* {
  box-sizing: border-box;
}

:root {
  --bg: #0f0d12;
  --panel: #1a1620;
  --panel-2: #241d2e;
  --line: #3a3048;
  --text: #efe7f5;
  --muted: #a396b3;
  --accent: #ff4d6d;
  --accent-2: #ffd166;
  --good: #6bcb77;
  --bad: #ff5f56;
}

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

body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, #241a2e 0%, var(--bg) 55%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.bg-scare {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.6;
}

.game {
  position: relative;
  width: min(720px, 100%);
  padding: 24px 18px 40px;
}

.game__header {
  text-align: center;
  margin-bottom: 18px;
}

.game__title {
  margin: 0;
  font-size: clamp(28px, 6vw, 44px);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-2);
  text-shadow: 0 0 18px rgba(255, 209, 102, 0.35), 3px 3px 0 #7a2e3d;
}

.game__subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.hud__item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

.hud__label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hud__value {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  font-weight: bold;
}

.hud__value--score {
  color: var(--accent-2);
}

.round,
.final {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 2px solid var(--line);
  border-radius: 20px;
  padding: 22px 18px 26px;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.4);
}

.emojis {
  min-height: 120px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: #12101a;
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 14px;
  font-size: clamp(30px, 8vw, 48px);
  line-height: 1;
}

.emojis .pop {
  display: inline-block;
  animation: pop 0.45s ease backwards;
}

/* Заголовок вопроса — печатается по буквам */
.round__title {
  font-size: clamp(18px, 4vw, 26px);
  text-align: center;
  margin: 4px 0 14px;
  letter-spacing: 0.5px;
}

/* Убираем пустой параграф подсказки, если он не заполнен */
.round__lead:empty {
  display: none;
}

.ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(8px) rotate(-4deg);
  animation: ch-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.ch.is-space {
  width: 0.35em;
}

@keyframes ch-in {
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

.clue-label {
  flex-basis: 100%;
  text-align: center;
  font-size: 15px;
  color: var(--accent-2);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 6px;
  animation: fade 0.5s ease backwards;
  animation-delay: 0.3s;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    transform: scale(0.2) rotate(-25deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

.answers {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.btn {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-weight: bold;
  padding: 14px 16px;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent-2);
}

.btn:active {
  transform: translateY(2px);
}

.btn--correct {
  background: rgba(107, 203, 119, 0.22);
  border-color: var(--good);
  color: #d7ffdb;
}

.btn--wrong {
  background: rgba(255, 95, 86, 0.18);
  border-color: var(--bad);
  color: #ffd9d6;
}

.btn:disabled {
  cursor: default;
}

.btn--next,
#btn-restart {
  display: block;
  width: 100%;
  margin-top: 16px;
  background: var(--accent);
  border-color: #ff8aa3;
  color: #fff;
  position: relative;
  overflow: hidden;
  animation: btn-breathe 2.2s ease-in-out infinite;
}

.btn--next:hover,
#btn-restart:hover {
  animation-play-state: paused;
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn--next:active,
#btn-restart:active {
  transform: scale(0.97);
}

.btn--next .btn__arrow {
  display: inline-block;
  animation: arrow-nudge 1.2s ease-in-out infinite;
}

@keyframes arrow-nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(5px);
  }
}

/* Пульсация + бегущая полоска */
@keyframes btn-breathe {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 98, 122, 0.55);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 98, 122, 0);
    transform: translateY(-1px);
  }
}

.btn--next::after,
#btn-restart::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  animation: btn-shine 2.4s linear infinite;
}

@keyframes btn-shine {
  0% {
    left: -60%;
  }
  60%,
  100% {
    left: 120%;
  }
}

/* Состояние «Загрузка…» — спиннер + пульс */
.btn.is-loading {
  animation: btn-load-pulse 0.6s ease-in-out infinite;
  pointer-events: none;
  opacity: 0.85;
}

.btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 8px;
  display: inline-block;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes btn-load-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.feedback {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.feedback__emoji {
  font-size: 40px;
  line-height: 1;
}

.feedback__img {
  width: min(240px, 60vw);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  margin: 10px auto 4px;
  display: block;
  animation: img-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes img-in {
  0% {
    opacity: 0;
    transform: scale(0.6) rotate(-6deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

.feedback__title {
  font-weight: bold;
  font-size: 18px;
}

.feedback__desc {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.final {
  text-align: center;
}

.final__face {
  font-size: 72px;
  animation: float 1.6s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.final__title {
  margin: 10px 0 4px;
  font-size: 28px;
}

.final__score {
  margin: 4px 0;
  font-size: 20px;
  color: var(--accent-2);
}

.final__hint {
  color: var(--muted);
  margin: 8px 0 4px;
}

.game__footer {
  margin-top: 18px;
  text-align: center;
  color: #6d6480;
  font-size: 12px;
}

.shake {
  animation: shake 0.4s ease;
}

/* Появление кнопки «Дальше» */
@keyframes btn-pop {
  0% {
    transform: scale(0.85) translateY(8px);
    opacity: 0;
  }
  60% {
    transform: scale(1.04) translateY(0);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

.btn-pop {
  animation: btn-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-4px);
  }
}
