* {
  box-sizing: border-box;
}

:root {
  --bg: #0d0f16;
  --panel: #171a25;
  --panel-2: #1e2231;
  --line: #2b3044;
  --text: #e9ecf5;
  --muted: #9aa3bd;
  --red: #e03a3a;
  --red-dark: #8f1f1f;
  --gold: #f5c542;
  --green: #4ade80;
  --agi: #65d96b;
  --str: #f05a5a;
  --int: #7ab8ff;
  --uni: #d0c2ff;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, #1b1030 0%, var(--bg) 55%);
  overflow-x: hidden;
}

.glow {
  position: fixed;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
  pointer-events: none;
  z-index: 0;
  animation: drift 14s ease-in-out infinite alternate;
}
.glow--red {
  top: -18vmax;
  left: -12vmax;
  background: var(--red-dark);
}
.glow--gold {
  bottom: -20vmax;
  right: -14vmax;
  background: #7a5a10;
  animation-delay: -7s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vmax, 3vmax, 0) scale(1.12); }
}

#app {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: pop-in 0.35s ease both;
}
.screen--active {
  display: flex;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.logo {
  font-size: 4rem;
  filter: drop-shadow(0 0 18px rgba(224, 58, 58, 0.55));
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.title {
  margin: 0.4rem 0 0;
  font-size: clamp(1.7rem, 6vw, 2.5rem);
  font-weight: 800;
  letter-spacing: 0.5px;
}
.title--small { font-size: 1.5rem; }
.accent {
  background: linear-gradient(90deg, var(--gold), var(--red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  margin: 0.8rem 0 0;
  max-width: 30rem;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.98rem;
}

.rules {
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 26rem;
  text-align: left;
}
.rule {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font-size: 0.92rem;
  color: #cdd3e6;
}
.rule__num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--red), var(--red-dark));
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  padding: 0.85rem 2.2rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn:active { transform: scale(0.96); }

.btn--primary {
  background: linear-gradient(145deg, #ff5b4a, var(--red-dark));
  color: #fff;
  box-shadow: 0 8px 26px rgba(224, 58, 58, 0.4);
}
.btn--primary:hover { filter: brightness(1.12); transform: translateY(-2px); }

.btn--ghost {
  background: transparent;
  color: var(--gold);
  border: 1.5px dashed #6b5a20;
  padding: 0.6rem 1.4rem;
  font-weight: 600;
}
.btn--ghost:hover { background: rgba(245, 197, 66, 0.08); }
.btn--ghost:disabled { opacity: 0.4; cursor: default; }

.best {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ——— HUD ——— */
.hud {
  display: flex;
  gap: 0.6rem;
  width: 100%;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}
.hud__item {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.hud__item b {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: 0;
}
#hud-score { color: var(--gold); }
#hud-streak { color: var(--green); }

.progress {
  width: 100%;
  height: 8px;
  background: var(--panel-2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 1.1rem;
}
.progress__fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width 0.4s ease;
}

.mystery { margin-bottom: 0.9rem; }
.mystery__icon {
  width: 88px;
  height: 88px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  background: var(--panel);
  border: 2px dashed #3a4160;
  border-radius: 50%;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 197, 66, 0.25); }
  50% { box-shadow: 0 0 0 14px rgba(245, 197, 66, 0); }
}
.mystery__label {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ——— Подсказки ——— */
.clues {
  list-style: none;
  width: 100%;
  margin: 0 0 0.9rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.clue {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-align: left;
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font-size: 0.93rem;
  line-height: 1.4;
  animation: clue-in 0.35s ease both;
}
@keyframes clue-in {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: none; }
}
.clue__ico { font-size: 1.2rem; }
.clue--attr-str { border-left-color: var(--str); }
.clue--attr-agi { border-left-color: var(--agi); }
.clue--attr-int { border-left-color: var(--int); }
.clue--attr-uni { border-left-color: var(--uni); }
.clue b { color: var(--gold); }

.clue-hidden {
  width: 100%;
  height: 34px;
  border-radius: 12px;
  background: repeating-linear-gradient(
    45deg,
    #141723,
    #141723 10px,
    #181c2a 10px,
    #181c2a 20px
  );
  border: 1px dashed var(--line);
}

/* ——— Варианты ——— */
.options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  width: 100%;
  margin-top: 0.9rem;
}
@media (max-width: 420px) {
  .options { grid-template-columns: 1fr; }
}

.option {
  font: inherit;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  padding: 0.85rem 0.6rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: border-color 0.15s, transform 0.12s, background 0.15s;
  animation: pop-in 0.3s ease both;
}
.option:hover {
  border-color: var(--gold);
  background: var(--panel-2);
  transform: translateY(-2px);
}
.option__ic { font-size: 1.6rem; }
.option__name { font-weight: 700; }
.option__ru { font-size: 0.78rem; color: var(--muted); }
.option__key {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.7rem;
  color: var(--muted);
}
.option { position: relative; }

.option--correct {
  border-color: var(--green);
  background: rgba(74, 222, 128, 0.14);
  animation: glow-correct 0.5s ease;
}
.option--wrong {
  border-color: var(--red);
  background: rgba(224, 58, 58, 0.14);
  animation: shake 0.4s ease;
}
@keyframes glow-correct {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); }
  100% { box-shadow: 0 0 0 16px rgba(74, 222, 128, 0); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-5px); }
}

.tip {
  margin: 0.8rem 0 0;
  font-size: 0.78rem;
  color: #6d7591;
}

