:root {
  --bg: #070910;
  --surface: #0f1422;
  --surface-2: #161d30;
  --border: #283452;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --gold: #fbbf24;
  --crimson: #ef4444;
  --cyan: #38bdf8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(circle at top, #12182b 0%, var(--bg) 62%);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

button {
  font-family: inherit;
}

kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  padding: 0.1rem 0.42rem;
  border-radius: 4px;
  color: #f8fafc;
  font-family: monospace;
  font-size: 0.8rem;
}

canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Playable Cabinet Layout */
.release-main {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  background: #020308;
}

.play-layout {
  width: 100%;
  height: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.arcade-cabinet {
  width: 100%;
  height: 100%;
  background: #020308;
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cabinet-stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 0;
  touch-action: none;
}

.version-tag {
  position: absolute;
  right: 14px;
  bottom: 10px;
  padding: 2px 6px;
  background: transparent;
  border: none;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.45);
  pointer-events: none;
  z-index: 8;
  user-select: none;
}

.cabinet-stage:fullscreen,
.cabinet-stage:-webkit-full-screen,
.cabinet-stage.pseudo-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  background: #020308;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cabinet-stage.pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.cabinet-stage:fullscreen #game-canvas,
.cabinet-stage:-webkit-full-screen #game-canvas,
.cabinet-stage.pseudo-fullscreen #game-canvas {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  border-radius: 0;
}

/* Cabinet Intro / Options / Credits Overlays */
.cabinet-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: radial-gradient(circle at 50% 38%, rgba(12, 18, 34, 0.58), rgba(3, 5, 12, 0.88));
  border-radius: 6px;
  z-index: 5;
}

.cabinet-overlay.hidden {
  display: none;
}

.title-card {
  text-align: center;
  max-width: 680px;
  width: 100%;
  padding: 1.75rem 2.25rem;
  background: rgba(6, 10, 22, 0.88);
  border: 2px solid rgba(251, 191, 36, 0.6);
  border-radius: 14px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.88), inset 0 0 36px rgba(245, 158, 11, 0.1);
}

.title-eyebrow {
  font-family: 'Cinzel', 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  color: #93c5fd;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.game-main-title {
  margin: 0;
  font-family: 'Cinzel', 'Palatino Linotype', 'Book Antiqua', Palatino, 'Times New Roman', Georgia, serif;
  font-size: clamp(2.5rem, 5.6vw, 3.85rem);
  line-height: 1.04;
  letter-spacing: 0.1em;
  font-weight: 900;
  text-transform: uppercase;
  color: #fde047;
  text-shadow: 0 4px 0 #7f1d1d, 0 8px 18px rgba(0, 0, 0, 0.9), 0 0 32px rgba(251, 191, 36, 0.55);
}

