:root {
  --paper: #efe6d2;
  --paper-2: #e6dabf;
  --paper-3: #f7f1e3;
  --ink: #2b2118;
  --ink-2: #5b4a3a;
  --muted: #8a7863;
  --line: #cdbb98;
  --ox: #7a2e22;
  --ox-2: #9b3d2d;
  --moss: #4f5e3e;
  --slate: #3f4d5c;
  --gold: #a8812f;
  --holmes: #3f4d5c;
  --watson: #6b4a2b;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 2px 10px rgba(60,40,20,.12);
  --serif: 'PT Serif', Georgia, 'Times New Roman', serif;
  --display: 'Cormorant Garamond', 'PT Serif', Georgia, serif;

  /* Токены контролов: менять форму всех кнопок, полей, вкладок и переключателей — только здесь. */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --control-h: 38px;
  --control-h-sm: 30px;
  --control-px: 16px;
  --control-px-sm: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --fs-xs: 12px;
  --fs-sm: 13.5px;
  --fs-md: 15px;
  --surface: var(--paper-3);
  --surface-2: var(--paper-2);
  --surface-hover: #fff9ec;
  --border: var(--line);
  --border-strong: var(--ink-2);
  --accent: var(--ox);
  --accent-hover: var(--ox-2);
  --on-accent: #fbf3e4;
  --focus-ring: 0 0 0 3px rgba(122,46,34,.22);
  --elev-1: 0 1px 2px rgba(60,40,20,.08), 0 2px 8px rgba(60,40,20,.07);
  --elev-2: 0 8px 24px rgba(43,33,24,.22);
  --ease: .15s ease;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper);
  background-image: radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.55), transparent 60%), radial-gradient(ellipse at 100% 100%, rgba(120,90,50,.12), transparent 50%);
  color: var(--ink);
  font: 15px/1.5 var(--serif);
}
button {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill); min-height: var(--control-h); padding: 0 var(--control-px);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  cursor: pointer; transition: background var(--ease), border-color var(--ease), box-shadow var(--ease), color var(--ease);
}
button:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-hover); }
button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.big { font-size: 17px; min-height: 46px; padding: 0 26px; }
button.small { font-size: var(--fs-sm); min-height: var(--control-h-sm); padding: 0 var(--control-px-sm); }
button.link { background: none; border: none; color: var(--accent); min-height: 0; padding: 2px 4px; border-radius: var(--radius-xs); }
button.link:hover { text-decoration: underline; background: none; }
input, textarea {
  font: inherit; color: var(--ink); background: #fffaf0; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 14px; width: 100%;
  transition: border-color var(--ease), box-shadow var(--ease);
}
input:not([type=checkbox]):not([type=radio]):not([type=range]) { min-height: var(--control-h); }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
input[type=checkbox] { accent-color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; margin: 0 0 6px; }
h3 { font-size: 20px; } h4 { font-size: 17px; color: var(--ink-2); margin-top: 12px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: auto; }
.check.small { font-size: 13px; color: var(--ink-2); margin: 6px 0; }
.boot { padding: 40px; font-family: var(--display); font-size: 24px; }
.placeholder { display: grid; place-items: center; background: repeating-linear-gradient(45deg, var(--paper-2), var(--paper-2) 6px, var(--paper) 6px, var(--paper) 12px); color: var(--muted); font-family: var(--display); }
.placeholder span { font-size: 28px; opacity: .6; }

/* toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper-3); padding: 10px 18px; border-radius: 6px; z-index: 50; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: 80vw; }
.toast.error { background: var(--ox); }
body.busy { cursor: progress; }
body.reconnecting::after { content: 'Переподключение…'; position: fixed; top: 8px; left: 50%; transform: translateX(-50%); background: var(--ox); color: #fff; padding: 4px 12px; border-radius: 4px; font-size: 13px; z-index: 60; }

/* лобби */
.lobby { max-width: 1100px; margin: 0 auto; padding: 32px 24px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; min-height: 100vh; }
.cover { position: relative; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--paper-2); aspect-ratio: 16/10; overflow: hidden; border-radius: 4px; }
.cover-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-text { position: absolute; inset: auto 0 0 0; padding: 24px 28px; background: linear-gradient(transparent, rgba(30,20,10,.82)); color: #f6ecd8; }
.cover-text h1 { font-size: 46px; line-height: 1.05; color: #fff6e6; }
.cover-text .sub { font-style: italic; margin: 4px 0; }
.kicker { text-transform: uppercase; letter-spacing: .18em; font-size: 12px; color: var(--gold); }
.lobby-forms { display: flex; flex-direction: column; gap: 16px; }
.case-list { display: flex; flex-direction: column; gap: 16px; }
.game-description { line-height: 1.65; overflow-wrap: anywhere; }
.game-description p { margin: 0 0 1em; }
.game-description p:last-child { margin-bottom: 0; }
.cover.small { aspect-ratio: 16/6; }
.cover.small .cover-text h2 { color: #fff6e6; font-size: 30px; margin: 0; }
.cover-text .meta { font-size: 13px; opacity: .85; margin: 2px 0 8px; }
.brand-big { font-family: var(--display); font-size: 44px; font-weight: 700; color: var(--ox); line-height: 1; }
.lobby-forms label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.join-row { display: flex; gap: 8px; }
.lobby-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.lobby-actions.single { grid-template-columns: 1fr; }
.action-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper-2); }
.action-card.main { border-color: var(--ox); background: var(--paper-3); }
.action-card h3 { margin: 0; font-size: 18px; }
.action-card p { margin: 0; font-size: 13.5px; }
.action-card button { margin-top: auto; }
.action-card input { text-transform: uppercase; letter-spacing: .12em; }
.cover[data-case][role=button] { cursor: pointer; }
.cover.selected { outline: 3px solid var(--ox); outline-offset: 2px; }
.join-row input { text-transform: uppercase; letter-spacing: .12em; }

/* выбор ролей */
.roles-screen { max-width: 820px; margin: 0 auto; padding: 24px 24px calc(190px + env(safe-area-inset-bottom, 0px)); text-align: center; }
.roles-screen h2 { font-size: 32px; padding: 0 36px; }
.roles-screen h3 { font-size: 25px; margin-top: 10px; }
.role-instruction { margin: 6px 0 14px; color: var(--ink-2); }
.roles-mode { font-weight: 700; }
.roles-mode input { width: 20px; height: 20px; flex: none; }
.role-mode-help { max-width: 560px; margin: 8px auto 0; font-size: 14px; color: var(--ink-2); }
.role-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 18px 0; }
.role-card { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 16px; border: 2px solid var(--line); border-radius: var(--radius-md); text-align: center; background: var(--paper-3); box-shadow: var(--shadow); }
.role-card.mine { border-color: var(--ox); background: #fff8ea; }
.role-card.taken { opacity: .55; }
.role-portrait { width: 120px; height: 160px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; }
.role-name { font-family: var(--display); font-size: 26px; font-weight: 700; }
.role-title { color: var(--ox); font-style: italic; font-size: 14px; }
.role-choice { align-self: stretch; margin-top: auto; padding: 8px 4px; border-radius: var(--radius-sm); background: var(--ox); color: var(--on-accent); font-weight: 700; }
.role-card.mine .role-choice { background: var(--moss); }
.role-desc { max-width: 600px; font-size: 14px; color: var(--ink-2); margin: 12px auto; }
.role-taken { font-size: 13px; color: var(--moss); font-weight: 700; }
.invite { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.invite code { background: var(--paper-3); border: 1px dashed var(--line); padding: 4px 10px; border-radius: 4px; overflow-wrap: anywhere; min-width: 0; }
.invite-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 860px) { .desktop-invite { display: none; } }
.role-start { position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--paper-3); box-shadow: 0 -3px 16px rgba(60,40,20,.1); }
.role-start-help { margin: 0 0 8px; font-weight: 700; }
.role-start .primary { width: 100%; max-width: 480px; }
.role-waiting { max-width: 600px; margin: 0 auto 8px; font-size: 13px; }
.roles-screen .check { justify-content: center; }

