:root {
  --bg: #07131d;
  --panel: #3f78bc;
  --panel-light: #5a99e8;
  --green: #22d262;
  --red: #ff4a4a;
  --orange: #ffad1f;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: white;
}

button {
  font: inherit;
  border: 0;
  cursor: pointer;
}

.app,
.screen {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.hidden {
  display: none !important;
}

.display-controls {
  position: absolute;
  z-index: 70;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
}

.icon-button {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 1px solid #ffffff66;
  background: #162b36;
  color: white;
  font-size: 30px;
  line-height: 1;
}

.icon-button:hover,
.icon-button[aria-pressed="true"] { background: #365866; }
.icon-button.muted { text-decoration: line-through; }
button:focus-visible { outline: 3px solid #fff36a; outline-offset: 4px; }

.display-status {
  position: absolute;
  z-index: 71;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 90%);
  padding: 12px;
  background: #162b36;
  text-align: center;
}

.music-settings {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  width: min(300px, calc(100vw - 24px));
  padding: 20px;
  border: 1px solid #b3c9d3;
  border-radius: 8px;
  background: #fff;
  color: #102330;
  box-shadow: 0 12px 32px #0008;
  font-size: 18px;
}
.music-toggle, .music-volume-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.music-toggle { font-weight: 700; }
.music-toggle input { width: 24px; height: 24px; accent-color: #147444; }
.music-track { margin: 12px 0 24px; color: #4c616d; font-size: 14px; }
#musicVolume { width: 100%; margin: 16px 0 0; accent-color: #147444; }

.main-menu {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 52px;
  background:
    radial-gradient(circle at 25% 20%, rgba(90, 153, 232, 0.32), transparent 34%),
    linear-gradient(145deg, #081723, #10273a 52%, #07131d);
}

.main-menu h1 {
  margin: 0;
  font-size: clamp(58px, 7vw, 120px);
  color: #fff4a8;
  text-align: center;
  text-shadow: 0 8px 0 rgba(0, 0, 0, 0.28);
}

.difficulty-buttons {
  display: grid;
  gap: 24px;
  width: min(520px, 78vw);
}

.difficulty,
.top-ui button {
  height: 88px;
  border-radius: 8px;
  color: white;
  font-size: 38px;
  font-weight: 800;
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.22);
}

.difficulty:active,
.top-ui button:active {
  transform: translateY(4px);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.22);
}

.easy,
#nextButton {
  background: #24995b;
}

.normal {
  background: #278ee6;
}

.hard {
  background: #c93444;
}

.game-screen {
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 2px, transparent 2px),
    #07131d;
  background-size: 64px 64px;
}

.top-ui {
  position: absolute;
  z-index: 60;
  top: 24px;
  left: 32px;
  right: 32px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.top-ui button {
  width: 260px;
  height: 70px;
  font-size: 28px;
  pointer-events: auto;
}

#menuButton {
  background: #7d47b2;
}

.wall-group {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 48%;
  width: min(1500px, 84vw);
  height: min(460px, 36vh);
  transform: translate(-50%, -50%) scale(0.07);
  transform-origin: center center;
}

.wall-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 42px;
  background: linear-gradient(145deg, var(--panel), var(--panel-light));
  border: 14px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 26px 48px rgba(0, 0, 0, 0.35);
}

.question-text {
  width: 100%;
  white-space: nowrap;
  overflow: visible;
  text-align: center;
  font-size: clamp(90px, 8.2vw, 180px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.28);
}

.wall-fly {
  animation: wallFly 4s cubic-bezier(0.16, 0.76, 0.22, 1) forwards;
}

@keyframes wallFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.07);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.16);
  }
  87% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.16);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.45);
  }
}

.choice-countdown {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 22%;
  transform: translate(-50%, -50%);
  font-size: clamp(130px, 14vw, 220px);
  font-weight: 900;
  color: #fff36a;
  text-shadow:
    -5px -5px 0 #000,
    5px -5px 0 #000,
    -5px 5px 0 #000,
    5px 5px 0 #000,
    0 14px 22px rgba(0, 0, 0, 0.4);
}

.choice-group {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  display: grid;
  width: min(1400px, calc(100% - 48px));
  grid-template-columns: repeat(3, minmax(0, 360px));
  gap: min(7vw, 140px);
  align-items: center;
  justify-content: center;
}

