:root{color-scheme:light dark;--bg:#f5f7f5;--paper:#fff;--ink:#183d32;--muted:#60776d;--green:#205b49;--line:#d5e0da;--red:#b83e31;font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text",system-ui,sans-serif;color:var(--ink);background:var(--bg)}
*{box-sizing:border-box}body{margin:0}button,input,a,summary{-webkit-tap-highlight-color:transparent}button,input{font:inherit}a{color:inherit}button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid #66a895;outline-offset:3px}.game-shell{max-width:600px;min-height:100vh;min-height:100dvh;margin:auto;display:flex;flex-direction:column}.game-header{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;background:var(--green);color:#fff;padding:calc(env(safe-area-inset-top,0px) + 4px) max(16px,env(safe-area-inset-right)) 4px max(8px,env(safe-area-inset-left));flex:none}.game-header h1{font-size:20px;letter-spacing:.04em;margin:0}.back-link{display:flex;align-items:center;gap:4px;min-height:48px;width:max-content;text-decoration:none;font-size:14px;font-weight:600}.back-link span{font-size:32px;line-height:1}.header-mark{justify-self:end;font-size:26px;opacity:.8}main{padding:12px max(16px,env(safe-area-inset-right)) 8px max(16px,env(safe-area-inset-left));flex:1;min-width:0}.scene-heading{display:flex;justify-content:space-between;align-items:center;font-size:12px;font-weight:600;margin:0 2px 8px}.scene-heading #throw-count{font-weight:400;color:var(--muted);font-variant-numeric:tabular-nums}.table-scene{position:relative;height:clamp(220px,36dvh,340px);border-radius:24px;overflow:hidden;background:#284c3c;box-shadow:0 8px 24px #173d3212,inset 0 0 0 1px #ffffff20}#scene{width:100%;height:100%}#scene canvas{display:block;width:100%;height:100%}.scene-hint{position:absolute;bottom:12px;left:8px;right:8px;text-align:center;font-size:11px;color:#f1f6f1;pointer-events:none;text-shadow:0 1px 3px #163023}#scene-error{position:absolute;inset:0;background:var(--paper);padding:32px 24px;align-content:center;font-size:15px;line-height:1.8}#scene-error[hidden]{display:none}#scene-error a{display:block;margin-top:16px;font-weight:600}.result-card{display:flex;gap:16px;align-items:center;background:var(--paper);border:1px solid var(--line);border-radius:16px;padding:12px;margin-top:12px;min-height:78px}.face-list{display:flex;gap:4px;flex-shrink:0}.face-list span{display:grid;place-items:center;width:30px;height:34px;border-radius:8px;background:var(--bg);border:1px solid var(--line);font-weight:700;font-size:20px;font-variant-numeric:tabular-nums}.result-copy{min-width:0}.result-copy h2{font-size:18px;margin:0 0 4px;line-height:1.25}.result-copy p{font-size:11px;line-height:1.5;margin:0;color:var(--muted)}.result-card[data-kind=shonben] h2,.result-card[data-kind=cocked] h2{color:var(--red)}.controls{display:grid;grid-template-columns:1fr 1fr;gap:24px;margin-top:16px}.control-title{display:flex;justify-content:space-between;gap:4px;align-items:baseline}.control label{font-size:13px;font-weight:600}.control output{font-size:11px;color:var(--muted)}input[type=range]{display:block;width:100%;margin:0;min-height:44px;height:44px;accent-color:var(--green);cursor:pointer}input:disabled{opacity:.55}.scale-labels{display:flex;justify-content:space-between;font-size:10px;color:var(--muted);margin-top:-4px}.how-to{font-size:12px;line-height:1.7;margin-top:12px;color:var(--muted)}.how-to summary{min-height:44px;align-content:center;cursor:pointer}.how-to p{margin:0 0 8px}.game-footer{position:sticky;bottom:0;flex:none;background:var(--bg);padding:8px max(16px,env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left));border-top:1px solid var(--line)}#throw{width:100%;min-height:52px;border:0;border-radius:16px;color:#fff;background:var(--green);font-size:17px;font-weight:650;display:flex;align-items:center;justify-content:center;gap:8px;cursor:pointer;transition:transform .12s ease,opacity .12s ease}#throw>span:first-child{font-size:23px}#throw:active{transform:scale(.985)}#throw:disabled{opacity:.55;cursor:default}.game-footer p{font-size:10px;color:var(--muted);text-align:center;margin:8px 0 0}.rolling .scene-hint{opacity:.8}@media(min-width:700px){.game-shell{border-left:1px solid var(--line);border-right:1px solid var(--line)}.table-scene{height:380px}}@media(max-height:760px){main{padding-top:8px}.table-scene{height:clamp(190px,32dvh,270px)}.result-card{margin-top:8px;min-height:68px;padding:8px 12px}.controls{margin-top:12px}.how-to{margin-top:4px}}@media(max-width:360px){main{padding-left:12px;padding-right:12px}.controls{gap:16px}.result-card{gap:8px}.result-copy h2{font-size:16px}.face-list span{width:27px}}@media(prefers-color-scheme:dark){:root{--bg:#14271f;--paper:#20382d;--ink:#edf4ef;--muted:#adc1b6;--green:#286b54;--line:#3c5548;--red:#ff9e91}}@media(prefers-reduced-motion:reduce){#throw{transition:none}}
/* Round controls stay above the bowl; detailed corrections open below it. */
.round-link, #round-finish {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 44px; font-size: 14px; font-weight: 650; text-decoration: none;
}
.round-link { margin: -4px 0 8px; padding: 0 4px; border-bottom: 1px solid var(--line); }
.round-link span, #round-finish span { font-size: 21px; }
.round-panel, .round-manage { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 0 12px; }
.round-panel { margin: 0 0 12px; }
.round-context, .round-actions, .round-transfer { display: grid; align-items: center; gap: 8px; }
.round-context { grid-template-columns: 1fr auto; }
.round-context span { color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.round-panel button, .round-panel select, .round-manage button, .round-manage select {
  min-height: 44px; min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; padding: 4px 10px;
}
.round-panel button, .round-manage button { font-size: 13px; font-weight: 600; cursor: pointer; }
.round-panel select, .round-manage select { font-size: 16px; }
.round-panel select:focus-visible, .round-manage select:focus-visible { outline: 3px solid #66a895; outline-offset: 2px; }
#round-player { width: 100%; font-size: 17px; font-weight: 650; }
#round-status { margin: 8px 0 10px; line-height: 1.45; font-size: 12px; overflow-wrap: anywhere; color: var(--muted); }
#round-finish { border-top: 1px solid var(--line); }
.round-panel button:disabled, .round-manage button:disabled, .round-manage select:disabled { opacity: .48; cursor: default; }
.round-manage { margin-top: 8px; padding-bottom: 0; }
.round-manage[open] { padding-bottom: 8px; }
.round-manage summary { min-height: 44px; align-content: center; cursor: pointer; font-size: 13px; font-weight: 600; }
.round-manage label { display: block; margin: 8px 0 4px; color: var(--muted); font-size: 12px; }
#round-history { width: 100%; }
.round-actions { grid-template-columns: 1fr 1fr; margin: 8px 0 12px; }
.round-transfer { grid-template-columns: minmax(0,1fr) auto; }
button.round-reset { color: var(--red); border: 0; background: transparent; margin-top: 8px; }
.game-shell [hidden] { display: none !important; }
.result-copy #round-result-owner { margin-bottom: 2px; overflow-wrap: anywhere; }
.round-panel h2 { margin: 0; font-size: 19px; line-height: 1.35; overflow-wrap: anywhere; }
#round-setup, #round-picker { padding: 16px 0 12px; }
#round-setup h2, #round-picker h2 { margin-bottom: 12px; }
.round-fields { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
#round-setup label, #round-picker label { display: block; font-size: 13px; color: var(--muted); }
.round-fields select, #round-picker select, #round-limit-custom { display: block; margin-top: 4px; width: 100%; }
#round-custom-field { margin-top: 8px; }
#round-limit-custom { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; }
.round-hint, .round-invalid { font-size: 13px; line-height: 1.5; }
.round-hint { margin: 12px 0 0; }
.round-invalid { color: var(--muted); }
.round-invalid summary { min-height: 44px; align-content: center; cursor: pointer; }
.round-invalid p { margin: 0 0 8px; }
.round-panel .round-primary { background: var(--green); color: white; border-color: var(--green); font-weight: 650; }
#round-start, #round-choose { width: 100%; }
#round-choose { margin-top: 12px; }
.round-context { padding-top: 9px; }
.round-head, .round-play-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.round-head { flex-wrap: wrap; padding-top: 4px; }
#round-count { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.round-play-actions { justify-content: flex-end; flex-wrap: wrap; padding-bottom: 10px; }
.round-play-actions button { flex: 1; }
#round-back[aria-disabled=true] { opacity: .6; }
#round-prev { margin-top: 8px; }
/* Keep browser magnification separate from the result camera; allow a single-finger pan through the controls. */
html, body { touch-action: pan-x pan-y; }
.game-shell input { font-size: max(1rem, 16px); }
/* Direct manipulation is the primary input; button controls remain keyboard-accessible. */
#scene{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:grab}.holding #scene{cursor:grabbing}#hand-marker{position:absolute;width:64px;height:64px;transform:translate(-50%,-50%);border:2px solid #f6e6aeaa;border-radius:50%;background:#fff6cb16;pointer-events:none;display:grid;place-items:center;box-shadow:0 0 0 6px #fff6cb10;z-index:2}#hand-marker[hidden]{display:none}#hand-marker span{font-size:26px;opacity:0}#hand-marker.held{border-color:#ffe7a0;background:#fff7dc28}#hand-marker.held span{opacity:1}.button-mode{margin-top:16px;border:1px solid var(--line);border-radius:16px;background:var(--paper);padding:0 12px}.button-mode>summary{font-size:13px;font-weight:600;min-height:48px;align-content:center;cursor:pointer}.button-mode .controls{margin:0 0 16px}.button-mode #throw{margin-bottom:12px}.gesture-guide{display:flex;align-items:center;justify-content:center;gap:12px;font-size:12px;font-weight:600;min-height:28px}.game-footer{padding-top:12px;padding-bottom:calc(12px + env(safe-area-inset-bottom,0px))}.table-scene{height:clamp(260px,44dvh,400px)}@media(max-height:760px){.table-scene{height:clamp(230px,40dvh,320px)}}
#hand-marker svg{position:absolute;inset:-2px;width:64px;height:64px;transform:rotate(-90deg);pointer-events:none}#hand-marker circle{fill:none;stroke:#ffe7a0;stroke-width:3;stroke-dasharray:183;stroke-dashoffset:183}#hand-marker.pending circle{animation:grip-progress .22s linear forwards}#hand-marker.held svg{display:none}@keyframes grip-progress{to{stroke-dashoffset:0}}
.table-scene{height:clamp(260px,39dvh,352px);background:#a5a5a3;box-shadow:0 8px 24px #00000012,inset 0 0 0 1px #ffffff20}
.scene-hint{left:16px;right:16px;bottom:10px;width:max-content;max-width:calc(100% - 32px);margin:auto;padding:5px 10px;border-radius:12px;background:#232727d9;color:#fff;text-shadow:none}
.release-height{margin:8px 2px 0;font-size:12px;color:var(--muted)}.release-height span{font-variant-numeric:tabular-nums}
@media(max-height:760px){.table-scene{height:clamp(220px,34dvh,280px)}}
@media(prefers-reduced-motion:reduce){#hand-marker.pending circle{animation:none;stroke-dashoffset:0}}
.sound-toggle{justify-self:end;min-width:64px;min-height:44px;border:1px solid #ffffff55;border-radius:12px;background:#ffffff12;color:#fff;font-size:13px;font-weight:600;cursor:pointer}
.sound-toggle[aria-pressed=false]{background:transparent;color:#ffffffb3}

.game-header { position: sticky; top: 0; z-index: 5; }
html { scroll-padding-block: calc(64px + env(safe-area-inset-top, 0px)) calc(74px + env(safe-area-inset-bottom, 0px)); }

.stored-faces { font-size: 22px; font-weight: 700; letter-spacing: .1em; margin: 12px 0 4px; font-variant-numeric: tabular-nums; }
