/* FocusTown v0.1 — midnight + gold theme, mobile-first. */
:root {
  --gold: #f5b942;
  --gold-soft: #ffd97a;
  --bg: #0e0d1d;
  --bg2: #17152e;
  --card: #1d1a38;
  --card2: #26224a;
  --text: #f4f1e8;
  --muted: #a9a4c4;
  --border: #35315c;
  --accent: #f5b942;
  --green: #4cc38a;
  --red: #e26d5a;
  --radius: 16px;
}
html[data-theme="light"] {
  --bg: #f6f2e7;
  --bg2: #efe8d6;
  --card: #fffdf6;
  --card2: #f3ecda;
  --text: #241f1a;
  --muted: #6d6353;
  --border: #ddd2b8;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Sinhala", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 720px; margin: 0 auto; padding: 0 12px calc(96px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.25rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
h4 { font-size: 0.95rem; margin: 12px 0 6px; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
small { font-size: 0.82rem; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 2px 10px; position: sticky; top: 0; background: var(--bg); z-index: 20; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--gold), #c98a2e); color: #241a05; font-weight: 800; display: grid; place-items: center; font-size: 1.05rem; }
.brand strong { display: block; font-size: 1.1rem; }
.brand small { color: var(--muted); }
.top-stats { display: flex; gap: 6px; }
.stat-pill { background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; font-size: 0.85rem; white-space: nowrap; }

/* Cards & screens */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
.screen { display: none; animation: fadein .25s ease; }
.screen.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
body.reduced-motion .screen { animation: none; }
body.perf-mode * { animation: none !important; transition: none !important; }

/* Buttons */
.btn { background: var(--card2); border: 1px solid var(--border); border-radius: 12px; padding: 11px 16px; min-height: 44px; font-weight: 600; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: linear-gradient(135deg, var(--gold), #e09a1f); color: #241a05; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.big { font-size: 1.1rem; padding: 14px 28px; }
.btn.small { padding: 8px 12px; min-height: 38px; font-size: 0.88rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.btn-row.wrap { flex-wrap: wrap; }
.chip { display: inline-block; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 0.8rem; margin: 2px; }

/* Hero / dashboard */
.hero { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; background: linear-gradient(135deg, #221d4d, #1d1a38 60%, #3a2c10); }
html[data-theme="light"] .hero { background: linear-gradient(135deg, #fdf3d0, #f3ecda); }
.big-days { font-size: 2rem; font-weight: 800; margin: 4px 0; }
.big-days small { font-size: 1rem; font-weight: 600; color: var(--muted); }
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--border) 0); }
.ring.big { width: 220px; height: 220px; margin: 14px auto; }
.ring-inner { width: 78%; height: 78%; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 2px; }
.hero-ring { text-align: center; }
.xp-row { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
.xp-bar, .mini-bar, .bar-track { flex: 1; height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.xp-bar > div, .mini-bar > div, .bar-fill { height: 100%; background: var(--gold); border-radius: 999px; transition: width .4s ease; }
.subj-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.subj-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.subj-name { width: 84px; }
.subj-mins { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.clean-list { list-style: none; margin: 0; padding: 0; }
.clean-list li { padding: 9px 2px; border-bottom: 1px solid var(--border); }
.clean-list li.done { color: var(--muted); text-decoration: line-through; }
.clean-list li:last-child { border-bottom: 0; }
.comp-picker { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.comp-pick { background: var(--bg2); border: 2px solid var(--border); border-radius: 14px; padding: 8px; min-width: 64px; min-height: 64px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.comp-pick.sel { border-color: var(--gold); background: #f5b94222; }
.comp-pick span { font-size: 1.8rem; }
.companion-face { width: 64px; height: 64px; border-radius: 50%; border: 2px solid; display: grid; place-items: center; flex: none; }
.comp-emoji { font-size: 2.2rem; }
#companionMini { display: flex; gap: 12px; align-items: center; }
.settings-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-label { display: flex; gap: 8px; align-items: center; }

/* Timer */
.timer-card { text-align: center; }
.field { display: block; text-align: left; margin: 10px 0; font-weight: 600; }
.field select, .field input { display: block; width: 100%; margin-top: 6px; }
.field.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.field.inline input { width: 70px; margin: 0; }
.mode-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; margin: 10px 0; }
.timer-display { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 1px; }

/* Focus screen */
.focus-screen { position: fixed; inset: 0; background: #0a0918; color: #f4f1e8; z-index: 60; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; }
.focus-screen.open { display: flex; }
.focus-screen #btnExitFocus { position: absolute; top: 16px; right: 16px; }
.focus-companion { font-size: 5rem; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.focus-clock { font-size: 4rem; font-weight: 800; font-variant-numeric: tabular-nums; margin: 10px 0; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 70; display: none; align-items: flex-end; justify-content: center; }
.modal.open { display: flex; }
.modal-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px 20px 0 0; padding: 20px; width: 100%; max-width: 560px; }
.modal-card input { width: 100%; margin: 10px 0; }
.stars { display: flex; gap: 4px; margin: 8px 0; }
.stars button { font-size: 2rem; background: none; border: 0; color: var(--muted); padding: 4px 6px; min-width: 44px; min-height: 44px; }
.stars button.sel { color: var(--gold); }

/* Rooms */
.room-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.room-card { background: var(--bg2); border: 2px solid var(--border); border-radius: 14px; padding: 8px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.room-card.sel { border-color: var(--acc, var(--gold)); box-shadow: 0 0 0 2px var(--acc, var(--gold)); }
.room-thumb { height: 64px; border-radius: 10px; display: block; }
.room-name { font-weight: 700; font-size: 0.9rem; }
.room-card small { color: var(--muted); }
.room-scene { position: relative; height: 420px; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); cursor: crosshair; touch-action: manipulation; }
.room-window { position: absolute; left: 50%; top: 8%; transform: translateX(-50%); width: 46%; height: 34%; border-radius: 50% 50% 8px 8px; background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--acc) 55%, white), transparent 75%), linear-gradient(180deg, #ffffff33, transparent); border: 6px solid rgba(255,255,255,.25); box-shadow: 0 0 40px color-mix(in srgb, var(--acc) 60%, transparent); }
.win-round { border-radius: 50%; }
.win-tall { border-radius: 12px; height: 42%; }
.win-porthole { border-radius: 50%; width: 34%; height: 26%; border-width: 10px; }
.win-open { border-radius: 8px; }
.room-floor { position: absolute; left: 0; right: 0; bottom: 0; height: 34%; background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.5)); }
.room-decor { position: absolute; inset: 0; pointer-events: none; }
.decor { position: absolute; font-size: 1.4rem; }
.decor-shelves { left: 4%; top: 30%; width: 16%; height: 30%; background: repeating-linear-gradient(180deg, #6b4a2f 0 8px, #4a3220 8px 12px); border-radius: 6px; }
.decor-globe { right: 6%; top: 46%; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #7fb3d5, #2a5a7a); }
.decor-plants { left: 8%; bottom: 30%; width: 30px; height: 44px; background: radial-gradient(circle at 50% 0, #4cc38a 30%, transparent 70%); }
.decor-fire { right: 10%; bottom: 32%; width: 52px; height: 40px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, #ff8c42, #c93a1e); box-shadow: 0 0 30px #ff8c42aa; }
.decor-stars::after { content: "✦ ✧ ✦"; color: #fff; letter-spacing: 18px; position: absolute; top: 6%; left: 8%; }
.decor-trees { left: 2%; top: 20%; width: 60px; height: 90px; background: radial-gradient(circle at 50% 20%, #2e6b34, transparent 70%); }
.decor-coral { left: 5%; bottom: 28%; width: 70px; height: 40px; background: radial-gradient(circle at 30% 80%, #ff7f9e, transparent 60%), radial-gradient(circle at 70% 80%, #ffb86b, transparent 60%); }
.decor-lamp { right: 8%; top: 34%; width: 26px; height: 40px; background: #f5b942; border-radius: 50% 50% 4px 4px; box-shadow: 0 0 26px #f5b942; }
/* Extra decor (one visual per room decor item, so no room renders bare) */
.decor-candles { right: 6%; bottom: 34%; width: 34px; height: 22px; background: repeating-linear-gradient(90deg, #f5d9a0 0 6px, transparent 6px 12px); border-bottom: 3px solid #8a6a3a; }
.decor-counter { left: 0; bottom: 30%; width: 34%; height: 14px; background: #5d3f2a; border-radius: 4px; box-shadow: 0 3px 0 #4a3220; }
.decor-menu { left: 6%; top: 22%; width: 44px; height: 56px; background: #2a2118; border: 2px solid #8a6a3a; border-radius: 6px; }
.decor-rain { left: 28%; top: 8%; width: 44%; height: 34%; background: repeating-linear-gradient(115deg, transparent 0 10px, rgba(180,210,235,.35) 10px 12px, transparent 12px 22px); border-radius: 12px; }
.decor-mug { left: 12%; bottom: 36%; width: 26px; height: 22px; background: #c96f4a; border-radius: 4px 4px 10px 10px; }
.decor-blanket { right: 12%; bottom: 30%; width: 56px; height: 20px; background: repeating-linear-gradient(90deg, #7a4a6b 0 10px, #e8c07a 10px 20px); border-radius: 6px; }
.decor-palms { left: 4%; top: 16%; width: 70px; height: 60px; background: radial-gradient(circle at 30% 30%, #2e7a3d 30%, transparent 65%), radial-gradient(circle at 70% 40%, #3d8a4a 30%, transparent 65%); }
.decor-sun { right: 10%; top: 10%; width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #fff3b0, #ffb347); box-shadow: 0 0 30px #ffb347aa; }
.decor-shells { left: 8%; bottom: 30%; width: 60px; height: 18px; background: radial-gradient(circle at 20% 50%, #ff9ebb 30%, transparent 60%), radial-gradient(circle at 55% 50%, #ffd166 30%, transparent 60%), radial-gradient(circle at 85% 50%, #fff 30%, transparent 60%); }
.decor-fireflies { right: 8%; top: 14%; width: 60px; height: 50px; background: radial-gradient(circle at 20% 30%, #d8f79a 3px, transparent 5px), radial-gradient(circle at 60% 60%, #d8f79a 3px, transparent 5px), radial-gradient(circle at 85% 25%, #fff3b0 3px, transparent 5px); }
.decor-mushrooms { left: 6%; bottom: 30%; width: 44px; height: 22px; background: radial-gradient(circle at 25% 60%, #e26d5a 30%, transparent 55%), radial-gradient(circle at 70% 60%, #f5b942 30%, transparent 55%); }
.decor-planet { right: 8%; top: 8%; width: 52px; height: 52px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #b08ae8, #5a2a8a); box-shadow: 0 0 0 4px rgba(255,255,255,.15); }
.decor-console { right: 4%; bottom: 34%; width: 64px; height: 26px; background: #1a2038; border: 1px solid #3a4a6b; border-radius: 6px; }
.decor-aurora { left: 0; top: 6%; width: 100%; height: 30%; background: linear-gradient(100deg, transparent 10%, rgba(126,240,193,.35) 35%, rgba(127,212,255,.3) 60%, transparent 85%); }
.decor-pines { left: 2%; top: 24%; width: 70px; height: 80px; background: linear-gradient(180deg, #0d2b26 0 30%, transparent 30%), radial-gradient(circle at 30% 40%, #14343f 35%, transparent 70%); }
.decor-luggage { right: 6%; bottom: 30%; width: 46px; height: 26px; background: #6b4a2f; border-radius: 5px; border-top: 3px solid #4a3220; }
.decor-ticket { left: 10%; bottom: 38%; width: 34px; height: 18px; background: #f4f1e8; border-radius: 3px; transform: rotate(-8deg); }
.decor-rug { left: 50%; bottom: 30%; transform: translateX(-50%); width: 120px; height: 18px; border-radius: 50%; background: repeating-radial-gradient(circle, #8a3a2e 0 6px, #e8c07a 6px 12px); }
.decor-books { left: 4%; bottom: 34%; width: 54px; height: 30px; background: repeating-linear-gradient(90deg, #c94f4f 0 8px, #4f7ac9 8px 16px, #4cc38a 16px 24px, #f5b942 24px 32px); border-radius: 3px; }
.decor-fish { right: 10%; top: 30%; width: 60px; height: 30px; background: radial-gradient(ellipse at 30% 50%, #ffb86b 30%, transparent 60%), radial-gradient(ellipse at 75% 50%, #5fe0d0 30%, transparent 60%); }
.decor-rays { left: 20%; top: 0; width: 60%; height: 40%; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.18) 45%, transparent 55%, rgba(255,255,255,.12) 70%, transparent 85%); }
.decor-bonsai { left: 8%; bottom: 30%; width: 40px; height: 48px; background: radial-gradient(circle at 50% 25%, #4a7a3d 40%, transparent 70%); border-bottom: 6px solid #4a3220; }
.decor-stones { right: 8%; bottom: 30%; width: 56px; height: 18px; background: radial-gradient(circle at 25% 60%, #9a9a9a 35%, transparent 60%), radial-gradient(circle at 65% 60%, #7a7a7a 35%, transparent 60%); }
.decor-lantern { left: 10%; top: 18%; width: 26px; height: 34px; background: #d94f3d; border-radius: 8px; box-shadow: 0 0 22px #d94f3daa; }
.decor-lights { left: 10%; top: 6%; width: 80%; height: 22px; background: radial-gradient(circle at 10% 50%, #ffd166 4px, transparent 6px), radial-gradient(circle at 35% 50%, #ff7f9e 4px, transparent 6px), radial-gradient(circle at 60% 50%, #7fd4ff 4px, transparent 6px), radial-gradient(circle at 85% 50%, #a8d56a 4px, transparent 6px); }
.decor-antenna { right: 12%; top: 8%; width: 4px; height: 60px; background: #555; border-radius: 2px; box-shadow: 0 -6px 0 2px #ff5a5a; }
.decor-skyline { left: 0; right: 0; bottom: 34%; height: 70px; background: linear-gradient(180deg, transparent, #1a1430 70%), repeating-linear-gradient(90deg, #241d4d 0 22px, transparent 22px 34px, #2c2350 34px 52px, transparent 52px 64px); }
/* Extra window shapes (fallback is the arch in .room-window) */
.win-canopy { border-radius: 50% 50% 12px 12px; border-color: rgba(168,213,106,.5); }
.win-aurora { border-radius: 40% 40% 10px 10px; height: 44%; }
.win-train { border-radius: 10px; width: 62%; height: 30%; }
.win-small { border-radius: 8px; width: 26%; height: 18%; }
.win-bubble { border-radius: 50%; width: 32%; height: 26%; }
.win-garden { border-radius: 50% 50% 8px 8px; border-color: rgba(168,213,106,.55); }
.win-skyline { border-radius: 8px; width: 68%; height: 36%; }
.peer { position: absolute; width: 34px; height: 52px; background: none; border: 0; padding: 0; transform: translate(-50%, -100%); transition: left .8s ease, top .8s ease; animation: sway 3.5s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: translate(-50%, -100%) rotate(-2deg); } 50% { transform: translate(-50%, -100%) rotate(2deg); } }
.peer-head { display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--skin); margin: 0 auto; position: relative; box-shadow: inset 0 -6px 0 var(--hair); }
.peer-body { display: block; width: 26px; height: 24px; border-radius: 10px 10px 4px 4px; background: var(--shirt); margin: 1px auto 0; }
.peer-desk { display: block; width: 40px; height: 8px; background: #6b4a2f; border-radius: 3px; margin: 2px auto 0; }
.peer.celebrating { animation: jump 0.9s ease-in-out infinite; }
@keyframes jump { 0%, 100% { transform: translate(-50%, -100%); } 50% { transform: translate(-50%, -130%); } }
.peer.user .peer-head { box-shadow: inset 0 -6px 0 #f5b942; }
.peer.user .peer-body { background: var(--gold); }
.peer.user { z-index: 5; }
.room-hint { position: absolute; left: 8px; right: 8px; bottom: 8px; text-align: center; font-size: 0.78rem; color: #fff; background: rgba(0,0,0,.45); border-radius: 999px; padding: 6px 10px; pointer-events: none; }
.peer-card { display: none; margin-top: 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.peer-card.open { display: block; }
.flag { background: var(--card2); border-radius: 6px; padding: 1px 6px; font-size: 0.8rem; }

/* Town */
.town-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.town-grid.night { filter: brightness(.85) saturate(1.2); }
.town-plot { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 12px; text-align: center; }
.town-plot.building { border-color: var(--bc); }
.town-plot.grand { border-color: var(--bc); box-shadow: 0 0 16px color-mix(in srgb, var(--bc) 45%, transparent); }
.town-bld { font-size: 2.4rem; }
.town-plot small { display: block; color: var(--muted); margin: 2px 0; }

/* Learn */
.lesson-subj { margin-bottom: 8px; }
.lesson-row { display: flex; justify-content: space-between; gap: 8px; width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 6px 0; text-align: left; min-height: 44px; }
.lesson-row.locked { opacity: .55; }
.teach-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 10px 0; }
.quiz-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-top: 12px; }
.quiz-head { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.quiz-opts { display: grid; gap: 8px; margin: 12px 0; }
.quiz-opt { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: left; min-height: 48px; }
.quiz-opt.correct { border-color: var(--green); background: #4cc38a22; }
.quiz-opt.wrong { border-color: var(--red); background: #e26d5a22; }
.solution { border-top: 1px solid var(--border); padding-top: 10px; }
.solution.ok { border-left: 4px solid var(--green); padding-left: 10px; }
.solution.no { border-left: 4px solid var(--red); padding-left: 10px; }
.big-score { font-size: 2rem; font-weight: 800; margin: 6px 0; }
.flash-card { background: linear-gradient(135deg, var(--card2), var(--bg2)); border: 1px solid var(--border); border-radius: 16px; padding: 22px 16px; text-align: center; cursor: pointer; min-height: 150px; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.flash-text { font-size: 1.15rem; font-weight: 700; }
.flash-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.mistake-row { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }
.night-before { border-color: #6b5aa8; background: linear-gradient(135deg, #1d1a38, #2c2350); }
html[data-theme="light"] .night-before { background: linear-gradient(135deg, #efe7fb, #f3ecda); }
.nb-lessons { display: grid; gap: 6px; margin: 10px 0; }
.nb-pick { display: block; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.nb-block { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin: 8px 0; }

/* Track */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.stat-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 6px; text-align: center; }
.stat-box b { display: block; font-size: 1.2rem; }
.stat-box span { font-size: 0.75rem; color: var(--muted); }
.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.hm-cell { aspect-ratio: 1; border-radius: 5px; background: var(--bg2); border: 1px solid var(--border); }
.hm-cell.lvl1 { background: #3a5a2e; } .hm-cell.lvl2 { background: #4cc38a; }
.hm-cell.lvl3 { background: #f5b942; } .hm-cell.lvl4 { background: #ffd97a; }
.bar-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.bar-row > span:first-child { width: 84px; }
.bar-row b { width: 64px; text-align: right; font-size: 0.85rem; }
.donut { width: 150px; height: 150px; border-radius: 50%; margin: 10px auto; display: grid; place-items: center; }
.donut-hole { width: 92px; height: 92px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; font-size: 0.85rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.radar-svg { width: 100%; max-width: 300px; display: block; margin: 0 auto; }
.radar-label { font-size: 9px; fill: var(--muted); text-anchor: middle; }
.fc-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.medal { display: inline-block; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; margin: 3px; font-size: 0.85rem; }
.ach-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ach { border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; font-size: 0.8rem; opacity: .55; }
.ach.got { opacity: 1; border-color: var(--gold); background: #f5b94218; }

/* Plan & shop */
.task-add { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.task-add input { flex: 1; min-width: 160px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.shop-item { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }

/* Bottom nav */
.bottomnav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(720px, 100%); background: var(--card); border-top: 1px solid var(--border); display: flex; z-index: 30; padding-bottom: env(safe-area-inset-bottom); overflow-x: auto; }
.nav-btn { flex: 1; min-width: 64px; background: none; border: 0; padding: 8px 2px 10px; font-size: 0.68rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; align-items: center; }
.nav-btn:first-child { font-size: 1.05rem; }
.nav-btn { font-size: 1.05rem; }
.nav-btn span { font-size: 0.68rem; }
.nav-btn.active { color: var(--gold); font-weight: 700; }
footer { text-align: center; color: var(--muted); padding: 8px 0 20px; }

/* Toast & confetti */
#toast { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(20px); background: #241f1a; color: #fff; border: 1px solid var(--gold); padding: 12px 18px; border-radius: 12px; z-index: 90; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; }

@media (min-width: 560px) {
  .hero { flex-wrap: nowrap; }
  .room-scene { height: 480px; }
}
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .focus-clock { font-size: 3rem; }
}
