:root {
  --bg0: #f3efe6;
  --bg1: #e7f0ea;
  --ink: #1a2e28;
  --ink-soft: #3d524a;
  --brand: #1f5c4a;
  --brand-2: #c46b2c;
  --card: rgba(255, 252, 247, 0.92);
  --line: rgba(26, 46, 40, 0.12);
  --ok: #2a7a4b;
  --warn: #9a5b1a;
  --danger: #8b3a2f;
  --radius: 18px;
  --font: "Be Vietnam Pro", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --shadow: 0 12px 40px rgba(31, 92, 74, 0.08);
  font-size: calc(16px * var(--font-scale, 1));
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #dfece4 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #f6e4d4 0%, transparent 50%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  line-height: 1.45;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 1rem 1rem 5.5rem;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(31, 92, 74, 0.18);
}
.brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.15;
}
.brand strong {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand small {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand);
  font-weight: 600;
}
.hero-brand {
  display: flex;
  justify-content: center;
  margin: 0.35rem 0 0.65rem;
}
.hero-logo {
  width: min(140px, 38vw);
  height: auto;
  border-radius: 28px;
  box-shadow: 0 8px 28px rgba(31, 92, 74, 0.18);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(31, 92, 74, 0.1);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 600;
}

.banner {
  background: #fff7e8;
  border: 1px solid rgba(154, 91, 26, 0.25);
  color: var(--warn);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.banner-sticky {
  /* UI-P0-04: milestone disclaimer — no dismiss control */
  border-color: rgba(31, 92, 74, 0.3);
  background: #eef6f1;
  color: var(--brand);
}
.banner button {
  margin-left: 0.5rem;
  background: none;
  border: none;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  min-height: 44px;
}

.ia-note {
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
}

.card-done {
  opacity: 0.92;
  border-style: dashed;
}
.done-chip {
  background: rgba(42, 122, 75, 0.15) !important;
  color: var(--ok) !important;
  font-weight: 600;
  vertical-align: middle;
}

.cta-sticky {
  position: sticky;
  bottom: calc(4.75rem + env(safe-area-inset-bottom));
  z-index: 15;
  padding: 0.65rem 0 0.25rem;
  margin-top: 0.5rem;
  background: linear-gradient(180deg, transparent, var(--bg0) 28%);
}

:focus-visible {
  outline: 3px solid rgba(31, 92, 74, 0.55);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

.milestone-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
.milestone-list li {
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
}
.milestone-list li:first-child { border-top: none; padding-top: 0; }
.milestone-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}
.milestone-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}
.milestone-actions button {
  appearance: none;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.55rem 0.35rem;
  min-height: 44px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.milestone-actions button[aria-pressed="true"] {
  border-color: var(--brand);
  background: rgba(31, 92, 74, 0.12);
  color: var(--brand);
  font-weight: 600;
}

.hero-panel {
  padding: 1.4rem 0 0.5rem;
}
.hero-panel h1 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 6vw, 2.35rem);
  line-height: 1.15;
  margin: 0.35rem 0 0.75rem;
  letter-spacing: -0.02em;
}
.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
}
.lede {
  color: var(--ink-soft);
  margin: 0 0 1.25rem;
  font-size: 1.02rem;
}

.stack { display: grid; gap: 0.85rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.card h2, .card h3 {
  font-family: var(--display);
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0;
}
.chip {
  font-size: 0.75rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(26, 46, 40, 0.06);
  color: var(--ink-soft);
}
.chip.domain { background: rgba(31, 92, 74, 0.12); color: var(--brand); font-weight: 600; }

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 0.85rem 1.1rem;
  min-height: 48px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--brand);
  color: #f7fff9;
  box-shadow: 0 8px 20px rgba(31, 92, 74, 0.25);
}
.btn-secondary {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid rgba(31, 92, 74, 0.35);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  padding-left: 0;
  padding-right: 0;
}
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.btn-block { width: 100%; }

label.field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
}
input, select, textarea {
  font: inherit;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 80px; resize: vertical; }

.steps { margin: 0.75rem 0 0; padding-left: 1.15rem; }
.steps li { margin: 0.35rem 0; }
.phrases {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.phrase {
  background: rgba(196, 107, 44, 0.12);
  color: #7a4318;
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  font-size: 0.88rem;
}
.safety {
  margin-top: 0.85rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: rgba(139, 58, 47, 0.08);
  color: var(--danger);
  font-size: 0.9rem;
}
.muted { color: var(--ink-soft); font-size: 0.92rem; }
.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--ink-soft);
}

