@font-face {
  font-family: "Melee Display";
  src: url("/art/anton.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  color: #f5f3ed;
  background: #111112;
  line-height: 1.4;
  --muted: #c1bfb9;
  --line: #696969;
  --gold: #ffda64;
  --red: #ad1827;
  --display: "Melee Display", Impact, "Arial Black", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  background:
    repeating-linear-gradient(135deg, #ffffff03 0 1px, transparent 1px 5px),
    conic-gradient(#19191b 25%, #131315 0 50%, #19191b 0 75%, #131315 0) 0 0 / 24px 24px;
}

header, main, footer { width: 100%; max-width: 1180px; margin: auto; padding-inline: 12px; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 88px;
  padding-block: 10px;
  border-bottom: 3px solid #bab9b4;
  background: linear-gradient(110deg, #0c0c0e 65%, #373739);
  box-shadow: 0 2px 0 #050505, inset 0 -5px 0 #353536;
}
header > div { min-width: 0; }
.eyebrow { color: var(--gold); font-size: .62rem; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  font-style: italic;
  line-height: 1.05;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
h1 { margin: 1px 0 0; font-size: clamp(1.65rem, 7.5vw, 2.6rem); letter-spacing: -.045em; text-shadow: 2px 2px #000; }
h1 span { color: var(--gold); }
h2 { margin: 0 0 10px; font-size: 1.5rem; letter-spacing: -.015em; }
h3 { margin: 16px 0 8px; font-size: 1.2rem; }
p { overflow-wrap: anywhere; }
#page-subtitle { margin: 3px 0 0; color: var(--muted); font-size: .68rem; }
main { padding-block: 10px 20px; }
section {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #858582;
  border-top: 3px solid #dedbd3;
  background: repeating-linear-gradient(0deg, #ffffff03 0 1px, transparent 1px 4px), #232325;
  box-shadow: inset 1px 0 #4d4d4d, inset -1px -2px #080809, 2px 3px 0 #080809;
}
#selected { padding: 10px 8px 12px; border-top-color: var(--gold); }
.menu { display: flex; gap: 6px; margin: 10px 0 12px; }
button, input, select, textarea { font: inherit; }
button {
  min-height: 44px;
  max-width: 100%;
  margin: 4px 0;
  padding: 10px 14px;
  border: 1px solid #fff0b1;
  border-bottom-color: #94651b;
  border-radius: 0;
  background: linear-gradient(#ffe69a, #e7b540);
  color: #1e180a;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  overflow-wrap: anywhere;
  box-shadow: inset 0 1px #fff4cd, 0 2px #080809;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { cursor: not-allowed; background: #343435; border-color: #686868; color: #aaa9a5; box-shadow: none; }
.secondary, .menu button, #play-choice button, .match-option {
  color: #f7f5ee;
  border-color: #aaa9a5 #555 #363636 #8a8985;
  background: linear-gradient(#575758, #313133 48%, #272729 49%, #39393b);
  box-shadow: inset 0 1px #ffffff25, 0 2px #080809;
}
.menu button { flex: 1; min-width: 0; margin: 0; padding: 9px 6px; font: italic 1.1rem var(--display); text-transform: uppercase; letter-spacing: .025em; }
.menu button[aria-pressed="true"], #play-choice button[aria-pressed="true"], .match-option[aria-pressed="true"] {
  color: #fff4d7;
  border-color: #ffdb77 #81111c #4a0911 #e6a250;
  background: linear-gradient(#ba2734, #8d1120 50%, #6f0e19 51%, #921824);
  box-shadow: inset 3px 0 var(--gold), inset 0 1px #ffffff40, 0 2px #080809;
}
.danger { color: #fff; background: #901c2a; border-color: #ec8190; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions > button { flex: 1 1 auto; }
:where(button, input, select, textarea, a, summary):focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
a { color: var(--gold); text-underline-offset: 3px; overflow-wrap: anywhere; }
label { display: block; margin: 12px 0; color: #e0ddd4; font-size: .8rem; font-weight: 700; }
input, select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin-top: 5px;
  padding: 10px;
  border: 1px solid #90908a;
  border-radius: 0;
  background: #101012;
  color: #fff;
  font-size: 16px;
  box-shadow: inset 2px 2px #050505;
}
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; }
.check input { flex: 0 0 24px; width: 24px; height: 24px; min-height: 24px; margin: 0; accent-color: var(--gold); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.grid > *, .pool-grid > *, .seats > * { min-width: 0; }
.grid form + form { border-top: 1px solid var(--line); padding-top: 12px; }
form > h3:first-child { margin-top: 0; }
form p { color: var(--muted); font-size: .78rem; }
img { max-width: 100%; height: auto; }

/* The challenger screen uses the same portrait stage as the four controller ports. */
#onboard { display: grid; grid-template-columns: minmax(0, 1fr); padding: 0; overflow: hidden; }
.join-art {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 128px;
  overflow: hidden;
  border-bottom: 3px solid #d5c99e;
  background: repeating-linear-gradient(125deg, transparent 0 22px, #0003 22px 26px), linear-gradient(110deg, #430b12, #b22232 55%, #4b0c15);
}
.join-art::before { content: "VS"; position: absolute; left: 9px; bottom: -14px; color: #ffffff1c; font: italic 110px var(--display); }
.join-art img { position: relative; width: 38%; height: 145px; margin: 0 -4%; object-fit: contain; object-position: center bottom; filter: drop-shadow(3px 3px 0 #16070a); }
.join-art img:nth-child(2) { z-index: 1; height: 165px; }
.join-copy { min-width: 0; padding: 14px 12px 10px; }
.join-copy h2 { margin-top: 3px; font-size: 1.8rem; }
.join-copy form > button { width: 100%; }
.join-copy details { margin-top: 10px; }
.join-copy label { margin-block: 10px; }
.section-title, .balance { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.section-title { margin-bottom: 10px; }
.section-title h2, .balance h2 { margin: 0; }
.section-title > * { min-width: 0; }
.section-title a { font-size: .7rem; }
.screen-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.screen-heading > div { min-width: 0; }
.screen-heading h2 { margin: 0; }
.screen-heading .eyebrow { display: block; margin-bottom: 4px; font-size: .56rem; }
#match-title { font-size: clamp(1.25rem, 5.8vw, 2rem); }
#match-state { flex-shrink: 0; max-width: 42%; padding: 4px 6px; border: 1px solid #82785a; color: var(--gold); background: #181715; font-size: .6rem; font-weight: 800; text-transform: uppercase; overflow-wrap: anywhere; }
#matches { padding-block: 10px; }
#matches h2 { font-size: 1.1rem; }
#match-list { display: flex; flex-wrap: wrap; gap: 6px; }
.match-option { margin: 0; padding: 8px 10px; font-size: .78rem; text-align: left; }
.battle-banner {
  position: relative;
  margin: 0 -3px 10px;
  padding: 8px 14px;
  border-block: 2px solid #f7d780;
  background: repeating-linear-gradient(125deg, transparent 0 11px, #00000012 11px 14px), linear-gradient(90deg, #710f1c, #b71e2e 54%, #690d18);
  color: #fff3c8;
  font: italic clamp(1.3rem, 6vw, 2.2rem)/1.05 var(--display);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .025em;
  text-shadow: 2px 2px #3b050b;
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
}
.seats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seat-card {
  --seat-color: #f06565;
  --seat-tint: #7b2029;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  isolation: isolate;
  height: 202px;
  min-height: 202px;
  min-width: 0;
  margin: 0;
  padding: 0 7px 7px;
  overflow: hidden;
  border: 2px solid #b7b4ac;
  border-top: 4px solid var(--seat-color);
  color: #fff;
  background: repeating-linear-gradient(135deg, #ffffff08 0 2px, transparent 2px 7px), linear-gradient(145deg, var(--seat-tint), #1b1b1d 78%);
  box-shadow: inset 0 0 0 1px #000, 0 3px #080809;
  text-align: left;
}
.seat-card[data-port="2"] { --seat-color: #86b9f2; --seat-tint: #244c77; }
.seat-card[data-port="3"] { --seat-color: #ffe06c; --seat-tint: #766020; }
.seat-card[data-port="4"] { --seat-color: #82d987; --seat-tint: #235b34; }
.seat-card::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(transparent 35%, #0009 57%, #101012 80%); }
.seat-card:disabled { color: #fff; border-color: #b7b4ac; border-top-color: var(--seat-color); background: repeating-linear-gradient(135deg, #ffffff08 0 2px, transparent 2px 7px), linear-gradient(145deg, var(--seat-tint), #1b1b1d 78%); box-shadow: inset 0 0 0 1px #000, 0 3px #080809; opacity: 1; }
.seat-card[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 1px #17130b, 0 3px #080809; }
.seat-card[aria-pressed="true"]::after { content: "YOUR PICK"; position: absolute; top: 6px; right: 4px; padding: 4px; background: var(--gold); color: #1a1407; font-size: .51rem; font-weight: 900; letter-spacing: .035em; transform: rotate(3deg); }
.port-badge { position: absolute; top: 5px; left: 5px; z-index: 2; padding: 3px 6px; background: var(--seat-color); border: 1px solid #fff7; color: #151515; font: italic .83rem var(--display); text-transform: uppercase; box-shadow: 2px 2px #0009; }
.fighter-art { position: absolute; z-index: -2; top: 13px; left: -3%; width: 106%; max-width: none; height: 151px; object-fit: contain; object-position: center top; filter: drop-shadow(3px 4px 0 #0006); }
.fighter-placeholder { position: absolute; z-index: -2; inset: 21px 0 auto; color: #ffffff60; font: italic 112px/1 var(--display); text-align: center; text-shadow: 3px 4px #0006; }
.fighter-name { display: block; color: #fff5d8; font: italic 1.2rem/1 var(--display); text-transform: uppercase; text-shadow: 1px 2px #000; overflow-wrap: anywhere; }
.player-name { display: block; margin-top: 4px; overflow: hidden; color: #fff; font-size: .82rem; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.seat-meta { display: block; margin-top: 3px; overflow: hidden; color: #d5d2c8; font-size: .64rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.seat-backing { display: block; margin-top: 5px; padding-top: 4px; border-top: 1px solid #ffffff35; color: var(--seat-color); font-size: .66rem; font-weight: 800; line-height: 1.1; }
.pool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 8px; padding: 9px 2px; border-block: 1px solid #6b675b; color: #d5d1c7; font-size: .67rem; font-weight: 700; text-transform: uppercase; }
.pool-grid > div + div { border-left: 1px solid #6b675b; padding-left: 10px; }
.pool-grid strong { display: block; margin-top: 3px; color: var(--gold); font: italic clamp(1.6rem, 7vw, 2.4rem)/1.05 var(--display); overflow-wrap: anywhere; }
#match-help { margin: 8px 0; color: #e0dbcc; font-size: .76rem; }
#participant-actions { width: 100%; max-width: none; margin-top: 10px; }
#participant-actions form { padding: 12px 10px; border: 1px solid #64615a; border-top: 2px solid #b4ac96; background: #18181a; }
#participant-actions form + form { margin-top: 10px; }
#play-choice { gap: 6px; margin-bottom: 10px; }
#play-choice > button { flex: 1 1 0; min-width: 0; margin: 0; padding-inline: 7px; font-size: .83rem; }
#participant-actions form > button:last-child { width: 100%; }
#roster-choice { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 10px 0; }
.roster-pick { position: relative; min-width: 0; min-height: 98px; margin: 0; padding: 0 2px 5px; border: 1px solid #8c8880; background: linear-gradient(135deg, #474547, #232325); color: #fff; box-shadow: inset 0 1px #ffffff30, 0 2px #000; }
.roster-pick img { display: block; width: 100%; height: 57px; object-fit: contain; }
.roster-pick span { display: flex; align-items: center; justify-content: center; min-height: 29px; font-family: var(--display); font-weight: 400; font-size: .75rem; line-height: 1.2; text-transform: uppercase; overflow-wrap: anywhere; }
.roster-pick[aria-pressed="true"] { border-color: var(--gold); background: #791521; box-shadow: inset 0 0 0 1px var(--gold); color: #fff0bb; }

/* Wallet and referee controls stay on compact metal menu strips. */
.balance { flex-wrap: wrap; margin-bottom: 12px; }
.balance strong { display: block; color: var(--gold); font: italic 2rem/1.05 var(--display); }
.balance > span { margin-left: auto; color: var(--muted); font-size: .73rem; text-align: right; }
#name { overflow-wrap: anywhere; }
.notice { margin: 0 0 10px; padding: 6px 9px; border: 1px solid #756342; border-left: 3px solid var(--gold); background: #25221b; color: #e1d6bf; font-size: .65rem; line-height: 1.35; }
details { min-width: 0; margin-top: 10px; border: 1px solid #5e5d59; background: #1c1c1e; }
summary { min-height: 44px; padding: 12px 10px; background: linear-gradient(#424243, #2b2b2d); color: #eee9dc; font-size: .78rem; font-weight: 700; cursor: pointer; overflow-wrap: anywhere; }
details[open] > summary { border-bottom: 1px solid #6b6860; }
details > :not(summary) { margin-inline: 10px; }
details > :last-child:not(summary) { margin-bottom: 10px; }
details p { font-size: .78rem; color: var(--muted); }
.notice summary { background: transparent; color: #f1dfb8; padding: 7px 0; }
.wallet-actions { padding-top: 2px; border-top: 1px solid var(--line); }
.payment { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.payment img, #station-qr { display: block; width: 150px; max-width: 100%; height: auto; border: 6px solid #fff; background: #fff; }
.payment img { margin: 12px 0; }
.payment textarea { font-family: monospace; font-size: 16px; }
.payment a { display: inline-block; min-height: 44px; padding-block: 10px; }
#share-match #station-qr { margin: 12px auto; }
#share-match p { text-align: center; }
pre, code { padding: 10px; border: 1px solid #56544e; background: #0f0f11; color: #e1ddd0; font-size: .75rem; white-space: pre-wrap; overflow-wrap: anywhere; }
code { display: block; margin: 12px 0; }
pre:empty { display: none; }
#match-rules, #deadline { color: var(--muted); font-size: .78rem; }
#referee-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
#error { position: sticky; top: 5px; z-index: 5; padding: 10px; border: 1px solid #f99b9b; background: #6b1420; color: #fff; font-size: .85rem; }
#status { margin: 0 0 6px; color: var(--muted); font-size: .65rem; }
footer { padding-block: 0 16px; color: var(--muted); font-size: .62rem; }

/* A spectator display is the character-select board, never the account UI. */
.overlay .notice, .overlay .menu, .overlay #wallet-view, .overlay #account,
.overlay #onboard, .overlay #recovery, .overlay #operator-login, .overlay #operator,
.overlay #participant-actions, .overlay #play-choice, .overlay #match-help,
.overlay #referee-actions, .overlay #cancel, .overlay footer, .overlay details { display: none; }
.overlay #share-match { display: block; margin-top: 12px; border: 0; background: transparent; }
.overlay #share-match > summary { display: none; }
.overlay #share-match #station-qr { width: 130px; }
.overlay #share-match p { color: #eee6d3; }
.overlay .battle-banner { font-size: clamp(1.4rem, 4.8vw, 3.4rem); }
.overlay .pool-grid strong { font-size: clamp(2rem, 6vw, 4rem); }

@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled) { filter: brightness(1.12); }
  .seat-card:hover:not(:disabled) { border-color: #fff1b2; }
  summary:hover { color: var(--gold); }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: filter 100ms ease, border-color 100ms ease; }
}
@media (min-width: 640px) {
  header, main, footer { padding-inline: 20px; }
  header { min-height: 96px; }
  .eyebrow { font-size: .7rem; }
  #page-subtitle { font-size: .75rem; }
  section { padding: 18px; }
  #selected { padding: 16px; }
  .menu button { flex: 0 1 240px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .grid form + form { border-top: 0; border-left: 1px solid var(--line); padding: 0 0 0 16px; }
  #onboard { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  .join-art { height: 100%; min-height: 280px; border-bottom: 0; border-right: 3px solid #d5c99e; }
  .join-art img { width: 48%; height: 220px; margin-inline: -8%; }
  .join-art img:nth-child(2) { height: 270px; }
  .join-copy { padding: 20px; }
  .seats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .seat-card { height: 226px; min-height: 226px; }
  .fighter-art { top: 15px; height: 175px; }
  .fighter-placeholder { top: 35px; }
  .pool-grid { font-size: .8rem; padding-block: 12px; }
  #participant-actions form { padding: 16px; }
  #roster-choice { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
  .roster-pick { min-height: 95px; }
  .roster-pick img { height: 70px; }
  .roster-pick span { font-size: .7rem; }
  #match-help, form p { font-size: .85rem; }
  .notice, #status { font-size: .72rem; }
  .overlay .seat-card { height: 290px; min-height: 290px; }
  .overlay .fighter-art { height: 230px; }
  .overlay .fighter-placeholder { font-size: 170px; }
  .overlay .fighter-name { font-size: 1.6rem; }
  .overlay .player-name { font-size: 1rem; }
  .overlay .seat-meta, .overlay .seat-backing { font-size: .78rem; }
  .overlay #matches { display: flex; align-items: center; gap: 16px; padding-block: 8px; }
  .overlay #matches .section-title { margin: 0; }
  .overlay #matches .section-title a { display: none; }
  .overlay #selected { display: grid; grid-template-columns: minmax(0, 1fr) 160px; column-gap: 12px; }
  .overlay .screen-heading, .overlay .battle-banner, .overlay .seats { grid-column: 1 / -1; }
  .overlay .pool-grid { align-self: center; }
  .overlay #share-match { grid-column: 2; grid-row: 4; margin: 0; align-self: center; }
  .overlay #share-match #station-qr { width: 112px; margin: 10px auto 4px; }
  .overlay #share-match p { margin-block: 4px; font-size: .65rem; }
}
@media (min-width: 960px) {
  header, main, footer { padding-inline: 28px; }
  main { padding-top: 14px; }
  .screen-heading .eyebrow { font-size: .68rem; }
  #match-state { font-size: .73rem; padding: 5px 9px; }
  .seat-card { height: 275px; min-height: 275px; padding: 0 10px 10px; }
  .fighter-art { height: 222px; }
  .fighter-placeholder { font-size: 150px; }
  .fighter-name { font-size: 1.7rem; }
  .player-name { font-size: .95rem; }
  .seat-meta, .seat-backing { font-size: .75rem; }
  .port-badge { font-size: 1rem; }
  .seat-card[aria-pressed="true"]::after { font-size: .64rem; padding: 5px 7px; }
  #participant-actions { max-width: 820px; margin-inline: auto; }
  #play-choice { max-width: 540px; margin-inline: auto; }
  .overlay .seat-card { height: 360px; min-height: 360px; }
  .overlay .fighter-art { top: 16px; height: 305px; }
  .overlay .fighter-name { font-size: 2rem; }
  .overlay .pool-grid { padding-block: 16px; }
}

/* Bracket: rounds read left to right; pods stack inside each round. */
.bracket-page :is(header, main, footer) { max-width: none; }
.rounds { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.round { flex: 0 0 240px; margin: 0; }
.round.final { border-top-color: var(--gold); }
.pod { margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line); background: #18181a; }
.pod h3 { margin: 0 0 6px; font-size: 1rem; color: var(--gold); }
.pod .players { margin: 0; padding-left: 0; list-style: none; }
.pod .players li { display: flex; justify-content: space-between; gap: 6px; padding: 4px 0; border-bottom: 1px solid #ffffff12; overflow-wrap: anywhere; }
.pod .players li.out { color: var(--muted); text-decoration: line-through; }
.pod .players li.first { color: var(--gold); font-weight: 800; }
.pod .players li.second { color: #e4e4e4; font-weight: 800; }
.pod .tag { flex-shrink: 0; font-size: .6rem; letter-spacing: .12em; align-self: center; }
.pod .pending { margin: 4px 0 0; color: var(--muted); font-size: .75rem; }
.pod-result label { margin: 6px 0; }
.champion { border-top-color: var(--gold); text-align: center; }
.champion h2 { margin: 6px 0 0; font-size: clamp(2rem, 8vw, 4rem); color: var(--gold); text-shadow: 3px 3px #000; }
