:root {
  --ink: #f6f8ff;
  --muted: #9aa7bd;
  --panel: rgba(13, 20, 35, .9);
  --line: rgba(255,255,255,.1);
  --cyan: #23d9f3;
  --red: #ff496b;
  --yellow: #ffd34d;
  color-scheme: dark;
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #080c15; color: var(--ink); overflow: hidden; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }

.menu-screen {
  overflow-y: auto;
  background:
    radial-gradient(circle at 86% 4%, rgba(35,217,243,.15), transparent 30%),
    radial-gradient(circle at 4% 95%, rgba(255,73,107,.13), transparent 36%),
    linear-gradient(125deg, #0b101b, #070a11 65%);
}
.menu-screen::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 86%);
}
.menu-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 34px; position: relative; }
.brand-block { display: grid; grid-template-columns: 1fr 1fr; align-items: end; margin-bottom: 24px; }
.eyebrow, .step-label { margin: 0 0 8px; color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .2em; }
.brand-block h1 { grid-column: 1; margin: 0; font-size: clamp(42px, 5.4vw, 76px); line-height: .9; letter-spacing: -.075em; text-transform: uppercase; }
.brand-block h1 span { color: transparent; -webkit-text-stroke: 1px rgba(246,248,255,.6); }
.subtitle { grid-column: 2; grid-row: 2; justify-self: end; margin: 0 0 5px; color: var(--muted); font-size: 14px; }

