/* Локальные дополнения к Raha (сам Raha не менялся). Цвета, отступы, формы, движение - только токены Raha.
   Чего в Raha нет и что добавлено здесь: поле ввода, нижний лист с затемнением, просмотр снимка, полоса этапов, строка-кнопка.
   Закон 1 (один сигнал): оранжевым на экране остаётся одно - плитка «Ваш ход» в списке и главная кнопка решения в карточке;
   лампа «ждёт вас» в списках и карточках - чёрный кружок (форма отличает её от «готово»), а не оранжевая. */

html { background: var(--raha-bg); }
body.raha { margin: 0; min-height: 100vh; min-height: 100dvh; font-size: var(--fs-title); }
#app { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--gap);
  padding: var(--gap) var(--gap) calc(var(--s-6) + env(safe-area-inset-bottom)); }
.boot { padding: var(--s-5); text-align: center; }
button { font: inherit; color: inherit; }
.btn { font-size: var(--fs-title); min-height: 44px; height: auto; padding-block: var(--s-2); }
.btn.sm { font-size: var(--fs-body); min-height: 44px; height: auto; }
#app .lamp[data-s="ask"] { background: var(--t-fg); border-radius: 50%; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.body-text { font-size: var(--fs-title); line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 7; overflow: hidden; }
.link { appearance: none; border: 0; background: transparent; padding: var(--s-2) 0; min-height: 44px; cursor: pointer; text-align: left;
  color: var(--t-fg); font-size: var(--fs-body); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* верх экрана */
.top { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-2) var(--s-1); min-height: 44px; }
.top .logo { font-size: 26px; }
.top .aside { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.round { width: 44px; height: 44px; }

/* герой-плитка «Ваш ход» (образец: панель Raha) */
.hero { padding: var(--s-4); min-height: 164px; justify-content: space-between; }
.hero .hero-row { display: flex; align-items: flex-end; gap: var(--s-4); }
.hero .hero-num { font-size: 84px; }
.hero .hero-row .label { padding-bottom: var(--s-2); font-size: var(--fs-body); }
.hero .hero-chip { background: rgba(18, 18, 18, 0.14); color: var(--raha-on-signal); }
.btn.alert.hero-btn, .btn.alert.hero-btn:hover { background: var(--raha-on-signal); color: var(--raha-signal); }
.hero.calm { min-height: 0; gap: var(--s-3); }
.summary { padding: var(--s-1) var(--s-2); }

/* списки: билеты прямо на холсте, зазор 6 px (закон 3); фон билета - обычная плитка, не тёмно-серая полоса */
.list { display: flex; flex-direction: column; gap: var(--gap); margin-top: var(--s-2); }
.sec-head { display: flex; align-items: center; gap: var(--s-2); min-height: 28px; padding: 0 var(--s-2); font-weight: 500; font-size: var(--fs-title); }
.sec-head .aside { margin-left: auto; font-family: var(--raha-font-mono); font-size: var(--fs-label); color: var(--raha-muted); font-weight: 400; }
button.ticket { appearance: none; border: 0; width: 100%; min-height: 64px; text-align: left; cursor: pointer; --t-track: var(--raha-tile);
  transition: transform var(--dur-1) var(--ease); }
button.ticket:active { transform: scale(0.985); }
.ticket .t { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; overflow-wrap: anywhere; }
.ticket .s { white-space: normal; }
.ticket .r { white-space: nowrap; align-self: center; }
.ticket.waiting .t { font-weight: 700; }
.more { align-self: flex-start; }

/* карточка */
.title-block { padding: var(--s-2) var(--s-2) var(--s-1); }
.title-block .h { font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.tile .lbl { font-size: var(--fs-label); color: var(--t-muted); font-weight: 500; }
.tile.formula { gap: var(--s-3); padding: var(--s-4); }
.field-label { padding: 0 var(--s-2); }
.tile.formula .blk { display: flex; flex-direction: column; gap: 2px; }
.tile.formula .blk p { font-size: var(--fs-title); line-height: 1.35; }
.tile.formula .blk p.micro { font-size: var(--fs-micro); color: var(--raha-muted); line-height: 1.4; }
.tile.formula .blk p.cmd { font-family: var(--raha-font-mono); overflow-wrap: anywhere; white-space: pre-wrap; max-height: 9em; overflow: auto; }
.stages { display: flex; gap: 3px; }
.stg { flex: 1 1 0; height: 8px; border-radius: var(--r-mark); box-shadow: inset 0 0 0 1.5px var(--t-muted); }
.stg.done { background: var(--t-fg); box-shadow: none; }
.stg.current { background: repeating-linear-gradient(135deg, var(--t-fg) 0 1.4px, transparent 1.4px 3.4px); box-shadow: inset 0 0 0 1.5px var(--t-fg); }
.thumbs { display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--s-1); -webkit-overflow-scrolling: touch; }
.thumb { appearance: none; border: 0; padding: 0; flex: 0 0 62%; max-width: 240px; scroll-snap-align: start; background: var(--raha-tile); border-radius: var(--r-tile); overflow: hidden; cursor: pointer; text-align: left; }
.thumb img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; object-position: top; background: var(--raha-track); }
.thumb span { display: block; padding: var(--s-2); font-size: var(--fs-label); color: var(--raha-muted); }
.log-line { font-size: var(--fs-label); color: var(--t-muted); }
.log-line b { font-weight: 500; color: var(--t-fg); }

