:root {
  --bg: #0d1028; --ink: #f4f1e8; --gold: #ffcf4a; --red: #ff3b4e; --green: #2fe38b; --panel: #171b3d; --line: #2c3270;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: Rubik, system-ui, sans-serif; overflow: hidden; }
button { font-family: inherit; cursor: pointer; }

#stage { position: fixed; inset: 0; display: grid; place-items: center; background: #05061a; }
#view { position: relative; width: min(100vw, calc(100dvh * 16 / 9)); aspect-ratio: 16 / 9; background: #0e0b26; }
#view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.overlay { position: fixed; inset: 0; display: none; place-items: center; overflow-y: auto; padding: 16px; z-index: 5; background: rgba(8, 9, 28, .62); }
.overlay.solid { background: linear-gradient(180deg, rgba(13,16,40,.05) 0%, rgba(13,16,40,.25) 34%, rgba(13,16,40,.93) 56%); place-items: end center; padding-bottom: 14px; }
.overlay.show { display: grid; }

.chip { position: fixed; top: 10px; right: 10px; z-index: 20; width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line); background: rgba(13, 16, 40, .8); color: var(--ink); font-size: 18px; }

.btn { border: 0; border-radius: 10px; padding: 11px 20px; font-weight: 700; font-size: 15px; background: var(--gold); color: #1a1405; box-shadow: 0 4px 0 #a37a10; transition: transform .08s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #a37a10; }
.btn.big { font-family: Bangers, Impact, sans-serif; font-size: 26px; letter-spacing: 1.5px; padding: 10px 30px; background: var(--red); color: #fff; box-shadow: 0 5px 0 #96101f; }
.btn.big:disabled { background: #454a6e; box-shadow: 0 5px 0 #2a2e4c; color: #9a9fc4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost.dark { color: #1c1a16; box-shadow: inset 0 0 0 2px #1c1a16; }

.sheet { max-width: 560px; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 24px 26px; line-height: 1.5; }
.sheet h2 { font-family: Bangers, Impact, sans-serif; font-size: 34px; letter-spacing: 1px; margin: 0 0 8px; color: var(--gold); }
.sheet ul { padding-left: 20px; color: #c9cbe6; font-size: 14px; }
.sheet .btn { margin-top: 8px; width: 100%; }

.titlebox { text-align: center; }
.kicker { text-transform: uppercase; letter-spacing: 4px; font-size: 12px; color: var(--gold); }
.titlebox h1 { font-family: Bangers, Impact, sans-serif; font-size: clamp(56px, 13vw, 150px); line-height: .86; margin: 10px 0 14px; letter-spacing: 3px; transform: rotate(-3deg); text-shadow: 0 6px 0 #05061a; }
.titlebox h1 span { display: block; }
.titlebox h1 .red { color: var(--red); }
.sub { font-size: 17px; margin: 0 0 20px; }
.fine { font-size: 11px; color: #9a9fc4; margin-top: 18px; }

.selwrap { width: min(1040px, 100%); margin: auto; }
.selwrap h2 { font-family: Bangers, Impact, sans-serif; font-size: 34px; letter-spacing: 1.5px; text-align: center; margin: 0 0 10px; color: var(--gold); }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; margin-bottom: 12px; }
.vs { font-family: Bangers, Impact, sans-serif; font-size: 44px; color: var(--red); align-self: center; transform: rotate(-6deg); }
.slot { background: rgba(23,27,61,.82); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; min-height: 124px; cursor: pointer; font-size: 13px; }
.slot.active { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 207, 74, .2); }
.slot .who { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #9a9fc4; }
.slot h3 { font-family: Bangers, Impact, sans-serif; font-size: 26px; letter-spacing: 1px; margin: 2px 0 0; }
.slot .co { color: var(--gold); font-weight: 700; font-size: 12px; margin-bottom: 6px; }
.slot .sp { margin: 3px 0; color: #c9cbe6; }
.slot .sp b { color: var(--ink); }
.slot .sp i { font-style: normal; font-size: 10px; padding: 1px 6px; border-radius: 99px; background: #2c3270; margin-right: 5px; }
.slot .sp i.u { background: var(--red); }
.slot.opp { text-align: right; }
.slot .empty { color: #7d82a8; padding-top: 30px; text-align: center; }

.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 4px 2px 6px; color: var(--ink); text-align: center; position: relative; transition: transform .1s; }
.card:hover { transform: translateY(-3px); }
.card canvas { width: 100%; aspect-ratio: 1; display: block; border-radius: 8px; }
.card .n { font-size: 11px; font-weight: 700; line-height: 1.15; display: block; }
.card .c { font-size: 10px; color: var(--gold); }
.card.you { border-color: #4aa3ff; box-shadow: 0 0 0 3px rgba(74, 163, 255, .25); }
.card.opp { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 59, 78, .25); }
.card.you::after, .card.opp::after { position: absolute; top: -9px; left: 6px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; color: #fff; }
.card.you::after { content: 'YOU'; background: #2f7bd6; }
.card.opp::after { content: 'RIVAL'; background: var(--red); }

.row { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.seg { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.seg span { margin-right: 4px; color: #9a9fc4; letter-spacing: 2px; }
.seg button { border: 2px solid var(--line); background: transparent; color: var(--ink); padding: 7px 11px; border-radius: 8px; font-weight: 700; font-size: 12px; }
.seg button.on { background: var(--gold); color: #1a1405; border-color: var(--gold); }
.keys { text-align: center; font-size: 11.5px; color: #9a9fc4; margin: 12px 0 0; }
.keys b { color: var(--gold); }

.paper { width: min(560px, 100%); background: #f1e9d6; color: #1c1a16; border-radius: 4px; padding: 20px 26px 22px; text-align: center; transform: rotate(-1.2deg); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); font-family: Georgia, 'Times New Roman', serif; }
.mast { font-weight: 700; letter-spacing: 3px; font-size: 13px; border-bottom: 3px double #1c1a16; padding-bottom: 8px; }
.mast span { font-weight: 400; letter-spacing: 1px; font-style: italic; }
.paper h2 { font-size: clamp(26px, 5vw, 40px); line-height: 1.05; margin: 14px 0 8px; text-transform: uppercase; }
.paper p { margin: 6px 0; font-size: 15px; }
.paper .quote { font-style: italic; color: #5a5346; }
.paper .btn { font-family: Rubik, sans-serif; }

#touch { display: none; position: fixed; inset: auto 0 0 0; z-index: 4; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); justify-content: space-between; pointer-events: none; }
#touch.show { display: flex; }
.pad { display: grid; grid-template-columns: repeat(2, 58px); gap: 8px; pointer-events: auto; }
.pad button { width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); background: rgba(20, 24, 60, .55); color: #fff; font-size: 22px; font-weight: 700; touch-action: none; user-select: none; }
.pad button:active { background: rgba(255, 207, 74, .6); }
.pad .sup { opacity: .35; font-family: Bangers, Impact, sans-serif; }
.pad .sup.ready { opacity: 1; background: var(--gold); color: #1a1405; border-color: #fff; }
.pad .sup.ultra.ready { background: var(--red); color: #fff; }

@media (max-width: 760px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
  .versus { grid-template-columns: 1fr 1fr; }
  .vs { display: none; }
  .slot .sp span { display: none; }
  .keys { display: none; }
  .overlay { place-items: start center; }
  #title.overlay, #notice.overlay, #result.overlay { place-items: center; }
}
#rotate { display: none; position: fixed; inset: 0; z-index: 50; background: #0d1028; place-items: center; text-align: center; padding: 24px; }
#rotate .ph { font-size: 72px; animation: tilt 1.6s ease-in-out infinite; }
#rotate h2 { font-family: Bangers, Impact, sans-serif; font-size: 34px; letter-spacing: 1px; color: var(--gold); margin: 10px 0 4px; }
#rotate p { margin: 0; color: #c9cbe6; }
@keyframes tilt { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (pointer: coarse), (orientation: portrait) and (max-width: 600px) { #rotate { display: grid; } }

/* mid-height windows: slim the picker so the 3D fighters stay visible above it */
@media (max-height: 820px) {
  .slot { min-height: 0; padding: 7px 12px; }
  .slot .sp span { display: none; }
  .slot .empty { padding: 14px 0; }
  .selwrap h2 { font-size: 26px; margin-bottom: 6px; }
  .keys { display: none; }
  .grid { max-width: 860px; margin: 0 auto; }
}
/* phones in landscape: short viewport */
@media (max-height: 500px) {
  .overlay { padding: 8px 12px; place-items: start center; }
  #title.overlay, #notice.overlay, #result.overlay { place-items: center; }
  .selwrap h2 { font-size: 20px; margin-bottom: 4px; }
  .versus { grid-template-columns: 1fr auto 1fr; gap: 8px; margin-bottom: 6px; }
  .vs { display: block; font-size: 26px; }
  .slot { min-height: 0; padding: 5px 10px; font-size: 11px; }
  .slot h3 { font-size: 18px; display: inline-block; margin-right: 8px; }
  .slot .co { display: inline-block; margin: 0; }
  .slot .sp span, .slot .who { display: none; }
  .slot .empty { padding: 8px 0; }
  .grid { grid-template-columns: repeat(10, 1fr); gap: 5px; }
  .card .n { font-size: 9.5px; } .card .c { display: none; }
  .row { margin-top: 8px; gap: 8px; }
  .btn.big { font-size: 20px; padding: 6px 22px; }
  .keys { display: none; }
  .sheet { padding: 12px 18px; font-size: 13px; } .sheet h2 { font-size: 24px; } .sheet ul { margin: 6px 0; font-size: 12px; }
  .titlebox h1 { font-size: 20vh; margin: 4px 0 8px; } .sub { margin-bottom: 10px; font-size: 14px; }
  .paper { padding: 12px 20px; } .paper h2 { font-size: 22px; margin: 8px 0 4px; }
  .pad { grid-template-columns: repeat(2, 52px); gap: 6px; } .pad button { width: 52px; height: 52px; }
}

.pad.right { grid-template-columns: repeat(3, 58px); }
.pad .sig { background: rgba(47, 227, 139, .55); }
.slot .sp i.g { background: #1f8f5c; }
@media (max-height: 500px) { .pad.right { grid-template-columns: repeat(3, 52px); } }

/* ---------- select screen (v2) ---------- */
#select.show { display: flex; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden;
  background: linear-gradient(180deg, rgba(8,9,28,.7) 0, rgba(8,9,28,0) 14%, rgba(8,9,28,0) 46%, rgba(8,9,28,.85) 62%, #0b0d26 74%); }
.selhead { position: relative; display: flex; justify-content: center; align-items: center; padding: 14px 16px 0; }
.pillbtn { position: absolute; left: 16px; top: 14px; border: 1px solid #3a418c; background: rgba(10,12,34,.9); color: #fff; font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 999px; }
.pillbtn:hover { border-color: var(--gold); }
.step { display: flex; align-items: center; gap: 12px; background: rgba(10,12,34,.92); border: 1px solid #3a418c; border-radius: 999px; padding: 7px 20px 7px 8px; }
.step span { background: var(--gold); color: #1a1405; font-weight: 700; font-size: 12px; letter-spacing: 1px; padding: 4px 10px; border-radius: 999px; }
.step b { font-family: Bangers, Impact, sans-serif; font-weight: 400; font-size: 26px; letter-spacing: 1px; color: #fff; }
.stagegap { flex: 1; display: flex; justify-content: center; align-items: center; gap: 14px; padding: 0 16px; min-height: 0; }
.vsmini { font-family: Bangers, Impact, sans-serif; font-size: 40px; color: var(--red); text-shadow: 0 3px 0 #05061a; }
.plate { width: min(320px, 32vw); background: rgba(10,12,34,.94); border: 1px solid #3a418c; border-left: 6px solid #4aa3ff; border-radius: 14px; padding: 12px 16px; cursor: pointer; transition: box-shadow .15s; }
.plate.opp { border-left: 1px solid #3a418c; border-right: 6px solid var(--red); text-align: right; }
.plate.active { box-shadow: 0 0 0 3px var(--gold); }
.plate .who { font-size: 12px; letter-spacing: 2px; color: #aab0dc; font-weight: 700; }
.plate h3 { font-family: Bangers, Impact, sans-serif; font-weight: 400; font-size: 32px; letter-spacing: 1px; margin: 2px 0 0; color: #fff; line-height: 1.05; }
.plate .co { color: var(--gold); font-weight: 700; font-size: 15px; margin: 2px 0 8px; }
.plate .mv { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 15px; color: #fff; font-weight: 500; }
.plate.opp .mv { flex-direction: row-reverse; }
.plate .mv i { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 3px 0; width: 74px; text-align: center; border-radius: 6px; flex: none; }
.plate .mv i.sig { background: #1f8f5c; } .plate .mv i.sup { background: #2f5fc4; } .plate .mv i.ult { background: var(--red); }
.plate .empty { color: #d6d8f0; font-size: 16px; padding: 18px 0; line-height: 1.4; }
.selbar { background: #0b0d26; border-top: 1px solid #262b66; padding: 12px 16px 16px; }
.selbar .grid { max-width: 1000px; margin: 0 auto; grid-template-columns: repeat(10, 1fr); gap: 8px; }
.selbar .card { padding: 4px 3px 7px; }
.selbar .card .n { font-size: 13px; margin-top: 3px; }
.selbar .card .c { display: none; }
.selbar .row { margin-top: 12px; }
.seg span { color: #c9cbe6; font-size: 13px; letter-spacing: 0; font-weight: 700; }
.seg button { font-size: 13px; padding: 8px 12px; }
/* how to play */
.sheet.help { max-width: 720px; }
.help .lead { color: #d6d8f0; margin: 0 0 14px; }
.helpgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 22px; }
.helpgrid .wide { grid-column: 1 / -1; }
.helpgrid h4 { margin: 0 0 6px; color: var(--gold); font-size: 15px; letter-spacing: 1px; text-transform: uppercase; }
.helpgrid h4 small { color: #aab0dc; text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }
.helpgrid dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; align-items: center; }
.helpgrid .wide dl { grid-template-columns: repeat(4, auto 1fr); }
.helpgrid dt { font-weight: 700; font-size: 13px; background: #262b66; border: 1px solid #3a418c; border-bottom-width: 3px; border-radius: 6px; padding: 3px 8px; text-align: center; min-width: 46px; }
.helpgrid dd { margin: 0; font-size: 15px; color: #fff; }
.touchnote { color: #aab0dc; font-size: 13px; margin: 14px 0 4px; }
#help { z-index: 30; }
@media (max-height: 560px) {
  .step b { font-size: 18px; } .step span { font-size: 10px; padding: 3px 8px; }
  .pillbtn { font-size: 12px; padding: 6px 10px; top: 10px; } .selhead { padding-top: 10px; }
  .plate { padding: 7px 12px; } .plate h3 { font-size: 20px; } .plate .co { font-size: 12px; margin-bottom: 4px; }
  .plate .mv { font-size: 12px; margin-top: 3px; } .plate .mv.sup, .plate .mv.ult { display: none; } .plate .empty { font-size: 13px; padding: 8px 0; }
  .vsmini { font-size: 26px; }
  .selbar { padding: 6px 10px 8px; } .selbar .grid { gap: 5px; } .selbar .card .n { font-size: 10px; } .selbar .row { margin-top: 6px; }
  .sheet.help { padding: 12px 16px; } .helpgrid { gap: 6px 14px; } .helpgrid dd { font-size: 12px; } .helpgrid dt { font-size: 11px; } .help .lead, .touchnote { font-size: 12px; margin-bottom: 6px; }
}
@media (max-width: 760px) { .selbar .grid { grid-template-columns: repeat(10, 1fr); } .plate { width: 40vw; } }

/* touch pads (v2): bigger targets, kept clear of the HUD */
#touch { padding: 0 max(14px, env(safe-area-inset-right)) calc(34px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); align-items: flex-end; }
.pad { gap: 10px; }
.pad.left { grid-template-columns: repeat(2, 62px); }
.pad.right { grid-template-columns: repeat(3, 62px); }
.pad button { width: 62px; height: 62px; font-size: 24px; background: rgba(12,14,40,.6); border: 2px solid rgba(255,255,255,.4); }
.pad button:active { background: rgba(255,207,74,.75); transform: scale(.94); }
@media (max-height: 430px) { .pad.left { grid-template-columns: repeat(2, 54px); } .pad.right { grid-template-columns: repeat(3, 54px); } .pad button { width: 54px; height: 54px; font-size: 20px; } .pad { gap: 7px; } #touch { padding-bottom: calc(30px + env(safe-area-inset-bottom)); } }

body.ingame #mute { display: none; }   /* M toggles sound during a fight */
@media (max-height: 560px) {
  .selbar .card canvas { width: 46px; height: 46px; margin: 0 auto; }
  .selbar .card { padding: 3px 2px 4px; }
  .plate { width: min(280px, 36vw); }
  .step { padding: 4px 14px 4px 5px; }
}

.pad .sig.cool { opacity: .35; }

.fine a { color: #c9cbe6; }

/* title logo image */
.titlebox h1.logo { transform: none; text-shadow: none; line-height: 0; margin: 0 0 10px; }
.titlebox h1.logo img { width: min(560px, 78vw); height: auto; filter: drop-shadow(0 8px 0 rgba(5,6,26,.55)); }
@media (max-height: 560px) { .titlebox h1.logo img { width: auto; height: 32vh; } }
