/* ACID UNO — FINAL V7 viewport/menu pass
   One-screen UI, three always-visible modes, system cursor only. */

html, body {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden !important;
  overscroll-behavior: none;
}
body { margin: 0; }
#game {
  width: 100vw !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}

/* Kill the old SVG/crosshair cursor. Keep native OS cursors. */
@media (pointer:fine) {
  html, body, #game, .overlay, .window, .door, .storyNode, .districtClose,
  .tableInner, #center, #discard, #opponents, .opponent {
    cursor: default !important;
  }
  button, a, [role="button"], .seatPick, .doorPick, .districtOpen {
    cursor: pointer !important;
  }
  #hand .handCard, #deck { cursor: grab !important; }
  #hand .handCard:active, #deck:active, .handCard.dragging { cursor: grabbing !important; }
}

/* Prevent any legacy layer from widening the document. */
#arena, #physical3dScene, .ambient, .noise, .v10Hands,
#animationLayer, #opponents, .topbar, #table, #hand, .overlay {
  max-width: 100vw !important;
}

/* ---------- START MENU: all three modes visible at once ---------- */
html[data-theme] #lobby.overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  padding: 14px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}
html[data-theme] #lobby .lobbyWindow {
  width: min(1280px, calc(100vw - 28px)) !important;
  height: min(760px, calc(100dvh - 28px)) !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 auto !important;
  padding: 18px 20px 14px !important;
  overflow: hidden !important;
  border-radius: 22px !important;
  box-sizing: border-box !important;
  background: linear-gradient(150deg, rgba(4,7,15,.96), rgba(9,6,20,.96)) !important;
}
html[data-theme] #lobbyMain {
  width: 100% !important;
  height: 100% !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  gap: 11px !important;
  padding: 0 !important;
  overflow: hidden !important;
}
html[data-theme] #lobbyMain::before { display: none !important; }
html[data-theme] .lobbyHead {
  grid-column: 1 !important;
  grid-row: 1 !important;
  margin: 0 !important;
  text-align: left !important;
}
html[data-theme] .lobbyHead .windowEyebrow { font-size: 8px !important; }
html[data-theme] .lobbyHead h2 {
  margin: 2px 0 3px !important;
  font-size: clamp(30px, 4.2vw, 58px) !important;
  line-height: .92 !important;
}
html[data-theme] .lobbyLead {
  max-width: 760px !important;
  margin: 0 !important;
  font-size: 9px !important;
  line-height: 1.3 !important;
  opacity: .68 !important;
}
html[data-theme] .lobbyShowcase { display: none !important; }

html[data-theme] .doorsV2 {
  grid-column: 1 !important;
  grid-row: 2 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr) minmax(0, .86fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  gap: 11px !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  align-items: stretch !important;
}
html[data-theme] .doorsV2 .door,
html[data-theme] .doorsV2 .door.chosen,
html[data-theme] .doorsV2 .storyDoor,
html[data-theme] .doorsV2 .compactDoor,
html[data-theme] .doorsV2 .storyDoor.chosen,
html[data-theme] .doorsV2 .compactDoor.chosen {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  width: auto !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 15px !important;
  margin: 0 !important;
  transform: none !important;
  filter: none !important;
  opacity: 1 !important;
  overflow: hidden !important;
  border-radius: 18px !important;
  box-sizing: border-box !important;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease !important;
}
html[data-theme] .doorsV2 .door:hover,
html[data-theme] .doorsV2 .door.chosen:hover {
  transform: translateY(-2px) !important;
}
html[data-theme] .doorsV2 .storyDoor {
  order: 1 !important;
  border: 1px solid rgba(183,255,67,.72) !important;
  background:
    linear-gradient(150deg, rgba(17,28,11,.82), rgba(6,13,21,.88) 58%, rgba(19,7,28,.86)),
    url("assets/arena-1.webp") center/cover !important;
  box-shadow: 0 0 0 1px rgba(183,255,67,.09), 0 22px 48px rgba(0,0,0,.32), 0 0 34px rgba(183,255,67,.09) !important;
}
html[data-theme] .doorsV2 .storyDoor::after {
  content: "ГЛАВНЫЙ РЕЖИМ";
  position: absolute;
  right: 12px;
  top: 11px;
  z-index: 5;
  padding: 5px 8px;
  border: 1px solid rgba(183,255,67,.45);
  border-radius: 999px;
  background: rgba(183,255,67,.08);
  color: #dfff9b;
  font: 900 7px/1 ui-monospace, monospace;
  letter-spacing: .13em;
}
html[data-theme] .doorsV2 .door[data-door="bots"] {
  order: 2 !important;
  border: 1px solid rgba(255,77,205,.38) !important;
  background: linear-gradient(155deg, rgba(22,6,28,.88), rgba(6,11,22,.91)) !important;
}
html[data-theme] .doorsV2 .door[data-door="live"] {
  order: 3 !important;
  border: 1px solid rgba(77,234,255,.34) !important;
  background: linear-gradient(155deg, rgba(3,17,25,.90), rgba(8,7,21,.92)) !important;
}
html[data-theme] .doorsV2 .doorPick,
html[data-theme] .doorsV2 .storyDoor .doorPick {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  padding: 0 0 11px !important;
  display: grid !important;
  gap: 5px !important;
  align-content: start !important;
  text-align: left !important;
  background: transparent !important;
}
html[data-theme] .doorsV2 .doorPick b,
html[data-theme] .doorsV2 .storyDoor .doorPick b {
  font-size: clamp(20px, 2.05vw, 31px) !important;
  line-height: .98 !important;
}
html[data-theme] .doorsV2 .storyDoor .doorPick b { color: #efffd1 !important; }
html[data-theme] .doorsV2 .doorPick em {
  font-size: 8px !important;
  line-height: 1.35 !important;
  color: rgba(230,240,255,.58) !important;
}
html[data-theme] .doorKicker { font-size: 7px !important; }

/* All mode bodies are visible and interactive immediately. */
html[data-theme] .doorsV2 .door .doorBody,
html[data-theme] .doorsV2 .door:not(.chosen) .doorBody,
html[data-theme] .doorsV2 .door.chosen .doorBody,
html[data-theme] .doorsV2 .storyDoor .doorBody,
html[data-theme] .doorsV2 .compactDoor .doorBody {
  display: flex !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: none !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
}
html[data-theme] .storyDoorBody { gap: 8px !important; }
html[data-theme] .storyPremise {
  margin: 0 0 3px !important;
  font-size: 10px !important;
  line-height: 1.35 !important;
}
html[data-theme] .storyDoor #storyMetaMount { margin: 0 !important; }
html[data-theme] .storyDoor .metaHud { margin: 0 !important; }
html[data-theme] .storyDoor .districtOpen {
  min-height: 62px !important;
  padding: 10px 11px !important;
  border-radius: 13px !important;
}
html[data-theme] .storyDoor .metaHudCopy b { font-size: 12px !important; }
html[data-theme] .storyDoor .metaHudCopy small { font-size: 7px !important; }
html[data-theme] .storyDoor .metaHudCopy em { font-size: 7px !important; }
html[data-theme] .storyDoor .metaWallet>span { min-width: 44px !important; }
html[data-theme] .storyDoor .metaWallet i { font-size: 11px !important; }

html[data-theme] .door[data-door="bots"] .doorBody { gap: 8px !important; }
html[data-theme] .lobbySetup {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 0 !important;
  overflow: hidden !important;
  border-radius: 13px !important;
}
html[data-theme] .lobbyRow { padding: 9px 9px !important; }
html[data-theme] .lobbyLabel { margin-bottom: 7px !important; font-size: 7px !important; }
html[data-theme] .seatPicker { display: grid !important; grid-template-columns: repeat(6, minmax(0,1fr)) !important; gap: 5px !important; }
html[data-theme] .seatPick { min-width: 0 !important; min-height: 34px !important; padding: 0 !important; }
html[data-theme] .clockToggle { min-height: 36px !important; font-size: 9px !important; }
html[data-theme] .quickSummary {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  margin: 0 !important;
}
html[data-theme] .quickSummary span { font-size: 6px !important; padding: 4px 6px !important; }
html[data-theme] #lobbyStart, html[data-theme] .lobbyOnline {
  margin-top: auto !important;
  min-height: 54px !important;
  flex: 0 0 auto !important;
}
html[data-theme] #lobbyStart em, html[data-theme] .lobbyOnline em { font-size: 7px !important; }

