.ter-game{display:grid;grid-template-columns:minmax(0,1fr);gap:17px;width:100%;min-width:0;color:var(--ink);--ter-turn-color:#dc6246;--ter-turn-fill:#fff0e8}
.ter-game *{box-sizing:border-box}.ter-game button,.ter-game input{touch-action:manipulation}.ter-top{min-width:0;display:flex;flex-direction:column;gap:11px}
.ter-end{display:none}
.ter-game .ter-heading{font-size:clamp(23px,3vw,30px);margin:0}.ter-game .ter-rules{margin:0;font-size:15px;line-height:1.55}.ter-board-info{margin:0;text-align:center;color:var(--muted);font-size:13px;line-height:1.5}
.ter-scores{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;width:100%;max-width:620px;margin:2px auto 0}
.ter-score{display:flex;align-items:center;gap:9px;min-width:0;padding:12px;border:2px solid transparent;border-radius:16px;background:#f6f7fb}
.ter-score.is-active{background:var(--ter-player-fill);border-color:var(--ter-player)}.ter-avatar{display:grid;place-items:center;flex:none;width:38px;height:38px;border-radius:12px;background:white;font-size:22px;color:var(--ter-player);font-weight:750}
.ter-identity{min-width:0;flex:1}.ter-name{display:block;color:var(--ink);font-size:15px;line-height:1.3;overflow-wrap:anywhere}.ter-player-status{display:block;color:var(--muted);font-size:12px;margin-top:3px;line-height:1.3}.ter-score.is-active .ter-player-status{color:var(--ter-player);font-weight:700}.ter-score-count{font-size:27px;color:var(--ter-player);font-variant-numeric:tabular-nums;flex:none}
.ter-status{margin:0;padding:10px 13px;border-radius:11px;background:var(--ter-turn-fill);color:var(--ink);text-align:center;font-size:14px;line-height:1.5;min-height:42px}
.ter-solo .ter-scores{grid-template-columns:minmax(0,1fr);max-width:440px}
.ter-practice-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.ter-practice-stats p{display:flex;flex-direction:column;gap:4px;padding:9px 10px;margin:0;border-radius:11px;background:#fff0e8;color:var(--ink);font-size:12px;line-height:1.35}.ter-practice-stats strong{font-size:23px;color:#dc6246;font-variant-numeric:tabular-nums}
.ter-stage{width:100%;min-width:0;display:flex;align-items:start;justify-content:center}.ter-board{display:block;width:100%;height:auto;max-width:520px;aspect-ratio:1;touch-action:manipulation;user-select:none;-webkit-user-select:none}
.ter-tools{display:flex;flex-direction:column;gap:12px;min-width:0;width:100%;max-width:520px;justify-self:center;align-self:start}
.ter-turn{margin:0;color:var(--ter-turn-color);font-size:19px;font-weight:800;line-height:1.35;overflow-wrap:anywhere}.ter-selection{margin:0;color:var(--ink);font-size:14px;line-height:1.5;background:#f4f5f9;padding:10px 12px;border-radius:10px}
.ter-navigation{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.ter-navigation button{min-width:0;min-height:46px;padding:10px 6px;font-size:14px}
.ter-confirm{width:100%;min-height:50px!important;color:white!important;font-size:16px!important;white-space:normal;line-height:1.35}.ter-confirm:focus-visible,.ter-navigation button:focus-visible{outline:3px solid var(--ter-turn-color);outline-offset:3px}
.ter-help,.ter-progress{font-size:13px;line-height:1.55;color:var(--muted);margin:0}.ter-progress{font-variant-numeric:tabular-nums}
.ter-aids{min-width:0;margin:0;padding:10px 12px 12px;border:1px solid var(--border);border-radius:11px}.ter-aids legend{padding:0 5px;color:var(--ink);font-weight:700;font-size:14px}
.ter-aid{display:flex;align-items:center;gap:9px;min-height:44px;font-size:14px;line-height:1.35;overflow-wrap:anywhere}.ter-aid input{flex:none;width:20px;height:20px;margin:0;accent-color:var(--purple)}.ter-aid-note{margin:4px 0 0;font-size:12px;line-height:1.5;color:var(--muted)}
.ter-keyboard{border-top:1px solid var(--border);padding-top:10px;font-size:13px;line-height:1.55;color:var(--muted)}.ter-keyboard summary{min-height:36px;color:var(--ink);font-size:14px;font-weight:700;cursor:pointer}.ter-keyboard p{margin:8px 0 0}.ter-keyboard-note{font-style:italic}
.ter-review{width:100%;max-width:440px;margin:12px auto}.ter-review-board{max-width:440px}.ter-review-legend{display:flex;flex-wrap:wrap;justify-content:center;gap:7px 17px;margin-top:10px;font-size:13px;line-height:1.5}.ter-review-player{font-weight:700;overflow-wrap:anywhere}.ter-review-note{font-size:13px;line-height:1.5;text-align:center;color:var(--muted);margin:9px 0 0}
@media(min-width:900px){.ter-game{grid-template-columns:minmax(0,1fr) minmax(200px,240px);column-gap:24px;row-gap:20px;max-width:840px;margin-inline:auto}.ter-top{grid-column:1/-1}.ter-stage{grid-column:1}.ter-tools{grid-column:2}.ter-game .ter-board{max-width:400px}}
@media(max-width:390px){.ter-game{gap:13px}.ter-scores{gap:6px}.ter-score{padding:9px 7px;gap:6px}.ter-avatar{width:29px;height:31px;font-size:18px;border-radius:9px}.ter-name{font-size:14px}.ter-player-status{font-size:11px}.ter-score-count{font-size:23px}.ter-status{font-size:13px}.ter-game .ter-rules{font-size:14px}}
@media(max-width:650px){
  .ter-game{gap:10px}.ter-top{gap:6px}
  .ter-game .ter-heading{font-size:20px;line-height:1.2}
  .ter-game .ter-rules{font-size:14px;line-height:1.4}
  .ter-board-info{font-size:12px;line-height:1.35}
  .ter-scores{gap:7px;margin:1px auto 0}.ter-score{padding:7px 8px;gap:7px;border-radius:12px}
  .ter-score .ter-avatar{display:none}
  .ter-score .ter-name{font-size:14px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal}
  .ter-player-status{font-size:12px;line-height:1.25;margin-top:2px}.ter-score-count{font-size:23px}
  .ter-status{padding:7px 9px;min-height:0;font-size:13px;line-height:1.4}
  .ter-tools{gap:8px}.ter-tools .ter-turn{order:-3;font-size:16px;line-height:1.3}
  .ter-tools .ter-confirm{order:-2}.ter-tools .ter-progress{order:-1}
  .ter-selection{font-size:13px;line-height:1.4;padding:8px 10px}
}

/* A shared board with a personal set of controls at each physical end. */
.ter-game[data-table-view=face]{display:flex;flex-direction:column;gap:6px;max-width:none}
.ter-game[data-table-view=face] .ter-top,.ter-game[data-table-view=face] .ter-tools{display:none}
.ter-game[data-table-view=face] .ter-stage{display:grid;grid-template-columns:136px minmax(0,1fr) 136px;grid-template-rows:minmax(0,1fr);align-items:stretch;gap:10px;height:var(--table-stage-height,360px)}
.ter-game[data-table-view=face] .ter-board{grid-column:2;grid-row:1;width:100%;height:100%;min-height:0;max-width:none;object-fit:contain;align-self:center;justify-self:center;touch-action:none}
.ter-game[data-table-view=face] .ter-end{display:block;position:relative;min-width:0;min-height:0;background:var(--ter-player-fill);border:2px solid transparent;border-radius:16px;overflow:hidden}
.ter-game[data-table-view=face] .ter-end.is-active{border-color:var(--ter-player)}
.ter-end-0{grid-column:1;grid-row:1}.ter-end-1{grid-column:3;grid-row:1}
.ter-end-inner{position:absolute;left:50%;top:50%;width:calc(var(--table-stage-height,360px) - 16px);height:124px;display:flex;flex-direction:column;justify-content:center;gap:5px;padding:4px 8px;transform-origin:center}
.ter-end-0 .ter-end-inner{transform:translate(-50%,-50%) rotate(90deg)}.ter-end-1 .ter-end-inner{transform:translate(-50%,-50%) rotate(-90deg)}
.ter-end-identity{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}.ter-end-name{font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.ter-end-count{font-size:18px;color:var(--ter-player);white-space:nowrap;font-variant-numeric:tabular-nums}
.ter-end-turn{font-size:13px;font-weight:650;margin:0;color:var(--ter-player);text-align:center;line-height:1.2}.ter-end-actions{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:6px}.ter-end-actions .game-btn{min-width:0;min-height:44px;padding:6px!important;font-size:16px!important;background:#fff;color:var(--ter-player);border-color:transparent}.ter-end-actions .ter-end-trace{background:var(--ter-player)!important;color:#fff!important;font-size:15px!important}.ter-end-actions .game-btn:disabled{opacity:.4}.ter-end-actions .game-btn:focus-visible{outline:3px solid var(--ter-player);outline-offset:1px}
.ter-end-hint{display:flex;justify-content:center;align-items:center;gap:7px;min-height:24px;font-size:13px;line-height:1.2}.ter-end-hint input{width:18px;height:18px;margin:0;accent-color:var(--ter-player)}
@media(orientation:portrait){
 .ter-game[data-table-view=face] .ter-stage{grid-template-columns:minmax(0,1fr);grid-template-rows:126px minmax(160px,1fr) 126px;height:min(740px,calc(100dvh - 235px));min-height:424px;gap:8px}
 .ter-game[data-table-view=face] .ter-board{grid-column:1;grid-row:2}
 .ter-game[data-table-view=face] .ter-end-0{grid-column:1;grid-row:3}.ter-game[data-table-view=face] .ter-end-1{grid-column:1;grid-row:1}
 .ter-end-inner{position:static;width:100%;height:100%;padding:6px 12px}.ter-end-0 .ter-end-inner{transform:none}.ter-end-1 .ter-end-inner{transform:rotate(180deg)}
}
@media(orientation:landscape) and (max-width:740px){.ter-game[data-table-view=face] .ter-stage{grid-template-columns:124px minmax(0,1fr) 124px;gap:6px}.ter-end-inner{height:114px;padding:2px 6px;gap:3px}.ter-end-name{font-size:14px}.ter-end-count{font-size:16px}.ter-end-actions{grid-template-columns:44px minmax(0,1fr) 44px;gap:4px}.ter-end-hint{font-size:12px;min-height:22px}}
