/* =========================================================================
   Игротека · версия 2 — «вечерняя программа».
   Направление: печатный зин / театральная программка, две краски (чёрная
   и красная) на тёплой бумаге. Осознанная противоположность тёмному неону v1.

   Опора (по коллекции awesome-design-md): редакционная типографика Claude
   (тёплый акцент, журнальная сетка), «бумажные» полосы чтения Runway,
   конденсированные заголовки Jobright. По taste-skill: сначала арт-направление
   и референс, потом код; браузерная проверка обязательна; никаких «generic AI
   страниц» — ни градиентных кнопок, ни стеклянных карточек, ни эмодзи-иконок.

   Правила системы:
   1. Две краски. Бумага + чёрная типографика + один красный акцент.
      Красный — только для действия и внимания, не для украшения.
   2. Толстая линия важнее тени. Иерархия строится линейками и воздухом,
      а не свечением и блюром.
   3. Один шрифт с характером: засечный дисплей для заголовков, гротеск
      для интерфейса. Контраст засечек и гротеска — главный приём.
   4. Жёсткая сетка, узкие поля, крупные номера. Печатная вёрстка узнаётся
      по номерам страниц и линейкам.
   5. Движение почти отсутствует: 120 мс, только смена состояния.
   ========================================================================= */

:root {
  --paper: #f1ece1;
  --paper-2: #fbf8f0;
  --ink: #131310;
  --ink-soft: #34322a;
  --muted: #6b6657;
  --rule: #131310;
  --accent: #bd330f;
  --marker: #f2e14c;
  --danger: #b3260a;
  --ok: #2f6b3a;

  --tap: 54px;
  --pad: 18px;
  --maxw: 1080px;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Мягкая «бумажная» фактура: две почти незаметные сетки. */
  background-image:
    radial-gradient(rgba(19, 19, 16, 0.045) 1px, transparent 1px),
    radial-gradient(rgba(19, 19, 16, 0.03) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px;
  background-position: 0 0, 12px 12px;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

h1 { font-size: clamp(38px, 10.5vw, 74px); }
h2 { font-size: clamp(26px, 6.4vw, 38px); }
h3 { font-size: 20px; letter-spacing: -0.01em; }

p { margin: 0; line-height: 1.55; color: var(--ink-soft); }

/* Надзаголовки — гротеск, капитель, разрядка. Печатный приём. */
.label {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.mark {
  background: linear-gradient(180deg, transparent 58%, var(--marker) 58%, var(--marker) 92%, transparent 92%);
  padding: 0 0.06em;
}

/* ---------- Каркас ---------- */

.masthead {
  position: relative;
  z-index: 2;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 18px var(--pad) 0;
}

.masthead__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 3px solid var(--rule);
  padding-bottom: 10px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__dot { color: var(--accent); }

.masthead__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.masthead__meta a { border-bottom: 1px solid var(--muted); padding-bottom: 1px; white-space: nowrap; }

.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.rule--thick { border-top-width: 3px; }
.rule--thin { border-top-color: rgba(19, 19, 16, 0.28); }

main {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--pad) calc(48px + env(safe-area-inset-bottom));
  flex: 1;
}

/* ---------- Первая полоса ---------- */

.opener {
  display: grid;
  gap: 18px;
  padding: 26px 0 22px;
}

.opener__kicker {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opener h1 { max-width: 16ch; }

.opener__deck {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 720px) {
  .opener__deck { grid-template-columns: 1.4fr 1fr; gap: 28px; }
}

.deck {
  font-family: var(--serif);
  font-size: clamp(17px, 4.4vw, 20px);
  line-height: 1.4;
  color: var(--ink-soft);
}

.facts { display: grid; gap: 6px; font-size: 12.5px; }
.facts div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dotted rgba(19,19,16,0.35); padding-bottom: 4px; }
.facts b { font-weight: 700; }

/* ---------- Формы входа ---------- */

.entry {
  display: grid;
  gap: 0;
  border: 2px solid var(--rule);
  background: var(--paper-2);
  box-shadow: 5px 5px 0 var(--ink);
  margin-top: 6px;
}

@media (min-width: 760px) {
  .entry { grid-template-columns: 1fr 1fr; }
  .entry > * + * { border-left: 2px solid var(--rule); }
}

.entry__pane { padding: 18px; display: grid; gap: 12px; align-content: start; }
.entry__pane + .entry__pane { border-top: 2px solid var(--rule); }

@media (min-width: 760px) {
  .entry__pane + .entry__pane { border-top: 0; }
}

.entry__title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- Поля и кнопки ---------- */

.field { display: grid; gap: 6px; }

.field > label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.input, .textarea, .select {
  appearance: none;
  width: 100%;
  min-height: var(--tap);
  padding: 13px 14px;
  border: 1.5px solid var(--rule);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
}

.textarea { min-height: 120px; resize: none; font-family: var(--sans); }
.input::placeholder, .textarea::placeholder { color: #9a9484; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.code-input {
  font-family: var(--mono);
  font-size: 24px;
  letter-spacing: 0.36em;
  text-align: center;
  text-transform: uppercase;
  padding-left: calc(14px + 0.36em);
}

.segment { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--rule); }

.segment button {
  appearance: none;
  min-height: 46px;
  border: 0;
  border-right: 1.5px solid var(--rule);
  background: #fff;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.segment button:last-child { border-right: 0; }
.segment button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1.5px solid var(--rule);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms var(--ease), background 120ms var(--ease), color 120ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translate(2px, 2px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff8f2; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--small { min-height: 40px; font-size: 11px; padding: 0 12px; width: auto; }
.btn--tiny { min-height: 34px; font-size: 10.5px; padding: 0 10px; width: auto; letter-spacing: 0.1em; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag--accent { background: var(--accent); border-color: var(--accent); color: #fff8f2; }
.tag--marker { background: var(--marker); }

/* ---------- Содержание (каталог) ---------- */

.contents { margin-top: 40px; }

.contents__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 3px solid var(--rule);
  padding-bottom: 8px;
}

.contents__list { display: grid; }

.entry-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 15px 2px;
  border-bottom: 1px solid rgba(19, 19, 16, 0.35);
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  cursor: pointer;
  transition: background 120ms var(--ease), padding-left 120ms var(--ease);
}

.entry-row:hover { background: var(--paper-2); padding-left: 8px; }
.entry-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.entry-row__no {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.entry-row__body { display: grid; gap: 3px; min-width: 0; }

.entry-row__title {
  font-family: var(--serif);
  font-size: clamp(19px, 5vw, 24px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.entry-row__desc { font-size: 13px; color: var(--muted); line-height: 1.4; }

.entry-row__go {
  font-family: var(--sans);
  font-size: 10px;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  align-self: center;
}

.entry-row__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---------- Комната ---------- */

.room { background: var(--paper); }

.slate {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--ink);
  color: var(--paper);
}

.slate__row {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 620px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) var(--pad) 10px;
}

.slate__brand { font-family: var(--serif); font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

.slate__code {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.22em;
  padding: 5px 8px;
  border: 1px solid rgba(241, 236, 225, 0.4);
}

.slate__spacer { margin-left: auto; }

.slate__link {
  background: none;
  border: 1px solid rgba(241, 236, 225, 0.4);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 6px 9px;
  cursor: pointer;
}

.progress { height: 2px; background: rgba(241, 236, 225, 0.25); }
.progress__bar { height: 100%; background: var(--accent); transform-origin: left center; transform: scaleX(0); }

.column {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 20px var(--pad) 150px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.column--tight { padding-bottom: 120px; }

.sheet {
  background: var(--paper-2);
  border: 1.5px solid var(--rule);
  box-shadow: 4px 4px 0 rgba(19, 19, 16, 0.9);
  padding: 18px;
  display: grid;
  gap: 14px;
  animation: sheet-in 180ms var(--ease);
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.sheet--bare { box-shadow: none; border: 0; background: none; padding: 0; }

.sheet__kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(19, 19, 16, 0.3);
  padding-bottom: 8px;
}

.sheet__title { font-family: var(--serif); font-size: clamp(25px, 7vw, 34px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.sheet__deck { font-family: var(--serif); font-size: 17px; line-height: 1.4; color: var(--ink-soft); }
.sheet__note { font-size: 12px; color: var(--muted); line-height: 1.45; }

.roster { display: flex; flex-wrap: wrap; gap: 6px 12px; }

.member {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  padding: 3px 0;
}

.member__no { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.member__name { border-bottom: 1px solid rgba(19, 19, 16, 0.35); }
.member--me .member__name { border-bottom-color: var(--accent); border-bottom-width: 2px; }
.member--off { opacity: 0.4; }
.member__host { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }

.pick {
  display: grid;
  gap: 0;
  border-top: 1px solid rgba(19, 19, 16, 0.35);
}

.pick__item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 13px 2px;
  border-bottom: 1px solid rgba(19, 19, 16, 0.35);
  background: none;
  border-left: 0;
  border-right: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  min-height: 52px;
}

.pick__item[aria-pressed="true"] { background: var(--marker); }
.pick__mark { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pick__item[aria-pressed="true"] .pick__mark { color: var(--ink); }
.pick__title { font-family: var(--serif); font-size: 18px; font-weight: 700; }
.pick__desc { font-size: 12px; color: var(--muted); }

/* Варианты ответа: буквенный медальон + текст, как пункты программы. */
.answers { display: grid; gap: 10px; }

.answer {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  min-height: 60px;
  padding: 14px 12px;
  border: 1.5px solid var(--rule);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background 120ms var(--ease), transform 120ms var(--ease);
}

.answer:hover { background: var(--marker); }
.answer:active { transform: translate(1px, 1px); }
.answer:disabled { opacity: 0.5; }
.answer:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.answer__letter {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--rule);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.answer--big { min-height: 84px; font-family: var(--serif); font-size: 18px; }

.answers--pair { grid-template-columns: 1fr 1fr; }
.answers--pair .answer { grid-template-columns: 1fr; text-align: center; justify-items: center; }

/* Вскрытие: строка с точечным заполнителем, как в меню с ценами. */
.tally { display: grid; gap: 2px; }

.tally__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px dotted rgba(19, 19, 16, 0.4);
  animation: sheet-in 200ms var(--ease) backwards;
}

.tally__row--hot { background: linear-gradient(180deg, transparent 62%, var(--marker) 62%); }
.tally__text { font-size: 15px; line-height: 1.35; }
.tally__sub { display: block; font-family: var(--sans); font-size: 11px; color: var(--muted); margin-top: 3px; letter-spacing: 0.04em; }
.tally__value { font-family: var(--mono); font-size: 14px; font-weight: 700; white-space: nowrap; }

/* Таблица очков — как турнирная таблица в программке. */
.standings { display: grid; gap: 0; border-top: 2px solid var(--rule); }

.standing {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 11px 2px;
  border-bottom: 1px solid rgba(19, 19, 16, 0.35);
}

.standing--first { background: var(--marker); }
.standing__no { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.standing--first .standing__no { color: var(--ink); }
.standing__name { font-family: var(--serif); font-size: 18px; font-weight: 700; }
.standing__score { font-family: var(--mono); font-size: 16px; font-weight: 700; }

/* Секретная карточка — как отрывной билет. */
.ticket {
  position: relative;
  background: var(--paper-2);
  border: 1.5px dashed var(--rule);
  padding: 22px 18px;
  display: grid;
  gap: 8px;
  text-align: center;
}

.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px dashed var(--rule);
  top: 50%;
  transform: translateY(-50%);
}

.ticket::before { left: -7px; }
.ticket::after { right: -7px; }

.ticket__role { font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.ticket__value { font-family: var(--serif); font-size: clamp(26px, 8vw, 34px); font-weight: 700; letter-spacing: -0.02em; }
.ticket__body { font-size: 14px; color: var(--ink-soft); white-space: pre-line; }

/* Нижняя панель ведущего. */
.footbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  background: var(--paper);
  border-top: 2px solid var(--rule);
}

.footbar__inner {
  max-width: 620px;
  margin: 0 auto;
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
}

.footbar__hint { font-size: 11px; color: var(--muted); text-align: center; letter-spacing: 0.04em; }

/* ---------- Правила ---------- */

.read { max-width: 760px; display: grid; gap: 22px; }

.read__head { display: grid; gap: 10px; padding-top: 20px; }

.read__rule { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(19,19,16,0.3); }
.read__n { font-family: var(--mono); font-size: 12px; color: var(--accent); padding-top: 3px; }
.read__text { font-size: 15.5px; line-height: 1.5; color: var(--ink-soft); }

.pullquote {
  border-left: 4px solid var(--accent);
  padding: 2px 0 2px 14px;
  display: grid;
  gap: 4px;
}

.pullquote__label { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.pullquote__body { font-family: var(--serif); font-size: 17px; line-height: 1.45; color: var(--ink); }

.colophon {
  margin-top: 40px;
  border-top: 3px solid var(--rule);
  padding-top: 12px;
  display: grid;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- Служебное ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 60;
  max-width: min(90vw, 420px);
  padding: 11px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 160ms var(--ease);
}

.toast--show { opacity: 1; transform: translate(-50%, 0); }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: var(--pad);
  background: rgba(241, 236, 225, 0.94);
}

.overlay__box { width: 100%; max-width: 400px; display: grid; gap: 14px; }

.empty { padding: 30px 0; text-align: center; color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
