:root {
  --paper: #fbf8ef;
  --paper-deep: #f1eadc;
  --ink: #24332e;
  --muted: #65756d;
  --green: #2f6f5e;
  --green-deep: #24584b;
  --leaf: #dcebdd;
  --sun: #f4bc62;
  --red: #c55549;
  --blue: #5277a8;
  --line: rgba(36, 51, 46, 0.12);
  --shadow: 0 18px 50px rgba(48, 70, 59, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(244, 188, 98, 0.24), transparent 34rem),
    linear-gradient(180deg, #fbf8ef 0%, #f5efe2 100%);
  font-size: 18px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 111, 94, 0.35);
  outline-offset: 3px;
}

.app-shell {
  width: 100%;
  max-width: 720px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px calc(98px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -18px -16px 10px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: rgba(251, 248, 239, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(36, 51, 46, 0.06);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 14px;
  font-size: 26px;
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.offline-badge,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--leaf);
  color: var(--green-deep);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.app-main {
  display: grid;
  gap: 16px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 24px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(36, 88, 75, 0.92), rgba(47, 111, 94, 0.7)),
    url("./assets/images/park-map-bg.png") center / cover;
  box-shadow: var(--shadow);
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -60px -90px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(244, 188, 98, 0.34);
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.hero-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.date-line {
  margin: 0;
  opacity: 0.88;
  font-size: 17px;
  font-weight: 700;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
  box-shadow: none;
}

.icon-btn:active {
  transform: scale(0.96);
}

.hero-title {
  max-width: 9em;
  margin-bottom: 18px;
  font-size: clamp(34px, 11vw, 54px);
  line-height: 0.98;
  letter-spacing: -0.07em;
}

.progress-road {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 12px 0 4px;
}

.road-line {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
}

.road-fill {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: 999px;
  background: var(--sun);
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 12px;
}

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

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

.metric {
  min-height: 108px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 26px rgba(48, 70, 59, 0.06);
}

.metric strong {
  display: block;
  margin-bottom: 6px;
  font-size: 31px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.metric span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 34px rgba(48, 70, 59, 0.08);
}

.soft-card {
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--paper-deep);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 14px;
}

.list {
  display: grid;
  gap: 12px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 15px;
  background: rgba(255, 255, 255, 0.78);
}

.row-title {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 900;
}

.row-sub {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.block-actions {
  margin: 16px 0 14px;
}

.block-actions + .soft-card,
.block-actions + .export-box {
  margin-top: 8px;
}

.export-actions {
  margin-bottom: 12px;
}

.export-actions + .export-box {
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(47, 111, 94, 0.22);
}

.btn.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-deep);
  box-shadow: none;
}

.btn.warning {
  background: var(--red);
  box-shadow: 0 10px 24px rgba(197, 85, 73, 0.18);
}

.btn.plain {
  min-height: 42px;
  padding: 9px 12px;
  background: var(--paper-deep);
  color: var(--green-deep);
  box-shadow: none;
}

.btn.full {
  width: 100%;
}

.entry-grid {
  display: grid;
  gap: 12px;
}

.entry {
  width: 100%;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  border: 0;
  border-radius: var(--radius-lg);
  padding: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 10px 24px rgba(48, 70, 59, 0.07);
}

.entry-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: var(--leaf);
  color: var(--green-deep);
  font-weight: 900;
}

.entry strong {
  display: block;
  font-size: 19px;
}

.entry span {
  color: var(--muted);
  font-size: 14px;
}

