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

:root {
  --bg:             #0f1923;
  --surface:        #1a2a3a;
  --letter-idle:    #1e3a5f;
  --letter-select:  #64c8ff;
  --letter-first:   #f0a500;
  --accent:         #64c8ff;
  --accent-gold:    #f0a500;
  --text:           #ffffff;
  --text-muted:     rgba(255, 255, 255, 0.45);
  --slot-bg:        rgba(255, 255, 255, 0.06);
  --slot-border:    rgba(255, 255, 255, 0.18);
  --slot-found-bg:  rgba(100, 200, 255, 0.12);
  --slot-found-bd:  #64c8ff;
  --valid:          #4caf50;
  --invalid:        #ef5350;
  --duplicate:      #ff9800;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ─── App shell ──────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  height: 100%;
  padding: 20px 16px 28px;
  gap: 14px;
}

/* ─── Header ─────────────────────────────────────────────── */

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-shrink: 0;
}

#logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent);
}

#level-indicator {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

#bonus-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-gold);
  min-width: 80px;
  text-align: right;
}

/* ─── Word slots ─────────────────────────────────────────── */

#word-slots {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  flex-shrink: 0;
}

.word-row {
  display: flex;
  gap: 5px;
}

.letter-box {
  width: 32px;
  height: 32px;
  border: 2px solid var(--slot-border);
  border-radius: 6px;
  background: var(--slot-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text);
}

.letter-box.revealed {
  background: var(--slot-found-bg);
  border-color: var(--slot-found-bd);
  animation: pop 0.22s ease forwards;
}

@keyframes pop {
  0%   { transform: scale(0.75); opacity: 0.5; }
  65%  { transform: scale(1.18); }
  100% { transform: scale(1);    opacity: 1; }
}

/* ─── Current word display ───────────────────────────────── */

#current-word {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  min-height: 2.2rem;
  text-transform: uppercase;
  text-align: center;
  flex-shrink: 0;
  color: var(--text);
}

#current-word.feedback-valid {
  animation: flash-colour 0.4s ease;
  --flash: var(--valid);
}

#current-word.feedback-invalid {
  animation: flash-colour 0.4s ease;
  --flash: var(--invalid);
}

#current-word.feedback-duplicate {
  animation: flash-colour 0.4s ease;
  --flash: var(--duplicate);
}

@keyframes flash-colour {
  0%, 100% { color: var(--text); }
  40%       { color: var(--flash); }
}

/* ─── Wheel ──────────────────────────────────────────────── */

#wheel-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

#wheel {
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ─── Win overlay ────────────────────────────────────────── */

#win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.3s ease;
}

#win-overlay.hidden {
  display: none;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#win-card {
  background: var(--surface);
  border: 1px solid rgba(100, 200, 255, 0.2);
  border-radius: 24px;
  padding: 44px 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: slide-up 0.35s ease;
}

@keyframes slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#win-icon {
  font-size: 2.4rem;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

#win-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
}

#win-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  min-height: 1.2em;
}

#win-btn {
  margin-top: 12px;
  padding: 14px 44px;
  background: var(--accent);
  color: #0a1520;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

#win-btn:active {
  opacity: 0.85;
  transform: scale(0.97);
}
