/*
 * Планшет и телефон поверх оригинального style.css.
 *
 * Два экрана, без рамок и панелей (просьба владельца: «вообще нету рамок,
 * весь интерфейс включается, если нажимаешь играть»):
 *   лобби — название, «Играть», строгость, звук; больше ничего;
 *   игра  — камера на весь экран, поверх неё сигнал, таймер, игроки, «Стоп».
 * Экран выбирает tablet.js: body[data-screen="lobby" | "game"].
 */

:root {
  /* Кириллицы в шрифтах оригинала нет: заголовок берёт системный жирный */
  --font-display: "Black Han Sans", "Arial Black", "Helvetica Neue", system-ui, sans-serif;
}
html, body { overscroll-behavior: none; background: #0b1418; }
body { -webkit-tap-highlight-color: transparent; }

/* Тексты оригинала, которые на маленьком экране только мешают */
.lede, .privacy-line, .stage-caption, .difficulty-note, .calibration-note,
.roster-title, .timer-label, .light-sub, .idle-text, .stage-badge, .scan { display: none !important; }

/* Тексты, которые оригинал рисует прямо в CSS */
.roster:empty::before { content: none; }
.player-box[data-state="out"]::after { content: "ВЫБЫЛ"; }

/* ============================ ЛОББИ ============================ */
body[data-screen="lobby"] .console,
body[data-screen="lobby"] .field,
body[data-screen="lobby"] .cloud { display: none !important; }
body[data-screen="lobby"] .hero {
  min-height: 100svh; padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom);
  display: grid; place-items: center;
}
body[data-screen="lobby"] .hero-head {
  display: grid; grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 28px;
}
body[data-screen="lobby"] .hero-copy { justify-items: center; padding: 0; max-width: none; }
/* колонка не шире экрана: иначе на телефоне кнопки режимов уезжали за край */
body[data-screen="lobby"] .hero-head, body[data-screen="lobby"] .hero-copy { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.sign { font-size: clamp(2.4rem, 9vw, 5rem); white-space: normal; line-height: 1; }
.cta-row { justify-content: center; }

/* Строгость и звук — в лобби, под кнопкой (из панели игры их переносит tablet.js) */
.lobby-controls { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }

.btn { font-size: 1.15rem; min-height: 60px; padding: 0.9rem 1.6rem; }
.btn-big { font-size: 1.3rem; min-height: 68px; padding: 1rem 1.9rem; }
.btn-huge { font-size: clamp(1.6rem, 6vw, 2.2rem); min-height: 88px; padding: 1.1rem 3rem; }
.btn .icon { width: 1.4em; height: 1.4em; }
.segmented button { font-size: 1.1rem; min-height: 54px; padding: 0 1.1rem; }
.icon-btn { width: 56px; height: 56px; }
.icon-btn .icon { width: 28px; height: 28px; }

.ios-hint {
  margin: 0; padding: 10px 16px; border-radius: 14px; font-size: 1rem; max-width: 30rem;
  background: rgba(255, 255, 255, 0.85); color: #0d2a33;
}

.credits {
  position: fixed; left: 0; right: 0; bottom: calc(6px + env(safe-area-inset-bottom));
  text-align: center; font-size: 0.7rem; opacity: 0.55; padding: 0;
}
.credits a { color: inherit; }
body[data-screen="game"] .credits { display: none; }

/* ============================ ИГРА ============================ */
body[data-screen="game"] { overflow: hidden; }
body[data-screen="game"] .hero-head,
body[data-screen="game"] .sky,
body[data-screen="game"] .field { display: none !important; }
body[data-screen="game"] .hero { padding: 0; min-height: 0; background: #000; }

/* Камера — во весь экран, без рамок. Размер сцены ставит tablet.js: строго
   в пропорциях камеры (иначе рамки игроков съехали бы с людей), лишнее
   уходит за край экрана; если обрезать пришлось бы много — чёрные поля */
body[data-screen="game"] .console {
  position: fixed; inset: 0; margin: 0; padding: 0; display: block; overflow: hidden;
  background: #000; border: 0; border-radius: 0; box-shadow: none;
}
body[data-screen="game"] .console::before,
body[data-screen="game"] .console::after { display: none; }
body[data-screen="game"] .why-card {
  left: calc(12px + var(--cut-x, 0px)); right: calc(12px + var(--cut-x, 0px)); bottom: calc(12px + var(--cut-y, 0px)); width: auto;
}
body[data-screen="game"] .stage-col {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
}
body[data-screen="game"] .stage {
  flex: none; border: 0; border-radius: 0; box-shadow: none; outline: 0;
}

/* Сигнал и таймер — сверху по центру, крупно, читается из другого угла комнаты */
body[data-screen="game"] .referee {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 26px;
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
  border: 0; border-radius: 0; box-shadow: none; pointer-events: none;
}
body[data-screen="game"] .lamp { display: none; }
body[data-screen="game"] .light-state { margin: 0; padding: 0; background: none; box-shadow: none; }
body[data-screen="game"] .light-word {
  font-size: clamp(2.2rem, 8vw, 4.2rem); line-height: 1; text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
}
body[data-screen="game"] .timer { margin: 0; padding: 0; background: none; box-shadow: none; transform: scale(0.8); }

/* Игроки — мелкими значками снизу слева */
body[data-screen="game"] .roster-block {
  position: fixed; left: calc(12px + env(safe-area-inset-left)); bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 20; max-width: 55vw; pointer-events: none;
}
body[data-screen="game"] .roster { display: flex; flex-wrap: wrap; gap: 6px; }

/* Звук и «Стоп» — снизу справа; строгость во время партии не нужна */
body[data-screen="game"] .console-bar {
  position: fixed; right: calc(12px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 21; padding: 0; background: none; border: 0; box-shadow: none; width: auto;
}
body[data-screen="game"] .console-bar .segmented { display: none; }
body[data-screen="game"] .controls { gap: 10px; }

/* Сообщения поверх сцены — крупнее */
.why-card h3 { font-size: 1.5rem; }
.endcard-title { font-size: clamp(2.6rem, 9vw, 5rem); }
.idle-title { font-size: 1.6rem; }

/* Регулятор нагрузки сообщает, что включил облегчённый режим */
.perf-note {
  position: absolute; right: 12px; top: 12px; z-index: 6; margin: 0;
  padding: 4px 10px; border-radius: 999px; font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.45); color: #fff; pointer-events: none;
}
.perf-note:empty { display: none; }
/* сцена может быть крупнее экрана — надпись держим у края экрана, а не сцены */
body[data-screen="game"] .perf-note {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); z-index: 21;
}

/* Кнопка «на весь экран» в углу — для Android во время партии */
.stage-full {
  position: fixed; left: calc(12px + env(safe-area-inset-left)); top: calc(12px + env(safe-area-inset-top));
  z-index: 22; width: 52px; height: 52px; border-radius: 14px; border: 0;
  background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 26px; line-height: 1;
}
body[data-screen="lobby"] .stage-full, :fullscreen .stage-full { display: none; }

/* В лобби заголовок горит обоими цветами светофора — контур был слишком бледным */
body[data-screen="lobby"] .sign-red { color: var(--red-lit); -webkit-text-stroke-color: transparent; }
body[data-screen="lobby"] .sign-green { color: var(--green-lit); -webkit-text-stroke-color: transparent; }

/* ============================ РЕЖИМЫ ============================ */
/* ссылка в меню игр — только в лобби */
.all-games { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 12px; z-index: 5; padding: 8px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.85); color: #0d2a33; font: 700 15px/1 system-ui, sans-serif; text-decoration: none; }
body[data-screen="game"] .all-games { display: none; }
.modes[hidden] { display: none; }
.mirror-count[hidden] { display: none; }
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 560px; }
/* нечётная последняя кнопка — во всю ширину, без дыры в сетке */
.modes button:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; }
.modes button {
  display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 14px;
  border-radius: 18px; border: 3px solid transparent; background: rgba(255, 255, 255, 0.82);
  font: 700 1.1rem/1.15 var(--font-body); color: #0d2a33; text-align: left; cursor: pointer;
}
.modes button b { font-size: 1.7rem; }
.modes button[aria-pressed="true"] { border-color: #0d2a33; background: #fff; box-shadow: 0 4px 0 rgba(13, 42, 51, 0.25); }
.mode-rule { margin: 0; font-size: 1.05rem; color: #0d2a33; opacity: 0.8; text-align: center; }

.mode-view { position: fixed; inset: 0; z-index: 50; background: #000; }
.mode-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.mode-stage video, .mode-stage canvas { position: absolute; }
.mode-stage video { transform: scaleX(-1); } /* как в зеркале */
.mode-top {
  position: absolute; left: 0; right: 0; top: calc(10px + env(safe-area-inset-top)); margin: 0;
  text-align: center; color: rgba(255, 255, 255, 0.75); font: 700 1rem/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase;
}
.mode-hud {
  position: absolute; left: 0; right: 0; top: calc(34px + env(safe-area-inset-top));
  text-align: center; pointer-events: none; padding: 0 16px;
}
.mode-msg {
  margin: 0; color: #fff; font: 400 clamp(2.2rem, 9vw, 4.6rem)/1 var(--font-display);
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.7);
}
.mode-sub {
  margin: 8px 0 0; color: #fff; font: 800 clamp(1.4rem, 6vw, 3rem)/1.1 var(--font-body);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}
/* Съедобное-несъедобное: предмет крупно по центру сверху */
.mode-item {
  /* в правом верхнем углу (владелец 27.10: «карточка перекрывает весь экран») */
  position: absolute; right: calc(12px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top));
  display: grid; justify-items: center; gap: 2px; padding: 8px 14px 10px; border-radius: 22px;
  background: rgba(226, 238, 250, 0.95); color: #0d2a33; pointer-events: none; /* не белый: белая вилка терялась */
}
.mode-item[hidden] { display: none; }
.mode-item-pic { font-size: min(15vmin, 110px); line-height: 1; }
.mode-item-3d { display: none; width: min(18vmin, 140px); height: min(18vmin, 140px); }
.mode-item.is3d .mode-item-3d { display: block; }
.mode-item.is3d .mode-item-pic { display: none; }
.mode-item-name { font: 800 min(4vmin, 26px) / 1.1 system-ui, sans-serif; max-width: 34vw; text-align: center; }
.mode-item.ok { background: rgba(52, 199, 89, 0.95); }
.mode-item.no { background: rgba(255, 59, 48, 0.95); color: #fff; }
.mode-figure.small { width: min(20vmin, 150px) !important; height: min(20vmin, 150px) !important; opacity: .92; top: calc(12px + env(safe-area-inset-top)); transform: none; }
.mode-figure {
  position: absolute; right: calc(14px + env(safe-area-inset-right)); top: 50%; transform: translateY(-50%);
  width: min(32vw, 240px); height: auto; aspect-ratio: 1; pointer-events: none;
}
.mode-stop { position: absolute; right: calc(14px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); }
@media (orientation: portrait) { .mode-figure { top: auto; bottom: 100px; right: 50%; transform: translateX(50%); } }
#difficulty[hidden] { display: none !important; }
