*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --night: #0f1e4d;
  --blue: #2a4faa;
  --sun: #f2c14e;
  --orange: #e8622c;
  --teal: #1f6f6b;
  --crimson: #a8232f;
  --cream: #f4ead7;
  --umber: #3a2a1e;
  --gold-deep: #6d4712;
  --gold: #d8a84a;
  --gold-light: #f7e2a6;
  --frame-w: clamp(9px, 1.8vmin, 26px);
  --hud-h: clamp(76px, 13.5vh, 132px);
  --deck-h: clamp(98px, 15.5vh, 152px);
  --font-display: "Sedgwick Ave", "Permanent Marker", "Comic Sans MS", cursive;
  --font-body: "Caveat", "Segoe Script", cursive;
  --font-num: "Permanent Marker", "Sedgwick Ave", cursive;
  --font-title: "Bungee", "Sedgwick Ave", Impact, sans-serif;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(ellipse at 50% 5%, #4a351d 0%, #201509 45%, #0c0805 100%);
  color: var(--cream);
  font-family: var(--font-body);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  opacity: 0.055;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.9) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.7) 0 1px, transparent 1px 4px);
  mix-blend-mode: overlay;
}

button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}
button:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
}

.cabinet {
  position: fixed;
  inset: 0;
  padding: var(--frame-w);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.12) 0 2px, transparent 2px 7px),
    linear-gradient(135deg, #5b3a0f 0%, #e9bf63 10%, #a97725 24%, #f7de9b 40%, #8a5a18 56%, #e7b958 72%, #c08f33 84%, #4e300c 100%);
  box-shadow: inset 0 0 0 2px #2a1a08, inset 0 0 0 5px rgba(247,226,166,0.45);
}
.cabinet::after {
  content: "";
  position: absolute;
  inset: var(--frame-w);
  pointer-events: none;
  box-shadow:
    inset 0 0 0 2px #2a1a08,
    inset 0 0 0 5px rgba(244,234,215,0.35),
    inset 0 0 22px rgba(0,0,0,0.7);
}

.mat {
  position: relative;
  width: 100%;
  height: 100%;
  padding: clamp(4px, 0.8vmin, 12px);
  background:
    radial-gradient(ellipse at 50% 40%, #fbf3e2 0%, #f4ead7 48%, #e2cba6 100%);
  box-shadow: inset 0 0 0 1px #b99550, inset 0 0 30px rgba(58,42,30,0.28);
}

#screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  box-shadow:
    inset 0 0 0 2px #2a1a08,
    inset 0 0 0 4px rgba(216,168,74,0.5),
    inset 0 0 90px rgba(0,0,0,0.6);
}

#game {
  position: absolute;
  inset: 0;
  z-index: 1;
}
#game canvas { display: block; }
#game::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 48%, transparent 42%, rgba(10,6,3,0.35) 100%),
    linear-gradient(180deg, rgba(8,4,2,0.18), transparent 20%, transparent 76%, rgba(8,4,2,0.28));
}

.hidden { display: none !important; }

/* ---------------- HUD ---------------- */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hud-h);
  z-index: 6;
  display: flex;
  align-items: flex-start;
  gap: clamp(4px, 1vw, 18px);
  padding: clamp(4px, 0.9vmin, 12px) clamp(6px, 1.4vmin, 20px) 0;
  pointer-events: none;
}

.hud-side {
  flex: 1 1 0;
  display: flex;
  align-items: flex-start;
  gap: clamp(4px, 0.7vw, 12px);
  min-width: 0;
}
.hud-side.p2 { flex-direction: row-reverse; }

.hud-portrait {
  flex: 0 0 auto;
  width: clamp(38px, 8vh, 86px);
  aspect-ratio: 366 / 405;
  overflow: hidden;
  border: 2px solid #3a2a1e;
  box-shadow: 0 0 0 2px #c99a44, 0 3px 10px rgba(0,0,0,0.55);
  background: var(--umber);
}
.hud-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hud-bar-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 0.5vh, 6px);
}

.bar-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 514 / 153;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.55));
}
.bar-frame-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.bar-clip {
  position: absolute;
  inset: 15% 6.4% 15% 6.4%;
  overflow: hidden;
}
.bar-fill {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  filter: saturate(1.08) brightness(1.02);
  transition: clip-path 0.22s ease-out;
}
.hud-side.p2 .bar-fill { transform: scaleX(-1); }
.bar-glint {
  position: absolute;
  inset: 15% 6.4% 15% 6.4%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.35), transparent 38%, rgba(0,0,0,0.18));
  mix-blend-mode: overlay;
}

.hud-name-plate {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  padding: 0.1em 0.7em 0.14em;
  background:
    linear-gradient(180deg, #f0cf7b 0%, #c8953d 38%, #8b5c18 70%, #d9ae58 100%);
  border: 1px solid #3a2a1e;
  box-shadow: inset 0 1px 0 rgba(255,244,205,0.7), inset 0 -2px 4px rgba(58,42,30,0.4);
  color: #2b1a0a;
  overflow: hidden;
  white-space: nowrap;
}
.hud-side.p2 .hud-name-plate { flex-direction: row-reverse; }
.hud-name-plate b {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(10px, 1.55vh, 17px);
  letter-spacing: 0.09em;
}
.hud-name-plate span {
  font-size: clamp(8px, 1.15vh, 12px);
  font-style: italic;
  opacity: 0.82;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-tag {
  align-self: flex-start;
  display: none;
  align-items: baseline;
  gap: 0.35em;
  margin-top: 0.1em;
  padding: 0.08em 0.7em 0.1em;
  color: var(--cream);
  background:
    linear-gradient(100deg, transparent 0%, #a8232f 12%, #7e1420 62%, transparent 100%);
  clip-path: polygon(0 18%, 96% 0, 100% 78%, 5% 100%);
  text-shadow: 0 1px 0 #3a2a1e;
  transform: rotate(-1.5deg);
}
.hud-side.p2 .combo-tag { align-self: flex-end; transform: rotate(1.5deg); }
.combo-tag b {
  font-family: var(--font-display);
  font-size: clamp(20px, 3.6vh, 40px);
  line-height: 0.9;
  color: var(--cream);
}
.combo-tag span {
  font-family: var(--font-display);
  font-size: clamp(8px, 1.2vh, 13px);
  letter-spacing: 0.12em;
}
.combo-tag.show { display: inline-flex; animation: combo-pop 0.18s ease-out; }

.hud-timer {
  flex: 0 0 auto;
  width: clamp(66px, 12vh, 116px);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -0.4vmin;
}
.timer-plaque {
  position: relative;
  width: 100%;
  aspect-ratio: 325 / 323;
  filter: drop-shadow(0 4px 9px rgba(0,0,0,0.6));
}
.timer-plaque img { position: absolute; inset: 0; width: 100%; height: 100%; }
.timer-plaque::after {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(12,20,45,0.94) 0%, rgba(12,20,45,0.82) 58%, rgba(12,20,45,0) 74%);
}
.timer-plaque span {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2%;
  font-family: var(--font-display);
  font-size: clamp(26px, 6vh, 64px);
  line-height: 1;
  color: var(--cream);
  text-shadow: 0 0 12px rgba(242,193,78,0.55), 0 2px 0 #3a2a1e;
}
.round-label {
  position: relative;
  z-index: 3;
  margin-top: -0.2em;
  padding: 0.05em 0.6em;
  font-family: var(--font-display);
  font-size: clamp(9px, 1.4vh, 15px);
  letter-spacing: 0.18em;
  color: var(--gold-light);
  text-shadow: 0 1px 2px #000;
  background: rgba(15,30,77,0.55);
  border: 1px solid rgba(216,168,74,0.45);
  white-space: nowrap;
}

/* ---------------- DECK ---------------- */

#deck {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--deck-h);
  z-index: 6;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  padding: 0 clamp(5px, 1.2vmin, 18px) clamp(4px, 0.9vmin, 12px);
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(8,6,10,0.12) 45%, rgba(8,6,10,0.44) 100%);
}
.deck-side {
  display: flex;
  align-items: flex-end;
  gap: clamp(4px, 0.9vw, 14px);
  flex: 0 0 auto;
}
.deck-left { flex: 0 1 auto; }
.deck-right { flex: 0 1 auto; justify-content: flex-end; }
.deck-center {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  align-self: center;
  min-width: 0;
  pointer-events: none;
}
.deck-hint {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(9px, 1.15vw, 14px);
  letter-spacing: 0.08em;
  color: rgba(244,234,215,0.82);
  text-shadow: 0 1px 2px #000;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.deck-help {
  pointer-events: auto;
  width: clamp(20px, 2.8vh, 30px);
  height: clamp(20px, 2.8vh, 30px);
  border-radius: 50%;
  background: linear-gradient(180deg, #f0cf7b, #8b5c18);
  border: 1px solid #3a2a1e;
  color: #2b1a0a;
  font-family: var(--font-display);
  font-size: clamp(11px, 1.7vh, 17px);
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.super-meter {
  position: relative;
  width: clamp(82px, 14.5vh, 168px);
  aspect-ratio: 383 / 230;
  flex: 0 0 auto;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.55));
}
.super-meter .palette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: filter 0.25s, opacity 0.25s;
  filter: saturate(0.35) brightness(0.78);
  opacity: 0.9;
}
.super-fill {
  position: absolute;
  inset: 14% 10% 18% 12%;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.3s ease-out;
  background:
    linear-gradient(180deg, rgba(255,236,170,0.95), rgba(242,193,78,0.9) 35%, rgba(232,98,44,0.9) 75%, rgba(168,35,47,0.9) 100%);
  border-radius: 40% 45% 38% 50%;
}
.super-txt {
  position: absolute;
  left: 9%;
  bottom: 9%;
  font-family: var(--font-display);
  font-size: clamp(8px, 1.2vh, 13px);
  letter-spacing: 0.14em;
  color: #2b1a0a;
  text-shadow: 0 1px 0 rgba(244,234,215,0.5);
}
.super-pct {
  position: absolute;
  right: 9%;
  bottom: 9%;
  font-family: var(--font-display);
  font-size: clamp(9px, 1.4vh, 15px);
  letter-spacing: 0.04em;
  color: #2b1a0a;
}
.super-meter.ready .palette {
  filter: saturate(1.35) brightness(1.1) drop-shadow(0 0 10px rgba(242,193,78,0.7));
  opacity: 1;
}
.super-meter.ready { animation: meter-ready 1.1s ease-in-out infinite; }
.super-meter.p2 { transform: scaleX(-1); }
.super-meter.p2 .super-txt,
.super-meter.p2 .super-pct { transform: scaleX(-1); }

