/* ============================================================
   СПАДОК — вікторина, експедиція, результат
   ============================================================ */

/* ── Setup ──────────────────────────────────────────────── */
.quiz-setup-page {
  padding-bottom: clamp(70px, 9vw, 120px);
}
.setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, 0.6fr);
  gap: clamp(34px, 6vw, 88px);
  align-items: start;
  padding-top: clamp(38px, 5vw, 64px);
}
.setup-form { min-width: 0; }
.field-group {
  margin: 0 0 40px;
  padding: 0;
  border: 0;
}
.field-group > legend {
  display: flex;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line-light);
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.field-group > legend span {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--gold-2);
}
.field-hint {
  margin: 10px 0 18px;
  font-size: 12px;
  color: var(--muted);
}
.choice-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line-light);
  border: 1px solid var(--line-light);
  margin-top: 16px;
}
.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 18px;
  background: var(--ink);
  text-align: left;
  border: 0;
  transition: background 0.25s ease, color 0.25s ease;
}
.choice-wide { grid-column: 1 / -1; }
.choice-list-time { grid-template-columns: repeat(4, 1fr); }
.choice:hover { background: var(--ink-2); }
.choice.is-selected { background: var(--paper); color: var(--ink); }
.choice.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold);
}
.choice strong {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
}
.choice small {
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.choice.is-selected small { color: var(--muted-dark); }

.select-wrap {
  position: relative;
  margin-top: 16px;
  border: 1px solid var(--line-light);
  background: var(--ink);
}
.select-wrap::after {
  content: "↓";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--gold-2);
  pointer-events: none;
}
.select-wrap select {
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 16px 46px 16px 18px;
  font-size: 14px;
  color: var(--paper);
  outline: none;
}
.select-wrap select option { background: var(--ink); color: var(--paper); }
.select-stack { display: grid; gap: 10px; margin-top: 16px; }
.select-stack .select-wrap { margin-top: 0; }
.select-label {
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.select-stack .select-label:not(:first-child) { margin-top: 8px; }

.choice strong,
.choice small,
.difficulty-choice strong,
.difficulty-choice small,
.mode-choice strong,
.mode-choice small { overflow-wrap: anywhere; }

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--line-light);
  border: 1px solid var(--line-light);
  margin-top: 16px;
}
.difficulty-choice {
  position: relative;
  padding: 16px 14px;
  background: var(--ink);
  border: 0;
  text-align: left;
  min-height: 112px;
  transition: background 0.25s ease, color 0.25s ease;
}
.difficulty-choice:hover { background: var(--ink-2); }
.difficulty-choice.is-selected { background: var(--paper); color: var(--ink); }
.difficulty-choice.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold);
}
.difficulty-choice .roman {
  display: block;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--gold-2);
  margin-bottom: 8px;
}
.difficulty-choice strong { display: block; font-size: 13px; font-weight: 500; }
.difficulty-choice small { display: block; margin-top: 5px; font-size: 10px; line-height: 1.45; color: var(--muted); }
.difficulty-choice.is-selected small { color: var(--muted-dark); }
.choice-count {
  position: absolute;
  top: 12px;
  right: 14px;
  min-width: 22px;
  padding: 2px 6px;
  border: 1px solid var(--line-light);
  font-family: var(--sans);
  font-size: 9px;
  line-height: 1.4;
  text-align: center;
  color: var(--gold-2);
}
.difficulty-choice.is-selected .choice-count { border-color: rgba(23, 20, 15, 0.18); color: var(--gold-3); }
.difficulty-choice[disabled],
.mode-choice[disabled] { opacity: 0.38; cursor: default; }
.difficulty-choice[disabled]:hover,
.mode-choice[disabled]:hover { background: var(--ink); }
.difficulty-choice[disabled] .choice-count { color: var(--muted); }

