:root {
  --bg-night: #120f1f;
  --bg-violet: #25174b;
  --bg-fire: #ff6f3c;
  --bg-acid: #f6cf4e;
  --text-main: #fff7ea;
  --text-soft: rgba(255, 247, 234, 0.75);
  --panel: rgba(14, 19, 40, 0.82);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top, rgba(255, 207, 78, 0.18), transparent 24%),
    radial-gradient(circle at 20% 20%, rgba(98, 230, 255, 0.2), transparent 22%),
    radial-gradient(circle at 80% 16%, rgba(255, 127, 209, 0.18), transparent 20%),
    linear-gradient(145deg, #090810 0%, var(--bg-night) 35%, var(--bg-violet) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.75), transparent);
}

button, select, input { font: inherit; }
h1, h2, h3, p, ul { margin-top: 0; }

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255, 212, 105, 0.08), rgba(9, 8, 16, 0.82) 55%);
  backdrop-filter: blur(8px);
}

.showdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 39;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle, rgba(98, 230, 255, 0.06), rgba(9, 8, 16, 0.84) 58%);
  backdrop-filter: blur(8px);
}

.showdown-panel {
  width: min(940px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px 32px;
  border-radius: 32px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(17,22,46,0.97), rgba(11,15,30,0.98));
  box-shadow:
    0 0 0 14px rgba(255,255,255,0.04),
    0 24px 80px rgba(0,0,0,0.42);
  animation: result-rise 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.overlay-dismiss-note {
  margin-bottom: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(255,247,234,0.72);
}

.showdown-kicker {
  justify-self: center;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,247,234,0.68);
}

.showdown-statline {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.showdown-statline span:first-child {
  font-family: "Bangers", cursive;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 0.95;
  letter-spacing: 0.05em;
  color: #fff5d8;
}

.showdown-statline span:last-child {
  font-size: 1rem;
  font-weight: 800;
  color: rgba(255,212,105,0.95);
}

.showdown-versus {
  display: grid;
  grid-template-columns: 1fr 110px 1fr;
  gap: 18px;
  align-items: center;
}

.showdown-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}

.showdown-card-left {
  box-shadow: inset 0 0 0 1px rgba(98,230,255,0.15);
}

.showdown-card-right {
  box-shadow: inset 0 0 0 1px rgba(255,127,209,0.15);
}

.showdown-label {
  margin-bottom: 0;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,247,234,0.62);
}

.showdown-card h3 {
  margin-bottom: 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.05;
}

.showdown-value-wrap {
  display: grid;
  place-items: center;
  min-height: 150px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
}

.showdown-value {
  font-family: "Bangers", cursive;
  font-size: clamp(4rem, 12vw, 6rem);
  line-height: 1;
  letter-spacing: 0.06em;
  color: #fff5d8;
}

.showdown-vs-badge {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 50%;
  font-family: "Bangers", cursive;
  font-size: 2rem;
  letter-spacing: 0.08em;
  color: #221335;
  background: linear-gradient(135deg, #ffd469, #ff8a5b);
  box-shadow: 0 18px 36px rgba(255,138,91,0.35);
}

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle, rgba(255, 212, 105, 0.08), rgba(9, 8, 16, 0.86) 55%);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.result-overlay-panel {
  display: grid;
  gap: 10px;
  justify-items: center;
  width: min(760px, 100%);
  padding: 28px 34px;
  border-radius: 32px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(135deg, rgba(255,111,60,0.96), rgba(255,212,105,0.96));
  color: #1b1024;
  box-shadow:
    0 0 0 18px rgba(255,255,255,0.05),
    0 24px 80px rgba(255,138,91,0.35);
  animation: result-rise 520ms cubic-bezier(0.22, 1, 0.36, 1);
  text-align: center;
}

.result-overlay h2,
.result-overlay p {
  margin-bottom: 0;
}

.result-badge {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#result-title {
  font-family: "Bangers", cursive;
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0.04em;
}