.move-pad {
  display: grid;
  grid-template-columns: repeat(3, clamp(34px, 6.2vh, 62px));
  grid-template-rows: repeat(2, clamp(34px, 6.2vh, 62px));
  gap: clamp(2px, 0.5vh, 7px);
  pointer-events: none;
}
.pad-btn {
  pointer-events: auto;
  border-radius: 50%;
  border: 2px solid #3a2a1e;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,244,205,0.5), transparent 42%),
    linear-gradient(160deg, #d8a84a, #7c5216 62%, #c69440);
  color: #2b1a0a;
  font-size: clamp(13px, 2.4vh, 24px);
  line-height: 1;
  box-shadow: inset 0 2px 3px rgba(255,255,255,0.3), 0 3px 6px rgba(0,0,0,0.55);
  touch-action: none;
  transition: transform 0.08s, filter 0.08s;
}
.pad-btn:active, .pad-btn.on { transform: translateY(2px) scale(0.96); filter: brightness(1.2); }
.pad-left { grid-column: 1; grid-row: 2; }
.pad-jump { grid-column: 2; grid-row: 1; }
.pad-right { grid-column: 3; grid-row: 2; }

.actions {
  display: flex;
  align-items: flex-end;
  gap: clamp(3px, 0.45vw, 8px);
  pointer-events: none;
}
.action-btn {
  pointer-events: auto;
  position: relative;
  width: clamp(42px, 8.4vh, 84px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  padding: 0;
  transform: translateY(var(--lift, 0px));
  transition: transform 0.1s, filter 0.15s;
  touch-action: none;
}
.action-btn img {
  width: 100%;
  display: block;
  border-radius: 50%;
  filter: drop-shadow(0 3px 7px rgba(0,0,0,0.55));
}
.action-btn span {
  font-family: var(--font-display);
  font-size: clamp(7px, 1.05vh, 11px);
  letter-spacing: 0.09em;
  color: var(--cream);
  text-shadow: 0 1px 3px #000, 0 0 6px #000;
  white-space: nowrap;
}
.action-btn:active { transform: translateY(calc(var(--lift, 0px) + 3px)) scale(0.95); }
.action-btn:hover img { filter: drop-shadow(0 0 10px rgba(242,193,78,0.6)); }
.action-btn.locked img { filter: grayscale(0.65) brightness(0.72); }
.action-btn.locked span { opacity: 0.5; }
.action-btn.ready img { filter: drop-shadow(0 0 12px rgba(242,193,78,0.85)) saturate(1.2); }
.action-btn.ready { animation: meter-ready 1.1s ease-in-out infinite; }
.actions .action-btn:nth-child(1) { --lift: 0px; }
.actions .action-btn:nth-child(2) { --lift: -7px; }
.actions .action-btn:nth-child(3) { --lift: -12px; }
.actions .action-btn:nth-child(4) { --lift: -7px; }
.actions .action-btn:nth-child(5) { --lift: 0px; }
.actions .action-btn:nth-child(6) { --lift: -5px; }

/* ---------------- SCREENS ---------------- */

#screens { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}
.screen.active { display: block; pointer-events: auto; animation: screen-in 0.32s ease-out; }

.eyebrow {
  margin: 0 0 0.35em;
  font-family: var(--font-num);
  font-size: clamp(10px, 1.5vh, 15px);
  letter-spacing: 0.24em;
  color: var(--gold-light);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}
h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(24px, 4.6vh, 50px);
  line-height: 1.02;
  color: var(--cream);
  text-shadow: 0 2px 0 #3a2a1e, 0 0 22px rgba(242,193,78,0.25);
}

.brass-btn {
  position: relative;
  padding: 0.5em 1.25em 0.55em;
  background:
    linear-gradient(180deg, #f3d68b 0%, #cf9f45 34%, #96651e 68%, #e4bb64 100%);
  border: 1px solid #3a2a1e;
  box-shadow: inset 0 1px 0 rgba(255,247,214,0.8), inset 0 -3px 6px rgba(58,42,30,0.45), 0 3px 7px rgba(0,0,0,0.5);
  color: #2b1a0a;
  font-family: var(--font-num);
  font-size: clamp(12px, 1.7vh, 17px);
  letter-spacing: 0.14em;
  text-shadow: 0 1px 0 rgba(255,247,214,0.4);
  transition: transform 0.09s, filter 0.09s;
}
.brass-btn:hover { filter: brightness(1.1); }
.brass-btn:active { transform: translateY(2px); }
.brass-btn.gold {
  background: linear-gradient(180deg, #fff0bc 0%, #f2c14e 32%, #b9801f 70%, #f6dd93 100%);
  box-shadow: 0 0 18px rgba(242,193,78,0.4), inset 0 1px 0 #fff;
}
.brass-btn.small { padding: 0.4em 0.85em 0.45em; font-size: clamp(10px, 1.3vh, 13px); }

/* Title */

#scr-title { background: #0a0710; }
.title-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
  filter: saturate(1.05) contrast(1.02);
}
.title-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 44%, rgba(8,5,10,0.1) 0%, rgba(8,5,10,0.55) 62%, rgba(5,3,7,0.92) 100%),
    linear-gradient(180deg, rgba(5,3,7,0.55), transparent 28%, transparent 62%, rgba(5,3,7,0.85));
}
.title-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 3vh, 40px);
  text-align: center;
}
.title-inner .eyebrow { font-size: clamp(9px, 1.6vh, 15px); color: #f2dfae; }
.game-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.02;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.02em;
  transform: rotate(-1.2deg);
}
.game-title span {
  display: block;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #2a1608) drop-shadow(0 0 26px rgba(242,193,78,0.25));
}
.game-title .t1 {
  font-size: clamp(34px, 8.4vh, 92px);
  background-image: linear-gradient(180deg, #fff6d2 0%, #f2c14e 36%, #a97a24 62%, #f8e6ae 82%, #7c5013 100%);
  -webkit-text-stroke: 1.5px #3a2a1e;
}
.game-title .t2 {
  font-size: clamp(44px, 10.8vh, 120px);
  background-image: linear-gradient(180deg, #ff9a68 0%, #c22c33 38%, #7f111d 70%, #e8622c 100%);
  -webkit-text-stroke: 1.5px #f2c14e;
  filter: drop-shadow(0 3px 0 #2a1608) drop-shadow(0 0 24px rgba(168,35,47,0.35));
}
.game-title .t3 {
  font-size: clamp(50px, 12.6vh, 140px);
  background-image: linear-gradient(180deg, #fff8da 0%, #f2c14e 30%, #b07d24 58%, #fff0b4 78%, #8a5a18 100%);
  -webkit-text-stroke: 2px #3a2a1e;
}
.tagline {
  margin: clamp(8px, 2vh, 22px) 0 0;
  max-width: 46ch;
  font-size: clamp(12px, 2.1vh, 20px);
  font-style: italic;
  color: #f4ead7;
  text-shadow: 0 2px 8px #000;
}
.press-start {
  margin-top: clamp(12px, 3vh, 34px);
  padding: 0.55em 1.9em 0.62em;
  font-family: var(--font-display);
  font-size: clamp(17px, 3.2vh, 34px);
  letter-spacing: 0.08em;
  color: #2b1a0a;
  background: linear-gradient(180deg, #fff4c9, #f2c14e 40%, #b47c1f 76%, #ffe9a8);
  border: 2px solid #3a2a1e;
  box-shadow: 0 0 0 3px #c99a44, 0 0 36px rgba(242,193,78,0.45), inset 0 2px 0 #fff8dc;
  animation: start-pulse 2.2s ease-in-out infinite;
}
.press-start:active { transform: translateY(2px) scale(0.99); }
.start-hint {
  margin: 0.55em 0 0;
  font-family: var(--font-num);
  font-size: clamp(9px, 1.3vh, 13px);
  letter-spacing: 0.3em;
  color: rgba(244,234,215,0.72);
}
.title-modes {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.7vw, 22px);
  margin-top: clamp(10px, 2.6vh, 28px);
  font-family: var(--font-num);
  font-size: clamp(10px, 1.5vh, 15px);
  letter-spacing: 0.18em;
  color: #f2dfae;
}
.title-modes i { width: 4px; height: 4px; border-radius: 50%; background: var(--crimson); box-shadow: 0 0 6px var(--crimson); }
.title-corner { position: absolute; right: clamp(8px, 2vw, 24px); top: clamp(8px, 2vw, 24px); z-index: 3; }
.sound-toggle {
  font-family: var(--font-num);
  font-size: clamp(9px, 1.3vh, 12px);
  letter-spacing: 0.14em;
  color: #f4ead7;
  padding: 0.45em 0.8em;
  border: 1px solid rgba(216,168,74,0.55);
  background: rgba(10,7,12,0.55);
  backdrop-filter: blur(3px);
}
.title-credit {
  position: absolute;
  bottom: clamp(6px, 1.2vh, 14px);
  left: 0;
  right: 0;
  z-index: 3;
  text-align: center;
  font-family: var(--font-num);
  font-size: clamp(8px, 1.1vh, 11px);
  letter-spacing: 0.3em;
  color: rgba(244,234,215,0.5);
}

/* Gallery backgrounds */

.gallery-wall {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 12%, rgba(242,193,78,0.2) 0%, transparent 46%),
    radial-gradient(ellipse at 20% 20%, rgba(242,193,78,0.12) 0%, transparent 34%),
    linear-gradient(180deg, #241a16 0%, #171112 52%, #0d0a0b 100%);
}
.gallery-wall::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    radial-gradient(circle at 12% 16%, rgba(244,234,215,0.5) 0 1px, transparent 1px),
    radial-gradient(circle at 74% 28%, rgba(244,234,215,0.35) 0 1px, transparent 1px);
  background-size: 120px 120px, 170px 170px;
  mix-blend-mode: screen;
}
.gallery-wall::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.4) 0 2px, rgba(88,56,24,0.5) 2px 9px, rgba(120,80,38,0.45) 9px 11px, rgba(0,0,0,0.2) 11px 18px),
    linear-gradient(180deg, #2a1a10 0%, #3a2614 30%, #1a100a 100%);
  box-shadow: inset 0 20px 40px rgba(0,0,0,0.7);
  opacity: 0.85;
}

/* Menu */

#scr-menu { background: #120d0a; }
.menu-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(242,193,78,0.17) 0%, transparent 45%),
    radial-gradient(ellipse at 75% 80%, rgba(31,111,107,0.18) 0%, transparent 50%),
    linear-gradient(150deg, #1d1612 0%, #0e0b0c 60%, #16100c 100%);
}
.menu-bg::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 26%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.5) 0 2px, rgba(92,60,28,0.45) 2px 12px, rgba(58,36,18,0.4) 12px 14px);
  transform: perspective(600px) rotateX(28deg);
  transform-origin: bottom;
  opacity: 0.6;
}
.menu-wrap {
  position: relative;
  z-index: 2;
  height: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(12px, 2.6vh, 34px) clamp(14px, 3vw, 42px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 20px);
  overflow-y: auto;
}
.menu-head h2 { font-size: clamp(26px, 5.2vh, 58px); }
.menu-lede {
  margin: 0.4em 0 0;
  max-width: 60ch;
  font-size: clamp(12px, 1.8vh, 18px);
  font-style: italic;
  color: rgba(244,234,215,0.8);
}
.menu-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(12px, 2.4vw, 34px);
  min-height: 0;
}
.mode-list { display: flex; flex-direction: column; gap: clamp(6px, 1.2vh, 14px); justify-content: center; }
.mode-item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(8px, 1.2vw, 18px);
  align-items: center;
  text-align: left;
  padding: clamp(7px, 1.4vh, 15px) clamp(10px, 1.6vw, 22px);
  background:
    linear-gradient(100deg, rgba(244,234,215,0.09) 0%, rgba(244,234,215,0.02) 60%, transparent 100%);
  border: 1px solid rgba(216,168,74,0.28);
  border-left: 4px solid rgba(216,168,74,0.55);
  transition: transform 0.14s, background 0.14s, border-color 0.14s;
}
.mode-item:hover, .mode-item.active {
  transform: translateX(6px);
  background:
    linear-gradient(100deg, rgba(242,193,78,0.18) 0%, rgba(168,35,47,0.12) 50%, transparent 100%);
  border-color: rgba(242,193,78,0.75);
  border-left-color: var(--crimson);
}
.mode-item .mode-key {
  font-family: var(--font-num);
  font-size: clamp(18px, 3.2vh, 36px);
  color: rgba(242,193,78,0.55);
  min-width: 1.4em;
  text-align: center;
}
.mode-item .mode-name {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(16px, 2.8vh, 30px);
  letter-spacing: 0.03em;
  color: var(--cream);
  text-shadow: 0 2px 0 rgba(0,0,0,0.5);
}
.mode-item .mode-desc {
  display: block;
  margin-top: 0.15em;
  font-size: clamp(11px, 1.5vh, 15px);
  font-style: italic;
  color: rgba(244,234,215,0.65);
}
.menu-feature {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vh, 12px);
  justify-content: center;
  min-height: 0;
}
.feature-frame {
  position: relative;
  padding: clamp(5px, 0.8vmin, 10px);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.14) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, #7a5015, #f2d48a 22%, #a97725 48%, #f7e2a6 70%, #6d4712 100%);
  box-shadow: 0 10px 26px rgba(0,0,0,0.6), inset 0 0 0 1px #3a2a1e;
}
.feature-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
  filter: saturate(1.08) contrast(1.02);
}
.feature-copy h3 {
  margin: 0.1em 0 0.2em;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(15px, 2.3vh, 24px);
  color: var(--gold-light);
}
.feature-copy p {
  margin: 0;
  font-size: clamp(11px, 1.6vh, 16px);
  line-height: 1.4;
  color: rgba(244,234,215,0.78);
}
.menu-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.viewer-line { margin: 0; font-size: clamp(10px, 1.4vh, 14px); font-style: italic; color: rgba(244,234,215,0.5); min-height: 1.2em; }
.menu-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: clamp(4px, 1vh, 10px);
  border-top: 1px solid rgba(216,168,74,0.25);
}
.foot-hint { margin: 0; font-size: clamp(10px, 1.4vh, 14px); font-style: italic; color: rgba(244,234,215,0.55); text-align: right; }

