/* ────────────────────────────────────────────────────────────
   Машина правды — truthmachine.css
   Стиль: газетная типографика, бежевый фон, красный акцент
   Mobile-first, без внешних шрифтов, без анимаций фона
──────────────────────────────────────────────────────────── */

:root {
  --bg:        #f5f0e6;
  --bg-card:   #fdfaf4;
  --ink:       #1a1208;
  --ink-mid:   #5c4f3a;
  --ink-light: #9a8c78;
  --accent:    #c0392b;
  --accent-dk: #9b2e22;
  --correct:   #1a6e2e;
  --wrong:     #c0392b;
  --border:    #d6c9b0;
  --border-dk: #b8a88a;
  --timer-ok:  var(--ink);
  --timer-hot: var(--accent);
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans:  system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

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

[hidden] { display: none !important; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  min-height: 100dvh;
}

/* ── Screens ── */

.screen {
  display: none;
  min-height: 70dvh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

.screen__inner {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  flex: 1;
}

/* ── Typography ── */

.top-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 20px;
}

.game-title {
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 8vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 10px;
}

.game-subtitle {
  font-size: clamp(0.8rem, 2.5vw, 0.95rem);
  color: var(--ink-mid);
  text-align: center;
  margin-bottom: 32px;
}

/* ── Splash ── */

.splash-rules {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  margin-bottom: 32px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.splash-rules p {
  font-size: 0.9rem;
  color: var(--ink-mid);
  line-height: 1.5;
}

/* ── Loading ── */

.screen--loading .screen__inner {
  justify-content: center;
  gap: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 0.9rem;
  color: var(--ink-mid);
  letter-spacing: 0.05em;
}

/* ── Playing: header ── */

.screen--playing .screen__inner {
  padding-top: 16px;
  gap: 0;
}

.game-header {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: baseline;
  margin-bottom: 16px;
}

.hdr-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  font-family: var(--font-sans);
}

/* ── Stats bar ── */

.stats-bar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 12px;
  background: var(--bg-card);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  border-right: 1px solid var(--border);
  transition: background 0.15s;
}

.stat:last-child {
  border-right: none;
}

.stat__val {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  transition: color 0.2s;
}

.stat__lbl {
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-top: 3px;
}

.stat--timer.timer-hot .stat__val {
  color: var(--timer-hot);
}

/* ── Round dots ── */

.round-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  align-items: center;
}

.round-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.15s;
}

.round-dot--done-correct {
  background: var(--correct);
}

.round-dot--done-wrong {
  background: var(--wrong);
}

.round-dot--done-timeout {
  background: var(--ink-light);
}

.round-dot--active {
  background: var(--ink);
  transform: scale(1.3);
}

/* ── Round question ── */

.round-question {
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  font-style: italic;
  color: var(--ink-mid);
  text-align: center;
  margin-bottom: 16px;
}

/* ── Cards ── */

.cards-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 0;
  margin-bottom: 16px;
}

.cards-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--ink-light);
  flex-shrink: 0;
}

.card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.card:hover:not(.card--blocked) {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(192, 57, 43, 0.12);
}

.card:focus-visible:not(.card--blocked) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card--blocked {
  cursor: default;
  pointer-events: none;
}

.card--correct {
  border-color: var(--correct);
  background: #f0faf2;
}

.card--wrong {
  border-color: var(--wrong);
  background: #fdf2f0;
}

.card__body {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 120px;
}

.card__text {
  font-family: var(--font-serif);
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  line-height: 1.45;
  color: var(--ink);
  flex: 1;
  min-height: 4.35em;
}

