@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css");

:root {
  --blue: #3182f6;
  --blue-dark: #1b64da;
  --red: #f04452;
  --gold: #f3d27a;
  --bg: #0a0b0f;
  --surface: #ffffff;
  --text-main: #191f28;
  --text-sub: #8b95a1;
  --text-faint: #b0b8c1;
  --line: #eef0f3;
  --p1: #f04452;
  --p2: #3182f6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #05060a;
  color: var(--text-main);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100%;
  max-width: 430px;
  /* On a real phone this must be the full device height — no cap — or the
     atmospheric background layers (sized off this box) end up shorter than
     the actual viewport, leaving a flat gap at the bottom. The 932px cap is
     only for framing the app like a phone on a wide desktop window below. */
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

@media (min-width: 431px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #app {
    height: min(932px, 96dvh);
    border-radius: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  }
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; }

/* ---------- Shared keyframes: the whole flow should feel alive ---------- */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-46px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(46px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.4); }
  70% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(240, 68, 82, 0.35); }
  50% { box-shadow: 0 10px 34px rgba(240, 68, 82, 0.65); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.05; }
  50% { opacity: 0.09; }
}
@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.22); }
  100% { transform: scale(1); }
}
@keyframes floatUpFade {
  0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70px) scale(1.4); }
}
@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes shimmerSweep {
  0% { transform: translateX(-140%) rotate(12deg); }
  35%, 100% { transform: translateX(220%) rotate(12deg); }
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Setup screen: UFC-style face-off ---------- */
.faceoff {
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: #0a0b0f;
  overflow-x: hidden;
  overflow-y: auto;
}
.faceoff-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(240, 68, 82, 0.25), transparent 60%),
    radial-gradient(120% 60% at 50% 110%, rgba(49, 130, 246, 0.22), transparent 60%),
    linear-gradient(180deg, #0a0b0f 0%, #121319 50%, #0a0b0f 100%);
}
.faceoff-bg::before {
  content: "";
  position: absolute;
  inset: -20% -60%;
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.035) 0 2px,
    transparent 2px 26px
  );
  transform: rotate(-3deg);
}
.faceoff-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 40% at 12% 30%, rgba(120, 220, 200, 0.16), transparent 70%),
    radial-gradient(60% 40% at 88% 70%, rgba(120, 220, 200, 0.12), transparent 70%);
  mix-blend-mode: screen;
}

.faceoff-watermark {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 220px;
  font-weight: 800;
  font-style: italic;
  color: #ffffff;
  letter-spacing: -6px;
  white-space: nowrap;
  z-index: 0;
  pointer-events: none;
  animation: breathe 4s ease-in-out infinite;
}

