/* Pokémon Slam — retro arcade hardwood */
:root {
  --bg: #0a0e1a;
  --bg2: #0f1526;
  --panel: #131b31;
  --panel2: #1a2442;
  --line: #26335a;
  --text: #eef2ff;
  --muted: #94a0c4;
  --dim: #66729a;
  --orange: #ff6b1a;
  --orange2: #ff8a3d;
  --gold: #ffc531;
  --red: #ff3b4d;
  --green: #2fd67b;
  --blue: #4da3ff;
  --wood: #c98a4b;
  --wood2: #b97a3d;
  --wood3: #a86b31;
  --court-line: rgba(255, 255, 255, 0.9);
  --radius: 10px;
  --display: "Bungee", "Barlow Condensed", system-ui, sans-serif;
  --cond: "Barlow Condensed", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 15px; line-height: 1.45; }
body { min-height: 100vh; display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
img.px { image-rendering: pixelated; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ header */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; padding: 10px 22px; background: rgba(10, 14, 26, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.logo { font-family: var(--display); font-size: 26px; letter-spacing: 0.5px; text-decoration: none; white-space: nowrap; line-height: 1; }
.logo .p { color: var(--text); }
.logo .s { color: var(--orange); text-shadow: 2px 2px 0 #7a2a00; }
.nav { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-wrap: nowrap; }
.nav a { font-family: var(--cond); font-weight: 700; font-size: 16px; letter-spacing: 0.4px; text-transform: uppercase; text-decoration: none; padding: 8px 15px; border-right: 1px solid var(--line); color: var(--text); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.nav a:last-child { border-right: 0; }
.nav a:hover { background: var(--panel); }
.nav a.on { background: var(--panel2); box-shadow: inset 0 -3px 0 var(--orange); }
.nav .num { color: var(--gold); }
.nav .num.r { color: var(--red); }
.nav .soon { font-size: 10px; background: var(--panel2); color: var(--muted); border-radius: 4px; padding: 1px 4px; }
.top .grow { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--cond); font-weight: 700; font-size: 16px; letter-spacing: 0.4px; text-transform: uppercase; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; white-space: nowrap; transition: transform 0.05s, background 0.15s; }
.btn:hover { background: var(--panel2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #1a0b00; }
.btn.primary:hover { background: var(--orange2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #241a00; }
.btn.ghost { background: transparent; }
.btn.sm { font-size: 14px; padding: 6px 11px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; text-decoration: none; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

/* ------------------------------------------------------------ layout */
main { flex: 1; width: 100%; max-width: 1380px; margin: 0 auto; padding: 18px 22px 40px; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-h h2, .panel-h h3 { margin: 0; font-family: var(--cond); font-weight: 800; font-size: 19px; letter-spacing: 0.5px; text-transform: uppercase; }
.eyebrow { font-family: var(--cond); font-weight: 700; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------ scorebug */
.bug { display: flex; align-items: stretch; border-radius: 10px; overflow: hidden; margin-bottom: 12px; border: 1px solid var(--line); background: var(--panel); font-family: var(--cond); text-transform: uppercase; }
.bug > div { padding: 8px 14px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.bug > div:last-child { border-right: 0; }
.bug .t { font-size: 12px; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.bug .v { font-size: 22px; font-weight: 800; line-height: 1.05; }
.bug .live { background: var(--red); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: 1px; flex-direction: row; align-items: center; gap: 6px; }
.bug .live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: blink 1s infinite; }
.bug .title { background: var(--orange); color: #1a0b00; font-size: 20px; font-weight: 800; }
.bug .grow { flex: 1; }
@keyframes blink { 50% { opacity: 0.2; } }

/* ------------------------------------------------------------ court */
.court-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #2a1a0c; }
.court { position: relative; width: 100%; aspect-ratio: 50 / 31; background:
  repeating-linear-gradient(90deg, var(--wood) 0 38px, var(--wood2) 38px 40px, #c58548 40px 78px, var(--wood3) 78px 80px);
}
.court::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(255, 220, 160, 0.25), transparent 60%), linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.28)); pointer-events: none; }
.court svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.court .wm { position: absolute; left: 50%; top: 77%; transform: translate(-50%, -50%); font-family: var(--display); font-size: clamp(22px, 4.6vw, 54px); color: rgba(120, 50, 10, 0.28); white-space: nowrap; pointer-events: none; z-index: 1; }
.spot { position: absolute; z-index: 3; transform: translate(-50%, -50%); width: 17%; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0; padding: 0; touch-action: manipulation; }
.spot .ring { position: relative; width: 100%; aspect-ratio: 1; display: grid; place-items: center; }
.spot .ring::before { content: ""; position: absolute; left: 12%; right: 12%; bottom: 6%; height: 16%; border-radius: 50%; background: rgba(0, 0, 0, 0.32); filter: blur(2px); }
.spot img { position: relative; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.35)); transition: transform 0.15s; }
.spot.empty .ring::after { content: "+"; position: absolute; inset: 18%; border: 3px dashed rgba(255, 255, 255, 0.75); border-radius: 50%; display: grid; place-items: center; font-family: var(--cond); font-weight: 800; font-size: clamp(18px, 3vw, 34px); color: rgba(255,255,255,0.9); background: rgba(0,0,0,0.12); }
.spot .tag { font-family: var(--cond); font-weight: 800; font-size: clamp(11px, 1.25vw, 15px); letter-spacing: 0.5px; text-transform: uppercase; background: rgba(10, 14, 26, 0.88); color: var(--text); padding: 1px 8px; border-radius: 6px; white-space: nowrap; max-width: 140%; overflow: hidden; text-overflow: ellipsis; }
.spot .pos { font-family: var(--cond); font-weight: 800; font-size: clamp(10px, 1.05vw, 13px); color: var(--gold); background: rgba(10, 14, 26, 0.88); padding: 0 6px; border-radius: 5px; }
.spot.sel .ring::after, .spot.target .ring::after { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 0 4px rgba(255, 197, 49, 0.25); }
.spot.target { animation: pulse 1.1s ease-in-out infinite; }
.spot.sel img { transform: translateY(-4px) scale(1.05); }
.spot.sel .tag { background: var(--gold); color: #241a00; }
.spot.drop-hover img { transform: scale(1.08); }
@keyframes pulse { 50% { transform: translate(-50%, -50%) scale(1.06); } }
.spot .shine, .bench-seat .shine { position: absolute; inset: 0; pointer-events: none; }
.shine i { position: absolute; width: 10px; height: 10px; background: radial-gradient(circle, #fff 0 20%, transparent 60%); animation: twinkle 1.6s infinite; }
.shine i:nth-child(1) { top: 8%; left: 14%; }
.shine i:nth-child(2) { top: 26%; right: 10%; animation-delay: 0.5s; }
.shine i:nth-child(3) { bottom: 22%; left: 30%; animation-delay: 1s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0.4); } 50% { opacity: 1; transform: scale(1.2); } }

.bench { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; padding: 10px; background: linear-gradient(180deg, #1b2240, #141a31); border-top: 3px solid #0c1022; }
.bench-seat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 6px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); min-width: 0; touch-action: manipulation; }
.bench-seat img { width: 100%; max-width: 76px; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; }
.bench-seat .ph { width: 100%; max-width: 76px; aspect-ratio: 1; display: grid; place-items: center; font-family: var(--cond); font-weight: 800; font-size: 26px; color: var(--dim); }
.bench-seat .tag { font-family: var(--cond); font-weight: 700; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.bench-seat .pos { font-family: var(--cond); font-weight: 800; font-size: 12px; color: var(--gold); letter-spacing: 0.5px; }
.bench-seat.sel, .bench-seat.target { border-color: var(--gold); background: rgba(255, 197, 49, 0.08); }
.bench-seat.target { animation: glow 1.1s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 3px rgba(255, 197, 49, 0.3); } }
.bench-label { display: flex; justify-content: space-between; padding: 8px 12px 0; background: #1b2240; font-family: var(--cond); font-weight: 800; font-size: 13px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }

/* ------------------------------------------------------------ toolbar under court */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 7px 11px; font-family: var(--cond); font-weight: 700; font-size: 14px; text-transform: uppercase; border-right: 1px solid var(--line); color: var(--muted); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 -2px 0 var(--orange); }

/* ------------------------------------------------------------ picker */
.picker { position: sticky; top: 76px; display: flex; flex-direction: column; max-height: calc(100vh - 96px); }
.picker .filters { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line); }
.search { width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; }
.search:focus { outline: 2px solid var(--orange); outline-offset: -1px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { border: 1px solid var(--line); background: var(--bg2); border-radius: 999px; padding: 3px 10px; font-family: var(--cond); font-weight: 700; font-size: 13px; text-transform: uppercase; color: var(--muted); }
.chip.on { background: var(--orange); color: #1a0b00; border-color: var(--orange); }
.list { overflow-y: auto; padding: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 6px; align-content: start; }
.mon { position: relative; border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 4px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; min-width: 0; }
.mon:hover { border-color: var(--orange); }
.mon.used { opacity: 0.35; }
.mon img { width: 68px; height: 68px; image-rendering: pixelated; }
.mon .n { font-family: var(--cond); font-weight: 700; font-size: 14px; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon .d { font-size: 11px; color: var(--dim); }
.mon .star { position: absolute; top: 4px; right: 6px; color: var(--gold); font-size: 12px; }
.types { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; }
.type { font-family: var(--cond); font-weight: 800; font-size: 10.5px; letter-spacing: 0.5px; text-transform: uppercase; padding: 0 5px; border-radius: 4px; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.35); }
.empty-note { padding: 24px 16px; color: var(--muted); text-align: center; grid-column: 1 / -1; }

/* type colors */
.t-normal { background: #9fa19f; } .t-fire { background: #e62829; } .t-water { background: #2980ef; } .t-electric { background: #d9a800; }
.t-grass { background: #3fa129; } .t-ice { background: #3dcef3; } .t-fighting { background: #ff8000; } .t-poison { background: #9141cb; }
.t-ground { background: #915121; } .t-flying { background: #81b9ef; } .t-psychic { background: #ef4179; } .t-bug { background: #91a119; }
.t-rock { background: #afa981; } .t-ghost { background: #704170; } .t-dragon { background: #5060e1; } .t-dark { background: #50413f; }
.t-steel { background: #60a1b8; } .t-fairy { background: #ef70ef; }

/* ------------------------------------------------------------ challenge roll card */
.roll { padding: 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.roll .big { display: flex; gap: 8px; align-items: stretch; }
.roll .box { flex: 1; border-radius: 10px; padding: 8px 10px; background: var(--bg2); border: 1px solid var(--line); }
.roll .box .k { font-family: var(--cond); font-weight: 700; font-size: 12px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.roll .box .v { font-family: var(--cond); font-weight: 800; font-size: 26px; text-transform: uppercase; line-height: 1.05; }
.roll .box.type .v { display: inline-block; padding: 0 8px; border-radius: 6px; margin-top: 2px; }
.roll .hint { font-size: 13px; color: var(--muted); }
.roll .rr { display: flex; gap: 6px; flex-wrap: wrap; }
.rolling .v { animation: shuffle 0.08s steps(2) infinite; }
@keyframes shuffle { 50% { opacity: 0.6; } }

/* ------------------------------------------------------------ hover card */
.card { position: fixed; z-index: 60; width: 248px; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,0.5); padding: 10px 12px; }
.card .hd { display: flex; gap: 10px; align-items: center; }
.card img { width: 64px; height: 64px; image-rendering: pixelated; background: var(--bg2); border-radius: 10px; }
.card .nm { font-family: var(--cond); font-weight: 800; font-size: 20px; line-height: 1.1; }
.card .meta { font-size: 12px; color: var(--muted); }
.stats { margin-top: 8px; display: grid; grid-template-columns: 52px 1fr 30px; gap: 3px 8px; align-items: center; font-size: 12px; }
.stats .bar { height: 7px; border-radius: 4px; background: var(--bg2); overflow: hidden; }
.stats .bar i { display: block; height: 100%; border-radius: 4px; }
.stats .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ results */
.results { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.record { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.record .wl { font-family: var(--display); font-size: clamp(46px, 7vw, 84px); line-height: 1; color: var(--gold); text-shadow: 3px 3px 0 #6b4a00; }
.record .wl.perfect { color: var(--orange); text-shadow: 3px 3px 0 #7a2a00; animation: flash 0.7s steps(2) 6; }
@keyframes flash { 50% { color: #fff; } }
.strip { display: grid; grid-template-columns: repeat(41, 1fr); gap: 2px; }
.strip i { aspect-ratio: 1; border-radius: 2px; background: var(--line); }
.strip i.w { background: var(--green); }
.strip i.l { background: var(--red); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.tile .k { font-family: var(--cond); font-weight: 700; font-size: 12px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.tile .v { font-family: var(--cond); font-weight: 800; font-size: 26px; line-height: 1.1; }
.bracket { display: flex; flex-direction: column; gap: 6px; }
.series { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; background: var(--bg2); border: 1px solid var(--line); font-family: var(--cond); font-weight: 700; font-size: 16px; }
.series.won { border-color: rgba(47, 214, 123, 0.5); }
.series.lost { border-color: rgba(255, 59, 77, 0.5); }
.series .res { font-weight: 800; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-family: var(--cond); font-weight: 800; font-size: 14px; text-transform: uppercase; padding: 3px 10px; border-radius: 7px; border: 1px solid; }
.badge.good { color: var(--green); border-color: rgba(47, 214, 123, 0.5); background: rgba(47, 214, 123, 0.08); }
.badge.bad { color: var(--red); border-color: rgba(255, 59, 77, 0.5); background: rgba(255, 59, 77, 0.08); }
.banner { font-family: var(--display); font-size: clamp(20px, 3vw, 30px); padding: 10px 14px; border-radius: 10px; background: linear-gradient(90deg, #ffb300, #ff6b1a); color: #1a0b00; text-align: center; }

/* ------------------------------------------------------------ leaderboard */
.board { width: 100%; border-collapse: collapse; }
.board th { text-align: left; font-family: var(--cond); font-weight: 700; font-size: 13px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.board td { padding: 9px 12px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.board td.rk { font-family: var(--cond); font-weight: 800; font-size: 18px; width: 54px; }
.board td.rec { font-family: var(--cond); font-weight: 800; font-size: 18px; }
.board tr.me td { background: rgba(255, 107, 26, 0.1); }
.board .who { display: flex; align-items: center; gap: 8px; }
.board .who img { width: 26px; height: 26px; border-radius: 50%; }
.board .who .ini { width: 26px; height: 26px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; font-family: var(--cond); font-weight: 800; font-size: 13px; }
.trophy { color: var(--gold); }

/* ------------------------------------------------------------ dialogs / toasts */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(5, 8, 16, 0.72); display: grid; place-items: center; padding: 16px; }
.modal .box { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.toast.bad { border-color: var(--red); }

/* ------------------------------------------------------------ prose pages */
.prose { max-width: 760px; margin: 0 auto; }
.prose h1 { font-family: var(--display); font-size: 40px; margin: 10px 0 6px; line-height: 1.05; }
.prose h2 { font-family: var(--cond); font-weight: 800; font-size: 24px; text-transform: uppercase; margin: 26px 0 8px; }
.prose p, .prose li { color: #d6dcf2; }
.prose table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-family: var(--cond); font-size: 14px; text-transform: uppercase; color: var(--muted); }
.back { display: inline-flex; gap: 6px; align-items: center; font-family: var(--cond); font-weight: 700; text-transform: uppercase; text-decoration: none; color: var(--muted); }

/* ------------------------------------------------------------ footer */
footer { border-top: 1px solid var(--line); padding: 18px 22px; display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
footer a { color: var(--text); font-weight: 600; }
footer .legal { max-width: 560px; text-align: right; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .nav a { padding: 8px 10px; font-size: 15px; }
  .stage { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .stage { grid-template-columns: 1fr; }
  .picker { position: static; max-height: none; }
  .play-stage > aside { order: -1; }
  .play-stage .picker .list { max-height: 46vh; }
  .picker .list { max-height: 62vh; }
  main { padding: 12px 12px 32px; }
  .bench { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip { grid-template-columns: repeat(21, 1fr); }
  footer .legal { text-align: left; }
  .spot { width: 19%; }
}
@media (max-width: 520px) {
  .logo { font-size: 21px; }
  .top .btn.play { display: none; }
  .bug .v { font-size: 18px; }
  .bug > div { padding: 6px 9px; }
  .list { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
  .mon img { width: 58px; height: 58px; }
}
