:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #f0f3ee;
  --text: #1d2520;
  --muted: #69736c;
  --line: #e1e6df;
  --green: #2f7d58;
  --green-deep: #1f5d43;
  --orange: #ff7a1a;
  --orange-soft: #fff0e5;
  --shadow: 0 16px 40px rgba(29, 37, 32, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a.primary-button,
a.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 56px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(225, 230, 223, 0.8);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
}

.search {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 8px;
}

.search:focus-within {
  background: var(--surface);
  border-color: rgba(47, 125, 88, 0.38);
}

.search-icon {
  margin-right: 8px;
  color: var(--muted);
  font-size: 20px;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.login-button,
.primary-button,
.secondary-button,
.load-more,
.segment,
.filter,
.period {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
}

.icon-button {
  width: 40px;
  color: var(--green-deep);
  background: var(--surface-soft);
  font-size: 24px;
  line-height: 1;
}

.login-button,
.primary-button {
  color: #ffffff;
  background: var(--green);
  padding: 0 16px;
}

.secondary-button {
  color: var(--green-deep);
  background: var(--surface-soft);
  padding: 0 16px;
}

main {
  padding-bottom: 96px;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 36px;
  align-items: end;
  padding: 38px clamp(16px, 4vw, 56px) 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: 44px;
  line-height: 1.1;
}

.hero-text {
  max-width: 560px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 110px);
  gap: 10px;
}

.hero-stats div {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-stats strong,
.hero-stats span {
  display: block;
}

.hero-stats strong {
  font-size: 20px;
}

.hero-stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.controls {
  position: sticky;
  top: 67px;
  z-index: 15;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(16px, 4vw, 56px);
  background: rgba(246, 247, 244, 0.94);
  backdrop-filter: blur(16px);
}

.segmented,
.ranking-filters,
.period-filters,
.filter-groups {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.segment,
.filter,
.period {
  flex: 0 0 auto;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0 14px;
}

.segment.active,
.filter.active,
.period.active {
  color: #ffffff;
  background: var(--orange);
  border-color: var(--orange);
}

.period {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.share-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.feed-section {
  padding: 8px clamp(16px, 4vw, 56px) 32px;
}

.feed-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

#resultSummary {
  flex: 0 0 auto;
  color: var(--green-deep);
  font-weight: 800;
}

.masonry {
  column-count: 5;
  column-gap: 16px;
}

.plant-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  break-inside: avoid;
  text-align: left;
}

.plant-card button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.plant-link {
  display: inline-flex;
  margin: 0 12px 12px;
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.plant-link:hover {
  text-decoration: underline;
}

.plant-card button:focus-visible,
.related-list button:focus-visible,
.icon-button:focus-visible,
.login-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.load-more:focus-visible,
.engagement-button:focus-visible,
.segment:focus-visible,
.filter:focus-visible,
.period:focus-visible {
  outline: 3px solid rgba(47, 125, 88, 0.28);
  outline-offset: 2px;
}

.plant-image {
  display: block;
  width: 100%;
  height: var(--card-h);
  object-fit: cover;
  background: #dfe7db;
}

.plant-body {
  padding: 12px;
}

.plant-head {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.tag {
  flex: 0 0 auto;
  max-width: 110px;
  overflow: hidden;
  color: #ffffff;
  background: var(--orange);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-badge {
  flex: 0 0 auto;
  color: var(--green-deep);
  background: #e9f3eb;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.plant-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.plant-desc {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.plant-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.lock-card {
  display: inline-flex;
  width: 100%;
  min-height: 220px;
  margin: 0 0 16px;
  padding: 22px;
  break-inside: avoid;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-linear-gradient(135deg, #ffffff, #ffffff 10px, #f4f6f1 10px, #f4f6f1 20px);
  text-align: center;
}

.lock-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.lock-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-image,
.skeleton-line {
  position: relative;
  overflow: hidden;
  background: #e8ede6;
}

.skeleton-image {
  height: var(--card-h);
}

.skeleton-line {
  height: 14px;
  margin-top: 10px;
  border-radius: 8px;
}

.skeleton-line.short {
  width: 42%;
}

.skeleton-line.tiny {
  width: 64%;
  height: 11px;
}

.skeleton-image::after,
.skeleton-line::after {
  position: absolute;
  inset: 0;
  content: "";
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.35s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.empty-state {
  padding: 64px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  margin-bottom: 8px;
  color: var(--text);
}

.load-more {
  display: block;
  margin: 10px auto 0;
  padding: 0 20px;
  color: var(--green-deep);
  background: var(--surface);
  border: 1px solid var(--line);
}

.install-bar {
  position: fixed;
  right: clamp(12px, 3vw, 28px);
  bottom: 18px;
  z-index: 18;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.install-copy {
  display: flex;
  gap: 10px;
  align-items: center;
}

.install-copy img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.install-copy strong,
.install-copy span {
  display: block;
}

.install-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.modal-backdrop,
.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 18, 14, 0.48);
}

.modal {
  position: relative;
  width: min(420px, 100%);
  padding: 24px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 34px 8px 0;
  font-size: 24px;
}

.modal p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 24px;
  line-height: 1;
}

.qr-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  height: 220px;
  margin: 0 auto 20px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-card svg {
  display: block;
  width: 196px;
  height: 196px;
}

.qr-card.is-loading {
  display: flex;
}

.qr-card.is-demo {
  border-color: rgba(255, 122, 26, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #fff8f2 100%);
}

.qr-card.is-expired {
  opacity: 0.52;
}

.qr-card.is-error {
  border-color: rgba(255, 77, 79, 0.3);
  background: #fffafa;
}

.qr-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 36px;
  color: var(--muted);
  background: var(--surface-soft);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

.login-status {
  min-height: 22px;
  margin: -8px 0 18px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.detail-drawer {
  place-items: stretch end;
  padding: 0;
}

.drawer-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 52vw) minmax(320px, 420px);
  width: min(1120px, 100%);
  height: 100%;
  margin-left: auto;
  background: var(--surface);
}

.drawer-close {
  z-index: 2;
}

.drawer-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #dfe7db;
}

.web-login-body,
.redirect-page-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #f6f7f4 0%, #ffffff 58%, #fff4ec 100%);
}

.web-login-shell,
.redirect-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
}

.web-login-panel,
.redirect-panel {
  width: min(460px, 100%);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.web-login-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  border-radius: 12px;
}

.web-login-panel h1,
.redirect-panel h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 6vw, 42px);
  line-height: 1.08;
}

