/* Stronger Than You Look — v3 "Gym quest" (B) + comic details (A). */
:root {
  --coral: #F26B4B; --coral-d: #C9482B; --sun: #FFD95A; --sun-d: #D9A400; --mint: #2FC487; --mint-d: #1B8A5D; --sky: #7CC4F2;
  --down: #FF7A7A;
  --navy: #1E2A4A;
  /* page (dark gym floor by default) */
  --bg: #1B2340; --panel: #222C50; --panel-2: #11182F; --ink: #0B1027;
  --text: #FFFFFF; --muted: #A9B4D6; --line: rgba(255,255,255,.12); --field: rgba(255,255,255,.08); --field-line: rgba(255,255,255,.22);
  --grid: rgba(255,255,255,.035);
  --shadow: 4px 4px 0 var(--ink);
  --r: 18px;
  --tab-h: 68px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #E7EEF8; --panel: #FFFFFF; --panel-2: #1E2A4A; --ink: #1E2A4A;
  --text: #1E2A4A; --muted: #56648A; --line: rgba(30,42,74,.12); --field: #F1F4FA; --field-line: rgba(30,42,74,.25);
  --grid: rgba(30,42,74,.05);
  color-scheme: light;
}
/* white "quest" cards always use dark ink inside */
.qcard, .opt, .bubble, .quest, .win-card {
  --text: #1E2A4A; --muted: #56648A; --line: rgba(30,42,74,.13); --field: #F1F4FA; --field-line: rgba(30,42,74,.28);
  color: var(--text);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 500 16px/1.42 "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
}
.floor { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0/46px 46px, linear-gradient(var(--grid) 1px, transparent 1px) 0 0/46px 46px; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.12; }
h1 { font: 30px/1.05 "Lilita One", "Fredoka", sans-serif; letter-spacing: .3px; }
h2 { font: 600 22px/1.15 "Fredoka", sans-serif; }
h3 { font: 600 18px/1.2 "Fredoka", sans-serif; }
p { margin: 8px 0; }
.small { font: 600 14px/1.4 "Nunito", sans-serif; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.link { color: var(--coral); font-weight: 800; text-decoration: none; }
.link:hover { text-decoration: underline; }
.foot { font: 600 12px/1.45 "Nunito", sans-serif; color: var(--muted); margin: 22px 4px 0; }
main { max-width: 560px; margin: 0 auto; padding: 12px 16px 0; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---------- panels & cards ---------- */
.card { background: var(--panel); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin: 0 0 16px; }
.qcard { background: #fff; border: 3px solid var(--ink); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin: 0 0 16px; }
:root[data-theme="light"] .card { box-shadow: 4px 4px 0 rgba(30,42,74,.9); }
.tag { display: inline-block; white-space: nowrap; font: 700 12px/1 "Fredoka"; letter-spacing: .6px; text-transform: uppercase; padding: 6px 9px; border-radius: 9px; background: var(--sun); color: var(--navy); border: 2px solid var(--ink); }
.tag.coral { background: var(--coral); color: #fff; }
.tag.mint { background: var(--mint); color: #fff; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 16px/1 "Fredoka"; padding: 13px 18px; border-radius: 14px; cursor: pointer; text-decoration: none;
  background: var(--panel); color: var(--text); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s; -webkit-tap-highlight-color: transparent; }
.qcard .btn { background: #fff; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--coral); color: #fff; }
.btn.sun { background: var(--sun); color: var(--navy); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.mint { background: var(--mint); color: #fff; }
.btn.block { display: flex; width: 100%; }
.btn.big { font: 22px/1 "Lilita One"; letter-spacing: .5px; padding: 16px 20px; }
.btn.sm { font-size: 14px; padding: 9px 12px; border-radius: 11px; }
.btn:disabled { opacity: .6; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--coral); font: inherit; font-weight: 800; cursor: pointer; }

/* ---------- HUD ---------- */
.hud { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hud:empty { display: none; }
.hud-in { max-width: 560px; margin: 0 auto; padding: 10px 16px; display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; }
.ava { width: 48px; height: 48px; border-radius: 14px; background: var(--mint); border: 3px solid var(--ink); overflow: hidden; box-shadow: 2px 2px 0 var(--ink); }
.ava img { width: 72px; max-width: none; margin: -1px 0 0 -12px; }
.lvl { font-weight: 700; font-size: 16px; display: flex; justify-content: space-between; gap: 8px; }
.lvl small { color: var(--sun); font-weight: 600; font-size: 13px; }
:root[data-theme="light"] .lvl small { color: #9A6B00; }
.xpbar { height: 14px; border-radius: 99px; background: var(--field); margin-top: 5px; overflow: hidden; border: 2px solid var(--ink); }
.xpbar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--sun), #FFB23E); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.fire { display: flex; align-items: center; gap: 4px; background: rgba(242,107,75,.18); border: 2px solid var(--coral); border-radius: 12px; padding: 5px 9px; font-weight: 700; white-space: nowrap; }
.fire.off { filter: grayscale(1); opacity: .6; }

/* ---------- tab bar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: #11182F; border-top: 3px solid var(--ink);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); height: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: #7D8AB0; font: 600 12px "Fredoka"; padding-top: 2px; }
.tabbar svg { width: 26px; height: 26px; stroke: currentColor; fill: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; padding: 2px; border-radius: 9px; }
.tabbar a.on { color: var(--sun); }
.tabbar a.on svg { background: rgba(255,217,90,.14); }
body.gate-mode .tabbar, body.gate-mode .hud { display: none; }
body.gate-mode { padding-bottom: 32px; }

/* ---------- path (home) ---------- */
.map { position: relative; margin: 0 -16px; }
.map svg.trail { position: absolute; inset: 0; overflow: visible; }
.banner { position: absolute; left: 50%; transform: translateX(-50%) rotate(-1.5deg); white-space: nowrap; background: var(--panel); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); border-radius: 12px; padding: 6px 14px; font: 15px/1.1 "Lilita One"; letter-spacing: .6px; text-transform: uppercase; z-index: 2; }
.banner small { font: 600 12px "Fredoka"; letter-spacing: 0; text-transform: none; color: var(--muted); margin-left: 6px; }
.banner.done { background: var(--mint); color: #fff; }
.banner.done small { color: rgba(255,255,255,.85); }
.node { position: absolute; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; z-index: 3;
  font: 18px/1 "Lilita One"; color: #8FA0C8; border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink);
  background: radial-gradient(circle, var(--bg) 0 8px, #3A4870 9px 20px, #2B3659 21px 27px, #47577F 28px); transition: transform .1s; }
:root[data-theme="light"] .node { background: radial-gradient(circle, var(--bg) 0 8px, #B9C3DA 9px 20px, #A3AECB 21px 27px, #CCD4E6 28px); color: #5D6B91; }
.node:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.node.done { color: #fff; background: radial-gradient(circle, var(--bg) 0 8px, #23A36F 9px 20px, var(--mint-d) 21px 27px, var(--mint) 28px); }
.node.done::after { content: "✓"; position: absolute; right: -6px; top: -6px; width: 24px; height: 24px; border-radius: 50%; background: var(--sun); color: var(--navy); border: 2px solid var(--ink); font: 700 13px/20px "Fredoka"; text-align: center; }
.node.next { width: 84px; height: 84px; margin: -42px 0 0 -42px; font-size: 24px; color: #fff;
  background: radial-gradient(circle, var(--bg) 0 10px, var(--coral) 11px 26px, #D9573A 27px 36px, #FF8A6B 37px);
  box-shadow: 0 6px 0 var(--ink), 0 0 0 8px rgba(242,107,75,.22), 0 0 34px rgba(242,107,75,.55); animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: translateY(-5px) scale(1.04); box-shadow: 0 11px 0 var(--ink), 0 0 0 12px rgba(242,107,75,.14), 0 0 44px rgba(242,107,75,.7); } }
.node.boss { width: 80px; height: 80px; margin: -40px 0 0 -40px; color: var(--navy); font-size: 22px;
  background: radial-gradient(circle, var(--bg) 0 10px, #E0A800 11px 24px, var(--sun-d) 25px 33px, var(--sun) 34px); }
.node.boss.next { background: radial-gradient(circle, var(--bg) 0 10px, #E0A800 11px 26px, var(--sun-d) 27px 36px, var(--sun) 37px); box-shadow: 0 6px 0 var(--ink), 0 0 0 8px rgba(255,217,90,.22), 0 0 36px rgba(255,217,90,.6); }
.crown { position: absolute; top: -26px; left: 50%; width: 38px; transform: translateX(-50%) rotate(-6deg); }
.nlabel { position: absolute; z-index: 2; font: 600 13px/1.2 "Fredoka"; color: var(--muted); white-space: nowrap; transform: translateY(-50%); }
.nlabel b { display: block; color: var(--text); font-weight: 600; font-size: 14px; }
.map .rep { position: absolute; z-index: 4; height: 118px; width: auto; pointer-events: none; filter: drop-shadow(0 5px 0 rgba(0,0,0,.28)); }
.map .spot { position: absolute; z-index: 1; width: 120px; height: 34px; border-radius: 50%; background: radial-gradient(closest-side, rgba(124,196,242,.45), transparent); }
.bubble { position: absolute; z-index: 5; background: #fff; border: 3px solid var(--ink); border-radius: 20px; padding: 9px 12px; font: 17px/1.05 "Lilita One"; letter-spacing: .2px; box-shadow: 3px 3px 0 var(--ink); max-width: 170px; }
/* comic tail: a white square turned 45deg, outlined on the two sides that form the point */
.bubble::after { content: ""; position: absolute; width: 16px; height: 16px; background: #fff; transform: rotate(45deg); }
.bubble.tl::after, .bubble.tr::after { bottom: -10px; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.bubble.tl::after { left: 24px; } .bubble.tr::after { right: 24px; }
.bubble.pl::after { left: -10px; top: 18px; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.bubble.pr::after { right: -10px; top: 18px; border-right: 3px solid var(--ink); border-top: 3px solid var(--ink); }
.bubble small { display: block; font: 700 12px/1.3 "Nunito"; color: var(--muted); margin-top: 4px; letter-spacing: 0; }
.pop-in { animation: popIn .45s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes popIn { from { opacity: 0; transform: scale(.6) translateY(10px); } }

.quest { position: fixed; z-index: 25; left: 50%; transform: translateX(-50%); width: min(528px, calc(100% - 24px)); bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom));
  background: #fff; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 4px 5px 0 var(--ink); padding: 12px 12px 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; text-decoration: none; }
.quest .q-k { font: 700 11px/1 "Fredoka"; letter-spacing: .8px; text-transform: uppercase; color: var(--coral); }
.quest b { display: block; font: 20px/1.1 "Lilita One"; letter-spacing: .3px; margin-top: 3px; }
.quest small { font: 700 13px/1.3 "Nunito"; color: var(--muted); }
.quest .xp { color: #B07A00; }
.quest .btn { padding: 14px 18px; font-size: 18px; }
body.home-mode { padding-bottom: calc(var(--tab-h) + 120px + env(safe-area-inset-bottom)); }

.side-title { font: 18px "Lilita One"; letter-spacing: .5px; text-transform: uppercase; margin: 26px 2px 10px; color: var(--sun); }
:root[data-theme="light"] .side-title { color: var(--coral); }
.tip { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; }
.tip img { width: 64px; height: 72px; object-fit: contain; }
.tip b { font-weight: 600; }

/* ---------- workout ---------- */
.wk-head h1 { margin: 8px 0 4px; }
.warm { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--field); font: 600 14px/1.4 "Nunito"; }
.ex-top { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.ex-img { width: 96px; height: 110px; border-radius: 14px; background: #E3F4EC; border: 2px solid var(--line); display: grid; place-items: end center; overflow: hidden; }
.ex-img img { max-height: 106px; width: auto; }
.ex-n { font: 700 12px "Fredoka"; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.ex h3 { font: 21px/1.1 "Lilita One"; letter-spacing: .3px; margin: 2px 0 4px; }
.target { font-weight: 600; font-size: 16px; }
.chip { margin-top: 8px; padding: 8px 10px; border-radius: 12px; font: 700 13px/1.35 "Nunito"; background: #EEF1F7; border: 2px solid rgba(30,42,74,.14); }
.chip.up { background: #DDF6EA; border-color: var(--mint); }
.chip.down { background: #FFE6E1; border-color: var(--coral); }
.chip.new { background: #FFF5CF; border-color: var(--sun-d); }
.last { margin-top: 12px; display: flex; gap: 8px; align-items: center; font: 700 14px "Nunito"; color: var(--muted); }
.last b { color: var(--text); font-family: "Fredoka"; font-weight: 600; font-size: 15px; }
.last .ic { width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--navy); color: var(--sun); display: grid; place-items: center; font-size: 13px; }
.plates { margin-top: 8px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--field); }
.plates .bar { display: flex; align-items: center; height: 44px; flex: none; }
.plates .bar::before { content: ""; width: 26px; height: 6px; background: #9AA5BF; border-radius: 3px 0 0 3px; }
.plates .bar::after { content: ""; width: 10px; height: 6px; background: #9AA5BF; border-radius: 0 3px 3px 0; }
.plates .p { width: 9px; margin-right: 2px; border-radius: 3px; border: 2px solid var(--ink); }
.plates .txt { font: 700 13px/1.3 "Nunito"; }
.plates .txt b { font: 600 15px "Fredoka"; }
details { margin-top: 12px; border-top: 2px dashed var(--line); padding-top: 10px; }
summary { cursor: pointer; font-weight: 600; color: var(--coral); list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "＋ "; }
details[open] summary::before { content: "－ "; }
details p { font: 600 14px/1.45 "Nunito"; }
.sets { margin-top: 12px; display: grid; gap: 8px; }
.sets-head { display: grid; grid-template-columns: 30px 1fr 1fr 52px; gap: 8px; font: 700 11px "Fredoka"; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); padding: 0 2px; }
.set { display: grid; grid-template-columns: 30px 1fr 1fr 52px; gap: 8px; align-items: center; padding: 6px; border-radius: 14px; border: 2px solid transparent; transition: background .2s; }
.set.done { background: #DDF6EA; border-color: rgba(47,196,135,.55); }
.set .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 600 15px "Fredoka"; background: var(--navy); color: #fff; }
.set.done .n { background: var(--mint); }
.static { text-align: center; font-weight: 600; color: var(--muted); }
.field { position: relative; display: flex; align-items: center; background: var(--field); border: 2px solid var(--field-line); border-radius: 12px; padding: 0 8px 0 10px; min-height: 46px; }
.field:focus-within { border-color: var(--coral); }
.field input { width: 100%; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: 600 19px "Fredoka"; padding: 8px 0; }
.field .u { font: 700 12px "Nunito"; color: var(--muted); white-space: nowrap; margin-left: 4px; }
.check { position: relative; width: 52px; height: 46px; border-radius: 14px; border: 3px solid var(--ink); background: #fff; box-shadow: 0 4px 0 var(--ink); cursor: pointer; font: 700 22px "Fredoka"; color: #C5CCDD; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
.check:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.check.on { background: var(--mint); color: #fff; }
.flexpop { position: absolute; left: 50%; bottom: 30px; width: 64px; max-width: none; pointer-events: none; z-index: 6; animation: flexpop .9s cubic-bezier(.2,.9,.3,1) forwards; }
@keyframes flexpop { 0% { opacity: 0; transform: translate(-50%, 20px) scale(.4); } 30% { opacity: 1; transform: translate(-50%, -10px) scale(1.05); } 70% { opacity: 1; transform: translate(-50%, -16px) scale(1); } 100% { opacity: 0; transform: translate(-50%, -30px) scale(.9); } }
.xpfloat { position: fixed; z-index: 60; white-space: nowrap; pointer-events: none; font: 22px "Lilita One"; color: var(--sun); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; text-shadow: 2px 2px 0 var(--ink); animation: xpfloat 1s ease-out forwards; }
@keyframes xpfloat { 0% { opacity: 0; transform: translate(-50%, 0) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -14px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -64px) scale(1); } }
.done-strip { display: flex; align-items: center; gap: 12px; background: var(--mint); color: #fff; }
.done-strip b { font: 20px "Lilita One"; letter-spacing: .3px; }
.pager { display: flex; justify-content: space-between; margin-top: 14px; }

/* ---------- reward screen ---------- */
.fx { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(11,16,39,.82); overflow: auto; }
.fx[hidden] { display: none; }
.rays { position: fixed; left: 50%; top: 34%; width: 900px; height: 900px; margin: -450px 0 0 -450px; pointer-events: none;
  background: repeating-conic-gradient(rgba(255,217,90,.16) 0 9deg, transparent 9deg 22deg); border-radius: 50%; mask: radial-gradient(closest-side, #000 40%, transparent); -webkit-mask: radial-gradient(closest-side, #000 40%, transparent);
  animation: spin 24s linear infinite, fadeIn .6s both; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } }
.win { position: relative; width: min(420px, 100%); text-align: center; color: #fff; }
.win-title { font: 46px/0.92 "Lilita One"; letter-spacing: 1px; color: var(--sun); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 4px 5px 0 var(--ink); text-transform: uppercase; animation: slam .55s cubic-bezier(.2,1.6,.4,1) .1s both; }
.win-title span { display: block; color: #fff; font-size: 30px; }
@keyframes slam { from { opacity: 0; transform: scale(2.4) rotate(-6deg); } }
.win-rep { height: 190px; width: auto; margin: 6px auto -8px; position: relative; z-index: 2; animation: jump .8s cubic-bezier(.3,1.4,.5,1) .45s both; filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); }
@keyframes jump { 0% { opacity: 0; transform: translateY(60px) scale(.8); } 60% { opacity: 1; transform: translateY(-14px); } }
.win-card { position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 22px; box-shadow: 5px 6px 0 var(--ink); padding: 16px; animation: rise .5s cubic-bezier(.2,1.2,.4,1) .7s both; }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } }
.win-xp { font: 52px/1 "Lilita One"; color: var(--coral); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink); }
.win-xp small { font-size: 24px; }
.win-lines { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 10px 0 4px; }
.win-lines span { font: 700 13px "Nunito"; padding: 5px 9px; border-radius: 10px; background: #F1F4FA; border: 2px solid rgba(30,42,74,.14); animation: popIn .35s cubic-bezier(.3,1.6,.5,1) both; }
.win-lines span b { color: var(--mint-d); }
.win-lvl { margin-top: 12px; text-align: left; }
.win-lvl .lvl small { color: #9A6B00; }
.records { display: grid; gap: 10px; margin-top: 14px; }
.record { display: grid; grid-template-columns: 70px 1fr; gap: 10px; align-items: center; text-align: left; animation: popIn .45s cubic-bezier(.3,1.6,.5,1) both; }
.star { width: 70px; height: 70px; display: grid; place-items: center; background: var(--sun); color: var(--navy); font: 13px/1 "Lilita One"; text-align: center; transform: rotate(-8deg);
  clip-path: polygon(50% 0,61% 22%,85% 10%,78% 36%,100% 45%,79% 58%,90% 84%,63% 76%,50% 100%,38% 77%,11% 88%,22% 60%,0 48%,22% 36%,14% 10%,40% 22%); }
.record b { font: 18px/1.1 "Lilita One"; letter-spacing: .3px; display: block; }
.lvlup { margin: 12px auto 0; display: inline-block; font: 26px "Lilita One"; letter-spacing: .6px; color: #fff; background: var(--coral); border: 3px solid var(--ink); border-radius: 14px; padding: 6px 14px; box-shadow: 3px 3px 0 var(--ink); transform: rotate(-3deg); animation: slam .5s cubic-bezier(.2,1.6,.4,1) both; }
.win .btn { margin-top: 16px; animation: rise .4s ease-out both; }
.confetti { position: fixed; top: -20px; width: 10px; height: 16px; border: 2px solid var(--ink); border-radius: 3px; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- questionnaire (dialog with Rep) ---------- */
.gate { max-width: 520px; margin: 0 auto; padding-top: 8px; }
.qprog { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; }
.qprog .xpbar { flex: 1; margin: 0; }
.qprog small { font: 700 13px "Nunito"; color: var(--muted); white-space: nowrap; }
.talk { display: grid; grid-template-columns: 86px 1fr; gap: 10px; align-items: end; margin-bottom: 16px; }
.talk .who { height: 110px; display: grid; place-items: end center; }
.talk .who img { max-height: 110px; width: auto; filter: drop-shadow(0 4px 0 rgba(0,0,0,.3)); }
.talk .bubble { position: relative; max-width: none; font-size: 21px; margin-bottom: 18px; }
.welcome { position: relative; text-align: center; padding-top: 6px; }
.welcome .logo { font: 40px/0.95 "Lilita One"; letter-spacing: .5px; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 4px 0 var(--ink); }
.welcome .logo span { display: block; color: var(--coral); }
:root[data-theme="light"] .welcome .logo { color: var(--navy); -webkit-text-stroke: 0; text-shadow: none; }
.welcome .by { margin-top: 6px; color: var(--muted); font-weight: 600; }
.welcome .stage { position: relative; height: 250px; margin-top: 8px; }
.welcome .stage img { position: absolute; right: 8%; bottom: 0; height: 240px; filter: drop-shadow(0 6px 0 rgba(0,0,0,.3)); }
.welcome .stage .bubble { left: 0; top: 18px; text-align: left; max-width: 172px; }
.welcome .stage .spot { position: absolute; right: 0; bottom: -8px; width: 220px; height: 44px; border-radius: 50%; background: radial-gradient(closest-side, rgba(124,196,242,.45), transparent); }
.bullets { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; text-align: left; }
.bullets li { display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: center; font: 700 15px/1.35 "Nunito"; }
.bullets li i { width: 30px; height: 30px; border-radius: 9px; background: var(--sun); border: 2px solid var(--ink); display: grid; place-items: center; font-style: normal; font: 15px "Lilita One"; }
.plain { margin: 6px 0 12px; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.plain li { font: 700 14px/1.35 "Nunito"; padding: 8px 10px; border-radius: 12px; background: var(--field); }
.plain li b { font-family: "Fredoka"; font-weight: 600; font-size: 15px; }
.qlabel { display: block; margin: 16px 0 8px; font: 600 15px "Fredoka"; }
.opts { display: grid; gap: 10px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opts.three { grid-template-columns: repeat(3, 1fr); }
.opt { text-align: left; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 12px 14px; cursor: pointer; box-shadow: 0 4px 0 var(--ink); font: inherit; -webkit-tap-highlight-color: transparent; transition: transform .08s; }
.opt b { display: block; font: 600 17px/1.2 "Fredoka"; }
.opt small { display: block; font: 700 13px/1.3 "Nunito"; color: var(--muted); margin-top: 2px; }
.opt:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.opt.on { background: var(--sun); }
.opt.on small { color: #6B5600; }
.opts.three .opt { text-align: center; padding: 12px 6px; }
.qgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { padding: 10px 0; border-radius: 12px; border: 3px solid var(--ink); background: #fff; color: var(--navy); font: 600 14px "Fredoka"; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.wd.on { background: var(--coral); color: #fff; }
.checkline { display: flex; gap: 10px; align-items: center; margin-top: 14px; font-weight: 600; }
.checkline input { width: 22px; height: 22px; accent-color: var(--coral); }
.input { width: 100%; font: 600 18px "Fredoka"; padding: 12px; border-radius: 12px; border: 2px solid var(--field-line); background: var(--field); color: var(--text); outline: 0; }
.input:focus { border-color: var(--coral); }
.err { color: #D9362B; font: 800 14px "Nunito"; min-height: 4px; margin-top: 10px; }
.card .err { color: var(--down); }
.warn { margin-top: 10px; padding: 10px; border-radius: 12px; background: #FFF5CF; color: var(--navy); font: 700 14px "Nunito"; border: 2px solid var(--sun-d); }
.qnav { margin-top: 4px; }
.plan-card .map-mini { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.plan-card .map-mini i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink); background: radial-gradient(circle, #fff 0 3px, #B9C3DA 4px); }
.plan-card .map-mini i:first-child { background: radial-gradient(circle, #fff 0 3px, var(--coral) 4px); }
.plan-card .map-mini i:last-child { background: radial-gradient(circle, #fff 0 3px, var(--sun) 4px); }

/* toggles (units plate / day-night) */
.tgl { position: relative; width: 84px; height: 40px; border-radius: 99px; border: 3px solid var(--ink); background: var(--field); cursor: pointer; padding: 0; flex: none; box-shadow: 0 3px 0 var(--ink); }
.qcard .tgl { background: #EEF1F7; }
.tgl .knob { position: absolute; top: 2px; left: 2px; width: 30px; height: 30px; border-radius: 50%; transition: left .3s cubic-bezier(.3,1.4,.5,1); display: grid; place-items: center; }
.tgl.on .knob { left: 46px; }
.tgl.plate .tgl-l, .tgl.plate .tgl-r { position: absolute; top: 9px; font: 700 12px "Fredoka"; color: var(--muted); }
.tgl.plate .tgl-l { left: 12px; } .tgl.plate .tgl-r { right: 12px; }
.tgl.plate .knob { background: radial-gradient(circle, #fff 0 3px, #2B3659 4px 9px, #47577F 10px); border: 2px solid var(--ink); }
.tgl.plate .knob b { display: none; }
.tgl.night { background: #8FD0F5; }
.tgl.night.on { background: #11182F; }
.tgl.night .knob { background: var(--sun); border: 2px solid var(--ink); }
.tgl.night.on .knob { background: #E9EEF8; box-shadow: inset -7px -3px 0 #B9C3DA; }
.tgl.night .stars { position: absolute; inset: 0; border-radius: 99px; opacity: 0; transition: opacity .3s; }
.tgl.night .stars::before { content: ""; position: absolute; left: 11px; top: 9px; width: 3px; height: 3px; border-radius: 50%; background: #fff;
  box-shadow: 15px 5px 0 -.5px #fff, 5px 14px 0 .5px #FFD95A, 24px 16px 0 -1px #fff, 27px -2px 0 -.5px #fff; }
.tgl.night.on .stars { opacity: 1; }

/* ---------- stats ---------- */
.report { background: var(--navy); color: #fff; }
:root:not([data-theme="light"]) .report { background: linear-gradient(160deg, #2A3666, #1E2A4A); }
.report .big { font: 58px/1 "Lilita One"; color: var(--sun); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink); }
.lift-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 2px dashed rgba(255,255,255,.14); font-weight: 600; }
.lift-row .pct { font: 18px "Lilita One"; color: var(--mint); }
.lift-row .pct.neg { color: var(--coral); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 3px 3px 0 var(--ink); padding: 12px 8px; text-align: center; }
.kpi .val { font: 30px/1 "Lilita One"; letter-spacing: .3px; }
.kpi .val small { font-size: 16px; color: var(--muted); }
.kpi:nth-child(1) .val { color: var(--sun); } .kpi:nth-child(2) .val { color: var(--mint); } .kpi:nth-child(3) .val { color: var(--coral); }
:root[data-theme="light"] .kpi:nth-child(1) .val { color: #B07A00; }
.ring { --p: 0; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(closest-side, var(--panel) 72%, transparent 73% 100%), conic-gradient(var(--mint) calc(var(--p) * 1%), var(--field) 0); border: 3px solid var(--ink); }
.ring span { font: 600 14px "Fredoka"; }
.wrings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; text-align: center; }
.wring { display: grid; justify-items: center; gap: 6px; font: 600 13px "Fredoka"; color: var(--muted); }
.wring.full .ring { background: var(--mint); }
.wring.full .ring span { color: #fff; font-size: 22px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.badge { display: grid; grid-template-columns: 46px 1fr; gap: 8px; align-items: center; padding: 8px; border-radius: 14px; background: var(--field); }
.badge .star { width: 46px; height: 46px; font-size: 10px; }
.badge b { display: block; font-weight: 600; font-size: 14px; line-height: 1.15; }
.badge small { font: 700 12px "Nunito"; color: var(--muted); }
.chart { width: 100%; height: auto; margin-top: 10px; overflow: visible; }
.chart text { font: 600 18px "Fredoka"; fill: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; font: 700 13px "Nunito"; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; border: 2px solid var(--ink); }
.bwlist { margin-top: 10px; display: grid; gap: 6px; }

/* ---------- log sheet ---------- */
.sheet-wrap { overflow: auto; border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); background: var(--panel); max-height: 62vh; }
.sheet { border-collapse: collapse; min-width: 720px; width: 100%; font: 600 14px "Fredoka"; }
.sheet th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); color: #fff; text-align: left; padding: 10px 8px; font-weight: 600; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; }
.sheet td { border-top: 1px solid var(--line); padding: 0; }
.sheet td span { display: block; padding: 9px 8px; white-space: nowrap; }
.sheet td.num { text-align: right; }
.sheet td input { width: 72px; background: transparent; border: 0; border-bottom: 2px dashed var(--field-line); color: var(--text); font: 600 15px "Fredoka"; padding: 8px; }
.sheet td input:focus { outline: 0; border-bottom-color: var(--coral); background: var(--field); }
.sheet tfoot td { background: var(--field); font-weight: 700; }
.sheet-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.sel { font: 600 15px "Fredoka"; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--field-line); background: var(--field); color: var(--text); }
.sel option { color: #1E2A4A; }

/* ---------- me / settings ---------- */
.set-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-top: 2px dashed var(--line); }
.set-line:first-of-type { border-top: 0; }
.set-line b { font-weight: 600; }
.seg { display: flex; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; flex: none; }
.seg button { border: 0; padding: 8px 14px; background: var(--field); color: var(--text); font: 600 14px "Fredoka"; cursor: pointer; }
.seg button.on { background: var(--sun); color: var(--navy); }
.me-head { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; }
.me-head .ava { width: 72px; height: 72px; border-radius: 18px; }
.me-head .ava img { width: 104px; margin: -2px 0 0 -16px; }

/* ---------- rest timer ---------- */
.timer { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); width: min(528px, calc(100% - 24px));
  display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 8px; align-items: center; background: var(--navy); color: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 4px 5px 0 var(--ink); padding: 8px 8px 8px 14px; }
.timer[hidden] { display: none; }
.timer-label { font: 700 12px "Fredoka"; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.timer-time { font: 30px/1 "Lilita One"; letter-spacing: 1px; color: var(--sun); }
.timer button { border: 2px solid var(--ink); background: rgba(255,255,255,.1); color: #fff; border-radius: 11px; padding: 10px 10px; font: 600 14px "Fredoka"; cursor: pointer; }
.timer button.primary { background: var(--coral); }
.timer.end { background: var(--mint); animation: shake .4s ease 2; }
.timer.end .timer-time { color: #fff; }
@keyframes shake { 25% { transform: translateX(calc(-50% - 5px)); } 75% { transform: translateX(calc(-50% + 5px)); } }

/* ---------- toast ---------- */
.toast { position: fixed; z-index: 90; left: 50%; top: 16px; transform: translate(-50%, calc(-100% - 30px)); visibility: hidden; background: #fff; color: var(--navy); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); border-radius: 14px; padding: 10px 16px; font: 600 15px "Fredoka"; transition: transform .3s cubic-bezier(.3,1.4,.5,1); max-width: calc(100% - 32px); }
.toast.show { transform: translate(-50%, 0); visibility: visible; }

@media (max-width: 380px) {
  h1 { font-size: 26px; }
  .ex-top { grid-template-columns: 76px 1fr; }
  .ex-img { width: 76px; height: 92px; }
  .ex-img img { max-height: 88px; }
  .set, .sets-head { grid-template-columns: 28px 1fr 1fr 48px; gap: 6px; }
  .check { width: 48px; }
  .win-title { font-size: 38px; }
  .opts.three .opt b { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .rays { display: none; }
}

/* ---------- v3.1: avatar, locks, rest day ---------- */
.ava i { display: block; width: 100%; height: 100%; background-repeat: no-repeat; }
.ava-pick { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.ava-pick .ava { width: 56px; height: 56px; padding: 0; cursor: pointer; border-radius: 16px; }
.ava-pick .ava.on { outline: 3px solid var(--sun); outline-offset: 2px; }
.ava-pick .ava.add { display: grid; place-items: center; background: var(--field); color: var(--text); font: 600 12px/1.1 "Fredoka"; text-align: center; border-style: dashed; }
.node.locked:not(.next) { color: #6F7DA3; }
.node .lock { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.node.boss.locked .lock { color: var(--navy); }
.node.next.resting { animation: none; filter: saturate(.55); box-shadow: 0 6px 0 var(--ink); }
.quest .btn[aria-disabled="true"] { background: var(--field); color: var(--muted); }
.rest-card { display: grid; grid-template-columns: 70px 1fr; gap: 12px; align-items: center; }
.rest-card img { width: 70px; }
.rest-card b { font: 20px "Lilita One"; letter-spacing: .3px; }
.check:disabled, #finish:disabled { opacity: .45; cursor: not-allowed; }
.danger { border-color: var(--ink); }
.danger .btn[data-reset] { color: var(--down); }

/* ---------- v3.2: swap + technique ---------- */
.swapbtn { margin-top: 8px; border: 2px solid var(--ink); background: #fff; color: var(--navy); border-radius: 10px; padding: 5px 10px; font: 600 13px "Fredoka"; cursor: pointer; box-shadow: 0 2px 0 var(--ink); }
.swapbtn:active { transform: translateY(2px); box-shadow: none; }
.tframes { position: relative; width: min(100%, 300px); margin: 10px auto 4px; border-radius: 14px; overflow: hidden; border: 2px solid var(--line); background: #FBF6EA; }
.tframes img { display: block; width: 100%; height: auto; }
.tframes .b { position: absolute; inset: 0; height: 100%; object-fit: cover; }
.tframes .b { animation: tflip 1.2s steps(1, end) infinite; }
@keyframes tflip { 0% { opacity: 0; } 50% { opacity: 1; } }
.steps { margin: 10px 0 8px; padding-left: 0; list-style: none; counter-reset: st; display: grid; gap: 6px; }
.steps li { counter-increment: st; display: grid; grid-template-columns: 26px 1fr; gap: 8px; font: 700 14px/1.4 "Nunito"; }
.steps li::before { content: counter(st); width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font: 600 13px "Fredoka"; }
.mistake { padding: 8px 10px; border-radius: 12px; background: #FFE6E1; border: 2px solid var(--coral); font: 700 14px/1.4 "Nunito"; }
.mistake b { color: #C9482B; font-family: "Fredoka"; font-weight: 600; margin-right: 4px; }
.sheetm { position: fixed; inset: 0; z-index: 85; display: flex; align-items: flex-end; justify-content: center; }
.sheetm-bg { position: absolute; inset: 0; background: rgba(11,16,39,.7); }
.sheetm-card { position: relative; width: min(560px, 100%); max-height: 85vh; overflow: auto; margin: 0; border-radius: 22px 22px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); animation: rise .3s cubic-bezier(.2,1.2,.4,1) both; }
@media (prefers-reduced-motion: reduce) { .tframes { display: grid; grid-template-columns: 1fr 1fr; width: 100%; } .tframes .b { position: static; height: auto; opacity: 1; } }
.ex-img img.tf { width: 100%; height: 100%; max-height: none; object-fit: cover; transform: scale(1.45); transform-origin: 50% 45%; }
