:root {
  --bg-image: url('assets/zoe-background.webp');
  /* Fallback that matches the sunset meadow if the image is missing */
  --bg-fallback: linear-gradient(180deg, #5b74c9 0%, #f3a85c 28%, #8fae6a 45%, #3f7a35 70%, #2c5a26 100%);
  --glass: rgba(28, 22, 48, 0.42);
  --glass-border: rgba(255, 236, 200, 0.35);
  --text: #fff8ec;
  --accent: #ffc56b;
  --accent-ink: #3a2410;
  --stage-ratio: 941 / 1672;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1b1630;
  color: var(--text);
  font-family: 'Fredoka', system-ui, sans-serif;
}

/* Blurred copy of the scene that fills any space around the portrait stage */
.backdrop {
  position: fixed;
  inset: -40px;
  background: var(--bg-image) center / cover no-repeat, var(--bg-fallback);
  filter: blur(28px) brightness(0.6) saturate(1.1);
}

/* Portrait stage that keeps the picture's 9:16 shape */
.stage {
  position: relative;
  height: 100dvh;
  max-width: 100vw;
  aspect-ratio: var(--stage-ratio);
  margin: 0 auto;
  background: var(--bg-image) center / cover no-repeat, var(--bg-fallback);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.55);
}

/* On narrow screens (phones) fill the whole screen instead */
@media (max-aspect-ratio: 941 / 1672) {
  .stage { width: 100vw; height: 100dvh; aspect-ratio: auto; }
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene:active { cursor: grabbing; }

.status {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  font-size: 15px;
  text-align: center;
  max-width: calc(100% - 32px);
  transition: opacity 0.4s;
}
.status.hidden { opacity: 0; pointer-events: none; }

/* "Choose your fighter" header */
.fighter-select {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(14px, env(safe-area-inset-top)) 16px 22px;
  text-align: center;
  background: linear-gradient(to bottom, rgba(20, 14, 36, 0.75) 40%, transparent);
  pointer-events: none; /* let drags through to the character */
}

.fighter-select h1 {
  margin: 0 0 10px;
  font-family: 'Bungee', 'Fredoka', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(22px, 7.5vmin, 34px);
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 2px 0 #7a3d12, 0 0 3px rgba(40, 18, 4, 0.9), 0 4px 14px rgba(0, 0, 0, 0.7);
}

.fighters {
  display: flex;
  justify-content: center;
  gap: 10px;
  pointer-events: auto;
}

.fighter-select .fighters button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 48px;
  padding: 8px 20px;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fighters button small {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0.85;
}

.fighters button:disabled {
  cursor: default;
  opacity: 0.6;
  transform: none;
}

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 16px 16px max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(20, 14, 36, 0.55), transparent);
}

.controls button,
.fighters button {
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  padding: 11px 20px;
  min-width: 88px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 0.12s, background 0.2s, color 0.2s;
}
.controls button:hover,
.fighters button:not(:disabled):not([aria-pressed='true']):hover { transform: translateY(-2px); background: rgba(60, 44, 90, 0.6); }
.controls button:active,
.fighters button:not(:disabled):active { transform: translateY(1px) scale(0.97); }
.controls button:focus-visible,
.fighters button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.controls button[aria-pressed='true'],
.fighters button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