html[data-theme] .door[data-door="live"] .doorText {
  margin: 0 !important;
  font-size: 9px !important;
  line-height: 1.45 !important;
  color: rgba(230,244,255,.64) !important;
}

html[data-theme] #rulesOpen {
  grid-column: 1 !important;
  grid-row: 3 !important;
  justify-self: start !important;
  margin: 0 !important;
  padding: 2px 0 !important;
  font-size: 8px !important;
  opacity: .58 !important;
}

/* Story map itself also stays inside one viewport. */
html[data-theme] .districtMap, html[data-theme] #tutorial.storyTutorial, html[data-theme] #endScreen, html[data-theme] #colorPicker {
  max-width: 100vw !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}

/* No developer/build badges. */
html[data-theme] .v7BuildBadge { display: none !important; }

/* Short desktop screens: compress, never scroll. */
@media (max-height: 760px) and (min-width: 861px) {
  html[data-theme] #lobby.overlay { padding: 8px !important; }
  html[data-theme] #lobby .lobbyWindow { height: calc(100dvh - 16px) !important; width: calc(100vw - 16px) !important; padding: 12px 14px 10px !important; }
  html[data-theme] #lobbyMain { gap: 7px !important; }
  html[data-theme] .lobbyHead h2 { font-size: clamp(28px, 3.4vw, 44px) !important; }
  html[data-theme] .lobbyLead { font-size: 8px !important; }
  html[data-theme] .doorsV2 { gap: 8px !important; }
  html[data-theme] .doorsV2 .door, html[data-theme] .doorsV2 .door.chosen { padding: 11px !important; }
  html[data-theme] .doorsV2 .doorPick, html[data-theme] .doorsV2 .storyDoor .doorPick { padding-bottom: 7px !important; gap: 3px !important; }
  html[data-theme] .doorsV2 .doorPick b, html[data-theme] .doorsV2 .storyDoor .doorPick b { font-size: clamp(18px, 1.8vw, 26px) !important; }
  html[data-theme] .storyDoor .districtOpen { min-height: 52px !important; padding: 7px 9px !important; }
  html[data-theme] .lobbyRow { padding: 6px 7px !important; }
  html[data-theme] .seatPick { min-height: 30px !important; }
  html[data-theme] .clockToggle { min-height: 31px !important; }
  html[data-theme] #lobbyStart, html[data-theme] .lobbyOnline { min-height: 46px !important; }
}