/* ——— Результат раунда ——— */
.verdict {
  font-size: 3.4rem;
  font-weight: 800;
  animation: pop-in 0.4s ease both;
}
.verdict--ok { color: var(--green); text-shadow: 0 0 24px rgba(74, 222, 128, 0.6); }
.verdict--no { color: var(--red); text-shadow: 0 0 24px rgba(224, 58, 58, 0.6); }

.hero-card {
  width: 100%;
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.3rem 1.1rem;
  margin: 1rem 0 1.2rem;
}
.hero-card__icon { font-size: 3.2rem; }
.hero-card__name {
  margin: 0.4rem 0 0.15rem;
  font-size: 1.7rem;
  font-weight: 800;
}
.hero-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin: 0.5rem 0;
}
.tag {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 99px;
  background: #12151f;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tag--str { color: var(--str); border-color: var(--str); }
.tag--agi { color: var(--agi); border-color: var(--agi); }
.tag--int { color: var(--int); border-color: var(--int); }
.tag--uni { color: var(--uni); border-color: var(--uni); }
.tag--gold { color: var(--gold); border-color: #6b5a20; }
.hero-card__fact {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: #c3cadd;
  line-height: 1.5;
}
.hero-card__gain {
  margin-top: 0.8rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold);
}
.hero-card__gain--zero { color: var(--red); }

/* ——— Финал ——— */
.final__medal { font-size: 4rem; animation: float 3s ease-in-out infinite; }
.final__score {
  font-size: 3.6rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--gold), #ff8a3a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.1;
}
.final__stats {
  display: flex;
  gap: 0.6rem;
  margin: 0.6rem 0 1.4rem;
  flex-wrap: wrap;
  justify-content: center;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.stat b { display: block; font-size: 1.15rem; color: var(--text); }

@media (max-width: 480px) {
  #app { padding-top: 1.2rem; }
  .logo { font-size: 3.2rem; }
}

/* ——— Вкладки: Игра / Помощь ——— */
.tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.2rem;
}
.tabs[hidden] { display: none; }
.tab {
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.12s;
}
.tab:hover { border-color: var(--gold); color: var(--text); transform: translateY(-1px); }
.tab--active {
  background: linear-gradient(145deg, var(--red), var(--red-dark));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(224, 58, 58, 0.35);
}

/* ——— Фон боя (только во время игры) ——— */
#screen-game { position: relative; }
.battle-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 18% 8%, rgba(90, 22, 22, 0.55), transparent 70%),
    radial-gradient(55% 45% at 85% 90%, rgba(18, 70, 40, 0.5), transparent 70%),
    linear-gradient(180deg, #11141f 0%, #0a0c13 100%);
}
.battle-bg::before {
  content: "";
  position: absolute;
  inset: -15%;
  background:
    radial-gradient(32% 26% at 30% 35%, rgba(140, 40, 40, 0.25), transparent 70%),
    radial-gradient(30% 24% at 72% 62%, rgba(40, 110, 60, 0.22), transparent 70%);
  animation: fog-drift 16s ease-in-out infinite alternate;
}
.battle-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(75% 75% at 50% 40%, #000, transparent);
  mask-image: radial-gradient(75% 75% at 50% 40%, #000, transparent);
}
@keyframes fog-drift {
  from { transform: translate(-4%, -2%) scale(1); }
  to { transform: translate(4%, 3%) scale(1.08); }
}
#screen-game > *:not(.battle-bg) {
  position: relative;
  z-index: 1;
}
.ember {
  position: absolute;
  bottom: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd27a, #ff6a2a);
  box-shadow: 0 0 8px rgba(255, 140, 60, 0.8);
  opacity: 0;
  animation: ember-rise linear infinite;
}
@keyframes ember-rise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  12% { opacity: 0.9; }
  100% { transform: translateY(-105vh) translateX(28px); opacity: 0; }
}

/* ——— Подсказка 50/50 ——— */
.hints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
}
.btn--fifty {
  background: linear-gradient(145deg, #2f6fd6, #173a75);
  color: #fff;
  padding: 0.6rem 1.4rem;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(40, 100, 200, 0.35);
}
.btn--fifty:hover { filter: brightness(1.15); transform: translateY(-2px); }
.btn--fifty:disabled { opacity: 0.35; cursor: default; filter: none; box-shadow: none; }
.option--gone {
  opacity: 0.22;
  filter: grayscale(1);
  pointer-events: none;
}

/* ——— Справка: герой и вещи ——— */
.help-block { width: 100%; margin-bottom: 1.4rem; text-align: left; }
.help-h { margin: 0 0 0.6rem; font-size: 1.02rem; color: var(--gold); }
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}
.help-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: left;
}
.help-card b { display: block; color: var(--text); font-size: 0.92rem; margin-top: 0.2rem; }
.help-card__ic { font-size: 1.5rem; }
.help-card__m { display: block; margin-top: 0.25rem; }
.help-card__tip { display: block; margin-top: 0.35rem; color: var(--gold); font-size: 0.75rem; }
.help-roles { display: flex; flex-direction: column; gap: 0.5rem; }
.help-role {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  text-align: left;
}
.help-role ul { margin: 0.4rem 0 0; padding-left: 1.1rem; color: var(--muted); }
.help-role li { margin-bottom: 0.15rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; }
.chip {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--gold); color: var(--text); }
.chip--on { background: var(--gold); border-color: var(--gold); color: #241c00; }