.faceoff-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  padding: 40px 22px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.faceoff-header {
  text-align: center;
  margin-bottom: 4px;
  animation: fadeSlideUp 0.6s ease both;
}
.faceoff-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffd166;
  background: #000000;
  padding: 6px 14px;
  border-radius: 3px;
  margin-bottom: 14px;
}
.die-die {
  font-size: 64px;
  line-height: 0.85;
  letter-spacing: 2px;
  font-weight: 900;
  font-style: italic;
  transform: skewX(-6deg);
  background: linear-gradient(180deg, #ffffff 0%, #ffd6d6 35%, var(--red) 60%, #7a0d16 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.25);
  filter: drop-shadow(0 0 18px rgba(240, 68, 82, 0.55)) drop-shadow(0 4px 0 #4a060c);
  animation: dieFlicker 3s ease-in-out infinite 0.8s;
}
@keyframes dieFlicker {
  0%, 92%, 100% { filter: drop-shadow(0 0 18px rgba(240, 68, 82, 0.55)) drop-shadow(0 4px 0 #4a060c); }
  95% { filter: drop-shadow(0 0 30px rgba(240, 68, 82, 0.85)) drop-shadow(0 4px 0 #4a060c); }
}

.faceoff-title {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-style: italic;
  color: #ffffff;
  text-shadow: 0 0 24px rgba(120, 220, 200, 0.35);
}

.corner {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid transparent;
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 0 100%, 0 14px);
}
.faceoff-inner .fight-btn { margin-top: 10px; }

.corner-red {
  border-color: rgba(240, 68, 82, 0.45);
  box-shadow: inset 3px 0 0 var(--red);
  animation: slideInLeft 0.55s ease both 0.05s;
}
.corner-blue {
  border-color: rgba(49, 130, 246, 0.45);
  box-shadow: inset 3px 0 0 var(--blue);
  animation: slideInRight 0.55s ease both 0.1s;
}
.corner-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.55);
}
.corner-red .corner-tag { color: #ff8891; }
.corner-blue .corner-tag { color: #8cb8fb; }

.corner-input {
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 14px;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  outline: none;
  transition: border-color 0.15s;
}
.corner-input::placeholder { color: rgba(255, 255, 255, 0.35); font-weight: 500; }
.corner-red .corner-input:focus { border-color: var(--red); }
.corner-blue .corner-input:focus { border-color: var(--blue); }

.vs-badge {
  font-size: 15px;
  font-weight: 800;
  font-style: italic;
  color: #0a0b0f;
  background: linear-gradient(135deg, #ffffff, #d7dbe2);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -6px 0;
  box-shadow: 0 0 0 4px #0a0b0f, 0 4px 14px rgba(0, 0, 0, 0.4);
  z-index: 2;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both 0.3s;
}

.fight-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 18px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--red), #b8232f);
  box-shadow: 0 10px 24px rgba(240, 68, 82, 0.35);
  cursor: pointer;
  transition: transform 0.1s;
  animation: fadeSlideUp 0.5s ease both 0.35s, ctaPulse 2.2s ease-in-out infinite 1s;
}
.fight-btn:active { transform: scale(0.97); }

.faceoff-footer {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  animation: fadeSlideUp 0.5s ease both 0.4s;
}
.footer-tag {
  background: #000000;
  color: rgba(255, 255, 255, 0.75);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 6px 10px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ---------- Character select (Tekken-style fighter pick) ---------- */
.select-inner { gap: 20px; }
.select-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeSlideUp 0.5s ease both;
}
.select-row:nth-of-type(2) { animation-delay: 0.1s; }
.select-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
}
.select-label-red { color: #ff8891; }
.select-label-blue { color: #8cb8fb; }

.char-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.char-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.char-chip:active { transform: scale(0.95); }
.char-emoji { font-size: 20px; }
.char-name {
  font-size: 8px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  line-height: 1.15;
}
#char-grid-1 .char-chip.selected {
  border-color: var(--red);
  background: rgba(240, 68, 82, 0.15);
  box-shadow: 0 0 16px rgba(240, 68, 82, 0.35);
}
#char-grid-2 .char-chip.selected {
  border-color: var(--blue);
  background: rgba(49, 130, 246, 0.15);
  box-shadow: 0 0 16px rgba(49, 130, 246, 0.35);
}
.char-chip.selected .char-name { color: #ffffff; }

#confirm-select-btn {
  animation: fadeSlideUp 0.5s ease both 0.2s;
  transition: opacity 0.2s, transform 0.1s;
}
#confirm-select-btn:disabled {
  opacity: 0.35;
  animation: none;
  box-shadow: none;
  cursor: not-allowed;
}

.champion-char-badge {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  animation: fadeSlideUp 0.5s ease both 0.25s;
}
.champion-char-badge:empty { display: none; }

.primary-btn {
  background: var(--blue);
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 17px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.1s, background 0.15s;
}
.primary-btn:active { transform: scale(0.98); background: var(--blue-dark); }
.primary-btn:disabled { background: var(--text-faint); }

.secondary-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 15px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.secondary-btn:active { background: rgba(255, 255, 255, 0.12); }

/* ---------- Game screen: same fight-night material as the rest of the app ---------- */
#game-screen {
  gap: 10px;
  padding: 10px;
  background: #0a0b0f;
  overflow: hidden;
}
#game-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(90% 40% at 50% 0%, rgba(240, 68, 82, 0.1), transparent 60%),
    radial-gradient(90% 40% at 50% 100%, rgba(49, 130, 246, 0.1), transparent 60%),
    linear-gradient(180deg, #0a0b0f 0%, #121319 50%, #0a0b0f 100%);
}

.player-half {
  position: relative;
  z-index: 1;
  flex: 1;
  border: none;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  cursor: pointer;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  overflow: hidden;
  transition: opacity 0.15s, filter 0.15s, box-shadow 0.3s;
}

@keyframes glowPulseRed {
  0%, 100% { box-shadow: 0 0 0 1.5px rgba(240, 68, 82, 0.35), 0 0 0 rgba(240, 68, 82, 0); }
  50% { box-shadow: 0 0 0 1.5px rgba(240, 68, 82, 0.7), 0 0 26px rgba(240, 68, 82, 0.4); }
}
@keyframes glowPulseBlue {
  0%, 100% { box-shadow: 0 0 0 1.5px rgba(49, 130, 246, 0.35), 0 0 0 rgba(49, 130, 246, 0); }
  50% { box-shadow: 0 0 0 1.5px rgba(49, 130, 246, 0.7), 0 0 26px rgba(49, 130, 246, 0.4); }
}
#player1-half:not(.inactive) { animation: glowPulseRed 1.8s ease-in-out infinite; }
#player2-half:not(.inactive) { animation: glowPulseBlue 1.8s ease-in-out infinite; }

.player-half.inactive {
  opacity: 0.45;
  filter: grayscale(0.5);
}

.plus-one {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 0);
  font-size: 28px;
  font-weight: 800;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(243, 210, 122, 0.7);
  pointer-events: none;
  z-index: 5;
  animation: floatUpFade 0.7s ease-out forwards;
}

