/* PinBattle — over the top, like a backglass at full brightness.
   Two themes: body[data-theme=wizard] (default) and body[data-theme=dpm]. */
:root {
  --bg: #07040f; --bg2: #120a24; --panel: rgba(18, 10, 36, .82); --line: rgba(255, 210, 120, .25);
  --text: #f3ead7; --muted: #b9a98b; --gold1: #fff1b8; --gold2: #f5c242; --gold3: #a8641a;
  --red: #ff2d3d; --red2: #8d0b16; --blue: #2d8bff; --blue2: #0a2f7a; --dmd: #ff8a1f; --dmd-bg: #1a0700;
  --title-font: 'Cinzel Decorative', Georgia, serif; --body-font: 'Exo 2', system-ui, sans-serif; --head-font: 'Cinzel Decorative', Georgia, serif;
  --radius: 18px;
}
body[data-theme=dpm] {
  --bg: #000; --bg2: #141414; --panel: rgba(28, 28, 28, .92); --line: rgba(255, 170, 0, .3);
  --text: #f4f4f4; --muted: #a6a6a6; --gold1: #ffdd00; --gold2: #ff9a00; --gold3: #ff6a00;
  --red: #ff2bd6; --red2: #6d0a5c; --blue: #18d6ff; --blue2: #05506a; --dmd: #ffae00;
  --title-font: 'Oswald', Arial, sans-serif; --body-font: 'Raleway', Arial, sans-serif; --head-font: 'Oswald', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font-family: var(--body-font); font-size: 16px; line-height: 1.45;
  background: radial-gradient(1200px 600px at 50% -10%, #3a1a6e 0%, transparent 60%), radial-gradient(800px 500px at 0% 100%, #4a0812 0%, transparent 60%),
    radial-gradient(800px 500px at 100% 100%, #08245e 0%, transparent 60%), var(--bg);
  background-attachment: fixed; overflow-x: hidden;
}
body[data-theme=dpm] { background: radial-gradient(900px 500px at 50% -10%, #3b1d00 0%, transparent 60%), #000; }
.sky { position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .7;
  background-image: radial-gradient(1px 1px at 10% 20%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 30% 70%, #ffe 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 70% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 85% 80%, #eef 50%, transparent 51%),
    radial-gradient(1px 1px at 50% 50%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 20% 90%, #ffd 50%, transparent 51%);
  background-size: 300px 300px; animation: twinkle 6s ease-in-out infinite alternate; }
body[data-theme=dpm] .sky { display: none; }
@keyframes twinkle { from { opacity: .35; } to { opacity: .8; } }
a { color: var(--gold2); }
main { max-width: 980px; margin: 0 auto; padding: 0 16px 40px; }

/* ---------------------------------------------------------------- header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: linear-gradient(180deg, rgba(7, 4, 15, .95), rgba(7, 4, 15, .7)); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
body[data-theme=dpm] .top { background: #262626; border-bottom: 3px solid; border-image: linear-gradient(90deg, #ff7700, #ffdd00) 1; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-logo { height: 40px; width: auto; border-radius: 6px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.brand-name { font-family: var(--title-font); font-weight: 900; font-size: 22px; letter-spacing: .5px; white-space: nowrap;
  background: linear-gradient(180deg, var(--gold1) 0%, var(--gold2) 45%, var(--gold3) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 6px rgba(255, 180, 60, .45)); }
body[data-theme=dpm] .brand-name { text-transform: uppercase; font-weight: 700; letter-spacing: 1px; filter: none; background: linear-gradient(175deg, #ff7700, #ffdd00); -webkit-background-clip: text; background-clip: text; }
.brand-tag { font-size: 11px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.lang { width: auto; background: transparent; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px; font: inherit; font-size: 13px; }
.lang option { color: #000; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 14px;
  color: #1a0e00; background: linear-gradient(180deg, var(--gold1), var(--gold2)); box-shadow: 0 0 14px rgba(245, 194, 66, .35); white-space: nowrap; }
.chip.me { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
body[data-theme=dpm] .chip { background: linear-gradient(180deg, #ff7e0f, #f06f00); color: #fff; border-radius: 4px; text-transform: uppercase; font-family: var(--head-font); letter-spacing: 1px; }

/* ---------------------------------------------------------------- hero */
.hero { position: relative; margin: 16px 0 0; border-radius: var(--radius); overflow: hidden; min-height: 240px; border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(255, 220, 140, .15), 0 20px 60px rgba(0, 0, 0, .6), 0 0 80px rgba(120, 60, 255, .25); background: #000; }
.hero-img { display: block; width: 100%; height: clamp(240px, 48vw, 470px); object-fit: cover; object-position: center 30%; filter: saturate(1.15) contrast(1.05); }
body[data-theme=wizard] .hero-over { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; }
.hero-over { position: absolute; inset: auto 0 0 0; padding: 60px 16px 18px; text-align: center; background: linear-gradient(180deg, transparent, rgba(5, 2, 12, .92) 70%); }
body[data-theme=dpm] .hero { background: #000; min-height: 0; padding: 18px 16px 0; text-align: center; }
body[data-theme=dpm] .hero-logo { width: min(520px, 92%); height: auto; display: block; margin: 0 auto; }
body[data-theme=dpm] .hero-over { position: static; background: none; padding: 6px 16px 20px; }
.title { font-family: var(--title-font); font-weight: 900; margin: 0; font-size: clamp(44px, 11vw, 96px); line-height: .95; letter-spacing: 1px;
  background: linear-gradient(180deg, #fff8d6 0%, var(--gold2) 40%, #d48a1d 60%, #fff0b0 62%, var(--gold3) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 1px rgba(60, 25, 0, .7); filter: drop-shadow(0 3px 0 #3b1a00) drop-shadow(0 0 22px rgba(255, 170, 40, .55)); animation: titleGlow 3.5s ease-in-out infinite; }
.title.small { font-size: clamp(30px, 7vw, 48px); margin-bottom: 10px; animation: none; }
body[data-theme=dpm] .title { text-transform: uppercase; background: linear-gradient(175deg, #ff7700, #ffdd00); -webkit-background-clip: text; background-clip: text;
  -webkit-text-stroke: 2px #000; filter: drop-shadow(3px 3px 0 #ff2bd6) drop-shadow(-2px -2px 0 #18d6ff); font-style: italic; }
@keyframes titleGlow { 50% { filter: drop-shadow(0 3px 0 #3b1a00) drop-shadow(0 0 34px rgba(255, 190, 60, .85)); } }
.ribbon { display: inline-block; margin-top: 10px; padding: 7px 26px; font-family: var(--head-font); font-weight: 700; letter-spacing: 2px; font-size: clamp(13px, 3.4vw, 18px);
  color: #3a1d00; background: linear-gradient(180deg, #ffe9a8, #e2b35a 60%, #b07a2a); clip-path: polygon(0 0, 100% 0, 96% 50%, 100% 100%, 0 100%, 4% 50%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5); }
body[data-theme=dpm] .ribbon { clip-path: none; border-radius: 3px; background: #262626; color: #ffdd00; text-transform: uppercase; }

/* ---------------------------------------------------------------- CTA */
.cta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.flipper { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 999px 22px 22px 999px; text-decoration: none; color: #fff; position: relative; overflow: hidden;
  transition: transform .12s ease; min-height: 92px; }
.flipper.blue { border-radius: 22px 999px 999px 22px; flex-direction: row-reverse; text-align: right; }
.flipper.red { background: radial-gradient(circle at 25% 30%, #ff8a93, var(--red) 35%, var(--red2)); box-shadow: 0 0 0 2px #ffb0b6 inset, 0 0 30px rgba(255, 45, 61, .55); }
.flipper.blue { background: radial-gradient(circle at 75% 30%, #9cc8ff, var(--blue) 35%, var(--blue2)); box-shadow: 0 0 0 2px #b4d4ff inset, 0 0 30px rgba(45, 139, 255, .55); }
.flipper::after { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, .35) 45%, transparent 60%); transform: translateX(-120%); animation: sheen 4s ease-in-out infinite; }
.flipper.blue::after { animation-delay: 2s; }
@keyframes sheen { 60%, 100% { transform: translateX(120%); } }
.flipper:active { transform: scale(.97) rotate(-1deg); }
.flipper b { display: block; font-family: var(--head-font); font-size: 22px; letter-spacing: 1px; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.flipper small { display: block; opacity: .92; font-size: 13px; }
.cta-ico { font-size: 34px; filter: drop-shadow(0 0 8px rgba(255, 255, 255, .7)); }
.joinbox { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; padding: 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.joinbox label { font-family: var(--head-font); font-weight: 700; }
body[data-theme=dpm] .flipper { border-radius: 6px; }
body[data-theme=dpm] .flipper b { text-transform: uppercase; }

/* ---------------------------------------------------------------- panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06); }
body[data-theme=dpm] .panel { border-radius: 6px; border-top: 3px solid #ff9a00; }
.panel.narrow { max-width: 520px; margin: 20px auto; }
.panel h2, .create label, .tab-body h2 { font-family: var(--head-font); font-weight: 700; letter-spacing: .5px; }
.panel h2 { margin: 0 0 12px; font-size: 20px; color: var(--gold1); }
body[data-theme=dpm] .panel h2 { text-transform: uppercase; color: #ffdd00; }
.center { text-align: center; }
.muted { color: var(--muted); }
.err { color: #ff7b86; min-height: 1em; }
.demo { background: rgba(255, 138, 31, .15); border: 1px dashed var(--dmd); padding: 8px 12px; border-radius: 10px; }
.lists { display: grid; gap: 4px; }
.battles { list-style: none; margin: 0; padding: 0; }
.battles a { display: grid; grid-template-columns: 34px 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 10px; padding: 10px 6px; border-bottom: 1px solid rgba(255, 255, 255, .07); color: var(--text); text-decoration: none; }
.battles a:hover { background: rgba(255, 255, 255, .04); }
.battles .fmt-ico { grid-row: span 2; }
.battles small { grid-column: 2 / -1; color: var(--muted); }
.b-name { font-weight: 700; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(80, 255, 140, .15); color: #8dffb4; text-transform: uppercase; letter-spacing: 1px; }
.pill.finished { background: rgba(255, 210, 120, .15); color: var(--gold2); }
.fmt-ico { display: inline-block; width: 28px; height: 28px; border-radius: 8px; background: rgba(255, 255, 255, .08); text-align: center; line-height: 28px; font-size: 16px; }
.f-round_robin::before { content: '▦'; } .f-knockout::before { content: '⚔'; } .f-ladder::before { content: '⇡'; } .f-king::before { content: '♛'; }

/* ---------------------------------------------------------------- forms */
input, select, textarea, button { font: inherit; }
input, select { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .45); color: var(--text); outline: none; }
input:focus, select:focus { border-color: var(--gold2); box-shadow: 0 0 0 3px rgba(245, 194, 66, .25); }
select option { color: #000; }
.create label, .panel > label { display: block; margin: 14px 0 6px; font-size: 15px; color: var(--gold1); }
.big-input { font-size: 20px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.row.center { justify-content: center; }
.row input { flex: 1; min-width: 160px; }
.check { display: flex !important; align-items: center; gap: 8px; color: var(--text) !important; font-family: var(--body-font) !important; font-weight: 400 !important; }
.check input { width: 22px; height: 22px; accent-color: var(--gold2); }
details { margin: 12px 0; } summary { cursor: pointer; color: var(--gold1); font-weight: 700; padding: 6px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer;
  background: rgba(255, 255, 255, .06); color: var(--text); font-weight: 700; text-decoration: none; transition: transform .1s; }
.btn:active { transform: scale(.97); }
.btn.gold, .btn.mega { background: linear-gradient(180deg, var(--gold1), var(--gold2) 55%, var(--gold3)); color: #2a1500; border: 0; box-shadow: 0 0 20px rgba(245, 194, 66, .4); }
.btn.mega { display: flex; width: 100%; margin-top: 18px; padding: 18px; font-size: 22px; font-family: var(--head-font); letter-spacing: 2px; border-radius: 16px; animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 40px rgba(245, 194, 66, .8); } }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255, 45, 61, .15); border-color: rgba(255, 45, 61, .5); color: #ffb3b9; margin-top: 14px; }
.btn[disabled], .btn:disabled { opacity: .5; animation: none; }
body[data-theme=dpm] .btn.gold, body[data-theme=dpm] .btn.mega { background: linear-gradient(180deg, #ff7e0f, #f06f00); color: #fff; border-radius: 4px; text-transform: uppercase; }
.panel .btn { margin: 6px 6px 0 0; }
.linkish { background: none; border: 0; color: var(--gold2); text-decoration: underline; cursor: pointer; font-size: 13px; margin-left: 8px; }
.code-input { width: 8.5ch; text-align: center; font-family: 'Press Start 2P', monospace; font-size: 18px; letter-spacing: 3px; text-transform: uppercase; color: var(--dmd); background: var(--dmd-bg); }
.code-input.wide { width: 100%; font-size: 24px; letter-spacing: 10px; }

/* formats + chips */
.formats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.format { text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); color: var(--text); cursor: pointer; display: grid; grid-template-columns: 34px 1fr; column-gap: 10px; }
.format .fmt-ico { grid-row: span 2; }
.format b { font-family: var(--head-font); } .format small { color: var(--muted); }
.format.on { border-color: var(--gold2); background: linear-gradient(180deg, rgba(245, 194, 66, .22), rgba(245, 194, 66, .06)); box-shadow: 0 0 22px rgba(245, 194, 66, .35); }
.chips, .picker, .suggest, .mine, .queue-line { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }
.pchip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .07); color: var(--text); cursor: pointer; font-weight: 600; }
.pchip.reg { border-color: var(--gold2); }
.pchip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 0 0 4px; }
.pchip.sel-red { background: var(--red); border-color: #ffb0b6; box-shadow: 0 0 16px rgba(255, 45, 61, .6); }
.pchip.sel-blue { background: var(--blue); border-color: #b4d4ff; box-shadow: 0 0 16px rgba(45, 139, 255, .6); }

/* ---------------------------------------------------------------- DMD */
.dmd { font-family: 'Press Start 2P', monospace; color: var(--dmd); text-shadow: 0 0 6px rgba(255, 138, 31, .9), 0 0 18px rgba(255, 100, 0, .5);
  background-color: var(--dmd-bg); background-image: radial-gradient(rgba(0, 0, 0, .55) 35%, transparent 36%); background-size: 4px 4px;
  border-radius: 10px; padding: 12px 14px; border: 2px solid #2b1200; box-shadow: inset 0 0 18px rgba(0, 0, 0, .9), 0 0 0 3px #0a0300; letter-spacing: 1px; word-break: break-word; }
.dmd.marquee { text-align: center; font-size: clamp(14px, 4vw, 22px); line-height: 1.5; }
.dmd.marquee.small { font-size: 13px; margin-bottom: 12px; }
.dmd.code { display: inline-block; font-size: clamp(30px, 10vw, 54px); padding: 16px 22px; margin: 10px 0 14px; letter-spacing: 8px; animation: flicker 4s infinite; }
@keyframes flicker { 0%, 97%, 100% { opacity: 1; } 98% { opacity: .55; } }

/* ---------------------------------------------------------------- competition */
.comp-head { margin: 16px 0 6px; }
.comp-meta { text-align: center; color: var(--muted); margin: 10px 0 0; display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; }
.champ { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px auto 0; padding: 10px 18px; border-radius: 999px; width: fit-content;
  background: linear-gradient(180deg, rgba(255, 220, 120, .22), rgba(255, 160, 40, .08)); border: 1px solid var(--gold2); box-shadow: 0 0 30px rgba(245, 194, 66, .4); }
.champ small { display: block; color: var(--gold2); letter-spacing: 3px; font-size: 11px; } .champ b { font-family: var(--head-font); font-size: 22px; }
.crown { font-size: 34px; color: var(--gold2); text-shadow: 0 0 14px rgba(255, 200, 60, .9); }
.crown.big { font-size: 64px; display: block; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-4deg); } }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 12px 0 2px; position: sticky; top: 60px; z-index: 10; }
.tabs a { flex: 0 0 auto; padding: 9px 16px; border-radius: 999px; text-decoration: none; color: var(--text); border: 1px solid var(--line); background: rgba(0, 0, 0, .5); font-weight: 700; }
.tabs a.on { background: linear-gradient(180deg, var(--gold1), var(--gold2)); color: #2a1500; border-color: transparent; }
body[data-theme=dpm] .tabs a { border-radius: 4px; text-transform: uppercase; font-family: var(--head-font); letter-spacing: 1px; }
body[data-theme=dpm] .tabs a.on { background: linear-gradient(175deg, #ff7700, #ffdd00); color: #000; }
.gate { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; padding: 12px; margin: 12px 0; border-radius: 14px; border: 1px dashed var(--dmd); background: rgba(255, 138, 31, .08); }

/* versus: the heart of the game */
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 0; margin: 10px 0; }
.vs-side { position: relative; overflow: hidden; border: 0; cursor: pointer; color: #fff; min-height: 150px; padding: 18px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--head-font); transition: transform .12s ease, filter .2s; }
.vs-side.red { padding-right: 40px; border-radius: 22px 0 0 22px; background: radial-gradient(circle at 30% 30%, #ff9aa2, var(--red) 40%, var(--red2)); box-shadow: inset 0 0 0 2px #ffb0b6, 0 0 30px rgba(255, 45, 61, .45); }
.vs-side.blue { padding-left: 40px; border-radius: 0 22px 22px 0; background: radial-gradient(circle at 70% 30%, #a9cfff, var(--blue) 40%, var(--blue2)); box-shadow: inset 0 0 0 2px #b4d4ff, 0 0 30px rgba(45, 139, 255, .45); }
.vs-side:hover:not(:disabled) { filter: brightness(1.15); } .vs-side:active:not(:disabled) { transform: scale(.96); }
.vs-side:disabled { cursor: default; filter: saturate(.7); }
.vs-name { font-size: clamp(20px, 5.5vw, 32px); font-weight: 900; text-shadow: 0 3px 0 rgba(0, 0, 0, .4), 0 0 18px rgba(255, 255, 255, .45); word-break: break-word; text-align: center; }
.vs-side small { font-family: var(--body-font); opacity: .9; }
.vs-mid { width: 0; position: relative; z-index: 2; }
.vs-mid span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--title-font); font-weight: 900; font-size: 22px; color: #2a1500; background: radial-gradient(circle at 35% 30%, #fff, #ddd 30%, #777 70%, #333);
  box-shadow: 0 0 0 3px var(--gold2), 0 0 24px rgba(255, 220, 140, .9), 0 0 60px rgba(150, 90, 255, .6); animation: spin 6s linear infinite; }
@keyframes spin { 0% { box-shadow: 0 0 0 3px var(--gold2), -8px 0 30px var(--red), 8px 0 30px var(--blue); } 50% { box-shadow: 0 0 0 3px var(--gold2), 8px 0 30px var(--red), -8px 0 30px var(--blue); } 100% { box-shadow: 0 0 0 3px var(--gold2), -8px 0 30px var(--red), 8px 0 30px var(--blue); } }
body[data-theme=dpm] .vs-side.red { border-radius: 6px 0 0 6px; } body[data-theme=dpm] .vs-side.blue { border-radius: 0 6px 6px 0; }
.machine { margin: 6px 0 4px; }
.queue, .log { list-style: none; margin: 0; padding: 0; }
.queue li, .log li { padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.mini-vs { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 12px; padding: 10px; color: var(--text); cursor: pointer; font-weight: 700; }
.mini-vs .r { color: #ff8f99; text-align: right; } .mini-vs .b { color: #8fbfff; text-align: left; } .mini-vs i { color: var(--gold2); font-style: normal; font-family: var(--title-font); }
.throne { text-align: center; }
.king-card { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 8px; }
.king-card small { letter-spacing: 4px; color: var(--gold2); } .king-card b { font-family: var(--head-font); font-size: 30px; }

/* standings: high score table */
.scoreboard .hs { width: 100%; border-collapse: collapse; font-size: 16px; }
.hs th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; padding: 6px; }
.hs td { padding: 10px 6px; border-top: 1px solid rgba(255, 255, 255, .07); }
.hs .num { text-align: right; font-family: 'Press Start 2P', monospace; font-size: 13px; color: var(--dmd); }
.hs th:nth-child(n+3) { text-align: right; }
.hs .rank { width: 36px; font-family: 'Press Start 2P', monospace; color: var(--muted); }
.hs tr.first td { background: linear-gradient(90deg, rgba(245, 194, 66, .25), transparent); font-weight: 800; font-size: 18px; }
.hs tr.first .rank { color: var(--gold2); font-size: 20px; text-shadow: 0 0 10px rgba(255, 200, 60, .9); }
.star { color: var(--gold2); }

/* matrix */
.matrix-wrap { overflow-x: auto; }
.matrix { border-collapse: separate; border-spacing: 3px; margin: 0 auto; }
.matrix th { font-size: 13px; font-weight: 700; text-align: right; padding: 4px 6px; white-space: nowrap; }
.matrix .colh { height: 110px; vertical-align: bottom; padding: 0; }
.matrix .colh span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); padding: 4px 0; }
.matrix td { width: 44px; height: 38px; text-align: center; border-radius: 8px; background: rgba(255, 255, 255, .05); font-family: 'Press Start 2P', monospace; font-size: 11px; }
.matrix td.self { background: repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 4px, transparent 4px 8px); }
.matrix td.win { background: rgba(60, 220, 120, .3); color: #b5ffd0; box-shadow: inset 0 0 0 1px rgba(60, 220, 120, .6); }
.matrix td.loss { background: rgba(255, 45, 61, .22); color: #ffc0c6; }
.matrix td.draw { background: rgba(245, 194, 66, .2); }

/* bracket */
.bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 14px; overflow-x: auto; padding: 14px 2px; }
.b-round { display: flex; flex-direction: column; justify-content: space-around; gap: 10px; }
.b-round h3 { text-align: center; font-family: var(--head-font); color: var(--gold1); margin: 0 0 4px; font-size: 15px; }
.b-match { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: rgba(0, 0, 0, .45); }
.b-p { padding: 8px 10px; font-weight: 600; } .b-p + .b-p { border-top: 1px solid rgba(255, 255, 255, .08); }
.b-p.w { background: linear-gradient(90deg, rgba(245, 194, 66, .35), transparent); color: var(--gold1); }
.b-p.l { opacity: .45; text-decoration: line-through; }

/* modal + toast + celebration */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .7); display: grid; place-items: center; padding: 16px; }
.modal .panel { width: min(640px, 100%); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; padding: 12px 18px; border-radius: 12px; background: #1b1230; border: 1px solid var(--gold2); color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, .6); transition: opacity .5s; }
.toast.bad { border-color: var(--red); } .toast.out { opacity: 0; }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 80; }
.celebrate { position: fixed; inset: 0; display: grid; place-items: center; align-content: center; gap: 16px; background: radial-gradient(circle, rgba(255, 210, 120, .25), rgba(0, 0, 0, .75) 70%); animation: flash .25s ease-out; transition: opacity .5s; }
.celebrate.red { background: radial-gradient(circle, rgba(255, 45, 61, .4), rgba(0, 0, 0, .8) 70%); }
.celebrate.blue { background: radial-gradient(circle, rgba(45, 139, 255, .4), rgba(0, 0, 0, .8) 70%); }
.celebrate.out { opacity: 0; }
.celebrate .dmd.big { font-size: clamp(26px, 8vw, 54px); padding: 18px 26px; animation: zoom .5s cubic-bezier(.2, 1.6, .4, 1); }
.winner-name { font-family: var(--title-font); font-size: clamp(22px, 6vw, 38px); font-weight: 900; color: #fff; text-shadow: 0 0 20px var(--gold2), 0 3px 0 #000; animation: zoom .6s .1s both cubic-bezier(.2, 1.6, .4, 1); }
.bolt { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 47%, rgba(255, 255, 255, .95) 49%, rgba(190, 220, 255, .9) 50%, transparent 52%); mix-blend-mode: screen; animation: bolt .35s steps(3) 2; }
.spark { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h), 100%, 65%); box-shadow: 0 0 12px hsl(var(--h), 100%, 60%);
  animation: spark 1.1s ease-out forwards; }
@keyframes spark { from { transform: rotate(var(--a)) translateX(0) scale(1.4); opacity: 1; } to { transform: rotate(var(--a)) translateX(var(--d)) scale(.2); opacity: 0; } }
@keyframes zoom { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes flash { from { background-color: rgba(255, 255, 255, .8); } }
@keyframes bolt { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

/* ---------------------------------------------------------------- footer */
.foot { max-width: 980px; margin: 10px auto 30px; padding: 0 16px; text-align: center; color: var(--muted); font-size: 13px; }
.sponsor { display: block; padding: 12px; margin-bottom: 10px; border-radius: 12px; border: 1px dashed var(--line); color: var(--text); text-decoration: none; }
.sponsor small { color: var(--muted); text-transform: uppercase; letter-spacing: 2px; font-size: 10px; margin-right: 6px; }
.foot-links a { color: var(--muted); }

@media (max-width: 640px) {
  .cta { grid-template-columns: 1fr; }
  .flipper.blue { flex-direction: row; text-align: left; border-radius: 999px 22px 22px 999px; }
  .vs-side { min-height: 120px; }
  .tabs { top: 58px; }
  .brand-name { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::after, *::before { animation: none !important; transition: none !important; } }
