:root {
  --ink: #0a0a0c;
  --panel: #101014;
  --panel-2: #15151a;
  --bone: #f0eadf;
  --muted: #8e8984;
  --red: #f21b2d;
  --red-dark: #7f0914;
  --acid: #d9ff45;
  --line: rgba(240, 234, 223, 0.16);
  --shadow: 0 0 24px rgba(242, 27, 45, 0.28);
  --font-pixel: "Courier New", "Lucida Console", monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; overscroll-behavior: none; }

body {
  margin: 0;
  overflow-x: hidden;
  background: radial-gradient(circle at 72% 28%, rgba(242, 27, 45, 0.13), transparent 28rem), linear-gradient(145deg, #060608, var(--ink) 52%, #11070a);
  color: var(--bone);
  font-family: var(--font-pixel);
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 320px;
  touch-action: manipulation;
}

button { font: inherit; }
button:focus-visible { outline: 2px solid var(--bone); outline-offset: 4px; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.12;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,0.08) 3px 4px), radial-gradient(circle at 20% 30%, rgba(255,255,255,0.12) 0 1px, transparent 1px);
  background-size: 100% 4px, 7px 7px;
  mix-blend-mode: soft-light;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  border-inline: 1px solid rgba(255,255,255,0.05);
  background: rgba(8, 8, 10, 0.82);
}

.system-rail {
  height: 44px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 10px;
  color: var(--muted);
  position: relative;
  z-index: 10;
}

.signal { color: var(--bone); }
.signal i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  animation: blink 1.3s steps(2, jump-none) infinite;
}

.audio-toggles { margin-left: auto; display: flex; gap: 8px; }
.rail-button {
  border: 0;
  border-left: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 10px;
}
.rail-button:hover, .rail-button[aria-pressed="true"] { color: var(--bone); }

.screen {
  min-height: calc(100vh - 44px);
  position: relative;
  animation: screenIn 280ms steps(5, end) both;
}

.title-screen {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 35%);
  align-items: stretch;
}

.title-screen::before, .select-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 49.8%, rgba(242,27,45,0.07) 50%, transparent 50.2%), linear-gradient(0deg, transparent 49.8%, rgba(242,27,45,0.05) 50%, transparent 50.2%);
  background-size: 80px 80px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.title-grid {
  position: absolute;
  inset: auto -20% 0 30%;
  height: 44%;
  transform: perspective(360px) rotateX(64deg);
  transform-origin: center bottom;
  background-image: linear-gradient(rgba(242,27,45,0.28) 1px, transparent 1px), linear-gradient(90deg, rgba(242,27,45,0.28) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to top, black, transparent);
}

