:root {
  --bg: #142018;
  --bg2: #1c2c20;
  --panel: #243528;
  --ink: #f4efe4;
  --muted: #c3b8a4;
  --copper: #d4843c;
  --copper-hi: #f0c07a;
  --brass: #e8c27a;
  --grass: #2f8a42;
  --grass-dk: #1e5c2c;
  --cut: #c5de56;
  --danger: #e25a3c;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
#app, #cv, #screens, .screen {
  position: fixed; inset: 0;
}
#cv { z-index: 0; width: 100%; height: 100%; display: block; }
#screens { z-index: 3; pointer-events: none; }
.screen {
  pointer-events: auto;
  display: flex; flex-direction: column;
  padding: calc(20px + var(--safe-t)) 22px calc(20px + var(--safe-b));
  background:
    radial-gradient(80% 50% at 50% -10%, rgba(212,132,60,.28), transparent 55%),
    radial-gradient(70% 40% at 100% 100%, rgba(40,90,40,.35), transparent 50%),
    linear-gradient(180deg, #1a2a1c 0%, #101810 100%);
  overflow: hidden;
}
.screen[hidden], #hud[hidden], #dock[hidden], #hint[hidden], #celebrate[hidden] { display: none !important; }

.brand {
  margin: 8px 0 0; text-align: center;
  letter-spacing: .22em; text-transform: uppercase;
  font-size: 11px; color: var(--brass); font-weight: 600;
}
#sc-title h1 {
  margin: 10px 0 0; text-align: center;
  font-size: clamp(48px, 14vw, 72px); line-height: .9;
  letter-spacing: -0.04em;
  color: #f3f0e4;
  text-shadow: 0 2px 0 #1a3a1c, 0 8px 24px rgba(0,0,0,.35);
}
.tag {
  text-align: center; color: var(--muted);
  font-size: 17px; line-height: 1.35; margin: 14px 0 28px;
}
.stack { display: flex; flex-direction: column; gap: 12px; width: min(360px, 100%); margin: 0 auto; }
.btn {
  appearance: none; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 17px;
  color: var(--ink);
  background: var(--panel);
  border-radius: 16px;
  min-height: 52px; padding: 12px 18px;
  box-shadow: 0 2px 0 #0c140e, inset 0 1px 0 rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn.primary {
  background: linear-gradient(180deg, #e09a4c, #c56e28);
  color: #2a1608;
  box-shadow: 0 3px 0 #7a3e12, inset 0 1px 0 rgba(255,255,255,.28);
}
.btn.ghost { background: transparent; border: 1px solid rgba(232,194,122,.28); box-shadow: none; }
.btn:active { transform: translateY(1px); }
.text-btn {
  appearance: none; background: none; border: 0; color: var(--brass);
  font: inherit; font-weight: 600; font-size: 15px; padding: 8px 4px; cursor: pointer;
}
.muted { text-align: center; color: var(--muted); font-size: 14px; min-height: 1.2em; }
.coins {
  background: #2a2114; color: var(--brass);
  border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 700;
}
#dailyBadge { font-size: 12px; font-weight: 700; color: var(--cut); }

.sc-top {
  display: grid; grid-template-columns: 64px 1fr auto; align-items: center;
  gap: 8px; margin-bottom: 8px;
}
.sc-top h2 { margin: 0; text-align: center; font-size: 20px; letter-spacing: -0.02em; }
.back { text-align: left; }
.blurb { margin: 0 0 12px; color: var(--muted); text-align: center; font-size: 14px; }
.scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  touch-action: pan-y;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.hood {
  display: block; width: 100%; text-align: left;
  background: var(--panel); border: 0; color: inherit; font: inherit;
  border-radius: 16px; padding: 14px 16px; margin: 0 0 10px;
  box-shadow: 0 2px 0 #0c140e;
}
.hood[disabled] { opacity: .45; }
.hood-name { font-weight: 800; font-size: 17px; }
.hood-blurb { color: var(--muted); font-size: 13px; margin-top: 3px; }
.hood-meta { margin-top: 8px; font-size: 12px; color: var(--copper-hi); display: flex; justify-content: space-between; }

.level-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.lv {
  aspect-ratio: 1; border: 0; border-radius: 14px;
  background: var(--panel); color: var(--ink); font: inherit;
  font-weight: 800; font-size: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 2px 0 #0c140e;
}
.lv .stars { color: var(--brass); font-size: 11px; letter-spacing: 1px; font-weight: 700; }
.lv.locked { opacity: .4; }
.lv.done { background: #2c4a30; }

#hud {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 4;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  background: linear-gradient(180deg, rgba(16,24,16,.82), rgba(16,24,16,0));
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: rgba(20,32,24,.75); color: var(--ink);
  font-size: 18px; font-weight: 700; cursor: pointer;
}
#hudMid { flex: 1; min-width: 0; }
#hudName { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hudSub { font-size: 12px; color: var(--muted); }
#hudRight { text-align: right; }
#hudCut { font-weight: 800; font-size: 16px; }
#hudRegen { font-size: 11px; color: #b7e07a; }

#hint {
  z-index: 4; position: fixed; left: 16px; right: 16px;
  bottom: calc(88px + var(--safe-b));
  background: rgba(20,32,24,.9); color: var(--ink);
  border: 1px solid rgba(232,194,122,.25);
  border-radius: 14px; padding: 10px 14px;
  font-size: 14px; text-align: center; pointer-events: none;
}

#dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 4;
  display: flex; gap: 10px; justify-content: center;
  padding: 8px 16px calc(12px + var(--safe-b));
  background: linear-gradient(0deg, rgba(16,24,16,.9), rgba(16,24,16,0));
}
.dock-btn {
  min-width: 92px; min-height: 44px; padding: 8px 14px;
  border: 0; border-radius: 12px; cursor: pointer;
  background: rgba(36,53,40,.92); color: var(--ink);
  font: inherit; font-weight: 700; font-size: 15px;
}

#celebrate {
  z-index: 5; position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,12,8,.55); padding: 24px;
}
.cel-card {
  width: min(380px, 100%);
  background: linear-gradient(180deg, #2a3c28, #1a261c);
  border-radius: 24px; padding: 26px 22px 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08);
}
.cel-kicker { margin: 0; letter-spacing: .16em; text-transform: uppercase; font-size: 11px; color: var(--brass); }
#celTitle { margin: 6px 0 10px; font-size: 32px; letter-spacing: -0.03em; }
#celStars { font-size: 36px; color: var(--brass); letter-spacing: 6px; margin: 4px 0 8px; }
#celStats, #celCoins { margin: 0 0 6px; color: var(--muted); }
.cel-row { display: flex; gap: 10px; margin-top: 16px; }
.cel-row .btn { flex: 1; }

.shop-sec { margin: 6px 0 18px; }
.shop-sec h3 { margin: 0 0 10px; font-size: 14px; color: var(--brass); letter-spacing: .08em; text-transform: uppercase; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-item {
  background: var(--panel); border: 0; color: inherit; font: inherit;
  border-radius: 16px; padding: 12px; text-align: left; min-height: 88px;
}
.shop-item.on { outline: 2px solid var(--copper); }
.shop-item b { display: block; font-size: 15px; }
.shop-item span { font-size: 12px; color: var(--muted); }

.daily-card {
  margin-top: 20px; background: var(--panel); border-radius: 20px; padding: 22px;
  text-align: center;
}
.daily-card h3 { margin: 0 0 8px; font-size: 24px; }
.daily-card p { color: var(--muted); }
.daily-card .btn { width: 100%; margin-top: 16px; }

.pause-card {
  margin: auto; width: min(360px, 100%);
  background: var(--panel); border-radius: 24px; padding: 24px 20px;
}
.pause-card h2 { text-align: center; margin: 0 0 16px; }

#streakLine { margin-top: auto; padding-top: 16px; }
#btnTitleMute { margin: 4px auto 0; display: block; }
