/* Trainer's Pad: game-UI styling for the Uma coach app */
:root {
  --sky-top: #6cc8ff;
  --sky-bot: #d9f3ff;
  --blue: #2a8fe0;
  --blue-deep: #1767b3;
  --turf: #43c15f;
  --turf-deep: #238a3f;
  --pink: #ff5fa2;
  --pink-deep: #d63c80;
  --carrot: #ff9a1f;
  --gold: #ffd23f;
  --gold-deep: #e0a800;
  --red: #ef4b4b;
  --ink: #1e2a4a;
  --ink-soft: #56628a;
  --paper: #fffdf6;
  --card: #ffffff;
  --line: #dfe6f3;
  --shadow: 0 6px 0 rgb(30 42 74 / .12), 0 14px 30px rgb(30 42 74 / .10);
  --grass-a: #5fd07a; --grass-b: #54c56f;
  --dirt: #f3e2c0;
  --uphill: #ff9a1f;
  --downhill: #2fb7ff;
  --accel: #ff5fa2;
  --st-runaway: #ff4d4d; --st-front: #ff9a1f; --st-pace: #2fb24f; --st-late: #2a8fe0; --st-end: #9b5cff;
  --display: "Dela Gothic One", "M PLUS Rounded 1c", system-ui, sans-serif;
  --body: "M PLUS Rounded 1c", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-s: 10px; --r-m: 18px; --r-l: 26px;
  --gutter: clamp(16px, 4vw, 32px);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky-top: #0e2a52; --sky-bot: #16335c;
    --ink: #eef3ff; --ink-soft: #a9b6d8; --paper: #101a33; --card: #172646; --line: #2a3b63;
    --grass-a: #2f8f4a; --grass-b: #2a8443; --dirt: #c9b48c;
    --shadow: 0 6px 0 rgb(0 0 0 / .35), 0 14px 30px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  font-family: var(--body); font-size: 16px; line-height: 1.6; color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0, var(--sky-bot) 520px, var(--paper) 900px);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--pink); color: #fff; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p, li { text-wrap: pretty; }