.feedback-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.feedback-row button {
  padding: 0.85rem 0.4rem;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  cursor: pointer;
}
.feedback-row button[aria-pressed="true"] {
  border-color: var(--brand);
  background: rgba(31, 92, 74, 0.1);
  font-weight: 600;
}

.nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.25rem;
  padding: 0.55rem 0.65rem calc(0.55rem + env(safe-area-inset-bottom));
  background: rgba(255, 252, 247, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 20;
}
.nav button {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0.5rem 0.1rem;
  min-height: 48px;
  min-height: 48px;
  border-radius: 12px;
  cursor: pointer;
}
.nav button[aria-current="page"] {
  color: var(--brand);
  background: rgba(31, 92, 74, 0.1);
}
.nav span { display: block; font-size: 1.05rem; margin-bottom: 0.1rem; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.filters button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  min-height: 44px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.filters button[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.list-item {
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}
.list-item:hover { border-color: rgba(31, 92, 74, 0.35); }

.topbar-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.gx-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 2px solid #e8c56a;
  border-radius: 999px;
  background: #fff3d6;
  color: #5c3d00;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(92, 61, 0, 0.12);
}
.gx-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.gx-chip span { font-size: 0.78rem; color: #8a5a00; font-weight: 700; white-space: nowrap; }
.gx-today { margin: 0.35rem 0 0; color: var(--ink); }
.gx-promo-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.gx-promo-row img { border-radius: 50%; flex-shrink: 0; }
.gx-big { display: block; margin: 0 auto 0.75rem; border-radius: 50%; }
.celebrate-card { text-align: center; }
.gx-balance-line { font-size: 1.15rem; color: var(--teal, #1f5c4a); }

.resource-art {
  display: flex;
  justify-content: center;
  margin: 0.85rem 0;
  padding: 0.75rem;
  background: #fff;
  border-radius: 12px;
  border: 1px dashed var(--line);
}
.resource-art img {
  width: min(280px, 85vw);
  height: auto;
  background: #fff;
  border-radius: 12px;
}
.resource-art-btn {
  display: block;
  width: 100%;
  border: 1px dashed var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 0.75rem;
  cursor: zoom-in;
  position: relative;
  margin: 0.5rem 0 0;
}
.resource-art-btn.hero img {
  width: min(100%, 420px);
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 14px;
}
.resource-art-btn img {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
}
.zoom-badge {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--teal, #1f5c4a);
}
.res-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-align: left;
}
.res-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--line);
}
.res-row-text { flex: 1; min-width: 0; }
.res-row-text h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.resource-body {
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 1.02rem;
  line-height: 1.55;
  background: rgba(31, 92, 74, 0.06);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 0;
  overflow-x: auto;
}

.shop-page { padding-bottom: 5rem; }
.shop-settings { margin: 0.75rem 0 1rem; }
.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.35rem 0;
  font-weight: 600;
}
.shop-msg {
  color: #c45c2c;
  font-weight: 600;
  margin: 0 0 0.75rem;
}
.shop-tier {
  grid-column: 1 / -1;
  margin: 0.85rem 0 0.25rem;
  color: var(--teal, #1f5c4a);
  font-size: 1.05rem;
}
.shop-caution { grid-column: 1 / -1; margin: 0 0 0.5rem; color: #b42318; }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.shop-tile {
  background: var(--paper, #fffbf5);
  border: 1.5px solid #c5d9d5;
  border-radius: 16px;
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: stretch;
}
.shop-tile-art {
  aspect-ratio: 1;
  background: #f0ebe3;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.shop-tile-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.35rem;
}
.shop-tile h4 {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.25;
  min-height: 2.4em;
  text-align: center;
}
.shop-price {
  display: inline-flex;
  align-self: center;
  align-items: center;
  gap: 0.3rem;
  background: #fff3d6;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  color: #8a5a00;
}
.shop-price img { border-radius: 50%; }
.gx-recent { padding-left: 1.1rem; color: var(--muted, #5c6f6b); }

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.94);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.lightbox.open { display: flex; }
.lightbox-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 2;
}
.lightbox-title {
  margin: 0;
  color: #fff;
  font-weight: 700;
  text-align: center;
  font-size: 1.15rem;
}
.lightbox-close { width: min(100%, 360px); }
.lightbox-img {
  max-width: min(96vw, 900px);
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  touch-action: pinch-zoom;
}
.lightbox-hint {
  position: absolute;
  bottom: max(1rem, env(safe-area-inset-bottom));
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  margin: 0;
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