.title-copy {
  position: relative;
  z-index: 2;
  padding: clamp(54px, 9vh, 112px) 6vw 100px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow { margin: 0 0 16px; color: var(--red); font-size: clamp(9px, 1vw, 12px); letter-spacing: 0.34em; }
.temple-lockup { position: relative; width: max-content; max-width: 100%; }
.temple-lockup h1, .temple-shadow {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(68px, 11vw, 166px);
  line-height: 0.78;
  letter-spacing: -0.055em;
  transform: scaleX(0.86);
  transform-origin: left;
  white-space: nowrap;
}
.temple-lockup h1 {
  position: relative;
  color: var(--bone);
  text-shadow: 5px 5px 0 #33050a, 8px 8px 0 var(--red-dark);
  clip-path: polygon(0 0, 100% 0, 100% 39%, 93% 39%, 93% 44%, 100% 44%, 100% 100%, 0 100%, 0 68%, 7% 68%, 7% 63%, 0 63%);
}
.temple-shadow { position: absolute; inset: 7px auto auto -9px; color: var(--red); opacity: 0.9; filter: blur(0.3px); }
.system-name { margin: 24px 0 0; font-size: clamp(12px, 1.5vw, 20px); letter-spacing: 0.16em; }
.system-name span { color: var(--red); }
.title-manifesto { margin: 10px 0 34px; color: var(--muted); font-size: clamp(8px, 0.8vw, 11px); letter-spacing: 0.18em; }
.title-manifesto b { color: var(--red); }

.main-menu { width: min(480px, 100%); display: grid; gap: 8px; }
.menu-option {
  min-height: 60px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 62px 1fr auto;
  align-items: center;
  border: 1px solid var(--line);
  background: rgba(10,10,12,0.72);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: 120ms steps(2, end);
}
.menu-option i { opacity: 0; font-style: normal; }
.menu-option:hover, .menu-option.is-selected {
  color: var(--bone);
  border-color: var(--red);
  background: linear-gradient(90deg, rgba(242,27,45,0.22), transparent);
  box-shadow: inset 4px 0 0 var(--red), var(--shadow);
  transform: translateX(6px);
}
.menu-option.is-selected i { opacity: 1; color: var(--red); }
.menu-index { color: var(--red); font-size: 11px; }

.title-side {
  border-left: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, transparent 0 60%, rgba(242,27,45,0.12)), repeating-linear-gradient(90deg, transparent 0 19px, rgba(255,255,255,0.025) 19px 20px);
}
.title-side::after {
  content: "FIGHT\A OR\A FADE";
  white-space: pre;
  position: absolute;
  right: -18px;
  bottom: 12%;
  color: rgba(240,234,223,0.04);
  font: 900 96px/0.68 Impact, sans-serif;
  text-align: right;
}
.fighter-silhouette {
  position: absolute;
  width: 250px;
  height: 74%;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  background: linear-gradient(130deg, transparent 10%, #170b0e 11% 25%, #030304 26% 79%, transparent 80%);
  clip-path: polygon(41% 0, 61% 0, 69% 10%, 67% 22%, 78% 32%, 87% 54%, 72% 60%, 69% 100%, 53% 100%, 48% 65%, 43% 100%, 25% 100%, 33% 60%, 12% 54%, 27% 29%, 37% 21%, 34% 10%);
  filter: drop-shadow(0 0 28px rgba(242,27,45,0.4));
}
.fighter-silhouette::after { content: ""; position: absolute; width: 12px; height: 4px; background: var(--red); top: 12%; left: 52%; box-shadow: 0 0 14px 3px var(--red); }
.meter-label, .coordinates { position: absolute; z-index: 2; font-size: 9px; color: var(--muted); }
.meter-label { top: 7%; left: 9%; }
.meter-label span { color: var(--red); }
.coordinates { bottom: 8%; right: 8%; line-height: 1.8; text-align: right; }
.equalizer { position: absolute; top: 11%; left: 9%; display: flex; align-items: end; height: 42px; gap: 4px; }
.equalizer i { width: 5px; height: 20%; background: var(--red); animation: meter 900ms steps(4,end) infinite alternate; }
.equalizer i:nth-child(2n) { animation-delay: -420ms; height: 80%; }
.equalizer i:nth-child(3n) { animation-delay: -670ms; height: 45%; }
.equalizer i:nth-child(5n) { animation-delay: -160ms; height: 100%; }

.control-strip {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3vw, 46px);
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  background: rgba(7,7,9,0.94);
  color: var(--muted);
  font-size: 9px;
}
.control-strip b { color: var(--bone); }

.select-screen { padding: 32px clamp(20px, 5vw, 70px) 54px; }
.screen-heading {
  max-width: 1260px;
  margin: 0 auto 26px;
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}
.screen-heading h2 { margin: 0; font: 900 clamp(32px, 5vw, 64px)/0.9 Impact, sans-serif; letter-spacing: 0.015em; }
.screen-heading h2 span { color: var(--red); }
.screen-heading .eyebrow { margin-bottom: 8px; }
.back-button, .fight-back, .ghost-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; text-align: left; font-size: 10px; }
.back-button:hover, .fight-back:hover, .ghost-button:hover { color: var(--bone); }
.selection-counter { text-align: right; color: var(--muted); font-size: 12px; }
.selection-counter span { color: var(--red); font-size: 24px; }