/* Narrow viewport: still one screen — three compact columns, no stacking scroll. */
@media (max-width: 860px) {
  html[data-theme] #lobby.overlay { padding: 6px !important; }
  html[data-theme] #lobby .lobbyWindow { width: calc(100vw - 12px) !important; height: calc(100dvh - 12px) !important; padding: 10px !important; border-radius: 14px !important; }
  html[data-theme] .lobbyHead h2 { font-size: 28px !important; }
  html[data-theme] .lobbyLead { display: none !important; }
  html[data-theme] .doorsV2 { grid-template-columns: 1.16fr 1fr .86fr !important; gap: 6px !important; }
  html[data-theme] .doorsV2 .door, html[data-theme] .doorsV2 .door.chosen { padding: 8px !important; border-radius: 12px !important; }
  html[data-theme] .doorsV2 .doorPick b, html[data-theme] .doorsV2 .storyDoor .doorPick b { font-size: 14px !important; }
  html[data-theme] .doorsV2 .doorPick em { display: none !important; }
  html[data-theme] .doorKicker { font-size: 5px !important; }
  html[data-theme] .storyPremise, html[data-theme] .door[data-door="live"] .doorText { font-size: 7px !important; }
  html[data-theme] .storyDoor .metaWallet { display: none !important; }
  html[data-theme] .storyDoor .districtOpen { grid-template-columns: 10px minmax(0,1fr) 14px !important; min-height: 46px !important; padding: 6px !important; gap: 5px !important; }
  html[data-theme] .storyDoor .metaHudCopy b { font-size: 9px !important; }
  html[data-theme] .seatPicker { gap: 2px !important; }
  html[data-theme] .seatPick { min-height: 26px !important; font-size: 9px !important; }
  html[data-theme] .lobbyLabel { font-size: 5px !important; }
  html[data-theme] .quickSummary { display: none !important; }
  html[data-theme] #lobbyStart, html[data-theme] .lobbyOnline { min-height: 40px !important; padding: 5px !important; font-size: 9px !important; }
  html[data-theme] #rulesOpen { display: none !important; }
}

/* Live-room panel must also fit the same one-screen lobby. */
html[data-theme] #roomPanel:not(.hidden) {
  width: min(760px, 100%) !important;
  height: 100% !important;
  margin: 0 auto !important;
  padding: 8px 12px !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  display: grid !important;
  grid-template-rows: auto auto auto minmax(0,1fr) auto auto auto !important;
  gap: 7px !important;
  align-content: stretch !important;
}
html[data-theme] #roomPanel .roomCode { margin: 0 !important; font-size: clamp(30px,5vh,44px) !important; }
html[data-theme] #roomPanel .roomCopy { padding: 9px !important; }
html[data-theme] #roomPanel .roomPlayers { margin: 0 !important; gap: 4px !important; overflow: hidden !important; align-content: start !important; }
html[data-theme] #roomPanel .roomSeat { padding: 6px 10px !important; min-height: 0 !important; }
html[data-theme] #roomPanel .roomTools { margin: 0 !important; }
html[data-theme] #roomPanel .roomStart, html[data-theme] #roomPanel .roomLeave { min-height: 40px !important; margin: 0 !important; }
html[data-theme] #roomPanel .lobbyNote { margin: 0 !important; }


/* =========================================================
   V8 STABILIZATION PASS — 2026-10-01
   ========================================================= */
html[data-ui-pass="v8-stabilization"],
html[data-ui-pass="v8-stabilization"] body {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

/* Opponent names shrink in JS before they are ever allowed to wrap vertically. */
html[data-ui-pass="v8-stabilization"] .opponentName {
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  text-overflow: clip !important;
  line-height: 1.05 !important;
}
html[data-ui-pass="v8-stabilization"] .opponentPlate {
  min-width: 0 !important;
  overflow: visible !important;
}

/* Authored PNG arms are only a temporary interaction cue.  Never show both
   arms over the hand and never pretend they are the requested 3D hand rig. */
html[data-ui-pass="v8-stabilization"] .v15Hands {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 120ms linear !important;
}
html[data-ui-pass="v8-stabilization"] body.v15-grab-left:not(.v8-hand-packed) .v15Hands,
html[data-ui-pass="v8-stabilization"] body.v15-grab-right:not(.v8-hand-packed) .v15Hands {
  opacity: .32 !important;
}
html[data-ui-pass="v8-stabilization"] body.v15-grab-left .v15Hands .v10Arm.left,
html[data-ui-pass="v8-stabilization"] body.v15-grab-right .v15Hands .v10Arm.right {
  opacity: .72 !important;
  filter: brightness(.72) saturate(.88) contrast(1.06) !important;
}
html[data-ui-pass="v8-stabilization"] body.v15-grab-left .v15Hands .v10Arm.right,
html[data-ui-pass="v8-stabilization"] body.v15-grab-right .v15Hands .v10Arm.left {
  opacity: 0 !important;
}
html[data-ui-pass="v8-stabilization"] body.v8-hand-dense .v15Hands,
html[data-ui-pass="v8-stabilization"] body.v8-hand-packed .v15Hands {
  opacity: 0 !important;
}

/* Dense hands need visual room more than decorative chrome. */
html[data-ui-pass="v8-stabilization"] body.v8-hand-dense #hand {
  width: min(1120px, 88vw) !important;
}
html[data-ui-pass="v8-stabilization"] body.v8-hand-packed #hand {
  width: min(1280px, 94vw) !important;
}

/* Explicitly defeat every legacy custom cursor layer loaded earlier. */
@media (pointer:fine) {
  html[data-ui-pass="v8-stabilization"],
  html[data-ui-pass="v8-stabilization"] body,
  html[data-ui-pass="v8-stabilization"] #game { cursor: default !important; }
  html[data-ui-pass="v8-stabilization"] button,
  html[data-ui-pass="v8-stabilization"] a,
  html[data-ui-pass="v8-stabilization"] [role="button"] { cursor: pointer !important; }
  html[data-ui-pass="v8-stabilization"] #hand .handCard,
  html[data-ui-pass="v8-stabilization"] #deck { cursor: grab !important; }
  html[data-ui-pass="v8-stabilization"] #hand .handCard:active,
  html[data-ui-pass="v8-stabilization"] #deck:active { cursor: grabbing !important; }
}