.title-tagline {
  margin: 0.6rem auto 1.35rem;
  max-width: 540px;
  font-family: 'Crimson Pro', 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  font-style: italic;
  font-weight: 600;
  color: #e2e8f0;
  font-size: clamp(1.12rem, 2vw, 1.38rem);
  line-height: 1.35;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

.title-menu {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 260px;
  margin: 0 auto 0.9rem;
}

.menu-btn {
  padding: 0.6rem 1.15rem;
  border-radius: 8px;
  border: 1px solid #475569;
  background: rgba(15, 23, 42, 0.95);
  color: #e2e8f0;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.menu-btn:hover,
.menu-btn:focus-visible,
.menu-btn.selected {
  transform: translateY(-1px) scale(1.02);
  border-color: #fde047;
  background: #1e293b;
  color: #fff;
  box-shadow: 0 0 14px rgba(253, 224, 71, 0.28);
  outline: none;
}

.menu-btn.primary {
  background: linear-gradient(135deg, #b45309, #dc2626);
  border-color: #fbbf24;
  color: #fffbeb;
  box-shadow: 0 0 18px rgba(220, 38, 38, 0.35);
}

.menu-btn.primary:hover,
.menu-btn.primary:focus-visible,
.menu-btn.primary.selected {
  background: linear-gradient(135deg, #d97706, #ef4444);
}

.title-hint {
  font-size: 0.74rem;
  color: #94a3b8;
}

.panel-card {
  width: 100%;
  max-width: 600px;
  background: rgba(6, 10, 22, 0.94);
  border: 2px solid #475569;
  border-radius: 12px;
  padding: 1rem 1.35rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
}

.panel-heading {
  margin: 0 0 0.65rem;
  text-align: center;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  color: #fde047;
}

.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.34rem 0.6rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid #1e293b;
  border-radius: 8px;
  font-size: 0.84rem;
  color: #e2e8f0;
}

.stage-pill {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.34rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.stage-pill.active {
  background: #1d4ed8;
  border-color: #60a5fa;
  color: #fff;
}

.options-controls {
  margin-top: 0.65rem;
  padding: 0.55rem 0.7rem;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid #1e293b;
  border-radius: 8px;
}

.options-controls-title {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #93c5fd;
  margin-bottom: 0.35rem;
  text-align: center;
}

.options-controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 0.75rem;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.credits-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.credit-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.42rem 0.65rem;
  background: rgba(15, 23, 42, 0.75);
  border-left: 3px solid #fbbf24;
  border-radius: 6px;
}

.credit-role {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #93c5fd;
}

.credit-name {
  font-size: 0.84rem;
  color: #f8fafc;
}

.panel-actions {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

/* Mobile Multi-Touch Controls Overlay */
.touch-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.touch-util-btn {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(6, 10, 22, 0.65);
  color: #fde047;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  touch-action: none;
}

.touch-skip-btn {
  top: max(10px, env(safe-area-inset-top));
  bottom: auto;
  left: auto;
  right: max(16px, env(safe-area-inset-right));
  transform: none;
}

.touch-stick-zone {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 146px;
  height: 146px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
}

.touch-stick-base {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(6, 10, 22, 0.45);
  border: 2px solid rgba(251, 191, 36, 0.38);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.55);
}

.touch-stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  margin-top: -24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(253, 224, 71, 0.82), rgba(180, 83, 9, 0.75));
  border: 2px solid rgba(254, 240, 138, 0.85);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  transition: transform 0.04s linear;
}

.touch-actions {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.touch-actions-top,
.touch-actions-main {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.touch-btn {
  pointer-events: auto;
  border-radius: 50%;
  border: 2px solid rgba(251, 191, 36, 0.45);
  background: rgba(6, 10, 22, 0.56);
  color: #f8fafc;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 800;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

.touch-btn.active {
  transform: scale(0.93);
  border-color: #fde047;
  background: rgba(30, 41, 59, 0.85);
  box-shadow: 0 0 14px rgba(253, 224, 71, 0.4);
}

.touch-btn-lg {
  width: 76px;
  height: 76px;
  font-size: 0.84rem;
}

.touch-btn-md {
  width: 62px;
  height: 62px;
  font-size: 0.72rem;
}

.touch-btn-sm {
  width: 54px;
  height: 54px;
  font-size: 0.66rem;
}

.touch-btn-atk {
  border-color: rgba(239, 68, 68, 0.65);
  background: rgba(127, 29, 29, 0.52);
}

.touch-btn-jmp {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(3, 105, 161, 0.52);
}

.touch-btn-smite.smite-ready {
  border-color: #fde047;
  color: #fde047;
  box-shadow: 0 0 16px rgba(253, 224, 71, 0.55);
}

@media (max-width: 760px), (pointer: coarse) {
  .touch-stick-zone {
    width: 136px;
    height: 136px;
  }
  .touch-stick-base {
    width: 104px;
    height: 104px;
  }
  .touch-stick-knob {
    width: 44px;
    height: 44px;
    margin-left: -22px;
    margin-top: -22px;
  }
  .touch-actions,
  .touch-actions-top,
  .touch-actions-main {
    gap: 12px;
  }
  .touch-btn-lg {
    width: 74px;
    height: 74px;
    font-size: 0.84rem;
  }
  .touch-btn-md {
    width: 60px;
    height: 60px;
    font-size: 0.7rem;
  }
  .touch-btn-sm {
    width: 52px;
    height: 52px;
    font-size: 0.64rem;
  }
}

/* Light a Candle (Donation) & Victory Overlays */
.menu-btn.donate-btn {
  border-color: rgba(251, 191, 36, 0.58);
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.72), rgba(30, 41, 59, 0.92));
  color: #fef08a;
}

.menu-btn.donate-btn:hover,
.menu-btn.donate-btn:focus-visible,
.menu-btn.donate-btn.selected {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.88), rgba(146, 64, 14, 0.92));
  border-color: #fde047;
  color: #fffbeb;
}

.donate-subtitle {
  text-align: center;
  font-family: 'Crimson Pro', Georgia, serif;
  font-style: italic;
  font-size: 0.96rem;
  color: #cbd5e1;
  margin: -0.25rem 0 0.85rem;
}

.donate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

@media (max-width: 520px) {
  .donate-grid {
    grid-template-columns: 1fr;
  }
}

.donate-tier-btn,
.donate-custom-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.donate-tier-btn:hover,
.donate-custom-btn:hover {
  transform: translateY(-1px);
  border-color: #fde047;
  background: #1e293b;
}

.donate-tier-btn.popular {
  border-color: rgba(251, 191, 36, 0.75);
  background: rgba(120, 53, 15, 0.28);
  box-shadow: inset 0 0 18px rgba(251, 191, 36, 0.12);
}

.donate-tier-head {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fde047;
}

.donate-tier-price {
  color: #fffbeb;
  font-size: 0.9rem;
}

.donate-tier-desc {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 0.82rem;
  color: #94a3b8;
}

.donate-badge {
  position: absolute;
  top: -7px;
  right: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fbbf24;
  color: #090c14;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.donate-custom-btn {
  width: 100%;
  margin-top: 0.55rem;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  border-style: dashed;
  border-color: rgba(147, 197, 253, 0.45);
}

.donate-notice {
  margin-top: 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fde047;
  font-size: 0.78rem;
  text-align: center;
}

.victory-card {
  text-align: center;
}

.victory-score {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #93c5fd;
  margin-bottom: 0.65rem;
}

.victory-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.95rem;
}

.candle-flicker {
  display: inline-block;
  transform-origin: bottom center;
  animation: candleFlicker 1.35s infinite alternate ease-in-out;
}

@keyframes candleFlicker {
  0% {
    transform: scale(1) skewX(0deg);
    text-shadow: 0 0 6px rgba(251, 191, 36, 0.75);
    filter: brightness(1);
  }
  25% {
    transform: scale(1.06, 0.96) skewX(-3deg);
    text-shadow: 0 0 12px rgba(249, 115, 22, 0.95);
    filter: brightness(1.18);
  }
  55% {
    transform: scale(0.97, 1.08) skewX(3deg);
    text-shadow: 0 0 15px rgba(253, 224, 71, 1);
    filter: brightness(1.25);
  }
  80% {
    transform: scale(1.04, 0.98) skewX(-2deg);
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
    filter: brightness(1.05);
  }
  100% {
    transform: scale(1.02, 1.05) skewX(2deg);
    text-shadow: 0 0 14px rgba(253, 224, 71, 0.95);
    filter: brightness(1.2);
  }
}