.selection-layout { max-width: 1260px; margin: 0 auto; display: grid; grid-template-columns: minmax(500px, 1.2fr) minmax(330px, 0.8fr); gap: 24px; }
.roster-grid { display: grid; grid-template-columns: repeat(5, minmax(82px, 1fr)); gap: 10px; align-content: start; }
.roster-card {
  min-width: 0;
  aspect-ratio: 0.78;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #202026, #0d0d10 65%);
  padding: 0;
  cursor: pointer;
  color: var(--bone);
}
.roster-card::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(255,255,255,.035) 5px 6px); z-index: 1; pointer-events: none; }
.roster-card img {
  position: absolute;
  width: 100%;
  height: 88%;
  left: 0;
  bottom: 20px;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: saturate(0.45) contrast(1.18) brightness(0.68);
  transform: scale(1.08);
  transition: 120ms steps(2,end);
}
.roster-card span { position: absolute; z-index: 2; bottom: 0; left: 0; right: 0; min-height: 28px; display: grid; place-items: center; padding: 4px; background: rgba(5,5,7,.9); font-size: clamp(7px, 0.72vw, 10px); text-align: center; }
.roster-card b { position: absolute; z-index: 2; top: 6px; left: 7px; color: var(--muted); font-size: 8px; }
.roster-card:hover, .roster-card[aria-selected="true"] { border-color: var(--red); box-shadow: inset 0 0 0 2px var(--red), var(--shadow); }
.roster-card[aria-selected="true"] img { filter: saturate(1) contrast(1.08) brightness(1); transform: scale(1.15); }
.roster-card[aria-selected="true"] span { color: var(--red); }
.roster-card[aria-selected="true"]::after { content: "SELECT"; position: absolute; z-index: 3; top: 6px; right: 6px; color: var(--red); font-size: 7px; }

