:root {
  /* Warm, calm neutral base + ONE accent family (orange — the ADHD-awareness colour).
     Skill: avoid two competing bright colours side by side; one accent for CTAs. */
  --bg: #17141a;          /* warm charcoal, low arousal */
  --card: #221d27;        /* warm raised surface */
  --card2: #2c2632;
  --text: #f3eee9;        /* warm off-white, softer than pure white */
  --muted: #a99fb0;
  --accent: #ff7a18;      /* primary ADHD orange — all CTAs */
  --accent-soft: #ff9f43; /* lighter orange for gradients/hover */
  --accent2: #ffb83d;     /* amber, same warm family (no competing hue) */
  --gold: #ffc83d;
  --green: #3ddc84;       /* reserved for success/done only */
  --red: #ff5470;         /* reserved for boss/danger only */
  --orange: #ff9f43;
  --radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;     /* prevent iOS auto text inflation */
  -webkit-tap-highlight-color: transparent;
}

/* Touch-first: every interactive element gets fast taps (no 300ms delay, no double-tap zoom) */
button, .step, .bonus, .lb-row, .quest-card, .type-chip, .player-chip, .ach { touch-action: manipulation; }

/* Hover transforms only on devices that truly hover — avoids sticky :hover states on touch */
@media (hover: none) {
  .quest-card:hover, .quest-card:hover .quest-emoji, .btn-primary:hover,
  .lb-row:hover, .player-chip:hover, .btn-back:hover { transform: none !important; animation: none; }
}

.hidden { display: none !important; }

/* animated background blobs */
#bg-blobs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
/* tiled motif pattern — static, low opacity, sits above blobs but below content */
#bg-pattern { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: url("pattern.svg") repeat; background-size: 300px 300px; opacity: .8; -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%); mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%); }
/* Static decorative shapes — no permanent motion (ADHD: ambient animation = distraction). */
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.b1 { width: 480px; height: 480px; background: #ff7a18; top: -120px; left: -120px; }
.b2 { width: 420px; height: 420px; background: #ffb83d; bottom: -100px; right: -80px; }
.b3 { width: 360px; height: 360px; background: #c0392b; top: 40%; left: 55%; }

.view { position: relative; z-index: 1; max-width: 980px; margin: 0 auto; padding: 24px 20px 80px; }

/* ===== AUTH ===== */
#view-auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card {
  background: var(--card); border-radius: 24px; padding: 40px 36px; width: 380px; max-width: 92vw;
  box-shadow: 0 30px 80px rgba(0,0,0,.5); text-align: center;
  border: 1px solid rgba(255,255,255,.07);
}
.auth-logo { font-size: 64px; }
/* bounce runs a fixed number of times — never infinitely (one transient motion, then rest) */
.bounce { animation: bounce 2.2s ease-in-out 2; display: inline-block; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px) rotate(-6deg); } }
.auth-title {
  font-size: 28px; letter-spacing: 3px; margin-top: 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-sub { color: var(--muted); margin: 6px 0 22px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.auth-tab {
  flex: 1; padding: 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font-weight: 700; cursor: pointer; transition: all .25s;
}
.auth-tab.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(255,122,24,.45); }
.auth-card input {
  width: 100%; padding: 15px 16px; margin-bottom: 12px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.1); background: var(--bg); color: var(--text); font-size: 16px; /* 16px: iOS won't zoom on focus */
  transition: border .2s, box-shadow .2s;
}
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,122,24,.25); }
.auth-error { color: var(--red); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.btn-primary {
  width: 100%; padding: 14px; border: 0; border-radius: 12px; font-size: 16px; font-weight: 800; cursor: pointer;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff;
  transition: transform .15s, box-shadow .2s; box-shadow: 0 8px 24px rgba(255,122,24,.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(255,122,24,.55); }
.btn-primary:active { transform: scale(.97); }
.auth-textlink { margin-top: 16px; border: 0; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 700; cursor: pointer; min-height: 44px; padding: 8px; transition: color .2s; }
.auth-textlink:hover { color: var(--accent); }
.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }

/* ===== TOPBAR ===== */
#topbar { position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); background: rgba(23,20,26,.82); border-bottom: 1px solid rgba(255,255,255,.06); }
.topbar-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 12px 20px; }
.brand { font-weight: 900; letter-spacing: 2px; cursor: pointer; font-size: 15px; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.player-chip { margin-left: auto; display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 999px; padding: 6px 14px 6px 6px; cursor: pointer; border: 1px solid rgba(255,255,255,.08); transition: transform .15s; }
.player-chip:hover { transform: scale(1.03); }
.level-badge {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 900;
  background: conic-gradient(from 0deg, var(--gold), var(--orange), var(--gold)); color: #1a1300;
}
.player-meta { min-width: 110px; }
.player-name { font-size: 13px; font-weight: 800; }
.xp-bar { height: 7px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-top: 3px; }
.xp-fill { height: 100%; width: 0%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .8s cubic-bezier(.22,1,.36,1); }
.player-xp { font-size: 12px; color: var(--gold); font-weight: 800; white-space: nowrap; }
.nav-link { border: 0; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px; cursor: pointer; padding: 10px 12px; min-height: 44px; border-radius: 10px; transition: color .2s, background .2s; }
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.06); }
.btn-ghost { border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; min-width: 44px; min-height: 44px; transition: color .2s; }
.btn-ghost:hover { color: var(--red); }

