:root {
  color-scheme: light;
  --ink:#132f3a; --muted:#435d66; --paper:#f7f7f0; --line:#b6c7c7; --action:#ad341f;
  --coral:#c54123; --teal:#147588;
  --mono:"Press Mono","Courier New",monospace;
  font:16px/1.5 "Segoe UI",Arial,sans-serif; color:var(--ink); background:#dbe6e5;
}
* {box-sizing:border-box}
body {margin:0;min-height:100vh;background:linear-gradient(126deg,#e4eeec,#e6eae1 65%,#d4e2e1)}
button,input {font:inherit;color:inherit}
button {cursor:pointer}
button:disabled {cursor:default}
button:focus-visible,a:focus-visible,input:focus-visible,canvas:focus-visible {outline:3px solid #097385;outline-offset:4px}
[hidden] {display:none!important}
#game {width:min(1384px,100%);margin:auto;padding:0 clamp(14px,3.8vw,62px) 26px}
.nav {height:clamp(66px,9vh,95px);display:flex;align-items:center;justify-content:space-between}
.nav-tools,.back,.plain {display:flex;align-items:center;gap:10px}
.back,.plain,.text-button {color:var(--ink);font-weight:650}
.back {text-decoration:none;font-size:.94rem}
.back span:first-child {font-size:1.35rem}
.nav-tools {gap:clamp(12px,2.5vw,34px)}
.plain,.text-button {border:none;background:none}
.question {display:grid;place-content:center;border:1.5px solid currentColor;width:20px;height:20px;font:bold 14px/1 Georgia;border-radius:50%}
.nav button.isk-language.isk-language {background:none;border-color:#9db2b5;box-shadow:none;color:var(--ink);border-radius:4px}
.stage {display:grid;grid-template-columns:minmax(0,1.44fr) minmax(350px,.86fr);isolation:isolate;overflow:hidden;border:1px solid #91a8a9;border-radius:7px;background:var(--paper);box-shadow:0 17px 50px #1f465116}
.cover,.ice {position:relative;margin:0;grid-area:1/1;min-height:clamp(530px,76vh,800px);background:#b3d2d4;overflow:hidden}
.cover img {position:absolute;width:100%;height:100%;object-fit:cover;object-position:57% 50%}
.cover::after {content:"";position:absolute;inset:62% 0 0;background:linear-gradient(transparent,#032737aa);pointer-events:none}
.cover figcaption {position:absolute;bottom:clamp(18px,4vw,42px);left:clamp(18px,3vw,42px);z-index:1;display:flex;align-items:center;gap:.7rem;color:white;font:500 clamp(.72rem,1.2vw,.91rem)/1.4 var(--mono);letter-spacing:.07em;text-transform:uppercase;text-shadow:0 1px 5px #123}
.flag {display:inline-block;width:13px;height:16px;border-left:2px solid currentColor;position:relative}
.flag:after {content:"";position:absolute;left:0;top:0;border:5px solid transparent;border-left:9px solid currentColor;border-right:0}
.console {grid-area:1/2;min-width:0;padding:clamp(28px,4.3vw,67px);display:flex;flex-direction:column;justify-content:center;border-left:1px solid #92a8a9;background:var(--paper)}
h1,h2,h3,p {margin:0}
h1,h2 {font-family:"Press Serif",Georgia,serif;line-height:1.01;letter-spacing:-.055em}
h1 {font-size:clamp(3.25rem,5.45vw,5.35rem);overflow-wrap:break-word;margin:1.1rem 0 1rem}
h2 {font-size:clamp(2.1rem,3.6vw,3.6rem);margin:.8rem 0 1rem}
.lead,.gesture,.note,.sheet p {color:var(--muted)}
.lead {font-size:clamp(1rem,1.25vw,1.12rem);line-height:1.51;max-width:37ch}
.format,.micro,.match-meta,.format-foot,caption,th,output,.range label,#join-form label {font-family:var(--mono)}
.format,.micro,.range label,#join-form label,caption {font-size:.72rem;line-height:1.3;letter-spacing:.085em;text-transform:uppercase}
.format {display:flex;align-items:center;gap:.75rem;font-weight:600;color:#365c65}
.house-mark {display:block;width:27px;height:27px;flex:none;border-radius:50%;border:3px solid #167c89;box-shadow:inset 0 0 0 3px var(--paper),inset 0 0 0 6px #cb492c,inset 0 0 0 8px var(--paper);background:#153944}
.actions {display:grid;gap:.65rem;margin-top:clamp(21px,3.5vh,35px)}
.primary,.secondary {width:100%;display:flex;justify-content:space-between;align-items:center;gap:.55em;padding:.8rem 1.07rem;min-height:46px;border-radius:4px;text-align:left;font-size:1.01rem;font-weight:680;line-height:1.35}
.primary {border:1px solid var(--action);background:var(--action);color:#fffafa}
.primary:hover:enabled {background:#8d2918}
.secondary {border:1px solid #91a7a8;background:transparent}
.secondary:hover:enabled {background:#e6efea}
.primary b,.secondary b {font:500 1.25em/1 var(--mono)}
.primary:disabled,.secondary:disabled {background:#d9e0dd;border-color:#c3cfca;color:#536870}
.text-button {justify-self:start;align-self:start;padding:.48rem 0;text-align:left;text-decoration:underline;text-underline-offset:.27rem;text-decoration-color:#8fa6a8;font-size:.92rem}
.text-button:hover,.back:hover,.plain:hover {color:#1a6b72}
.format-foot {border-top:1px solid var(--line);margin-top:clamp(20px,4.3vh,45px);padding-top:1.1rem;font-size:.69rem;display:flex;flex-wrap:wrap;gap:8px;align-items:center;color:var(--muted)}
.pair-icon {width:18px;height:12px;display:inline-block;background:radial-gradient(circle at 29% 24%,currentColor 0 2.3px,transparent 2.7px),radial-gradient(ellipse at 29% 103%,currentColor 0 4.2px,transparent 4.7px),radial-gradient(circle at 76% 27%,currentColor 0 2px,transparent 2.5px),radial-gradient(ellipse at 78% 105%,currentColor 0 3.8px,transparent 4.3px)}
.sep {opacity:.5}
input[type=text],#code {border:1px solid #81989c;background:white;border-radius:4px;padding:.68rem .8rem;min-width:0;width:100%}
#code {text-transform:uppercase;font:600 1.25rem var(--mono);letter-spacing:.2em}
.invite {margin:1.6rem 0 .8rem;border-block:1px solid var(--line);padding:1.15rem 0;display:grid;gap:.55rem}
.invite strong {font:600 clamp(1.8rem,3.2vw,3rem)/1.15 var(--mono);letter-spacing:.12em}
#cancel {margin-top:1rem}
.pulse,.dot {display:inline-block;width:12px;height:12px;border-radius:50%;background:#207588}
.pulse {box-shadow:0 0 0 4px #187c8522;margin:4px}
canvas {display:block;width:100%;height:100%;position:absolute;inset:0;touch-action:pan-y}
canvas.aiming {touch-action:none;cursor:crosshair}
.stage[data-play] .console {padding:clamp(20px,2.7vw,46px)}
.stage[data-play] h2 {font-size:clamp(1.9rem,3vw,3rem)}
.match-meta {display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px;font-size:.76rem;color:var(--muted)}
.scoreboard {display:flex;border-block:1px solid var(--line);margin:.65rem 0 1.15rem;padding:.55rem 0;gap:1rem}
.team {flex:1;display:flex;align-items:center;justify-content:space-between;gap:5px;min-width:0}
.team + .team {border-left:1px solid var(--line);padding-left:1rem}
.team div {display:flex;align-items:center;gap:6px;font-size:.83rem;font-weight:650}
.team b {font:700 1.8rem/1.1 "Press Serif",Georgia,serif}
.dot {width:10px;height:10px;flex:none;background:var(--teal)}
.coral .dot {background:var(--coral);border-radius:2px;transform:rotate(45deg)}
#shot-controls {display:grid;gap:.85rem}
.range {display:grid;align-items:center;grid-template-columns:1fr auto}
output {font-size:.85rem}
input[type=range] {grid-column:span 2;width:100%;min-height:24px;margin:0;accent-color:#176e79;cursor:pointer}
input[type=range]:disabled {opacity:.5;cursor:default}
.gesture,.note {font-size:.82rem;line-height:1.4}
.note {border-left:2px solid #37939a;padding-left:.7rem;margin:.9rem 0 .5rem}
.note:empty {display:none}
#leave {margin-top:.55rem}
#end-summary {margin:1rem 0}
table {border-collapse:collapse;width:100%;font-size:.82rem}
caption {text-align:left;margin-bottom:.55rem}
th,td {text-align:center;padding:.25rem;border-bottom:1px solid #d2ddda}
th {font-weight:500}
th:first-child {text-align:left}
.message {color:#7b331e;margin-top:.9rem;font-size:.92rem;line-height:1.4}
.sheet {color:var(--ink);width:min(435px,calc(100% - 24px));max-height:88dvh;padding:clamp(21px,4vw,32px);border:1px solid #7c989e;border-radius:7px;background:var(--paper);box-shadow:0 18px 60px #00161d38}
.sheet::backdrop {background:#071e2c9c}
.sheet-top {display:flex;justify-content:space-between;align-items:center}
.sheet-top button {border:none;background:none;font-size:1.7rem;line-height:1}
.sheet h2 {font-size:2rem;line-height:1.1}
.sheet h3 {font-size:1rem;margin:1.1rem 0 .2rem}
.sheet p {font-size:.93rem}
.sheet>.secondary {margin-top:1.2rem}
@media(max-width:760px) {
  #game {padding:0 12px 16px}
  .nav {height:54px}
  .stage {grid-template-columns:minmax(0,1fr)}
  .cover,.ice {min-height:0;grid-area:auto}
  .cover {height:clamp(170px,31svh,320px)}
  .cover img {object-position:57% 62%}
  .console {grid-area:auto;border:0;border-top:1px solid #9db3b2;padding:clamp(21px,5.5vw,32px)}
  h1 {font-size:clamp(2.45rem,8.2vw,3.4rem);margin:.62rem 0 .55rem}
  .format-foot {margin-top:14px;padding-top:12px}
  .actions {margin-top:18px}
  .stage[data-play] {padding:12px;gap:6px 12px;grid-template-columns:1fr auto;align-items:center}
  .stage[data-play] .console,.stage[data-play] #match {display:contents}
  .stage[data-play] .format,.stage[data-play] #stone-index {display:none}
  #turn-label {order:0;grid-column:1;margin:0;font-size:1.48rem!important}
  .match-meta {order:1;grid-column:2;justify-content:flex-end}
  .scoreboard {order:2;grid-column:span 2;margin:3px 0;padding:4px 0}
  .team b {font-size:1.25rem}
  .ice {order:3;grid-column:span 2;height:clamp(265px,43dvh,470px);border-radius:3px}
  #shot-controls,#end-summary,#rematch-actions,#shot-note,#leave,.stage[data-play] .message {grid-column:span 2}
  #shot-controls {order:4;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px 16px}
  #shoot,.gesture {grid-column:span 2}
  #shoot {min-height:39px;padding:7px 12px}
  .gesture {font-size:.75rem}
  #shot-note {order:5;margin:.2rem 0}
  #end-summary {order:6;margin:.3rem 0}
  #rematch-actions {order:7}
  #leave {order:9;margin:0;padding:3px 0}
  .stage[data-play] .message {order:8;margin:0}
}
@media (min-width:761px) and (max-height:650px) { .cover,.ice {min-height:515px}.console {padding-block:24px} }
@media (max-width:360px) { .nav-tools {gap:8px}.plain {gap:5px}.console {padding:17px}.match-meta {font-size:.68rem} }

/* The sheet is the opening screen. The controls sit on its near edge. */
:root {
  color-scheme:dark; --ink:#f0fafb; --muted:#abc4ca; --paper:#10262d;
  --line:#38545b; --action:#c2f2f1; --coral:#f18d65; --teal:#63c7c9;
}
body {background:#08181e}
.nav {height:clamp(54px,8vh,78px)}
.stage {background:#10262d;border-color:#30484e;border-radius:12px}
.stage:not([data-play]) {position:relative;display:grid;grid-template:1fr / minmax(0,1fr);min-height:clamp(27rem,75svh,53rem);align-items:end}
.stage:not([data-play]) .cover {position:absolute;inset:0;height:auto;min-height:0;z-index:-1}
.stage:not([data-play]) .cover img {object-position:64% center}
.stage:not([data-play]) .cover::after {inset:0;background:linear-gradient(0deg,#05161cee,transparent 68%),linear-gradient(90deg,#061b24aa,transparent 69%)}
.stage:not([data-play]) .console {grid-area:1/1;max-width:54rem;padding:clamp(1.2rem,5vw,5.7rem);background:none;border:0}
.stage:not([data-play]) h1 {font:800 clamp(3rem,7.5vw,7.6rem)/.94 system-ui,sans-serif;letter-spacing:-.078em;text-wrap:balance;max-width:10ch;margin:0;color:#f4ffff;text-shadow:0 2px 25px #06151c77}
.stage:not([data-play]) h2 {font:750 clamp(2rem,4.3vw,4.7rem)/1.02 system-ui,sans-serif;letter-spacing:-.055em}
#lobby-actions {display:flex;flex-wrap:wrap;gap:.6rem;margin-top:clamp(1.2rem,3vh,2rem)}
#lobby-actions button {width:auto;min-width:10rem;gap:1rem}
.primary {background:var(--action);border-color:var(--action);color:#08282f}
.primary:hover:enabled {background:#ebffff}
.secondary {background:#0a252dca;border-color:#89a6ac;color:#e8f6f6}
.secondary:hover:enabled {background:#234a53}
.console {background:linear-gradient(145deg,#16333a,#0d2028);border-color:var(--line)}
#wait-mode {color:#c8eff1}
#waiting .lead,.sheet p,.message {color:#ccdddf}
input[type=text],#code {background:#0d232c;color:var(--ink);border-color:#54747b}
.opponent-ready {display:flex;align-items:center;gap:.55rem;margin-top:.9rem;color:#cff4d5;font-weight:600}
.opponent-ready::before {content:"";width:.52rem;height:.52rem;border-radius:50%;background:#8af0af;box-shadow:0 0 .75rem #8af0af8a}
.stage[data-search] .pulse {background:#a7eff3;box-shadow:0 0 0 4px #a7eff328}
.stage[data-play] h2 {font:780 clamp(1.8rem,3vw,3.3rem)/1 system-ui,sans-serif;letter-spacing:-.06em}
.scoreboard {gap:.5rem;border:0;margin:.85rem 0;padding:0}
.team,.team + .team {padding:.62rem .75rem;background:#071d24;border:0;border-top:2px solid var(--teal)}
.team.coral {border-color:var(--coral)}
.team b {font:700 1.85rem/1 system-ui,sans-serif;font-variant-numeric:tabular-nums}
.sr-only {position:absolute!important;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(max-width:760px) {
  .stage:not([data-play]) {min-height:clamp(24rem,72svh,43rem)}
  .stage:not([data-play]) .cover img {object-position:59% center}
  .stage:not([data-play]) .console {padding:clamp(1.05rem,5vw,2rem)}
  #lobby-actions button {min-width:min(9rem,100%);flex:1}
  .stage[data-play] {background:#10272e}
  .scoreboard {margin:.4rem 0}
  .team,.team + .team {padding:.36rem .6rem}
  .team b {font-size:1.35rem}
}