/* Select */

#scr-select, #scr-stage, #scr-quest { background: #0d0a0b; }
.select-wrap, .stage-wrap, .quest-wrap {
  position: relative;
  z-index: 2;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(10px, 2.2vh, 28px) clamp(12px, 2.6vw, 38px);
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.2vh, 14px);
  overflow-y: auto;
}
.select-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}
.select-head h2 { font-size: clamp(22px, 4.4vh, 48px); }
.select-step {
  margin: 0;
  font-family: var(--font-num);
  font-size: clamp(10px, 1.6vh, 15px);
  letter-spacing: 0.16em;
  color: var(--gold-light);
  text-align: right;
  text-shadow: 0 1px 4px #000;
}
.select-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: clamp(3px, 0.8vh, 8px);
  flex: 0 0 auto;
}
.control-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-num);
  font-size: clamp(9px, 1.3vh, 12px);
  letter-spacing: 0.12em;
  color: var(--gold-light);
  text-shadow: 0 1px 3px #000;
}
.control-pick select {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(11px, 1.4vh, 14px);
  letter-spacing: 0.02em;
  color: #2b1a0a;
  background: linear-gradient(180deg, #f3d68b 0%, #cf9f45 34%, #96651e 68%, #e4bb64 100%);
  border: 1px solid #3a2a1e;
  border-radius: 2px;
  padding: 0.35em 1.5em 0.35em 0.5em;
  width: 195px;
  min-width: 195px;
  max-width: 100%;
  box-shadow: 3px 3px 0 var(--umber), inset 0 1px 0 #fff7d6;
}
.control-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 2px solid var(--umber);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 3px 3px 0 var(--umber);
  background: #f6ecd6;
}
.control-opt {
  font-family: var(--font-display);
  font-size: clamp(10px, 1.35vh, 13px);
  letter-spacing: 0.06em;
  line-height: 1.1;
  padding: 0.4em 0.7em 0.44em;
  color: #2b1a0a;
  background: linear-gradient(180deg, #f3d68b 0%, #cf9f45 55%, #96651e 100%);
  border: 0;
  border-right: 1px solid var(--umber);
  border-radius: 0;
  text-shadow: none;
  cursor: pointer;
}
.control-opt:last-child { border-right: 0; }
.control-opt.on {
  background: linear-gradient(180deg, #c83545 0%, #8e1826 60%, #b22330 100%);
  color: #fff4d4;
  text-shadow: 1px 1px 0 #3a2a1e;
}
.control-opt:active { transform: translateY(1px); }
body.controls-keys .joystick { opacity: 0.82; }
.key-hint {
  display: none;
  position: absolute;
  top: -4px;
  right: -2px;
  z-index: 2;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--umber);
  background: linear-gradient(180deg, #fff3c8, #d8a84a);
  color: var(--umber);
  font-family: var(--font-num);
  font-style: normal;
  font-size: 9px;
  line-height: 1;
  box-shadow: 1px 1px 0 var(--umber);
}
body.controls-keys .key-hint { display: flex; }
.select-main {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 0.7fr);
  gap: clamp(10px, 2vw, 28px);
  min-height: 0;
}
.wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(6px, 1.3vh, 16px) clamp(6px, 1vw, 16px);
  min-height: 0;
  align-content: center;
}
.portrait-card {
  position: relative;
  padding: 4px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.14) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, #7a5015, #f2d48a 22%, #a97725 48%, #f7e2a6 70%, #6d4712 100%);
  border: 2px solid #3a2a1e;
  border-radius: 3px;
  align-self: center;
  transition: transform 0.18s ease-out, filter 0.18s;
  filter: drop-shadow(0 7px 14px rgba(0,0,0,0.65));
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 0 0 3px #cf9f45, 0 0 0 5px #3a2a1e, 8px 9px 0 rgba(0,0,0,0.55);
}
.portrait-card:nth-child(1) { --tilt: -1.8deg; }
.portrait-card:nth-child(2) { --tilt: 0.9deg; }
.portrait-card:nth-child(3) { --tilt: -0.6deg; }
.portrait-card:nth-child(4) { --tilt: 1.2deg; }
.portrait-card:nth-child(5) { --tilt: -1.1deg; }
.portrait-card:nth-child(6) { --tilt: 1.6deg; }
.portrait-art {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 2px solid #3a2a1e;
  border-radius: 1px;
  box-shadow: inset 0 0 26px rgba(0,0,0,0.38);
}
.portrait-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 28%, rgba(255,247,214,0.3), transparent 62%);
  pointer-events: none;
}
.portrait-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  border-radius: 1px;
  z-index: 1;
}
.portrait-card .plate {
  position: static;
  display: block;
  width: 76%;
  margin: 3px auto 0;
  padding: 0.12em 0.25em 0.16em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(7px, 1.35vh, 13px);
  letter-spacing: 0.07em;
  text-align: center;
  color: #2b1a0a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(255,247,214,0.55);
  background: linear-gradient(180deg, #f3d68b 0%, #cf9f45 55%, #96651e 100%);
  border: 1px solid #3a2a1e;
  border-radius: 1px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.45);
}
.portrait-card:hover, .portrait-card.sel {
  transform: translateY(-7px) rotate(0deg) scale(1.035);
  filter: drop-shadow(0 15px 22px rgba(0,0,0,0.75)) drop-shadow(0 0 16px rgba(242,193,78,0.35));
  z-index: 3;
}
.portrait-card.sel::after {
  content: "SELECTED";
  position: absolute;
  top: 3%;
  right: 4%;
  padding: 0.2em 0.5em;
  font-family: var(--font-num);
  font-size: clamp(7px, 1.1vh, 11px);
  letter-spacing: 0.13em;
  color: var(--cream);
  background: rgba(168,35,47,0.92);
  border: 1px solid rgba(242,193,78,0.6);
  transform: rotate(4deg);
}
.portrait-card.cpu-pick::after {
  content: "OPPONENT";
  background: rgba(42,79,170,0.95);
}

