/* style.css — стили приложения "Волшебная палочка" */

/* === Подключение шрифта DOORS для вопросов === */
@font-face {
  font-family: "DOORS";
  src: url("../fonts/DOORS_V3point4alt.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* === Подключение шрифта Tilda Sans для счётчика и ответов === */
@font-face {
  font-family: "TildaSans";
  src: url("../fonts/TILDASANS-VF.TTF") format("truetype");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

/* === Сброс и база === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #0f0c1a;
  --color-surface: #1a1530;
  --color-surface-hover: #252045;
  --color-primary: #b388ff;
  --color-primary-hover: #ce93d8;
  --color-gold: #ffd700;
  --color-gold-hover: #ffed4a;
  --color-text: #e8e0f0;
  --color-text-muted: #9e94b8;
  --color-border: #2d2650;
  --color-selected: #3d3570;
  --color-success: #69f0ae;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

html,
body {
  height: 100%;
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

/* Фон на весь экран для вопросов с изображением */
body.question-bg .question-screen {
  background: transparent;
}

/* Фон на весь экран для результата */
body.result-bg .result-screen {
  background: transparent;
}

#app {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* === Экран === */
.screen {
  width: 95%;
  max-width: 1400px;
  padding: 40px 32px;
}

/* === Стартовый экран === */
.start-screen {
  text-align: center;
}

.start-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.start-screen h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--color-primary);
}

.start-description {
  font-size: 16px;
  color: var(--color-text-muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* === Кнопки === */
.btn {
  display: inline-block;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
  font-family: var(--font);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #1a1530;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

/* === Экран вопроса === */
.question-screen {
  position: relative;
  background: transparent;
}


.question-counter {
  display: flex;
  align-items: flex-start;
  gap: 1px;
  margin-bottom: 16px;
  font-family: "TildaSans", var(--font);
}

.counter-current {
  font-size: 28px;
  font-weight: 400;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  margin-top: -6px;
}

.counter-slash {
  font-size: 28px;
  font-weight: 300;
  color: var(--color-text-muted);
  display: inline-block;
  line-height: 1;
  margin-top: 2px;
}

.counter-total {
  font-size: 18px;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1;
  align-self: flex-start;
  margin-top: 12px;
}

.question-text {
  font-family: "DOORS", var(--font);
  font-size: 60px;
  font-weight: 400;
  margin-bottom: 32px;
  line-height: 1.3;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 1), 0 0 50px rgba(0, 0, 0, 0.85), 0 0 80px rgba(0, 0, 0, 0.5);
}

/* === Список ответов === */
.answers-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 150px;
}

.answers-list--cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.answers-list--cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.answer-option {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  padding: 6px 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.answer-option:hover {
  background: transparent;
  border-color: transparent;
}

.answer-option.selected {
  background: transparent;
  border-color: transparent;
}

.answer-option input[type="radio"] {
  display: none;
}

.radio-custom {
  width: 40px;
  height: 40px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.2s;
}

.answer-option:hover .radio-custom {
  border-color: #ffffff;
}

.answer-option.selected .radio-custom {
  border-color: #ffffff;
}

.answer-option.selected .radio-custom::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  background: #ffffff;
  border-radius: 50%;
}

.answer-text {
  font-family: "TildaSans", var(--font);
  font-size: 30px;
  line-height: 1.3;
  color: var(--color-text);
  transition: color 0.2s;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 1), 0 4px 12px rgba(0, 0, 0, 1), 0 0 30px rgba(0, 0, 0, 0.9), 0 0 60px rgba(0, 0, 0, 0.6);
}

.answer-option:hover .answer-text {
  color: var(--color-gold);
}

.answer-option.selected .answer-text {
  color: var(--color-gold);
}

/* === Навигационные кнопки === */
.nav-buttons {
  display: flex;
  justify-content: space-between;
}

.nav-buttons .btn {
  font-family: "TildaSans", var(--font);
  font-size: 30px;
  font-weight: 400;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--color-text);
  padding: 6px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 1), 0 4px 12px rgba(0, 0, 0, 1), 0 0 30px rgba(0, 0, 0, 0.9);
  transition: color 0.2s;
}

.nav-buttons .btn:hover:not(:disabled) {
  background: transparent;
  color: var(--color-gold);
}

.nav-buttons .btn:disabled {
  opacity: 0.3;
}

/* === Экран результата === */
.result-screen {
  text-align: center;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.result-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.result-screen h1 {
  font-size: 40px;
  font-weight: normal;
  margin-bottom: 24px;
  color: #ffffff;
  font-family: "DOORS", var(--font);
  text-shadow: 0 4px 20px rgba(0, 0, 0, 1), 0 0 50px rgba(0, 0, 0, 0.85), 0 0 80px rgba(0, 0, 0, 0.5);
}

.result-card {
  background: #0d0b15;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  text-align: left;
}

.result-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 16px;
  text-align: center;
  font-family: "TildaSans", var(--font);
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--color-text-muted);
  font-size: 24px;
  font-family: "TildaSans", var(--font);
}

.detail-value {
  font-weight: 600;
  font-size: 24px;
  font-family: "TildaSans", var(--font);
}

.result-description {
  font-size: 24px;
  color: var(--color-text-muted);
  line-height: 1.6;
  text-align: center;
  font-family: "TildaSans", var(--font);
}

/* === Кнопка "Поделиться результатом" === */
.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 28px;
  font-size: 20px;
  font-weight: 600;
  font-family: "TildaSans", var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  background: #4a76a8;
  color: #ffffff;
  margin-bottom: 12px;
}