/* Info (nameplate/score) sits toward the shared center bar, like a scoreboard
   both players can glance at; the press button sits toward the outer edge,
   closest to that player's own reaching hand — this split is what makes a
   HUD read as a HUD instead of a stack of centered form fields. */
.half-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 18px 12px;
}
.half-content.flipped { transform: rotate(180deg); }

.hud-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.action-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Fighter nameplate: character portrait avatar + character/player name stack,
   like a fighting game's in-match HUD tag instead of a plain label */
.fighter-tag {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fighter-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.player-half:not(.inactive) .fighter-avatar.p1 {
  border-color: var(--p1);
  box-shadow: 0 0 12px rgba(240, 68, 82, 0.5);
}
.player-half:not(.inactive) .fighter-avatar.p2 {
  border-color: var(--p2);
  box-shadow: 0 0 12px rgba(49, 130, 246, 0.5);
}
.fighter-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}
.fighter-char {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.4);
}
.fighter-player {
  font-size: 16px;
  font-weight: 800;
}
#player1-half .fighter-player { color: var(--p1); }
#player2-half .fighter-player { color: var(--p2); }
.player-half.inactive .fighter-player {
  color: rgba(255, 255, 255, 0.4);
}

/* Explicit turn callout — reads clearly even mid-glance during a handoff */
.turn-flag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.2);
  visibility: hidden;
}
.player-half:not(.inactive) .turn-flag {
  visibility: visible;
  animation: hint-pulse 1.4s ease-in-out infinite;
}
#player1-half:not(.inactive) .turn-flag { color: #ff8891; }
#player2-half:not(.inactive) .turn-flag { color: #8cb8fb; }

/* LCD-style digital readout, like a physical dual game clock's display */
.lcd-readout {
  display: flex;
  align-items: baseline;
  gap: 5px;
  background: linear-gradient(180deg, #14151a, #060708);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 4px 18px;
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.6),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}
.lcd-digits {
  font-family: "Courier New", "SFMono-Regular", monospace;
  font-size: 46px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.25);
  display: inline-block;
}
.lcd-digits.bump { animation: bump 0.28s ease-out; }
.lcd-suffix {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
}
.player-half:not(.inactive) .lcd-readout.p1 .lcd-digits {
  color: var(--p1);
  text-shadow: 0 0 12px rgba(240, 68, 82, 0.6);
}
.player-half:not(.inactive) .lcd-readout.p2 .lcd-digits {
  color: var(--p2);
  text-shadow: 0 0 12px rgba(49, 130, 246, 0.6);
}