.web-login-panel p,
.redirect-panel p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.7;
}

.redirect-search {
  width: 100%;
  margin: 0 0 18px;
}

.web-login-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.drawer-content {
  padding: 54px 30px 30px;
  overflow-y: auto;
}

.category-pill {
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
  margin-bottom: 12px;
  color: #ffffff;
  background: var(--orange);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-content h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
}

.drawer-content p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 24px 0;
}

.detail-meta div {
  padding: 12px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.detail-meta dt {
  color: var(--muted);
  font-size: 12px;
}

.detail-meta dd {
  margin: 6px 0 0;
  font-weight: 800;
}

.engagement-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: -8px 0 22px;
}

.engagement-button {
  display: inline-grid;
  grid-template-columns: auto minmax(0, auto);
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 10px;
  color: var(--green-deep);
  background: #eef6ef;
  border: 1px solid rgba(47, 125, 88, 0.16);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.engagement-button span {
  font-size: 17px;
  line-height: 1;
}

.engagement-button strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-section {
  margin: 24px 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.drawer-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.info-list {
  display: grid;
  gap: 8px;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.info-list span {
  color: var(--muted);
}

.info-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.thumb-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.thumb-row figure {
  margin: 0;
}

.thumb-row img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #dfe7db;
}

.thumb-row figcaption {
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related-list {
  display: grid;
  gap: 10px;
}

.related-list button {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  color: var(--text);
  background: var(--surface-soft);
  border: 0;
  border-radius: 8px;
  text-align: left;
}

.related-list img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
}

.related-list span {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.full-width {
  width: 100%;
}

.detail-page-body main {
  padding-bottom: 64px;
}

.plant-detail-shell {
  padding: 24px clamp(16px, 4vw, 56px) 120px;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
  align-items: start;
}

.detail-photo-wrap {
  position: sticky;
  top: 92px;
  overflow: hidden;
  background: #dfe7db;
  border-radius: 8px;
}

.detail-photo {
  display: block;
  width: 100%;
  max-height: calc(100vh - 130px);
  object-fit: cover;
}

.detail-info-panel {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-state {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.detail-info-panel h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.18;
}

.detail-info-panel p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.detail-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.detail-actions-row button {
  flex: 1;
}

.detail-section {
  margin-top: 28px;
}

.detail-section h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.detail-thumb-grid,
.detail-related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.detail-thumb-grid figure {
  margin: 0;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-thumb-grid img,
.detail-related-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #dfe7db;
}

.detail-thumb-grid figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.detail-related-grid a {
  display: block;
  padding: 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

.detail-related-grid span {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .masonry {
    column-count: 4;
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .search {
    grid-column: 1 / -1;
    order: 3;
  }

  .hero-band {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .controls {
    top: 120px;
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-groups {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .masonry {
    column-count: 3;
  }

  .drawer-panel {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .drawer-image {
    height: 52vh;
  }

  .drawer-content {
    overflow: visible;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-photo-wrap {
    position: static;
  }

  .detail-photo {
    max-height: none;
  }

  .detail-thumb-grid,
  .detail-related-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    gap: 12px;
    padding: 12px;
  }

  .brand-name {
    font-size: 17px;
  }

  .login-button {
    padding: 0 12px;
  }

  h1 {
    font-size: 30px;
  }

  .hero-band {
    padding: 24px 12px 14px;
  }

  .hero-stats {
    display: none;
  }

  .controls,
  .feed-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .feed-status {
    flex-direction: column;
    gap: 4px;
  }

  .masonry {
    column-count: 2;
    column-gap: 10px;
  }

  .plant-card,
  .lock-card {
    margin-bottom: 10px;
  }

  .plant-image {
    height: calc(var(--card-h) * 0.78);
  }

  .plant-body {
    padding: 10px;
  }

  .install-bar {
    right: 10px;
    left: 10px;
    bottom: 10px;
    justify-content: space-between;
  }

  .install-copy span {
    max-width: 170px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions button {
    width: 100%;
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }

  .thumb-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .plant-detail-shell {
    padding: 16px 12px 110px;
  }

  .detail-info-panel {
    padding: 18px;
  }

  .detail-info-panel h1 {
    font-size: 28px;
  }

  .detail-actions-row {
    flex-direction: column;
  }

  .detail-thumb-grid,
  .detail-related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
