/* Общая бумажная сцена; цвет относится к выбранной игре, а не к её участникам. */
body[data-route="game"] {
  --game-tint: #e9dfc8;
  --game-ink: #665431;
  --game-paper: var(--surface);
  --game-edge: color-mix(in srgb, var(--game-ink) 18%, var(--game-tint));
  --game-radius: 24px;
  --game-faint: color-mix(in srgb, var(--game-tint) 42%, var(--game-paper));
  --game-caption: color-mix(in srgb, var(--ink) 78%, var(--game-paper));
}
body:is([data-game-id="alias"], [data-game-id="never"], [data-game-id="letter"]) { --game-tint: #e9dfc8; --game-ink: #665431; }
body:is([data-game-id="spy"], [data-game-id="who"], [data-game-id="likely"]) { --game-tint: #d6e6ec; --game-ink: #365967; }
body:is([data-game-id="truth"], [data-game-id="taboo"], [data-game-id="ten"], [data-game-id="three"]) { --game-tint: #eed6d3; --game-ink: #78474d; }
body:is([data-game-id="croc"], [data-game-id="draw"], [data-game-id="apocalypse"], [data-game-id="bottle"]) { --game-tint: #dce6d9; --game-ink: #3f5b46; }
body:is([data-game-id="mafia"], [data-game-id="assoc"], [data-game-id="hangman"]) { --game-tint: #e2dced; --game-ink: #5d4c6b; }
body:is([data-game-id="us"], [data-game-id="wave"], [data-game-id="sell"]) { --game-tint: #f0dfcf; --game-ink: #725139; }
:root[data-theme="dark"] body[data-route="game"] { --game-tint: #332f27; --game-ink: #e1cfaa; }
:root[data-theme="dark"] body:is([data-game-id="spy"], [data-game-id="who"], [data-game-id="likely"]) { --game-tint: #28363a; --game-ink: #bbd5df; }
:root[data-theme="dark"] body:is([data-game-id="truth"], [data-game-id="taboo"], [data-game-id="ten"], [data-game-id="three"]) { --game-tint: #382d30; --game-ink: #e5bec1; }
:root[data-theme="dark"] body:is([data-game-id="croc"], [data-game-id="draw"], [data-game-id="apocalypse"], [data-game-id="bottle"]) { --game-tint: #2d352c; --game-ink: #c3d5bd; }
:root[data-theme="dark"] body:is([data-game-id="mafia"], [data-game-id="assoc"], [data-game-id="hangman"]) { --game-tint: #302d3a; --game-ink: #d0c3e1; }
:root[data-theme="dark"] body:is([data-game-id="us"], [data-game-id="wave"], [data-game-id="sell"]) { --game-tint: #393127; --game-ink: #e3c7aa; }

body[data-route="game"] .nav { border-bottom: 0; }
body[data-route="game"] .nav-note { display: none; }
body[data-route="game"] .game-page {
  width: min(1024px, calc(100% - 64px));
  max-width: 1024px;
  padding-top: 12px;
  padding-bottom: calc(var(--game-dock-height, 94px) + 32px);
}
body[data-route="game"] .game-page:not(.is-playing) {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  column-gap: 48px;
  align-items: start;
}
.game-page:not(.is-playing) #game-start-notice { grid-column: 1 / -1; grid-row: 1; }
.game-page:not(.is-playing) .game-heading-row { grid-column: 1 / -1; grid-row: 2; margin: 0 0 16px; }
.game-page:not(.is-playing) #game-page-content { display: block; grid-column: 1; grid-row: 3; min-width: 0; }
.game-page:not(.is-playing) .game-live { grid-column: 2; grid-row: 3; }
.game-page .game-overview { display: grid; grid-template-columns: 1fr; gap: 22px; margin: 0 0 28px; }
.game-page .game-page-art { width: 100%; height: 236px; border: 0; border-radius: var(--game-radius); }
.game-page .game-page-art > img { inset: 8%; width: 84%; height: 84%; }
.game-page .game-page-copy { text-align: left; }
.game-page .game-page-copy h1 { font-size: clamp(28px, 3.1vw, 38px); font-weight: 800; line-height: 1.14; letter-spacing: -.045em; margin: 0 0 12px; }
.game-page .game-page-copy .detail-meta { font-size: 13px; color: var(--game-caption); line-height: 1.6; }
.game-page .game-page-copy .detail-description { display: block; font-size: 15px; line-height: 1.7; color: var(--ink); margin-top: 16px; max-width: 40ch; }
.game-page .game-page-copy .game-recommendation { font-size: 12px; margin-top: 6px; color: var(--game-caption); }
.game-page .game-live { margin: 0; min-width: 0; }
.game-page #preparation-guide { gap: 8px; padding: 0 0 22px; margin: 0 0 22px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.game-page #preparation-guide strong { font-size: 16px; font-weight: 750; letter-spacing: -.025em; }
.game-page #preparation-guide > p { font-size: 14px; line-height: 1.7; color: var(--game-caption); }
.game-page .preparation-connection { margin: 0; }
.game-page .preparation-connection summary { color: var(--game-caption); font-size: 12px; min-height: 36px; }
.game-page .preparation-connection p { color: var(--game-caption); font-size: 13px; }
.game-page .rules-panel { border: 0; border-top: 1px solid var(--line); background: transparent; border-radius: 0; padding: 0; margin: 0; min-width: 0; }
.game-page .rules-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 0; font-size: 14px; line-height: 1.5; min-height: 56px; list-style: none; }
.game-page .rules-panel > summary::-webkit-details-marker { display: none; }
.game-page .rules-panel > summary::after { content: '+'; font-size: 22px; font-weight: 400; flex: none; color: var(--game-caption); }
.game-page .rules-panel[open] > summary::after { content: '−'; }
.game-page .rules-panel .rule-list { margin: 0; padding: 0 0 20px 22px; gap: 14px; font-size: 14px; line-height: 1.75; }
.game-page .rules-panel > p { font-size: 13px; line-height: 1.7; color: var(--game-caption); }
.game-page .rules-panel .related-games { gap: 8px; }
.game-page .related-games a { background: var(--game-faint); border: 0; border-radius: 10px; padding: 12px 14px; min-height: 44px; font-size: 13px; }

/* Активная игра оставляет место заданию и не повторяет обложку. */
body[data-route="game"][data-playing="true"] .game-page { width: min(760px, calc(100% - 48px)); }
body[data-route="game"][data-playing="true"]:is([data-game-id="apocalypse"], [data-game-id="mafia"]) .game-page { width: min(980px, calc(100% - 48px)); }
body[data-route="game"]:is([data-game-id="apocalypse"], [data-game-id="mafia"]) .game-live #active-game-content { max-width: none; }
.game-page.is-playing .game-heading-row { gap: 12px; margin-bottom: 20px; align-items: center; }
.game-page .game-heading-row > .back-link { width: 36px; min-width: 36px; height: 44px; padding: 0; justify-content: flex-start; font-size: 29px; color: var(--game-caption); }
.game-page .game-heading-art { display: block; flex: none; width: 42px; height: 42px; border-radius: 12px; overflow: hidden; background: var(--game-tint); }
.game-page .game-heading-art > img { width: 100%; height: 100%; display: block; object-fit: contain; padding: 4px; }
.game-page .game-heading-row > h1 { font-size: 23px; font-weight: 800; line-height: 1.2; letter-spacing: -.035em; }
.game-page .game-heading-row > #game-player-switch { border: 1px solid var(--line); background: var(--game-paper); border-radius: 10px; padding: 10px 12px; min-height: 44px; max-width: 160px; font-size: 12px; font-weight: 650; color: var(--ink); }
.game-page .shared-turn { padding: 16px 18px; margin-top: 18px; border: 0; border-radius: 16px; background: var(--game-faint); }
.game-page .shared-turn p { font-size: 13px; line-height: 1.65; color: var(--game-caption); }
.game-page .shared-turn .btn { background: var(--game-paper); border: 1px solid var(--game-edge); font-size: 14px; min-height: 48px; color: var(--game-ink); }
.game-page #room-actions { margin-top: 18px; gap: 12px; }
.game-page #room-actions > .btn-primary { border-radius: 12px; }
.game-page .finish-round-note, .game-page #room-notice { font-size: 13px; line-height: 1.65; color: var(--game-caption); }
.game-page #room-notice:empty, .game-page #room-error:empty { display: none; }
.game-page .prompt-skip { padding: 0; border: 0; border-radius: 0; gap: 10px; }
.game-page .prompt-skip > .btn-secondary { background: transparent; border: 1px solid var(--line); }

body[data-route="game"] .game-dock { padding: 12px max(24px, calc((100vw - 760px) / 2)) max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--game-paper); column-gap: 10px; row-gap: 8px; }
body[data-route="game"] .game-dock > #dock-main { min-height: 52px; border-radius: 12px; padding: 14px 20px; font-size: 14px; font-weight: 800; background: var(--game-ink); color: var(--game-paper); }
body[data-route="game"] .game-dock > #dock-main:disabled { opacity: 1; background: var(--soft); color: var(--game-caption); }
body[data-route="game"] .game-dock-note, body[data-route="game"] .game-dock-error { font-size: 12px; line-height: 1.5; }
.quick-players { display: flex; align-items: center; gap: 8px; flex: 0 0 100%; order: -2; min-width: 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.quick-player-list { position: relative; display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 3px; }
.quick-player-list::-webkit-scrollbar { display: none; }
.quick-player, .quick-player-step { display: inline-flex; align-items: center; justify-content: center; flex: none; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--game-paper); color: var(--ink); touch-action: manipulation; }
.quick-player { gap: 8px; padding: 6px 12px 6px 7px; max-width: 190px; font-size: 13px; font-weight: 650; }
.quick-player.is-current { background: var(--game-tint); border-color: var(--game-edge); color: var(--game-ink); }
.quick-player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.quick-player-avatar { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--game-faint); color: var(--game-ink); font-size: 12px; font-weight: 800; }
.quick-player-step { width: 44px; padding: 0; font-size: 27px; line-height: 1; color: var(--game-ink); }
.quick-players button:disabled { opacity: .6; }
.quick-players button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
body[data-route="game"] .game-menu > summary { border-color: var(--line); border-radius: 12px; min-height: 52px; font-size: 13px; padding-inline: 16px; }
body[data-route="game"] .game-menu[open] > summary { background: var(--game-faint); border-color: var(--game-edge); }

body[data-route="game"] .team-menu-heading > strong { font-size: 20px; }
body[data-route="game"] #game-extra { padding: 14px 0; font-size: 13px; line-height: 1.65; color: var(--game-caption); }
body[data-route="game"] .team-menu-content > .btn { border-radius: 10px; min-height: 48px; justify-content: flex-start; text-align: left; }
body[data-route="game"] .game-menu-body .profile-panel { border: 0; border-radius: 12px; padding: 14px; background: var(--game-faint); }
body[data-route="game"] .game-menu-body .profile-chip { background: var(--game-paper); border-color: var(--line); min-height: 44px; }
body[data-route="game"] .game-menu-body .profile-chip[aria-pressed="true"] { background: var(--game-tint); color: var(--ink); border-color: var(--game-edge); }
body[data-route="game"] .pass-cover { background: var(--bg); }
body[data-route="game"] .pass-card { width: min(460px, calc(100% - 32px)); border: 0; border-radius: 24px; background: var(--game-paper); padding: 32px 24px; box-shadow: none; }
body[data-route="game"] .pass-card > svg { color: var(--game-ink); }
body[data-route="game"] .pass-card h2 { font-size: clamp(26px, 5vw, 36px); line-height: 1.2; letter-spacing: -.04em; margin-block: 12px 16px; }
body[data-route="game"] .pass-card .btn-primary { background: var(--game-ink); color: var(--game-paper); }

@media (max-width: 900px) {
  body[data-route="game"] .game-page { width: min(620px, calc(100% - 40px)); }
  body[data-route="game"] .game-page:not(.is-playing) { display: flex; align-items: stretch; }
  .game-page:not(.is-playing) #game-page-content { display: contents; }
  .game-page:not(.is-playing) .game-heading-row { margin-bottom: 12px; }
  .game-page .game-overview { grid-template-columns: 156px minmax(0, 1fr); gap: 20px; margin-bottom: 26px; align-items: center; }
  .game-page .game-page-art { height: 164px; border-radius: 22px; }
  .game-page .game-page-copy h1 { font-size: 30px; margin-bottom: 10px; }
  .game-page .game-page-copy .detail-description { margin-top: 12px; font-size: 14px; line-height: 1.6; }
  .game-page .game-live { margin-bottom: 20px; }
  .game-page .rules-panel { margin: 0; }
  .game-page #preparation-guide { margin-bottom: 20px; padding-bottom: 20px; }
}
@media (max-width: 560px) {
  body[data-route="game"] .game-page { width: calc(100% - 32px); padding-top: 4px; }
  body[data-route="game"][data-playing="true"] .game-page,
  body[data-route="game"][data-playing="true"]:is([data-game-id="apocalypse"], [data-game-id="mafia"]) .game-page { width: calc(100% - 24px); }
  .game-page .game-overview { grid-template-columns: 112px minmax(0, 1fr); gap: 16px; margin-bottom: 22px; }
  .game-page .game-page-art { height: 134px; border-radius: 20px; }
  .game-page .game-page-art > img { inset: 5%; width: 90%; height: 90%; }
  .game-page .game-page-copy h1 { font-size: 27px; line-height: 1.15; margin-bottom: 8px; letter-spacing: -.04em; }
  .game-page .game-page-copy .detail-meta { font-size: 12px; }
  .game-page .game-page-copy .detail-description { display: block; font-size: 13px; line-height: 1.55; margin-top: 10px; }
  .game-page #preparation-guide { padding: 0 0 18px; margin-bottom: 18px; }
  .game-page #preparation-guide strong { font-size: 15px; }
  .game-page #preparation-guide > p { font-size: 13px; line-height: 1.65; }
  .game-page.is-playing .game-heading-row { gap: 8px; margin-bottom: 14px; }
  .game-page .game-heading-row > .back-link { width: 28px; min-width: 28px; justify-content: center; }
  .game-page .game-heading-art { width: 34px; height: 38px; border-radius: 10px; }
  .game-page .game-heading-row > h1 { font-size: 19px; }
  .game-page .game-heading-row > #game-player-switch { max-width: 112px; padding: 9px; font-size: 11px; }
  .game-page .shared-turn { padding: 14px; margin-top: 14px; }
  body[data-route="game"] .game-dock { padding: 10px 12px max(10px, env(safe-area-inset-bottom)); gap: 8px; }
  body[data-route="game"] .game-dock > #dock-main { min-height: 50px; font-size: 13px; padding: 13px 14px; }
  body[data-route="game"] .game-menu > summary { padding-inline: 12px; min-height: 50px; font-size: 12px; }
  
}
@media (max-width: 360px) {
  .game-page .game-overview { grid-template-columns: 94px minmax(0, 1fr); gap: 14px; }
  .game-page .game-page-art { height: 118px; }
  .game-page .game-page-copy h1 { font-size: 23px; }
  .game-page .game-heading-art { width: 30px; }
  .game-page .game-heading-row > h1 { font-size: 17px; }
  .game-page .game-heading-row > #game-player-switch { max-width: 92px; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-route="game"] *, body[data-route="game"] *::before, body[data-route="game"] *::after { scroll-behavior: auto; transition-duration: .01ms; animation-duration: .01ms; animation-iteration-count: 1; }
}

/* Перед настройками остаются компактное название и раскрываемая памятка. */
#game-page #preparation-guide{padding:0;margin:0 0 12px;border:0;gap:0}
.preparation-basics{min-width:0;border-bottom:1px solid var(--line)}
.preparation-basics>summary{display:flex;align-items:center;gap:10px;min-height:44px;padding:8px 0;cursor:pointer;list-style:none}
.preparation-basics>summary::-webkit-details-marker{display:none}
#game-page #preparation-guide .preparation-basics>summary>strong{flex-shrink:0;font-size:13px;line-height:1.4;letter-spacing:0}
.preparation-format{flex:1;min-width:0;text-align:right;font-size:12px;line-height:1.4;color:var(--game-caption)}
.preparation-chevron{width:16px;height:16px;flex-shrink:0;color:var(--game-caption);transition:transform .16s ease}
.preparation-basics[open]>summary>.preparation-chevron{transform:rotate(90deg)}
#game-page #preparation-guide .preparation-basics>p{font-size:13px;line-height:1.6;color:var(--game-caption);margin:2px 0 10px}
#game-page #preparation-guide .preparation-basics>.preparation-connection{display:block;margin-bottom:10px}
#game-page #preparation-guide .preparation-connection summary{min-height:44px}
@media(max-width:760px){
 body[data-route="game"] #game-page:not(.is-playing){display:grid;grid-template-columns:44px minmax(0,1fr);column-gap:8px;row-gap:0;align-items:start;padding-top:4px}
 #game-page:not(.is-playing) #game-start-notice{grid-column:1/-1;grid-row:1}
 #game-page:not(.is-playing) #game-page-content{display:contents}
 #game-page:not(.is-playing) .game-heading-row{grid-column:1;grid-row:2;align-self:center;margin:0 0 12px}
 #game-page:not(.is-playing) .game-heading-row>.back-link{width:44px;min-width:44px;height:44px;padding:0;justify-content:center}
 #game-page:not(.is-playing) .game-overview{grid-column:2;grid-row:2;grid-template-columns:40px minmax(0,1fr);align-items:center;gap:10px;margin:0 0 12px}
 #game-page:not(.is-playing) .game-page-art{width:40px;height:48px;border-radius:10px}
 #game-page:not(.is-playing) .game-page-copy h1{font-size:21px;line-height:1.2;letter-spacing:-.6px;margin:0 0 4px}
 #game-page:not(.is-playing) .game-page-copy .detail-meta{font-size:12px;line-height:1.5}
 #game-page:not(.is-playing) .game-page-copy :is(.detail-description,.game-recommendation){display:none}
 #game-page:not(.is-playing) .game-live{grid-column:1/-1;grid-row:3;margin:0 0 16px}
 #game-page:not(.is-playing) .rules-panel{grid-column:1/-1;grid-row:4}
 #game-page:not(.is-playing) .rules-panel~.rules-panel{grid-row:5}
}
@media(max-width:360px){#game-page:not(.is-playing) .game-page-copy h1{font-size:19px}#game-page:not(.is-playing) .game-overview{grid-template-columns:34px minmax(0,1fr);gap:8px}#game-page:not(.is-playing) .game-page-art{width:34px;height:44px}}