.select-detail {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.8vh, 10px);
  padding: clamp(8px, 1.3vh, 16px) clamp(9px, 1.1vw, 18px);
  background: linear-gradient(180deg, rgba(244,234,215,0.07), rgba(244,234,215,0.02));
  border: 1px solid rgba(216,168,74,0.3);
  box-shadow: inset 0 0 30px rgba(0,0,0,0.35);
  overflow-y: auto;
  min-height: 0;
}
.detail-portrait { display: none; }
.detail-epithet {
  margin: 0;
  font-family: var(--font-num);
  font-size: clamp(10px, 1.5vh, 14px);
  letter-spacing: 0.16em;
  color: var(--gold-light);
}
.select-detail h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(18px, 3vh, 32px);
  line-height: 1;
  color: var(--cream);
}
.detail-quote { margin: 0.15em 0 0; font-size: clamp(11px, 1.55vh, 16px); font-style: italic; color: rgba(244,234,215,0.75); }
.detail-super {
  padding: 0.45em 0.6em;
  border-left: 3px solid var(--crimson);
  background: rgba(168,35,47,0.16);
}
.detail-super span {
  display: block;
  font-family: var(--font-num);
  font-size: clamp(8px, 1.2vh, 11px);
  letter-spacing: 0.16em;
  color: var(--gold-light);
}
.detail-super b {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(12px, 1.9vh, 19px);
  line-height: 1.05;
  color: var(--cream);
}
.stat-rows { display: flex; flex-direction: column; gap: 4px; margin-top: 0.2em; }
.stat-row { display: grid; grid-template-columns: 4.2em 1fr; gap: 8px; align-items: center; }
.stat-row span {
  font-family: var(--font-num);
  font-size: clamp(8px, 1.2vh, 12px);
  letter-spacing: 0.12em;
  color: rgba(244,234,215,0.7);
}
.stat-track {
  height: clamp(6px, 0.9vh, 10px);
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(216,168,74,0.25);
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  background: linear-gradient(90deg, #a8232f, #e8622c 55%, #f2c14e);
  box-shadow: 0 0 8px rgba(242,193,78,0.35);
}
.detail-arena {
  margin-top: auto;
  padding-top: 0.3em;
  font-family: var(--font-num);
  font-size: clamp(9px, 1.3vh, 13px);
  letter-spacing: 0.12em;
  color: rgba(242,193,78,0.8);
}
.select-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: clamp(4px, 1vh, 10px);
  border-top: 1px solid rgba(216,168,74,0.25);
}
.select-hint {
  flex: 1 1 auto;
  margin: 0;
  text-align: center;
  font-family: var(--font-num);
  font-size: clamp(9px, 1.3vh, 13px);
  letter-spacing: 0.15em;
  color: rgba(244,234,215,0.6);
}

/* Stage select */

.stage-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.6vh, 20px) clamp(8px, 1.4vw, 22px);
  min-height: 0;
  align-content: center;
}
.stage-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(4px, 0.7vmin, 9px);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.12) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, #7a5015, #f2d48a 22%, #a97725 48%, #f7e2a6 70%, #6d4712 100%);
  box-shadow: 0 8px 20px rgba(0,0,0,0.55), inset 0 0 0 1px #3a2a1e;
  transition: transform 0.15s, filter 0.15s;
  min-height: 0;
  text-align: left;
}
.stage-card:hover { transform: translateY(-5px) scale(1.01); filter: drop-shadow(0 0 16px rgba(242,193,78,0.35)); }
.stage-card img { width: 100%; height: 100%; min-height: 0; object-fit: cover; display: block; }
.stage-card .stage-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0.35em 0.3em 0.1em;
  color: #2b1a0a;
}
.stage-label b { font-family: var(--font-display); font-weight: 400; font-size: clamp(12px, 1.9vh, 20px); }
.stage-label span { font-size: clamp(9px, 1.2vh, 12px); font-style: italic; opacity: 0.8; }

/* Quest */

.quest-main {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr);
  gap: clamp(10px, 2vw, 28px);
  min-height: 0;
}
.quest-ladder { display: flex; flex-direction: column; gap: clamp(4px, 0.9vh, 10px); justify-content: center; overflow-y: auto; }
.quest-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(8px, 1.2vw, 16px);
  align-items: center;
  padding: clamp(5px, 1vh, 11px) clamp(8px, 1.2vw, 16px);
  border: 1px solid rgba(216,168,74,0.28);
  background: rgba(244,234,215,0.04);
}
.quest-row.done { opacity: 0.55; }
.quest-row.current { border-color: rgba(242,193,78,0.8); background: linear-gradient(100deg, rgba(242,193,78,0.18), rgba(168,35,47,0.1)); }
.quest-row.locked { opacity: 0.4; }
.quest-row .q-num { font-family: var(--font-num); font-size: clamp(16px, 2.6vh, 28px); color: rgba(242,193,78,0.65); }
.quest-row .q-name { font-family: var(--font-display); font-size: clamp(12px, 2vh, 21px); color: var(--cream); }
.quest-row .q-meta { font-size: clamp(9px, 1.3vh, 13px); font-style: italic; color: rgba(244,234,215,0.6); }
.quest-row .q-stars { font-size: clamp(9px, 1.3vh, 13px); color: var(--gold-light); letter-spacing: 0.1em; white-space: nowrap; }
.quest-fighter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: clamp(8px, 1.2vh, 14px);
  border: 1px solid rgba(216,168,74,0.3);
  background: rgba(244,234,215,0.04);
  overflow-y: auto;
  min-height: 0;
}
.quest-fighter img { width: 100%; max-height: 58%; object-fit: contain; object-position: center top; }
.quest-fighter .qf-name { font-family: var(--font-display); font-size: clamp(14px, 2.2vh, 24px); color: var(--cream); }
.quest-fighter .qf-super { font-family: var(--font-num); font-size: clamp(9px, 1.3vh, 13px); letter-spacing: 0.1em; color: var(--gold-light); }
.quest-fighter .qf-quote { font-size: clamp(10px, 1.4vh, 14px); font-style: italic; color: rgba(244,234,215,0.65); }

/* Result */

#scr-result { background: #0a0709; }
.result-wash {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(242,193,78,0.16) 0%, transparent 55%),
    linear-gradient(180deg, #1a1210 0%, #0b080a 100%);
}
.result-wrap {
  position: relative;
  z-index: 2;
  height: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(10px, 2.2vh, 28px) clamp(14px, 3vw, 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1vh, 12px);
  text-align: center;
  overflow-y: auto;
}
#result-title { font-size: clamp(34px, 8vh, 92px); line-height: 0.9; }
.result-sub { margin: 0; font-size: clamp(12px, 1.9vh, 19px); font-style: italic; color: rgba(244,234,215,0.8); }
.result-body {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 44px);
  margin: clamp(4px, 1vh, 12px) 0;
  max-width: 100%;
}
.winner-frame {
  flex: 0 0 auto;
  width: clamp(120px, 23vh, 240px);
  padding: clamp(5px, 0.8vmin, 10px);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.14) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, #7a5015, #f2d48a 22%, #a97725 48%, #f7e2a6 70%, #6d4712 100%);
  box-shadow: 0 10px 26px rgba(0,0,0,0.65), 0 0 34px rgba(242,193,78,0.25), inset 0 0 0 1px #3a2a1e;
  animation: frame-slide 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.2) both;
}
.winner-frame img { display: block; width: 100%; }
.result-info { flex: 1 1 auto; min-width: 0; text-align: left; }
.result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
  padding: clamp(6px, 1vh, 12px);
  border: 1px solid rgba(216,168,74,0.28);
  background: rgba(244,234,215,0.04);
}
.result-stats div { display: flex; justify-content: space-between; gap: 8px; font-size: clamp(10px, 1.5vh, 15px); }
.result-stats b { font-family: var(--font-num); letter-spacing: 0.08em; color: var(--gold-light); font-weight: 400; }
.result-stats span { color: rgba(244,234,215,0.75); }
.result-board { margin-top: 8px; font-size: clamp(10px, 1.4vh, 14px); }
.result-board h4 {
  margin: 0 0 4px;
  font-family: var(--font-num);
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--gold-light);
  font-size: clamp(9px, 1.3vh, 12px);
}
.board-row { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; border-bottom: 1px dotted rgba(216,168,74,0.18); }
.board-row.me { color: var(--gold-light); }
.board-row a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(242,193,78,0.35); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Help modal */