/* Very short desktop windows: keep the three modes in the viewport rather
   than hiding controls behind overflow:hidden. */
@media (min-width: 861px) and (max-height: 680px) {
  html[data-theme] #lobby .lobbyWindow { padding: 8px 10px 7px !important; }
  html[data-theme] #lobbyMain { gap: 5px !important; }
  html[data-theme] .lobbyHead h2 { font-size: 28px !important; }
  html[data-theme] .lobbyHead .windowEyebrow, html[data-theme] .lobbyLead { display: none !important; }
  html[data-theme] .doorsV2 { gap: 6px !important; }
  html[data-theme] .doorsV2 .door, html[data-theme] .doorsV2 .door.chosen { padding: 8px !important; }
  html[data-theme] .doorsV2 .doorPick b, html[data-theme] .doorsV2 .storyDoor .doorPick b { font-size: 18px !important; }
  html[data-theme] .storyPremise { font-size: 8px !important; }
  html[data-theme] .storyDoor .districtOpen { min-height: 44px !important; }
  html[data-theme] .lobbyRow { padding: 5px 6px !important; }
  html[data-theme] .seatPick, html[data-theme] .clockToggle { min-height: 27px !important; }
  html[data-theme] #lobbyStart, html[data-theme] .lobbyOnline { min-height: 40px !important; }
}

/* 27.11: СЮЖЕТ — первая и самая широкая дверь на любом экране; С БОТАМИ и
   С ЖИВЫМИ — рядом под ним. Селекторы с html[data-theme], иначе старый
   v7.css (html[data-theme="v7"] .doorsV2 {flex column; bots order -3})
   перебивал эту раскладку и прятал СЮЖЕТ под сгиб (y≈801 на 1280×800). */
html[data-theme] #lobby .doorsV2 {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  align-content: stretch !important;
  overflow: hidden !important;
}
html[data-theme] #lobby .doorsV2 .door[data-door="story"] { grid-column: 1 / -1 !important; grid-row: 1 !important; height: auto !important; }
html[data-theme] #lobby .doorsV2 .door[data-door="bots"] { grid-column: 1 !important; grid-row: 2 !important; }
html[data-theme] #lobby .doorsV2 .door[data-door="live"] { grid-column: 2 !important; grid-row: 2 !important; }
html[data-theme] #lobby .doorsV2 .door .doorBody { display: flex !important; }

@media (max-width: 860px) {
  html[data-theme] #lobby .doorsV2 {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto !important;
    align-content: start !important;
    gap: 7px !important;
  }
  html[data-theme] #lobby .doorsV2 .door[data-door="story"] { grid-column: 1 !important; grid-row: 1 !important; }
  html[data-theme] #lobby .doorsV2 .door[data-door="bots"] { grid-column: 1 !important; grid-row: 2 !important; height: auto !important; }
  html[data-theme] #lobby .doorsV2 .door[data-door="live"] { grid-column: 1 !important; grid-row: 3 !important; height: auto !important; }
  html[data-theme] #lobby .doorsV2 .doorPick b { font-size: 18px !important; }
  html[data-theme] #lobby .doorsV2 .doorPick em,
  html[data-theme] #lobby .lobbyLead,
  html[data-theme] #lobby .storyPremise,
  html[data-theme] #lobby .quickSummary,
  html[data-theme] #lobby #lobbyStart em,
  html[data-theme] #lobby .lobbyOnline em { display: none !important; }
  html[data-theme] #lobby .doorsV2 .door { padding: 10px !important; }
  html[data-theme] #lobby .doorsV2 .door .doorBody { gap: 6px !important; }
  html[data-theme] #lobby .doorKicker { font-size: 7px !important; }
  html[data-theme] #lobby .seatPick { min-height: 44px !important; min-width: 44px !important; font-size: 13px !important; }
  html[data-theme] #lobby .seatPicker { gap: 4px !important; }
  html[data-theme] #lobby .clockToggle { min-height: 44px !important; }
  html[data-theme] #lobby #lobbyStart, html[data-theme] #lobby .lobbyOnline { min-height: 48px !important; font-size: 12px !important; }
  html[data-theme] #lobby .door[data-door="live"] .doorText { display: none !important; }
}
/* Телефон лёжа: высоты нет — три колонки рядом, СЮЖЕТ слева. */
@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  html[data-theme] #lobby .lobbyHead h2 { font-size: 22px !important; margin: 0 !important; }
  html[data-theme] #lobby .lobbyHead .windowEyebrow { display: none !important; }
  html[data-theme] #lobby .doorsV2 {
    grid-template-columns: 1.1fr 1fr .8fr !important;
    grid-template-rows: minmax(0, 1fr) !important;
    align-content: stretch !important;
  }
  html[data-theme] #lobby .doorsV2 .door[data-door="story"] { grid-column: 1 !important; grid-row: 1 !important; height: 100% !important; }
  html[data-theme] #lobby .doorsV2 .door[data-door="bots"] { grid-column: 2 !important; grid-row: 1 !important; height: 100% !important; }
  html[data-theme] #lobby .doorsV2 .door[data-door="live"] { grid-column: 3 !important; grid-row: 1 !important; height: 100% !important; }
  html[data-theme] #lobby .doorsV2 .doorPick b { font-size: 15px !important; }
  html[data-theme] #lobby .storyDoor::after { display: none !important; }
  html[data-theme] #lobby .seatPick { min-height: 40px !important; }
  html[data-theme] #lobby .lobbyRow { padding: 5px !important; }
  html[data-theme] #lobby .lobbyLabel { display: none !important; }
  /* название стола в двери СЮЖЕТ целиком: было «ПОДВО…» */
  html[data-theme] #lobby .storyDoor .metaHudCopy b { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; font-size: 11px !important; line-height: 1.1 !important; }
  html[data-theme] #lobby .storyDoor .districtOpen { grid-template-columns: 10px minmax(0, 1fr) 14px !important; }
  html[data-theme] #lobby .storyDoor .metaWallet { grid-column: 2 !important; grid-row: 2 !important; justify-content: flex-start !important; }
}
/* 27.11: v8.css зашивал «POT · 1 250 CR» на столе и в итоге — спорило с банком стола. */
html[data-render] .endWindow::after, html[data-render] .v8Pot::after { content: none !important; display: none !important; }
/* 27.11: телефон лёжа — шесть кнопок числа ботов по 44 точки (были 34×40). */
@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  html[data-theme] #lobby .seatPicker { grid-template-columns: repeat(3, minmax(44px, 1fr)) !important; gap: 4px !important; }
  html[data-theme] #lobby .seatPick { min-height: 44px !important; min-width: 44px !important; }
  html[data-theme] #lobby .clockToggle { min-height: 44px !important; }
}
/* 27.11: телефон — маршрут главы сеткой 2×3 (ux-v4 задавал сетку, но ux-v2 оставлял
   горизонтальную ленту по 260px: в колонке 185px был виден один стол из шести). */