.choice-wrap {
  --choice-color: #72d8ff;
  position: relative;
  display: grid;
  justify-items: center;
  gap: 20px;
}

.choice-wrap:nth-child(2) { --choice-color: #ffdb69; }
.choice-wrap:nth-child(3) { --choice-color: #ffacce; }

.choice-label {
  color: var(--choice-color);
  font-size: 104px;
  font-weight: 900;
  line-height: 1;
  text-shadow:
    -3px -3px 0 #000,
    3px -3px 0 #000,
    -3px 3px 0 #000,
    3px 3px 0 #000;
}

.choice-box {
  display: grid;
  place-items: center;
  width: 100%;
  height: 230px;
  background: var(--choice-color);
  color: #102330;
  border: 8px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.34);
}

.choice-box span {
  font-size: 132px;
  font-weight: 900;
}

.choice-result {
  height: 82px;
  font-size: 56px;
  font-weight: 900;
  text-align: center;
  text-shadow: 0 5px 0 rgba(0, 0, 0, 0.4);
}

.choice-box.correct {
  background: #73ee9e;
  border-color: #c1ffd5;
}

.choice-box.wrong {
  background: #ff9b9b;
  border-color: #ffd1d1;
}

.result-correct {
  color: #42ff83;
}

.result-wrong {
  color: #ff5b5b;
}

.overlay {
  position: absolute;
  z-index: 30;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

.big-countdown {
  position: absolute;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-size: 420px;
  white-space: nowrap;
  line-height: 1.15;
  pointer-events: none;
  font-weight: 900;
  text-align: center;
  text-shadow:
    -8px -8px 0 #000,
    8px -8px 0 #000,
    -8px 8px 0 #000,
    8px 8px 0 #000,
    0 22px 30px rgba(0, 0, 0, 0.55);
}

.big-countdown.countdown-phrase {
  font-size: 180px;
}

.penalty-slot.countdown-covered { visibility: hidden; }

.penalty-slot {
  position: absolute;
  z-index: 45;
  left: 50%;
  top: 36%;
  width: min(1450px, 84vw);
  height: 330px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  background: white;
  color: black;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.48);
  overflow: hidden;
}

.penalty-text {
  font-size: clamp(86px, 10vw, 170px);
  font-weight: 900;
  text-align: center;
  animation: none;
}

.slot-move {
  animation: slotMove var(--slot-interval, 0.12s) ease-in forwards;
}

@keyframes slotMove {
  from {
    transform: translateY(110px);
  }
  to {
    transform: translateY(-110px);
  }
}

.slot-punch {
  animation: slotPunch 0.38s ease-out;
}

@keyframes slotPunch {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

.timer-group {
  position: absolute;
  z-index: 46;
  left: 80px;
  right: 80px;
  bottom: 80px;
  height: 60px;
  padding: 0;
  overflow: visible;
  background: #111923;
  border: 6px solid rgba(255, 255, 255, 0.2);
  color: white;
}

.timer-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: #19d957;
}

.timer-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.55);
}

.pause-text {
  position: absolute;
  left: 0;
  right: 0;
  top: -82px;
  font-size: 54px;
  font-weight: 900;
  text-shadow:
    -3px -3px 0 #000,
    3px -3px 0 #000,
    -3px 3px 0 #000,
    3px 3px 0 #000;
}

@media (max-width: 1180px) {
  .choice-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
  }

  .choice-box {
    width: 100%;
    height: 180px;
  }

  .choice-box span {
    font-size: 100px;
  }
}

@media (max-width: 700px) {
  .choice-group { width: calc(100% - 24px); gap: 12px; }
  .choice-wrap { gap: 16px; }
  .choice-box { height: 140px; border-width: 4px; }
  .choice-box span { font-size: 56px; }
  .choice-label { font-size: 48px; }
  .choice-result { font-size: 22px; height: 40px; white-space: nowrap; }
  .top-ui { top: 16px; left: 12px; right: 12px; }
  .top-ui button { width: 100px; height: 48px; font-size: 18px; }
  .display-controls { top: 18px; gap: 8px; }
  .icon-button { width: 40px; height: 40px; font-size: 24px; }
  .big-countdown { font-size: 240px; }
  .big-countdown.countdown-phrase { font-size: 100px; }
}

@media (max-width: 420px) {
  .display-controls { top: 80px; }
  .music-settings { top: 52px; }
}
