:root {
  --bg: #0a0a0a;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f4f0e8;
  --muted: rgba(244, 240, 232, 0.7);
  --accent: #f54d2e;
  --accent-soft: #ffb02e;
  --correct: #2fbf71;
  --wrong: #ff5d73;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top, rgba(245, 77, 46, 0.2), transparent 34%),
    linear-gradient(160deg, #151515 0%, #070707 56%, #140d0c 100%);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", sans-serif;
  overflow-x: hidden;
}

button {
  font: inherit;
}

.app {
  width: min(100%, 36rem);
  margin: 0 auto;
  padding: 1rem 0.9rem max(2rem, calc(env(safe-area-inset-bottom) + 1.2rem));
}

.hero {
  text-align: center;
  margin-bottom: 0.9rem;
}

.eyebrow,
h1 {
  font-family: "Black Han Sans", sans-serif;
  letter-spacing: 0.03em;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent-soft);
  font-size: 0.9rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 10vw, 3.7rem);
  line-height: 0.95;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.rule {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.8rem;
  padding: 0.8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.score-card {
  padding: 0.8rem 0.9rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.score-value {
  display: block;
  margin-top: 0.2rem;
  font-family: "Black Han Sans", sans-serif;
  font-size: 1.7rem;
  line-height: 1;
}

.player-panel,
.controls,
.choices {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.player-panel {
  padding: 0.7rem;
}

.player-frame {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  aspect-ratio: 16 / 9;
  background: #000;
}

.player-stage,
.yt-player-slot,
.yt-player-slot iframe {
  width: 100%;
  height: 100%;
}

.player-stage {
  position: relative;
}

.yt-player-slot {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.yt-player-slot.active {
  opacity: 1;
}

.answer-thumbnail {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  background-color: #000;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  transition: opacity 180ms ease;
}

.answer-thumbnail.visible {
  opacity: 1;
}

.player-cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(0, 0, 0, 1), rgba(0, 0, 0, 1)),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 18px,
      transparent 18px,
      transparent 36px
    );
  z-index: 2;
  transition: opacity 180ms ease;
}

.player-cover span {
  font-family: "Black Han Sans", sans-serif;
  font-size: clamp(3.4rem, 20vw, 7rem);
  line-height: 1;
}

.player-cover.revealed {
  opacity: 0;
  pointer-events: none;
}

.controls {
  margin-top: 0.8rem;
  padding: 0.9rem;
  text-align: center;
}

.listen-button,
.choice-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 120ms ease,
    opacity 120ms ease,
    background-color 120ms ease,
    color 120ms ease;
}

.listen-button {
  width: 100%;
  min-height: 4rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #130c09;
  font-family: "Black Han Sans", sans-serif;
  font-size: 1.45rem;
}

.listen-button:hover,
.choice-button:hover {
  transform: translateY(-1px);
}

.listen-button:disabled,
.choice-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.status {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.choices {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.8rem;
  padding: 0.85rem;
  position: sticky;
  bottom: max(0.4rem, env(safe-area-inset-bottom));
}

.choice-button {
  width: 100%;
  min-height: 4.2rem;
  padding: 1rem 1rem;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}

.choice-button.correct {
  background: var(--correct);
  color: #08160f;
}

.choice-button.wrong {
  background: var(--wrong);
  color: #1a0609;
}

@media (max-width: 430px) {
  .app {
    padding: 0.55rem 0.65rem max(1.6rem, calc(env(safe-area-inset-bottom) + 0.9rem));
  }

  .hero {
    margin-bottom: 0.55rem;
  }

  .eyebrow {
    margin-bottom: 0.2rem;
    font-size: 0.75rem;
  }

  h1 {
    font-size: clamp(1.35rem, 10vw, 2.1rem);
    line-height: 0.94;
  }

  .rule {
    margin-top: 0.35rem;
    font-size: 0.78rem;
  }

  .scoreboard {
    gap: 0.55rem;
    margin-bottom: 0.55rem;
    padding: 0.55rem;
  }

  .score-card {
    padding: 0.55rem 0.45rem;
  }

  .score-label {
    font-size: 0.68rem;
  }

  .score-value {
    font-size: 1.25rem;
  }

  .player-panel,
  .controls,
  .choices {
    border-radius: 1.1rem;
  }

  .player-panel {
    padding: 0.45rem;
  }

  .player-frame {
    aspect-ratio: 16 / 7.8;
  }

  .controls {
    margin-top: 0.55rem;
    padding: 0.6rem;
  }

  .listen-button {
    min-height: 3.15rem;
    font-size: 1.12rem;
  }

  .status {
    min-height: 1.2rem;
    margin-top: 0.45rem;
    font-size: 0.78rem;
  }

  .choices {
    gap: 0.6rem;
    margin-top: 0.55rem;
    padding: 0.6rem;
    position: static;
    bottom: auto;
  }

  .choice-button {
    min-height: 3rem;
    padding: 0.8rem;
    font-size: 0.88rem;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: clamp(1.2rem, 9.4vw, 1.8rem);
  }

  .listen-button {
    min-height: 2.95rem;
    font-size: 1rem;
  }

  .choice-button {
    min-height: 2.8rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 430px) and (max-height: 760px) {
  .player-panel {
    padding: 0.4rem;
  }

  .player-frame {
    aspect-ratio: 16 / 6.9;
  }

  .controls {
    padding: 0.5rem;
  }

  .scoreboard {
    padding: 0.45rem;
  }

  .choice-button {
    min-height: 2.7rem;
  }
}

@media (min-width: 640px) {
  .app {
    padding: 2rem 1.25rem 3rem;
  }

  .listen-button {
    width: auto;
    min-width: 11rem;
  }

  .choices {
    position: static;
    padding: 1rem;
    margin-top: 1rem;
  }

  .choice-button {
    min-height: 3.6rem;
  }
}