@media (max-width: 860px) {
  html[data-theme] .districtNodes.campaignRoute { display: grid !important; overflow: hidden !important; }
  html[data-theme] .districtNodes.campaignRoute > .storyNode { width: auto !important; min-width: 0 !important; }
}
/* 27.11: телефон стоя — главы друг под другом, в главе 3×2, название стола целиком
   (в плитке 86 px на текст оставалось ~13 px: «П…», «Л…»). */
@media (max-width: 500px) and (orientation: portrait) {
  html[data-theme] .campaignStory { grid-template-rows: auto minmax(0, 1fr) !important; }
  html[data-theme] .campaignMapWrap { height: auto !important; grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto auto auto auto !important; row-gap: 3px !important; overflow: visible !important; }
  html[data-theme] .campaignChapterLabel:not(.chapterTwo) { grid-column: 1 !important; grid-row: 1 !important; }
  html[data-theme] #districtNodes1 { grid-column: 1 !important; grid-row: 2 !important; }
  html[data-theme] .campaignChapterLabel.chapterTwo { grid-column: 1 !important; grid-row: 3 !important; }
  html[data-theme] #districtNodes2 { grid-column: 1 !important; grid-row: 4 !important; }
  html[data-theme] .districtNodes.campaignRoute { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; grid-template-rows: repeat(2, 46px) !important; }
  html[data-theme] .districtNodes .storyNode { grid-template-columns: 28px minmax(0, 1fr) 10px !important; gap: 4px !important; }
  html[data-theme] .districtNodes .storyNodeIndex { display: none !important; }
  html[data-theme] .districtNodes .storyNodeCopy { min-width: 0 !important; overflow: visible !important; }
  html[data-theme] .districtNodes .storyNodeCopy b { font-size: 7.5px !important; letter-spacing: .01em !important; line-height: 1.15 !important; white-space: normal !important; overflow: hidden !important; text-overflow: clip !important; overflow-wrap: normal !important; }
}

/* 27.11: стол на телефоне. Рука не закрывает «ТЫ», панель хода не лежит на сбросе.
   Замер — test/kadr-telefon.mjs (390×844 и 844×390). */
@media (max-width: 500px) and (orientation: portrait) {
  html[data-theme] #playerArea #hand { bottom: 68px !important; }
  html[data-theme] .actionHUD {
    left: 10px !important; right: 10px !important; top: auto !important;
    bottom: calc(var(--safe-bottom, 0px) + 268px) !important;
    width: auto !important; max-width: none !important; height: auto !important; max-height: none !important;
    transform: none !important; padding: 6px 8px !important;
    display: grid !important; grid-template-columns: minmax(0, 1fr) auto !important; gap: 4px 8px !important; align-items: center !important;
  }
  html[data-theme] .actionHUD #status { grid-column: 1 / -1 !important; }
  html[data-theme] .actionHUD #turnRule { width: auto !important; min-width: 0 !important; }
}
@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  html[data-theme] #playerArea #hand { bottom: 50px !important; left: calc(50% - 128px) !important; width: min(540px, calc(100vw - 290px)) !important; }
  html[data-theme] .actionHUD {
    left: auto !important; right: 8px !important; top: auto !important;
    bottom: calc(var(--safe-bottom, 0px) + 42px) !important;
    width: 236px !important; max-width: none !important; height: auto !important; max-height: none !important; transform: none !important; padding: 6px 8px !important;
  }
  html[data-theme] .actionHUD #status, html[data-theme] .actionHUD #turnRule { width: auto !important; min-width: 0 !important; white-space: normal !important; }
  /* «ТЫ» — справа, под панелью хода: слева низ полосы занят краями веера. */
  html[data-theme] #playerArea .playerHUD .youLabel { margin-left: auto !important; margin-right: 8px !important; }
}
/* 27.11: респект и крипта в двери СЮЖЕТ видны и на телефоне (старый узкий блок их прятал). */
@media (max-width: 860px) {
  html[data-theme] #lobby .storyDoor .metaWallet { display: flex !important; }
}
@media (max-width: 500px) and (orientation: portrait) {
  html[data-theme] #lobby .storyDoor .districtOpen { grid-template-columns: 10px minmax(0, 1fr) auto 14px !important; }
}
@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  html[data-theme] #lobby .storyDoor .districtOpen { height: auto !important; min-height: 0 !important; padding-bottom: 8px !important; }
  html[data-theme] #lobby .storyDoor .metaHudArrow { grid-column: 3 !important; grid-row: 1 / span 2 !important; }
}
/* 27.11 приёмка Fable Д1: на 844×390 пустая коробка руки лежала на 2/3 колоды и съедала касания. */
@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  html[data-theme] #playerArea #hand { pointer-events: none !important; }
  html[data-theme] #playerArea #hand .handCard { pointer-events: auto !important; }
}
/* 27.11 (С2): карта района на телефоне лёжа — весь текст ≥12 px (было 5–7 px). */
@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  html[data-theme] #districtMap .windowEyebrow,
  html[data-theme] #districtMap .campaignBrand p,
  html[data-theme] #districtMap .districtStats small,
  html[data-theme] #districtMap .districtStats b,
  html[data-theme] #districtMap .campaignTabs button,
  html[data-theme] #districtMap .campaignChapterLabel span,
  html[data-theme] #districtMap .campaignChapterLabel em,
  html[data-theme] #districtMap .dossierChapter,
  html[data-theme] #districtMap .storyNodeIndex,
  html[data-theme] #districtMap .storyNodeState { font-size: 12px !important; letter-spacing: .02em !important; }
  html[data-theme] #districtMap .campaignBrand p, html[data-theme] #districtMap .campaignChapterLabel em { display: none !important; }
  html[data-theme] #districtMap .campaignTabs button { min-height: 36px !important; padding: 0 12px !important; }
  html[data-theme] #districtMap .districtNodes .storyNode { grid-template-columns: 18px 30px minmax(0, 1fr) 14px !important; gap: 5px !important; }
  html[data-theme] #districtMap .districtNodes .storyNodeCopy b { font-size: 12px !important; line-height: 1.08 !important; white-space: normal !important; overflow: hidden !important; text-overflow: clip !important; letter-spacing: 0 !important; }
}
/* 27.11: десктоп — текст панели хода внутри её рамки (дети были шире на 16 px с каждой
   стороны, рамка 290 px высотой стояла пустой). */