.btn-share:hover {
  background: #5b88bd;
}

.btn-share:active {
  transform: scale(0.97);
}

.btn-share:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.btn-share-icon {
  font-size: 22px;
}

.btn-restart {
  width: 100%;
}

/* === Адаптивность === */
@media (max-width: 480px) {
  .screen {
    padding: 28px 20px;
  }

  .start-screen h1 {
    font-size: 24px;
  }

  .question-text {
    font-size: 36px;
  }

  .counter-current {
    font-size: 22px;
  }

  .counter-slash {
    font-size: 22px;
  }

  .counter-total {
    font-size: 14px;
  }

  .answer-option {
    padding: 12px 14px;
  }

  .nav-buttons {
    flex-direction: column;
  }
}

/* Мобильная вертикальная ориентация — ответы в один столбец и уменьшенные шрифты */
@media (orientation: portrait) and (max-width: 768px) {
  .answers-list {
    grid-template-columns: 1fr;
    margin-bottom: 20px;
  }

  /* Стартовый экран */
  .start-icon {
    font-size: 58px;
  }

  .start-screen h1 {
    font-size: 18px;
  }

  .start-description {
    font-size: 10px;
  }

  /* Счётчик вопросов */
  .counter-current {
    font-size: 16px;
  }

  .counter-slash {
    font-size: 16px;
  }

  .counter-total {
    font-size: 8px;
  }

  /* Текст вопроса */
  .question-text {
    font-size: 30px;
  }

  /* Текст ответов */
  .answer-text {
    font-size: 24px;
  }

  /* Навигационные кнопки */
  .nav-buttons .btn {
    font-size: 24px;
  }

  /* Экран результата */
  .result-icon {
    font-size: 58px;
  }

  .result-screen h1 {
    font-size: 34px;
  }

  .result-title {
    font-size: 14px;
  }

  .detail-label {
    font-size: 18px;
  }

  .detail-value {
    font-size: 18px;
  }

  .result-description {
    font-size: 18px;
  }
}

/* === Мобильная горизонтальная ориентация (ландшафт) === */
/* Срабатывает на устройствах с небольшим viewport по высоте (мобильные в landscape) */
@media (orientation: landscape) and (max-height: 500px) {
  #app {
    padding: 6px;
    align-items: center;
  }

  .screen {
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
  }

  /* Стартовый экран */
  .start-icon {
    font-size: 28px;
    margin-bottom: 4px;
  }

  .start-screen h1 {
    font-size: 16px;
    margin-bottom: 4px;
  }

  .start-description {
    font-size: 10px;
    margin-bottom: 8px;
    line-height: 1.3;
  }

  .start-screen .btn {
    padding: 6px 18px;
    font-size: 12px;
  }

  /* Счётчик вопросов */
  .question-counter {
    margin-bottom: 4px;
  }

  .counter-current {
    font-size: 14px;
    margin-top: -2px;
  }

  .counter-slash {
    font-size: 14px;
    margin-top: 0;
  }

  .counter-total {
    font-size: 10px;
    margin-top: 4px;
  }

  /* Текст вопроса */
  .question-text {
    font-size: 22px;
    margin-bottom: 6px;
    line-height: 1.2;
  }

  /* Список ответов — компактная сетка */
  .answers-list {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 4px;
    margin-bottom: 6px;
  }

  .answers-list--cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .answers-list--cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .answer-option {
    gap: 6px;
    padding: 2px 0;
  }

  .radio-custom {
    width: 18px;
    height: 18px;
    border-width: 2px;
  }

  .answer-option.selected .radio-custom::after {
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
  }

  .answer-text {
    font-size: 13px;
    line-height: 1.2;
  }

  /* Навигационные кнопки */
  .nav-buttons {
    flex-direction: row;
    gap: 8px;
  }

  .nav-buttons .btn {
    font-size: 14px;
    padding: 4px 0;
  }

  /* Экран результата */
  .result-screen {
    max-width: 50%;
  }

  .result-icon {
    font-size: 28px;
    margin-bottom: 4px;
  }

  .result-screen h1 {
    font-size: 20px;
    margin-bottom: 8px;
  }

  .result-card {
    padding: 10px 14px;
    margin-bottom: 8px;
  }

  .result-title {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .result-details {
    gap: 2px;
    margin-bottom: 6px;
  }

  .detail-item {
    padding: 3px 0;
  }

  .detail-label {
    font-size: 12px;
  }

  .detail-value {
    font-size: 12px;
  }

  .result-description {
    font-size: 12px;
    line-height: 1.3;
  }

  .result-screen .btn {
    padding: 6px 18px;
    font-size: 12px;
  }
}

/* Очень маленькая высота (iPhone SE landscape и т.п.) */
@media (orientation: landscape) and (max-height: 380px) {
  .question-text {
    font-size: 18px;
  }

  .answer-text {
    font-size: 11px;
  }

  .answers-list {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 2px;
  }

  .radio-custom {
    width: 14px;
    height: 14px;
  }

  .answer-option.selected .radio-custom::after {
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
  }

  .nav-buttons .btn {
    font-size: 12px;
  }

  .screen {
    padding: 4px 8px;
  }
}

/* Планшеты в ландшафте — чуть крупнее */
@media (orientation: landscape) and (min-height: 501px) and (max-height: 600px) {
  .question-text {
    font-size: 28px;
  }

  .answer-text {
    font-size: 16px;
  }

  .answers-list {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}