:root {
  --cream: #f7f0e6;
  --paper: #fffaf3;
  --ink: #3b322c;
  --muted: #7a6d62;
  --line: #eadccb;
  --leaf: #5b8f7b;
  --leaf-deep: #3f6d5d;
  --leaf-soft: #e4f0ea;
  --clay: #c46b4a;
  --clay-soft: #f6e4db;
  --gold: #d4a054;
  --gold-soft: #f7ead3;
  --rose: #e8c4bc;
  --shadow: 0 12px 30px rgba(90, 62, 44, 0.08);
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--cream); color: var(--ink); }
body {
  background-image:
    radial-gradient(circle at 12% -8%, #fde8d8 0, transparent 32%),
    radial-gradient(circle at 100% 0, #e7f3ec 0, transparent 28%);
}
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--leaf-deep); }

.app {
  width: min(430px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(12px + var(--safe-t)) 16px calc(92px + var(--safe-b));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px;
  background:
    linear-gradient(180deg, #f6d9b8, #e8b88a 55%, #c9895d);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.4);
  position: relative;
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
}
.brand-mark::before {
  top: 6px; width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 8px solid #5b8f7b;
}
.brand-mark::after {
  top: 13px; width: 14px; height: 12px; background: #fffaf3; border-radius: 2px 2px 3px 3px;
}
.brand-text { font-family: "Noto Serif TC", serif; font-weight: 700; letter-spacing: 0.04em; }

.install-chip {
  border: 0; background: var(--leaf-soft); color: var(--leaf-deep);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 500;
}

.view { animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hero, .card, .stamp-card, .share-card, .stat {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.hero {
  border-radius: 28px;
  padding: 22px 20px 20px;
  position: relative;
  overflow: hidden;
}
.hero h1 {
  font-family: "Noto Serif TC", serif;
  font-size: 28px;
  line-height: 1.3;
  margin: 0 0 10px;
}
.hero h1 { padding-right: 92px; }
.hero p, .lede, .muted { color: var(--muted); line-height: 1.7; margin: 0; }
.hero > p { padding-right: 88px; }
.hero-art { position: absolute; right: -4px; top: 8px; width: 108px; opacity: .92; pointer-events: none; }

.actions { display: grid; gap: 10px; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 18px; text-decoration: none;
  font-weight: 500; cursor: pointer;
}
.btn-primary { background: var(--leaf); color: #fff; }
.btn-ghost { background: var(--clay-soft); color: #8a4b35; }
.btn-line { background: #06c755; color: #fff; }
.btn-wide { width: 100%; }

.section-title {
  font-family: "Noto Serif TC", serif;
  font-size: 18px; margin: 22px 0 10px;
}

.practice-grid, .stats-grid, .stamp-grid { display: grid; gap: 10px; }
.practice-grid { grid-template-columns: 1fr 1fr; }
.chip-card, .stat, .card {
  border-radius: var(--radius);
  padding: 14px;
}
.chip-card {
  background: var(--paper);
  border: 1px solid var(--line);
  min-height: 86px;
}
.chip-card strong { display: block; margin-bottom: 4px; }
.chip-card span { color: var(--muted); font-size: 13px; line-height: 1.5; }

.stats-grid { grid-template-columns: 1fr 1fr; }
.stat { text-align: center; padding: 16px 10px; }
.stat b { display: block; font-family: "Noto Serif TC", serif; font-size: 28px; color: var(--leaf-deep); }
.stat span { color: var(--muted); font-size: 13px; }

.tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(430px, 100%);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,250,243,.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + var(--safe-b));
}
.tabbar a {
  text-decoration: none; color: var(--muted); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0;
}
.tabbar a.active { color: var(--leaf-deep); font-weight: 700; }
.tabbar a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.banner {
  border-radius: 16px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
  background: var(--gold-soft); color: #7a5a20;
}
.card { margin-bottom: 14px; }
.card h2, .card h3 { margin: 0 0 8px; font-size: 18px; font-family: "Noto Serif TC", serif; }
label { display: block; font-size: 14px; margin: 0 0 6px; }
input[type="text"] {
  width: 100%; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; padding: 12px 14px; margin-bottom: 12px; outline: none;
}
input[type="text"]:focus { border-color: var(--leaf); box-shadow: 0 0 0 3px var(--leaf-soft); }

.iframe-wrap {
  border-radius: 18px; overflow: hidden; border: 1px solid var(--line);
  background: #fff; min-height: 70vh;
}
.iframe-wrap iframe { width: 100%; height: 78vh; border: 0; background: #fff; }

.stamp-grid { grid-template-columns: 1fr 1fr; }
.stamp-card {
  border-radius: 24px; padding: 16px 12px 14px; text-align: center; min-height: 168px;
}
.seal {
  width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 50%;
  display: grid; place-items: center;
  border: 3px dashed var(--line); color: var(--muted); font-weight: 700; font-size: 15px;
  background: #f3eee6;
}
.seal.done {
  border: 3px solid var(--leaf);
  background: radial-gradient(circle at 30% 30%, #eff8f3, #cfe4d8);
  color: var(--leaf-deep);
  box-shadow: 0 0 0 6px rgba(91,143,123,.12);
  transform: rotate(-8deg);
}
.seal.na {
  border-style: solid; background: #f4f0ea; color: #9a8d82;
}
.stamp-card small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 6px; }
.progress-note { margin: 8px 0 0; color: var(--muted); }

.share-card { border-radius: 20px; padding: 16px; margin-bottom: 12px; }
.share-card p { margin: 0; line-height: 1.75; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { background: var(--leaf-soft); color: var(--leaf-deep); border-radius: 999px; padding: 3px 8px; font-size: 12px; }
.date { color: var(--muted); font-size: 12px; margin-top: 8px; }

.bars { display: grid; gap: 10px; margin: 8px 0 4px; }
.bar-row { display: grid; grid-template-columns: 88px 1fr 36px; gap: 8px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: #efe6d8; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--leaf), #8fbfa8); border-radius: inherit; }

.about h2 { font-family: "Noto Serif TC", serif; font-size: 20px; margin: 0 0 8px; }
.about p, .about li { line-height: 1.8; color: #4d433c; }
.about ol, .about ul { padding-left: 1.2em; }
.quote {
  background: var(--clay-soft); border-radius: 18px; padding: 14px 16px;
  font-family: "Noto Serif TC", serif; margin: 0 0 14px;
}

.sheet {
  position: fixed; inset: 0; background: rgba(40, 28, 20, .35);
  display: grid; place-items: end center; z-index: 20;
}
.sheet[hidden] { display: none; }
.sheet-card {
  width: min(430px, 100%); background: var(--paper);
  border-radius: 24px 24px 0 0; padding: 22px 20px calc(20px + var(--safe-b));
}
.install-steps { padding-left: 1.2em; color: var(--muted); line-height: 1.7; }

.center { text-align: center; }
.error { background: #fdeceb; color: #8a3a32; border-radius: 14px; padding: 10px 12px; font-size: 14px; }
.reward {
  background: linear-gradient(180deg, #fff6e4, #f4e0b7);
  border: 1px solid #e6c57a; border-radius: 22px; padding: 16px; text-align: center; margin-bottom: 14px;
}
.reward strong { font-family: "Noto Serif TC", serif; font-size: 20px; display: block; margin-bottom: 4px; }

.stamp-card.is-bonus strong em {
  display: inline-block; margin-left: 6px; font-style: normal; font-weight: 500;
  font-size: 11px; background: var(--gold-soft); color: #7a5a20;
  border-radius: 999px; padding: 1px 7px; vertical-align: middle;
}
.seal.done.bonus {
  border-color: var(--gold);
  background: radial-gradient(circle at 30% 30%, #fff6e4, #f3dd9f);
  color: #7a5a20;
  box-shadow: 0 0 0 6px rgba(212, 160, 84, .16);
}