@media (min-width: 861px) {
  html[data-theme][data-physical3d] .actionHUD { top: auto !important; height: auto !important; min-height: 0 !important; max-height: none !important; width: 272px !important; max-width: none !important; padding: 10px !important; align-content: start !important; gap: 8px !important; box-sizing: border-box !important; }
  html[data-theme][data-physical3d] .actionHUD > * { width: 100% !important; max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; box-sizing: border-box !important; }
}
/* 27.11: перетаскиваемая карта рисуется в 3D-канвасе под DOM-панелями — пока карту
   тянут (#center.drop-ready), панели почти прозрачны и не закрывают её. */
html:has(#center.drop-ready) .actionHUD,
html:has(#center.drop-ready) .opponentPlate,
html:has(#center.drop-ready) .opponent,
html:has(#center.drop-ready) #v13TurnBeacon { opacity: .14 !important; transition: opacity .12s linear !important; }

/* п.7ф (28.11): дымка бара body::after была inset:-20% — страница выше окна на 20% (dym: 172 px на 860).
   Теперь в границах окна; «дыхание» — масштаб ≤ 0.98 со сдвигом 1%, за край не выходит. */
html[data-theme] body::after{inset:0!important;animation-name:acidBarBreathIn}
@keyframes acidBarBreathIn{from{transform:translate3d(-1%,1%,0) scale(.96)}to{transform:translate3d(1%,-1%,0) scale(.98)}}
/* п.7ф: веер соперника вне коробки кнопки (см. liftOpponentFans в final-v7-ui.js). */
html[data-theme] .opponent.acidFanOut{margin-top:calc(var(--fanLift) / 2 + var(--fanNudgeY, 0px))!important;margin-left:calc(var(--fanShiftX, 0px) + var(--fanNudgeX, 0px))!important;width:var(--fanBoxW)!important;min-width:0!important;max-width:none!important}
html[data-theme] .opponent.acidFanOut .opponentFan{position:absolute!important;top:var(--fanTop)!important;left:var(--fanLeft, 0px)!important;margin:0!important}
/* п.7ф/сдвиг (28.11): плашку сюжета meta.js вставляет в #storyMetaMount уже после первой отрисовки —
   двери ехали вниз на 52 px, касание по «НАЧАТЬ ПАРТИЮ» попадало в «ТАЙМЕР» (dym --telefon, 390×844).
   Пока плашки нет, дверей нет вовсе (display:none — visibility дети перебивали, Fable 28.11: 4/6 касаний
   в «ТАЙМЕР»). Класс acidDoorsReady ставит final-v7-ui.js по вставке плашки, запасной — через 2 с. */
html[data-theme]:not(.acidDoorsReady) #doors{display:none!important}
/* п.7ф (28.11): учебный тур на телефоне боком (844×390) был 567 px в столбик — рука новичка за краем,
   окно прокручивалось на 177 px. Здесь — две колонки: слева реплика и кнопки, справа стол и рука. */
@media (orientation: landscape) and (max-height: 500px) {
  html[data-theme] #tutorial:not(.storyTutorial) { padding: 8px !important; overflow: hidden !important; }
  html[data-theme] #tutorial:not(.storyTutorial) .tourWindow {
    display: grid !important; box-sizing: border-box !important;
    width: min(100%, 980px) !important; max-width: none !important; height: calc(100dvh - 16px) !important; max-height: none !important;
    margin: 0 auto !important; padding: 10px 14px !important; overflow: hidden !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) !important;
    grid-template-rows: auto auto 1fr auto auto !important;
    grid-template-areas: "head table" "title table" "hint hand" "status hand" "actions hand" !important;
    column-gap: 14px !important; row-gap: 6px !important; align-items: center !important;
  }
  html[data-theme] #tutorial:not(.storyTutorial) .tutorialStoryHead { grid-area: head !important; margin: 0 !important; }
  html[data-theme] #tutorial:not(.storyTutorial) .tutorialPortrait { width: 40px !important; height: 40px !important; }
  html[data-theme] #tutorial:not(.storyTutorial) #tutorialLine { display: none !important; }
  html[data-theme] #tutorial:not(.storyTutorial) #tutorialTitle { grid-area: title !important; margin: 0 !important; font-size: 20px !important; line-height: 1.1 !important; text-align: left !important; }
  html[data-theme] #tutorial:not(.storyTutorial) .tutorialHint { grid-area: hint !important; margin: 0 !important; text-align: left !important; align-self: start !important; }
  html[data-theme] #tutorial:not(.storyTutorial) .tutorialTable { grid-area: table !important; margin: 0 !important; padding: 6px !important; min-height: 0 !important; }
  html[data-theme] #tutorial:not(.storyTutorial) .tutorialHandTitle { display: none !important; }
  html[data-theme] #tutorial:not(.storyTutorial) .tutorialHand { grid-area: hand !important; margin: 0 !important; align-self: start !important; }
  html[data-theme] #tutorial:not(.storyTutorial) .tutorialStatus { grid-area: status !important; margin: 0 !important; text-align: left !important; }
  html[data-theme] #tutorial:not(.storyTutorial) .tutorialActions { grid-area: actions !important; margin: 0 !important; }
  html[data-theme] #tutorial:not(.storyTutorial) #tutorialFinish { grid-area: actions !important; margin: 0 !important; }
}
/* п.7ф (28.11): «Правила целиком» страницами (src/stranicy.js), без прокрутки. */
html[data-theme] .rulesBody{overflow:hidden!important;position:relative!important}
html[data-theme] .rulesPager{padding:6px 0 4px}
@media (orientation: landscape) and (max-height: 500px) {
  html[data-theme] #rules .rulesWindow{height:calc(100dvh - 16px)!important;max-height:none!important;padding:8px 16px 10px!important;
    display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;grid-template-rows:auto minmax(0,1fr) auto!important;grid-template-areas:"title title" "body body" "pager close"!important;column-gap:12px!important}
  html[data-theme] #rules .rulesWindow > h2{grid-area:title}
  html[data-theme] #rules .rulesScroller{grid-area:body;min-height:0!important}
  html[data-theme] #rules .rulesPager{grid-area:pager;padding:0!important}
  html[data-theme] #rules #rulesClose{grid-area:close;margin:0!important}
  html[data-theme] #rules .rulesWindow > .windowEyebrow{display:none!important}
  html[data-theme] #rules .rulesWindow > h2{font-size:18px!important;margin:0!important;line-height:1.1!important}
  html[data-theme] #rules .rulesBody{margin:6px 0!important}
  html[data-theme] #rules #rulesClose{min-height:44px!important;padding:0 18px!important}
}
@media (max-width: 640px) {
  html[data-theme] #rules .rulesWindow{height:calc(100dvh - 24px)!important;max-height:none!important}
}
/* п.7ф (28.11, Fable): сюжетный тур боком — карты руки уходили на 25 px за низ (288..415 при 390). */
@media (orientation: landscape) and (max-height: 500px) {
  html[data-theme] #tutorial.storyTutorial .tutorialHand{bottom:34px!important;height:120px!important}
  html[data-theme] #tutorial.storyTutorial .tutorialTable{min-height:0!important;height:calc(100dvh - 150px)!important;top:42%!important}
}
@media (max-width: 640px) and (orientation: portrait) {
  html[data-theme] #tutorial.storyTutorial .tutorialHand{bottom:64px!important}
}
/* п.7ф (28.11, Fable): 5–6 ботов на телефоне — десктопные таблички 224 px с именами наезжали друг на друга
   (до 177 px) и на панель хода. На телефоне — компактная табличка, как при 4 ботах: аватар и счёт карт. */
@media (max-width: 640px), (orientation: landscape) and (max-height: 500px) {
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="5"] .opponent,
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="6"] .opponent{width:142px!important}
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="5"] .opponentPlate,
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="6"] .opponentPlate{width:auto!important;max-width:none!important}
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="5"] .opponentName,
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="6"] .opponentName{display:none!important}
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="5"] .opponentFace,
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="6"] .opponentFace{width:44px!important;height:44px!important;flex:0 0 44px!important}
}
@media (max-width: 640px), (orientation: landscape) and (max-height: 500px) {
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="5"] .opponentPlate,
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="6"] .opponentPlate{padding-left:5px!important;padding-right:5px!important;gap:5px!important}
}
@media (max-width: 640px), (orientation: landscape) and (max-height: 500px) {
  html[data-theme] #rules{padding:8px!important;overflow:hidden!important}
  html[data-theme] #rules .rulesWindow{height:calc(100dvh - 16px)!important;box-sizing:border-box!important}
}
/* 28.11 (мера kadr-stol-vidim): боком верх карт руки заходил на низ колоды и сброса на 6 px — центр выше на 10 px. */
@media (orientation: landscape) and (max-height: 500px) {
  html[data-theme] #center{translate:0 -10px}
}
@media (orientation: landscape) and (max-height: 500px) {
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="5"] .opponentPlate,
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="6"] .opponentPlate{min-height:0!important;height:auto!important;padding-top:4px!important;padding-bottom:4px!important}
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="5"] .opponentFace,
  html[data-physical3d="ready"] body #game #opponents.opponents[data-count="6"] .opponentFace{width:38px!important;height:38px!important;flex:0 0 38px!important}
}
/* 29.11 «странные карточки»: там, где карту рисует DOM (урок, правила), — авторское лицо из модели
   MASTER V7 (assets/faces, слой .acidFaceArt из game.js cardFaceHTML) вместо самодельных CSS-слоёв. */