#result-subtitle {
  font-size: clamp(1.05rem, 3vw, 1.45rem);
  font-weight: 800;
}

.countdown-number {
  min-width: 180px;
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 20px;
  border-radius: 50%;
  font-family: "Bangers", cursive;
  font-size: clamp(5rem, 14vw, 8rem);
  line-height: 1;
  letter-spacing: 0.08em;
  color: #1b1024;
  background: linear-gradient(135deg, #ffd469, #ff8a5b);
  box-shadow:
    0 0 0 16px rgba(255, 255, 255, 0.06),
    0 24px 80px rgba(255, 138, 91, 0.4);
  animation: countdown-pop 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-panel, .panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-panel::after, .panel::after {
  content: "";
  position: absolute;
  inset: auto -10% -60% auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
  pointer-events: none;
}

.eyebrow, .panel-kicker {
  margin: 0 0 8px;
  font-family: "Bangers", cursive;
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  color: var(--bg-acid);
}

h1 {
  margin-bottom: 12px;
  font-family: "Bangers", cursive;
  font-size: clamp(3.5rem, 9vw, 6rem);
  line-height: 0.9;
  letter-spacing: 0.04em;
}

.tagline {
  font-size: clamp(1.15rem, 3vw, 1.65rem);
  font-weight: 700;
  color: #ffeec3;
}

.intro { color: var(--text-soft); line-height: 1.55; }

.hero-panel {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  padding: 28px;
  margin-bottom: 24px;
}

.hero-actions, .sidebar, .stage-panel { display: grid; gap: 24px; }
.hero-actions { align-content: center; gap: 12px; }

.config-stage {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 24px;
  margin-bottom: 24px;
}

.panel { padding: 24px; }

.mode-grid, .control-grid, .metric-grid, .remote-hand-grid { display: grid; gap: 14px; }
.mode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.control-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.remote-hand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }

.action-button, .mini-action, .mode-pill, .toggle-button, .reveal-card {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, opacity 180ms ease;
}

.action-button:hover, .mini-action:hover, .mode-pill:hover, .toggle-button:hover, .reveal-card:hover { transform: translateY(-2px); }
.action-button { padding: 14px 18px; font-weight: 800; background: linear-gradient(135deg, #fff0cf, #ffd168); color: #120f1f; }
.action-button-primary { background: linear-gradient(135deg, var(--bg-fire), #ffd168); box-shadow: 0 18px 34px rgba(255,111,60,0.3); }
.mini-action { padding: 10px 14px; background: rgba(255,255,255,0.1); color: var(--text-main); }
.mode-pill { padding: 12px 16px; font-weight: 800; background: rgba(255,255,255,0.08); color: var(--text-main); }
.mode-pill.is-active { background: linear-gradient(135deg, rgba(255,111,60,0.9), rgba(255,209,104,0.95)); color: #1b1024; }
.toggle-button { padding: 14px 18px; font-weight: 800; background: linear-gradient(135deg, #fff0cf, #ffd168); color: #120f1f; }

.control { display: grid; gap: 8px; }
.control span, .metric-grid span, .stat-meta, .mask-label { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-soft); }

select, input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  color: var(--text-main);
}

select option { color: #120f1f; }

.options-panel { margin-top: 18px; border-radius: 22px; background: rgba(255,255,255,0.05); }
.options-panel summary { padding: 16px 18px; cursor: pointer; font-weight: 800; list-style: none; }
.options-panel summary::-webkit-details-marker { display: none; }
.options-panel[open] .control-grid { padding: 0 18px 18px; margin-top: 4px; }

.announcer {
  margin-top: 22px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(140deg, rgba(255,111,60,0.18), rgba(98,230,255,0.12));
}

.announcer.alt { background: linear-gradient(140deg, rgba(255,127,209,0.16), rgba(255,209,104,0.14)); }

.battlefield {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
}

.terrain-art-wrap, .portrait-card, .reveal-card {
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}

.terrain-art-wrap img, .portrait-card img, .reveal-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.stage-topline, .fighter-head, .stat-label-row, .stage-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255,255,255,0.1);
}

.portrait-stack { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; margin: 18px 0; }
.portrait-stack-large { grid-template-columns: 1.2fr 0.9fr; }
.portrait-card-weapon img, #active-weapon-reveal img { object-fit: contain; padding: 14px; background: transparent; }

.reveal-card {
  position: relative;
  padding: 0;
  min-height: 540px;
  background:
    radial-gradient(circle at top, rgba(255,209,104,0.18), transparent 28%),
    linear-gradient(145deg, rgba(28,36,70,0.94), rgba(17,21,44,0.98));
  transform-style: preserve-3d;
  perspective: 1200px;
}

.reveal-card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  transition: opacity 240ms ease, transform 620ms cubic-bezier(0.22,1,0.36,1);
}

.reveal-card-back {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.animal-back .reveal-card-back,
.portrait-card-masked.animal-back::before {
  background-image: url("./assets/Card Back - Animals.png");
}

.weapon-back .reveal-card-back,
.portrait-card-masked.weapon-back::before {
  background-image: url("./assets/Card Back - Weapons.png");
}

.reveal-card-front { opacity: 0; transform: rotateY(180deg) scale(0.96); padding: 10px; }
.reveal-card.is-revealed .reveal-card-back { opacity: 0; transform: rotateY(180deg) scale(1.02); }
.reveal-card.is-revealed .reveal-card-front { opacity: 1; transform: rotateY(360deg) scale(1); }

.reveal-card.is-bursting, .portrait-card.is-bursting { animation: burst-entry 700ms cubic-bezier(0.22, 1, 0.36, 1); }

.reveal-card.is-bursting::after,
.portrait-card.is-bursting::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 28px;
  border: 3px solid rgba(255,212,105,0.92);
  box-shadow: 0 0 28px rgba(255,212,105,0.32);
  animation: burst-outline 700ms ease-out;
  pointer-events: none;
}

.portrait-card { position: relative; }
.portrait-card .card-shell { height: 100%; }
.portrait-card-masked::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  transition: opacity 260ms ease;
}
.portrait-card-masked img { opacity: 0; transform: scale(0.92); transition: opacity 260ms ease, transform 360ms ease; }
.portrait-card-masked.is-revealed img { opacity: 1; transform: scale(1); }
.portrait-card-masked.is-revealed::before { opacity: 0; pointer-events: none; }
.mask-label {
  position: absolute;
  z-index: 2;
  inset: auto 14px 14px 14px;
  padding: 10px 12px;
  border-radius: 14px;
  text-align: center;
  background: rgba(10,14,28,0.78);
}
.portrait-card-masked.is-revealed .mask-label { display: none; }

.full-card .reveal-card-front,
.portrait-card .card-shell {
  display: grid;
}

.card-shell {
  align-content: start;
  gap: 10px;
  width: 100%;
  min-height: 100%;
  padding: 18px;
  border-radius: 22px;
  border: 2px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(15,19,40,0.96), rgba(10,13,28,0.98));
  grid-template-rows: auto auto auto 1fr;
}

.card-shell-animal {
  box-shadow: inset 0 0 0 1px rgba(98,230,255,0.18);
}

.card-shell-weapon {
  box-shadow: inset 0 0 0 1px rgba(255,212,105,0.18);
}

.card-topline {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,247,234,0.6);
}

.card-title {
  font-family: "Bangers", cursive;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 0.95;
  letter-spacing: 0.03em;
  color: #fff5d8;
  min-height: 0.95em;
}

.card-shell img {
  width: 100%;
  height: 270px;
  object-fit: contain;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

.card-shell-weapon img {
  object-fit: contain;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}

.card-copy {
  color: var(--text-soft);
  font-size: 1.05rem;
  line-height: 1.52;
}

.stats-list { display: grid; gap: 12px; }
.stat-row { display: grid; gap: 8px; }
.stat-bar { position: relative; height: 16px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,0.08); }
.stat-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; transition: width 620ms cubic-bezier(0.22,1,0.36,1), filter 220ms ease; }
.stat-fill-base { background: linear-gradient(90deg, #5fd3ff, #a8f5ff); }
[data-seat="opponent"] .stat-fill-base { background: linear-gradient(90deg, #ff7cc9, #ffc8ea); }
.stat-fill-bonus { background: linear-gradient(90deg, rgba(255,212,105,0.28), rgba(255,212,105,0.95)); box-shadow: 0 0 24px rgba(255,212,105,0.4); }
.stat-row.is-focus .stat-fill-base, .stat-row.is-focus .stat-fill-bonus { filter: saturate(1.25) brightness(1.08); }
.stat-meta { min-height: 1em; color: rgba(255,247,234,0.55); }

.chooser-panel { margin-top: 18px; padding: 16px; border-radius: 20px; background: rgba(255,255,255,0.05); }
.stat-choice-buttons { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stat-choice-button {
  padding: 12px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  color: var(--text-main);
  font-weight: 700;
  cursor: pointer;
}
.stat-choice-button.is-active { background: linear-gradient(135deg, rgba(255,111,60,0.95), rgba(255,209,104,0.95)); color: #1b1024; }

.versus-reveal { position: relative; }
.versus-badge {
  position: absolute;
  inset: -18px auto auto calc(50% - 46px);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  font-family: "Bangers", cursive;
  font-size: 2rem;
  letter-spacing: 0.08em;
  color: #221335;
  background: linear-gradient(135deg, #ffd469, #ff8a5b);
  box-shadow: 0 18px 36px rgba(255,138,91,0.35);
}

.metric-grid div { padding: 14px; border-radius: 18px; background: rgba(255,255,255,0.06); }
.metric-grid strong { display: block; margin-top: 4px; font-size: 1.15rem; }

.fighter-card.is-winner { box-shadow: var(--shadow), 0 0 0 1px rgba(141,255,139,0.24), 0 0 60px rgba(141,255,139,0.16); }
.fighter-card.is-winner .status-badge { background: rgba(141,255,139,0.18); color: #8dff8b; }

.hand-list { margin: 0; padding-left: 18px; color: var(--text-soft); line-height: 1.6; }
.is-hidden { display: none !important; }

@keyframes burst-entry {
  0% { transform: scale(0.8); box-shadow: 0 0 0 rgba(255,209,104,0); }
  48% { transform: scale(1.06); box-shadow: 0 0 50px rgba(255,209,104,0.28); }
  100% { transform: scale(1); box-shadow: none; }
}

@keyframes burst-glow {
  0% { opacity: 0; transform: scale(0.3); }
  30% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.4); }
}

@keyframes burst-outline {
  0% { opacity: 0; transform: scale(0.92); }
  25% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0; transform: scale(1.08); }
}

@keyframes result-rise {
  0% { opacity: 0; transform: translateY(24px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes countdown-pop {
  0% { transform: scale(0.4); opacity: 0; }
  35% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 1220px) {
  .hero-panel, .config-stage, .battlefield { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portrait-stack-large { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app-shell { width: min(100% - 20px, 100%); padding-top: 16px; }
  .hero-panel, .panel { padding: 18px; }
  .mode-grid, .control-grid, .metric-grid, .portrait-stack, .portrait-stack-large, .stat-choice-buttons, .remote-hand-grid, .sidebar { grid-template-columns: 1fr; }
  .showdown-versus { grid-template-columns: 1fr; }
  .reveal-card { min-height: 460px; }
  .card-shell img { height: 220px; }
  .card-copy { font-size: 0.98rem; }
  .stage-topline, .fighter-head { align-items: start; flex-direction: column; }
  .versus-badge { position: static; margin: 0 auto -10px; }
}