.form {
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.segment {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.segment.is-active {
  border-color: transparent;
  background: var(--green);
  color: #fff;
}

.status-normal {
  background: var(--leaf);
  color: var(--green-deep);
}

.status-watch {
  background: #e9f0fb;
  color: #315f94;
}

.status-attention {
  background: #fff0cf;
  color: #93610a;
}

.status-danger {
  background: #fae4df;
  color: #9b3f35;
}

.status-urgent {
  background: #7f2f2a;
  color: #fff;
}

.pressure-summary {
  border-left: 8px solid var(--green);
}

.pressure-summary.pressure-watch {
  border-left-color: var(--blue);
}

.pressure-summary.pressure-attention {
  border-left-color: var(--sun);
}

.pressure-summary.pressure-danger,
.pressure-summary.pressure-urgent {
  border-left-color: var(--red);
}

.pressure-latest {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.pressure-action {
  margin: 12px 0 8px;
  border-radius: 18px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.45;
}

.bp-legend,
.pantry-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.bp-legend span,
.pantry-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
}

.legend-dot.normal,
.legend-dot.stocked {
  background: var(--green);
}

.legend-dot.watch,
.legend-dot.noQuantity {
  background: var(--blue);
}

.legend-dot.attention {
  background: var(--sun);
}

.legend-dot.danger,
.legend-dot.urgent,
.legend-dot.restock {
  background: var(--red);
}

.legend-dot.finished {
  background: #9aa39f;
}

.pressure-row {
  border-left: 7px solid var(--green);
}

.pressure-row.pressure-watch {
  border-left-color: var(--blue);
}

.pressure-row.pressure-attention {
  border-left-color: var(--sun);
}

.pressure-row.pressure-danger,
.pressure-row.pressure-urgent {
  border-left-color: var(--red);
}

.bp-values {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.bp-value {
  display: inline-grid;
  min-width: 74px;
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 8px 11px;
  background: #fff;
}

.bp-value strong {
  font-size: 26px;
  line-height: 1;
}

.bp-value small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.bp-value.normal {
  background: var(--leaf);
}

.bp-value.watch {
  background: #e9f0fb;
}

.bp-value.attention {
  background: #fff0cf;
}

.bp-value.danger,
.bp-value.urgent {
  background: #fae4df;
}

.bp-slash {
  color: var(--muted);
  font-size: 24px;
  font-weight: 900;
}

.pantry-search {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  margin-bottom: 12px;
}

.pantry-search input {
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 15px;
  background: #fff;
  color: var(--ink);
}

.pantry-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -18px 12px;
  padding: 0 18px 6px;
  scrollbar-width: none;
}

.pantry-filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.filter-chip strong {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--green-deep);
  font-size: 12px;
}

.filter-chip.is-active {
  border-color: transparent;
  background: var(--green);
  color: #fff;
}

.filter-chip.is-active strong {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.pantry-table {
  display: grid;
  gap: 8px;
}

.pantry-head,
.pantry-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1.2fr) minmax(82px, 0.55fr) minmax(150px, 0.8fr);
  gap: 10px;
  align-items: center;
}

.pantry-head {
  padding: 0 10px 2px 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pantry-head span:nth-child(1) {
  grid-column: 2;
}

.pantry-row {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.86);
}

.pantry-marker {
  width: 8px;
  height: 100%;
  min-height: 50px;
  border-radius: 999px;
  background: var(--green);
}

.pantry-restock .pantry-marker {
  background: var(--red);
}

.pantry-noQuantity .pantry-marker {
  background: var(--blue);
}

.pantry-finished .pantry-marker {
  background: #9aa39f;
}

.pantry-main {
  min-width: 0;
}

.pantry-main .row-title,
.pantry-main .row-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pantry-qty {
  display: grid;
  justify-items: start;
}

.pantry-qty strong {
  font-size: 22px;
  line-height: 1;
}

.pantry-qty span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pantry-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.pantry-actions .btn {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 14px;
}

.pantry-pill {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 12px;
}

.pantry-pill-stocked {
  background: var(--leaf);
  color: var(--green-deep);
}

.pantry-pill-restock {
  background: #fae4df;
  color: #9b3f35;
}

.pantry-pill-noQuantity {
  background: #e9f0fb;
  color: #315f94;
}

.pantry-pill-finished {
  background: #e7e5df;
  color: #636c67;
}

.done {
  opacity: 0.62;
}

.done .row-title {
  text-decoration: line-through;
}

.empty {
  border: 1px dashed rgba(36, 51, 46, 0.22);
  border-radius: var(--radius-lg);
  padding: 18px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
  text-align: center;
}

.export-box {
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  width: min(720px, 100%);
  transform: translateX(-50%);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 252, 244, 0.94);
  backdrop-filter: blur(16px);
}

.tab {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  font-size: 15px;
}

.tab.is-active {
  color: var(--green-deep);
  background: var(--leaf);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-bottom));
  z-index: 20;
  width: min(92vw, 420px);
  transform: translateX(-50%);
  border-radius: 999px;
  padding: 13px 18px;
  background: rgba(36, 51, 46, 0.92);
  color: #fff;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow);
}

@media (max-width: 430px) {
  body {
    font-size: 17px;
  }

  .app-shell {
    padding-inline: 12px;
  }

  .topbar {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: stretch;
  }

  .row-actions .btn {
    flex: 1;
  }

  .pressure-latest {
    grid-template-columns: 1fr;
  }

  .pantry-search {
    grid-template-columns: 1fr;
  }

  .pantry-head {
    display: none;
  }

  .pantry-row {
    grid-template-columns: 8px minmax(0, 1fr) auto;
    align-items: start;
  }

  .pantry-qty {
    justify-items: end;
  }

  .pantry-actions {
    grid-column: 2 / -1;
    justify-content: stretch;
  }

  .pantry-actions .btn,
  .pantry-actions .pill {
    flex: 1 1 auto;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .tab {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .card,
  .hero-card,
  .entry,
  .row,
  .pantry-row {
    animation: rise 0.25s ease both;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}