.acidFaceArt{display:none}
html[data-theme] :is(#tutorial, #rules) .card{background:transparent!important;border:0!important;overflow:visible!important}
html[data-theme] :is(#tutorial, #rules) .card .v7Card3D > :not(.acidFaceArt){display:none!important}
html[data-theme] :is(#tutorial, #rules) .card .acidFaceArt{display:block;position:absolute;inset:0;z-index:5;border-radius:7%;
  background-position:center;background-size:100% 100%;background-repeat:no-repeat;
  box-shadow:0 10px 24px rgba(0,0,0,.55),0 0 18px color-mix(in srgb,var(--acid-face-glow,#7df) 45%,transparent)}
html[data-theme] :is(#tutorial, #rules) .card.red{--acid-face-glow:#ff2d55}
html[data-theme] :is(#tutorial, #rules) .card.blue{--acid-face-glow:#2f8bff}
html[data-theme] :is(#tutorial, #rules) .card.green{--acid-face-glow:#2bff6a}
html[data-theme] :is(#tutorial, #rules) .card.yellow{--acid-face-glow:#ffd21f}
html[data-theme] :is(#tutorial, #rules) .card.wild{--acid-face-glow:#c45cff}
/* 29.11: карты урока были 52×78 px — крупнее, по пропорции лица 350×500; боком ограничены высотой. */
html[data-theme] #tutorial .tutorialCard{width:min(118px, 21vw, 19dvh)!important;height:auto!important;aspect-ratio:350/500!important;padding:0!important;min-width:0!important}
html[data-theme] #tutorial .tutorialCard .card,
html[data-theme] #tutorial #tutorialTop .card{width:100%!important;height:100%!important;min-width:0!important;min-height:0!important}
html[data-theme] #tutorial #tutorialTop{width:min(150px, 28vw, 26dvh)!important;height:auto!important;aspect-ratio:350/500!important}
@media (orientation: landscape) and (max-height: 500px) {
  html[data-theme] #tutorial #tutorialTop{width:18dvh!important}
}
/* 29.11: фон стола — чистый арт арены текущего стола (src/assets.js dressArena, --arena-art) вместо
   assets/v7/bar-bg.webp: тот был макетом-скриншотом с впечатанными табличками «ВИКТОР», «АННА» и картами. */
html[data-theme] body{background:#02030a!important}
html[data-theme] #arena[data-art="1"]{background-image:linear-gradient(180deg,rgba(2,3,10,.30),rgba(2,3,10,.62)),var(--arena-art)!important;
  background-size:cover!important;background-position:center!important;background-repeat:no-repeat!important}
@media (min-width: 901px) and (max-height: 760px) {
  html[data-theme] #tutorial .tutorialCard{width:min(118px, 15dvh)!important}
}
/* 29.11: в 3D-сцене колода уходит «за» плоскость .tableInner, и касание по её центру получал стол
   (1280×720 и 390×844; dym — «касания не дошли»). Стол событий не ловит — колода и сброс ловят сами. */
html[data-theme] .tableInner{pointer-events:none!important}
html[data-theme] .tableInner #deck, html[data-theme] .tableInner #discard{pointer-events:auto!important}

/* 29.11 — решение Сергея («7, да»): зелёная масть стала фиолетовой, как пропуск на эталоне ___best.png.
   Ключ масти "green" в движке прежний; здесь — только вид DOM-карт, выбора цвета, ауры стола.
   Модели и лица перекрашены test/tools/perekraska-masti.mjs. Рамка «дикой» — золото (в моделях). */
:root, html[data-theme], html[data-deck="acid"] {
  --green: #c04bff;
  --green-light: #e0a6ff;
  --green-deep: #5e14a0;
  --v7-green: #c04bff;
}
html[data-theme] :is(#tutorial, #rules) .card.green { --acid-face-glow: #c04bff; }
.colorWheel .pick.green, html[data-render="v8"] .colorWheel .pick.green { --pick: #c04bff; background: #c04bff; }
.tableInner.color-green { box-shadow: inset 0 0 46px rgba(192, 75, 255, .10); }
@keyframes flashGreen {
  0% { opacity: 0; }
  18% { opacity: .34; background: rgba(192, 75, 255, .30); }
  100% { opacity: 0; }
}
/* «ФИОЛЕТОВЫЙ» на 3 буквы длиннее «РОЗОВЫЙ»: при разрядке .12em упирался в рамку кнопки на телефоне. */
html[data-v11="1"] .colorWheel .pick.green::after { letter-spacing: .04em !important; font-size: 13px !important; }

/* «НА САЙТ» (свод п.29б): ссылка наружу, область ≥44, видна в лобби и в партии; «ГЛАВНОЕ МЕНЮ» в лобби скрыта —
   там она ничего не делает (Рот 29.11). */
#siteLink { display:inline-grid; grid-auto-flow:column; place-items:center; gap:6px; min-width:44px; min-height:44px;
  padding:0 12px; text-decoration:none; color:inherit; white-space:nowrap; }
body.lobby-open #homeLink { display:none !important; }
/* Подпись видна всегда (Рот 29.11: голый ↩ читается как «назад»); на узких — «САЙТ». */
#siteLink { width:auto !important; padding:0 12px !important; }
#siteLink .siteWord, #siteLink .siteNa { display:inline !important; font-size:12px; letter-spacing:.06em; font-weight:800; }
@media (max-width: 700px), (max-height: 500px) { #siteLink { padding:0 9px !important; gap:4px; } #siteLink .siteNa { display:none !important; } }
body.lobby-open .topbar { z-index:80001 !important; pointer-events:none; }
body.lobby-open .topbar #siteLink { pointer-events:auto; }