/* ---------- sky ---------- */
.sky { position: fixed; inset: 0 0 auto 0; height: 420px; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud { position: absolute; background: #fff; border-radius: 999px; opacity: .55; filter: drop-shadow(0 6px 0 rgb(255 255 255 / .4)); animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.c1 { width: 140px; height: 40px; top: 16px; left: -160px; animation-duration: 60s; }
.c1::before { width: 60px; height: 60px; top: -28px; left: 24px; } .c1::after { width: 44px; height: 44px; top: -18px; left: 70px; }
.c2 { width: 100px; height: 30px; top: 52px; left: -120px; animation-duration: 85s; animation-delay: -30s; }
.c2::before { width: 44px; height: 44px; top: -20px; left: 18px; } .c2::after { width: 34px; height: 34px; top: -14px; left: 52px; }
.c3 { width: 180px; height: 46px; top: 4px; left: -200px; animation-duration: 110s; animation-delay: -70s; opacity: .6; }
.c3::before { width: 70px; height: 70px; top: -34px; left: 36px; } .c3::after { width: 52px; height: 52px; top: -22px; left: 96px; }
@keyframes drift { to { transform: translateX(calc(100vw + 400px)); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cloud { opacity: .08; } }

/* ---------- top bar ---------- */
.topbar {
  position: relative; z-index: 2; max-width: 1080px; margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-family: var(--display); font-size: 20px; text-shadow: 0 3px 0 var(--blue-deep); }
.logo svg { width: 34px; height: 34px; fill: var(--carrot); filter: drop-shadow(0 3px 0 var(--blue-deep)); }
.logo svg rect { fill: var(--ink); }
.badges { display: flex; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--card); box-shadow: 0 3px 0 rgb(30 42 74 / .18); font-size: 14px; font-variant-numeric: tabular-nums; }
.chip b { font-weight: 800; }
.chip small { color: var(--ink-soft); font-size: 11px; }
.chip.rank b { color: #fff; background: linear-gradient(135deg, #a66bff, #ff5fa2); padding: 0 8px; border-radius: 6px; }
.gem { width: 14px; height: 14px; background: linear-gradient(135deg, #7fe3ff, #2a8fe0); transform: rotate(45deg); border-radius: 3px; box-shadow: inset 0 0 0 2px rgb(255 255 255 / .5); }
@media (max-width: 480px) { .chip small { display: none; } .logo span { font-size: 17px; } }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 4px; padding: 6px; border-radius: 22px;
  background: var(--card); box-shadow: 0 6px 0 rgb(30 42 74 / .15), 0 18px 40px rgb(30 42 74 / .2);
  width: min(560px, calc(100% - 20px));
}
.tabs a {
  flex: 1; white-space: nowrap; display: grid; justify-items: center; gap: 0; padding: 6px 2px; border-radius: 16px;
  text-decoration: none; color: var(--ink-soft); font-size: 11px; font-weight: 700;
  transition: background-color .15s, color .15s, transform .15s var(--spring);
}
.tabs a .ti { font-size: 20px; line-height: 1.2; transition: transform .25s var(--spring); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--blue); color: #fff; box-shadow: inset 0 -3px 0 var(--blue-deep); }
.tabs a[aria-current="page"] .ti { transform: translateY(-2px) scale(1.12); }
.tabs a:active { transform: scale(.94); }
@media (min-width: 900px) {
  body { padding-bottom: 40px; }
  .tabs { position: sticky; top: 10px; bottom: auto; left: auto; transform: none; margin: 8px auto 0; }
  .tabs a { font-size: 13px; grid-auto-flow: column; gap: 6px; align-items: center; padding: 10px 6px; }
  .tabs a .ti { font-size: 18px; }
}

/* ---------- layout ---------- */
main { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 12px var(--gutter) 40px; }
.view { animation: view-in .28s var(--ease-out); }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }
.card { background: var(--card); border-radius: var(--r-l); box-shadow: var(--shadow); padding: clamp(18px, 3vw, 28px); margin-bottom: 22px; border: 2px solid var(--line); }
.grid2 { display: grid; gap: 22px; grid-template-columns: 1fr; }
.grid2 > .card { margin-bottom: 0; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.grid2 { margin-bottom: 22px; }

.display { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 8vw, 76px); color: #fff; letter-spacing: .01em; text-shadow: 0 4px 0 var(--blue-deep), 0 10px 24px rgb(23 103 179 / .35); line-height: 1.02; }
.display.sm { font-size: clamp(32px, 6vw, 52px); }
.sub { margin: 8px 0 20px; font-weight: 500; color: var(--ink); max-width: 62ch; }
.h2 { font-family: var(--display); font-weight: 400; font-size: clamp(22px, 3vw, 28px); }
.h2 small { font-family: var(--body); font-size: 14px; font-weight: 700; color: var(--ink-soft); margin-left: 6px; }
.h3 { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.section-h { margin: 8px 0 14px; }
.tiny { font-size: 12px; color: var(--ink-soft); margin: 10px 0 0; }
.note { font-size: 14px; color: var(--ink-soft); margin: 16px 0 0; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; vertical-align: middle; }
.pill.pink { background: var(--pink); color: #fff; box-shadow: 0 2px 0 var(--pink-deep); }
.pill.ghost { background: rgb(255 255 255 / .75); color: var(--ink); }
.card .pill.ghost { background: var(--paper); border: 1px solid var(--line); }
.count-pill { font-size: 12px; font-weight: 800; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-variant-numeric: tabular-nums; color: var(--ink-soft); }

/* ---------- buttons ---------- */
.btn {
  --b: var(--card); --b-edge: var(--line); --b-ink: var(--ink);
  font: inherit; font-weight: 800; font-size: 15px; color: var(--b-ink);
  background: var(--b); border: none; border-radius: 14px; cursor: pointer;
  padding: 11px 20px; min-height: 46px;
  box-shadow: 0 5px 0 var(--b-edge);
  transform: translateY(0); transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--b-edge); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.gold { --b: var(--gold); --b-edge: var(--gold-deep); --b-ink: #3a2a00; }
.btn.pink { --b: var(--pink); --b-edge: var(--pink-deep); --b-ink: #fff; }
.btn.red { --b: var(--red); --b-edge: #b92f2f; --b-ink: #fff; }
.btn.big { font-size: 17px; padding: 14px 28px; min-height: 54px; }

/* ---------- hero ---------- */
.hero { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: end; margin: 14px 0 22px; }
@media (min-width: 860px) { .hero { grid-template-columns: 1fr auto; } }
.kicker { margin: 0 0 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.hero .sub { color: #0f2d55; font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero .sub { color: var(--ink); } }
.bonus-card { display: grid; gap: 4px; background: var(--card); border-radius: var(--r-m); padding: 14px 18px; box-shadow: var(--shadow); transform: rotate(2deg); border: 3px solid var(--gold); justify-self: start; }
.bonus-title { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.bonus-stats { display: flex; gap: 8px; }
.bonus-stats b { font-family: var(--display); font-weight: 400; font-size: 22px; padding: 2px 10px; border-radius: 10px; color: #fff; }
.bonus-stats .stam { background: var(--blue); } .bonus-stats .guts { background: var(--carrot); }
.bonus-note { font-size: 13px; font-weight: 700; }

/* ---------- track ---------- */
.track-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.track-wrap { position: relative; }
#track { width: 100%; height: auto; display: block; border-radius: 22px; overflow: visible; }
#track .infield { font-family: var(--display); font-size: 30px; fill: rgb(255 255 255 / .35); letter-spacing: .1em; }
.seg-line { fill: none; stroke-width: 12; stroke-linecap: round; opacity: .9; }
.marker { cursor: pointer; }
.marker circle { fill: var(--card); stroke-width: 4; transition: transform .2s var(--spring); transform-box: fill-box; transform-origin: center; }
.marker text { font: 800 12px var(--body); fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.marker:hover circle, .marker:focus circle, .marker.on circle { transform: scale(1.25); }
.marker:focus { outline: none; }
.runner { transition: none; }
.runner circle { stroke: #fff; stroke-width: 3; }
.runner text { font: 800 10px var(--body); fill: #fff; text-anchor: middle; dominant-baseline: central; }
.runner.me circle { stroke: var(--gold); stroke-width: 4; }
.ticker {
  margin-top: 12px; min-height: 48px; padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; gap: 10px;
}
.ticker::before { content: "📣"; }
.ticker.pop { animation: pop .35s var(--spring); }
@keyframes pop { 50% { transform: scale(1.03); } }
.legend { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; font-weight: 700; }
.legend i { display: inline-block; width: 22px; height: 8px; border-radius: 4px; vertical-align: middle; margin-right: 6px; }
.legend i.flag { width: 14px; height: 14px; background: repeating-conic-gradient(var(--ink) 0 25%, #fff 0 50%) 0 0 / 7px 7px; border-radius: 2px; }
.results-board { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- styles picker ---------- */
.styles { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 12px; margin-bottom: 22px; overflow-x: auto; padding: 4px 4px 12px; scroll-snap-type: x mandatory; }
.style-card {
  --c: var(--st-front);
  scroll-snap-align: start; position: relative; text-align: left;
  font: inherit; color: var(--ink); cursor: pointer;
  background: var(--card); border: 3px solid var(--line); border-radius: var(--r-m);
  padding: 14px 14px 16px; box-shadow: 0 5px 0 var(--line);
  transition: transform .2s var(--spring), border-color .15s, box-shadow .15s;
}
.style-card:hover { transform: translateY(-3px); }
.style-card:active { transform: translateY(2px); }
.style-card .sc-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--c); color: #fff; font-size: 22px; box-shadow: 0 3px 0 rgb(0 0 0 / .15); margin-bottom: 10px; }
.style-card .sc-name { display: block; font-weight: 800; font-size: 15px; }
.style-card .sc-tier { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); }
.style-card[aria-checked="true"] { border-color: var(--c); box-shadow: 0 5px 0 var(--c); transform: translateY(-4px); }
.style-card[aria-checked="true"]::after { content: "✓"; position: absolute; top: 10px; right: 12px; width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 13px; animation: pop .3s var(--spring); }
@media (max-width: 700px) { .styles { grid-template-columns: repeat(5, 132px); } }

/* ---------- gauges ---------- */
.gauges { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.gauge { display: grid; grid-template-columns: 76px 1fr 64px; gap: 10px; align-items: center; }
.g-name { font-weight: 800; font-size: 14px; }
.g-name small { display: block; font-size: 10px; font-weight: 800; color: var(--pink); }
.g-bar { position: relative; height: 18px; border-radius: 9px; background: var(--paper); border: 2px solid var(--line); overflow: hidden; }
.g-fill { position: absolute; inset: 0; border-radius: 7px; transform-origin: left; transform: scaleX(0); transition: transform .7s var(--spring); }
.g-fill::after { content: ""; position: absolute; inset: 2px 6px auto 6px; height: 4px; border-radius: 2px; background: rgb(255 255 255 / .45); }
.g-val { font-family: var(--display); font-size: 17px; text-align: right; font-variant-numeric: tabular-nums; }
.gauge[data-s="speed"] .g-fill { background: #2fb7ff; }
.gauge[data-s="stamina"] .g-fill { background: #ff5f7e; }
.gauge[data-s="power"] .g-fill { background: #ff9a1f; }
.gauge[data-s="guts"] .g-fill { background: #ff5fa2; }
.gauge[data-s="wit"] .g-fill { background: #2fb24f; }

/* ---------- checklist ---------- */
.checklist, .warns, .results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--paper); border: 2px solid var(--line); cursor: pointer; transition: border-color .15s, background-color .15s; }
.checklist input { appearance: none; flex: none; width: 24px; height: 24px; margin: 0; border-radius: 8px; border: 3px solid var(--line); background: var(--card); display: grid; place-items: center; transition: background-color .15s, border-color .15s; cursor: pointer; }
.checklist input::after { content: "✓"; color: #fff; font-weight: 800; font-size: 14px; transform: scale(0); transition: transform .25s var(--spring); }
.checklist input:checked { background: var(--turf); border-color: var(--turf-deep); }
.checklist input:checked::after { transform: scale(1); }
.checklist label:has(input:checked) { border-color: var(--turf); }
.checklist label:has(input:checked) span { color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 2px; }
.warn-h { margin-top: 22px; }
.warns li, .results li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.warns li::before { content: "!"; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--carrot); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 13px; margin-top: 2px; }

/* ---------- build check ---------- */
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.field-row label { font-weight: 800; }
select, input[type="text"], input[type="number"], input[type="search"], input[type="password"] {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 46px;
}
select:focus, input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 4px rgb(42 143 224 / .2); }
.slider { display: grid; grid-template-columns: 76px 1fr 72px; gap: 10px; align-items: center; margin-bottom: 14px; }
.slider label { font-weight: 800; font-size: 14px; }
.slider output { font-family: var(--display); font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.slider output.ok { color: var(--turf-deep); } .slider output.low { color: var(--red); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--c, var(--blue)) var(--p, 50%), var(--line) var(--p, 50%)); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 4px solid var(--c, var(--blue)); box-shadow: 0 3px 0 rgb(0 0 0 / .15); cursor: grab; transition: transform .15s var(--spring); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); cursor: grabbing; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 4px solid var(--c, var(--blue)); cursor: grab; }
input[type="range"]:focus-visible { box-shadow: 0 0 0 4px rgb(255 210 63 / .6); }
.toggles { display: grid; gap: 12px; margin-top: 8px; }
.seg { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seg-label { font-weight: 800; font-size: 14px; margin-right: auto; }
.seg button { font: inherit; font-weight: 800; min-width: 48px; min-height: 42px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; transition: transform .15s var(--spring); }
.seg button[aria-checked="true"] { background: var(--blue); border-color: var(--blue-deep); color: #fff; box-shadow: inset 0 -3px 0 var(--blue-deep); }
.seg button:active { transform: scale(.92); }
.verdict-card { display: grid; align-content: start; gap: 16px; }
.stamp {
  --sc: var(--carrot);
  justify-self: center; display: grid; place-items: center; text-align: center;
  width: 180px; height: 180px; border-radius: 50%;
  border: 8px double var(--sc); color: var(--sc);
  font-family: var(--display); font-size: 24px; line-height: 1.1; padding: 20px;
  transform: rotate(-8deg);
}
.stamp.slam { animation: slam .45s var(--spring); }
@keyframes slam { 0% { transform: rotate(-8deg) scale(1.6); opacity: 0; } 100% { transform: rotate(-8deg) scale(1); opacity: 1; } }
.stamp.ready { --sc: var(--turf-deep); } .stamp.close { --sc: var(--carrot); } .stamp.far { --sc: var(--red); }
.readouts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.readouts div { background: var(--paper); border-radius: 14px; padding: 10px 12px; border: 2px solid var(--line); }
.readouts dt { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.readouts dd { margin: 0; font-family: var(--display); font-size: 22px; font-variant-numeric: tabular-nums; }
.results li::before { flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; margin-top: 1px; }
.results li.pass::before { content: "✓"; background: var(--turf); }
.results li.fail::before { content: "✗"; background: var(--red); }
.results li.tip::before { content: "i"; background: var(--blue); }

/* ---------- send ---------- */
.send-card { display: grid; gap: 18px; }
.capsule {
  position: relative; display: grid; justify-items: center; gap: 4px; text-align: center; cursor: pointer;
  padding: 26px 16px; border-radius: var(--r-l); border: 3px dashed var(--line); background: var(--paper);
  transition: border-color .15s, background-color .15s, transform .2s var(--spring);
}
.capsule:hover, .capsule.over { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 7%, var(--paper)); }
.capsule.over { transform: scale(1.02); }
.capsule:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.capsule input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.capsule-ball { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; display: grid; grid-template-rows: 1fr 1fr; box-shadow: 0 5px 0 rgb(0 0 0 / .12), inset 0 0 0 4px rgb(255 255 255 / .6); margin-bottom: 8px; animation: bob 2.4s ease-in-out infinite; }
.capsule-ball .top { background: var(--pink); border-bottom: 4px solid var(--ink); }
.capsule-ball .bot { background: #fff; }
.capsule-ball { outline: 3px solid var(--ink); outline-offset: -3px; }
.capsule.over .capsule-ball { animation: wobble .5s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes wobble { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.drop-main { font-weight: 800; font-size: 18px; }
.drop-sub { font-size: 13px; color: var(--ink-soft); }
.queue { display: flex; gap: 12px; flex-wrap: wrap; }
.q-item { position: relative; width: 86px; animation: pop-in .35s var(--spring); }
@keyframes pop-in { from { transform: scale(.5); opacity: 0; } }
.q-item img { width: 86px; height: 112px; object-fit: cover; border-radius: 12px; border: 3px solid var(--line); }
.q-item.done img { border-color: var(--turf); } .q-item.fail img { border-color: var(--red); }
.q-item.sending img { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.q-item button { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 50%; border: none; background: var(--ink); color: #fff; font-size: 16px; cursor: pointer; box-shadow: 0 2px 0 rgb(0 0 0 / .2); }
.q-state { display: block; font-size: 12px; font-weight: 800; text-align: center; margin-top: 4px; color: var(--ink-soft); }
.q-item.done .q-state { color: var(--turf-deep); } .q-item.fail .q-state { color: var(--red); }
.cats { border: none; padding: 0; margin: 0; }
.cats legend { font-weight: 800; font-size: 14px; margin-bottom: 8px; padding: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { font: inherit; font-size: 14px; font-weight: 700; padding: 8px 14px; min-height: 40px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; transition: transform .15s var(--spring); }
.chips button[aria-checked="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips button:active { transform: scale(.94); }
.field { display: grid; gap: 6px; font-weight: 800; font-size: 14px; }
.field em { font-style: normal; font-weight: 500; color: var(--ink-soft); }
.field input { width: 100%; }
.actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.status { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.status.error { color: var(--red); } .status.ok { color: var(--turf-deep); }
.inbox-head { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; }
.inbox { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.inbox li { background: var(--card); border-radius: var(--r-m); overflow: hidden; box-shadow: var(--shadow); border: 2px solid var(--line); display: grid; transition: transform .2s var(--spring); }
.inbox li:hover { transform: translateY(-3px) rotate(-1deg); }
.inbox .thumb { display: block; aspect-ratio: 3 / 4; background: var(--paper); }
.inbox .thumb img { width: 100%; height: 100%; object-fit: cover; }
.inbox .meta { padding: 10px 12px 12px; display: grid; gap: 3px; font-size: 13px; }
.inbox .cat { font-weight: 800; }
.inbox .when { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.inbox .note { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.inbox .del { justify-self: start; background: none; border: none; padding: 4px 0; color: var(--red); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.empty { grid-column: 1 / -1; text-align: center; padding: 30px 16px; border-radius: var(--r-m); border: 3px dashed var(--line); color: var(--ink-soft); font-weight: 700; background: var(--card); }

/* ---------- trainer ---------- */
.trainer-hero { display: flex; gap: 18px; align-items: center; background: linear-gradient(135deg, var(--blue), #7a6bff); border: none; margin-top: 14px; }
.trainer-hero .display { text-shadow: 0 4px 0 rgb(0 0 0 / .2); }
.trainer-hero .sub { color: #fff; margin-bottom: 0; }
.avatar { flex: none; width: 76px; height: 76px; border-radius: 22px; background: #fff; display: grid; place-items: center; font-size: 42px; box-shadow: 0 5px 0 rgb(0 0 0 / .18); transform: rotate(-6deg); }
mark.q { background: var(--gold); color: #3a2a00; padding: 0 6px; border-radius: 6px; font-weight: 800; }
.saver-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.carat-input { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.carat-input input { width: 120px; font-variant-numeric: tabular-nums; }
.jar { position: relative; height: 34px; border-radius: 17px; background: var(--paper); border: 3px solid var(--line); overflow: visible; }
.jar-fill { position: absolute; inset: 0; border-radius: 14px; background: repeating-linear-gradient(-45deg, var(--carrot) 0 14px, #ffb24f 14px 28px); transform-origin: left; transform: scaleX(0); transition: transform .9s var(--spring); }
.jar-runner { position: absolute; top: 50%; left: 0; font-size: 30px; transform: translate(-50%, -55%); transition: left .9s var(--spring); filter: drop-shadow(0 3px 0 rgb(0 0 0 / .15)); }
.jar-text { margin: 12px 0 0; font-weight: 700; font-size: 15px; }

/* ---------- prose ---------- */
.prose { font-size: 15px; }
.prose > :first-child { margin-top: 0; }
.prose h1 { display: none; }
.prose h2 { font-family: var(--display); font-weight: 400; font-size: 21px; margin: 26px 0 10px; padding-top: 16px; border-top: 3px dotted var(--line); }
.prose h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.prose h3 { font-size: 16px; font-weight: 800; margin: 18px 0 8px; }
.prose p { margin: 0 0 10px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 1.3em; }
.prose li { margin: 4px 0; }
.prose li::marker { color: var(--pink); }
.prose strong { font-weight: 800; }
.prose code { font-size: .88em; background: var(--paper); border: 1px solid var(--line); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0 16px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.prose th { background: var(--paper); font-weight: 800; }
.prose hr { border: none; border-top: 3px dotted var(--line); margin: 20px 0; }
.loading { color: var(--ink-soft); font-weight: 700; }

/* ---------- playbook ---------- */
.pb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.updated { margin: 0; font-size: 13px; font-weight: 700; color: #0f2d55; }
.search { position: relative; margin: 14px 0 18px; }
.search input { width: 100%; padding-left: 44px; min-height: 54px; border-radius: 18px; font-size: 17px; background: var(--card); box-shadow: var(--shadow); }
.search::before { content: "🔎"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 18px; }
.search-count { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.pb-sections { display: grid; gap: 12px; }
.pb-sec { background: var(--card); border-radius: var(--r-m); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); overflow: hidden; }
.pb-sec > summary { list-style: none; cursor: pointer; padding: 16px 52px 16px 18px; font-weight: 800; font-size: 16px; position: relative; display: flex; gap: 10px; align-items: center; }
.pb-sec > summary::-webkit-details-marker { display: none; }
.pb-sec > summary::after { content: "+"; position: absolute; right: 16px; top: 50%; width: 28px; height: 28px; margin-top: -14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--line); display: grid; place-items: center; font-size: 18px; transition: transform .25s var(--spring); }
.pb-sec[open] > summary::after { transform: rotate(45deg); background: var(--pink); color: #fff; border-color: var(--pink); }
.pb-sec .num { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--blue); color: #fff; font-family: var(--display); font-size: 14px; }
.pb-sec .body { padding: 0 18px 18px; }
.pb-sec .hits { margin-left: auto; font-size: 12px; font-weight: 800; background: var(--gold); color: #3a2a00; padding: 1px 8px; border-radius: 999px; }
mark.hl { background: color-mix(in srgb, var(--gold) 70%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- dialog + confetti ---------- */
.dialog { border: none; border-radius: var(--r-l); padding: 24px; max-width: 380px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgb(30 42 74 / .5); }
.dialog p { color: var(--ink-soft); margin: 0 0 20px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .cloud { display: none; }
}

/* ================= v2: accounts, rating, admin ================= */
textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; resize: vertical; }
textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 4px rgb(42 143 224 / .2); }

/* auth */
.auth { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 20px var(--gutter) 60px; display: grid; gap: 28px; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 900px) { .auth { grid-template-columns: 1.15fr 1fr; padding-top: 50px; } }
.auth-hero .sub { color: #0f2d55; font-weight: 700; font-size: 17px; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.perks li { display: flex; align-items: center; gap: 12px; background: rgb(255 255 255 / .8); border-radius: 14px; padding: 10px 14px; font-weight: 700; box-shadow: 0 3px 0 rgb(30 42 74 / .1); }
.perks span { font-size: 22px; }
.auth-card { display: grid; gap: 14px; margin: 0; transform: rotate(-1deg); }
.auth-card:focus-within { transform: none; transition: transform .3s var(--spring); }
.auth-tabs { justify-content: stretch; }
.auth-tabs button { flex: 1; }
.auth-tabs button[aria-selected="true"] { background: var(--blue); border-color: var(--blue-deep); color: #fff; box-shadow: inset 0 -3px 0 var(--blue-deep); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* user menu */
.user-menu { position: relative; }
.user-btn { border: none; cursor: pointer; font: inherit; color: var(--ink); }
.user-btn .ava { font-size: 16px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; z-index: 30; display: grid; animation: pop-in .2s var(--spring); }
.menu a, .menu button { text-align: left; font: inherit; font-weight: 700; font-size: 15px; padding: 10px 12px; border-radius: 10px; border: none; background: none; color: var(--ink); text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--paper); }
@media (max-width: 480px) { .user-btn b { display: none; } .chip.carat { padding: 6px 10px; } }

/* profile */
.profile-card { display: grid; gap: 14px; }
.profile-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .profile-grid { grid-template-columns: 1.3fr 1fr 1fr; } }
.profile-grid select, .profile-grid input { width: 100%; }

/* rate */
.rate-card { display: grid; gap: 16px; }
.gold-capsule .capsule-ball .top { background: var(--gold); }
.gold-capsule:hover, .gold-capsule.over { border-color: var(--gold-deep); background: color-mix(in srgb, var(--gold) 10%, var(--paper)); }
.rating { display: grid; gap: 18px; margin-bottom: 22px; animation: view-in .4s var(--ease-out); }
.rating-top { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 760px) { .rating-top { grid-template-columns: auto 1fr; } }
.rating .stamp { width: 170px; height: 170px; font-size: 21px; }
.stamp.cannot { --sc: var(--ink-soft); }
.rating-name { font-family: var(--display); font-size: clamp(26px, 4vw, 36px); line-height: 1.1; }
.rating-name small { display: block; font-family: var(--body); font-size: 14px; font-weight: 800; color: var(--ink-soft); margin-top: 4px; }
.headline { font-size: 18px; font-weight: 800; margin: 8px 0 0; }
.score-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.score-bar { flex: 1; height: 16px; border-radius: 8px; background: var(--paper); border: 2px solid var(--line); overflow: hidden; }
.score-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold) 50%, var(--turf)); transform-origin: left; transition: transform .9s var(--spring); }
.score-num { font-family: var(--display); font-size: 24px; font-variant-numeric: tabular-nums; }
.apt-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.apt { display: grid; justify-items: center; gap: 2px; background: var(--paper); border: 2px solid var(--line); border-radius: 12px; padding: 6px 2px; }
.apt small { font-size: 10px; font-weight: 800; color: var(--ink-soft); }
.apt b { font-family: var(--display); font-size: 20px; }
.apt[data-g="S"] b { color: var(--gold-deep); } .apt[data-g="A"] b { color: var(--turf-deep); }
.apt[data-g="B"] b, .apt[data-g="C"] b { color: var(--carrot); } .apt[data-g="D"] b, .apt[data-g="E"] b, .apt[data-g="F"] b, .apt[data-g="G"] b { color: var(--red); }
.skill-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-chips span { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); }
.skill-chips .unique { background: linear-gradient(135deg, #ffe3f0, #e8e2ff); border-color: var(--pink); }
.skill-chips .gold { background: #fff4c7; border-color: var(--gold-deep); }
.skill-chips .green { background: #e2f7e6; border-color: var(--turf); }
.skill-chips .debuff { background: #ffe1e1; border-color: var(--red); }
.lists { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .lists { grid-template-columns: repeat(3, 1fr); } }
.lists h3 { font-size: 15px; font-weight: 800; margin: 0 0 8px; }
.lists ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: 15px; }
.lists .good li::marker { color: var(--turf); } .lists .bad li::marker { color: var(--red); } .lists .fix li::marker { color: var(--blue); }
.working { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 30px 16px; }
.runner-anim { font-size: 44px; animation: gallop .5s ease-in-out infinite alternate; }
@keyframes gallop { from { transform: translateX(-30px) rotate(-6deg); } to { transform: translateX(30px) rotate(6deg); } }
.eval-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.eval-list button { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; cursor: pointer; box-shadow: 0 3px 0 var(--line); transition: transform .15s var(--spring); }
.eval-list button:hover { transform: translateY(-2px); }
.eval-badge { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-family: var(--display); color: #fff; font-size: 17px; }
.eval-badge.ready { background: var(--turf); } .eval-badge.almost { background: var(--carrot); } .eval-badge.not_ready { background: var(--red); } .eval-badge.pending { background: var(--blue); } .eval-badge.failed, .eval-badge.cannot_tell { background: var(--ink-soft); }
.eval-meta { display: grid; }
.eval-meta b { font-weight: 800; } .eval-meta small { color: var(--ink-soft); font-size: 13px; }

/* admin */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px 8px; border-bottom: 2px solid var(--line); text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin-table th { font-size: 12px; color: var(--ink-soft); }
.admin-table tr.sel td { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.admin-table button { font: inherit; font-weight: 800; font-size: 13px; border: none; background: none; color: var(--blue); cursor: pointer; padding: 4px 6px; }
.admin-table .tag { font-size: 11px; font-weight: 800; background: var(--pink); color: #fff; padding: 1px 6px; border-radius: 6px; margin-left: 6px; }
.new-dot { display: inline-block; min-width: 22px; text-align: center; padding: 1px 6px; border-radius: 999px; background: var(--gold); font-weight: 800; }

/* ================= v2.5: same look, less childish ================= */
/* calmer sky: no cartoon clouds */
.sky { display: none; }
/* headings: keep Dela Gothic but drop the heavy sticker shadow */
.display { text-shadow: 0 2px 0 rgb(23 103 179 / .55); letter-spacing: 0; }
.trainer-hero .display { text-shadow: none; }
.logo { text-shadow: 0 2px 0 rgb(23 103 179 / .5); }
.logo svg { filter: none; }
/* no tilted cards */
.bonus-card, .auth-card, .avatar { transform: none; }
.auth-card:focus-within { transform: none; }
.bonus-card { border-width: 2px; }
/* flatter 3D: thinner press edges, softer shadows */
.btn { box-shadow: 0 3px 0 var(--b-edge); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--b-edge); }
:root { --shadow: 0 3px 0 rgb(30 42 74 / .08), 0 10px 24px rgb(30 42 74 / .08); }
.card { border-width: 1px; }
.style-card { box-shadow: 0 3px 0 var(--line); border-width: 2px; }
.style-card:hover { transform: translateY(-2px); }
.style-card[aria-checked="true"] { transform: translateY(-2px); box-shadow: 0 3px 0 var(--c); }
.style-card[aria-checked="true"]::after { animation: none; }
.style-card .sc-icon { font-family: var(--display); font-size: 20px; width: 40px; height: 40px; border-radius: 12px; }
.inbox li:hover { transform: translateY(-2px); }
/* tab icons: clean line icons instead of emoji */
.tabs a .ti { display: grid; place-items: center; height: 24px; }
.tabs a .ti svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] .ti { transform: none; }
@media (min-width: 900px) { .tabs a .ti svg { width: 18px; height: 18px; } }
.perks span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--blue); color: #fff; flex: none; }
.perks span svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.user-btn .ava, .avatar { font-family: var(--display); text-transform: uppercase; color: var(--blue-deep); }
.user-btn .ava { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--gold); color: #3a2a00; font-size: 13px; }
.avatar { font-size: 32px; }
/* upload capsule: static, no bobbing */
.capsule-ball, .capsule.over .capsule-ball { animation: none; width: 56px; height: 56px; }
.capsule.over { transform: none; }
/* verdict: tidy badge instead of a rotated rubber stamp */
.stamp { width: auto; height: auto; border-radius: 16px; border: 3px solid var(--sc); transform: none; padding: 14px 22px; font-size: 24px; justify-self: start; background: color-mix(in srgb, var(--sc) 10%, var(--card)); }
.stamp.slam { animation: badge-in .3s var(--ease-out); }
@keyframes badge-in { from { opacity: 0; transform: translateY(6px); } }
.rating .stamp { width: auto; height: auto; font-size: 24px; }
@media (min-width: 760px) { .rating-top { grid-template-columns: auto 1fr; } }
/* ticker without the megaphone */
.ticker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
/* working state: progress sweep instead of a galloping emoji */
.runner-anim { display: block; width: 100%; max-width: 360px; height: 6px; border-radius: 3px; font-size: 0; background: linear-gradient(90deg, transparent, var(--blue), transparent) 0 0 / 40% 100% no-repeat, var(--line); animation: sweep 1.3s linear infinite; }
@keyframes sweep { from { background-position: -40% 0, 0 0; } to { background-position: 140% 0, 0 0; } }
/* savings bar: no running carrot */
.jar-runner { display: none; }
.jar { height: 22px; border-width: 2px; }
/* list headings get small colour keys instead of emoji */
.lists h3 { display: flex; align-items: center; gap: 8px; }
.lists h3::before { content: ""; width: 10px; height: 10px; border-radius: 3px; }
.lists .good h3::before { background: var(--turf); } .lists .bad h3::before { background: var(--red); } .lists .fix h3::before { background: var(--blue); }
.search::before { content: ""; width: 12px; height: 12px; border: 2px solid var(--ink-soft); border-radius: 50%; left: 18px; margin-top: -2px; font-size: 0; }
.checklist input::after { font-size: 12px; }
/* gentler motion overall */
.tabs a, .style-card, .seg button, .chips button, .inbox li { transition-timing-function: var(--ease-out); }
@media (min-width: 900px) { .tabs { width: auto; max-width: 820px; } .tabs a { flex: none; padding: 10px 14px; } }
.logo { white-space: nowrap; }
@media (max-width: 480px) { .logo { font-size: 16px; gap: 6px; } .logo svg { width: 26px; height: 26px; } .badges { gap: 6px; } .chip { padding: 5px 9px; } }
@media (min-width: 900px) { .tabs { width: fit-content; max-width: calc(100% - 20px); } }
@media (max-width: 420px) { .chip { font-size: 13px; padding: 4px 8px; gap: 5px; } .logo span { font-size: 15px; } .topbar { gap: 8px; padding-left: 14px; padding-right: 14px; } }

/* ================= v2.6: optional accounts ================= */
.auth { position: fixed; inset: 0; z-index: 40; max-width: none; margin: 0; overflow-y: auto; padding: 24px var(--gutter) 40px;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bot) 60%, var(--paper)); align-content: center; }
@media (min-width: 900px) { .auth { padding-left: max(var(--gutter), calc((100vw - 1080px) / 2)); padding-right: max(var(--gutter), calc((100vw - 1080px) / 2)); } }
.auth-close { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 14px; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--card); color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; box-shadow: var(--shadow); z-index: 41; }
body.modal-open { overflow: hidden; }
.save-btn { min-height: 36px; padding: 6px 14px; font-size: 14px; border-radius: 12px; }
.guest-note { margin: 0; font-size: 14px; color: var(--ink-soft); background: var(--paper); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; }
.linkish { font: inherit; font-weight: 800; color: var(--blue); background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline; }
@media (max-width: 420px) { .save-btn { padding: 4px 10px; font-size: 13px; min-height: 32px; } }
.auth { align-content: start; padding-top: calc(64px + env(safe-area-inset-top)); }
@media (min-width: 900px) { .auth { align-content: center; padding-top: 40px; } }

/* ================= v3: coach-first layout ================= */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.left-chip b { color: var(--blue-deep); }
.guest-card-link { text-decoration: none; font-weight: 700; }
@media (max-width: 480px) { .left-chip small, .guest-card-link { display: none; } }

/* coach chat */
.coach { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 10px; }
@media (min-width: 900px) { .coach { grid-template-columns: 250px 1fr; align-items: start; } }
.threads { padding: 14px; margin: 0; display: grid; gap: 10px; align-content: start; }
@media (min-width: 900px) { .threads { position: sticky; top: 90px; max-height: calc(100dvh - 120px); overflow-y: auto; } }
.new-chat { width: 100%; }
#thread-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
#thread-list li { display: flex; align-items: center; gap: 4px; border-radius: 10px; }
#thread-list button.t { flex: 1; min-width: 0; text-align: left; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); background: none; border: none; padding: 9px 10px; border-radius: 10px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#thread-list button.t small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-soft); }
#thread-list li:hover, #thread-list li.on { background: var(--paper); }
#thread-list li.on button.t { color: var(--blue-deep); }
#thread-list button.x { flex: none; width: 28px; height: 28px; border: none; background: none; color: var(--ink-soft); border-radius: 8px; cursor: pointer; font-size: 18px; opacity: 0; }
#thread-list li:hover button.x, #thread-list li.on button.x { opacity: 1; }
@media (max-width: 899px) { .threads { max-height: 190px; overflow-y: auto; } #thread-list button.x { opacity: 1; } }
.chat { margin: 0; padding: 0; display: grid; grid-template-rows: 1fr auto; min-height: min(70dvh, 720px); overflow: hidden; }
.chat-log { padding: 20px; display: grid; gap: 16px; align-content: start; overflow-y: auto; max-height: calc(100dvh - 260px); }
.msg { display: grid; gap: 6px; max-width: 88%; }
.msg.me { justify-self: end; }
.msg .bubble { padding: 12px 16px; border-radius: 18px; font-size: 15px; line-height: 1.6; }
.msg.me .bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.coach .bubble { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg .who { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.msg.me .who { justify-self: end; }
.msg .pics { display: flex; gap: 6px; flex-wrap: wrap; }
.msg.me .pics { justify-content: flex-end; }
.msg .pics img { width: 70px; height: 92px; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); }
.msg .bubble.err { background: #fff1f1; border-color: #f3c2c2; color: #8a2020; }
.bubble.prose > :last-child { margin-bottom: 0; }
.bubble.prose ul { margin: 6px 0 10px; }
.typing { display: inline-flex; gap: 5px; padding: 4px 0; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.welcome { display: grid; gap: 14px; padding: 10px 4px; }
.welcome h2 { font-family: var(--display); font-weight: 400; font-size: clamp(24px, 3.4vw, 32px); }
.welcome p { margin: 0; color: var(--ink-soft); max-width: 60ch; }
.suggest { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .suggest { grid-template-columns: 1fr 1fr; } }
.suggest button { text-align: left; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; transition: border-color .15s, transform .15s var(--ease-out); }
.suggest button:hover { border-color: var(--blue); transform: translateY(-1px); }
.composer { border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 8px; background: var(--card); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; resize: none; min-height: 46px; max-height: 180px; border-radius: 14px; }
.attach { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--line); cursor: pointer; color: var(--ink-soft); position: relative; }
.attach:hover { color: var(--blue); border-color: var(--blue); }
.attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.attach svg, .send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.send { width: 46px; min-width: 46px; padding: 0; min-height: 46px; }
.composer .q-item, .composer .q-item img { width: 60px; } .composer .q-item img { height: 78px; }
.composer .status:empty { display: none; }

/* tool pages */
.tool-head { margin: 14px 0 6px; }
.tool-form { display: grid; gap: 16px; }
.tool-fields { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .tool-fields { grid-template-columns: repeat(2, 1fr); } .tool-fields .wide { grid-column: 1 / -1; } }
.tool-fields input, .tool-fields select { width: 100%; }
.result-card { display: grid; gap: 18px; animation: view-in .3s var(--ease-out); }
.result-head { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; }
.result-head .headline { margin: 0; flex: 1 1 280px; }
.buy-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: buy; }
.buy-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; counter-increment: buy; }
.buy-list li::before { content: counter(buy); width: 30px; height: 30px; border-radius: 10px; background: var(--blue); color: #fff; display: grid; place-items: center; font-family: var(--display); font-size: 15px; }
.buy-list b { display: block; font-size: 16px; }
.buy-list .why { color: var(--ink-soft); font-size: 14px; }
.buy-list .cost { font-family: var(--display); font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.prio { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; vertical-align: 2px; }
.prio.must { background: var(--pink); color: #fff; } .prio.strong { background: var(--blue); color: #fff; } .prio.nice { background: var(--line); color: var(--ink); }
.sp-meter { display: grid; gap: 6px; min-width: 220px; }
.sp-meter .bar { height: 12px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.sp-meter .bar span { display: block; height: 100%; background: var(--turf); transform-origin: left; }
.sp-meter .bar.over span { background: var(--red); }
.sp-meter small { font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.skip-list { margin: 0; padding-left: 1.2em; color: var(--ink-soft); display: grid; gap: 4px; font-size: 14px; }
.deck-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) { .deck-grid { grid-template-columns: repeat(3, 1fr); } }
.deck-card { --t: var(--line); border: 2px solid var(--line); border-top: 5px solid var(--t); border-radius: 14px; padding: 10px 12px 12px; background: var(--card); display: grid; gap: 4px; }
.deck-card small { font-size: 11px; font-weight: 800; color: var(--ink-soft); text-transform: capitalize; }
.deck-card b { font-size: 15px; line-height: 1.3; }
.deck-card span { font-size: 13px; color: var(--ink-soft); }
.deck-card[data-t="speed"] { --t: #2fb7ff; } .deck-card[data-t="stamina"] { --t: #ff5f7e; } .deck-card[data-t="power"] { --t: var(--carrot); }
.deck-card[data-t="guts"] { --t: var(--pink); } .deck-card[data-t="wit"] { --t: var(--turf); } .deck-card[data-t="pal"], .deck-card[data-t="group"] { --t: var(--gold); }
.deck-card.borrow { border-style: dashed; }
.parents { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .parents { grid-template-columns: 1fr 1fr; } }
.parents div { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.parents b { display: block; }
.parents span { font-size: 14px; color: var(--ink-soft); }
.pick-card { display: grid; gap: 4px; background: color-mix(in srgb, var(--gold) 14%, var(--card)); border: 2px solid var(--gold); border-radius: 16px; padding: 14px 16px; }
.pick-card small { font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.pick-card b { font-family: var(--display); font-weight: 400; font-size: 22px; }
.pick-card span { color: var(--ink-soft); font-size: 14px; }
.stamp.pull, .stamp.pick { --sc: var(--turf-deep); } .stamp.save { --sc: var(--blue); } .stamp.skip { --sc: var(--red); }
.hist-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
/* v3 layout fixes */
.coach > * { min-width: 0; }
.threads { overflow-x: hidden; }
#thread-list li { min-width: 0; }
.guest-card-link { color: var(--ink); }
@media (max-width: 899px) {
  .threads { display: flex; align-items: center; gap: 8px; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 10px; border-radius: 18px; }
  .new-chat { width: auto; flex: none; min-height: 40px; padding: 8px 14px; font-size: 14px; }
  #thread-list { display: flex; gap: 6px; }
  #thread-list li { flex: none; max-width: 210px; background: var(--paper); }
  #thread-list button.t { padding: 6px 8px; }
  .chat { overflow: visible; min-height: 0; }
  .chat-log { max-height: none; overflow: visible; padding: 16px; }
  .composer { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom)); border-radius: 0 0 26px 26px; box-shadow: 0 -8px 20px rgb(30 42 74 / .06); z-index: 5; }
  .msg { max-width: 94%; }
}

/* ================= v3.1: stable + CM sim ================= */
.stable-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
@media (min-width: 900px) { .stable-bar { position: sticky; top: 84px; z-index: 6; } }
.stable-sel { margin: 0; font-weight: 700; }
.stable-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stable-grid { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.uma-card { position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 14px 16px 12px; display: grid; gap: 10px; box-shadow: 0 3px 0 var(--line); transition: border-color .15s, transform .15s var(--ease-out); }
.uma-card.sel { border-color: var(--pink); box-shadow: 0 3px 0 var(--pink); }
.uma-card label.pick { position: absolute; inset: 0; border-radius: 18px; cursor: pointer; }
.uma-card label.pick input { position: absolute; opacity: 0; }
.uma-card .check { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); background: var(--paper); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; pointer-events: none; }
.uma-card.sel .check { background: var(--pink); border-color: var(--pink-deep); }
.uma-card .uname { font-family: var(--display); font-size: 20px; padding-right: 34px; line-height: 1.15; }
.uma-card .umeta { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.mini-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.mini-stats div { background: var(--paper); border-radius: 10px; padding: 4px 2px; text-align: center; }
.mini-stats small { display: block; font-size: 10px; font-weight: 800; color: var(--ink-soft); }
.mini-stats b { font-family: var(--display); font-size: 15px; font-variant-numeric: tabular-nums; }
.mini-stats b.miss { color: var(--red); }
.uma-card .apts { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; font-weight: 800; }
.uma-card .apts span { background: var(--paper); border-radius: 8px; padding: 2px 8px; }
.uma-card .apts span b[data-g="S"] { color: var(--gold-deep); } .uma-card .apts span b[data-g="A"] { color: var(--turf-deep); }
.uma-card .apts span b[data-g="B"], .uma-card .apts span b[data-g="C"] { color: var(--carrot); } .uma-card .apts span b[data-g="D"], .uma-card .apts span b[data-g="E"], .uma-card .apts span b[data-g="F"], .uma-card .apts span b[data-g="G"] { color: var(--red); }
.uma-card .row { display: flex; gap: 6px; position: relative; z-index: 1; }
.uma-card .row button { font: inherit; font-size: 13px; font-weight: 800; border: none; background: none; color: var(--blue); cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.uma-card .row button:hover { background: var(--paper); }
.uma-card .row button.del { color: var(--red); margin-left: auto; }
.uma-dlg { max-width: 560px; width: calc(100% - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; }
.uma-form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
.uma-form-grid input, .uma-form-grid select { width: 100%; }
.stat-inputs, .apt-inputs { border: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; grid-template-columns: repeat(5, 1fr); }
.stat-inputs legend, .apt-inputs legend { font-weight: 800; font-size: 14px; margin-bottom: 6px; padding: 0; }
.stat-inputs label, .apt-inputs label { display: grid; gap: 4px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.stat-inputs input { width: 100%; min-width: 0; padding: 8px; text-align: center; }
.apt-inputs select { width: 100%; min-width: 0; padding: 6px 4px; min-height: 40px; }
@media (max-width: 480px) { .stat-inputs, .apt-inputs { grid-template-columns: repeat(5, 1fr); gap: 5px; } .stat-inputs input { font-size: 15px; padding: 6px 2px; } }
.sim-card { display: grid; gap: 18px; }
.vs-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .vs-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }
.vs { border: 2px solid var(--line); border-radius: 18px; padding: 14px 16px; display: grid; gap: 8px; background: var(--paper); }
.vs .who { font-family: var(--display); font-size: 19px; }
.vs .big { font-family: var(--display); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.vs .big.up { color: var(--turf-deep); } .vs .big.down { color: var(--red); }
.vs small { color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.lobby { width: 100%; border-collapse: collapse; font-size: 14px; }
.lobby th, .lobby td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lobby th { font-size: 12px; color: var(--ink-soft); }
.lobby tr.mine td { background: color-mix(in srgb, var(--pink) 9%, transparent); font-weight: 800; }
.lobby td.name { white-space: normal; min-width: 150px; }
.lobby-wrap { overflow-x: auto; }
.fire { display: flex; flex-wrap: wrap; gap: 6px; }
.fire span { font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.fire span b { font-variant-numeric: tabular-nums; }
.fire span.low b { color: var(--red); }
.saved-note { margin: 0; font-size: 14px; font-weight: 700; color: var(--turf-deep); }
.lobby-details { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; background: var(--paper); }
.lobby-details > summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; list-style: none; }
.lobby-details > summary::-webkit-details-marker { display: none; }
.lobby-details > summary::after { content: "Show"; margin-left: auto; font-size: 13px; font-weight: 800; color: var(--blue); }
.lobby-details[open] > summary::after { content: "Hide"; }
.lobby-details .lobby-wrap { margin-top: 12px; }

/* ================= v3.2: ideal builds ================= */
.build-filters { display: grid; gap: 12px; padding: 16px 18px; }
.build-filters input[type=search] { width: 100%; }
.bf-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.tog { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; cursor: pointer; }
.tog input { width: 18px; height: 18px; accent-color: var(--pink); }
#bf-count { margin-left: auto; }
.uma-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.uma-tile { width: 100%; height: 100%; text-align: left; font: inherit; color: var(--ink); cursor: pointer; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 10px; display: grid; gap: 8px; align-content: start; box-shadow: 0 3px 0 var(--line); transition: transform .15s var(--ease-out), border-color .15s; position: relative; }
.uma-tile:hover { transform: translateY(-2px); border-color: var(--blue); }
.uma-tile .pic { display: flex; gap: 10px; align-items: center; }
.uma-tile img { width: 56px; height: 56px; border-radius: 14px; background: var(--paper); object-fit: cover; flex: none; }
.uma-tile b { display: block; font-size: 15px; line-height: 1.2; }
.uma-tile small { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 700; line-height: 1.3; }
.uma-tile .apts { display: flex; flex-wrap: wrap; gap: 4px; font-size: 11px; font-weight: 800; }
.uma-tile .apts span { background: var(--paper); border-radius: 6px; padding: 1px 6px; }
.apts b[data-g="S"] { color: var(--gold-deep); display: inline; } .apts b[data-g="A"] { color: var(--turf-deep); display: inline; }
.apts b[data-g="B"], .apts b[data-g="C"] { color: var(--carrot); display: inline; } .apts b[data-g="D"], .apts b[data-g="E"], .apts b[data-g="F"], .apts b[data-g="G"] { color: var(--red); display: inline; }
.tile-badge { position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: var(--line); color: var(--ink); }
.tile-badge.strong { background: var(--turf); color: #fff; } .tile-badge.viable { background: var(--gold); color: #3a2a00; } .tile-badge.weak { background: var(--red); color: #fff; }
.build-dlg { width: min(880px, calc(100% - 16px)); max-width: none; max-height: calc(100dvh - 16px); overflow-y: auto; padding: 0; background: var(--paper); }
.build-dlg::backdrop { background: rgb(30 42 74 / .55); }
.bd-close { position: sticky; top: 10px; z-index: 2; display: grid; margin: 10px 10px -54px auto; }
.bd-head { padding-right: 44px; }
#bd-body { padding: 18px clamp(16px, 3vw, 28px) 28px; display: grid; gap: 16px; }
.bd-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.bd-head img { width: 84px; height: 84px; border-radius: 20px; background: var(--card); border: 2px solid var(--line); object-fit: cover; }
.bd-head h2 { font-family: var(--display); font-weight: 400; font-size: clamp(24px, 4vw, 34px); line-height: 1.05; }
.bd-head .sub { margin: 4px 0 0; font-size: 14px; }
.bd-verdict { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; margin-right: 6px; }
.bd-verdict.strong { background: var(--turf); color: #fff; } .bd-verdict.viable { background: var(--gold); color: #3a2a00; } .bd-verdict.weak { background: var(--red); color: #fff; }
.bd-sec { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.bd-sec > h3 { font-size: 16px; font-weight: 800; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; }
.spark-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.spark-list li { display: grid; grid-template-columns: 1fr; gap: 4px 12px; align-items: baseline; padding: 10px 12px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); }
.spark-list li.must { border: 2px solid var(--pink); background: color-mix(in srgb, var(--pink) 7%, var(--card)); }
.spark-list .sk { font-weight: 800; }
.spark-list .from { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.spark-list .from:empty, .spark-list li > span:empty { display: none; }
.spark-list .why { font-size: 14px; color: var(--ink-soft); }
.spark-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 2px; }
.spark-dot.green { background: var(--turf); } .spark-dot.blue { background: var(--blue); } .spark-dot.pink { background: var(--pink); }
.two-col { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .two-col { grid-template-columns: 1fr 1fr; } }
.bd-actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 480px) { .tabs a { font-size: 10px; } .tabs a .ti svg { width: 19px; height: 19px; } }
.uma-tile:has(.tile-badge) .pic > span { padding-right: 44px; }
