/* Шар № 8 — magic8ball.bhakti108.online */

:root {
  --bg: #000000;
  --ink: #d9dce3;
  --muted: #8b92a3;
  --dim: #565d70;
  --line: #1c1e26;
  --accent: #7d95ff;
  --yes: #6fe3a5;
  --hazy: #8fa7ff;
  --no: #ff8080;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}

#dust {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

::selection { background: #2a3568; color: #fff; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════ HERO ═══════════ */

.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px 72px;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 640px;
}

/* ── шар ── */

.scene {
  perspective: 900px;
  margin-bottom: 34px;
}

.ball {
  position: relative;
  width: min(400px, 84vw);
  aspect-ratio: 1;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.ball-tilt {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.4s ease-out;
  animation: hover-float 6s ease-in-out infinite;
}

@keyframes hover-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

.ball-body {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 33% 27%, rgba(255,255,255,0.14), transparent 30%),
    radial-gradient(circle at 30% 26%, #3b3b45 0%, #17171d 46%, #030305 80%);
  box-shadow:
    0 30px 70px rgba(0,0,0,0.85),
    inset 0 -34px 60px rgba(0,0,0,0.55),
    inset 8px 14px 40px rgba(255,255,255,0.045),
    0 0 130px rgba(90,110,255,0.07);
}

.ball-gloss {
  position: absolute;
  left: 16%;
  top: 9%;
  width: 34%;
  height: 20%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.22), transparent 68%);
  transform: rotate(-24deg);
  filter: blur(2px);
  pointer-events: none;
}

.ball-shadow {
  position: absolute;
  left: 12%;
  bottom: -13%;
  width: 76%;
  height: 8%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(60,80,220,0.16), transparent 70%);
  filter: blur(6px);
  animation: shadow-pulse 6s ease-in-out infinite;
}

@keyframes shadow-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.92); opacity: 0.7; }
}

.face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