/* нижняя панель действий */
.actions { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: var(--s-2); margin: var(--s-2) calc(var(--gap) * -1) 0;
  padding: var(--s-3) var(--s-3) calc(var(--s-3) + env(safe-area-inset-bottom)); background: var(--raha-bg); z-index: 5; }
.actions::before { content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--raha-bg)); }
.err-note { font-size: var(--fs-body); color: var(--raha-fg); display: flex; gap: var(--s-2); align-items: flex-start; }
.hint { padding: 0 var(--s-1); }
.calm-plate { gap: var(--s-2); }
.err-note .lamp { margin-top: 4px; }

/* вопрос: варианты */
.opts { display: flex; flex-direction: column; gap: var(--gap); }
.opt { appearance: none; border: 0; width: 100%; text-align: left; cursor: pointer; display: grid; grid-template-columns: auto 1fr; gap: 2px var(--s-3);
  align-items: start; padding: var(--s-3) var(--s-4); border-radius: var(--r-tile); background: var(--raha-tile); color: var(--raha-fg);
  transition: background-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease); min-height: 52px; }
.opt .lamp { grid-row: 1 / span 2; margin-top: 5px; }
.opt .o-t { font-weight: 500; line-height: 1.3; }
.opt .o-d { grid-column: 2; font-size: var(--fs-label); color: var(--raha-muted); line-height: 1.3; }
.opt[aria-checked="true"] { background: var(--raha-i-bg); color: var(--raha-i-fg); }
.opt[aria-checked="true"] .o-d { color: var(--raha-i-muted); }
#app .opt[aria-checked="true"] .lamp { background: var(--raha-i-fg); }
.opt .rec { grid-column: 2; font-size: var(--fs-micro); font-weight: 500; color: var(--raha-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.opt[aria-checked="true"] .rec { color: var(--raha-i-muted); }
.selection-block .h { font-size: var(--fs-title); padding: 0 var(--s-2); }
.selection-block .opt { grid-template-columns: auto minmax(0, 1fr); }
.selection-block .o-t { overflow-wrap: anywhere; }
.choice-mark { display: flex; grid-row: 1 / span 2; width: 20px; height: 20px; margin-top: 2px; border: 1px solid currentColor; border-radius: var(--s-1); }
.choice-mark svg { display: block; width: 100%; height: 100%; }
.selection-block .opt:focus-visible { outline: 2px solid var(--raha-fg); outline-offset: 2px; }
.selection-block .opt:disabled { cursor: default; }

/* поле ввода (в Raha его нет): плитка, 16px, чтобы iPhone не увеличивал экран */
.field { width: 100%; min-height: 132px; resize: vertical; border: 0; outline: 0; border-radius: var(--r-tile); padding: var(--s-3) var(--s-4);
  background: var(--raha-tile); color: var(--raha-fg); font: inherit; font-size: 16px; line-height: 1.4; }
.field::placeholder { color: var(--raha-muted); }
.field:focus-visible { box-shadow: inset 0 0 0 2px var(--raha-fg); }

/* Управление и наблюдение: плитки и отступы Raha, без дополнительных акцентных цветов. */
.quick-actions, .filter-tabs { display: flex; flex-wrap: wrap; gap: var(--gap); }
.quick-actions > .btn { flex: 1 1 150px; }
.filters { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-2); }
.search-field { min-height: 44px; height: 44px; resize: none; }
.filter-tabs .btn { flex: 1 1 auto; }
.task-controls, .form-settings, .stop-confirm, .crew-tile, .crew-task { display: flex; flex-direction: column; gap: var(--s-3); }
.check-row { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; font-size: var(--fs-title); }
.check-row input { width: 22px; height: 22px; accent-color: var(--raha-fg); }
.crew-task .title { font-weight: 500; }

/* нижний лист (образец Raha: «Решение внизу экрана») */
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; justify-content: center;
  animation: fade var(--dur-2) var(--ease) both; }
