/* =========================
   ROOT: КОНТРОЛЬ ПОЗИЦИЙ/РАЗМЕРОВ
   (ДВИГАЕШЬ ЭЛЕМЕНТЫ ТОЛЬКО ЗДЕСЬ)
========================= */

:root {
  /* Общий размер сцены под 1920x1080 (для ориентира) */
  --scene-width: 1920px;
  --scene-height: 1080px;

  /* Фоны */
  --bg-test: url("test_bg.png");
  --bg-illusion: url("illusion_bg.gif");
  --bg-main: url("second_bg.png");

  /* === TEST SCREEN === */
  --test-title-top: 20%;
  --test-title-left: 50%;
  --test-title-size: 50px;        /* РАЗМЕР ANSWER 3 QUESTIONS */

  --test-question-top: 40%;
  --test-question-left: 50%;
  --test-question-size: 30px;     /* РАЗМЕР ТЕКСТА ВОПРОСА */

  --test-button-top: 55%;
  --test-button-left: 50%;
  --test-button-width: 260px;
  --test-button-height: 70px;

  /* === ILLUSION SCREEN === */
  --illusion-title-top: 50%;
  --illusion-title-left: 50%;
  --illusion-title-size: 80px;

  --sound-toggle-size: 60px;
  --sound-toggle-right: 40px;
  --sound-toggle-bottom: 30px;

  /* === MAIN SCREEN (CHART) === */
  --main-heading-top: 8%;
  --main-heading-left: 50%;
  --main-heading-size: 32px;

  --chart-frame-top: 22%;
  --chart-frame-left: 50%;
  --chart-frame-width: 800px;
  --chart-frame-height: 450px;

  --ca-top: 72%;
  --ca-left: 50%;
  --ca-font-size: 18px;

  /* === FOOTER / GLASS === */
  --footer-left: 50%;
  --footer-bottom: 40px;
  --footer-width: 520px;
  --footer-height: 90px;
  --footer-border-radius: 999px;
  --footer-gap: 50px;
}

/* =========================
   BASE
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background-color: #cfd9d5;
  color: #ffffff;
  overflow-x: hidden;
}

/* Когда активен тест — блокируем скролл */
body.test-active {
  overflow: hidden;
}

/* =========================
   TEST SCREEN
========================= */

.test-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-test) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 1;
  transition: opacity 0.8s ease;
}

.test-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.test-overlay {
  position: relative;
  width: 100%;
  max-width: var(--scene-width);
  height: 100%;
  text-align: center;
}

.test-title {
  position: absolute;
  top: var(--test-title-top);
  left: var(--test-title-left);
  transform: translate(-50%, 0);
  margin: 0;
  font-size: var(--test-title-size); /* ← теперь из переменной */
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
}