.modal {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6,4,6,0.78);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: 92%;
  overflow-y: auto;
  padding: clamp(16px, 3vh, 34px) clamp(16px, 3vw, 34px);
  background:
    radial-gradient(ellipse at 50% 0%, #fbf3e2, #efdfc2 60%, #dcc39c 100%);
  border: 3px solid #3a2a1e;
  box-shadow: 0 0 0 5px #c99a44, 0 0 0 7px #3a2a1e, 0 20px 60px rgba(0,0,0,0.8);
  color: #2b1a0a;
}
.modal-card .eyebrow { color: #8b5c18; }
.modal-card h2 { color: #2b1a0a; text-shadow: none; font-size: clamp(20px, 4vh, 38px); }
.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f0cf7b, #8b5c18);
  border: 1px solid #3a2a1e;
  color: #2b1a0a;
  font-family: var(--font-display);
  font-size: 14px;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 20px;
  margin: 14px 0;
}
.help-grid div { display: flex; flex-direction: column; padding-bottom: 5px; border-bottom: 1px solid rgba(58,42,30,0.2); }
.help-grid b { font-family: var(--font-num); font-weight: 400; letter-spacing: 0.12em; color: #8b3a1c; }
.help-grid span { font-size: 0.95em; }
.help-note { font-size: clamp(12px, 1.7vh, 16px); line-height: 1.45; }

/* Overlay */

#overlay { position: absolute; inset: 0; z-index: 30; pointer-events: none; }

#callout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  opacity: 0;
}
#callout.show { animation: callout-in 0.42s cubic-bezier(0.2, 1, 0.3, 1) forwards; }
#callout.leave { animation: callout-out 0.32s ease-in forwards; }
.call-main {
  font-family: var(--font-display);
  font-size: clamp(44px, 14vmin, 150px);
  line-height: 0.9;
  color: var(--cream);
  -webkit-text-stroke: 2px #a8232f;
  text-shadow:
    0 4px 0 #3a2a1e,
    0 0 0 #f2c14e,
    0 0 34px rgba(242,193,78,0.55);
  letter-spacing: 0.02em;
  transform: rotate(-2deg);
}
.call-sub {
  margin-top: 0.4em;
  font-family: var(--font-num);
  font-size: clamp(12px, 2.4vmin, 26px);
  letter-spacing: 0.3em;
  color: var(--gold-light);
  text-shadow: 0 2px 6px #000;
}

#super-cutin {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  background: #08060a;
}
.cut-wipe {
  position: absolute;
  inset: -20%;
  background:
    linear-gradient(105deg, transparent 0 28%, #a8232f 28% 45%, #f2c14e 45% 54%, #0f1e4d 54% 78%, transparent 78%);
  transform: translateX(-120%) skewY(-6deg);
  animation: wipe-in 0.42s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0.95;
}
.cut-panel { position: absolute; inset: -4%; opacity: 0; animation: panel-in 0.6s 0.18s ease-out forwards; }
.cut-panel img { width: 100%; height: 100%; object-fit: cover; object-position: center; filter: saturate(1.15) contrast(1.05); }
.cut-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 30%, rgba(5,3,8,0.55) 100%),
    linear-gradient(180deg, rgba(5,3,8,0.15), transparent 30%, rgba(5,3,8,0.55) 100%);
}
.cut-name {
  position: absolute;
  left: 0;
  right: 0;
  top: 8%;
  z-index: 3;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(24px, 6.4vmin, 72px);
  line-height: 0.95;
  color: var(--cream);
  -webkit-text-stroke: 2px #a8232f;
  text-shadow: 0 3px 0 #3a2a1e, 0 0 26px rgba(0,0,0,0.8);
  transform: rotate(-2deg) scale(0.7);
  opacity: 0;
  animation: cut-name-in 0.5s 0.45s cubic-bezier(0.2, 1.2, 0.3, 1) forwards;
}
.cut-fighter {
  position: absolute;
  right: 5%;
  bottom: -2%;
  z-index: 4;
  width: clamp(110px, 28vmin, 330px);
  transform: translateY(30%) rotate(6deg);
  opacity: 0;
  animation: fighter-in 0.5s 0.6s cubic-bezier(0.2, 1.2, 0.3, 1) forwards;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.75));
}
.cut-fighter img { width: 100%; display: block; }
.cut-fighter::after {
  content: "";
  position: absolute;
  left: 10%; right: 10%; bottom: 0;
  height: 12px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.55), transparent 70%);
}
.cut-burst {
  position: absolute;
  left: 50%;
  top: 52%;
  z-index: 6;
  width: 62vmin;
  height: 62vmin;
  transform: translate(-50%, -50%) scale(0.2) rotate(-12deg);
  opacity: 0;
  filter: drop-shadow(0 0 30px rgba(232,98,44,0.6));
}
.cut-burst img { display: block; width: 100%; height: 100%; object-fit: contain; }
#super-cutin.burst .cut-burst { animation: burst-in 0.5s ease-out forwards; }
.cut-flash {
  position: absolute;
  inset: 0;
  z-index: 7;
  background: #fff6da;
  opacity: 0;
  pointer-events: none;
}
#super-cutin.burst .cut-flash { animation: flash 0.3s ease-out forwards; }

#splat-layer { position: absolute; inset: 0; z-index: 8; overflow: hidden; }
.splat {
  position: absolute;
  width: var(--size, 40vmin);
  transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(0.2);
  opacity: 0;
  animation: splat-in 0.28s ease-out forwards, splat-fade 1.6s 0.7s ease-in forwards;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}
.splat.drip { animation: splat-in 0.28s ease-out forwards, splat-drip 2.2s 0.5s ease-in forwards; }

#toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--deck-h) + 16px);
  z-index: 12;
  transform: translateX(-50%);
  padding: 0.5em 1em;
  background: rgba(10,7,12,0.85);
  border: 1px solid rgba(242,193,78,0.5);
  color: var(--cream);
  font-family: var(--font-num);
  font-size: clamp(11px, 1.6vh, 15px);
  letter-spacing: 0.1em;
  text-align: center;
  max-width: 80%;
}

/* Loading */

.loading {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse at 50% 40%, #241a12 0%, #0c0807 70%);
}
.loading-card {
  width: min(520px, 100%);
  padding: clamp(18px, 4vh, 40px);
  text-align: center;
  border: 2px solid #3a2a1e;
  box-shadow: 0 0 0 5px #b98a39, 0 0 0 7px #3a2a1e, 0 20px 60px rgba(0,0,0,0.7);
  background: linear-gradient(180deg, #221812, #120d0b);
}
.loading-card h2 { font-size: clamp(18px, 3.6vh, 34px); }
.load-track {
  height: 14px;
  margin: 18px 0 10px;
  background: #0a0707;
  border: 1px solid #6d4712;
  overflow: hidden;
}
.load-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a8232f, #e8622c 40%, #f2c14e 80%, #fff3c4);
  transition: width 0.2s;
}
#load-note { margin: 0; font-size: clamp(11px, 1.6vh, 15px); font-style: italic; color: rgba(244,234,215,0.7); }

#load-error {
  position: absolute;
  inset: 0;
  z-index: 91;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c0807;
}

#frame-foot {
  position: fixed;
  left: 50%;
  bottom: max(2px, calc(var(--frame-w) * 0.18));
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  font-family: var(--font-num);
  font-size: clamp(7px, 0.9vh, 10px);
  letter-spacing: 0.18em;
  color: #3a2a1e;
  opacity: 0.62;
  white-space: nowrap;
}
.frame-dot { width: 3px; height: 3px; border-radius: 50%; background: #3a2a1e; }

/* ---------------- animations ---------------- */

@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes start-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 3px #c99a44, 0 0 26px rgba(242,193,78,0.35), inset 0 2px 0 #fff8dc; }
  50% { transform: scale(1.035); box-shadow: 0 0 0 3px #f2c14e, 0 0 48px rgba(242,193,78,0.7), inset 0 2px 0 #fff8dc; }
}
@keyframes combo-pop { from { transform: scale(1.4) rotate(-2deg); } to { transform: scale(1) rotate(-1.5deg); } }
@keyframes meter-ready {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(242,193,78,0.4)); }
  50% { filter: drop-shadow(0 0 16px rgba(242,193,78,0.95)); }
}
@keyframes callout-in {
  0% { opacity: 0; transform: scale(1.5); }
  60% { opacity: 1; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes callout-out { to { opacity: 0; transform: scale(0.94); } }
@keyframes wipe-in {
  0% { transform: translateX(-120%) skewY(-6deg); }
  100% { transform: translateX(0%) skewY(-6deg); }
}
@keyframes panel-in {
  0% { opacity: 0; transform: scale(1.16); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes cut-name-in {
  0% { opacity: 0; transform: rotate(-2deg) scale(0.7); }
  100% { opacity: 1; transform: rotate(-2deg) scale(1); }
}
@keyframes fighter-in {
  0% { opacity: 0; transform: translateY(40%) rotate(10deg); }
  100% { opacity: 1; transform: translateY(0) rotate(4deg); }
}
@keyframes burst-in {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(-12deg); }
  55% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(2deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
}
@keyframes flash {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}
@keyframes splat-in {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(0.2); }
  70% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1.06); }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1); }
}
@keyframes splat-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes splat-drip {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -36%) rotate(var(--rot, 0deg)) scale(1.06); }
}
@keyframes frame-slide {
  0% { opacity: 0; transform: translateX(-70px) rotate(-6deg) scale(0.9); }
  100% { opacity: 1; transform: translateX(0) rotate(0) scale(1); }
}

/* ---------------- responsive ---------------- */

