/* Раскладка экрана раскопа. Только расположение блоков; вид — в components.css. */
.screen { max-width: 640px; margin: 0 auto; padding: max(var(--sp-3), env(safe-area-inset-top)) var(--sp-2) var(--sp-5); display: grid; gap: var(--sp-2); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 0 var(--sp-1); }
.topbar > div:first-of-type { flex: 1 1 auto; min-width: 0; }
#homeBtn { flex: none; margin-left: calc(-1 * var(--sp-2)); }
.topbar__actions { display: flex; flex: none; gap: var(--sp-2); }
.topbar .title { overflow-wrap: anywhere; }
/* низкие экраны: шапка компактнее, чтобы поле и кнопки поместились без прокрутки */
.hud { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-2); }
.board-wrap { display: flex; justify-content: center; overflow-x: clip; }  /* слой эффектов шире поля — без горизонтальной прокрутки */
#wrap { display: flex; justify-content: center; }  /* рамка по размеру поля */
#board { display: block; touch-action: none; cursor: crosshair; border-radius: 3px; }
.board-stage { position: relative; }
/* Реставрация: «камера» наезжает на утрату и её образец (setZoom() в main.js); поле обрезается рамкой */
.board-zoom { position: relative; transform-origin: 0 0; transition: transform .5s var(--ease); }
.is-restoring .board-stage { overflow: hidden; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { .board-zoom { transition: none; } }
#fx { position: absolute; pointer-events: none; }  /* эффекты поверх поля, шире его на PAD (src/fx.js) */
#coach { min-height: 56px; }

.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.actions .btn { flex: 1 1 150px; }

#restUI { display: grid; gap: var(--sp-2); }
/* Экран главы */
.chapter__progress { display: flex; justify-content: space-between; align-items: center; padding: 0 var(--sp-1); color: var(--ink-2); font-size: var(--fs-s); }
.chapter__stars { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.chapter__stars svg { width: 14px; height: 14px; }
.chapter__next svg { width: 13px; height: 13px; vertical-align: -1px; color: var(--gold-hi); }
.chapter__meter { margin: 0 var(--sp-1); }
.chapter__intro { margin: 0; padding: 0 var(--sp-1); color: var(--ink-2); font-size: var(--fs-s); }
.octagon-wrap { padding: var(--sp-2) 0; }
.chapter__pick { margin: 0; text-align: center; color: var(--ink-2); font-size: var(--fs-s); }
.chapter__pick b { color: var(--ink); }
.chapter__next { margin: 0; text-align: center; }
/* Реставрация: всё на одном экране — плашки и подсказка прячутся, поле уменьшается (fit() в main.js) */
.is-restoring .hud, .is-restoring #coach { display: none !important; }
/* реставрация: шапка — только название, место отдаётся полю */
.is-restoring #game .topbar .subtitle { display: none; }
.is-restoring #game .topbar .title { font-size: 19px; line-height: 1.15; overflow-wrap: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.rbar { display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-2); align-items: center; }
.is-restoring #chips { gap: var(--sp-2); }
.is-restoring #chips .swatch { width: 52px; height: 52px; flex: 1 1 0; max-width: 64px; }
/* «Оставить лакуну» — отдельной строкой во всю ширину, с пояснением */
.is-restoring #chips { flex-wrap: nowrap; }
.is-restoring #chips .swatch { max-width: none; }
#digUI { display: grid; gap: var(--sp-2); }

/* Низкие экраны: в шапке только название (до двух строк), плашки и подсказка плотнее — место отдаётся полю.
   Подсказка держит высоту трёх строк, чтобы поле не прыгало при смене текста */
@media (max-height: 800px) {
  .screen { gap: 6px; padding-top: max(6px, env(safe-area-inset-top)); }
  #game .topbar { min-height: 48px; }
  #game .topbar .title { font-size: 19px; line-height: 1.15; overflow-wrap: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  #game .topbar .subtitle { display: none; }
  .hud .plaque { padding: 5px 10px; }
  .hud .plaque__label { line-height: 1.15; }
  .hud .plaque__value { font-size: var(--fs-m); line-height: 1.2; }
  .hud .meter { height: 6px; margin-top: 3px; }
  #coach { min-height: 74px; padding-top: 7px; padding-bottom: 7px; font-size: var(--fs-s); line-height: 1.3; }
  .tool { min-height: 64px; }
}