.card__reveal {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.card__price {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

.card--correct .card__price {
  color: var(--correct);
}

.card--wrong .card__price {
  color: var(--wrong);
}

.card__price-lbl {
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  line-height: 1.3;
}

.card__pm-link {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  margin-top: 4px;
  pointer-events: auto;
}

.card__pm-link:hover {
  text-decoration: underline;
}

/* ── Round banner ── */

.round-banner {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 4px;
  background: transparent;
  transition: background 0.2s;
  margin-bottom: 8px;
}

.round-banner--hint {
  background: transparent;
}

.round-banner--correct {
  background: #e9f7ec;
  border: 1px solid #a8d5b0;
}

.round-banner--wrong {
  background: #fce9e7;
  border: 1px solid #e5a49e;
}

.round-banner--timeout {
  background: #f0ede8;
  border: 1px solid var(--border);
}

#round-banner-text {
  font-size: clamp(0.8rem, 2.5vw, 0.9rem);
  color: var(--ink-mid);
  text-align: center;
  font-family: var(--font-sans);
}

.round-banner--correct #round-banner-text {
  color: var(--correct);
  font-weight: 600;
}

.round-banner--wrong #round-banner-text,
.round-banner--timeout #round-banner-text {
  color: var(--ink);
}

/* ── Finished ── */

.screen--finished .screen__inner {
  justify-content: flex-start;
}

.finished-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 700;
  text-align: center;
  line-height: 1.1;
  margin-bottom: 24px;
}

.finished-score {
  font-family: var(--font-serif);
  font-size: clamp(3.5rem, 14vw, 6rem);
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
}

.finished-score-lbl {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 28px;
}

.finished-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 36px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  width: 100%;
  max-width: 360px;
  justify-content: center;
}

.fin-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.fin-stat__val {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 7vw, 2.4rem);
  font-weight: 700;
  line-height: 1;
}

.fin-stat__lbl {
  font-size: 0.7rem;
  color: var(--ink-light);
  text-align: center;
  letter-spacing: 0.05em;
}

/* ── Error ── */

.error-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
}

.error-message {
  font-size: 0.95rem;
  color: var(--ink-mid);
  text-align: center;
  line-height: 1.55;
  max-width: 420px;
  margin-bottom: 32px;
}

/* ── Shared: buttons & links ── */

.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 13px 36px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-bottom: 16px;
}

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

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-dk);
}

.btn--next {
  margin-top: 4px;
}

.link-home {
  font-size: 0.8rem;
  color: var(--ink-light);
  text-decoration: none;
  letter-spacing: 0.03em;
}

.link-home:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ── Responsive tweaks ── */

@media (max-width: 420px) {
  .cards-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .cards-vs {
    padding: 6px 0;
    font-size: 0.9rem;
  }

  .card__body {
    min-height: 90px;
  }

  .stats-bar {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 600px) {
  .screen__inner {
    padding: 32px 32px 48px;
  }

  .game-header {
    margin-bottom: 20px;
  }
}


/* ── Стандартные сетка, шапка и подвал сайта ──
   Логотип и подвал — из /elements/elements.css + /elements/elements.js.
   Базовая сетка .page-grid, полноэкранная оболочка .page-grid--single и шапка
   header.site-header — единый источник в /elements/layout.css (подключается
   перед этим файлом). Тег <main> несёт классы .page-grid.page-grid--single:
   страница не короче вьюпорта, а растягивающаяся строка .game-main забирает
   свободный зазор, прижимая подвал к низу. Здесь — только оформление
   игрового блока .game-main. */

/* Карточка-подложка под игровой блок — тот же «карточный» язык, что у шапки
   и подвала (белый фон, рамка, скругление, тень). Контент перестаёт лежать
   на голом фоне страницы и встаёт в один ряд с остальной системой. */
.page-grid > .game-main {
  grid-column: 1 / -1;
  background: #ffffff;
  border: 1px solid #dde1e8;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}

/* Активный экран заполняет высоту карточки, чтобы короткий контент
   центрировался внутри высокой белой поверхности, а не «висел» сверху. */
.page-grid > .game-main .screen.active {
  flex: 1;
}

/* Короткие экраны (заставка, ошибка) — контент по центру карточки.
   Игровой и финальный экраны содержательнее и остаются прижатыми к верху,
   чтобы при низком вьюпорте ничего не обрезалось. */
.screen--splash .screen__inner,
.screen--error .screen__inner {
  justify-content: center;
}