.mode-list { display: grid; gap: 1px; background: var(--line-light); border: 1px solid var(--line-light); margin-top: 16px; }
.mode-choice {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--ink);
  border: 0;
  text-align: left;
  transition: background 0.25s ease, color 0.25s ease;
}
.mode-choice:hover { background: var(--ink-2); }
.mode-choice.is-selected { background: var(--paper); color: var(--ink); }
.mode-choice .mode-index { font-family: var(--sans); font-size: 9px; color: var(--gold-2); }
.mode-choice strong { display: block; font-size: 14px; font-weight: 500; }
.mode-choice small { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; }
.mode-choice.is-selected small { color: var(--muted-dark); }
.mode-choice > span:nth-child(2) { min-width: 0; }
.mode-choice .mode-count {
  display: flex;
  align-items: baseline;
  gap: 3px;
  justify-self: end;
  font-family: var(--sans);
  color: var(--muted);
}
.mode-choice .mode-count b {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  color: var(--gold-2);
}
.mode-choice .mode-count small { margin: 0; font-size: 8px; letter-spacing: 0.04em; }
.mode-choice.is-selected .mode-count b { color: var(--gold-3); }

.setup-summary {
  position: sticky;
  top: 108px;
  border: 1px solid var(--line-gold);
  background: var(--ink-2);
  padding: 26px;
}
.setup-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-light);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-2);
}
.setup-summary dl { margin: 0; }
.setup-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-light);
  font-size: 12px;
}
.setup-summary-row dt { color: var(--muted); }
.setup-summary-row dd { margin: 0; min-width: 0; text-align: right; overflow-wrap: anywhere; }
.setup-summary-row dd.is-zero { color: #d8a39a; }
.setup-summary .btn { margin-top: 22px; }
.setup-summary .micro { margin-top: 14px; line-height: 1.6; }
.setup-notice {
  display: none;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line-gold);
  background: rgba(176, 138, 79, 0.08);
  color: var(--gold-2);
  font-size: 11px;
  line-height: 1.55;
}
.setup-notice.is-visible { display: block; }
.setup-warning {
  display: none;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(124, 52, 43, 0.45);
  color: #d8a39a;
  font-size: 11px;
  line-height: 1.55;
}
.setup-warning.is-visible { display: block; }
.setup-warning strong { display: block; font-weight: 600; }
.setup-warning p { margin: 6px 0 10px; }
.setup-warning-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.setup-warning-actions button {
  padding: 6px 8px;
  border: 1px solid rgba(216, 163, 154, 0.45);
  background: transparent;
  color: #e0b2aa;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.setup-warning-actions button:hover { background: rgba(216, 163, 154, 0.12); border-color: #d8a39a; }
.setup-reset {
  width: 100%;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line-light);
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.setup-reset:hover:not([disabled]) { border-color: var(--gold-2); color: var(--gold-2); }
.setup-reset[disabled] { opacity: 0.35; cursor: default; }
.setup-reset + .btn { margin-top: 10px; }

/* ── Game ───────────────────────────────────────────────── */
.game-page {
  min-height: 100svh;
  padding: 100px 0 60px;
  background:
    radial-gradient(circle at 80% 10%, rgba(176, 138, 79, 0.06), transparent 30rem),
    var(--ink);
}
.game-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-light);
}
.game-exit {
  justify-self: start;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.game-exit:hover { color: var(--gold-2); }
.game-progress {
  width: min(420px, 46vw);
  display: flex;
  align-items: center;
  gap: 12px;
}
.game-progress-track {
  flex: 1;
  height: 2px;
  background: var(--line-light);
  overflow: hidden;
}
.game-progress-track span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.4s var(--ease);
}
.game-progress-label {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}
.game-score {
  justify-self: end;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.game-score strong {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--gold-2);
  line-height: 1;
}
.game-score span {
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(230px, 0.45fr);
  gap: clamp(34px, 6vw, 88px);
  padding-top: clamp(36px, 6vw, 70px);
}
.question-panel { min-width: 0; }
.question-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.question-meta .kicker { font-size: 9px; }
.question-meta .dot { width: 3px; height: 3px; background: var(--gold); transform: rotate(45deg); }
.question-type { color: var(--muted); }
.question-title {
  font-size: clamp(2.1rem, 3.8vw, 3.65rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 500;
  max-width: 1000px;
}
.answer-list {
  display: grid;
  gap: 1px;
  background: var(--line-light);
  border: 1px solid var(--line-light);
  margin-top: clamp(30px, 5vw, 48px);
}
.answer {
  display: grid;
  grid-template-columns: 40px 1fr 22px;
  gap: 16px;
  align-items: center;
  min-height: 66px;
  padding: 14px 18px;
  background: var(--ink);
  border: 0;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.answer:hover:not(:disabled) { background: var(--ink-2); }
.answer-key {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-light);
  font-family: var(--sans);
  font-size: 9px;
  color: var(--muted);
  transition: border-color 0.2s ease, color 0.2s ease;
}
.answer-text { font-size: 15px; line-height: 1.5; }
.answer-mark { font-family: var(--sans); font-size: 13px; text-align: right; opacity: 0; }
.answer.is-correct { background: rgba(77, 98, 72, 0.24); }
.answer.is-correct .answer-key { border-color: #819b78; color: #c4d6bb; }
.answer.is-correct .answer-mark { opacity: 1; color: #b8d2ae; }
.answer.is-wrong { background: rgba(124, 52, 43, 0.24); }
.answer.is-wrong .answer-key { border-color: #a76a60; color: #e0b2aa; }
.answer.is-wrong .answer-mark { opacity: 1; color: #e0b2aa; }
.answer.is-dimmed { opacity: 0.34; }
.answer:disabled { cursor: default; }
.answer.is-hinted { text-decoration: line-through; text-decoration-thickness: 1px; }

.feedback {
  margin-top: 26px;
  border-top: 1px solid var(--line-gold);
  padding-top: 22px;
  animation: fade-up 0.4s var(--ease) both;
}
.feedback-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.feedback-verdict {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.feedback-verdict.is-correct { color: #a9c49d; }
.feedback-verdict.is-wrong { color: #dfa59b; }
.feedback p {
  max-width: 840px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(233, 223, 203, 0.78);
}
.feedback-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  align-items: center;
}
.feedback-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 24px;
  flex-wrap: wrap;
}
.next-btn { min-width: 190px; }

.game-aside {
  border-left: 1px solid var(--line-light);
  padding-left: clamp(22px, 3vw, 36px);
}
.game-aside-block { margin-bottom: 30px; }
.game-aside-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--sans);
  font-size: 8px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.game-aside-value {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  font-weight: 500;
  color: var(--gold-2);
}
.game-timer-track {
  height: 3px;
  background: var(--line-light);
  margin-top: 12px;
  overflow: hidden;
}
.game-timer-track span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--gold);
  transform-origin: left;
  transition: transform 0.95s linear;
}
.game-timer-track span.is-low { background: var(--oxblood); }
.hint-btn {
  width: 100%;
  border: 1px solid var(--line-gold);
  background: transparent;
  padding: 12px 14px;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-2);
  transition: background 0.2s ease;
}
.hint-btn:hover { background: rgba(176, 138, 79, 0.1); }
.hint-btn:disabled { opacity: 0.35; pointer-events: none; }
.game-aside-note {
  margin-top: 20px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

/* ── Result ─────────────────────────────────────────────── */
.result-page { padding-bottom: clamp(70px, 9vw, 120px); }
.result-hero {
  padding: 140px 0 58px;
  border-bottom: 1px solid var(--line-light);
}
.result-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: clamp(30px, 6vw, 90px);
  align-items: end;
}
.result-stamp {
  width: 170px;
  height: 170px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  transform: rotate(-9deg);
  color: var(--gold-2);
  position: relative;
  justify-self: end;
}
.result-stamp::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px dashed rgba(201, 166, 107, 0.5);
  border-radius: 50%;
}
.result-stamp strong { display: block; font-family: var(--serif); font-size: 31px; line-height: 0.95; font-weight: 500; }
.result-stamp small { display: block; margin-top: 7px; font-family: var(--sans); font-size: 7px; letter-spacing: 0.15em; text-transform: uppercase; }
.result-stamp.is-fail { border-color: var(--oxblood); color: #d09b92; }
.result-stamp.is-fail::before { border-color: rgba(124, 52, 43, 0.5); }
.result-title { margin-top: 16px; }
.result-sub { margin-top: 18px; max-width: 640px; }
.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: clamp(34px, 6vw, 80px);
  padding-top: 48px;
  align-items: start;
}
.result-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line-light);
  border: 1px solid var(--line-light);
}
.result-stat {
  padding: 24px;
  background: var(--ink);
}
.result-stat strong { display: block; font-family: var(--serif); font-size: 48px; line-height: 1; font-weight: 500; color: var(--gold-2); }
.result-stat span { display: block; margin-top: 7px; font-family: var(--sans); font-size: 8px; letter-spacing: 0.11em; text-transform: uppercase; color: var(--muted); }
.result-breakdown { margin-top: 28px; }
.result-breakdown h2 { font-size: 32px; margin-bottom: 16px; }
.breakdown-row {
  display: grid;
  grid-template-columns: 130px 1fr 48px;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-light);
  font-size: 12px;
}
.breakdown-row span:last-child { text-align: right; font-family: var(--sans); font-size: 9px; color: var(--muted); }
.breakdown-track { height: 4px; background: var(--line-light); overflow: hidden; }
.breakdown-track span { display: block; height: 100%; background: var(--gold); }
.result-review { border: 1px solid var(--line-light); }
.result-review-head { padding: 18px 20px; border-bottom: 1px solid var(--line-light); display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.result-review-head h2 { font-size: 28px; }
.review-list { max-height: 540px; overflow: auto; }
.review-item { padding: 16px 20px; border-bottom: 1px solid var(--line-light); }
.review-item:last-child { border-bottom: 0; }
.review-item-head { display: flex; gap: 10px; align-items: center; margin-bottom: 7px; }
.review-item-head .review-index { font-family: var(--sans); font-size: 9px; color: var(--muted); }
.review-item-head .review-verdict { font-family: var(--sans); font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; }
.review-verdict.is-correct { color: #a9c49d; }
.review-verdict.is-wrong { color: #dfa59b; }
.review-item p { font-size: 12px; line-height: 1.55; }
.review-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.result-achievements { margin-top: 28px; }
.result-achievements h2 { font-size: 30px; margin-bottom: 14px; }
.result-achievement {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-light);
}
.result-achievement span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  border-radius: 50%;
  font-family: var(--serif);
  color: var(--gold-2);
}
.result-achievement strong { display: block; font-size: 12px; font-weight: 500; }
.result-achievement small { display: block; font-size: 10px; color: var(--muted); }

@media (max-width: 1000px) {
  .setup-layout { grid-template-columns: 1fr; }
  .setup-summary { position: static; }
  .game-layout { grid-template-columns: 1fr; }
  .game-aside { border-left: 0; border-top: 1px solid var(--line-light); padding: 24px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
  .game-aside-block { margin-bottom: 0; }
  .game-aside-note { grid-column: 1 / -1; margin-top: 0; }
  .result-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .choice-list { grid-template-columns: 1fr; }
  .difficulty-grid { grid-template-columns: 1fr 1fr; }
  .setup-warning-actions { flex-direction: column; align-items: stretch; }
  .setup-warning-actions button { text-align: left; }
  .game-top { grid-template-columns: auto 1fr auto; }
  .game-progress { width: 100%; }
  .game-progress-label { display: none; }
  .game-aside { grid-template-columns: 1fr 1fr; }
  .game-aside-note { grid-column: 1 / -1; }
  .answer { grid-template-columns: 34px 1fr 18px; gap: 10px; padding: 12px 12px; }
  .answer-text { font-size: 14px; }
  .result-hero-grid { grid-template-columns: 1fr; }
  .result-stamp { justify-self: start; }
  .result-stat-grid { grid-template-columns: 1fr 1fr; }
  .breakdown-row { grid-template-columns: 92px 1fr 40px; }
  .review-list { max-height: 420px; }
}

@media (max-width: 480px) {
  .difficulty-grid { grid-template-columns: 1fr; }
  .difficulty-choice { min-height: 0; }
  .game-aside { grid-template-columns: 1fr; }
  .game-score strong { font-size: 22px; }
  .result-stat-grid { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; align-items: stretch; }
}