@media (max-height: 560px) {
  :root { --hud-h: clamp(60px, 15vh, 92px); --deck-h: clamp(82px, 19vh, 116px); }
  .hud-name-plate span { display: none; }
  .deck-hint { display: none; }
  .game-title .t1 { font-size: clamp(30px, 8vh, 70px); }
  .game-title .t2 { font-size: clamp(40px, 10vh, 92px); }
  .game-title .t3 { font-size: clamp(46px, 12vh, 110px); }
  .tagline { display: none; }
  .press-start { margin-top: 8px; }
}

@media (max-aspect-ratio: 4/5) {
  :root {
    --hud-h: clamp(96px, 12vh, 150px);
    --deck-h: clamp(150px, 20vh, 230px);
  }
  #hud { padding: 6px 6px 0; gap: 3px; }
  .hud-portrait { width: clamp(30px, 5.4vh, 52px); }
  .hud-name-plate span { display: none; }
  .hud-timer { width: clamp(58px, 9vh, 84px); }
  .super-meter { width: clamp(64px, 11vh, 104px); }
  .super-meter.p2 { display: none; }
  .actions { gap: 2px; }
  .action-btn { width: clamp(40px, 7vh, 62px); }
  .action-btn span { font-size: 6.5px; letter-spacing: 0.02em; }
  .move-pad {
    grid-template-columns: repeat(3, clamp(38px, 6.6vh, 60px));
    grid-template-rows: repeat(2, clamp(38px, 6.6vh, 60px));
  }
  .deck-hint { display: none; }
  .deck-left { flex: 0 1 auto; }
  .deck-right { margin-left: auto; }
  .deck-center { position: absolute; right: 8px; bottom: 4px; flex: 0 0 auto; }

  .menu-body { grid-template-columns: 1fr; }
  .menu-feature { order: -1; }
  .feature-frame img { max-height: 24vh; object-fit: cover; }
  .select-main { grid-template-columns: 1fr; }
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; align-content: start; }
  .select-detail { display: none; }
  .detail-portrait { display: block; }
  .stage-grid { grid-template-columns: 1fr; grid-template-rows: none; }
  .quest-main { grid-template-columns: 1fr; }
  .quest-fighter { display: none; }
  .result-body { flex-direction: column; gap: 10px; }
  .result-info { text-align: center; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-wrap { justify-content: flex-start; }
  .help-grid { grid-template-columns: 1fr; }
  .game-title { transform: rotate(-1deg) scale(0.96); }
  .title-inner .tagline { max-width: 26ch; }
}

@media (max-width: 620px) {
  .hud-portrait { display: none; }
  .hud-name-plate b { font-size: 9px; letter-spacing: 0.04em; }
  .hud-timer { width: 56px; }
  .round-label { font-size: 8px; }
  .mode-item .mode-desc { display: none; }
  .mode-item { padding: 8px 10px; }
  .title-modes { font-size: 9px; gap: 8px; }
  .menu-wrap, .select-wrap, .stage-wrap, .quest-wrap { padding: 8px; }
  .select-head h2 { font-size: 20px; }
  .select-step { font-size: 8px; }
  .result-actions .brass-btn { font-size: 11px; padding: 0.4em 0.7em; }
  .quest-row .q-meta { display: none; }
  .action-btn span { display: none; }
}

/* ================= cel-shaded redesign ================= */

:root {
  --night: #12235c;
  --blue: #2f5cc4;
  --sun: #f5c93f;
  --orange: #ef6a2a;
  --teal: #1d7d78;
  --crimson: #b22330;
  --cream: #f6ecd6;
  --umber: #33241a;
  --gold-deep: #6d4712;
  --gold: #d8a84a;
  --gold-light: #f7e2a6;
  --hud-h: clamp(80px, 14.5vh, 140px);
  --deck-h: clamp(112px, 17.5vh, 176px);
}