/* ВОПРОС С ПЛАВНЫМ ПОЯВЛЕНИЕМ */
.test-question {
  position: absolute;
  top: var(--test-question-top);
  left: var(--test-question-left);
  margin: 0;
  font-size: var(--test-question-size); /* ← тоже через переменную */
  font-weight: 600;
  color: #ffffff;
  text-align: center;

  /* Больше НЕТ max-width — текст не ограничен по ширине */
  opacity: 0;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

/* когда добавлен класс question-visible — плавно проявляется */
.test-question.question-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =====================
   КНОПКА ТЕСТА
===================== */

.system-button {
  position: absolute;
  top: var(--test-button-top);
  left: var(--test-button-left);
  transform: translate(-50%, 0);
  width: var(--test-button-width);
  height: var(--test-button-height);
  padding: 0;
  border: none;
  background: url("btn_system.png") center/contain no-repeat;
  cursor: pointer;
  outline: none;
  box-shadow: none;
  transition:
    transform 0.12s ease,
    filter 0.15s ease;
}

.system-button:hover {
  filter: brightness(1.05);
}

.system-button.pressed {
  transform: translate(-50%, 3px) scale(0.97);
  box-shadow: none;
}

/* =========================
   MAIN WRAPPER
========================= */

.page-wrapper {
  display: none;
}

body.site-active .page-wrapper {
  display: block;
}

/* Общий стиль экранов */
.screen {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* ===== Illusion screen ===== */

.screen-illusion {
  background: var(--bg-illusion) center/cover no-repeat fixed;
}

.screen-illusion-inner {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

.illusion-title {
  position: absolute;
  top: var(--illusion-title-top);
  left: var(--illusion-title-left);
  transform: translate(-50%, -50%);
  font-size: var(--illusion-title-size);
  font-weight: 700;
  color: #ffffff;
  text-align: center;
}

/* Sound toggle button */
.sound-toggle {
  position: absolute;
  right: var(--sound-toggle-right);
  bottom: var(--sound-toggle-bottom);
  width: var(--sound-toggle-size);
  height: var(--sound-toggle-size);
  background: url("illusion_sound_icon.png") center/contain no-repeat;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: 999px;
  outline: none;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.sound-toggle:hover {
  transform: translateY(-3px);
  filter: brightness(1.08);
}

.sound-toggle:active {
  transform: translateY(2px) scale(0.96);
}

.sound-toggle.muted {
  filter: grayscale(0.2) brightness(0.7);
}

/* ===== Main screen ===== */

.screen-main {
  background: var(--bg-main) center/cover no-repeat fixed;
}

.screen-main-inner {
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* Заголовок над графиком */
.main-heading {
  position: absolute;
  top: var(--main-heading-top);
  left: var(--main-heading-left);
  transform: translate(-50%, 0);
  margin: 0;
  text-align: center;
  font-size: var(--main-heading-size);
  font-weight: 700;
  color: #ffffff;
}

/* Chart frame */
.chart-frame {
  position: absolute;
  top: var(--chart-frame-top);
  left: var(--chart-frame-left);
  transform: translate(-50%, 0);
  width: var(--chart-frame-width);
  height: var(--chart-frame-height);
  background: rgba(0, 0, 0, 0.85);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.5);
}

.dex-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* CA wrapper */
.ca-wrapper {
  position: absolute;
  top: var(--ca-top);
  left: var(--ca-left);
  transform: translate(-50%, 0);
  font-size: var(--ca-font-size);
  font-weight: 600;
  color: #ffffff;
  text-align: center;
}

/* CA button */
.ca-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.2);
  color: #ffffff;
  cursor: pointer;
  font-size: inherit;
  font-weight: inherit;
  gap: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 0.13s ease,
    box-shadow 0.13s ease,
    background 0.13s ease;
}

.ca-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.35);
}

.ca-button:active {
  transform: translateY(2px) scale(0.97);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
}

/* =========================
   GLASS FOOTER
========================= */

.glass-footer {
  position: fixed;
  left: var(--footer-left);
  bottom: var(--footer-bottom);
  transform: translateX(-50%);
  width: var(--footer-width);
  height: var(--footer-height);
  border-radius: var(--footer-border-radius);
  background: rgba(200, 214, 210, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.45),
    inset 0 0 40px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.glass-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--footer-gap);
}

/* Footer buttons */
.footer-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(180deg, #1c1f1e, #111413);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 0 #050606;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease;
  padding: 0;
}

.footer-btn img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}

.footer-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 0 #050606;
  filter: brightness(1.1);
}

.footer-btn:active {
  transform: translateY(4px) scale(0.96);
  box-shadow: 0 3px 0 #050606;
}

/* =========================
   TOAST
========================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 30;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1024px) {
  :root {
    --illusion-title-size: 48px;
    --main-heading-size: 22px;
    --chart-frame-width: 90vw;
    --chart-frame-height: 55vh;
    --footer-width: 90vw;
  }

  .test-title {
    font-size: calc(var(--test-title-size) * 0.75);
  }

  .test-question {
    font-size: calc(var(--test-question-size) * 0.75);
    padding: 0 24px;
  }
}

