:root {
  --red: #e3350d;
  --red-dark: #a8230a;
  --yellow: #ffcb05;
  --yellow-dark: #c7a008;
  --blue: #2a75bb;
  --blue-dark: #1b4f86;
  --ink: #23262b;
  --ink-soft: #5b6270;
  --paper: #fffdf6;
  --cream: #f3efe2;
  --line: #9db4cf;
  --wood: #e2b47a;
  --wood-dark: #c48c4c;
  --hp-green: #3fc764;
  --hp-yellow: #f5c22c;
  --hp-red: #ec4c3a;
  --win: #3fbf5f;
  --loss: #e5483a;
  --radius: 14px;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --display: "Lilita One", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  font-weight: 600;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 50% 50%, transparent 9px, rgba(35, 38, 43, .045) 9px, rgba(35, 38, 43, .045) 11px, transparent 11px),
    linear-gradient(to bottom, transparent 23px, rgba(35, 38, 43, .045) 23px, rgba(35, 38, 43, .045) 25px, transparent 25px);
  background-size: 48px 48px;
  display: flex;
  flex-direction: column;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
img.px { image-rendering: pixelated; }

/* ---------- Pokédex header ---------- */
.dex-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(var(--red), #c92e0b);
  border-bottom: 5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(0,0,0,.15);
}
.lens {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  background: #fff; border: 3px solid var(--ink);
  display: grid; place-items: center;
}
.lens span {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #bfe6ff 0 14%, #39a3ff 16% 55%, #1667b5 70%);
  border: 2px solid var(--ink);
  animation: lens 3.2s ease-in-out infinite;
}
@keyframes lens { 50% { filter: brightness(1.25); } }
.leds { display: flex; gap: 6px; align-self: flex-start; margin-top: 4px; }
.leds i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); display: block; }
.leds .r { background: #ff5b5b; } .leds .y { background: #ffe14d; } .leds .g { background: #5be27a; }
.logo {
  background: none; border: 0; padding: 0; margin-left: 6px;
  display: flex; flex-direction: column; align-items: flex-start; line-height: 1;
}
.logo-main {
  font-family: var(--display); font-size: 38px; letter-spacing: 1px;
  color: var(--yellow);
  -webkit-text-stroke: 2.5px var(--blue-dark);
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--blue-dark);
}
.logo-sub { font-family: var(--pixel); font-size: 8px; color: #fff; margin-top: 6px; letter-spacing: .5px; }
.top-actions { margin-left: auto; }
.top-actions .pixel-btn, .logo-sub { white-space: nowrap; }

/* ---------- Buttons ---------- */
.pixel-btn {
  font-family: var(--pixel); font-size: 11px; line-height: 1.3;
  padding: 12px 16px;
  background: #fff; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 10px;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .06s, box-shadow .06s;
}
.pixel-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 5px 0 var(--ink); }
.pixel-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.pixel-btn:disabled { opacity: .45; box-shadow: 0 2px 0 var(--ink); }
.pixel-btn.primary { background: var(--yellow); }
.pixel-btn.red { background: var(--red); color: #fff; }
.pixel-btn.blue { background: var(--blue); color: #fff; }
.pixel-btn.ghost { background: rgba(255,255,255,.92); font-size: 9px; padding: 9px 12px; box-shadow: 0 3px 0 var(--ink); }
.pixel-btn.big { font-size: 15px; padding: 18px 26px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------- Dialog-box panels (GBA text box) ---------- */
.box {
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 6px var(--line), 0 5px 0 rgba(0,0,0,.12);
  padding: 18px;
}
.box-title {
  font-family: var(--pixel); font-size: 11px; margin: 0 0 14px; letter-spacing: .5px;
  display: flex; align-items: center; gap: 10px;
}
.box-title .tag { margin-left: auto; color: var(--ink-soft); font-size: 9px; }

main#app { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 22px 16px 30px; }

/* ---------- Title screen ---------- */
.title-screen { display: grid; gap: 22px; max-width: 760px; margin: 10px auto 0; text-align: center; }
.hero { padding: 30px 22px 26px; position: relative; overflow: hidden; }
.hero h1 {
  font-family: var(--display); font-weight: 400; margin: 6px 0 4px;
  font-size: clamp(64px, 16vw, 120px); line-height: .95;
  color: var(--yellow); -webkit-text-stroke: 5px var(--blue-dark); paint-order: stroke fill;
  text-shadow: 6px 6px 0 var(--blue-dark);
}
.hero .tagline { font-family: var(--pixel); font-size: 12px; line-height: 1.8; margin: 14px auto 0; max-width: 520px; }
.hero-sprites { display: flex; justify-content: center; gap: 4px; margin-top: 14px; min-height: 80px; flex-wrap: wrap; }
.hero-sprites img { width: 80px; height: 80px; object-fit: contain; animation: bob 1.6s ease-in-out infinite; }
/* Title lineup: Gen V sprites at their native pixel size so relative sizes stay true and nothing stretches. */
.hero-sprites.natural { align-items: flex-end; gap: 6px 10px; }
.hero-sprites.natural img { width: auto; height: auto; max-width: none; }
.hero-sprites img:nth-child(2n) { animation-delay: .4s; }
.hero-sprites img:nth-child(3n) { animation-delay: .8s; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; text-align: left; }
.step { padding: 14px; }
.step b { font-family: var(--pixel); font-size: 10px; display: block; margin-bottom: 8px; color: var(--red); }
.step p { margin: 0; font-size: 14px; line-height: 1.45; }
.modes { display: grid; gap: 10px; text-align: left; }
.toggle {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; cursor: pointer;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .sw {
  flex: none; width: 46px; height: 26px; border-radius: 99px; background: #cfd5de; border: 3px solid var(--ink); position: relative; transition: background .15s;
}
.toggle .sw::after {
  content: ""; position: absolute; top: 50%; left: 2px; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid var(--ink); transition: left .15s;
}
.toggle input:checked + .sw { background: var(--hp-green); }
.toggle input:checked + .sw::after { left: 22px; } /* 40px track - 16px knob - 2px inset */
.toggle input:focus-visible + .sw { outline: 3px solid var(--blue); outline-offset: 2px; }
.toggle strong { display: block; font-size: 15px; font-weight: 900; }
.toggle small { color: var(--ink-soft); font-size: 13px; }
.best-line { font-family: var(--pixel); font-size: 10px; line-height: 1.7; color: var(--ink-soft); }

/* ---------- Draft layout ---------- */
.draft { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px; align-items: start; }
.col { display: grid; gap: 18px; min-width: 0; }

/* Court */
.court-wrap { padding: 12px; }
.court { position: relative; width: 100%; aspect-ratio: 50 / 47; border-radius: 8px; overflow: hidden; border: 3px solid var(--ink); }
.court svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.slot {
  position: absolute; transform: translate(-50%, -50%);
  width: 26%; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; padding: 0;
}
.slot .ball {
  width: 54px; height: 54px; border-radius: 50%; border: 3px solid var(--ink);
  background: linear-gradient(var(--red) 0 46%, var(--ink) 46% 54%, #fff 54%);
  position: relative; box-shadow: 0 3px 0 rgba(0,0,0,.25);
}
.slot .ball::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%);
  border-radius: 50%; background: #fff; border: 3px solid var(--ink);
}
.slot.open.choosable .ball { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(255, 203, 5, .7); } }
.slot .sprite { width: 84px; height: 84px; margin-bottom: -14px; filter: drop-shadow(0 4px 0 rgba(0,0,0,.25)); object-fit: contain; }
.slot .sprite.anim { image-rendering: pixelated; width: auto; max-width: 96px; height: 72px; object-fit: contain; margin-bottom: -6px; }
.slot .plate {
  font-family: var(--pixel); font-size: 8px; line-height: 1.5; text-align: center;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 6px; padding: 4px 6px; max-width: 100%;
  overflow-wrap: break-word;
}
.slot .plate .pos { color: var(--red); }
.slot .ovr-chip { font-family: var(--pixel); font-size: 8px; padding: 2px 5px; border-radius: 5px; background: var(--ink); color: var(--yellow); }

/* Team ratings */
.cat-row { display: grid; grid-template-columns: 44px 1fr 34px; align-items: center; gap: 10px; margin: 7px 0; }
.cat-row .lbl { font-family: var(--pixel); font-size: 10px; }
.cat-row .num { font-family: var(--pixel); font-size: 10px; text-align: right; }
.bar { height: 12px; border: 2px solid var(--ink); border-radius: 99px; background: #e6e2d4; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; transition: width .4s ease; }
.cat-row.weak .lbl, .cat-row.weak .num { color: var(--loss); }
.cat-row.named { grid-template-columns: 120px 1fr 34px; }
.cat-row.named .lbl { font-family: var(--body); font-weight: 900; font-size: 14px; }
.muted { color: var(--ink-soft); font-size: 13px; }

/* Slot machine */
.machine {
  background: linear-gradient(#e8432a, #c52f19);
  border: 4px solid var(--ink); border-radius: 18px;
  padding: 14px 16px 18px; color: #fff;
  box-shadow: inset 0 3px 0 rgba(255,255,255,.3), 0 5px 0 rgba(0,0,0,.18);
}
.marquee {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-family: var(--pixel); font-size: 10px; letter-spacing: 1px;
  background: var(--ink); color: var(--yellow); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px;
  border: 3px dotted var(--yellow);
}
.marquee { justify-content: center; }
.marquee .round { color: #fff; }
.reels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reel-box { display: grid; gap: 6px; }
.reel-label { font-family: var(--pixel); font-size: 9px; text-align: center; opacity: .95; }
.reel {
  height: 92px; border-radius: 12px; border: 4px solid var(--ink);
  background: linear-gradient(#bfc6cf, #fff 22%, #fff 78%, #bfc6cf);
  display: grid; place-items: center; color: var(--ink); text-align: center; overflow: hidden; position: relative;
}
.reel::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: rgba(227, 53, 13, .25); }
.reel .val { font-family: var(--display); font-size: 30px; line-height: 1; }
.reel .sub { font-family: var(--pixel); font-size: 8px; color: var(--ink-soft); margin-top: 6px; }
.reel.rolling .inner { animation: roll .09s linear infinite; }
@keyframes roll { from { transform: translateY(-14px); opacity: .55; } to { transform: translateY(14px); opacity: .9; } }
.reel.landed { animation: land .35s ease-out; }
@keyframes land { 0% { transform: translateY(-6px); } 60% { transform: translateY(3px); } 100% { transform: none; } }
.reel .type-badge { font-size: 14px; padding: 8px 14px; }
.machine-ctrl { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.spin-btn {
  width: 96px; height: 96px; border-radius: 50%;
  font-family: var(--pixel); font-size: 13px;
  background: radial-gradient(circle at 35% 30%, #fff3b0, var(--yellow) 45%, var(--yellow-dark));
  border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--ink); color: var(--ink);
  transition: transform .06s, box-shadow .06s;
}
.spin-btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 var(--ink); }
.spin-btn:disabled { filter: grayscale(.6); opacity: .6; }
.spin-btn.ready { animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 6px 0 var(--ink), 0 0 0 8px rgba(255,255,255,.35); } }
.skips { display: grid; gap: 8px; }
.skip-btn { font-size: 9px; padding: 9px 10px; }

/* Type badges */
.type-badge {
  display: inline-block; font-family: var(--pixel); font-size: 8px; text-transform: uppercase; letter-spacing: .5px;
  color: #fff; padding: 4px 7px; border-radius: 6px; border: 2px solid rgba(0,0,0,.35);
  text-shadow: 1px 1px 0 rgba(0,0,0,.45);
}
.t-normal{background:#a8a77a}.t-fire{background:#ee8130}.t-water{background:#6390f0}.t-electric{background:#f7d02c}
.t-grass{background:#7ac74c}.t-ice{background:#96d9d6}.t-fighting{background:#c22e28}.t-poison{background:#a33ea1}
.t-ground{background:#e2bf65}.t-flying{background:#a98ff3}.t-psychic{background:#f95587}.t-bug{background:#a6b91a}
.t-rock{background:#b6a136}.t-ghost{background:#735797}.t-dragon{background:#6f35fc}.t-dark{background:#705746}
.t-steel{background:#b7b7ce}.t-fairy{background:#d685ad}

/* Picker */
.picker-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.picker-head .box-title { margin: 0; }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; margin-left: auto; }
.seg button { border: 0; background: #fff; font-family: var(--pixel); font-size: 8px; padding: 8px 10px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--yellow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card {
  position: relative; text-align: left;
  display: grid; grid-template-columns: 56px 1fr; gap: 6px 8px; align-items: center;
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 10px 8px 6px;
  box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.card:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 0 var(--ink); }
.card:disabled { opacity: .4; }
.card img { width: 56px; height: 56px; grid-row: span 2; object-fit: contain; }
.card .nm { font-weight: 900; font-size: 14px; line-height: 1.1; overflow-wrap: break-word; min-width: 0; }
.card .dexno { font-family: var(--pixel); font-size: 7px; color: var(--ink-soft); display: block; margin-bottom: 3px; }
.card .meta { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.card .meta .type-badge { font-size: 6px; padding: 3px 4px; }
.card .best {
  position: absolute; top: -9px; right: -6px;
  font-family: var(--pixel); font-size: 8px; background: var(--ink); color: var(--yellow); border-radius: 6px; padding: 4px 6px;
}
.card .legend-star { color: var(--yellow-dark); }
.empty-picker { text-align: center; padding: 26px 10px; }
.empty-picker p { font-family: var(--pixel); font-size: 10px; line-height: 1.9; margin: 10px 0 0; }

/* Summary dialog (Pokémon summary screen) */
.summary-dialog {
  width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  padding: 0; border: 4px solid var(--ink); border-radius: 18px; background: var(--paper); color: var(--ink);
  box-shadow: 0 10px 0 rgba(0,0,0,.25);
}
.summary-dialog::backdrop { background: rgba(20, 24, 32, .62); }
.sum-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: linear-gradient(var(--blue), var(--blue-dark)); color: #fff; border-bottom: 4px solid var(--ink);
}
.sum-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 28px; letter-spacing: .5px; text-shadow: 2px 2px 0 var(--ink); }
.sum-head .dexno { font-family: var(--pixel); font-size: 10px; opacity: .9; }
.sum-head .x { margin-left: auto; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 8px; width: 34px; height: 34px; font-family: var(--pixel); font-size: 12px; }
.sum-body { display: grid; grid-template-columns: 220px 1fr; gap: 18px; padding: 16px; }
.art {
  background: radial-gradient(circle at 50% 60%, #fff 0 40%, #dfe9f3 41% 100%);
  border: 3px solid var(--ink); border-radius: 14px; aspect-ratio: 1; display: grid; place-items: center; position: relative;
}
.art img { width: 88%; height: 88%; object-fit: contain; }
.art .types { position: absolute; bottom: 8px; left: 8px; display: flex; gap: 4px; }
.facts { margin-top: 10px; font-size: 13px; display: grid; gap: 4px; }
.facts b { font-family: var(--pixel); font-size: 8px; color: var(--ink-soft); display: inline-block; width: 64px; }
.stat-table { display: grid; gap: 5px; }
.stat-row { display: grid; grid-template-columns: 58px 32px 1fr; gap: 8px; align-items: center; }
.stat-row .lbl { font-family: var(--pixel); font-size: 8px; color: var(--ink-soft); }
.stat-row .num { font-family: var(--pixel); font-size: 9px; text-align: right; }
.stat-row .bar { height: 10px; }
.section-label { font-family: var(--pixel); font-size: 9px; margin: 14px 0 8px; display: flex; gap: 8px; align-items: center; }
.section-label::after { content: ""; flex: 1; height: 3px; background: var(--line); border-radius: 3px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.pos-btn {
  display: grid; gap: 4px; justify-items: center; padding: 10px 4px 9px;
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink);
}
.pos-btn:hover:not(:disabled) { background: #fff7d1; }
.pos-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.pos-btn:disabled { opacity: .35; box-shadow: 0 2px 0 var(--ink); }
.pos-btn .p { font-family: var(--pixel); font-size: 12px; }
.pos-btn .o { font-family: var(--display); font-size: 26px; line-height: 1; }
.pos-btn .f { font-family: var(--pixel); font-size: 6px; color: var(--ink-soft); text-align: center; line-height: 1.5; }
.pos-btn.best { background: #fff3b8; border-color: var(--ink); }
.pos-btn.best .f { color: var(--blue-dark); }
.pos-btn.taken .f { color: var(--ink-soft); }
.hint { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; }
.hidden-stat { font-family: var(--pixel); font-size: 10px; color: var(--ink-soft); padding: 18px; text-align: center; border: 3px dashed var(--line); border-radius: 12px; line-height: 1.8; }

/* How to play */
.how-body { padding: 18px 20px 22px; overflow: auto; }
.how-body h3 { font-family: var(--pixel); font-size: 10px; margin: 18px 0 8px; color: var(--red); }
.how-body p, .how-body li { font-size: 15px; line-height: 1.55; }
.how-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.how-body th, .how-body td { text-align: left; border-bottom: 2px solid #e4dfcf; padding: 7px 6px; vertical-align: top; }
.how-body th { font-family: var(--pixel); font-size: 8px; }
.pixel-btn.help-btn { width: 40px; height: 40px; padding: 2px 0 0 2px; font-size: 16px; line-height: 1; display: grid; place-items: center; }
.how-divider { margin-top: 24px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.about-card { background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 4px 14px 16px; display: flex; flex-direction: column; }
.about-card h3 { margin-top: 12px; }
.about-card p { margin: 0 0 14px; flex: 1; }
.about-card .pixel-btn { align-self: flex-start; text-decoration: none; font-size: 10px; }
@media (max-width: 640px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- Results ---------- */
.results { display: grid; gap: 20px; }
.scoreboard {
  background: var(--ink); color: #fff; border-radius: 18px; border: 4px solid var(--ink);
  box-shadow: inset 0 0 0 4px #3a3f48, 0 6px 0 rgba(0,0,0,.2);
  padding: 22px 18px 24px; text-align: center; position: relative; overflow: hidden;
}
.scoreboard .kicker { font-family: var(--pixel); font-size: 10px; color: var(--yellow); letter-spacing: 1px; }
.record {
  font-family: var(--pixel); font-size: clamp(54px, 13vw, 110px); line-height: 1.1; margin: 14px 0 8px;
  color: #ff9d2e; text-shadow: 0 0 12px rgba(255, 140, 30, .55), 4px 4px 0 #6b2b00;
}
.scoreboard.perfect .record { color: var(--yellow); text-shadow: 0 0 16px rgba(255, 220, 60, .8), 4px 4px 0 #6b5200; }
.grade-title { font-family: var(--display); font-size: clamp(26px, 5vw, 40px); color: #fff; letter-spacing: 1px; }
.grade-sub { font-size: 16px; color: #c8ced8; margin-top: 4px; }
.rating-pills { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.rating-pills span { font-family: var(--pixel); font-size: 9px; padding: 8px 10px; border-radius: 8px; background: #3a3f48; }
.rating-pills b { color: var(--yellow); }
.res-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.lineup { display: grid; gap: 8px; }
.lu-row {
  display: grid; grid-template-columns: 40px 64px 1fr auto; gap: 10px; align-items: center;
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 6px 12px 6px 8px;
}
.lu-row .pos { font-family: var(--pixel); font-size: 12px; color: var(--red); text-align: center; }
.lu-row img { width: 64px; height: 64px; object-fit: contain; }
.lu-row .nm { font-weight: 900; font-size: 16px; }
.lu-row .fit { font-size: 13px; color: var(--ink-soft); }
.lu-row .fit.off { color: var(--loss); }
.lu-row .o { font-family: var(--display); font-size: 30px; }
.season-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 4px; }
.gm {
  aspect-ratio: 1; border-radius: 5px; border: 2px solid var(--ink); font-family: var(--pixel); font-size: 7px;
  display: grid; place-items: center; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,.4); padding: 0;
  opacity: 0; animation: pop .25s forwards;
}
.gm.w { background: var(--win); } .gm.l { background: var(--loss); }
@keyframes pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
.game-detail { min-height: 22px; margin-top: 12px; font-size: 14px; }
.res-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-family: var(--pixel); font-size: 10px; padding: 12px 16px; border-radius: 10px; z-index: 50;
}
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
  position: absolute; top: -20px; width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(var(--red) 0 45%, var(--ink) 45% 55%, #fff 55%); border: 2px solid var(--ink);
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(420px) rotate(540deg); } }

.foot { text-align: center; font-size: 12px; color: var(--ink-soft); padding: 8px 16px 22px; }
.foot a { color: var(--blue-dark); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .draft, .res-grid { grid-template-columns: 1fr; }
  .draft .col-court { order: 2; }
}
@media (max-width: 640px) {
  main#app { padding: 16px 12px 24px; }
  .dex-top { padding: 8px 12px; gap: 10px; }
  .leds { display: none; }
  .lens { width: 38px; height: 38px; } .lens span { width: 26px; height: 26px; }
  .logo-main { font-size: 30px; }
  .logo-sub { font-size: 6px; }
  .steps { grid-template-columns: 1fr; }
  .sum-body { grid-template-columns: 1fr; }
  .sum-body { gap: 10px; padding: 12px 14px 16px; }
  .sum-body > div:first-child { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; }
  .art .types { bottom: 4px; left: 4px; }
  .facts { margin-top: 0; }
  .sum-head h2 { font-size: 22px; }
  .pos-grid { grid-template-columns: repeat(3, 1fr); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px 8px; }
  .card { grid-template-columns: 40px 1fr; gap: 4px 6px; padding: 8px 8px 8px 4px; }
  .card img { width: 40px; height: 40px; }
  .card .nm { font-size: 13px; }
  .machine { padding: 12px 12px 16px; }
  .machine-ctrl { flex-wrap: nowrap; gap: 8px; }
  .skip-btn { font-size: 7px; padding: 8px 6px; }
  .top-actions .pixel-btn { font-size: 8px; padding: 8px 9px; }
  .top-actions .pixel-btn.help-btn { width: 34px; height: 34px; font-size: 13px; }
  .marquee { font-size: 8px; }
  .slot .ball { width: 40px; height: 40px; }
  .slot .sprite { width: 60px; height: 60px; }
  .slot .sprite.anim { height: 52px; }
  .slot { width: 31%; }
  .slot .plate { font-size: 6px; padding: 3px 4px; }
  .reel { height: 80px; } .reel .val { font-size: 24px; }
  .spin-btn { width: 80px; height: 80px; font-size: 11px; }
  .lu-row { grid-template-columns: 30px 52px 1fr auto; }
  .lu-row img { width: 52px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* The pixel font has no symbol glyphs; render them in a system font. */
.sym { font-style: normal; font-family: system-ui, "Segoe UI Symbol", sans-serif; }
.sum-head .x .sym { font-size: 16px; }

/* Position buttons that bump or swap a rostered player */
.pos-btn { min-width: 0; }
.pos-btn .f { max-width: 100%; }
.pos-btn .who { display: block; max-width: 100%; overflow-wrap: break-word; margin-top: 2px; }
.pos-btn.taken:not(:disabled) { background: #eef4fb; }
.pos-btn.taken:not(:disabled):hover { background: #fff7d1; }
img[src*="official-artwork"] { image-rendering: auto; }

/* ---------- Results: stats to skills ---------- */
.bd-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.bd-player { background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.bd-p-head { display: grid; grid-template-columns: 30px 48px 1fr auto; gap: 8px; align-items: center; }
.bd-p-head .pos { font-family: var(--pixel); font-size: 11px; color: var(--red); }
.bd-p-head img { width: 48px; height: 48px; object-fit: contain; }
.bd-p-head .nm { font-weight: 900; font-size: 15px; line-height: 1.2; }
.bd-p-head .o { font-family: var(--display); font-size: 28px; }
.bd-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(38px, 1fr)); gap: 4px; }
.bd-line span { display: grid; justify-items: center; gap: 2px; padding: 4px 2px; border-radius: 8px; background: var(--cream); font-weight: 900; font-size: 14px; }
.bd-line i { font-style: normal; font-family: var(--pixel); font-size: 6px; color: var(--ink-soft); white-space: nowrap; }
.bd-line.skills span { background: #eef1f5; }
.bd-line.stats { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.bd-arrow { font-size: 11px; color: var(--ink-soft); text-align: center; }
@media (max-width: 760px) { .bd-players { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .bd-line { gap: 3px; } .bd-line span { font-size: 13px; padding: 4px 0; } }

/* ---------- Sport picker ---------- */
.sport-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sport-card {
  display: grid; gap: 4px; justify-items: center; padding: 14px 8px 12px;
  background: #fff; border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
  transition: transform .06s, box-shadow .06s;
}
.sport-card:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.sport-card .rec {
  font-family: var(--display); font-size: 40px; line-height: 1;
  color: var(--yellow); -webkit-text-stroke: 2px var(--blue-dark); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--blue-dark);
}
.sport-card .nm { font-family: var(--pixel); font-size: 10px; }
.sport-card .meta { font-size: 12px; color: var(--ink-soft); }
.sport-card.on { background: #fff3b8; box-shadow: 0 4px 0 var(--ink), inset 0 0 0 3px var(--yellow); }
.sport-card.soon { opacity: .5; filter: grayscale(1); }
.sport-card.soon:hover { transform: none; box-shadow: 0 4px 0 var(--ink); }
.sport-card.soon .meta { font-family: var(--pixel); font-size: 8px; color: var(--ink); }

/* ---------- Generation picker ---------- */
.gen-pick { padding: 12px 14px; background: #fff; border: 3px solid var(--ink); border-radius: 12px; display: grid; gap: 10px; }
.gen-head { display: flex; align-items: center; gap: 10px; }
.gen-head strong { display: block; font-size: 15px; font-weight: 900; }
.gen-head small { color: var(--ink-soft); font-size: 13px; }
.gen-all {
  margin-left: auto; font-family: var(--pixel); font-size: 9px; padding: 7px 10px;
  background: var(--cream); border: 3px solid var(--ink); border-radius: 8px; box-shadow: 0 3px 0 var(--ink);
}
.gen-all:disabled { opacity: .4; box-shadow: 0 1px 0 var(--ink); }
.gen-chips { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.gen-chip {
  font-family: var(--pixel); font-size: 10px; padding: 10px 0;
  background: #eef1f5; color: var(--ink-soft); border: 3px solid var(--ink); border-radius: 8px; box-shadow: 0 3px 0 var(--ink);
}
.gen-chip.on { background: var(--yellow); color: var(--ink); }
.gen-chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* Football and soccer fit more players on the field */
.court.dense .slot .sprite.anim { height: 56px; margin-bottom: -4px; }
.court.dense .slot .ball { width: 42px; height: 42px; }
.court.dense .slot .ball::after { width: 16px; height: 16px; }

/* Draws (soccer) and shorter seasons */
.gm.d { background: #9aa3b0; }
.season-grid.roomy { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; }
.season-grid.roomy .gm { font-size: 9px; }
@media (max-width: 640px) {
  .court.dense .slot .sprite.anim { height: 38px; }
  .court.dense .slot .ball { width: 30px; height: 30px; }
  .court.dense .slot .ball::after { width: 12px; height: 12px; border-width: 2px; }
  .sport-picker { gap: 8px; }
  .sport-card { padding: 10px 4px; }
  .sport-card .rec { font-size: 28px; }
  .sport-card .nm { font-size: 8px; }
  .sport-card .meta { font-size: 10px; }
  .sport-card.soon .meta { font-size: 6px; }
  .gen-chips { grid-template-columns: repeat(5, 1fr); }
  .hero-sprites.natural img { zoom: .75; }
  .cat-row.named { grid-template-columns: 96px 1fr 30px; }
  .cat-row.named .lbl { font-size: 13px; }
}
