:root {
  --bg: #0b1020;
  --bg-soft: rgba(11, 16, 32, 0.72);
  --surface: rgba(18, 27, 54, 0.82);
  --surface-strong: rgba(23, 34, 68, 0.92);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f8fbff;
  --muted: #a9b5d0;
  --accent: #00e5a8;
  --accent-2: #ff7a18;
  --danger: #ff5470;
  --warning: #ffd166;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(0, 229, 168, 0.2), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 122, 24, 0.22), transparent 30%),
    linear-gradient(135deg, #050816 0%, #0b1020 48%, #131a32 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.app {
  position: relative;
  z-index: 1;
  width: min(100%, 1040px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 16px;
  display: grid;
  place-items: center;
}

.noise {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}

.bg-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(50px);
  opacity: 0.5;
}

.orb-a {
  width: 240px;
  height: 240px;
  top: 6%;
  left: -40px;
  background: rgba(0, 229, 168, 0.3);
}

.orb-b {
  width: 300px;
  height: 300px;
  right: -60px;
  bottom: 10%;
  background: rgba(255, 122, 24, 0.28);
}

.screen {
  display: none;
  width: 100%;
}

.screen-active {
  display: block;
  animation: screen-in 280ms ease;
}

.card {
  width: 100%;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
}

.hero-card,
.info-card,
.end-card {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px;
}

.game-card {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent);
}

h1,
h2 {
  font-family: "Sora", sans-serif;
  margin: 0;
  line-height: 0.98;
}

h1 {
  font-size: clamp(3rem, 11vw, 5.8rem);
}

h2 {
  font-size: clamp(2rem, 7vw, 3.4rem);
}

.subtitle {
  margin: 18px 0 0;
  max-width: 560px;
  color: var(--muted);
  font-size: clamp(1rem, 2.6vw, 1.15rem);
  line-height: 1.6;
}

.difficulty-picker,
.menu-actions,
.menu-stats,
.answer-actions,
.results-grid,
.instructions-grid {
  display: grid;
  gap: 12px;
}

.difficulty-picker,
.menu-actions,
.answer-actions {
  margin-top: 26px;
}

.difficulty-picker {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.difficulty-btn,
.btn {
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    opacity 180ms ease;
}

.difficulty-btn {
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  font-weight: 700;
}

.difficulty-btn:hover,
.btn:hover {
  transform: translateY(-2px);
}

.difficulty-btn.is-selected {
  background: linear-gradient(135deg, rgba(0, 229, 168, 0.22), rgba(0, 229, 168, 0.08));
  border-color: rgba(0, 229, 168, 0.5);
  box-shadow: 0 0 0 1px rgba(0, 229, 168, 0.12), 0 14px 30px rgba(0, 229, 168, 0.12);
}

.btn {
  padding: 16px 18px;
  font-weight: 700;
}

.btn-primary {
  color: #051018;
  background: linear-gradient(135deg, #00e5a8, #4fffb9);
  box-shadow: 0 18px 36px rgba(0, 229, 168, 0.25);
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.menu-stats,
.results-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}

.stat-chip,
.result-box,
.instruction-step,
.hud-block,
.demo-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
}

.stat-chip,
.result-box {
  padding: 16px;
}

.stat-chip span,
.result-box span,
.hud-block span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.stat-chip strong,
.result-box strong,
.hud-block strong {
  font-size: 1.35rem;
}

.panel-header {
  margin-bottom: 24px;
}

.instructions-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.instruction-step {
  padding: 18px;
}

.instruction-step span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: rgba(0, 229, 168, 0.18);
  color: var(--accent);
  font-weight: 700;
}

.instruction-step p,
.demo-copy,
.demo-answer {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.demo-card {
  margin: 22px 0 26px;
  padding: 22px;
  text-align: center;
}

.demo-label {
  margin: 0;
  color: var(--warning);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
}

.demo-word {
  font-family: "Sora", sans-serif;
  font-size: clamp(2.6rem, 10vw, 4.6rem);
  margin: 10px 0 12px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hud-block {
  padding: 14px 16px;
}

.timer-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
}

.timer-bar {
  flex: 1;
  height: 14px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.timer-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #00e5a8 0%, #ffd166 70%, #ff5470 100%);
  transform-origin: left center;
  transition: transform 90ms linear, background 180ms ease;
}

.timer-text {
  min-width: 54px;
  text-align: right;
  color: var(--muted);
  font-weight: 700;
}

.play-zone {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 18px 8px;
}

.word-display {
  font-family: "Sora", sans-serif;
  font-size: clamp(3.6rem, 14vw, 8rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  text-wrap: balance;
}

.feedback {
  margin: 16px 0 0;
  min-height: 28px;
  color: var(--muted);
  font-size: 1rem;
}

.feedback.is-correct {
  color: var(--accent);
}

.feedback.is-wrong {
  color: var(--danger);
}

.answer-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.btn-answer {
  min-height: 68px;
  font-size: 1.05rem;
}

.btn-match {
  background: linear-gradient(135deg, rgba(0, 229, 168, 0.2), rgba(79, 255, 185, 0.12));
  color: var(--text);
  border: 1px solid rgba(0, 229, 168, 0.26);
}

.btn-mismatch {
  background: linear-gradient(135deg, rgba(255, 84, 112, 0.22), rgba(255, 122, 24, 0.16));
  color: var(--text);
  border: 1px solid rgba(255, 84, 112, 0.24);
}

.flash-correct .game-card {
  box-shadow: 0 0 0 1px rgba(0, 229, 168, 0.22), 0 24px 80px rgba(0, 229, 168, 0.16);
}

.flash-wrong .game-card {
  box-shadow: 0 0 0 1px rgba(255, 84, 112, 0.22), 0 24px 80px rgba(255, 84, 112, 0.16);
}

.btn:focus-visible,
.difficulty-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 720px) {
  .hero-card,
  .info-card,
  .end-card {
    padding: 40px;
  }

  .game-card {
    padding: 24px;
  }

  .hud {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .menu-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 719px) {
  .menu-stats,
  .results-grid,
  .instructions-grid,
  .difficulty-picker,
  .answer-actions {
    grid-template-columns: 1fr;
  }

  .app {
    padding: 16px 12px;
  }

  .hero-card,
  .info-card,
  .end-card,
  .game-card {
    padding: 18px;
    border-radius: 24px;
  }

  .play-zone {
    min-height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