.sheet { width: 100%; max-width: 560px; border-radius: 26px 26px 0 0; padding: var(--s-5) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: var(--s-4); background: var(--raha-i-bg); color: var(--raha-i-fg);
  --t-bg: var(--raha-i-bg); --t-fg: var(--raha-i-fg); --t-muted: var(--raha-i-muted); --t-track: var(--raha-i-track); --t-sig: var(--raha-i-signal-text);
  animation: rise var(--dur-2) var(--ease) both; }
.sheet .title { font-size: 20px; }
.sheet .body-text { color: var(--raha-i-muted); font-size: var(--fs-title); }
.sheet .body-text.fg { color: var(--raha-i-fg); }
.sheet .acts { display: flex; flex-direction: column; gap: var(--s-3); }
.sheet .acts .btn { min-height: 52px; }
.sheet .golive { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-3) var(--s-4); border-radius: var(--r-tile); background: var(--raha-i-track); }
.sheet .golive .lbl { font-size: var(--fs-label); color: var(--raha-i-muted); font-weight: 500; }
.sheet .golive .g-title { font-size: 17px; font-weight: 500; line-height: 1.25; color: var(--raha-i-fg); overflow-wrap: anywhere; }
.sheet .golive .micro { color: var(--raha-i-muted); }
.sheet .golive .body-text { font-size: var(--fs-body); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* отчёт и снимок во весь экран */
.report-frame { width: 100%; height: calc(100vh - 72px); height: calc(100dvh - 72px); border: 0; border-radius: var(--r-tile); background: var(--raha-bg); color-scheme: light dark; }
.report-wait { padding: var(--s-2) var(--s-3); }
.viewer { position: fixed; inset: 0; z-index: 30; background: var(--raha-bg); display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3); }
.viewer img { flex: 1 1 auto; min-height: 0; width: 100%; object-fit: contain; }
.viewer .cap-t { font-size: var(--fs-body); color: var(--raha-muted); text-align: center; }

/* экраны без данных */
.gate { margin-top: 18vh; align-items: center; text-align: center; padding: var(--s-6) var(--s-5); gap: var(--s-3); }
.gate .logo { font-size: 40px; }
.gate .title { font-size: var(--fs-h); }
.foot { text-align: center; padding: var(--s-3); }
.banner { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-2) var(--s-3); border-radius: var(--r-tile); background: var(--raha-tile); font-size: var(--fs-body); }

@media (prefers-reduced-motion: reduce) {
  .backdrop, .sheet { animation: none; }
  button.ticket, .opt { transition: none; }
}
