:root{
  --bg:#eef0f5; --panel:#ffffff; --ink:#1a1d29; --muted:#6b7089;
  --line:#e2e4ee; --chip:#eceef6; --accent:#2b3a67; --accent-ink:#fff;
  --good:#1f9d55; --again:#d9534f; --shadow:0 6px 24px rgba(30,35,60,.12);
  --radius:16px;
}
@media (prefers-color-scheme:dark){
  :root{
    --bg:#12141c; --panel:#1c1f2b; --ink:#e9ebf4; --muted:#9aa0bd;
    --line:#2c3040; --chip:#262a38; --accent:#5a74c4; --accent-ink:#fff;
    --shadow:0 6px 24px rgba(0,0,0,.4);
  }
}
*{box-sizing:border-box}
html,body{margin:0}
body{
  font-family:-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg); color:var(--ink);
  min-height:100dvh; display:flex; flex-direction:column;
  -webkit-font-smoothing:antialiased;
}
h1,h2{margin:0}
.hidden{display:none !important}

/* Topbar */
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:14px 18px; background:var(--panel); border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:10;
}
.brand{display:flex; align-items:center; gap:12px}
.logo{font-size:30px; line-height:1}
.topbar h1{font-size:19px; font-weight:800; letter-spacing:-.2px}
.sub{margin:2px 0 0; color:var(--muted); font-size:13px}
.icon-btn{
  background:var(--chip); border:1px solid var(--line); border-radius:12px;
  width:42px; height:42px; font-size:19px; cursor:pointer; color:var(--ink);
}
.icon-btn:active{transform:scale(.94)}

/* Panels */
.panel{
  max-width:560px; width:100%; margin:22px auto; padding:22px;
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.panel h2{font-size:22px; font-weight:800; margin-bottom:4px}
.field{margin:20px 0}
.field>label{display:block; font-size:12px; font-weight:700; text-transform:uppercase;
  letter-spacing:.6px; color:var(--muted); margin-bottom:8px}
.hint{color:var(--muted); font-size:13px; margin:8px 0 0}

/* Segmented */
.segmented{display:flex; gap:6px; background:var(--chip); padding:5px; border-radius:12px; flex-wrap:wrap}
.segmented button{
  flex:1; min-width:70px; border:none; background:transparent; color:var(--ink);
  padding:10px 8px; border-radius:9px; font-size:14px; font-weight:600; cursor:pointer;
}
.segmented button.active{background:var(--panel); box-shadow:0 1px 4px rgba(0,0,0,.12); color:var(--accent)}
@media (prefers-color-scheme:dark){.segmented button.active{color:#c7d3ff}}

/* Party chips */
.chips{display:flex; flex-wrap:wrap; gap:8px}
.chip{
  display:inline-flex; align-items:center; gap:7px; padding:8px 12px; border-radius:999px;
  background:var(--chip); border:2px solid transparent; cursor:pointer; font-size:13px; font-weight:600;
  user-select:none;
}
.chip .dot{width:11px; height:11px; border-radius:50%}
.chip.on{border-color:currentColor}
.chip.off{opacity:.4}

/* Stats */
.stats-row{display:flex; gap:14px; flex-wrap:wrap; margin:14px 0 20px; color:var(--muted); font-size:14px}
.stats-row b{color:var(--ink)}

/* Buttons */
button.primary{background:var(--accent); color:var(--accent-ink); border:none; border-radius:12px;
  font-weight:700; cursor:pointer}
button.primary.big{width:100%; padding:16px; font-size:16px; margin-top:6px}
button.primary.wide{width:100%; padding:15px; font-size:16px}
button.primary:active{transform:translateY(1px)}
.ghost{background:transparent; border:1px solid var(--line); color:var(--muted);
  border-radius:10px; cursor:pointer; padding:9px 12px; font-weight:600}
.ghost.small{width:100%; margin-top:10px; font-size:13px}
kbd{font-family:inherit; background:rgba(255,255,255,.22); border-radius:5px; padding:1px 6px; font-size:12px}

/* Trainer */
#trainer{max-width:560px; width:100%; margin:16px auto; padding:0 16px; flex:1}
.progress{height:7px; background:var(--chip); border-radius:99px; overflow:hidden}
#progressBar{height:100%; width:0%; background:var(--accent); transition:width .25s}
.round-meta{display:flex; justify-content:space-between; align-items:center; margin:10px 0 4px}
#roundCounter{color:var(--muted); font-size:13px; font-weight:600}
.round-meta .ghost.small{width:auto; margin:0}

.card-wrap{margin:10px 0}
.card{
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:22px; text-align:center; cursor:pointer;
  min-height:340px; display:flex; flex-direction:column; align-items:center;
}
.photo-box{width:190px; height:250px; border-radius:14px; overflow:hidden; background:var(--chip);
  box-shadow:0 3px 12px rgba(0,0,0,.18); flex-shrink:0}
.photo-box img{width:100%; height:100%; object-fit:cover; display:block}
.cardname{font-size:23px; font-weight:800; margin:16px 0 4px; letter-spacing:-.3px}
.cardname.big{margin-top:0}
.reveal-hint{color:var(--muted); font-size:13px; margin-top:8px}

.back{width:100%; margin-top:16px; text-align:left; border-top:1px solid var(--line); padding-top:14px}
.rows{display:flex; flex-direction:column; gap:8px}
.row{display:flex; gap:12px; align-items:baseline}
.lbl{flex:0 0 78px; font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); font-weight:700}
.val{flex:1; font-size:15.5px}
.party-badge{font-weight:800; display:inline-flex; align-items:center; gap:8px}
.party-badge .dot{width:12px; height:12px; border-radius:50%}
.ausblock{margin-top:14px}
.ausblock .lbl{display:block; margin-bottom:7px}
.aus-list{display:flex; flex-direction:column; gap:5px}
.aus{padding:6px 11px; border-radius:8px; background:var(--chip); font-size:14px}
.aus.lead{background:color-mix(in srgb,var(--accent) 20%,var(--chip)); font-weight:700}
.aus .r{font-size:11px; color:var(--muted); margin-left:6px; font-weight:600}

/* Controls */
.controls{max-width:560px; margin:14px auto 0; display:flex; gap:12px}
.rate{flex:1; padding:16px; border-radius:12px; border:none; font-size:16px; font-weight:800; cursor:pointer; color:#fff}
.rate.again{background:var(--again)} .rate.good{background:var(--good)}
.rate:active{transform:translateY(1px)}
.rate kbd{background:rgba(255,255,255,.25)}

/* Done */
.done-emoji{font-size:52px; text-align:center}
#done{text-align:center}
#done .primary.big{margin-top:18px}

/* Footer */
.foot{max-width:560px; width:100%; margin:20px auto 26px; padding:0 18px; text-align:center;
  color:var(--muted); font-size:12px; display:flex; flex-direction:column; gap:5px}
.foot .src{opacity:.8}

@media(max-width:480px){
  .panel{margin:14px; padding:18px; width:auto}
  .card{min-height:auto; padding:18px}
}