.selection-panel { border: 1px solid var(--line); background: rgba(12,18,31,.74); backdrop-filter: blur(12px); padding: 22px; box-shadow: 0 28px 80px rgba(0,0,0,.3); }
.panel-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.panel-heading > div { display: flex; align-items: baseline; gap: 12px; }
.panel-heading .step-label { margin: 0; }
.panel-heading h2 { margin: 0; font-size: 20px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.character-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.character-card {
  position: relative; min-height: 230px; overflow: hidden; text-align: left; cursor: pointer;
  padding: 0; border: 1px solid var(--line); background: #101827; transition: transform .18s, border-color .18s, box-shadow .18s;
}
.character-card:hover { transform: translateY(-4px); border-color: rgba(255,255,255,.26); }
.character-card.selected { border-color: var(--fighter); box-shadow: inset 0 0 0 1px var(--fighter), 0 12px 34px color-mix(in srgb, var(--fighter) 18%, transparent); }
.card-art { height: 92px; position: relative; background: linear-gradient(145deg, color-mix(in srgb, var(--fighter) 45%, #101827), #0b101b); overflow: hidden; }
.card-art::before { content: ""; position: absolute; width: 96px; height: 96px; border: 18px solid color-mix(in srgb, var(--fighter) 65%, white); border-radius: 50%; left: 50%; top: 25px; transform: translateX(-50%); opacity: .2; }
.fighter-icon { position: absolute; inset: 13px auto auto 50%; transform: translateX(-50%); width: 68px; height: 68px; display: grid; place-items: center; overflow: hidden; border: 3px solid color-mix(in srgb, var(--fighter) 65%, white); border-radius: 50%; background: var(--fighter); box-shadow: 0 8px 0 color-mix(in srgb, var(--fighter) 60%, #000); }
.fighter-icon img { width: 100%; height: 100%; object-fit: cover; }
.selected-mark { position: absolute; right: 9px; top: 9px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--fighter); color: #061018; font-size: 12px; font-weight: 1000; opacity: 0; transform: scale(.7); transition: .18s; }
.character-card.selected .selected-mark { opacity: 1; transform: scale(1); }
.card-copy { padding: 13px 14px 15px; }
.card-name { display: flex; justify-content: space-between; align-items: baseline; }
.card-name strong { font-size: 18px; }
.card-name span { color: var(--fighter); font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.card-copy p { min-height: 31px; margin: 8px 0 12px; color: #aeb8c9; font-size: 11px; line-height: 1.45; }
.stats { display: grid; gap: 6px; }
.stat { display: grid; grid-template-columns: 40px 1fr auto; gap: 7px; align-items: center; font-size: 9px; color: #8491a5; }
.stat i { height: 3px; background: #222d40; overflow: hidden; }
.stat i::after { content: ""; display: block; width: var(--value); height: 100%; background: var(--fighter); }
.stat b { color: #dbe1ed; font-size: 9px; }

.menu-actions { display: grid; grid-template-columns: 1fr 260px; gap: 12px; margin-top: 12px; }
.map-picker { display: flex; align-items: center; gap: 15px; padding: 13px 16px; border: 1px solid var(--line); background: rgba(14,21,35,.8); }
.map-picker .step-label { margin: 0; }
.map-picker div { display: grid; gap: 2px; }
.map-picker small { color: var(--muted); font-size: 9px; letter-spacing: .12em; }
.map-picker strong { font-size: 14px; }
.icon-button { margin-left: auto; width: 38px; height: 38px; cursor: pointer; border: 1px solid var(--line); background: #172136; font-size: 19px; }
.start-button { display: flex; justify-content: space-between; align-items: center; min-height: 62px; padding: 0 20px; border: 0; cursor: pointer; color: #061016; background: var(--yellow); font-size: 15px; font-weight: 1000; letter-spacing: .04em; box-shadow: 0 7px 0 #a97a16; transition: transform .12s, box-shadow .12s; }
.start-button:hover { transform: translateY(-2px); box-shadow: 0 9px 0 #a97a16; }
.start-button:active { transform: translateY(5px); box-shadow: 0 2px 0 #a97a16; }
.start-button b { font-size: 23px; }

.game-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #05080e; }
.game-frame { width: min(100vw, calc(100vh * 12 / 7)); max-height: 100vh; aspect-ratio: 12 / 7; position: relative; overflow: hidden; background: #111a25; box-shadow: 0 0 80px #000; }
#gameCanvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.hud { position: absolute; inset: 18px 24px auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; pointer-events: none; }
.team-status { display: flex; align-items: center; gap: 11px; color: #a9b9cb; font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.team-status strong { display: grid; place-items: center; width: 40px; height: 35px; background: rgba(5,10,17,.76); font-size: 20px; letter-spacing: 0; }
.ally-status strong { color: var(--cyan); border-bottom: 3px solid var(--cyan); }
.enemy-status { justify-self: end; }
.enemy-status strong { color: var(--red); border-bottom: 3px solid var(--red); }
.round-status { text-align: center; filter: drop-shadow(0 2px 5px #000); }
.round-score { font-size: 23px; font-weight: 1000; line-height: 1; }
.round-score span { color: #637086; margin: 0 7px; }
.round-label { margin-top: 5px; color: var(--yellow); font-size: 8px; font-weight: 900; letter-spacing: .2em; }
.round-status time { display: block; margin-top: 5px; font: 800 12px ui-monospace, monospace; }
.mute-button { position: absolute; right: 0; top: 48px; width: 32px; height: 32px; border: 1px solid rgba(255,255,255,.16); background: rgba(8,13,22,.75); pointer-events: auto; cursor: pointer; }
.mute-button.muted { color: #6f7887; text-decoration: line-through; }

.player-panel { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(600px, calc(100% - 32px)); display: grid; grid-template-columns: 58px 1fr 82px; gap: 11px; align-items: center; padding: 10px 13px; background: linear-gradient(90deg, rgba(8,14,24,.95), rgba(15,25,40,.88)); border: 1px solid rgba(255,255,255,.12); box-shadow: 0 10px 35px rgba(0,0,0,.4); pointer-events: none; }
.fighter-badge { width: 50px; height: 50px; display: grid; place-items: center; overflow: hidden; border: 3px solid var(--fighter, #73e2ee); background: var(--fighter, #73e2ee); clip-path: polygon(16% 0, 84% 0, 100% 25%, 91% 91%, 50% 100%, 9% 91%, 0 25%); }
.fighter-badge img { width: 100%; height: 100%; object-fit: cover; }
.player-title { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.player-title strong { font-size: 15px; }
.player-title span { color: #8795aa; font-size: 9px; }
.bar { position: relative; height: 10px; overflow: hidden; background: #242d3b; }
.bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #1ed585, #73ecad); transition: width .15s; }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; font: 800 7px ui-monospace, monospace; text-shadow: 0 1px 2px #000; }
.ammo-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-top: 5px; }
.ammo-slots i { height: 4px; background: var(--yellow); transition: opacity .2s, transform .2s; }
.ammo-slots i.empty { opacity: .14; transform: scaleX(.75); }
.super-block { text-align: center; }
.super-ring { width: 54px; height: 54px; margin: auto; display: grid; place-items: center; border-radius: 50%; border: 4px solid #283349; background: rgba(8,13,23,.85); box-shadow: inset 0 0 0 3px #0b111d; }
.super-ring span { font-size: 6px; color: #7e8a9b; }
.super-ring b { margin-top: -8px; font: 900 10px ui-monospace, monospace; }
.super-ring.ready { border-color: var(--yellow); color: var(--yellow); animation: readyPulse .85s infinite alternate; }
.super-block small { display: block; margin-top: 3px; color: #7f8ba0; font-size: 7px; }
.control-hint { grid-column: 2 / 4; color: #718096; font-size: 7px; letter-spacing: .05em; }
.control-hint b { color: #cbd3e0; }
.test-hint { position: absolute; bottom: 2px; margin: 0; color: #3b4556; font-size: 8px; letter-spacing: .08em; pointer-events: none; }

.announcement { position: absolute; left: 50%; top: 43%; transform: translate(-50%,-50%); text-align: center; padding: 15px 50px; background: rgba(7,11,18,.86); border-inline: 3px solid var(--yellow); animation: announceIn .25s both; pointer-events: none; }
.announcement small { color: var(--yellow); font-size: 9px; font-weight: 900; letter-spacing: .2em; }
.announcement strong { display: block; margin: 4px 0; font-size: clamp(28px, 5vw, 52px); font-weight: 1000; letter-spacing: -.06em; }
.announcement p { margin: 0; color: #9ba6b7; font-size: 10px; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; z-index: 8; background: rgba(3,6,11,.72); backdrop-filter: blur(6px); }
.overlay-card { width: min(420px, 88%); padding: 36px; text-align: center; border: 1px solid rgba(255,255,255,.14); background: #0d1523; box-shadow: 0 26px 90px #000; }
.overlay-card.compact { width: 330px; }
.overlay-card h2 { margin: 5px 0 8px; font-size: 34px; letter-spacing: -.05em; }
.overlay-card p { margin: 0 0 23px; color: var(--muted); font-size: 12px; }
.result-actions { display: grid; gap: 12px; }
.secondary-button { min-height: 48px; border: 1px solid rgba(255,255,255,.14); background: #172235; cursor: pointer; font-size: 12px; font-weight: 800; }

@keyframes readyPulse { to { transform: scale(1.08); box-shadow: 0 0 22px rgba(255,211,77,.45); } }
@keyframes announceIn { from { opacity: 0; transform: translate(-50%,-42%) scale(.9); } }

@media (max-width: 820px), (max-height: 680px) {
  html, body { overflow: auto; }
  .menu-shell { width: min(720px, calc(100% - 24px)); padding: 24px 0; }
  .brand-block { grid-template-columns: 1fr; gap: 10px; }
  .subtitle { grid-column: 1; grid-row: auto; justify-self: start; }
  .character-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .character-card:last-child { grid-column: 1 / 3; }
  .menu-actions { grid-template-columns: 1fr; }
  .panel-heading p { display: none; }
  .game-frame { width: 100vw; height: auto; }
}