/* hard ink edges everywhere instead of soft glows */
h2,
.mode-name,
.feature-copy h3,
.select-detail h3,
.quest-fighter .qf-name,
.stage-label b,
.result-wrap h2,
.call-main,
.cut-name,
.game-title span {
  text-shadow: 3px 3px 0 var(--umber);
}
.game-title span {
  -webkit-text-stroke: 2px var(--umber);
  filter: drop-shadow(4px 4px 0 var(--umber));
}
.game-title .t1 { -webkit-text-stroke: 2px var(--umber); }
.game-title .t2 { -webkit-text-stroke: 2px var(--gold); }
.game-title .t3 { -webkit-text-stroke: 3px var(--umber); }
.tagline,
.menu-lede,
.start-hint,
.title-modes,
.foot-hint,
.viewer-line { text-shadow: 1px 1px 0 #1a120c; }
.press-start {
  box-shadow: 5px 5px 0 var(--umber), inset 0 2px 0 #fff8dc;
  animation: start-pulse-flat 1.9s steps(2, end) infinite;
}
@keyframes start-pulse-flat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-2px, -2px); }
}
.brass-btn,
.action-btn img,
.sound-toggle,
.timer-plaque,
.bar-frame,
.super-meter,
.hud-portrait,
.winner-frame,
.feature-frame,
.stage-card,
.portrait-card,
.modal-card,
.loading-card {
  filter: none;
}
.brass-btn { box-shadow: 4px 4px 0 var(--umber), inset 0 1px 0 #fff7d6; }
.brass-btn.small { box-shadow: 3px 3px 0 var(--umber); }
.modal-card { box-shadow: 0 0 0 4px var(--gold), 0 0 0 7px var(--umber), 8px 8px 0 var(--umber); }
.winner-frame { box-shadow: 0 0 0 3px var(--umber), 8px 8px 0 var(--umber); }
.feature-frame { box-shadow: 5px 5px 0 var(--umber), inset 0 0 0 2px var(--umber); }
.stage-card { box-shadow: 5px 5px 0 var(--umber), inset 0 0 0 2px var(--umber); }
.portrait-card { border: 3px solid var(--umber); box-shadow: 0 0 0 4px var(--gold), 7px 7px 0 var(--umber); }
.portrait-card:hover, .portrait-card.sel {
  filter: drop-shadow(8px 9px 0 rgba(51,36,26,0.6));
}
.select-detail, .quest-fighter, .quest-row, .result-stats {
  border: 2px solid var(--umber);
  box-shadow: 3px 3px 0 rgba(51,36,26,0.55);
  background: rgba(246,236,214,0.055);
}
.mode-item {
  border: 2px solid var(--umber);
  border-left: 6px solid var(--umber);
  background: rgba(246,236,214,0.07);
  box-shadow: 4px 4px 0 rgba(51,36,26,0.5);
}
.mode-item:hover, .mode-item.active {
  background: rgba(245,201,63,0.16);
  transform: translate(4px, -3px);
  box-shadow: 6px 6px 0 var(--umber);
}
.title-wash { background:
  radial-gradient(ellipse at 50% 44%, rgba(8,5,10,0.12) 0%, rgba(8,5,10,0.62) 68%, rgba(5,3,7,0.94) 100%),
  linear-gradient(180deg, rgba(5,3,7,0.5), transparent 26%, transparent 64%, rgba(5,3,7,0.9)); }
#callout.show .call-main { text-shadow: 4px 4px 0 var(--umber), 0 0 0 var(--gold); }
.call-main { -webkit-text-stroke: 3px var(--crimson); }
.call-sub { text-shadow: 2px 2px 0 var(--umber); }
.cut-name { -webkit-text-stroke: 3px var(--crimson); text-shadow: 4px 4px 0 var(--umber); }
.cut-panel img { filter: saturate(1.08) contrast(1.03); }
.cut-fighter { filter: drop-shadow(6px 6px 0 rgba(51,36,26,0.7)); }
.hud-name-plate { box-shadow: 2px 2px 0 var(--umber), inset 0 1px 0 rgba(255,244,205,0.7); }
.timer-plaque { filter: drop-shadow(3px 3px 0 var(--umber)); }
.round-label { box-shadow: 2px 2px 0 var(--umber); }
.bar-frame { filter: drop-shadow(3px 3px 0 rgba(51,36,26,0.7)); }
.super-meter { filter: drop-shadow(3px 3px 0 rgba(51,36,26,0.65)); }
.hud-portrait { box-shadow: 0 0 0 2px var(--gold), 3px 3px 0 var(--umber); }

/* fighter names on the portrait pictures, in the fight */
.hud-portrait { position: relative; }
.hud-portrait::after {
  content: attr(data-name);
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -2px;
  padding: 1px 2px 2px;
  text-align: center;
  font-family: var(--font-num);
  font-size: clamp(6px, 1vh, 10px);
  letter-spacing: 0.06em;
  color: var(--umber);
  background: linear-gradient(180deg, #f0cf7b, #c8953d 60%, #9a6a22);
  border-top: 1px solid var(--umber);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* joystick */
.joystick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  flex: 0 0 auto;
}
.stick-base {
  position: relative;
  width: clamp(78px, 15vh, 132px);
  height: clamp(78px, 15vh, 132px);
  border-radius: 50%;
  border: 3px solid var(--umber);
  background:
    radial-gradient(circle at 38% 30%, rgba(255,244,205,0.5), transparent 38%),
    linear-gradient(160deg, #d8a84a 0%, #8b5c18 62%, #c69440 100%);
  box-shadow: 4px 4px 0 var(--umber), inset 0 0 0 6px rgba(51,36,26,0.25);
  pointer-events: auto;
  touch-action: none;
  overflow: hidden;
}
.stick-ring {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 3px solid rgba(51,36,26,0.45);
  box-shadow: inset 0 0 0 2px rgba(255,244,205,0.18);
}
.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  height: 46%;
  margin: -23% 0 0 -23%;
  border-radius: 50%;
  border: 3px solid var(--umber);
  background:
    radial-gradient(circle at 36% 28%, #fff5ce, transparent 36%),
    linear-gradient(180deg, #efcf7a 0%, #b27a1f 70%, #e3b858 100%);
  box-shadow: 3px 4px 0 var(--umber);
  transition: transform 0.04s linear;
}
.joystick.active .stick-base { filter: brightness(1.08); }
.stick-label {
  font-family: var(--font-num);
  font-size: clamp(6px, 0.9vh, 10px);
  letter-spacing: 0.08em;
  color: rgba(246,236,214,0.72);
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
}
.deck-left-col { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.fighter-plaque {
  padding: 0.12em 0.7em 0.16em;
  font-family: var(--font-display);
  background: linear-gradient(180deg, #f2d486, #c8953d 55%, #94641c);
  border: 2px solid var(--umber);
  box-shadow: 3px 3px 0 var(--umber);
  font-weight: 700;
  font-size: clamp(9px, 1.4vh, 14px);
  letter-spacing: 0.09em;
  color: var(--umber);
  white-space: nowrap;
}

/* the wider roster wall */
.wall {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}
.portrait-card .plate {
  left: 6%;
  right: 6%;
  bottom: 2.4%;
  padding: 0.12em 0.2em 0.16em;
  background: linear-gradient(180deg, #f2d486, #c8953d 55%, #94641c);
  border: 1px solid var(--umber);
  color: var(--umber);
  text-shadow: none;
  font-size: clamp(7px, 1.15vh, 12px);
  letter-spacing: 0.06em;
}

/* cinematic modal */
.cine-card {
  position: relative;
  width: min(1100px, 96%);
  padding: 10px;
  background: linear-gradient(135deg, #7a5015, #f2d48a 22%, #a97725 48%, #f7e2a6 70%, #6d4712 100%);
  border: 3px solid var(--umber);
  box-shadow: 8px 8px 0 var(--umber);
}
.cine-card video { display: block; width: 100%; max-height: 78vh; background: #06040a; }
.cine-card .modal-close { top: -14px; right: -14px; }
.board-empty { margin: 4px 0 0; font-style: italic; color: rgba(246,236,214,0.65); }

/* keep the painting big on the result screen */
.result-wrap { max-width: 1060px; }

@media (max-aspect-ratio: 4/5) {
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stick-base { width: clamp(96px, 13vh, 124px); height: clamp(96px, 13vh, 124px); }
  .deck-left { gap: 6px; }
  .deck-left-col { flex-direction: column; }
  .fighter-plaque { font-size: 9px; }
  .super-meter { width: clamp(66px, 10vh, 92px); }
}

@media (max-width: 980px) {
  .wall { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; overflow-y: auto; align-content: start; }
}
@media (max-width: 620px) {
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stick-base { width: 86px; height: 86px; }
  .deck-hint { display: none; }
  .fighter-plaque { font-size: 8px; }
}

@media (max-width: 900px) {
  .super-meter.p2 { display: none; }
  .action-btn { width: clamp(38px, 7.6vh, 52px); }
  .deck-hint { display: none; }
  .stick-base { width: clamp(70px, 13vh, 96px); height: clamp(70px, 13vh, 96px); }
  .super-meter { width: clamp(76px, 13vh, 110px); }
}

@media (max-aspect-ratio: 4/5) {
  .menu-body { display: flex; flex-direction: column; }
  .mode-list { order: 1; }
  .menu-feature { order: 2; }
  .feature-frame { max-height: 19vh; overflow: hidden; }
  .feature-frame img { max-height: 19vh; object-fit: cover; }
  .feature-copy { display: none; }
  .menu-tools { order: 3; }
  .menu-wrap { overflow-y: auto; }
  .menu-head .menu-lede { margin-bottom: 2px; }
}

/* title must never run off a portrait phone */
.game-title .t1 { font-size: min(7.6vh, 10vw); }
.game-title .t2 { font-size: min(9.8vh, 13vw); }
.game-title .t3 { font-size: min(11.4vh, 15vw); }

/* clearer names on the in-fight portrait pictures */
.hud-portrait { overflow: visible; }
.hud-portrait::after {
  top: 100%;
  bottom: auto;
  left: -2px;
  right: -2px;
  min-height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(7px, 1.05vh, 10px);
  border: 1px solid var(--umber);
  box-shadow: 2px 2px 0 var(--umber);
  background: linear-gradient(180deg, #f2d486, #c8953d 60%, #94641c);
}

/* the super art preview fills the select detail panel */
.detail-super-art {
  position: relative;
  margin-top: 6px;
  border: 2px solid var(--umber);
  box-shadow: 4px 4px 0 var(--umber);
  overflow: hidden;
  flex: 0 1 auto;
  min-height: 0;
}
.detail-super-art img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center 35%;
}
.detail-super-art span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 4px 3px;
  background: linear-gradient(180deg, #f2d486, #c8953d 60%, #94641c);
  border-top: 1px solid var(--umber);
  color: var(--umber);
  font-family: var(--font-num);
  font-size: clamp(7px, 1.1vh, 10px);
  letter-spacing: 0.12em;
  text-align: center;
}

@media (max-aspect-ratio: 4/5) {
  .hud-portrait { overflow: visible; }
}

.deck-exit {
  pointer-events: auto;
  font-family: var(--font-display);
  padding: 0.18em 0.55em 0.2em;
  background: linear-gradient(180deg, #f2d486, #c8953d 55%, #94641c);
  border: 1px solid var(--umber);
  box-shadow: 2px 2px 0 var(--umber);
  color: var(--umber);
  font-family: var(--font-num);
  font-size: clamp(8px, 1.1vh, 11px);
  letter-spacing: 0.1em;
}

.quest-row .q-name,
.quest-row .q-meta { display: block; }
.quest-row .q-meta { margin-top: 2px; color: rgba(246,236,214,0.66); }

.wall { perspective: 900px; transform-style: preserve-3d; }
.portrait-card:hover, .portrait-card.sel {
  transform: translateY(-7px) rotateX(6deg) rotate(0deg) scale(1.035);
}

/* portrait: fit the full roster and keep every name plate in view */
@media (max-aspect-ratio: 4/5) {
  .select-wrap { padding: 6px; gap: 4px; }
  .select-head {
    position: sticky;
    top: 0;
    z-index: 8;
    padding: 2px 0 5px;
    background: linear-gradient(180deg, rgba(13,10,11,0.98) 0%, rgba(13,10,11,0.9) 78%, rgba(13,10,11,0) 100%);
  }
  .select-head h2 { font-size: clamp(18px, 3.4vh, 28px); }
  .select-head { margin-bottom: 1px; }
  .wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: auto;
    align-content: start;
    gap: 7px 7px;
  }
  .portrait-card img {
    width: 100%;
    height: clamp(92px, 12.4vh, 122px);
    object-fit: cover;
    object-position: center 18%;
  }
  .portrait-card .plate {
    bottom: 3%;
    font-size: clamp(7px, 1.55vh, 11px);
    padding: 0.1em 0.15em 0.14em;
  }
  .select-foot { padding-top: 4px; }
  .select-hint { font-size: 8px; }

  .menu-foot { flex-wrap: wrap; }
  .menu-foot .foot-hint { width: 100%; text-align: left; padding-top: 2px; }

  /* portrait fight deck: all five buttons on screen, two rows */
  .deck-left { gap: 4px; }
  .stick-base { width: 84px; height: 84px; }
  .stick-label { font-size: 6px; }
  .super-meter { width: 62px; }
  .super-txt, .super-pct { font-size: 7px; }
  .fighter-plaque { font-size: 8px; padding: 0.08em 0.4em 0.12em; }
  .deck-right { align-items: flex-end; margin-left: auto; }
  .actions {
    display: grid;
    grid-template-columns: repeat(3, auto);
    grid-template-rows: repeat(2, auto);
    gap: 3px;
    align-items: end;
  }
  .action-btn { width: clamp(44px, 6.2vh, 58px); --lift: 0px !important; }
  .action-btn span { display: block; font-size: 7.5px; letter-spacing: 0.02em; }
  .actions .action-btn:nth-child(1) { grid-area: 1 / 1; }
  .actions .action-btn:nth-child(2) { grid-area: 2 / 1; }
  .actions .action-btn:nth-child(3) { grid-area: 2 / 2; }
  .actions .action-btn:nth-child(4) { grid-area: 2 / 3; }
  .actions .action-btn:nth-child(5) { grid-area: 1 / 2; }
  .actions .action-btn:nth-child(6) { grid-area: 1 / 3; }
  .deck-center {
    position: absolute;
    left: 50%;
    bottom: 3px;
    transform: translateX(-50%);
    flex-direction: row;
    gap: 4px;
    align-items: center;
  }
  .deck-hint { display: none; }
  .deck-help, .deck-exit { font-size: 7px; }
  .deck-help { width: 18px; height: 18px; }
  .deck-exit { padding: 0.12em 0.35em 0.14em; }
}

/* Paginated six-portrait wall: larger framed faces, all ten fighters kept */
.wall {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(2, auto) !important;
  grid-auto-rows: auto !important;
  align-content: center !important;
  overflow: visible !important;
  width: 100%;
  max-width: 730px;
  margin: 0 auto;
}
@media (max-width: 560px) {
  .wall {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(3, auto) !important;
  }
}
.portrait-art { aspect-ratio: 1 / 1; }
.wall.page-1 {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(2, auto) !important;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}
.portrait-card img {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center 24% !important;
}

@media (max-width: 560px) {
  .select-head {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .select-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
}

/* Title marquee: clean vertical stack on the cream margin */
#scr-title {
  background:
    radial-gradient(ellipse at 50% 18%, #fbf3e2 0%, #f6ecd6 46%, #e8d4ae 100%);
}
#scr-title .title-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 0.9vh, 10px);
  padding: clamp(8px, 2vh, 26px) clamp(10px, 3vw, 36px);
  overflow-y: auto;
  text-align: center;
}
.title-frieze {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 0.6vw, 7px);
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}
.title-frieze-item {
  position: relative;
  width: clamp(27px, 6.6vw, 54px);
  aspect-ratio: 1 / 1;
  flex: 0 1 auto;
  background: #b22330;
  border: 2px solid #33241a;
  box-shadow: 0 0 0 2px #c99a44, 3px 3px 0 #33241a;
  overflow: hidden;
  border-radius: 1px;
}
.title-frieze-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 24%;
  display: block;
}
.title-plate {
  margin: clamp(2px, 0.6vh, 8px) auto 0;
  padding: clamp(6px, 1.3vh, 15px) clamp(9px, 2.4vw, 26px);
  max-width: min(94%, 860px);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.13) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, #7a5015, #f2d48a 22%, #a97725 48%, #f7e2a6 70%, #6d4712 100%);
  border: 3px solid #33241a;
  box-shadow: 0 0 0 3px #c99a44, 6px 7px 0 rgba(51,36,26,0.6);
}
.title-plate .game-title {
  background: rgba(17,12,20,0.95);
  padding: clamp(5px, 1.1vh, 13px) clamp(8px, 2vw, 24px);
  box-shadow: inset 0 0 0 2px #c99a44, inset 0 0 26px rgba(0,0,0,0.6);
  transform: none;
}
#scr-title .eyebrow { color: #8a5a18; text-shadow: none; }
#scr-title .game-title span { filter: drop-shadow(0 3px 0 #140c14); }
#scr-title .tagline {
  margin: clamp(4px, 1.1vh, 12px) 0 0;
  color: #4a3324;
  text-shadow: none;
}
#scr-title .press-start {
  margin-top: clamp(8px, 2vh, 22px);
  padding: 0.5em 1.35em 0.56em;
  font-size: clamp(16px, 3vh, 30px);
  white-space: nowrap;
  box-shadow: 5px 5px 0 #33241a, inset 0 2px 0 #fff8dc;
  animation: none;
}
.title-controls {
  margin: 0.55em auto 0;
  padding: 0.3em 0.8em 0.34em;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(10px, 1.5vh, 14px);
  letter-spacing: 0.03em;
  color: #2b1a0a;
  background: linear-gradient(180deg, #f3d68b 0%, #cf9f45 55%, #96651e 100%);
  border: 1px solid #33241a;
  box-shadow: 2px 2px 0 #33241a;
  display: inline-block;
}
#scr-title .start-hint { margin: 0.35em 0 0; color: rgba(51,36,26,0.7); }
.title-control-pick {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0.35em auto 0.1em;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  color: #33241a;
}
.title-control-pick > span:first-child {
  font-size: clamp(10px, 1.35vh, 13px);
  letter-spacing: 0.1em;
  color: #33241a;
  text-shadow: none;
}
#scr-title .title-modes { margin-top: clamp(5px, 1.2vh, 12px); color: #4a3324; }
#scr-title .title-modes i { background: var(--crimson); box-shadow: none; }
#scr-title .title-credit { color: rgba(51,36,26,0.6); }
#scr-title .sound-toggle {
  color: #2b1a0a;
  background: linear-gradient(180deg, #f3d68b 0%, #cf9f45 55%, #96651e 100%);
  border: 1px solid #33241a;
  box-shadow: 2px 2px 0 #33241a;
  backdrop-filter: none;
}

/* Main gallery control plaque */
.menu-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(8px, 1.4vh, 16px);
  min-height: 0;
}
.menu-left .mode-list { flex: 0 0 auto; }
.menu-control-plaque {
  align-self: flex-start;
  padding: 7px 10px 8px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.12) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, #7a5015, #f2d48a 22%, #a97725 48%, #f7e2a6 70%, #6d4712 100%);
  border: 2px solid #33241a;
  box-shadow: 0 0 0 2px #c99a44, 4px 5px 0 rgba(51,36,26,0.55);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu-control-plaque .control-pick {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.menu-control-plaque .control-pick span {
  color: #2b1a0a;
  text-shadow: none;
}
.menu-control-plaque .control-pick select { width: 195px; }
@media (max-aspect-ratio: 4/5) {
  .menu-left { order: 1; }
  .menu-feature { order: 2; }
}
.title-plate {
  width: 100%;
  max-width: 860px;
}
#scr-title .game-title .t1 { font-size: min(9vh, 12vw); }
#scr-title .game-title .t2 { font-size: min(10vh, 13.5vw); }
#scr-title .game-title .t3 { font-size: min(14vh, 18.5vw); }
.menu-left .mode-list { order: 0; }
@media (max-aspect-ratio: 4/5) {
  .menu-body {
    flex: 0 0 auto;
    align-content: start;
    min-height: auto;
  }
  .menu-left {
    min-height: auto;
    justify-content: flex-start;
  }
}

/* ---------------- restored cinematic title and loading screen ---------------- */

#scr-title {
  background:
    linear-gradient(180deg, rgba(7,4,12,0.20), rgba(7,4,12,0.38)),
    url("../assets/img/cel/key_art.webp") center / cover no-repeat,
    #07050c;
}
#scr-title .title-video {
  opacity: 0.94;
  filter: saturate(1.08) contrast(1.04);
}
#scr-title .title-wash {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(6,4,10,0.10) 0%, rgba(6,4,10,0.58) 62%, rgba(4,3,8,0.94) 100%),
    linear-gradient(180deg, rgba(4,3,8,0.62), rgba(4,3,8,0.04) 30%, rgba(4,3,8,0.28) 64%, rgba(4,3,8,0.92));
}
#scr-title .title-inner { gap: clamp(4px, 0.8vh, 9px); }
#scr-title .title-plate {
  width: auto;
  max-width: min(96%, 1000px);
  margin: clamp(2px, 0.6vh, 8px) auto 0;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}