.fighter-profile {
  min-height: 460px;
  position: relative;
  display: grid;
  grid-template-columns: 48% 52%;
  align-items: end;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 28% 42%, rgba(242,27,45,.27), transparent 38%), linear-gradient(145deg, #17171c, #08080a);
  overflow: hidden;
}
.fighter-profile::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(242,27,45,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(242,27,45,.08) 1px, transparent 1px); background-size: 26px 26px; mask-image: linear-gradient(to bottom, black, transparent 75%); }
.profile-scan { position: absolute; inset: 0; overflow: hidden; }
.profile-scan::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--red); box-shadow: 0 0 10px var(--red); animation: scan 4s linear infinite; opacity: .45; }
.profile-number { position: absolute; top: 18px; right: 22px; color: rgba(240,234,223,.08); font: 900 82px/1 Impact, sans-serif; }
.fighter-profile > img { position: relative; z-index: 1; width: 115%; max-height: 430px; object-fit: contain; object-position: center bottom; margin-left: -8%; image-rendering: pixelated; filter: drop-shadow(12px 0 0 rgba(242,27,45,.14)); animation: fighterIdle 1.8s steps(3,end) infinite; }
.profile-copy { position: relative; z-index: 2; padding: 34px 26px 26px 4px; }
.profile-class { margin: 0 0 8px; color: var(--red); font-size: 9px; letter-spacing: .2em; }
.profile-copy h3 { margin: 0; font: 900 clamp(28px, 3.4vw, 54px)/.86 Impact, sans-serif; word-break: break-word; }
.profile-bio { min-height: 36px; color: var(--muted); font-size: 9px; line-height: 1.6; }
.profile-stats { display: grid; gap: 7px; margin: 18px 0 22px; }
.stat-row { display: grid; grid-template-columns: 34px 1fr 22px; align-items: center; gap: 8px; font-size: 8px; color: var(--muted); }
.stat-row i { height: 4px; background: #2d2d33; position: relative; }
.stat-row i::after { content: ""; position: absolute; inset: 0; width: var(--stat); background: var(--red); box-shadow: 0 0 6px rgba(242,27,45,.6); }
.stat-row b { color: var(--bone); text-align: right; }
.confirm-button { min-height: 48px; padding: 0 18px; border: 1px solid var(--red); background: var(--red); color: #fff; cursor: pointer; box-shadow: 5px 5px 0 var(--red-dark); font-size: 10px; text-align: left; }
.confirm-button span { float: right; margin-left: 26px; }
.confirm-button:hover { background: var(--bone); color: var(--ink); border-color: var(--bone); }
.profile-actions { display: grid; gap: 11px; margin-top: 18px; }
.profile-actions .confirm-button { margin-top: 0; }
.random-button { min-height: 42px; padding: 0 16px; border: 1px solid rgba(217,255,69,.72); color: var(--acid); background: rgba(14,18,10,.82); cursor: pointer; font-size: 9px; text-align: left; box-shadow: inset 3px 0 0 rgba(217,255,69,.5); }
.random-button span { float: right; font-size: 18px; line-height: .6; }
.random-button:hover { color: var(--ink); background: var(--acid); }
.select-tip { text-align: center; margin-top: 24px; color: var(--muted); font-size: 8px; }
.select-tip b { color: var(--red); }

.fight-screen { display: grid; place-items: center; padding: clamp(14px, 3vw, 42px); }
.canvas-frame { width: min(1200px, 100%); position: relative; border: 1px solid rgba(242,27,45,.6); box-shadow: 0 0 0 5px #101014, 0 0 0 6px #303038, 0 0 50px rgba(242,27,45,.25); background: #050507; }
#gameCanvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }
.loading-overlay, .pause-overlay { position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; text-align: center; background: rgba(5,5,7,.91); }
.loading-overlay span { font-size: 11px; color: var(--red); }
.loading-overlay > div { width: 260px; height: 5px; background: #2b2b31; margin-top: 14px; }
.loading-overlay i { display: block; height: 100%; width: 0%; background: var(--red); box-shadow: 0 0 12px var(--red); transition: width 150ms linear; }
.pause-overlay p { color: var(--red); font-size: 9px; letter-spacing: .22em; }
.pause-overlay h2 { margin: 2px 0 14px; font: 900 78px/.9 Impact, sans-serif; }
.pause-overlay span { color: var(--muted); font-size: 9px; }
.pause-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: min(330px, 74vw); margin: 24px auto 0; }
.pause-actions .confirm-button, .pause-actions .ghost-button { min-height: 40px; padding: 0 12px; font-size: 8px; text-align: center; }
.pause-actions .confirm-button { box-shadow: 4px 4px 0 var(--red-dark); }
.pause-actions .confirm-button b { float: right; font-size: 15px; line-height: .4; }
.pause-actions .ghost-button { border: 1px solid var(--line); color: var(--bone); background: rgba(8,8,11,.65); cursor: pointer; }
.pause-actions .ghost-button:hover { border-color: var(--bone); background: var(--bone); color: var(--ink); }
.round-announcer { position: absolute; z-index: 7; left: 50%; top: 50%; transform: translate(-50%,-50%); opacity: 0; font: 900 clamp(32px, 8vw, 100px)/.85 Impact, sans-serif; color: var(--bone); text-shadow: 6px 6px 0 var(--red), -3px -3px 0 var(--ink); pointer-events: none; text-align: center; white-space: nowrap; }
.round-announcer.is-showing { animation: announce 1s steps(6,end) both; }
.soundtrack-widget { position: absolute; left: 16px; bottom: 14px; z-index: 4; display: flex; align-items: center; gap: 7px; padding: 7px 9px; background: rgba(5,5,7,.78); border-left: 2px solid var(--red); backdrop-filter: blur(4px); }
.soundtrack-widget button { border: 0; color: var(--red); background: transparent; cursor: pointer; font-size: 11px; }
.soundtrack-widget div { display: grid; gap: 2px; margin-right: 8px; }
.soundtrack-widget span { color: var(--red); font-size: 6px; }
.soundtrack-widget strong { color: var(--bone); font-size: 7px; }
.soundtrack-widget > i { display: block; width: 2px; height: 12px; background: var(--red); animation: meter 600ms steps(3,end) infinite alternate; }
.soundtrack-widget > i:nth-last-child(2) { animation-delay: -250ms; height: 6px; }
.soundtrack-widget > i:nth-last-child(3) { animation-delay: -400ms; height: 17px; }
.fight-back { position: absolute; top: 12px; right: 14px; z-index: 5; color: rgba(240,234,223,.55); font-size: 7px; }
.mobile-pause { display: none; }

.touch-controls, .rotate-device { display: none; }

.result-modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(5,5,7,.78); backdrop-filter: blur(7px); }
.result-card { width: min(520px, 100%); padding: 42px; border: 1px solid var(--red); background: #0c0c0f; box-shadow: 9px 9px 0 var(--red-dark), 0 0 50px rgba(242,27,45,.26); }
.result-card > p:first-child { color: var(--red); font-size: 9px; }
.result-card h2 { margin: 4px 0 12px; font: 900 72px/.9 Impact, sans-serif; }
.result-card > p { color: var(--muted); font-size: 11px; line-height: 1.7; }
.result-card > div { display: flex; gap: 18px; align-items: center; margin-top: 24px; }

.exit-screen { display: grid; place-items: center; padding: 30px; }
.terminal-window { width: min(680px, 100%); border: 1px solid var(--line); padding: clamp(28px, 6vw, 72px); background: #08080a; box-shadow: 12px 12px 0 #15151a; }
.terminal-window p { color: var(--muted); font-size: 11px; line-height: 1.8; }
.terminal-window p span { color: var(--red); }
.terminal-window h2 { margin: 34px 0; font: 900 clamp(48px, 9vw, 110px)/.82 Impact, sans-serif; color: var(--red); }

.settings-screen { display: grid; place-items: center; padding: 30px; }
.settings-panel { width: min(720px, 100%); padding: clamp(28px, 5vw, 62px); border: 1px solid var(--line); background: linear-gradient(145deg, #141419, #08080a); box-shadow: 12px 12px 0 #15151a, 0 0 48px rgba(242,27,45,.13); }
.settings-panel h2 { margin: 14px 0 12px; font: 900 clamp(44px, 8vw, 86px)/.84 Impact, sans-serif; }
.settings-panel h2 span { color: var(--red); }
.settings-copy { margin: 0 0 26px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.difficulty-options { display: grid; gap: 10px; }
.difficulty-option { min-height: 72px; display: grid; grid-template-columns: 116px 1fr; gap: 14px; align-items: center; padding: 12px 16px; border: 1px solid var(--line); color: var(--muted); background: rgba(5,5,7,.6); text-align: left; cursor: pointer; }
.difficulty-option b { font: 900 28px/.9 Impact, sans-serif; color: var(--bone); }
.difficulty-option span { font-size: 8px; line-height: 1.45; }
.difficulty-option:hover, .difficulty-option.is-selected { border-color: var(--red); color: var(--bone); background: linear-gradient(90deg, rgba(242,27,45,.22), transparent); box-shadow: inset 4px 0 0 var(--red), var(--shadow); }
.difficulty-option.is-selected b { color: var(--red); }
.difficulty-readout { margin: 24px 0 0; color: var(--acid); font-size: 9px; letter-spacing: .15em; }

.online-screen { display: grid; place-items: center; padding: 30px; }
.online-panel { width: min(980px, 100%); padding: clamp(28px, 5vw, 62px); border: 1px solid var(--line); background: linear-gradient(145deg, #141419, #08080a); box-shadow: 12px 12px 0 #15151a, 0 0 54px rgba(242,27,45,.15); }
.online-panel h2 { margin: 14px 0 12px; font: 900 clamp(42px, 7.2vw, 82px)/.84 Impact, sans-serif; }
.online-panel h2 span { color: var(--red); }
.online-copy { max-width: 610px; margin: 0 0 26px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.online-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.online-option { min-height: 258px; display: flex; flex-direction: column; align-items: stretch; padding: 20px; border: 1px solid var(--line); background: rgba(5,5,7,.62); }
.online-option > span, .online-option > p { color: var(--muted); font-size: 8px; line-height: 1.6; }
.online-option h3 { margin: 10px 0 6px; font: 900 32px/.9 Impact, sans-serif; color: var(--bone); }
.online-option > p { margin: 0 0 18px; min-height: 26px; }
.online-option .confirm-button { margin-top: auto; }
.room-code-panel { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); }
.room-code-panel small { color: var(--acid); font-size: 7px; letter-spacing: .14em; }
.room-code-panel output { grid-column: 1 / -1; overflow-wrap: anywhere; color: var(--bone); font: 900 clamp(18px, 2.8vw, 30px)/1 Impact, sans-serif; letter-spacing: .08em; }
.room-code-panel .ghost-button { grid-column: 1 / -1; color: var(--acid); font-size: 8px; }
.room-input-label { margin-bottom: 7px; color: var(--muted); font-size: 7px; letter-spacing: .12em; }
.room-input { width: 100%; min-height: 44px; margin-bottom: 14px; padding: 0 11px; border: 1px solid var(--line); color: var(--bone); background: #08080a; outline: 0; font: 900 15px/1 Impact, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.room-input:focus { border-color: var(--red); box-shadow: inset 3px 0 0 var(--red); }
.online-status { min-height: 20px; margin: 24px 0 0; color: var(--acid); font-size: 9px; letter-spacing: .12em; }
.online-status.is-error { color: var(--red); }
.online-note { margin: 12px 0 0; color: var(--muted); font-size: 7px; line-height: 1.65; }
.online-selection-layout { width: min(1260px, 100%); margin: 0 auto; display: grid; grid-template-columns: minmax(500px, 1.2fr) minmax(330px, .8fr); gap: 24px; }
.online-matchup { min-height: 460px; position: relative; display: grid; grid-template-columns: 1fr 54px 1fr; grid-template-rows: 1fr auto auto; gap: 13px; align-items: end; padding: 18px; overflow: hidden; border: 1px solid var(--line); background: radial-gradient(circle at 50% 20%, rgba(242,27,45,.18), transparent 44%), #09090c; }
.online-matchup::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 6px, rgba(255,255,255,.025) 6px 7px); pointer-events: none; }
.online-fighter { position: relative; z-index: 1; display: grid; gap: 8px; align-content: end; min-width: 0; }
.online-fighter span { min-height: 22px; color: var(--acid); font-size: 7px; line-height: 1.35; letter-spacing: .1em; }
.online-fighter.remote span { color: var(--red); }
.online-fighter img { width: 100%; height: 252px; object-fit: contain; object-position: center bottom; image-rendering: pixelated; filter: drop-shadow(8px 0 0 rgba(242,27,45,.15)); }
.online-fighter strong { min-height: 35px; color: var(--bone); font: 900 clamp(20px, 2.6vw, 38px)/.88 Impact, sans-serif; overflow-wrap: anywhere; }
.versus-mark { position: relative; z-index: 1; align-self: center; color: var(--red); font: 900 30px/1 Impact, sans-serif; text-align: center; text-shadow: 3px 3px 0 #000; }
.online-matchup .confirm-button { position: relative; z-index: 2; grid-column: 1 / -1; width: 100%; }
.online-ready-status { position: relative; z-index: 2; grid-column: 1 / -1; min-height: 20px; margin: 0; color: var(--muted); font-size: 8px; text-align: center; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

@keyframes blink { 50% { opacity: .2; } }
@keyframes meter { to { height: 8%; } }
@keyframes scan { from { top: -2px; } to { top: 100%; } }
@keyframes fighterIdle { 50% { transform: translateY(-4px); } }
@keyframes screenIn { from { opacity: 0; filter: brightness(2); transform: translateX(6px); } to { opacity: 1; filter: brightness(1); transform: none; } }
@keyframes announce { 0% { opacity: 0; transform: translate(-50%,-50%) scale(1.7); } 18%,70% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(.82); } }

@media (max-width: 900px) {
  .title-screen { grid-template-columns: 1fr; }
  .title-side { position: absolute; inset: 0 0 48px 55%; border-left: 0; opacity: .5; }
  .title-copy { padding-inline: 8vw; }
  .selection-layout { grid-template-columns: 1fr; }
  .fighter-profile { min-height: 370px; }
  .fighter-profile > img { max-height: 340px; }
  .screen-heading { grid-template-columns: 90px 1fr 80px; }
}

@media (max-width: 620px) {
  .system-rail { padding: 0 12px; gap: 10px; }
  .system-rail > span:nth-child(2) { display: none; }
  .rail-button { padding-inline: 5px; font-size: 8px; }
  .title-side { display: none; }
  .title-copy { justify-content: flex-start; padding-top: 16vh; }
  .temple-lockup h1, .temple-shadow { font-size: clamp(64px, 23vw, 100px); }
  .control-strip { justify-content: flex-start; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .control-strip::-webkit-scrollbar { display: none; }
  .select-screen { padding: 22px 12px 42px; }
  .screen-heading { grid-template-columns: 56px 1fr 54px; }
  .screen-heading h2 { font-size: 33px; }
  .back-button { font-size: 0; }
  .back-button::before { content: "←"; font-size: 18px; }
  .roster-grid { grid-template-columns: repeat(5, minmax(56px, 1fr)); gap: 5px; }
  .roster-card span { font-size: 6px; min-height: 22px; }
  .roster-card b { display: none; }
  .fighter-profile { grid-template-columns: 45% 55%; min-height: 310px; }
  .fighter-profile > img { width: 125%; max-height: 286px; }
  .profile-copy { padding: 22px 14px 18px 0; }
  .profile-copy h3 { font-size: 30px; }
  .profile-bio { font-size: 7px; }
  .fight-screen { align-content: center; padding: 8px; }
  .soundtrack-widget { transform: scale(.78); transform-origin: left bottom; }
  .fight-back { display: none; }
  .result-card { padding: 28px; }
  .result-card h2 { font-size: 56px; }
  .result-card > div { align-items: stretch; flex-direction: column; }
  .difficulty-option { grid-template-columns: 84px 1fr; }
  .difficulty-option b { font-size: 23px; }
  .online-options, .online-selection-layout { grid-template-columns: 1fr; }
  .online-panel { padding: 28px 20px; }
  .online-option { min-height: 220px; }
  .online-matchup { min-height: 330px; }
  .online-fighter img { height: 165px; }
}

/* El combate móvil es una cabina apaisada: el canvas ocupa la ventana y los mandos quedan flotando. */
@media (orientation: landscape) and (max-height: 620px) {
  html, body { width: 100%; height: 100%; overflow: hidden; }
  body[data-screen="fight"] .system-rail { display: none; }
  body[data-screen="fight"] .app-shell { width: 100%; height: 100dvh; min-height: 100dvh; border: 0; }
  body[data-screen="fight"] .fight-screen {
    width: 100%; height: 100dvh; min-height: 100dvh; padding: 0;
    display: grid; place-items: center; background: #050507;
  }
  body[data-screen="fight"] .canvas-frame {
    width: min(100vw, 177.7778dvh); max-height: 100dvh; border: 0;
    box-shadow: none;
  }
  body[data-screen="fight"] #gameCanvas { width: 100%; height: auto; }
  body[data-screen="fight"] .soundtrack-widget { left: max(10px, env(safe-area-inset-left)); bottom: 7px; transform: scale(.76); transform-origin: left bottom; }
  body[data-screen="fight"] .fight-back { display: none; }
  body[data-screen="fight"] .mobile-pause {
    display: grid; place-items: center; gap: 1px; position: absolute; z-index: 12;
    top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
    width: 52px; height: 48px; padding: 0; border: 1px solid rgba(240,234,223,.5);
    color: var(--bone); background: rgba(8,8,12,.78); box-shadow: inset 0 -3px 0 rgba(0,0,0,.65), 0 3px 12px rgba(0,0,0,.42);
    border-radius: 11px; touch-action: none;
  }
  .mobile-pause span { color: var(--red); font: 900 20px/.8 Impact, sans-serif; }
  .mobile-pause small { font: 700 6px/1 var(--font-pixel); letter-spacing: .08em; }
  .mobile-pause[aria-pressed="true"] { border-color: var(--red); background: var(--red-dark); }
  .touch-controls {
    display: block; position: absolute; z-index: 10; inset: 0;
    --move-size: clamp(50px, 12vh, 64px); --attack-size: clamp(76px, 20vh, 104px);
    pointer-events: none; touch-action: none; user-select: none; -webkit-user-select: none;
  }
  .touch-group { position: absolute; display: grid; gap: 9px; pointer-events: auto; }
  .move-group {
    left: max(16px, env(safe-area-inset-left)); bottom: max(16px, env(safe-area-inset-bottom));
    grid-template: var(--move-size) var(--move-size) / var(--move-size) var(--move-size) var(--move-size);
    grid-template-areas: ". up ." "left . right";
  }
  .vector-up { grid-area: up; }
  .vector-left { grid-area: left; }
  .vector-right { grid-area: right; }
  .attack-group {
    right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom));
    grid-template: var(--attack-size) / var(--attack-size) var(--attack-size); grid-template-areas: "punch kick";
  }
  .punch-button { grid-area: punch; }
  .kick-button { grid-area: kick; }
  .touch-controls button {
    appearance: none; width: 100%; height: 100%; padding: 0; border: 1px solid rgba(240,234,223,.48);
    color: var(--bone); background: rgba(9,9,13,.74); box-shadow: inset 0 -3px 0 rgba(0,0,0,.7), 0 3px 10px rgba(0,0,0,.4);
    border-radius: 50%; display: grid; place-items: center; touch-action: none; -webkit-tap-highlight-color: transparent;
  }
  .touch-controls .vector-button { border-radius: 12px; clip-path: polygon(20% 0, 80% 0, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0 80%, 0 20%); }
  .vector-button svg { width: 29px; height: 29px; fill: currentColor; filter: drop-shadow(0 0 5px rgba(240,234,223,.65)); }
  .action-button { position: relative; font-family: Impact, sans-serif; font-size: 25px; line-height: 1; text-shadow: 0 0 8px currentColor; }
  .action-button::after { content: ""; position: absolute; width: 18px; height: 2px; margin-top: 38px; background: currentColor; opacity: .6; }
  .attack-group .punch-button { color: var(--bone); border-color: rgba(240,234,223,.64); }
  .attack-group .kick-button { color: var(--red); border-color: rgba(242,27,45,.88); background: rgba(78,5,14,.72); }
  .touch-controls button.is-pressed { color: #fff; border-color: #fff; background: var(--red); transform: translateY(2px) scale(.94); box-shadow: 0 0 18px rgba(242,27,45,.65), inset 0 -1px 0 rgba(0,0,0,.55); }
  .touch-controls button:focus-visible { outline-offset: 2px; }
  .round-announcer { font-size: clamp(28px, 10vw, 70px); }
  .loading-overlay > div { width: min(230px, 68vw); }
}

@media (orientation: portrait) and (max-width: 700px) {
  body[data-screen="fight"] { overflow: hidden; }
  body[data-screen="fight"] .fight-screen { min-height: calc(100dvh - 44px); }
  body[data-screen="fight"] .canvas-frame { filter: brightness(.24) saturate(.5); pointer-events: none; }
  body[data-screen="fight"] .rotate-device {
    display: grid; place-content: center; gap: 12px; position: fixed; inset: 0; z-index: 30;
    color: var(--bone); background: rgba(5,5,7,.76); text-align: center; font-size: 11px; letter-spacing: .18em;
  }
  .rotate-device span { color: var(--red); font: 900 64px/.8 Impact, sans-serif; animation: rotateHint 1.4s steps(5, end) infinite; }
  .rotate-device strong { font-size: 12px; }
  .rotate-device small { color: var(--muted); font-size: 7px; letter-spacing: .12em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

@keyframes rotateHint { 50% { transform: rotate(-90deg); } }