/* белый круг с восьмёркой */
.eight-circle {
  width: 44%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #ffffff, #cfcfd6 70%, #a9a9b2);
  box-shadow: inset 0 -8px 18px rgba(0,0,0,0.22), 0 4px 16px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.eight-circle span {
  font-family: var(--serif);
  font-size: clamp(56px, 12vw, 84px);
  font-weight: bold;
  color: #101014;
  transform: translateY(-2px);
}

/* окно с ответом */
.face-window { opacity: 0; transform: scale(0.86); pointer-events: none; }

.ball.answering .face-eight { opacity: 0; transform: scale(0.86); }
.ball.answering .face-window { opacity: 1; transform: scale(1); }

.window-glass {
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 34%, #101f63 0%, #081239 55%, #020617 100%);
  box-shadow:
    inset 0 10px 26px rgba(0,0,0,0.75),
    inset 0 -4px 14px rgba(90,120,255,0.12),
    0 0 0 7px #0a0a0e,
    0 0 0 8px #22222b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.die {
  width: 84%;
  aspect-ratio: 1;
  clip-path: polygon(50% 6%, 95% 90%, 5% 90%);
  background: linear-gradient(180deg, #2647c0 0%, #14276f 55%, #0a1650 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(46px) scale(0.65);
  filter: blur(9px);
}

.die.risen {
  animation: die-rise 1.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes die-rise {
  0%   { opacity: 0; transform: translateY(46px) scale(0.65); filter: blur(9px); }
  55%  { opacity: 1; }
  75%  { transform: translateY(-3px) scale(1.01); filter: blur(0.5px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.die-text {
  width: 60%;
  margin-top: 40%;
  text-align: center;
  font-size: clamp(9px, 2.2vw, 12px);
  line-height: 1.25;
  hyphens: manual;
  -webkit-hyphens: manual;
  letter-spacing: 0.02em;
  color: #eef1ff;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(160,180,255,0.6);
  user-select: none;
}

/* тряска */
.ball.shaking .ball-tilt {
  animation: ball-shake 1.35s ease-in-out;
}

@keyframes ball-shake {
  0%   { transform: translate(0,0) rotate(0deg); }
  10%  { transform: translate(-14px, 4px) rotate(-7deg); }
  22%  { transform: translate(13px, -6px) rotate(6deg); }
  34%  { transform: translate(-12px, 5px) rotate(-5deg); }
  46%  { transform: translate(10px, -4px) rotate(4deg); }
  58%  { transform: translate(-7px, 3px) rotate(-3deg); }
  70%  { transform: translate(5px, -2px) rotate(2deg); }
  82%  { transform: translate(-3px, 1px) rotate(-1deg); }
  100% { transform: translate(0,0) rotate(0deg); }
}

/* ── тексты hero ── */

.hero-title {
  font-family: var(--serif);
  font-weight: normal;
  font-size: clamp(30px, 6vw, 46px);
  letter-spacing: 0.06em;
  color: #f2f3f7;
  text-shadow: 0 0 40px rgba(125,149,255,0.25);
  transition: opacity 0.5s ease;
}

.hero-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  transition: opacity 0.5s ease;
}

.hero.answered .hero-title,
.hero.answered .hero-sub { opacity: 0.45; }

/* ── ползунок гадания ── */

.slide-wrap {
  margin-top: 30px;
  width: 100%;
  max-width: 420px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.slide-wrap.hidden {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.slide-track {
  position: relative;
  height: 68px;
  border-radius: 40px;
  border: 1px solid #262835;
  background: linear-gradient(180deg, #0b0c12, #06070b);
  box-shadow: inset 0 3px 12px rgba(0,0,0,0.6);
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.slide-track.nudging { animation: slide-nudge 0.7s ease; }

@keyframes slide-nudge {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  55% { transform: translateX(7px); }
  80% { transform: translateX(-3px); }
}

.slide-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(56,74,180,0.05), rgba(80,105,255,0.28));
  pointer-events: none;
}

.slide-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 44px;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #565d75;
  background: linear-gradient(90deg, #565d75 40%, #aab4dd 50%, #565d75 60%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: label-shimmer 2.6s linear infinite;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes label-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -80% 0; }
}

.slide-handle {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,0.18), transparent 34%),
    radial-gradient(circle at 32% 28%, #35353f 0%, #131318 55%, #050507 100%);
  box-shadow: 0 4px 14px rgba(0,0,0,0.7), 0 0 22px rgba(90,110,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  outline: none;
  will-change: transform;
}

.slide-handle:active { cursor: grabbing; }

.slide-handle.returning { transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1); }

.slide-handle .mini8 {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #ffffff, #c9c9d2 75%);
  color: #101014;
  font-family: var(--serif);
  font-weight: bold;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.slide-track.done { border-color: #38437f; box-shadow: inset 0 3px 12px rgba(0,0,0,0.6), 0 0 26px rgba(90,110,255,0.22); }
.slide-track.done .slide-label { animation: none; opacity: 0; }

#againBtn {
  background: linear-gradient(180deg, #2a3568, #1a2247);
  border: 1px solid #38437f;
  color: #dfe4ff;
  border-radius: 10px;
  padding: 13px 22px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.2s ease, transform 0.1s ease;
}

#againBtn:hover { filter: brightness(1.25); }
#againBtn:active { transform: scale(0.97); }

/* ── вердикт ── */

.verdict {
  margin-top: 26px;
  min-height: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.6s ease, opacity 0.6s ease;
}

.verdict.show {
  max-height: 400px;
  opacity: 1;
}

.verdict-answer {
  font-family: var(--serif);
  font-size: clamp(22px, 4.6vw, 32px);
  color: #f4f5fa;
}

.verdict-answer.cat-yes  { color: var(--yes); }
.verdict-answer.cat-hazy { color: var(--hazy); }
.verdict-answer.cat-no   { color: var(--no); }
.verdict-answer.cat-safe { color: var(--muted); font-size: 18px; font-family: var(--sans); max-width: 480px; margin: 0 auto; }

.verdict-en {
  margin-top: 4px;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.verdict-mirror {
  margin: 16px auto 0;
  max-width: 460px;
  color: var(--muted);
  font-style: italic;
  font-size: 15px;
}

.verdict-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
}

.ghost-link {
  color: var(--dim);
  font-size: 15px;
  border-bottom: 1px dashed #3a3f52;
  padding-bottom: 1px;
}

.ghost-link:hover { color: var(--accent); text-decoration: none; }

.collection-hint {
  margin-top: 26px;
  font-size: 13px;
  color: #3f4454;
  letter-spacing: 0.04em;
}

/* ── scroll cue ── */

.scroll-cue {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 42px;
  border: 1px solid #333848;
  border-radius: 14px;
  opacity: 0.7;
}

.scroll-cue span {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 3px;
  height: 8px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--accent);
  animation: cue-drop 2s ease-in-out infinite;
}

@keyframes cue-drop {
  0%   { transform: translateY(0); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateY(16px); opacity: 0; }
}

/* ═══════════ ГЛАВЫ ═══════════ */

.chapter {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 110px 24px 30px;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.chapter.visible {
  opacity: 1;
  transform: translateY(0);
}

.kicker {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.chapter h2 {
  font-family: var(--serif);
  font-weight: normal;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.25;
  color: #eef0f5;
  margin-bottom: 22px;
}

.chapter h3 {
  font-family: var(--serif);
  font-weight: normal;
  font-size: 20px;
  color: #dfe2ea;
  margin-bottom: 8px;
}

.chapter p { margin-bottom: 16px; color: var(--ink); }

.lead { font-size: 19px; color: #c3c8d4; }

/* статистика пролога */

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.stat {
  flex: 1 1 140px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 16px;
  background: linear-gradient(180deg, #0a0b10, #05060a);
}

.stat b {
  display: block;
  font-family: var(--serif);
  font-weight: normal;
  font-size: 32px;
  color: var(--accent);
}

.stat b i { font-style: normal; font-size: 18px; vertical-align: super; }

.stat span { font-size: 13px; color: var(--muted); }

/* анатомия */

.anatomy-wrap {
  display: grid;
  grid-template-columns: minmax(280px, 460px) 1fr;
  gap: 36px;
  align-items: start;
  margin-top: 28px;
}

.anatomy-svg { width: 100%; height: auto; }

.anatomy-facts { display: flex; flex-direction: column; gap: 22px; }

.fact {
  border-left: 2px solid #262c44;
  padding-left: 18px;
}

.fact p { color: var(--muted); font-size: 15.5px; margin: 0; }

/* грани */

.prob-bar {
  display: flex;
  gap: 4px;
  height: 44px;
  margin: 26px 0;
  border-radius: 10px;
  overflow: hidden;
}

.prob-bar > div {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: rgba(0,0,0,0.75);
  font-weight: 600;
  min-width: 0;
}

.prob-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }

.pb-yes  { background: linear-gradient(180deg, #7ee7ac, #4fbc82); }
.pb-hazy { background: linear-gradient(180deg, #9db2ff, #6c84e8); }
.pb-no   { background: linear-gradient(180deg, #ff9a9a, #e06868); }

.faces-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 30px;
}

.face-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px 12px;
  background: #07080d;
  min-height: 86px;
  transition: border-color 0.3s ease, background 0.3s ease;
  cursor: default;
}

.face-card .fc-ru { font-size: 14px; line-height: 1.35; color: var(--ink); }
.face-card .fc-en {
  display: block;
  margin-top: 7px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: transparent;
  transition: color 0.3s ease;
}

.face-card:hover .fc-en { color: var(--dim); }

.face-card::before {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22242e;
}

.face-card.cat-yes::before  { background: var(--yes); opacity: 0.65; }
.face-card.cat-hazy::before { background: var(--hazy); opacity: 0.65; }
.face-card.cat-no::before   { background: var(--no); opacity: 0.65; }

.face-card.seen {
  border-color: #33406f;
  background: linear-gradient(180deg, #0b0f22, #06070f);
}

.face-card.seen::after {
  content: 'выпадала';
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 10px;
  color: #4a5580;
  letter-spacing: 0.06em;
}

.faces-note { margin-top: 18px; font-size: 14px; color: var(--dim); }

/* таймлайн */

.timeline {
  margin-top: 34px;
  border-left: 1px solid #23273a;
  padding-left: 0;
}

.t-item {
  position: relative;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  padding: 0 0 34px 26px;
}

.t-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2c3352;
  box-shadow: 0 0 0 4px #000;
}

.t-item.t-key::before {
  background: var(--accent);
  box-shadow: 0 0 0 4px #000, 0 0 14px rgba(125,149,255,0.8);
}

.t-year {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--accent);
  white-space: nowrap;
}

.t-body p { color: var(--muted); font-size: 15.5px; margin: 0; }

/* психология */

.psy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.psy-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 22px;
  background: linear-gradient(180deg, #0a0b12, #050609);
  transition: border-color 0.3s ease;
}

.psy-card:hover { border-color: #2c3352; }

.psy-card p { color: var(--muted); font-size: 15.5px; margin: 0; }

.pull-quote {
  margin: 44px auto 0;
  max-width: 620px;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(19px, 3.4vw, 24px);
  line-height: 1.5;
  color: #b9c3e8;
  text-shadow: 0 0 30px rgba(125,149,255,0.2);
}

/* ритуал */

.ritual-list {
  margin: 26px 0 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ritual-list li { color: var(--muted); }
.ritual-list li b { color: var(--ink); font-weight: 600; }

/* этика */

.ethics-note { font-size: 14px; color: var(--dim); }

/* футер */

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 90px 20px 46px;
  color: #3c4150;
  font-size: 14px;
}

.site-footer p { margin-bottom: 6px; }

/* ═══════════ адаптив ═══════════ */

@media (max-width: 760px) {
  .anatomy-wrap { grid-template-columns: 1fr; }
  .t-item { grid-template-columns: 1fr; gap: 4px; }
  .chapter { padding-top: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .ball-tilt, .ball-shadow, .scroll-cue span { animation: none !important; }
  html { scroll-behavior: auto; }
}