/* игровой экран */
.game { display: grid; grid-template-columns: 290px minmax(0, 1fr) 370px; grid-template-rows: 50px minmax(0, 1fr); height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--paper-2); font-size: 14px; white-space: nowrap; overflow: hidden; }
.brand { font-family: var(--display); font-size: 21px; font-weight: 700; }
.clock { font-weight: 700; color: var(--ox); }
/* срок в шапке: компактная «таблетка», полный список — по клику */
.deadline-chip .pop-btn { min-height: 28px; padding: 0 12px; font-size: var(--fs-sm); color: var(--ink-2); background: var(--surface); max-width: 360px; }
.deadline-chip .pop-btn .dl-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deadline-chip .pop-btn.urgent { color: var(--accent); border-color: var(--accent); background: #fbeee6; }
.pop { position: relative; flex: none; min-width: 0; }
.pop .ico { display: inline-flex; }
.pop-panel { position: fixed; z-index: 65; width: 320px; max-width: calc(100vw - 16px); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--elev-2); padding: var(--space-3) var(--space-4); white-space: normal; font-size: 14px; }
.pop-panel[hidden] { display: none; }
.pop-panel h4 { margin: 0 0 var(--space-2); }
.dl-row { padding: 6px 0; border-top: 1px solid var(--border); }
.dl-row:first-of-type { border-top: none; }
.dl-label { font-weight: 700; }
.help .pop-btn { width: var(--control-h-sm); min-height: var(--control-h-sm); padding: 0; border: none; background: none; color: var(--ink-2); position: relative; }
.help .pop-btn:hover { color: var(--accent); background: none; }
.badge-dot { position: absolute; top: 3px; right: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper-2); }
.tip { margin: 0 0 var(--space-3); line-height: 1.45; }
.spacer { flex: 1; }
.partner .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.partner.on .dot { background: #4c8a3a; }
/* сегментный переключатель (соло: за кого играть) */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); }
.seg button { min-height: 26px; padding: 0 12px; font-size: var(--fs-sm); border: none; background: transparent; }
.seg button.on { background: var(--surface); box-shadow: var(--elev-1); font-weight: 700; }
/* подсказка: лампочка без «кнопочной» плашки, тёплое свечение */
.hint-bulb { min-height: 0; width: 40px; height: 40px; padding: 0; border: none; background: none; border-radius: 50%; flex: none;
  filter: drop-shadow(0 0 6px rgba(241,207,107,.75)); transition: transform var(--ease), filter var(--ease); }
.hint-bulb:hover:not(:disabled) { background: none; transform: translateY(-1px) scale(1.06); filter: drop-shadow(0 0 11px rgba(241,207,107,.95)); }
.hint-bulb:active { transform: scale(.96); }
@media (prefers-reduced-motion: reduce) { .hint-bulb { transition: none; } }