#scr-title .title-plate .game-title {
  background: none;
  padding: 0;
  box-shadow: none;
  transform: none;
}
#scr-title .game-title {
  font-family: var(--font-title);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 0.95;
  transform: skewX(-7deg) rotate(-1.2deg);
}
#scr-title .game-title span {
  font-family: var(--font-title);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  background-image: linear-gradient(180deg, #fff8da 0%, #f6cd58 26%, #b47c1f 58%, #ffe9a8 79%, #7c5013 100%);
  -webkit-text-stroke: 3px #241509;
  filter: drop-shadow(0 4px 0 #2a1608) drop-shadow(0 8px 0 rgba(0,0,0,0.55));
}
#scr-title .game-title .t1 { font-size: min(11vh, 14vw); }
#scr-title .game-title .t2 {
  font-size: min(15vh, 18vw);
  background-image: linear-gradient(180deg, #ffe9a8 0%, #f2b93c 28%, #b22330 57%, #8e1826 74%, #f2c14e 100%);
  -webkit-text-stroke: 3px #241509;
}
#scr-title .game-title .t3 {
  font-size: min(19vh, 23vw);
  background-image: linear-gradient(180deg, #fff8da 0%, #f2c14e 25%, #9a6a1c 55%, #fff0b4 76%, #7c5013 100%);
  -webkit-text-stroke: 4px #241509;
}
#scr-title .eyebrow {
  color: #ffe9ab;
  text-shadow: 0 2px 0 #1a1008, 0 0 14px rgba(0,0,0,0.85);
}
#scr-title .tagline {
  color: #fff3d0;
  text-shadow: 0 2px 0 #1a1008, 0 0 14px rgba(0,0,0,0.9);
}
#scr-title .start-hint {
  color: rgba(255,240,200,0.88);
  text-shadow: 0 1px 0 #1a1008, 0 0 10px rgba(0,0,0,0.8);
}
#scr-title .title-modes { color: #ffe9ab; text-shadow: 0 1px 0 #1a1008, 0 0 10px rgba(0,0,0,0.8); }
#scr-title .title-modes i { background: var(--crimson); box-shadow: 0 0 0 1px #1a1008; }
#scr-title .title-credit { color: rgba(255,240,200,0.62); text-shadow: 0 1px 0 #1a1008; }
#scr-title .title-control-pick > span:first-child {
  color: #ffe9ab;
  text-shadow: 0 1px 0 #1a1008, 0 0 10px rgba(0,0,0,0.8);
}
#scr-title .title-frieze { filter: drop-shadow(0 3px 6px rgba(0,0,0,0.65)); }

.control-pick select {
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}

.loading {
  background:
    linear-gradient(180deg, rgba(7,4,12,0.52), rgba(7,4,12,0.78)),
    url("../assets/img/cel/key_art.webp") center / cover no-repeat;
}
.loading-card {
  background: rgba(16,10,16,0.84);
  border: 3px solid var(--umber);
  box-shadow: 0 0 0 4px var(--gold), 8px 9px 0 rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
}
.loading-card h2 {
  font-family: var(--font-title);
  letter-spacing: 0.02em;
  color: #f6cd58;
  -webkit-text-stroke: 2px #241509;
  text-shadow: 0 3px 0 #241509;
}
.loading-card .eyebrow { color: #ffe9ab; }
#scr-title .game-title span { text-shadow: none; }
#scr-title .title-inner { overflow-x: hidden; }
@media (max-height: 560px) {
  #scr-title .title-inner { gap: 2px; padding-top: 4px; padding-bottom: 4px; }
  #scr-title .game-title .t1 { font-size: min(8vh, 8vw); }
  #scr-title .game-title .t2 { font-size: min(11vh, 11vw); }
  #scr-title .game-title .t3 { font-size: min(14vh, 14vw); }
  #scr-title .title-frieze-item { width: clamp(22px, 4.6vw, 38px); }
  #scr-title .title-credit { display: none; }
  #scr-title .title-modes { margin-top: 2px; }
}
#scr-title .title-frieze { display: none; }
#scr-title .title-wash {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(6,4,10,0.08) 0%, rgba(6,4,10,0.5) 60%, rgba(4,3,8,0.86) 100%),
    linear-gradient(180deg, rgba(4,3,8,0.6), rgba(4,3,8,0.04) 30%, rgba(4,3,8,0.18) 64%, rgba(4,3,8,0.66));
}
