@font-face {
  font-family: Barlow Condensed;
  src: url('assets/fonts/barlow-condensed-800.woff2') format('woff2');
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: Barlow Condensed;
  src: url('assets/fonts/barlow-condensed-900italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page: #121217;
  --panel: #1b1a22;
  --panel-dark: #15151c;
  --line: #35343e;
  --muted: #b4aebb;
  --ink: #fff2df;
  --hot: #ff6948;
  --hot-light: #ff997a;
  --cool: #85d9e9;
  --display: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 290px;
  background: radial-gradient(ellipse at 30% 0%, #26212a 0%, transparent 61%), var(--page);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled { cursor: default; }
button:focus-visible { outline: 2px solid #ffdbac; outline-offset: 4px; }
button, h1, h2, p { margin: 0; }

.page-width { width: min(100% - 72px, 1260px); margin-inline: auto; }

.masthead {
  position: relative;
  background: #15141be8;
  border-block-end: 1px solid #35323b;
}

.masthead::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #fc6748, #ce422f 23%, #472631 70%, #28222d);
}

.masthead-inner { min-height: 88px; display: flex; gap: 18px; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 14px; white-space: nowrap; }

.brand-mark {
  width: 43px;
  height: 41px;
  position: relative;
  display: block;
  background: var(--hot);
  clip-path: polygon(22% 0, 100% 0, 79% 100%, 0 100%);
}

.brand-mark::after {
  content: '';
  position: absolute;
  inset: 7px 8px;
  background: #211820;
  clip-path: polygon(52% 0, 100% 0, 65% 38%, 93% 38%, 28% 100%, 44% 54%, 11% 54%);
}

.brand h1 {
  font: italic 900 clamp(34px, 4vw, 52px)/0.92 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.018em;
  padding: 0 5px 5px 0;
}

.brand h1 span { color: var(--hot); }
.utilities { display: flex; align-items: center; gap: 8px; }

.utility-button, .glass-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding-inline: 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #23222b;
  color: var(--ink);
  font-weight: 650;
  font-size: 12px;
  transition: background 140ms, border-color 140ms;
}

.utility-button:hover, .glass-button:hover { background: #34313b; border-color: #6d626c; }
.utility-square, .glass-button { width: 38px; padding: 0; }
.icon { width: 16px; height: 16px; display: inline-block; position: relative; flex: none; }

.icon-keyboard {
  width: 16px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.icon-keyboard::before, .icon-keyboard::after {
  content: '';
  position: absolute;
  background: currentColor;
}

.icon-keyboard::before { width: 2px; height: 2px; top: 2px; left: 2px; box-shadow: 4px 0 currentColor, 8px 0 currentColor; }
.icon-keyboard::after { width: 7px; height: 1px; bottom: 2px; left: 3px; }

.icon-sound::before, .icon-sound::after { content: ''; position: absolute; }
.icon-sound::before { inset: 2px 5px 2px 0; background: currentColor; clip-path: polygon(0 28%, 43% 28%, 100% 0, 100% 100%, 43% 72%, 0 72%); }
.icon-sound::after { top: 1px; bottom: 1px; width: 5px; right: -1px; border-right: 1.5px solid currentColor; border-radius: 0 85% 85% 0; }
#sound[aria-pressed='false'] .icon-sound::after { top: 0; bottom: 0; right: 6px; width: 1px; border: 0; border-radius: 0; background: currentColor; transform: rotate(45deg); box-shadow: 2px 0 #23222b; }

.icon-expand {
  width: 15px;
  height: 15px;
  background:
    linear-gradient(currentColor, currentColor) top left / 6px 2px no-repeat,
    linear-gradient(currentColor, currentColor) top left / 2px 6px no-repeat,
    linear-gradient(currentColor, currentColor) top right / 6px 2px no-repeat,
    linear-gradient(currentColor, currentColor) top right / 2px 6px no-repeat,
    linear-gradient(currentColor, currentColor) bottom left / 6px 2px no-repeat,
    linear-gradient(currentColor, currentColor) bottom left / 2px 6px no-repeat,
    linear-gradient(currentColor, currentColor) bottom right / 6px 2px no-repeat,
    linear-gradient(currentColor, currentColor) bottom right / 2px 6px no-repeat;
}

.icon-pause::before { content: ''; position: absolute; inset: 2px 3px; border-inline: 3px solid currentColor; }

.main { padding-block: 27px 20px; }
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 302px; gap: 20px; }
.game-deck, .setup-panel { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; overflow: hidden; }
.game-deck { align-self: start; box-shadow: 0 14px 30px #0003; }

.screen { position: relative; background: #191723; }
.screen:focus { outline: none; }
.screen-surface { position: relative; container-type: inline-size; width: 100%; aspect-ratio: 480 / 232; overflow: hidden; isolation: isolate; }
.screen canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

.screen-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, #100c18cf 0%, #120f1a60 17%, transparent 37%, transparent 79%, #0e0b163f 100%),
    repeating-linear-gradient(to bottom, transparent 0 3px, #17122312 3px 4px);
  box-shadow: inset 0 0 32px #13101e36;
}

.hud { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 1.8cqw; position: absolute; inset: 2.7cqw 3.1cqw auto; pointer-events: none; }
.hud-left { --side: var(--hot); --side-light: #ffbd7b; }
.hud-right { --side: var(--cool); --side-light: #aaf5f1; }
.hud-name, .hud-bottom { display: flex; align-items: center; gap: 7px; }
.hud-right .hud-name, .hud-right .hud-bottom { flex-direction: row-reverse; }

.player-chip {
  display: grid;
  place-items: center;
  min-width: 3.3cqw;
  padding-inline: 5px;
  height: clamp(12px, 2.1cqw, 21px);
  background: var(--side);
  border-radius: 2px;
  color: #1c1720;
  font-weight: 850;
  font-size: clamp(8px, 1.25cqw, 12px);
  line-height: 1;
}

.fighter-name {
  display: block;
  color: #fff2de;
  font: italic 900 clamp(18px, 4.05cqw, 45px)/0.98 var(--display);
  text-transform: uppercase;
  text-shadow: 1px 2px 0 #201322, 0 0 10px #100a16;
}

.health {
  height: clamp(9px, 2cqw, 20px);
  margin-block-start: 6px;
  padding: 2px;
  background: #251721;
  outline: 1px solid #fff0d5a1;
  border-radius: 2px;
  box-shadow: 0 2px 3px #160b18c0;
}

.health-fill {
  display: block;
  height: 100%;
  background: linear-gradient(180deg, var(--side-light), var(--side) 55%, color-mix(in srgb, var(--side) 77%, #241028));
  border-radius: 1px;
  transform-origin: left;
  transition: transform 130ms ease-out;
}

.hud-right .health-fill, .hud-right .special-fill { transform-origin: right; }
.hud-bottom { margin-block-start: 6px; gap: 7px; }
.special-meter { position: relative; height: clamp(4px, .7cqw, 7px); width: 29%; border: 1px solid #1f1724; background: #211b2c; }
.special-meter::after { content: ''; width: 1px; position: absolute; inset: 0 auto 0 50%; background: #fff2d99d; }
.special-fill { display: block; height: 100%; background: #f8d47e; transform-origin: left; }
.special-meter.is-ready .special-fill { background: #ffe89c; box-shadow: 0 0 6px #f5aa35a0; }
.special-meter.is-empty .special-fill { background: #ef7163; }
.special-label { color: #fff1d7; text-shadow: 0 1px 3px #170d1b; font-size: clamp(7px, 1.1cqw, 11px); font-weight: 800; letter-spacing: 0.055em; text-transform: uppercase; }

.hud-clock {
  display: grid;
  min-width: 9.6cqw;
  justify-items: center;
  color: #fff2dc;
  text-align: center;
  text-shadow: 2px 2px 0 #281725, 0 0 8px #1a0e21;
}

.clock-number { font: italic 900 clamp(28px, 6cqw, 67px)/0.84 var(--display); padding: 0 0.7cqw 0.6cqw 0; font-variant-numeric: tabular-nums; }
.clock-number.is-low { color: #ff8766; }
.clock-label { font-size: clamp(7px, 1.27cqw, 11px); font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em; }
.round-score { display: flex; justify-content: space-between; position: absolute; inset: auto 3.2cqw 3.1cqw; pointer-events: none; }
.score-pips { display: flex; gap: 5px; }
.score-pips span { width: clamp(7px, 1.25cqw, 14px); aspect-ratio: 1; transform: skew(-12deg); border: 1px solid #f9ebdb9e; background: #191420a8; }
.score-pips span.won { background: #f9ce71; border-color: #fff3c8; box-shadow: 0 0 8px #ebb34c85; }

.stage-center { position: absolute; top: 49%; left: 50%; width: 78%; transform: translate(-50%, -50%); display: grid; justify-items: center; pointer-events: none; text-align: center; }
.preview-vs {
  display: grid;
  place-items: center;
  width: 12.2cqw;
  aspect-ratio: 1.12;
  padding: 0 0.9cqw 0.4cqw 0;
  border: 1px solid #ffbf927a;
  transform: skew(-9deg);
  background: #1a1225d9;
  box-shadow: 4px 5px 0 #16101b7a, inset 0 0 18px #2a2132;
  color: #ffb287;
  font: italic 900 clamp(22px, 5.3cqw, 54px)/1 var(--display);
  text-shadow: 2px 2px 0 #422235;
}

.announcement-title {
  color: #fff0dc;
  font: italic 900 clamp(25px, 8.5cqw, 88px)/0.9 var(--display);
  text-shadow: 3px 4px 0 #251727, -1px -1px 0 #251727, 0 0 18px #100917;
  text-transform: uppercase;
}

.announcement-title.is-impact { color: #ffbd86; }
.announcement-note { margin-block-start: 6px; color: #fff2df; font-weight: 800; font-size: clamp(9px, 1.9cqw, 17px); text-shadow: 1px 2px 3px #190f22; }
.announcement-note:empty { display: none; }

.stage-cover { position: absolute; inset: 0; display: grid; place-items: center; background: #14101ccc; z-index: 2; }
.stage-card { width: min(86%, 440px); display: grid; place-items: center; gap: 12px; text-align: center; }
.stage-card-title { font: italic 900 clamp(28px, 7.5cqw, 72px)/0.96 var(--display); color: #fff0dc; text-transform: uppercase; }
.match-score { color: #ffd292; font: 800 clamp(18px, 4.3cqw, 38px)/1 var(--display); letter-spacing: 0.07em; }
.stage-actions { display: flex; justify-content: center; gap: 8px; }
.stage-actions button { min-height: 38px; padding-inline: 15px; }
.fullscreen-actions, .fullscreen-play { display: none !important; }
.screen.is-expanded { display: grid; place-items: center; background: #111015; }
.screen.is-expanded .screen-surface { width: min(100vw, calc(100dvh * 2.0689655)); }
.screen.is-expanded .fullscreen-actions { position: absolute; z-index: 3; right: 10px; bottom: 10px; display: flex !important; gap: 6px; }
.screen.is-expanded .fullscreen-play { display: flex !important; pointer-events: auto; margin-block-start: 12px; gap: 16px; }
.screen.simulated-fullscreen { position: fixed; inset: 0; z-index: 10; }
body:has(.simulated-fullscreen) { overflow: hidden; }
.glass-button { background: #211925c9; border-color: #f8e2ce5b; }

.stage-bar { min-height: 60px; display: flex; gap: 12px; align-items: center; padding: 8px 14px; border-top: 1px solid #3a3540; }
.stage-location { margin-inline-end: auto; display: flex; align-items: center; gap: 11px; }
.stage-name { display: block; font: 800 23px/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.stage-spot { display: block; margin-block-start: 3px; color: var(--muted); font-size: 11px; }
.stage-rules { color: var(--muted); font-size: 11px; font-weight: 650; text-align: end; }

.flag { display: inline-block; position: relative; flex: none; width: 18px; height: 12px; border-radius: 2px; box-shadow: 0 0 0 1px #ffffff24; background: #fff6ee; }
.flag.fr { background: linear-gradient(90deg, #3d63a6 33.33%, #f7f3eb 33.33% 66.66%, #dc555a 66.66%); }
.flag.ru { background: linear-gradient(#f7f3eb 33.33%, #4d6bb9 33.33% 66.66%, #cf4a57 66.66%); }
.flag.jp { background: radial-gradient(circle at center, #ce4658 0 3px, #f7f3eb 3.4px); }
.flag.us { background: repeating-linear-gradient(#cc505c 0 1px, #f7f3eb 1px 2px); }
.flag.us::before { content: ''; position: absolute; inset: 0 auto auto 0; width: 8px; height: 6px; background: #4a6199; border-radius: 1px 0 0 0; }

.setup-panel { padding: 15px; display: flex; flex-direction: column; gap: 11px; }
.section-title { font: 800 31px/0.96 var(--display); text-transform: uppercase; letter-spacing: 0.032em; }
.setup-panel .section-title { font-size: 27px; }
.segment { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; gap: 3px; background: var(--panel-dark); border: 1px solid #30303b; border-radius: 6px; }
.segment button { min-height: 31px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding-inline: 3px; background: transparent; border: 1px solid transparent; border-radius: 3px; color: var(--muted); font-size: 12px; font-weight: 700; }
.segment button[aria-pressed='true'] { background: #312d38; border-color: #4d4550; color: var(--ink); }
.segment button:hover:not(:disabled) { color: var(--ink); background-color: #38323e; }
.role-dot { display: inline-block; width: 6px; height: 6px; transform: rotate(45deg); background: var(--hot); }
#pick-p2 .role-dot { background: var(--cool); }
.roster { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(99px, 1fr); gap: 8px; }

.fighter-card { position: relative; min-width: 0; display: block; isolation: isolate; overflow: hidden; padding: 0; border-radius: 5px; border: 1px solid #4b4050; text-align: start; background: radial-gradient(ellipse at 51% 22%, color-mix(in srgb, var(--fighter-background) 88%, #b2a0a3), var(--fighter-background) 52%, #25232d 100%); }
.fighter-card::before { content: ''; position: absolute; z-index: -1; inset: 0; background: repeating-linear-gradient(127deg, #ffffff0b 0 1px, transparent 1px 5px); }
.fighter-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 32%, #1813212b 60%, #15101bef 100%); }
.fighter-card img { width: 100%; height: 100%; display: block; position: absolute; inset: 0; object-fit: cover; object-position: center top; transition: transform 180ms ease; }
.fighter-card:hover:not(:disabled) img { transform: scale(1.07); }
.fighter-card:hover:not(:disabled) { border-color: #c0a3ad; }
.fighter-card.is-picked { border-color: var(--hot); box-shadow: inset 0 0 0 1px #ff69484d; }
.roster[data-picking='1'] .fighter-card.is-picked { border-color: var(--cool); box-shadow: inset 0 0 0 1px #85d9e960; }
.fighter-meta { position: absolute; z-index: 1; inset: auto 8px 6px; }
.fighter-card-name { display: block; font: italic 900 23px/0.91 var(--display); letter-spacing: 0.025em; text-transform: uppercase; text-shadow: 1px 1px 3px #140e1b; }
.fighter-style { display: block; margin-block-start: 4px; font-size: 9px; font-weight: 620; color: #f0e3d6; }
.fighter-tags { display: flex; gap: 3px; position: absolute; z-index: 1; top: 6px; left: 6px; }
.card-tag { background: var(--hot); color: #241a22; border-radius: 2px; font-size: 9px; font-weight: 900; padding: 2px 4px; line-height: 1; }
.card-tag.second { background: var(--cool); }

.setup-actions { display: grid; gap: 8px; }
.segmented-modes button { min-height: 27px; }
.play-button, .secondary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 4px 14px 5px;
  background: var(--hot);
  color: #23151c;
  border-radius: 5px;
  border: 1px solid #ff9e80;
  font: 800 21px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.045em;
  transition: background 140ms;
}

.play-button:hover:not(:disabled) { background: #ff9473; }
.play-button:disabled { border-color: #53414b; background: #3a303a; color: #bdb3bf; }
.play-button.start { justify-content: space-between; }
.button-arrow { font: 800 32px/0.65 var(--display); margin-block-end: 3px; }
.secondary-button { background: #2b2732; border-color: #625665; color: var(--ink); }
.secondary-button:hover { background: #39333f; }

.arenas { margin-block-start: 23px; }
.section-heading { display: flex; gap: 13px; align-items: center; margin-block-end: 12px; }
.section-heading::before { content: ''; width: 5px; height: 19px; transform: skew(-11deg); background: var(--hot); }
.section-heading::after { content: ''; height: 1px; background: var(--line); flex: 1; }
.arena-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; }
.arena-card { display: block; width: 100%; min-width: 0; padding: 0; position: relative; text-align: start; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); overflow: hidden; transition: border-color 140ms; }
.arena-card:hover:not(:disabled) { border-color: #b29ba5; }
.arena-card[aria-pressed='true'] { border-color: var(--hot); }
.arena-card:disabled:not([aria-pressed='true']) { opacity: 0.72; }
.arena-image { display: block; overflow: hidden; aspect-ratio: 2.7; background: #383341; }
.arena-image img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 46%; transition: transform 200ms ease; }
.arena-card:hover:not(:disabled) img { transform: scale(1.07); }
.arena-info { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 7px 8px 8px; }
.arena-name { font: 800 clamp(14px, 2vw, 23px)/0.93 var(--display); white-space: nowrap; text-transform: uppercase; }
.arena-country { display: flex; flex: none; gap: 4px; align-items: center; font-size: 10px; color: var(--muted); }
.arena-country .flag { width: 12px; height: 8px; }
.arena-country .flag.jp { background: radial-gradient(circle at center, #ce4658 0 2px, #f7f3eb 2.3px); }
.arena-country .flag.us::before { width: 5px; height: 4px; }

.quick-keys { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 24px; margin-block-start: 19px; padding-block-start: 13px; border-block-start: 1px solid #302e38; color: var(--muted); font-size: 11px; }
.quick-keys > div { display: flex; align-items: center; gap: 4px; }
.quick-keys > div > span:last-child { margin-inline-start: 4px; }
kbd { display: inline-block; min-width: 18px; padding: 2px 5px; background: #24222d; border: 1px solid #3e3a47; border-block-end-width: 2px; border-radius: 4px; color: #fff0dc; text-align: center; font: 700 11px/1.1 ui-monospace, Menlo, Consolas, monospace; }
.key-separator { color: #847d8a; }

.controls-dialog { width: min(545px, 100% - 32px); max-height: calc(100% - 32px); border: 1px solid var(--line); border-top: 3px solid var(--hot); border-radius: 8px; background: #1c1b24; padding: 20px; color: var(--ink); box-shadow: 0 16px 70px #0009; }
.controls-dialog::backdrop { background: #0a0911cb; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-block-end: 16px; }
.close-dialog { font-size: 22px; }
.controls-dialog table { border-collapse: collapse; width: 100%; font-size: 13px; }
.controls-dialog th, .controls-dialog td { border-block-end: 1px solid var(--line); padding: 8px 6px; text-align: start; }
.controls-dialog thead th { color: var(--hot-light); }
.controls-dialog p { margin-block-start: 12px; color: #d9d0db; font-size: 13px; line-height: 1.55; }
.controls-dialog td span { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1130px) {
  .page-width { width: calc(100% - 48px); }
  .game-grid { grid-template-columns: minmax(0, 1fr) 254px; gap: 14px; }
  .setup-panel { padding: 11px; gap: 8px; }
  .arena-info { align-items: start; flex-direction: column; gap: 5px; }
}

@media (max-width: 910px) {
  .game-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
  .setup-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 36%); padding: 12px; gap: 11px; align-items: center; }
  .roster { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(108px, 17vw); grid-column: 1 / -1; }
  .setup-actions { grid-template-columns: 1fr 1fr; grid-column: 1 / -1; }
  .segmented-modes button { min-height: 33px; }
  .arena-info { flex-direction: row; }
  .arena-country .flag { display: none; }
}

@media (max-width: 650px) {
  .page-width { width: calc(100% - 28px); }
  .masthead-inner { min-height: 67px; }
  .brand { gap: 7px; }
  .brand-mark { width: 31px; height: 29px; }
  .brand-mark::after { inset: 5px; }
  .brand h1 { font-size: clamp(27px, 6.3vw, 38px); }
  .utilities { gap: 5px; }
  .utility-label { display: none; }
  .utility-button { width: 33px; min-height: 33px; padding-inline: 0; }
  .main { padding-block-start: 14px; }
  .stage-bar { padding-inline: 9px; min-height: 49px; }
  .stage-name { font-size: 20px; }
  .hud-name, .hud-bottom { gap: 4px; }
  .health, .hud-bottom { margin-block-start: 4px; }
  .health { padding: 1px; }
  .roster { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: clamp(100px, 28vw, 150px); }
  .fighter-card img { object-position: center 14%; }
  .arenas { margin-block-start: 19px; }
  .arena-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .arena-name { font-size: 19px; }
  .arena-country .flag { display: inline-block; }
  .quick-keys { justify-content: flex-start; gap: 8px 15px; }
}

@media (max-width: 365px) {
  .setup-panel { grid-template-columns: minmax(0, 1fr); }
  .arena-info { flex-direction: column; }
  .stage-spot, .stage-rules { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