.left, .right { overflow-y: auto; padding: 12px; background: rgba(255,255,255,.18); }
.left { border-right: 1px solid var(--line); }
.right { border-left: 1px solid var(--line); display: flex; flex-direction: column; padding-top: 0; }
.mapwrap { background-color: var(--paper-3); background-size: 100% 100%; background-position: center; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); }
.mapsvg { width: 100%; display: block; }
.mapsvg .route, .mapsvg .route-halo { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
/* маршрут по дороге: светлая подложка и полупрозрачная бордовая линия поверх рисунка карты */
.mapsvg .route-halo { stroke: rgba(255,246,225,.7); }
.mapsvg .route { stroke: rgba(122,46,34,.62); }
.mapsvg .route-halo.dim { opacity: .35; }
.mapsvg .node circle { fill: var(--paper-3); stroke: var(--ink-2); stroke-width: 1.4; }
.mapsvg .node text { font: 600 10.5px var(--serif); fill: var(--ink); paint-order: stroke; stroke: var(--paper-3); stroke-width: 3px; }
.mapsvg .node text.cost { font-size: 9px; fill: var(--ox); font-weight: 400; }
.mapsvg .node.go { cursor: pointer; }
.mapsvg .node.go:hover circle { fill: #f6e7b8; stroke: var(--ox); }
.mapsvg .node.here circle { fill: var(--ox); stroke: var(--ox); }
.mapsvg .node .partner-ring { fill: none; stroke: var(--slate); stroke-width: 2; stroke-dasharray: 2 2; }
.mapsvg .node.closed { opacity: .35; }
.lsec { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px; }
.lsec-head { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: none; padding: 6px 2px; font: 600 19px var(--serif); color: var(--ink); text-align: left; cursor: pointer; box-shadow: none; }
.lsec-head:hover { color: var(--ox); background: none; }
.lsec-head .chev { font-size: 12px; color: var(--muted); transition: transform .2s; width: 12px; }
.lsec.closed .chev { transform: rotate(-90deg); }
.lsec-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; }
.lsec.closed .lsec-body { display: none; }
.lsec-body { padding-top: 4px; }
.mapwrap { position: relative; cursor: zoom-in; }
.map-expand { position: absolute; right: 6px; bottom: 6px; width: 28px; height: 28px; padding: 0; border-radius: 4px; font-size: 16px; line-height: 26px; background: rgba(251,243,226,.92); }
.left .people { flex-direction: column; flex-wrap: nowrap; gap: 6px; }
.left .person { width: 100%; justify-content: flex-start; border-radius: var(--radius-md); min-height: 48px; padding: 4px 10px 4px 4px; text-align: left; }
.left .person .pinfo { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.left .person .pname { font-weight: 700; }
.left .person .mood { font-size: 12.5px; }
.left .objects { grid-template-columns: 1fr; gap: 6px; }
.left .object { flex-direction: row; align-items: center; gap: 8px; padding: 5px; }
.left .object .thumb { width: 64px; height: 48px; object-fit: cover; flex: none; border-radius: 3px; }
.left .object .obody { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.left .object .oname { font-weight: 700; font-size: 14px; line-height: 1.2; }
.left .object .oactions { display: flex; flex-wrap: wrap; gap: 4px; }
.loc-actions { margin-top: 4px; }
/* карта на весь экран */
.mapfs { position: fixed; inset: 0; z-index: 60; background: radial-gradient(ellipse at center, rgba(43,33,24,.82), rgba(25,18,10,.94)); display: flex; }
.mapfs-stage { position: absolute; inset: 18px; overflow: hidden; border: 1px solid #8a7353; border-radius: 6px; box-shadow: 0 0 0 4px rgba(239,230,210,.12), 0 10px 40px rgba(0,0,0,.5); background: var(--paper-2); touch-action: none; cursor: grab; }
.mapfs-stage:active { cursor: grabbing; }
.mapfs-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.mapfs-paper { background-size: 100% 100%; background-color: var(--paper-3); box-shadow: inset 0 0 120px rgba(107,74,43,.35); }
.mapfs-paper .mapsvg { width: 100%; height: 100%; }
.mapfs-ui { position: absolute; right: 34px; top: 34px; display: flex; flex-direction: column; gap: 6px; z-index: 1; }
.mapfs-ui button { width: 40px; height: 40px; padding: 0; font-size: 20px; border-radius: 6px; background: var(--paper-3); box-shadow: var(--shadow); }
.mapfs-ui button.close { margin-top: 10px; background: var(--ox); color: var(--paper-3); border-color: var(--ox); }
.mapfs-hint { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); background: rgba(251,243,226,.92); border: 1px solid var(--line); border-radius: 14px; padding: 4px 14px; font-size: 13px; color: var(--ink-2); pointer-events: none; max-width: calc(100% - 60px); text-align: center; }
.travel-list { list-style: none; padding: 0; margin: 8px 0 12px; font-size: 14px; }
.travel-list li { margin: 2px 0; }
.action { display: block; width: 100%; text-align: left; margin: 4px 0; font-size: 14px; }
.time-actions { display: flex; gap: var(--space-2); margin-top: var(--space-4); flex-wrap: wrap; }
.time-actions button { flex: 1 1 auto; }

.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.scene { position: relative; height: 30vh; min-height: 170px; max-height: 340px; flex: none; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--paper-2); cursor: pointer; transition: height .28s ease, min-height .28s ease; }
.scene-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: object-position .28s ease; }
.scene-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 18px 10px; background: linear-gradient(transparent, rgba(25,18,10,.72)); display: flex; align-items: flex-end; gap: 10px; pointer-events: none; }
.scene-title h2 { color: #fff4e0; font-size: 28px; margin: 0; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.scene-chev { color: #fff4e0; opacity: 0; font-size: 14px; margin-left: auto; transition: opacity .2s, transform .28s; transform: rotate(180deg); }
.scene:hover .scene-chev, .scene:focus-visible .scene-chev { opacity: .85; }
.scene:focus-visible { outline: 2px solid var(--ox); outline-offset: -2px; }
/* свёрнута: узкая полоса вровень со строкой вкладок справа */
.scene.collapsed { height: var(--tabs-h, 44px); min-height: 0; }
.scene.collapsed .scene-img { object-position: center 38%; }
.scene.collapsed .scene-title { top: 0; padding: 0 14px; align-items: center; background: linear-gradient(90deg, rgba(25,18,10,.78), rgba(25,18,10,.35) 60%, rgba(25,18,10,.15)); }
.scene.collapsed .scene-title h2 { font-size: 17px; }
.scene.collapsed .scene-chev { opacity: .85; transform: none; }
@media (prefers-reduced-motion: reduce) { .scene, .scene-img, .scene-chev { transition: none; } }
.log { flex: 1; overflow-y: auto; padding: 14px 22px; min-height: 120px; }
.scene-next[hidden]{display:none}
.scene-next{flex:none;padding:11px 22px;border-top:1px solid var(--border);background:var(--paper-2)}
.scene-next-button{display:block;width:100%;max-width:760px;min-height:48px;padding:10px 18px;border:1px solid var(--ox);border-radius:6px;background:var(--ox);color:#fffaf0;text-align:left;font:700 17px/1.3 var(--display);cursor:pointer;box-shadow:0 3px 10px #3a1f161a}
.scene-next-button:hover:not(:disabled){background:var(--ox-2);border-color:var(--ox-2)}
.scene-next-button:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.entry { margin: 0 0 12px; max-width: 760px; }
.entry-head { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--muted); }
.entry-head .speaker { font-weight: 700; color: var(--ox); font-size: 14px; }
.entry-head .kind { text-transform: uppercase; letter-spacing: .1em; font-size: 11px; color: var(--gold); }
.entry-head .title { font-weight: 700; color: var(--ink-2); }
.entry-head .time { margin-left: auto; }
.from-badge { background: #e3dccb; color: var(--ink-2); padding: 0 6px; border-radius: 3px; font-size: 10.5px; letter-spacing: .05em; }
.private-badge { background: var(--slate); color: #fff; padding: 0 6px; border-radius: 3px; font-size: 10.5px; letter-spacing: .05em; }
.entry.k-scene .entry-text { font-style: italic; color: var(--ink-2); }
.entry.k-player { margin-left: 40px; }
.entry.k-player .entry-text { background: #fffaf0; border: 1px solid var(--line); border-radius: 8px 8px 2px 8px; padding: 6px 10px; display: inline-block; }
.entry.k-player .speaker { color: var(--slate); }
.entry.k-dialogue .entry-text { border-left: 3px solid var(--ox); padding-left: 10px; }
.log-new { position: sticky; bottom: 8px; display: block; margin: 0 auto; z-index: 2; background: var(--ox); color: var(--paper-3); border: none; border-radius: 16px; padding: 4px 14px; font-size: 13px; box-shadow: 0 2px 6px rgba(0,0,0,.2); cursor: pointer; }
.log-new[hidden] { display: none; }
.entry.k-expression { margin-left: 14px; }
.entry.k-expression.compact { font-size: 12.5px; font-style: italic; color: var(--muted); }
.expr-pair { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.expr-pair figure { margin: 0; width: 132px; text-align: center; }
.expr-pair img { width: 132px; height: 198px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); display: block; background: var(--paper-2); }
.expr-pair figcaption { font-size: 12px; color: var(--muted); margin-top: 3px; font-style: italic; }
.expr-arrow { font-size: 22px; color: var(--ox); }
.face-card { position: fixed; z-index: 70; width: 260px; background: var(--paper-3); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 30px rgba(43,33,24,.35); padding: 6px; pointer-events: none; }
.face-card[hidden] { display: none; }
.face-card img { width: 100%; height: 390px; object-fit: cover; border-radius: 4px; display: block; }
.face-cap { padding: 6px 4px 2px; font-size: 14px; }
.face-cap span { color: var(--muted); font-style: italic; }
.entry.k-tell { margin-left: 14px; }
.entry.k-tell .entry-text { font-style: italic; color: var(--ink-2); font-size: 14.5px; }
.entry.k-tell .kind { color: var(--slate); }
.entry.k-tell_hint { margin: 0 0 10px 14px; font-size: 12.5px; font-style: italic; color: var(--muted); }
img.face { transition: opacity .12s ease-in-out; }
img.face.swap { opacity: .25; }
@media (prefers-reduced-motion: reduce) { img.face { transition: none; } }
.entry.k-filler .entry-text { border-left: 3px dotted var(--ox); padding-left: 10px; font-style: italic; color: var(--ink-2); }
.pending .typing { margin: 0 0 12px; font-size: 13px; color: var(--muted); font-style: italic; animation: typing-pulse 1.4s ease-in-out infinite; }
@keyframes typing-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pending .typing { animation: none; } }
.entry.k-clue, .entry.k-observation { background: #fbf4e2; border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; }
.entry.k-clue { border-left: 4px solid var(--gold); }
.entry.k-observation.private, .entry.k-clue.private { border-left-color: var(--slate); }
.entry.k-deduction { background: #f3ead2; border: 1px solid var(--gold); padding: 10px 14px; border-radius: 4px; }
.entry.k-deduction .kind { color: var(--ox); }
.entry.k-hint { background: #fbf0c9; border-left: 4px solid var(--gold); padding: 8px 12px; border-radius: 3px; }
.entry.k-tutorial { background: #e9eef0; border-left: 4px solid var(--slate); padding: 8px 12px; border-radius: 3px; font-size: 14px; }
.entry.k-safety { background: #fde9e4; border: 1px solid var(--ox); padding: 8px 12px; border-radius: 4px; }
.entry.k-challenge { background: #f6e2dc; border-left: 4px solid var(--ox); padding: 8px 12px; }
.entry.k-system { color: var(--muted); font-size: 13.5px; }
.entry.k-system .entry-head { display: none; }
.entry.k-interpretation { color: var(--muted); font-size: 12px; margin: -6px 0 10px; font-style: italic; }
.entry.k-epilogue { background: #f3ead2; border: 2px double var(--gold); padding: 12px 16px; }
.entry.k-board { color: var(--ink-2); font-size: 14px; }

/* Give desktop investigation text a little more room without enlarging mobile UI. */
@media (min-width: 861px) {
  .log { font-size: 17px; line-height: 1.6; }
  .log .entry.k-tell .entry-text { font-size: 17px; }
  .log .entry-head { font-size: 13.5px; }
  .log .entry-head .speaker { font-size: 15px; }
}

.interact { flex: none; display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; padding: 8px 18px 10px; border-top: 1px solid var(--line); background: rgba(255,255,255,.25); max-height: 34vh; overflow-y: auto; }
.interact h4 { margin: 2px 0 6px; font-size: 15px; }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 30px; }
.person.active { border-color: var(--ox); background: #fff4e2; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); flex: none; }
.avatar.small { width: 28px; height: 28px; }
.pname { font-weight: 700; font-size: 14px; }
.mood { font-size: 12px; color: var(--muted); font-style: italic; }
.objects { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.object { background: var(--paper-3); border: 1px solid var(--line); border-radius: 4px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.object.seen { opacity: .85; }
.thumb { width: 100%; height: 64px; object-fit: cover; border-radius: 3px; }
.oname { font-size: 13.5px; font-weight: 700; line-height: 1.25; }
.oactions { display: flex; flex-wrap: wrap; gap: 4px; }
.act-trace { border-color: var(--holmes); }
.act-examine { border-color: var(--watson); }

.talkbox { display: none; flex: none; border-top: 2px solid var(--ox); padding: 8px 18px 12px; background: #fbf3e2; }
.talkbox.open { display: block; }
.talk-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.talk-head .link { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; align-items: center; }
.chips:empty { display: none; }
.chips-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.chip { font-size: 12.5px; min-height: 26px; padding: 0 11px; border-radius: var(--radius-pill); }
.chip.clue { border-style: dashed; }
.talk-form { display: flex; gap: var(--space-2); align-items: center; padding: 4px; background: #fffaf0; border: 1px solid var(--border); border-radius: var(--radius-pill); transition: border-color var(--ease), box-shadow var(--ease); }
.talk-form:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.talk-form input { border: none; background: transparent; box-shadow: none; border-radius: var(--radius-pill); min-height: 34px; padding: 0 12px; }
.talk-form input:focus { box-shadow: none; }
.talk-form button { flex: none; min-height: 34px; }

.tabs { position: sticky; top: 0; display: flex; gap: 2px; background: var(--paper-2); padding: 7px 8px; margin: 0 -12px 8px; border-bottom: 1px solid var(--border); z-index: 2; }
.tabs button { flex: 1 1 auto; min-height: 30px; padding: 0 12px; font-size: var(--fs-sm); border: 1px solid transparent; background: transparent; color: var(--ink-2); white-space: nowrap; }
.tabs button:hover:not(:disabled) { background: rgba(255,255,255,.45); border-color: transparent; }
.tabs button.on { background: var(--surface); border-color: var(--border); box-shadow: var(--elev-1); color: var(--ink); font-weight: 700; }
.combine-bar { position: sticky; top: var(--tabs-h, 46px); background: var(--paper); z-index: 1; padding: 6px 0 8px; font-size: var(--fs-sm); }
.combine-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); min-height: calc(var(--control-h-sm) + 8px); }
.combine-count { line-height: 1.3; min-height: 2.6em; display: flex; align-items: center; }
.combine-btn { flex: none; }
.combine-bar { position: sticky; }
.combine-guide { position: relative; margin: 7px 0 3px; padding: 10px 31px 10px 12px; border: 1px solid #c9a46a; border-left: 3px solid var(--gold); border-radius: var(--radius-sm); background: #fff7df; box-shadow: var(--elev-1); line-height: 1.35; }
.combine-guide strong { display: block; color: var(--ink); }
.combine-guide p { margin: 5px 0; }
.combine-guide small { color: var(--muted); }
.combine-guide-close { position: absolute; top: 3px; right: 4px; border: 0; background: transparent; min-height: 26px; width: 26px; padding: 0; color: var(--ink-2); font-size: 20px; }
/* результат «Соединить» всплывает под кнопкой поверх списка — раскладка не сдвигается */
.combine-msg { position: absolute; left: 0; right: 0; top: calc(100% - 2px); padding: 8px 12px; border-radius: var(--radius-sm); font-size: var(--fs-sm); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--elev-2); animation: msg-in .18s ease; }
@keyframes msg-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .combine-msg { animation: none; } }
.combine-msg.warn { border-color: #c9a46a; background: #fbf0d6; color: #6b4a14; }
.combine-msg.ok { border-color: #9fb58a; background: #edf3e3; color: #34502a; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; margin: 6px 0; font-size: 14px; transition: box-shadow var(--ease), border-color var(--ease); }
.card.private { border-left: 3px solid var(--slate); }
.card.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.card.deduction { background: #f6edd3; border-color: var(--gold); }
.card p { margin: 4px 0; }
.card-head { display: flex; gap: 6px; align-items: baseline; cursor: pointer; }
.card-head input { width: auto; }
.card-title { font-weight: 700; flex: 1; }
.card .time { font-size: 11px; color: var(--muted); }
.clue-origin { margin: 2px 0 4px; font-size: 11.5px; line-height: 1.35; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lens-holmes b { color: var(--holmes); }
.lens-watson b { color: var(--watson); }
.note { font-size: 13px; }
.board-form { position: sticky; bottom: 0; background: var(--paper); padding: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.atoms { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13.5px; }
.atoms li { margin: 3px 0; }
.badge { font-size: 11px; padding: 0 6px; border-radius: 3px; background: #ddd; white-space: nowrap; }
.st-supported .badge { background: #c9dcb9; color: #2f4a1f; }
.st-unproven .badge { background: #eadfbf; color: #6b5420; }
.st-contradicted .badge { background: #efc4b9; color: var(--ox); }
.st-untestable .badge { background: #ddd8ce; color: #666; }
.unexplained { background: #f6e2dc; border-radius: 4px; padding: 6px 10px; font-size: 13.5px; }
.finale-form fieldset { border: 1px solid var(--line); border-radius: 4px; margin: 0 0 10px; padding: 8px 10px; background: var(--paper-3); }
.finale-form legend { font-family: var(--display); font-weight: 700; font-size: 17px; padding: 0 4px; }
.opt { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin: 4px 0; cursor: pointer; }
.opt input { width: auto; margin-top: 4px; }

.modal { position: fixed; inset: 0; background: rgba(30,20,10,.55); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal-card { background: var(--paper); max-width: 680px; max-height: 88vh; overflow-y: auto; padding: 28px 32px; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.4); border: 1px solid var(--gold); }
.modal-card h2 { font-size: 36px; }
.epilogue p { margin: 6px 0; }

@media (max-width: 1100px) {
  .game { grid-template-columns: 240px minmax(0, 1fr) 320px; }
}
.next-steps { display: none; }
@media (max-width: 860px) {
  .next-steps { display: block; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
  .next-title { font-size: var(--fs-sm); color: var(--muted); margin-bottom: 6px; }
  .next-row { display: flex; flex-wrap: wrap; gap: 8px; }
  .next-row .go { font-weight: 600; }
  .game { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; height: auto; }
  .left, .right { border: none; max-height: none; }
  .lobby { grid-template-columns: 1fr; }
  /* обложки дел на телефоне: заголовок не вылезает за кадр, вторая обложка не сплющена */
  .cover { aspect-ratio: 4/3; }
  .cover.small { aspect-ratio: 4/3; }
  .cover-text { padding: 14px 16px; }
  .cover-text h1 { font-size: 30px; }
  .cover.small .cover-text h2 { font-size: 26px; line-height: 1.1; }
  .lobby-actions { grid-template-columns: 1fr; }
  /* шапка переносится: время, срок, справка, музыка и лампочка остаются видны */
  .topbar { flex-wrap: wrap; white-space: normal; overflow: visible; row-gap: 6px; column-gap: 10px; padding: 8px 12px; }
  .topbar .brand { font-size: 18px; flex-basis: 100%; }
  .topbar .spacer { display: none; }
  .deadline-chip .pop-btn { max-width: 70vw; }
  .roles-screen { padding: 16px 12px calc(210px + env(safe-area-inset-bottom, 0px)); }
  .roles-screen h2 { font-size: 27px; }
  .roles-screen h3 { font-size: 23px; }
  .role-instruction { font-size: 14px; }
  .role-cards { gap: 10px; margin: 14px 0; }
  .role-card { padding: 10px 8px; gap: 5px; }
  .role-portrait { width: 84px; height: 112px; }
  .role-name { font-size: 22px; line-height: 1.1; }
  .role-title { font-size: 12px; }
  .role-choice { margin-top: 6px; }
  .interact { grid-template-columns: 1fr; }
}

/* Полосы прокрутки в стиле бумаги и чернил */
* { scrollbar-width: thin; scrollbar-color: #b49c76 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: #c4ad86; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #9c7f56; }
::-webkit-scrollbar-thumb:active { background-color: var(--ox); }
::-webkit-scrollbar-corner { background: transparent; }

/* Кнопка «Музыка»: в шапке игры и плавающая в лобби */
.music-ctl { position: relative; flex: none; }
.music-ctl.floating { position: fixed; top: 12px; right: 14px; z-index: 40; }
.music-btn { min-height: 28px; padding: 0 12px; font-size: var(--fs-sm); }
.music-btn.off { color: var(--muted); }
.music-btn { position: relative; }
.music-dot { position: absolute; top: 3px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: #9a8f7c; }
.st-playing .music-dot { background: #3f8a4a; }
.st-loading .music-dot, .st-waiting .music-dot { background: #c99a2e; }
.st-loading .music-dot { animation: music-blink 1s ease-in-out infinite; }
@keyframes music-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .st-loading .music-dot { animation: none; } }
.music-now { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.music-vote { display: flex; align-items: center; gap: 8px; }
.music-vote .vote { min-width: 40px; font-size: 16px; }
.music-vote .vote.pressed { background: var(--ox); border-color: var(--ox); color: #fff; }
.music-btn[disabled] { opacity: .5; cursor: not-allowed; }
.music-panel { position: fixed; z-index: 65; min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--elev-2); padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: 10px; white-space: normal; }
.music-panel[hidden] { display: none; }
.music-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.music-vol { flex: 1; accent-color: var(--ox); }
@media (max-width: 860px) { .music-label { display: none; } }
.music-panel input[type=checkbox] { width: auto; flex: none; margin: 0; accent-color: var(--ox); }
.music-panel input[type=range] { width: auto; padding: 0; border: none; background: none; }

/* Переключатель (вместо галочки): «Ехать вместе», «Музыка» */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--ink-2); margin: 8px 0; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track { position: relative; width: 38px; height: 22px; flex: none; border-radius: var(--radius-pill); background: #d8c9a8; border: 1px solid var(--border); transition: background var(--ease), border-color var(--ease); }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(43,33,24,.3); transition: transform var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus-ring); }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-thumb { transition: none; } }

/* Маршрут на карте: выбранный путь — бегущий пунктир, остальные приглушены */
.mapsvg .route.dim { opacity: .3; }
.mapsvg .route.sel { stroke: #9b2c1c; opacity: .95; stroke-dasharray: 7 5; animation: route-march 1.2s linear infinite; }
.mapsvg .node.sel circle { fill: #f6e7b8; stroke: var(--accent); }
@keyframes route-march { to { stroke-dashoffset: -20; } }
@media (prefers-reduced-motion: reduce) { .mapsvg .route.sel { animation: none; } }
.route-card { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-top: var(--space-2); padding: 10px 12px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-md); box-shadow: var(--elev-1); }
.route-info { flex: 1 1 140px; min-width: 0; }
.route-name { font-weight: 700; line-height: 1.25; }
.route-meta { font-size: var(--fs-sm); }
.route-actions { display: flex; gap: var(--space-2); margin-left: auto; }
.route-card .switch { margin: 0; }
.mapfs-route { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); width: min(560px, calc(100% - 60px)); z-index: 2; }
.mapfs-route:empty { display: none; }
.route-card.big { padding: 14px 18px; box-shadow: var(--elev-2); }
.route-card.big .route-name { font-family: var(--display); font-size: 22px; }

/* Карточка предмета: клик — осмотр */
.left .object.clickable { cursor: pointer; transition: border-color var(--ease), box-shadow var(--ease), background var(--ease); }
.left .object.clickable:hover { border-color: var(--border-strong); background: var(--surface-hover); box-shadow: var(--elev-1); }
.left .object.clickable:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.left .object .oseen { color: var(--moss); font-weight: 400; font-size: 12px; }
.left .object { border-radius: var(--radius-md); }

/* Картинка сцены в журнале: широкая полоса, клик — целиком */
.entry-pic { display: block; width: 100%; max-width: 100%; padding: 0; margin: 4px 0 8px; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface-2); min-height: 0; cursor: zoom-in; }
.entry-pic img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 5; object-fit: cover; object-position: center; }
.entry-pic.portrait { width: 160px; max-width: 38%; }
.entry-pic.portrait img { aspect-ratio: 3 / 4; object-fit: contain; }
.entry-pic:hover { border-color: var(--border-strong); }
.lightbox { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(25,18,10,.88); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; min-height: 0; padding: 0; background: var(--surface); }
/* Картинка финала сверху окна */
.ending-pic { display: block; width: calc(100% + 64px); max-width: none; margin: -28px -32px var(--space-4); aspect-ratio: 16 / 7; height: auto; object-fit: cover; border-radius: var(--radius-md) var(--radius-md) 0 0; }
/* Смена шапки локации (сухо → после ливня) */
.scene .scene-img.scene-next { position: absolute; inset: 0; opacity: 0; transition: opacity .3s ease; }
.scene .scene-img.scene-next.in { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .scene .scene-img.scene-next { transition: none; } }

/* ---------- Телефон: вариант Г (web/proto/mobile-d.html) ----------
   Журнал — главный экран, поле ввода внизу, иконки разделов в шапке.
   Плашка под шапкой — картинка места; разделы (люди, предметы, карта, версии, «…»)
   выезжают сверху поверх журнала. На широком экране ничего из этого не видно. */
.micons, .mib, .mcompose, .msheet-backdrop, .mmore, .mtoasts { display: none; }
@media (max-width: 860px) {
  .game { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; --mtop: 54px; }
  .topbar { position: relative; z-index: 40; flex: none; flex-wrap: nowrap; height: auto; min-height: var(--mtop); padding: calc(env(safe-area-inset-top, 0px) + 4px) 4px 4px 12px; gap: 0; overflow: visible;
    background: rgba(239,230,210,.86); -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15); }
  .topbar .brand, .topbar .partner, .topbar .role-switch, .topbar .help { display: none; }
  .topbar .clock { font-size: 14px; line-height: 1.2; flex: none; }
  .topbar .clock-day { display: none; }
  .topbar .deadline-chip { min-width: 0; flex: 0 1 auto; margin-left: 6px; }
  .topbar .deadline-chip .pop-btn { min-height: 26px; padding: 0 7px; font-size: 12px; gap: 3px; max-width: 30vw; white-space: nowrap; }
  .topbar .deadline-chip .dl-short { display: none; }
  .topbar .spacer { display: block; flex: 1 1 0; min-width: 2px; }
  .micons { display: flex; flex: none; }
  .mib { display: inline-flex; position: relative; flex: none; width: 36px; min-width: 36px; height: 44px; min-height: 44px; padding: 0; border: none; background: none; box-shadow: none; color: var(--ink-2); align-items: center; justify-content: center; }
  .mib::before { content: ''; position: absolute; inset: 4px 1px; border-radius: 50%; background: rgba(255,250,240,.65); border: 1px solid rgba(205,187,152,.85); }
  .mib svg { position: relative; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .mib:hover:not(:disabled) { background: none; }
  .mib[aria-pressed="true"] { color: var(--on-accent, #fff); }
  .mib[aria-pressed="true"]::before { background: var(--ox); border-color: var(--ox); }
  .mib-dot { position: absolute; top: 7px; right: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--ox); box-shadow: 0 0 0 2px var(--paper-2); }
  .topbar .music-ctl { flex: none; }
  .topbar .music-btn { min-height: 34px; width: 36px; padding: 0; justify-content: center; }
  .topbar .hint-bulb { width: 36px; height: 40px; }
  .topbar .hint-bulb svg { width: 26px; height: 26px; }

  .center { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .scene { height: 30vh; min-height: 150px; max-height: 260px; }
  .scene.collapsed { height: 48px; }
  .log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 14px; -webkit-overflow-scrolling: touch; }
  .next-steps { display: none; }
  .scene-next{padding:8px 12px calc(env(safe-area-inset-bottom, 0px) + 8px)}
  .scene-next-button{min-height:48px;border-radius:24px;text-align:center;font-size:16px}
  .talkbox { flex: none; padding: 6px 12px calc(env(safe-area-inset-bottom, 0px) + 8px); box-shadow: 0 -4px 14px rgba(60,40,20,.08); }
  .talkbox .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .talkbox .chips::-webkit-scrollbar { display: none; }
  .talkbox .chips .chip { flex: none; }
  .mcompose { display: block; flex: none; margin: 6px 12px calc(env(safe-area-inset-bottom, 0px) + 10px); min-height: 48px; border-radius: 24px; text-align: left; padding: 0 18px; color: var(--muted); font-style: italic; background: var(--surface); border: 1px solid var(--border-strong, var(--border)); }
  .mcompose[hidden] { display: none; }

  /* Выдвижная панель: левая колонка (люди, предметы, карта), правая (улики, доска, реконструкция) или «…». */
  .left, .right, .mmore { display: none; position: fixed; z-index: 35; left: 0; right: 0; top: var(--mtop); max-height: 65vh; max-height: 65dvh; overflow-y: auto;
    background: var(--paper); border-bottom: 1px solid var(--border); box-shadow: 0 10px 24px rgba(40,25,10,.18); padding: 10px 14px 14px; animation: msheet-in .2s ease; }
  @keyframes msheet-in { from { transform: translateY(-12px); opacity: 0; } }
  @media (prefers-reduced-motion: reduce) { .left, .right, .mmore { animation: none; } }
  .game[data-msheet] .msheet-backdrop { display: block; position: fixed; inset: var(--mtop) 0 0 0; z-index: 34; background: rgba(30,20,10,.28); }
  .game[data-msheet=people] .left, .game[data-msheet=objects] .left, .game[data-msheet=map] .left { display: block; }
  .game[data-msheet=versions] .right { display: flex; }
  .game[data-msheet=more] .mmore { display: block; }
  .left .lsec, .left .loc-actions, .left .time-actions { display: none; }
  .game[data-msheet=people] .left .lsec[data-sec=people],
  .game[data-msheet=objects] .left .lsec[data-sec=objects],
  .game[data-msheet=map] .left .lsec[data-sec=map] { display: block; border: none; margin: 0; }
  .left .lsec-head { pointer-events: none; }
  .left .lsec-head .chev { display: none; }
  .left .lsec.closed .lsec-body { display: block; }
  .right .tabs { margin: -10px -14px 8px; }
  .mmore h4 { margin: 14px 0 6px; }
  .mmore-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
  .mmore-row.wrap { flex-wrap: wrap; }

  /* Итог действия всплывает под шапкой. */
  .mtoasts { display: flex; flex-direction: column; gap: 8px; position: fixed; z-index: 45; left: 10px; right: 10px; top: calc(var(--mtop) + 8px); pointer-events: none; }
  .mtoast { pointer-events: auto; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--ox); border-radius: var(--radius-md); box-shadow: 0 8px 22px rgba(40,25,10,.22); padding: 8px 10px 6px 12px; animation: msheet-in .2s ease; }
  .mtoast-head { display: flex; align-items: center; gap: 8px; }
  .mtoast-head b { flex: 1; font-size: 14px; }
  .mtoast-x { min-height: 32px; width: 32px; padding: 0; border: none; background: none; color: var(--muted); }
  .mtoast-text { margin: 2px 0 4px; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .mtoast-clue { font-size: 13px; color: var(--ox); margin: 2px 0; }
  .mtoast-go { font-size: 13px; min-height: 30px; padding: 0; }
  .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); }
}

/* Майкрофт Холмс: подсказки и разбор версий «по телефону» */
.advisor-icon { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--border); margin-right: 2px; vertical-align: middle; }
.entry.from-advisor { border-left: 3px solid var(--ochre, #a8812f); background: rgba(168,129,47,.07); }
.entry.from-advisor .entry-head { align-items: center; }
.advisor-portrait { float: left; margin: 2px 12px 6px 0; padding: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: none; min-height: 0; box-shadow: var(--elev-1); }
.advisor-portrait img { display: block; width: 64px; height: 96px; object-fit: cover; }
.entry.k-advisor::after { content: ''; display: block; clear: both; }
.advisor-call { margin-top: 6px; gap: 6px; }
.advisor-call .advisor-icon { width: 22px; height: 22px; margin: 0; }

/* Итог партии, ачивки, «Поделиться», рейтинг на главной.
   Карточки ачивок — как наклейки из старого альбома: бумага, двойная рамка, уголки-виньетки,
   слева гравированный медальон. Шуточные — охра и пунктир, секретные — сургучная печать. */
:root { --corner: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cpath d='M2 20V9c0-4 3-7 7-7h11' fill='none' stroke='%237a2e22' stroke-width='1.2'/%3E%3Cpath d='M5 20v-8c0-4 3-7 7-7h8' fill='none' stroke='%23a8812f' stroke-width='.8'/%3E%3Ccircle cx='9' cy='9' r='1.6' fill='%237a2e22'/%3E%3C/svg%3E"); }
.result { margin: 14px 0; padding: 16px 14px 12px; border: 1px solid var(--border); border-radius: 8px; background-color: #f8f0de; box-shadow: inset 0 0 0 3px #fbf5e8, inset 0 0 0 4px rgba(122,46,34,.25); text-align: center; }
.result-score { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 26px; border: 1px solid rgba(122,46,34,.45); border-radius: 999px; background: rgba(255,250,240,.7); font: 600 16px var(--serif); color: var(--ink-2); position: relative; }
.result-score::before, .result-score::after { content: '❦'; position: absolute; top: 50%; transform: translateY(-50%); color: var(--ox); font-size: 16px; }
.result-score::before { left: -22px; transform: translateY(-50%) scaleX(-1); }
.result-score::after { right: -22px; }
.result-score b { font: 700 38px/1 var(--display); color: var(--ox); }
.result-facts { list-style: none; padding: 0; margin: 10px 0 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.result-facts li { border: 1px solid var(--border); border-radius: 14px; padding: 2px 10px; font-size: 13.5px; background: var(--paper); }
.result-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; text-align: left; }
.badge-card { position: relative; display: grid; grid-template-columns: 58px 1fr; gap: 10px; align-items: center; padding: 10px 12px 10px 10px; border: 1px solid rgba(122,46,34,.35); border-radius: 6px;
  background: var(--corner) left 3px top 3px / 18px no-repeat, var(--corner) right 3px bottom 3px / 18px no-repeat; background-color: #f8f0de;
  box-shadow: inset 0 0 0 2px #fffaf0, inset 0 0 0 3px rgba(168,129,47,.35), 0 1px 3px rgba(60,40,20,.12); font-size: 13px; line-height: 1.35; }
.badge-card .medal { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; border: 2px solid #c9b08a; box-shadow: 0 0 0 2px #fffaf0, 0 0 0 3px rgba(122,46,34,.4), 0 2px 4px rgba(60,40,20,.25); background: #efe6d2; }
.badge-card .medal.none { display: grid; place-items: center; font-size: 26px; color: var(--ox); }
.badge-card b { display: block; font: 700 16px/1.15 var(--display); letter-spacing: .02em; color: var(--ink); margin-bottom: 2px; }
.badge-card span { color: var(--ink-2); font-style: italic; }
.badge-card.joke { border-style: dashed; border-color: rgba(168,129,47,.7); background-color: #f6ead0; }
.badge-card.joke::after, .badge-card.secret::after { position: absolute; top: -7px; right: 10px; font: 600 10.5px var(--serif); letter-spacing: .08em; text-transform: uppercase; padding: 1px 7px; border-radius: 3px; color: #fffaf0; }
.badge-card.joke::after { content: 'шутка'; background: #a8812f; }
.badge-card.secret::after { content: 'секрет'; background: var(--ox); }
.missed { margin-top: 12px; font-size: 14px; text-align: left; }
.missed summary { cursor: pointer; color: var(--ox); }
.share-progress { flex: none; }
.share-progress[hidden] { display: none; }
.entry.k-secret { border-left: 3px solid var(--moss, #4c7a3a); background: rgba(76,122,58,.07); font-weight: 600; }
.leaderboard { margin-top: 22px; }
.leaderboard h3 { margin: 0 0 8px; }
.lb-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.lb { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.lb li { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.lb-main { display: flex; justify-content: space-between; gap: 8px; }
.lb-score { font: 700 18px var(--display); color: var(--ox); }
.lb-sub { font-size: 13px; }
.lb-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.lb-badges .chip { font-size: 12px; min-height: 22px; padding: 0 8px; }
.lb-medal { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1.5px solid #c9b08a; box-shadow: 0 0 0 1.5px #fffaf0, 0 0 0 2.5px rgba(122,46,34,.35); }
@media (max-width: 860px) { .topbar .share-progress { display: none; } }
.community-btn { margin-top: 12px; }
.community-list { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow: auto; }
.community-list li { border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; background: var(--surface); }
.community-list p { margin: 0 0 4px; font-style: italic; }

/* Вехи расследования и найденные секреты в журнале */
.entry.moment { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; margin: 10px 0; padding: 10px 12px; border: 1px solid rgba(122,46,34,.35); border-radius: 8px;
  background: var(--corner) left 3px top 3px / 18px no-repeat, var(--corner) right 3px bottom 3px / 18px no-repeat; background-color: #f8f0de;
  box-shadow: inset 0 0 0 2px #fffaf0, inset 0 0 0 3px rgba(168,129,47,.35), 0 1px 4px rgba(60,40,20,.14); }
.entry.moment .medal, .moment-toast .medal { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid #c9b08a; box-shadow: 0 0 0 2px #fffaf0, 0 0 0 3px rgba(122,46,34,.4); background: #efe6d2; }
.entry.moment .medal.none { display: grid; place-items: center; font-size: 28px; color: var(--ox); }
.moment-kicker { display: flex; justify-content: space-between; gap: 8px; font: 600 11.5px var(--serif); letter-spacing: .1em; text-transform: uppercase; color: var(--ox); }
.moment-title { display: block; font: 700 20px/1.15 var(--display); color: var(--ink); margin: 2px 0; }
.entry.moment p { margin: 0 0 6px; font-style: italic; color: var(--ink-2); }
.entry.moment .share-btn { min-height: 30px; }
.entry.k-secret.moment { border-color: rgba(122,46,34,.55); }
.moment-toast { display: grid !important; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; }
.moment-toast .medal { width: 48px; height: 48px; }
.moment-toast b { display: block; font: 700 17px var(--display); }

/* «Рассказать Ватсону» прямо в журнале; «В соцсети» — отдельная иконка и окно с превью открытки */
.tell-btn { margin-top: 6px; }
.social-btn { display: inline-flex; align-items: center; gap: 6px; }
.social-btn .ico { display: inline-flex; }
.share-modal .modal-card { max-width: 640px; }
.share-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.share-head h3 { margin: 0; }
.icon-x { min-height: 36px; width: 36px; padding: 0; border: none; background: none; font-size: 18px; color: var(--muted); }
.share-preview { width: 100%; height: auto; border-radius: 6px; box-shadow: 0 3px 14px rgba(60,40,20,.22); margin: 8px 0 12px; display: block; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.share-actions .btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; }
.update-bar { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 8px); display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px; border-radius: 999px; background: var(--ink); color: var(--paper-3); box-shadow: 0 6px 18px rgba(0,0,0,.25); font-size: 14px; }
/* Телефон: «Закончить разговор» — просто крестик в правом верхнем углу панели разговора */
@media (max-width: 860px) {
  .talkbox { position: relative; }
  .talkbox .talk-head { padding-right: 34px; }
  .talk-leave { position: absolute; top: 4px; right: 6px; min-height: 36px; width: 36px; padding: 0; justify-content: center; font-size: 18px; }
  .talk-leave .leave-label { display: none; }
}
.mapfs-go { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--elev-2); padding: 10px 12px; }
.mapfs-go-title { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.mapfs-go-list { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 860px) { .mapfs-route { width: calc(100% - 36px); bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); } }

/* Кто где на карте: портретики героев у места (рамка — после правил кружков места, чтобы не заливалась) */
.mapsvg g.node circle.who-ring { fill: none; stroke: #fffaf0; }
.mapsvg g.node circle.who-ring.me { stroke: var(--ox); }
.mapsvg g.node circle.who-ring.partner { stroke: #4c7a3a; }

/* «Свечение» слабой подсказки Майкрофта: человек, предмет, место на карте, иконка раздела на телефоне */
@keyframes hint-glow { 0%, 100% { box-shadow: 0 0 0 2px rgba(241,207,107,.55), 0 0 10px 2px rgba(241,207,107,.45); } 50% { box-shadow: 0 0 0 3px rgba(241,207,107,.9), 0 0 18px 6px rgba(241,207,107,.6); } }
.person.glow, .object.glow { animation: hint-glow 1.8s ease-in-out infinite; border-color: #d9b44a !important; }
.mib.glow::before { animation: hint-glow 1.8s ease-in-out infinite; border-color: #d9b44a; }
@keyframes hint-glow-svg { 0%, 100% { filter: drop-shadow(0 0 3px rgba(241,207,107,.8)); } 50% { filter: drop-shadow(0 0 9px rgba(241,207,107,1)); } }
.mapsvg .node.glow circle:first-child { stroke: #d9b44a; animation: hint-glow-svg 1.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .person.glow, .object.glow, .mib.glow::before, .mapsvg .node.glow circle:first-child { animation: none; box-shadow: 0 0 0 3px rgba(241,207,107,.9); } }
.cover.upcoming { opacity: .92; filter: saturate(.85); cursor: default; }
.soon-ribbon { position: absolute; top: 12px; right: -34px; transform: rotate(35deg); background: var(--ox); color: #fffaf0; font: 600 12px var(--serif); letter-spacing: .14em; text-transform: uppercase; padding: 3px 40px; box-shadow: 0 2px 6px rgba(0,0,0,.3); z-index: 2; }
.lb li.me { border-color: var(--ox); box-shadow: inset 3px 0 0 var(--ox); }
.lang-switch { position: fixed; top: 12px; right: 66px; z-index: 40; }

/* Лобби: лента игр (жанр, «Скоро»), большая обложка выбранной, подвал с соцсетями */
.lobby2 { min-height: 100vh; display: flex; flex-direction: column; }
.lobby2 .lobby { min-height: 0; padding-top: 8px; align-items: start; }
.lobby-head { max-width: 1100px; width: 100%; margin: 0 auto; padding: 28px 24px 4px; }
.lobby-head p { margin: 6px 0 0; max-width: 760px; }
.feed { max-width: 1100px; width: 100%; margin: 0 auto; padding: 12px 24px 8px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.feed-card { position: relative; flex: none; width: 210px; height: 128px; padding: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--paper-2); scroll-snap-align: start; cursor: pointer; text-align: left; box-shadow: var(--elev-1); }
.feed-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feed-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 35%, rgba(25,18,10,.82)); }
.feed-card .feed-title { position: absolute; left: 10px; right: 10px; bottom: 8px; z-index: 1; color: #fff6e6; font: 700 16px/1.15 var(--display); }
.feed-card .feed-genre { position: absolute; left: 8px; top: 8px; z-index: 1; font: 600 11px var(--serif); letter-spacing: .08em; text-transform: uppercase; color: #fffaf0; background: rgba(43,33,24,.7); border-radius: 10px; padding: 2px 8px; }
.feed-card.selected { outline: 3px solid var(--ox); outline-offset: 2px; }
.feed-card.upcoming img { filter: saturate(.8); }
.feed-card .soon-ribbon { font-size: 10px; top: 10px; right: -38px; padding: 2px 40px; }
.cover.hero { aspect-ratio: 16/10; }
.soon-card .soon-links { display: flex; flex-wrap: wrap; gap: 8px; }
.soon-card .btn, .site-footer .foot-link { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; }
.site-footer { margin-top: auto; max-width: 1100px; width: 100%; margin-left: auto; margin-right: auto; padding: 22px 24px 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; border-top: 1px solid var(--border); font-size: 14px; }
.site-footer > span { margin-right: auto; }
@media (max-width: 860px) {
  .lobby-head { padding: 20px 16px 2px; }
  .lobby-head .brand-big { font-size: 36px; }
  .feed { padding: 10px 16px 6px; }
  .feed-card { width: 168px; height: 108px; }
  .site-footer { padding: 18px 16px 24px; }
}

/* Страница игры (после каталога): назад в каталог + бренд, дальше — сепия игры. */
.game-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.game-head .brand-big { font-size: 34px; }
.back-link { color: var(--ink-2); text-decoration: none; font-weight: 700; }
.back-link:hover { color: var(--ox); }
