/* Доска ограничена реальным местом в сетке, а не вычетом условных 300px.
   На компьютере прокручиваются инструменты; на телефоне остаётся обычная страница. */
.game-screen .panel{border:0;background:transparent}
.game-screen .pgroup{border:1px solid var(--line);border-radius:10px;background:linear-gradient(145deg,#fffdf9,var(--paper,#f6f4ef));box-shadow:0 1px 2px #32261906}
.game-screen .pbtn,.game-screen .panel .btn,.game-screen .p-seat{border-radius:7px}
.game-screen .pbtn{transition:background .15s,border-color .15s}
.game-screen .pbtn:focus-visible{outline:2px solid var(--wood);outline-offset:2px}
.game-screen .stage canvas{border-radius:8px;box-shadow:inset 0 0 0 1px #80502220}
.game-screen .p-seat{background:linear-gradient(130deg,#fdfbf7,#eee9df)}
.game-screen .panel input,.game-screen .panel select{border-radius:6px}
.battle-embedded .site-nav,.battle-embedded .head,.battle-embedded footer{display:none!important}
@media(min-width:700px){
 body.battle-embedded>.wrap{height:100dvh;display:flex;flex-direction:column}
 .battle-embedded .table{flex:1;min-height:0;width:100%;padding:0;container-type:size}
 .battle-embedded .table-in{height:100%;max-width:none;display:grid;grid-template-columns:min(100cqh,calc(100cqw - 224px)) minmax(220px,1fr);gap:4px;align-items:stretch}
 .battle-embedded .board-viewport{min-width:0;min-height:0;container-type:size;display:grid;place-items:start}
 .battle-embedded .board-viewport .stage{position:static;width:min(100cqw,100cqh);max-width:none;margin:0;padding:0}
 .battle-embedded .panel{position:static;height:100%;min-height:0;overflow:auto;padding:0 4px}
}
@media(prefers-reduced-motion:reduce){.game-screen .pbtn{transition:none}}
@media(min-width:961px){
  body.game-screen{margin:0}
  .game-screen > .wrap{height:100vh;height:100dvh;display:flex;flex-direction:column}
  .game-screen .head{flex:none;padding:10px 20px 0}
  .game-screen .head .eyebrow{display:none}
  .game-screen .head h1{font-size:22px;margin:0 0 4px}
  .game-screen .head .lede{font-size:14px;line-height:1.4;max-width:none}
  .game-screen .studio,.game-screen .table,.game-screen .desk{
    flex:1;min-height:0;width:100%;padding:0;container-type:size}
  .game-screen .studio-in,.game-screen .table-in,.game-screen .desk-in{
    height:100%;min-height:0;max-width:none;margin:0;display:grid;
    grid-template-columns:min(100cqh,calc(100cqw - 304px)) minmax(300px,1fr);gap:4px;align-items:stretch}
  .game-screen .board-viewport{min-width:0;min-height:0;display:grid;
    place-items:start;container-type:size}
  .ogs-screen .studio-in:not(.home){--ogs-panel:clamp(280px,24vw,360px);grid-template-columns:min(100cqh,calc(100cqw - var(--ogs-panel) - 8px)) var(--ogs-panel);justify-content:center;gap:8px}
  .game-screen .board-viewport .stage{position:relative;top:auto;
    width:min(100cqw,100cqh);max-width:none;aspect-ratio:1;height:auto;
    margin:0;padding:0;border:0;align-self:start;justify-self:start}
  .game-screen .stage canvas{display:block;width:100%;height:auto;aspect-ratio:1}
  .game-screen .panel{position:static;top:auto;min-width:0;min-height:0;height:100%;
    max-height:none;display:flex;flex-direction:column;gap:8px;overflow-y:auto;
    overscroll-behavior:contain;scrollbar-gutter:stable;padding:0 4px 2px 0}
  .game-screen .panel > *{flex-shrink:0}
  .game-screen .pgroup{padding:10px 12px}
  .game-screen .plabel{font-size:10px;letter-spacing:.1em;margin-bottom:8px}
  .game-screen .pbtn{padding:8px 10px;min-height:32px;font-size:11px;line-height:1.2}
  .game-screen .stat{font-size:13px;margin-bottom:3px}
  .game-screen .p-note,.game-screen .r-note,.game-screen .r-hint{font-size:13px;line-height:1.4}
  .game-screen .p-turn{font-size:13px;margin-bottom:8px}
  .game-screen .p-seat{padding:8px 10px;gap:8px}
  .game-screen .p-seat + .p-seat{margin-top:6px}
  .game-screen .p-name{font-size:13px;overflow-wrap:anywhere}
  .game-screen .p-clock{font-size:22px}
  .game-screen .p-stone{width:20px;height:20px}
  .game-screen .chat{font-size:14px;max-height:clamp(90px,20vh,180px)}
  .game-screen .nav-line{margin-top:6px}
  .game-screen .foot,.game-screen .howto{display:none}
  .game-screen .studio-in.home{grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    max-width:1100px;margin:0 auto}
  .game-screen .board-viewport:has(.stage[hidden]){display:none}
  .game-screen #oGate{grid-column:1/-1;align-self:start;max-width:680px;width:100%;margin:24px auto}
  .game-screen .board-viewport .stage:fullscreen{width:100vw;height:100dvh;
    max-width:none;aspect-ratio:auto;display:grid;place-items:center;background:#161A1E}
  .game-screen .stage:fullscreen canvas{width:min(100vw,100dvh);height:min(100vw,100dvh)}
}
@media(max-width:960px){.board-viewport{min-width:0}}
@media(min-width:961px){
  .joseki-screen .page{flex:1;min-height:0;padding:0}
  .joseki-screen .page-in{height:100%;max-width:none;display:flex;flex-direction:column}
  .joseki-screen .page-in > .eyebrow{display:none}
  .joseki-screen .page-in > h1{font-size:21px;margin:0 0 6px;flex:none}
  .joseki-screen .page-in > .lede{font-size:14px;line-height:1.4;margin-bottom:8px!important}
  .joseki-screen .j-cols{display:block;flex:1;min-height:0;container-type:size}
  .joseki-screen .j-layout{height:100%;display:grid;grid-template-columns:min(100cqh,calc(100cqw - 304px)) minmax(300px,1fr);gap:4px;align-items:stretch}
  .joseki-screen .j-board{max-width:none}
  .joseki-screen .j-say{min-height:0;margin:0;font-size:15px}
  .joseki-screen .card{padding:12px;margin:0}
  .joseki-screen .card h2{font-size:20px}
  .joseki-screen .panel h1{font-size:21px;margin:0 0 8px}
  .joseki-screen .j-item.on,.joseki-screen .j-item:hover{margin:0;padding-left:0;padding-right:0}
}
@media(max-width:960px){
  .game-screen .board-viewport .stage{padding:0;border:0;margin:0 auto;max-width:min(100%,calc(100dvh - 72px))}
  .joseki-screen .j-board{max-width:none}
}

.tournament-game{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:12px}.tournament-game a{font-size:14px;color:var(--ink)}.tournament-game button{border:1px solid var(--line);border-radius:12px;padding:10px 14px;background:var(--ink);color:var(--paper);cursor:pointer}.tournament-game button:disabled{opacity:.55}

.game-screen #pOver{order:0;border-left:3px solid var(--wood);font-size:15px;line-height:1.5}

/* Consent remains visible over both board modes and inside fullscreen. */
.board-takeback-notice{position:fixed;z-index:180;top:88px;left:50%;transform:translateX(-50%);width:min(380px,calc(100vw - 24px));box-sizing:border-box;padding:16px 18px;border:1px solid #bba47c;border-radius:18px;background:#fffdf7;color:#202820;box-shadow:0 12px 40px #0003;pointer-events:auto}
.board-takeback-notice[hidden]{display:none!important}
.board-takeback-notice .p-note{font-size:15px;line-height:1.5;margin:0 0 12px}
.board-takeback-notice .prow{display:flex;gap:8px}
.board-takeback-notice button{min-height:40px;flex:1}
.board-takeback-notice button[data-do="takeback_yes"]{background:#273e30;color:#fff;border-color:#273e30}

.game-audience{align-self:start;max-height:100%;overflow:auto;padding:10px 12px;background:var(--paper,#f7f5ef);color:var(--ink,#162421);border:1px solid var(--line,#ddd);border-radius:12px;font-size:13px;box-shadow:0 4px 20px #0001}
.game-audience strong,.game-audience small{display:block;margin-bottom:5px}.game-audience div{padding:3px 0;overflow-wrap:anywhere}#pOver #pReviewAction{border:0;background:transparent;padding:0;margin-top:10px}
/* Keep spectators beside the board on desktop and visible in immersive mode. */
.game-audience[hidden]{display:none!important}
@media(min-width:961px){.training-garden .studio:not(.garden-space) .studio-in:has(.game-audience:not([hidden])){grid-template-columns:160px minmax(0,1fr) 304px}}
@media(max-width:960px){.game-audience{grid-column:1/-1;max-height:112px;padding:8px 12px;margin:4px 0}.game-audience div{display:inline-block;margin-right:12px}}
.garden-space .game-audience{position:absolute;z-index:13;left:12px;top:68px;width:160px;max-height:28%;display:block;box-sizing:border-box}
@media(max-width:700px){.garden-space .game-audience{top:auto;bottom:12px;left:8px;width:150px;max-height:22%;font-size:12px}.garden-space .game-audience div{display:block;margin:0}}
.game-clock-hud .clock-hud-label{overflow-wrap:anywhere;line-height:1.3}

/* Keep the conversation and composer above calls and invitations. */
.game-screen #pChatList{max-height:136px;font-size:14px}
.game-screen #pChat .plabel{margin-bottom:6px}
.game-screen #pChatText{width:100%;font-size:16px}
.game-screen #pChatForm .pbtn{flex:0 0 auto;padding:8px}

.score-summary{color:var(--ink, #17221e)}
.score-summary p{margin:.5rem 0;line-height:1.5}
.score-totals{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0}
.score-totals>div{border:1px solid var(--line,#b8c1b9);border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:6px}
.score-totals b{font-size:1.6rem;font-variant-numeric:tabular-nums}
.score-note{font-size:.8rem;opacity:.85}
