:root {
  --bg: #2b1a33;
  --bg-panel: rgba(50, 30, 55, 0.82);
  --gold: #ffaa5e;
  --gold-dim: rgba(255, 170, 94, 0.3);
  --cream: #fff5e6;
  --cream-muted: rgba(255, 245, 230, 0.65);
  --danger: #ff6688;
  --border-radius: 0px;
  --btn-border-radius: 0px;
  --font-family: 'Press Start 2P', monospace;
  --text-highlight: #ffd866;
}

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

html,
body {
  width: 100%;
  height: 100%;
}

body {
  overflow: hidden;
  color: var(--cream);
  font-family: var(--font-family);
  background: var(--bg);
  touch-action: none;
  user-select: none;
}

#game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Panels ────────────────────────────────── */

.panel {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(92vw, 480px);
  transform: translate(-50%, -50%);
  background: var(--bg-panel);
  border: 1px solid var(--gold);
  border-radius: var(--border-radius);
  padding: clamp(1.5rem, 4vw, 2.4rem);
  text-align: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 0 40px rgba(212, 175, 55, 0.12);
  animation: panel-in 500ms ease;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translate(-50%, -46%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.kicker {
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  background: linear-gradient(to right, var(--text-highlight), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h1,
h2 {
  margin-top: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(to bottom, var(--text-highlight), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
}

h2 {
  font-size: clamp(1.5rem, 4.5vw, 2.2rem);
}

.subtitle,
.tip,
.result-line {
  margin-top: 0.8rem;
  color: var(--cream-muted);
  line-height: 1.6;
  font-size: 0.92rem;
}

.tip {
  font-size: 0.78rem;
  margin-top: 1rem;
  color: rgba(252, 238, 167, 0.45);
}

/* ── Buttons ───────────────────────────────── */

.primary-button,
.ghost-button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  border-radius: var(--btn-border-radius);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: all 0.3s ease;
}

.primary-button:active,
.ghost-button:active {
  transform: translateY(1px) scale(0.98);
}

.primary-button {
  width: 100%;
  margin-top: 1.2rem;
  padding: 0.9rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--gold);
  color: var(--cream);
  font-weight: 700;
  font-size: 0.88rem;
}

.primary-button:hover {
  background: rgba(212, 175, 55, 0.2);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.ghost-button {
  width: 100%;
  padding: 0.8rem 1rem;
  margin-top: 0.6rem;
  background: transparent;
  border: 1px solid var(--gold-dim);
  color: var(--cream-muted);
  font-size: 0.82rem;
}

.ghost-button:hover {
  border-color: var(--gold);
  color: var(--cream);
}

/* ── HUD ───────────────────────────────────── */

#hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  z-index: 6;
  pointer-events: none;
}

.chip {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  padding: 0.35rem 0.85rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--cream);
  backdrop-filter: blur(6px);
}

/* ── Ability Chips ─────────────────────────── */

#shield-chip.shield-active { border-color: #ff88aa; color: #ff88aa; }
#shield-chip.shield-ready  { border-color: var(--gold); color: var(--gold); }
#shield-chip.shield-cd     { border-color: var(--cream-muted); color: var(--cream-muted); }

/* ── Status Line ───────────────────────────── */

#status-line {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  backdrop-filter: blur(6px);
}

/* ── Gesture Preview ───────────────────────── */

#gesture-preview {
  position: absolute;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  width: 170px;
  aspect-ratio: 4 / 3;
  z-index: 7;
  border-radius: 2px;
  border: 1px solid var(--gold-dim);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.7);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

#gesture-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  opacity: 0.7;
}

#gesture-indicator {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  text-align: center;
  font-size: 0.65rem;
  padding: 0.15rem 0.3rem;
  color: var(--cream-muted);
  letter-spacing: 0.08em;
}

/* ── Result Actions ────────────────────────── */

.result-actions {
  margin-top: 0.9rem;
}

/* ── Utility ───────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Responsive ────────────────────────────── */

@media (max-width: 760px) {
  #gesture-preview {
    width: 120px;
    right: 8px;
  }

  .chip {
    font-size: 0.68rem;
  }
}