/* ===== QUEST LIST ===== */
.screen-title { font-size: 32px; margin-top: 18px; }
.screen-sub { color: var(--muted); margin: 4px 0 24px; }
.slide-up { animation: slideUp .5s cubic-bezier(.22,1,.36,1) both; }
@keyframes slideUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.pop-in { animation: popIn .45s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes popIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }

/* quest type filter chips */
.type-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.type-chip {
  border: 1px solid rgba(255,255,255,.12); background: var(--card); color: var(--muted);
  padding: 11px 18px; min-height: 44px; border-radius: 999px; font-weight: 800; font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.type-chip:hover { color: var(--text); border-color: var(--accent); }
.type-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(255,122,24,.4); }
.type-chip .cnt { opacity: .7; font-weight: 700; margin-left: 4px; }

.quest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.quest-card {
  background: var(--card); border-radius: var(--radius); padding: 22px; cursor: pointer; position: relative; overflow: hidden;
  border: 1px solid rgba(255,255,255,.07); transition: transform .2s, box-shadow .25s, border-color .25s;
  animation: slideUp .5s cubic-bezier(.22,1,.36,1) both;
}
.quest-card:nth-child(2) { animation-delay: .08s; }
.quest-card:nth-child(3) { animation-delay: .16s; }
.quest-card:hover { transform: translateY(-6px) rotate(-.4deg); box-shadow: 0 18px 44px rgba(0,0,0,.45); border-color: var(--accent); }
.quest-card.done { border-color: var(--green); }
.quest-emoji { font-size: 44px; filter: drop-shadow(0 6px 12px rgba(0,0,0,.4)); }
.quest-card:hover .quest-emoji { animation: bounce 1s ease-in-out 1; }
.quest-name { font-size: 17px; font-weight: 900; margin: 10px 0 2px; line-height: 1.25; }
.quest-tags { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.stars { color: var(--gold); letter-spacing: 1px; }
.q-progress { height: 9px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.q-progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .8s cubic-bezier(.22,1,.36,1); }
.quest-card.done .q-progress-fill { background: linear-gradient(90deg, var(--green), #aef5cd); }
.q-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12.5px; }
.q-xp { color: var(--gold); font-weight: 800; }
.q-rank { color: var(--muted); font-weight: 700; }
.done-ribbon {
  position: absolute; top: 14px; right: -34px; transform: rotate(40deg);
  background: var(--green); color: #06351c; font-size: 11px; font-weight: 900; padding: 4px 40px;
}

/* ===== QUEST PLAY ===== */
.btn-back { border: 0; background: var(--card); color: var(--text); padding: 12px 18px; min-height: 44px; border-radius: 10px; cursor: pointer; font-weight: 800; font-size: 15px; margin: 14px 0 18px; transition: transform .15s; }
.btn-back:hover { transform: translateX(-4px); }

.play-header {
  background: linear-gradient(135deg, #2c2230, #201a25); border-radius: var(--radius); padding: 26px; text-align: center;
  border: 1px solid rgba(255,255,255,.08); margin-bottom: 20px;
}
.play-emoji { font-size: 56px; animation: bounce 2.4s ease-in-out 1; display: inline-block; }
.play-title { font-size: 26px; font-weight: 900; letter-spacing: 1px; margin-top: 6px; }
.play-meta { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.play-xp-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.play-xp-bar { flex: 1; height: 14px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.play-xp-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--orange)); transition: width .8s cubic-bezier(.22,1,.36,1); box-shadow: 0 0 14px rgba(255,200,61,.5); }
.play-xp-label { font-weight: 900; color: var(--gold); font-size: 14px; white-space: nowrap; }
.play-rank { margin-top: 10px; font-size: 13px; font-weight: 800; color: var(--accent2); letter-spacing: 1px; }

.level-card {
  background: var(--card); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
  border: 1px solid rgba(255,255,255,.07); animation: slideUp .5s both;
}
.level-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; font-weight: 900; letter-spacing: .5px; font-size: 14.5px; }
.level-head .lv-xp { margin-left: auto; background: rgba(0,0,0,.3); padding: 4px 10px; border-radius: 99px; font-size: 12.5px; }
.lv-0 .level-head { background: linear-gradient(90deg, #b5641f, #d97e2b); }
.lv-1 .level-head { background: linear-gradient(90deg, #d97e2b, #f0922f); }
.lv-2 .level-head { background: linear-gradient(90deg, #f0922f, #ff9f43); }
.lv-3 .level-head { background: linear-gradient(90deg, #d4a017, #f1c40f); color: #1f1700; }
.lv-3 .level-head .lv-xp { background: rgba(255,255,255,.35); }
.lv-final .level-head { background: linear-gradient(90deg, #27ae60, #2ecc71); }
.level-card.boss { border: 2px solid var(--red); box-shadow: 0 0 24px rgba(255,84,112,.25); }
.level-card.boss .level-head { background: linear-gradient(90deg, #c0392b, #e74c3c); }
@keyframes boss-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }
.level-card.level-done { opacity: .82; }
.level-card.level-done .level-head::after { content: "✅"; margin-left: 8px; }

.steps { padding: 8px 10px 12px; }
.step {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 12px; border-radius: 12px; cursor: pointer;
  min-height: 56px; transition: background .2s; /* tall tap zone — whole row toggles the step */
}
.step:active { background: rgba(255,122,24,.1); }
@media (hover: hover) { .step:hover { background: rgba(255,255,255,.04); } }
.step-box {
  flex: 0 0 30px; height: 30px; border-radius: 9px; border: 2px solid var(--muted); display: grid; place-items: center;
  transition: all .25s cubic-bezier(.34,1.56,.64,1); font-size: 17px; color: transparent; margin-top: 1px;
}
.step.checked .step-box { background: var(--green); border-color: var(--green); color: #06351c; transform: scale(1.1); }
.step-text { font-size: 16px; line-height: 1.55; }
.step.checked .step-text { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(61,220,132,.6); }
.step-timer-btn {
  margin-left: auto; flex: 0 0 auto; border: 0; border-radius: 10px; padding: 10px 16px; min-height: 44px; font-weight: 800; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 13px; transition: transform .15s;
}
.step-timer-btn:hover { transform: scale(1.06); }
.step-timer-btn.running { background: var(--orange); color: #2b1700; animation: boss-pulse 1.2s infinite; }
.level-note { margin: 0 18px 14px; padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,.05); color: var(--muted); font-size: 12.5px; line-height: 1.5; border-left: 3px solid var(--accent); }

/* timer ring */
.timer-wrap { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 16px; margin: 0 18px 16px; background: var(--bg); border-radius: 14px; }
.timer-ring { position: relative; width: 110px; height: 110px; }
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring .ring-bg { fill: none; stroke: var(--card2); stroke-width: 8; }
.timer-ring .ring-fg { fill: none; stroke: var(--accent2); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer-done-msg { font-size: 16px; font-weight: 900; color: var(--green); animation: popIn .4s both; }

/* bonuses */
.bonus-card { background: var(--card); border-radius: var(--radius); border: 1px dashed var(--gold); margin-bottom: 16px; overflow: hidden; }
.bonus-head { padding: 14px 18px; font-weight: 900; background: rgba(255,200,61,.1); color: var(--gold); letter-spacing: .5px; font-size: 14.5px; }
.bonus { display: flex; gap: 14px; align-items: center; padding: 14px 18px; min-height: 56px; cursor: pointer; transition: background .2s; }
.bonus:active { background: rgba(255,200,61,.1); }
.bonus:hover { background: rgba(255,255,255,.04); }
.bonus .step-box { border-radius: 50%; }
.bonus.checked .step-box { background: var(--gold); border-color: var(--gold); color: #2b2000; }
.bonus-title { font-weight: 800; font-size: 14px; }
.bonus-desc { color: var(--muted); font-size: 12.5px; }
.bonus-xp { margin-left: auto; color: var(--gold); font-weight: 900; font-size: 13px; white-space: nowrap; }

/* mission complete banner */
.complete-banner {
  background: linear-gradient(135deg, #1d4d31, #27ae60); border-radius: var(--radius); padding: 30px; text-align: center;
  margin-bottom: 16px; animation: popIn .6s cubic-bezier(.34,1.56,.64,1) both; border: 1px solid rgba(255,255,255,.15);
}
.complete-banner h3 { font-size: 24px; letter-spacing: 2px; }
.complete-banner .final-score { font-size: 40px; font-weight: 900; color: var(--gold); margin: 8px 0; text-shadow: 0 4px 18px rgba(0,0,0,.4); }
.complete-banner .final-rank { font-size: 16px; font-weight: 900; letter-spacing: 2px; }
.complete-banner .outro { color: rgba(255,255,255,.85); font-size: 13.5px; margin-top: 12px; font-style: italic; }

/* xp float */
.xp-float {
  position: fixed; z-index: 50; font-weight: 900; color: var(--gold); font-size: 20px; pointer-events: none;
  text-shadow: 0 2px 8px rgba(0,0,0,.6); animation: xpFloat 1.2s ease-out forwards;
}
@keyframes xpFloat { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-70px) scale(1.4); } }

/* ===== PROFILE ===== */
.profile-hero { text-align: center; background: var(--card); border-radius: var(--radius); padding: 32px; margin-bottom: 20px; border: 1px solid rgba(255,255,255,.07); }
.profile-avatar { font-size: 64px; }
.profile-name { font-size: 24px; font-weight: 900; margin-top: 4px; }
.profile-stats { display: flex; justify-content: center; gap: 30px; margin-top: 18px; }
.pstat { text-align: center; }
.pstat .num { font-size: 26px; font-weight: 900; color: var(--accent2); }
.pstat .lbl { font-size: 12px; color: var(--muted); }
.sound-toggle {
  margin-top: 16px; border: 1px solid rgba(255,255,255,.15); background: var(--bg); color: var(--text);
  padding: 10px 18px; border-radius: 12px; font-weight: 800; font-size: 13px; cursor: pointer; transition: border-color .2s;
}
.sound-toggle:hover { border-color: var(--accent); }

.email-row { margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); text-align: left; }
.email-label { display: block; font-size: 13px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.email-edit { display: flex; gap: 8px; }
.email-edit input { flex: 1; padding: 12px 14px; min-height: 44px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); background: var(--bg); color: var(--text); font-size: 16px; }
.email-edit input:focus { outline: none; border-color: var(--accent); }
.btn-mini { border: 0; border-radius: 10px; padding: 0 18px; min-height: 44px; font-weight: 800; cursor: pointer; background: var(--accent); color: #fff; white-space: nowrap; }
.email-msg { font-size: 12.5px; margin-top: 6px; min-height: 16px; }

/* "you vs yesterday" — last 7 days XP chart */
.days-card { background: var(--card); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; border: 1px solid rgba(255,255,255,.07); animation: slideUp .4s both; }
.days-title { font-weight: 900; font-size: 15px; margin-bottom: 16px; }
.days-bars { display: flex; align-items: flex-end; gap: 10px; justify-content: space-between; height: 110px; }
.day-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; }
.day-xp { font-size: 11px; font-weight: 800; color: var(--gold); min-height: 14px; }
.day-bar { width: 100%; max-width: 46px; border-radius: 8px 8px 3px 3px; background: var(--card2); transition: height .6s cubic-bezier(.22,1,.36,1); }
.day-col.today .day-bar { background: linear-gradient(180deg, var(--accent2), var(--accent)); box-shadow: 0 0 14px rgba(255,184,61,.3); }
.day-lbl { font-size: 11px; color: var(--muted); font-weight: 700; }
.day-col.today .day-lbl { color: var(--accent2); }
.days-verdict { margin-top: 14px; font-size: 13.5px; color: var(--text); background: rgba(255,255,255,.05); border-left: 3px solid var(--accent2); border-radius: 8px; padding: 10px 14px; line-height: 1.5; }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.ach {
  background: var(--card); border-radius: 14px; padding: 18px; text-align: center; border: 1px solid rgba(255,255,255,.07);
  transition: transform .2s; animation: slideUp .4s both;
}
.ach:hover { transform: translateY(-4px); }
.ach.locked { opacity: .38; filter: grayscale(1); }
.ach .ach-emoji { font-size: 36px; }
.ach.earned .ach-emoji { display: inline-block; }
.ach .ach-title { font-weight: 900; font-size: 14px; margin-top: 8px; }
.ach .ach-desc { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }

/* ===== LEADERBOARD ===== */
.lb-me-card {
  display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #2c2230, #201a25);
  border: 1px solid var(--accent2); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px;
  box-shadow: 0 0 24px rgba(255,184,61,.15); animation: popIn .45s both;
}
.lb-me-card .lb-me-rank { font-size: 30px; font-weight: 900; color: var(--accent2); min-width: 64px; text-align: center; }
.lb-me-card .lb-me-rank small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.lb-me-card .lb-me-label { font-weight: 900; }
.lb-me-card .lb-me-sub { color: var(--muted); font-size: 12.5px; }
.lb-me-card .lb-me-xp { margin-left: auto; color: var(--gold); font-weight: 900; font-size: 18px; }

.lb-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px; padding: 12px 18px; animation: slideUp .4s both; transition: transform .15s;
}
.lb-row:hover { transform: translateX(4px); }
.lb-row.me { background: rgba(255,184,61,.1); border-color: var(--accent2); box-shadow: 0 0 16px rgba(255,184,61,.15); }
.lb-pos {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 14px; background: var(--card2); color: var(--muted); flex: 0 0 36px;
}
.lb-row.top1 .lb-pos { background: linear-gradient(135deg, #ffd24a, #b8860b); color: #2b2000; box-shadow: 0 0 14px rgba(255,210,74,.5); }
.lb-row.top2 .lb-pos { background: linear-gradient(135deg, #e8eef7, #9aa7b8); color: #222; }
.lb-row.top3 .lb-pos { background: linear-gradient(135deg, #e6b07a, #9a6228); color: #2b1700; }
.lb-row.top1 .lb-animal { animation: bounce 1.8s 1; }
.lb-animal { font-size: 26px; }
.lb-name { font-weight: 800; font-size: 14.5px; }
.me-tag {
  display: inline-block; margin-left: 8px; font-size: 10px; font-weight: 900; letter-spacing: 1px;
  background: var(--accent2); color: #3a2400; border-radius: 99px; padding: 2px 8px; vertical-align: middle;
}
.lb-level { color: var(--muted); font-size: 12px; }
.lb-xp { margin-left: auto; color: var(--gold); font-weight: 900; font-size: 15px; white-space: nowrap; }
.lb-more-wrap { text-align: center; margin-top: 18px; }
#lb-more { width: auto; padding: 12px 28px; }

/* ===== TOASTS ===== */
#toasts { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); right: 16px; left: 16px; z-index: 100; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; }
.toast {
  background: var(--card2); border: 1px solid var(--gold); border-radius: 14px; padding: 14px 18px; display: flex; gap: 12px;
  align-items: center; box-shadow: 0 14px 40px rgba(0,0,0,.5); animation: toastIn .5s cubic-bezier(.34,1.56,.64,1) both; max-width: 320px;
}
.toast .t-emoji { font-size: 30px; }
.toast .t-title { font-weight: 900; font-size: 14px; color: var(--gold); }
.toast .t-desc { font-size: 12px; color: var(--muted); }
.toast.out { animation: toastOut .4s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(120%); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(120%); } }

/* ===== LEVEL UP ===== */
#levelup-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(10,12,24,.7); backdrop-filter: blur(6px); animation: fadeIn .3s; }
@keyframes fadeIn { from { opacity: 0; } }
.levelup-card { text-align: center; animation: popIn .6s cubic-bezier(.34,1.56,.64,1) both; }
.levelup-burst { font-size: 80px; animation: bounce 1s 2; }
.levelup-title { font-size: 28px; font-weight: 900; letter-spacing: 4px; color: var(--gold); text-shadow: 0 0 30px rgba(255,200,61,.7); }
.levelup-num { font-size: 90px; font-weight: 900; background: linear-gradient(180deg, var(--gold), var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent; }

#confetti { position: fixed; inset: 0; z-index: 80; pointer-events: none; }

/* ADHD/accessibility: full stop for all motion when the OS asks for it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #confetti { display: none; }
}

/* "almost there" sticky bar — mobile-only, appears on the home stretch */
.steps-left { display: none; }
@media (max-width: 760px) {
  .steps-left:not(.hidden) {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(90deg, var(--accent), var(--accent-soft)); color: #fff;
    box-shadow: 0 -8px 28px rgba(0,0,0,.4); animation: slideUpBar .35s cubic-bezier(.22,1,.36,1) both;
  }
  .steps-left .sl-msg { font-weight: 900; font-size: 15px; }
  .steps-left .sl-count { font-size: 14px; font-weight: 700; }
  .steps-left .sl-count b { font-size: 18px; }
  /* keep the bonus card clear of the fixed bar */
  #view-play:has(.steps-left:not(.hidden)) #quest-play { padding-bottom: 72px; }
}
@keyframes slideUpBar { from { transform: translateY(100%); } to { transform: none; } }

/* ===== MOBILE & TABLET (touch-first) ===== */

/* respect notches / home-indicator on phones */
#topbar { padding-top: env(safe-area-inset-top); }
.view { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }

@media (max-width: 760px) {
  .view { padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
  .quest-grid { grid-template-columns: 1fr; gap: 14px; }
  .screen-title { font-size: 26px; }
  .play-title { font-size: 22px; }
  .play-header { padding: 20px 16px; }

  /* topbar: keep it one tidy row, brand text hidden, big player chip + actions */
  .topbar-inner { gap: 8px; padding: 10px 14px; }
  .brand span { display: none; }
  .brand { font-size: 22px; }
  .nav-link { font-size: 20px; padding: 10px 12px; }      /* emoji-only on narrow screens */
  .nav-label { display: none; }
  .player-chip { padding: 5px 12px 5px 5px; gap: 8px; }
  .player-meta { min-width: 64px; }
  .player-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* fuller-width, easier-to-hit rows */
  .level-head { padding: 16px; font-size: 14px; }
  .step { padding: 16px 12px; min-height: 60px; }
  .step-text { font-size: 16px; }
  .bonus { padding: 16px 14px; }
  .lb-row { padding: 14px; gap: 12px; }
  .profile-stats { gap: 18px; }
  .ach-grid { grid-template-columns: 1fr 1fr; }

  /* timer ring bigger so it reads from across the kitchen */
  .timer-ring { width: 130px; height: 130px; }

  #toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; width: 100%; }
  .levelup-num { font-size: 72px; }
  .levelup-burst { font-size: 64px; }
}

@media (max-width: 400px) {
  .ach-grid { grid-template-columns: 1fr; }
  .type-chip { font-size: 13px; padding: 10px 14px; }
  .days-bars { gap: 5px; }
  .day-lbl { font-size: 9px; }
}
