/* =========================================================================
   main.css — база: сброс, палитра, типографика, каркас экранов.
   Атмосфера: тёмный индиго + фиолет, тёплое золото акцентов, мягкое свечение.
   ========================================================================= */

:root {
  --bg-deep: #080418;
  --bg-mid: #0e0722;
  --bg-soft: #150b2e;

  --violet: #7e56e0;
  --violet-bright: #a97cff;
  --violet-dim: rgba(126, 86, 224, 0.28);
  --indigo: #2f2470;

  --gold: #ffd27a;
  --gold-bright: #ffe9a8;
  --gold-dim: rgba(255, 210, 122, 0.18);

  --ice: #8fe6ff;
  --leaf: #a6f57f;
  --ruby: #ff6a4d;

  --text: #efe9ff;
  --text-dim: #b6abd8;
  --text-faint: #8378ab;

  --panel: rgba(30, 19, 62, 0.62);
  --panel-strong: rgba(24, 14, 52, 0.9);
  --panel-border: rgba(168, 138, 255, 0.24);
  --panel-border-strong: rgba(200, 168, 255, 0.45);

  --radius: 18px;
  --radius-sm: 12px;
  --shadow-soft: 0 12px 40px rgba(4, 2, 14, 0.55);
  --shadow-glow: 0 0 28px rgba(126, 86, 224, 0.32);

  --font-display: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
  --font-ui: 'Trebuchet MS', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Собственный display у компонентов перебивает браузерное [hidden]{display:none},
   из-за чего «скрытая» модалка продолжала ловить клики. Возвращаем как надо. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: fixed;
  inset: 0;
}

#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  pointer-events: none;
}

#app {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* ------------------------------------------------------------- экраны */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
  transition: opacity 0.32s ease, transform 0.32s ease, visibility 0.32s;
  padding: calc(var(--safe-t) + 8px) 0 calc(var(--safe-b) + 8px);
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* ------------------------------------------------- заглавный экран */

.screen--title {
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3.2vh, 30px);
  padding-inline: 22px;
}

.title-block {
  text-align: center;
  animation: floatIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.title-sigil {
  width: clamp(96px, 20vh, 156px);
  margin: 0 auto clamp(4px, 1.4vh, 14px);
  filter: drop-shadow(0 0 22px rgba(169, 124, 255, 0.55));
  animation: sigilSpin 42s linear infinite;
}

.title-sigil svg {
  width: 100%;
  height: auto;
  display: block;
}

.sigil-ring {
  fill: none;
  stroke: rgba(200, 168, 255, 0.5);
  stroke-width: 1.4;
}
.sigil-ring--inner {
  stroke: rgba(255, 210, 122, 0.5);
  stroke-dasharray: 5 8;
  stroke-width: 1.2;
}
.sigil-glow {
  fill: rgba(126, 86, 224, 0.2);
  stroke: none;
}
.sigil-star {
  fill: rgba(169, 124, 255, 0.16);
  fill-rule: evenodd;
  stroke: var(--gold-bright);
  stroke-width: 2;
  stroke-linejoin: round;
}
.sigil-dots circle {
  fill: var(--gold-bright);
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(44px, 11vw, 86px);
  line-height: 0.98;
  margin: 0;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff6e0 0%, var(--gold) 46%, #b57b2e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 34px rgba(255, 210, 122, 0.28);
}

.game-subtitle {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(13px, 3.4vw, 19px);
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: lowercase;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: min(360px, 88vw);
  animation: floatIn 0.9s 0.12s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.title-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  animation: floatIn 0.9s 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.wallet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  font-weight: 700;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}
.wallet__icon {
  font-size: 1.05em;
}

.streak {
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* ----------------------------------------------------------- верхняя панель */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px 12px;
  flex: 0 0 auto;
}

.topbar__title {
  font-family: var(--font-display);
  font-size: clamp(18px, 4.6vw, 25px);
  margin: 0;
  flex: 1;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(255, 210, 122, 0.24);
}

.topbar__right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(6px);
}

.scroll-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 14px 26px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--violet-dim) transparent;
}

.scroll-body::-webkit-scrollbar {
  width: 8px;
}
.scroll-body::-webkit-scrollbar-thumb {
  background: var(--violet-dim);
  border-radius: 8px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.09em;
  color: var(--gold);
  margin: 22px 4px 10px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-title small {
  font-family: var(--font-ui);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--text-faint);
  font-weight: 400;
}

/* ------------------------------------------------------------- анимации */

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(255, 210, 122, 0);
  }
  50% {
    box-shadow: 0 0 22px rgba(255, 210, 122, 0.45);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.82) translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes starPop {
  0% {
    opacity: 0;
    transform: scale(0.1) rotate(-140deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.25) rotate(8deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.05ms !important;
  }
}