/* Physical push-button, like a real chess/baduk-clock's dome switch */
.clock-button {
  --dome-face: #eef1f5;
  --dome-shadow: #c7cdd6;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 32% 26%, #ffffff, var(--dome-face) 60%, var(--dome-face) 100%);
  box-shadow:
    0 7px 0 var(--dome-shadow),
    0 12px 20px rgba(0, 0, 0, 0.35),
    inset 0 2px 3px rgba(255, 255, 255, 0.9),
    inset 0 -10px 14px rgba(15, 23, 42, 0.06);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.press-icon {
  font-size: 36px;
  filter: drop-shadow(0 2px 2px rgba(15, 23, 42, 0.15));
}

.player-half:not(.inactive) .clock-button.p1 {
  --dome-face: #fddadd;
  --dome-shadow: #ec8891;
}
.player-half:not(.inactive) .clock-button.p2 {
  --dome-face: #dceafe;
  --dome-shadow: #7fadf3;
}

.player-half:active:not(.inactive) .clock-button {
  transform: translateY(5px);
  box-shadow:
    0 2px 0 var(--dome-shadow),
    0 4px 10px rgba(0, 0, 0, 0.35),
    inset 0 2px 3px rgba(255, 255, 255, 0.7),
    inset 0 -6px 10px rgba(15, 23, 42, 0.08);
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.pace {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.06);
  padding: 5px 12px;
  border-radius: 999px;
}

.center-bar {
  position: relative;
  z-index: 1;
  height: 88px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.elapsed {
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}
.center-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pace-unit-switch {
  display: flex;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 3px;
}
.unit-opt {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
}
.unit-opt.active {
  background: var(--gold);
  color: #1a1405;
}
.end-btn {
  background: rgba(240, 68, 82, 0.12);
  color: #ff8891;
  border: 1px solid rgba(240, 68, 82, 0.3);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.end-btn:active { background: rgba(240, 68, 82, 0.22); }

/* ---------- Modal ---------- */
.modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 24px;
  animation: modalFade 0.2s ease both;
}
.modal.active { display: flex; }
.modal-box {
  background: #17181d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 24px;
  width: 100%;
  max-width: 300px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: modalPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.modal-box p {
  margin: 0 0 18px;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}
.modal-actions {
  display: flex;
  gap: 8px;
}
.modal-actions button { flex: 1; }

/* ---------- Result screen: a winner's poster, not a scoreboard ---------- */
#result-screen {
  align-items: center;
  justify-content: center;
  background: #05060a;
  padding: 16px;
  gap: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.result-wrap {
  width: 100%;
  max-width: 340px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.story-card {
  position: relative;
  width: auto;
  max-width: 100%;
  /* Fill whatever vertical space is left after the action buttons below —
     mobile browser chrome (address bar / home indicator) eats into the
     viewport, so a fixed-ratio-from-width card can get clipped off-screen.
     Flexing the height first and deriving width from the 9:16 ratio keeps
     the whole poster + buttons on screen no matter how much chrome shows. */
  flex: 1 1 auto;
  min-height: 0;
  max-height: 480px;
  aspect-ratio: 9 / 16;
  border-radius: 28px;
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(243, 210, 122, 0.14), transparent 60%),
    linear-gradient(160deg, #1c1c1c 0%, #0e0e0e 55%, #000000 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 36px 24px 28px;
  color: #ffffff;
  overflow: hidden;
  box-shadow:
    0 0 0 1.5px rgba(212, 175, 55, 0.5) inset,
    0 12px 30px rgba(0, 0, 0, 0.5);
}
.story-card.tie {
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.25) inset, 0 12px 30px rgba(0, 0, 0, 0.5);
}
.story-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 220%;
  background: linear-gradient(75deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: shimmerSweep 4.5s ease-in-out infinite 0.6s;
  pointer-events: none;
}

.story-rays {
  position: absolute;
  top: -10%;
  left: 50%;
  width: 340px;
  height: 340px;
  transform: translateX(-50%);
  background: repeating-conic-gradient(rgba(243, 210, 122, 0.14) 0deg 4deg, transparent 4deg 16deg);
  border-radius: 50%;
  animation: rotateSlow 26s linear infinite;
  pointer-events: none;
}
.story-card.tie .story-rays { opacity: 0.4; filter: grayscale(1); }

.belt-plate {
  position: relative;
  z-index: 1;
  text-align: center;
  animation: fadeSlideUp 0.5s ease both;
}
.belt-emblem {
  width: 60px;
  height: 60px;
  margin: 0 auto 10px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  background: linear-gradient(135deg, #f6dd8c, #b8860b 60%, #7a5a08);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4) inset, 0 6px 20px rgba(184, 134, 11, 0.5);
  animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both 0.15s;
}
.story-header {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(243, 210, 122, 0.4);
}

.champion-block {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.champion-name {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  animation: fadeSlideUp 0.5s ease both 0.3s;
}
.story-card.champ-p1 .champion-name { color: #ff8891; }
.story-card.champ-p2 .champion-name { color: #8cb8fb; }
.story-card.tie .champion-name { color: rgba(255, 255, 255, 0.85); }

.champion-count {
  font-size: 92px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(243, 210, 122, 0.45);
  animation: fadeSlideUp 0.5s ease both 0.4s;
}
.story-card.tie .champion-count { color: rgba(255, 255, 255, 0.9); text-shadow: none; }
.champion-count small {
  font-size: 22px;
  font-weight: 600;
  margin-left: 6px;
  color: rgba(255, 255, 255, 0.6);
}
.champion-pace {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 12px;
  border-radius: 999px;
  animation: fadeSlideUp 0.5s ease both 0.5s;
}

.opponent-line {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  animation: fadeSlideUp 0.5s ease both 0.6s;
}
.opponent-line span { font-weight: 800; color: rgba(255, 255, 255, 0.7); }

.story-footer {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
}

.result-actions {
  width: 100%;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- Compact layout for shorter phone screens ---------- */
@media (max-height: 720px) {
  .half-content { gap: 5px; }
  .fighter-avatar { width: 32px; height: 32px; font-size: 16px; }
  .fighter-player { font-size: 14px; }
  .lcd-readout { padding: 2px 14px; }
  .lcd-digits { font-size: 34px; }
  .clock-button { width: 88px; height: 88px; }
  .press-icon { font-size: 28px; }
  .turn-flag { font-size: 10px; }
  .pace { font-size: 11px; padding: 4px 10px; }
  .center-bar { height: 76px; }
}

