:root {
  --chalk: rgba(242, 239, 230, 0.92);
  --chalk-dim: rgba(242, 239, 230, 0.55);
  --yellow: #E8C547;
  --red-chalk: #E07A6A;
  --slate: #2B2F2C;
  --oak: #8A5A32;
  --ink: #2A2620;
  --cream: #EDE4CF;
  --olive: #6F7A4A;
  --ochre: #C8952E;
  --hdr: 54px;
  --split: 38%;
  /* distemper: a faint brushed grain, painted, never glossy */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9 0.035' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0.16 0 0 0 0 0.15 0 0 0 0 0.12 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--cream); overflow: hidden; }
body { font: 15px/1.35 "PT Sans", sans-serif; color: var(--ink); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- the club wall: cream distemper above, ochre-green paint below ---------- */
#wall {
  position: fixed; inset: 0; overflow: hidden; overflow: clip;
  background: url("img/brick.jpg") center top / 300px 300px repeat, #5a2a1c;
}
#wall::before { /* a warm lamp over the board, the corners of the room falling into shade */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(70% 55% at 40% 38%, rgba(255, 214, 150, 0.22), rgba(255, 214, 150, 0) 60%),
              radial-gradient(120% 90% at 50% 40%, rgba(0, 0, 0, 0) 55%, rgba(20, 8, 4, 0.5) 100%);
}
#wall::after { content: none; }
.wall-light { display: none; }

/* ---------- header sign ---------- */
#sign {
  position: absolute; z-index: 4; top: 0; left: 0; right: 0; height: var(--hdr);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  background: var(--grain) 0 0 / 240px 240px, var(--cream);
  border-bottom: 3px solid #3a2a1e; box-shadow: 0 4px 10px rgba(20, 8, 4, 0.45);
}
/* stenciled paint: flat ink, slightly uneven where the brush went light */
.stencil {
  font-family: "Oswald", sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.18' numOctaves='3' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.1 1.5'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23m)'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.18' numOctaves='3' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.1 1.5'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23m)'/%3E%3C/svg%3E");
  -webkit-mask-size: 180px 180px; mask-size: 180px 180px;
}
.stencil-small { font-size: 26px; white-space: nowrap; }
.stencil .dot { margin: 0 0.2em; }
.sign-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tin-label {
  font-family: "Oswald", sans-serif; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; font-size: 13px;
  color: var(--ink); background: transparent; border: 2px solid var(--ink); border-radius: 3px; padding: 3px 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.tin-label:empty { display: none; }
body.on-menu .stencil-small, body.on-menu .tin-label { visibility: hidden; }

/* ---------- plaques: painted wooden boards, matte ---------- */
.plaque {
  font-family: "Oswald", sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 15px;
  color: var(--ink); background: var(--grain) 0 0 / 240px 240px, #F4EDDC;
  border: 2px solid var(--ink); border-radius: 3px; padding: 9px 14px; cursor: pointer;
  box-shadow: 0 1px 0 var(--ink);
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out;
  touch-action: manipulation; user-select: none;
}
.plaque:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 0 0 var(--ink); }
.plaque:disabled { opacity: 0.5; cursor: default; }
.plaque.accent, .plaque.selected { background: var(--grain) 0 0 / 240px 240px, var(--ochre); color: var(--ink); }
.plaque.small { font-size: 12px; padding: 5px 9px; white-space: nowrap; }
.plaque.big { font-size: 19px; padding: 13px 18px; width: 100%; }
.plaque.wide { width: 100%; font-size: 18px; padding: 13px 16px; }
.plaque small { display: block; font-family: "PT Sans", sans-serif; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 13px; opacity: 0.85; }
.plaque:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------- menu ---------- */
#menu { position: absolute; inset: 0; z-index: 3; overflow-y: auto; overflow-x: hidden; display: flex; justify-content: center; padding: calc(var(--hdr) - 10px) 16px 24px; }
.menu-inner { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; margin: auto 0; }
.sign-board { text-align: center; padding: 14px 10px 12px; background: var(--grain) 0 0 / 240px 240px, var(--cream); border: 3px solid var(--ink); border-radius: 3px; box-shadow: 0 8px 18px rgba(20, 8, 4, 0.5); }
.stencil-big { font-size: clamp(54px, 15vw, 92px); line-height: 1; letter-spacing: 0.06em; }
.stencil-sub { margin-top: 6px; font-size: 14px; font-weight: 500; letter-spacing: 0.3em; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-pick .plaque.big { font-size: 15px; padding: 12px 6px; line-height: 1.15; }
.options {
  display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 3px;
  background: var(--grain) 0 0 / 240px 240px, #E3D8BE; border: 2px solid var(--ink);
}
.opt-row { display: flex; flex-direction: column; gap: 6px; }
.opt-lbl { font-family: "Oswald", sans-serif; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; color: var(--ink); }
.opt-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opt-btns .plaque { padding: 9px 4px; font-size: 14px; }
.tags { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tag { display: block; background: var(--slate); border: 4px solid var(--oak); border-radius: 3px; box-shadow: inset 0 0 0 1px #5d3a1d, inset 0 0 12px rgba(0, 0, 0, 0.5); }
.tag input {
  width: 100%; border: 0; background: transparent; outline: none; padding: 2px 10px 0;
  font: 700 26px/1.2 "Caveat", cursive; color: var(--chalk);
}
.tag input::placeholder { color: var(--chalk-dim); }
.tag input:focus { background: rgba(255, 255, 255, 0.05); }
.rules { margin: 2px 0 0; padding: 8px 12px; font: 400 15px/1.35 "PT Sans", sans-serif; text-align: center; color: var(--ink); background: var(--grain) 0 0 / 240px 240px, var(--cream); border: 2px solid var(--ink); border-radius: 3px; }
.scope { margin: 0; font-size: 13px; text-align: center; color: var(--cream); text-shadow: 0 1px 2px #000; min-height: 1em; }

/* ---------- game layout: phone held upright first ---------- */
#game {
  overflow: hidden;
  position: absolute; z-index: 2; left: 0; right: 0; top: var(--hdr); bottom: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 4px 2px calc(64px + env(safe-area-inset-bottom));
}
#boardArea { flex: 0 1 min(100vw - 4px, 100% - 200px, 700px); min-height: 160px; display: flex; justify-content: center; align-items: center; width: 100%; container-type: size; }
#boardWrap {
  --bs: min(100cqw, 100cqh);
  width: var(--bs); height: var(--bs); max-width: 760px; max-height: 760px;
  position: relative; touch-action: none; user-select: none; -webkit-user-select: none;
}
#stage { position: fixed; inset: 0; z-index: 1; touch-action: none; user-select: none; -webkit-user-select: none; }
#stage canvas { display: block; touch-action: none; }
#game, #boardArea, #boardWrap { pointer-events: none; }
#side, #finale { pointer-events: auto; }
#side { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; min-height: 0; }
#side { flex: 0 0 auto; max-width: min(520px, 72vw); }
.mode-short { display: none; }
@media (max-width: 560px) { .mode-long { display: none; } .mode-short { display: inline; } }

/* ---------- slate ---------- */
.slate {
  position: relative; color: var(--chalk); font-family: "Caveat", cursive;
  background:
    radial-gradient(60% 40% at 30% 20%, rgba(255, 255, 255, 0.05), transparent 70%),
    radial-gradient(50% 50% at 75% 75%, rgba(255, 255, 255, 0.04), transparent 70%),
    var(--slate);
  border: 11px solid var(--oak);
  border-image: linear-gradient(135deg, #a06a3c, #7b4d29 40%, #93603a 60%, #6e4322) 1;
  box-shadow: inset 0 0 0 2px #4d2f16, inset 0 0 22px rgba(0, 0, 0, 0.6), 0 8px 20px rgba(0, 0, 0, 0.5);
  padding: 3px 10px 5px;
}
.slate-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.slate-status { font: 500 16px/1.1 "Caveat", cursive; color: var(--chalk); min-height: 24px; }
.slate-status b { color: var(--yellow); font-weight: 700; }
.sheet-close { display: none; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.col { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 0 4px; }
.col + .col { border-left: 2px solid rgba(242, 239, 230, 0.22); }
.pname { position: relative; display: flex; align-items: center; gap: 4px; font: 700 19px/1.05 "Caveat", cursive; max-width: 100%; }
.pname .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 0.2em 3px 0.05em; }
.pname .arrow { position: absolute; right: 100%; top: 50%; margin: -7px 2px 0 0; width: 24px; height: 14px; visibility: hidden; fill: none; stroke: var(--yellow); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.col.active .pname .arrow { visibility: visible; }
.col.active .pname .nm { color: var(--yellow);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M2 5 C20 2.5 38 6.5 55 4 S88 3 98 5.2' fill='none' stroke='rgb(232,197,71)' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") left bottom / 100% 7px no-repeat; }
.tally:empty { display: none; }
.tally { display: flex; gap: 5px; height: 16px; align-items: center; }
.tally i { width: 3px; height: 15px; background: var(--chalk); border-radius: 2px; transform: rotate(8deg); opacity: 0.9; }
.tally i:nth-child(2n) { transform: rotate(-4deg); height: 14px; }
.hist { list-style: none; margin: 2px 0; padding: 0; display: none; width: 100%; }
.hist li { position: relative; display: flex; justify-content: center; gap: 10px; font: 500 22px/1.1 "Caveat", cursive; }
.hist li .sc { color: var(--chalk-dim); min-width: 2.2em; text-align: right; font-size: 0.85em; }
.hist li .rm { position: relative; min-width: 2.4em; text-align: left; }
.hist li .rm::after {
  content: ""; position: absolute; left: -8%; right: -6%; top: 46%; height: 8px; transform: rotate(var(--rot, -3deg));
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M2 5 C20 3 40 6 60 4 S90 3.5 98 4.6' fill='none' stroke='rgba(242,239,230,0.85)' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.hist li.bust .sc { color: var(--red-chalk); }
.remain-lbl { display: none; font: 500 18px/1 "Caveat", cursive; color: var(--chalk-dim); }
.remain { font: 700 38px/0.95 "Caveat", cursive; letter-spacing: 0.01em; }
.col.active .remain { color: #fff8e6; }
.avg { display: none; font: 500 18px/1.1 "Caveat", cursive; color: var(--chalk-dim); }
.turnrow { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 2px; }
.slots { display: flex; gap: 8px; flex: 0 0 auto; }
.slot { flex: 0 0 auto; }
.slot {
  position: relative; width: 48px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(242, 239, 230, 0.8); border-radius: 4px 7px 3px 6px; font: 700 22px/1 "Caveat", cursive;
}
.slot:nth-child(2) { transform: rotate(-1deg); border-radius: 6px 3px 7px 4px; }
.slot:nth-child(3) { transform: rotate(1.2deg); }
.slot.miss { font-size: 18px; color: var(--chalk-dim); }
.slot.next { border-style: dashed; border-color: rgba(232, 197, 71, 0.75); }
.slots.bust .slot::after {
  content: ""; position: absolute; inset: -3px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 36' preserveAspectRatio='none'%3E%3Cpath d='M4 4 L56 33 M55 3 L5 32' fill='none' stroke='rgb(224,122,106)' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  animation: write 0.25s ease-out both;
}
.tsum { flex: 0 0 auto; min-width: 56px; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.tsum span { font: 500 16px/1 "Caveat", cursive; color: var(--chalk-dim); }
.tsum b { font: 700 24px/1 "Caveat", cursive; color: var(--yellow); }
.hint { text-align: center; font: 500 16px/1.1 "Caveat", cursive; min-height: 20px; color: var(--chalk); }
.hint b { color: var(--yellow); font-weight: 700; }
.hint.dim { color: var(--chalk-dim); }

.slate-msg:empty { display: none; }
.slate-msg { background: radial-gradient(ellipse at center, rgba(43,47,44,0.94) 0, rgba(43,47,44,0.82) 55%, rgba(43,47,44,0.55) 100%); animation: write 0.25s ease-out both; position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; }
.slate-msg .big { padding: 0 0.2em; font: 700 clamp(44px, 14vw, 64px)/1 "Caveat", cursive; transform: rotate(-7deg); }
.slate-msg .big.red { color: var(--red-chalk); }
.slate-msg .big.gold { color: var(--yellow); }
.slate-msg .sub { margin-top: 8px; font: 500 24px/1.1 "Caveat", cursive; color: var(--chalk); transform: rotate(-3deg); background: rgba(43, 47, 44, 0.85); padding: 0 8px; border-radius: 4px; }
.slate-msg .ringwrap { position: relative; padding: 10px 34px; background: rgba(43, 47, 44, 0.86); border-radius: 50%; }
.slate-msg .ringwrap svg { position: absolute; inset: -6px -10px; width: calc(100% + 20px); height: calc(100% + 12px); fill: none; stroke: var(--yellow); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 0.45s 0.15s ease-out forwards; }

.controls { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.controls .plaque { font-size: 13px; padding: 8px 8px; flex: 1 1 auto; white-space: nowrap; }

/* chalk is written, left to right */
.write { animation: write 0.28s ease-out both; }
@keyframes write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* history as a pull-up slate on narrow screens */
.sheet-backdrop { display: none; }
#side.sheet-open .sheet-backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 4, 2, 0.3); z-index: 20; }
#side.sheet-open .slate { max-height: 40dvh; position: fixed; z-index: 21; left: 0; right: 0; bottom: calc(8px + env(safe-area-inset-bottom)); top: auto; margin: 0 auto; width: min(480px, 72vw); max-width: none; display: flex; flex-direction: column; animation: up 0.22s ease-out; }
#side.sheet-open .sheet-close { display: inline-block; }
#side.sheet-open .cols { flex: 1 1 auto; min-height: 0; overflow-y: auto; align-items: start; }
#side.sheet-open .hist, #side.sheet-open .avg, #side.sheet-open .remain-lbl { display: block; }
#side.sheet-open .remain-lbl { display: none; }
#side.sheet-open .hist li { font-size: 18px; }
#side.sheet-open .avg { font-size: 15px; }
#side.sheet-open .remain { font-size: 38px; }
#side.sheet-open .slate-status { font-size: 16px; }
#side.sheet-open .hist li { display: flex; }
#side.sheet-open .hist { flex: 0 0 auto !important; overflow: visible !important; justify-content: flex-start !important; }
@keyframes up { from { transform: translateY(30px); } to { transform: none; } }

/* ---------- wide screens: board left, slate right ---------- */
@media (min-aspect-ratio: 6/5) {
  :root { --hdr: 58px; }
  .stencil-small { font-size: 30px; }
  .tin-label { font-size: 14px; }
  #game { flex-direction: row; align-items: stretch; gap: 0; padding: 0 0 env(safe-area-inset-bottom); }
  #boardArea { flex: 0 0 70%; align-items: center; height: auto; padding: 4px 12px; }
  #boardWrap { max-width: 900px; max-height: 900px; }
  #side { flex: 1 1 auto; max-width: 320px; min-height: 0; padding: 6px 18px 110px 6px; justify-content: center; }
  .slate { flex: 1 1 auto; min-height: 0; max-height: min(380px, 52vh); display: flex; flex-direction: column; padding: 6px 12px 8px; }
  .cols { flex: 1 1 auto; min-height: 0; }
  .col { min-height: 0; }
  .hist { display: flex; flex-direction: column; justify-content: flex-end; flex: 1 1 0; min-height: 0; overflow: hidden; }
  .remain-lbl, .avg { display: block; }
  .remain { font-size: clamp(40px, 7vh, 68px); }
  .only-narrow { display: none; }
  .slate-msg .big { font-size: clamp(56px, 9vh, 96px); }
  .controls .plaque { font-size: 14px; padding: 9px 10px; }
}
@media (min-aspect-ratio: 6/5) and (max-height: 520px) {
  :root { --hdr: 44px; }
  #side { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  #boardArea { padding: 8px 20px; }
  .stencil-small { font-size: 22px; }
  .slate { border-width: 8px; padding: 4px 10px 6px; }
  .slate-status, .hint { font-size: 18px; }
  .pname { font-size: 21px; }
  .remain { font-size: clamp(36px, 12vh, 60px); }
  .remain-lbl, .avg { display: none; }
  .hist li { font-size: 18px; }
  .slot { width: 50px; height: 30px; font-size: 21px; }
  .tsum b { font-size: 26px; }
  .controls .plaque { font-size: 12px; padding: 6px 6px; }
}
@media (min-aspect-ratio: 6/5) and (min-height: 800px) {
  :root { --hdr: 72px; }
  .stencil-small { font-size: 40px; }
  .tin-label { font-size: 17px; padding: 5px 12px; }
  #sign .plaque.small { font-size: 15px; padding: 7px 12px; }
  .slate-status, .hint { font-size: 19px; }
  .pname { font-size: 23px; }
  .hist li { font-size: 20px; }
  .avg, .remain-lbl { font-size: 17px; }
  .slot { width: 54px; height: 32px; font-size: 21px; }
  .tsum b { font-size: 28px; }
  .controls .plaque { font-size: 16px; padding: 11px 14px; }
}
@media (max-width: 440px) {
  .controls { flex-wrap: nowrap; }
  .controls .plaque { flex: 1 1 0; white-space: normal; line-height: 1.1; padding: 6px 3px; min-width: 0; font-size: 12.5px; }
}
@media (max-width: 370px) {
  #sign { gap: 6px; }
  .tin-label { display: none; }
  .slate { padding: 4px 8px 6px; border-width: 9px; }
  .controls { flex-wrap: nowrap; }
  .controls .plaque { flex: 1 1 0; white-space: normal; line-height: 1.1; padding: 5px 3px; min-width: 0; }
  .stencil-small { font-size: 21px; }
  .controls .plaque { font-size: 11.5px; padding: 7px 5px; }
  .slot { width: 48px; height: 30px; font-size: 20px; }
  .slots { gap: 6px; }
  .remain { font-size: 40px; }
  .pname { font-size: 19px !important; }
  .col { padding: 0 2px 0 16px !important; }
}

/* ---------- finale ---------- */
#finale { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(42, 38, 32, 0.45); padding: 16px; }
.finale-slate { width: min(520px, 100%); text-align: center; padding: 26px 18px 18px; position: relative; animation: up 0.25s ease-out; }
.finale-title { position: relative; z-index: 1; font: 700 clamp(44px, 11vw, 70px)/1.05 "Caveat", cursive; color: var(--yellow); padding: 12px 10px; }
.chalk-circle { position: absolute; left: 6%; top: 8px; width: 88%; height: 120px; fill: none; stroke: var(--yellow); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 0.5s 0.25s ease-out forwards; }
.finale-sub { font: 500 24px/1.25 "Caveat", cursive; margin: 14px 0 16px; white-space: pre-line; }
.finale-btns { display: flex; gap: 10px; justify-content: center; }
.finale-btns .plaque { min-width: 130px; font-size: 17px; }

@media (max-aspect-ratio: 6/5) and (max-height: 680px) {
  #game { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  #side { max-width: min(520px, 70vw); }
  #boardArea { flex-basis: min(100vw - 4px, 100% - 170px, 700px); }
  .slate { padding: 3px 8px 5px; border-width: 8px; }
  .slate-status, .hint { font-size: 18px; min-height: 20px; }
  .pname { font-size: 21px; }
  .remain { font-size: 38px; }
  .slot { height: 28px; font-size: 20px; }
  .tsum b { font-size: 24px; }
  .tsum span { font-size: 14px; }
  #side:not(.sheet-open) .col { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; padding: 0 2px 0 20px; }
  #side:not(.sheet-open) .col .hist { display: none; }
  #side:not(.sheet-open) .col .pname { flex: 0 1 auto; min-width: 0; }
  #side:not(.sheet-open) .col .tally { flex: 0 0 auto; margin-left: 6px; height: 12px; }
  #side:not(.sheet-open) .col .tally i { height: 12px; }
  #side:not(.sheet-open) .col .remain { flex-basis: 100%; text-align: center; }
  #side:not(.sheet-open) .hint.dim:empty { display: none; }
}
#finale .finale-slate { flex: 0 1 520px; display: block; max-height: none; min-height: 0; }

/* ---------- short phone screens (in-app browsers): one chalk strip, board first ---------- */
@media (max-aspect-ratio: 6/5) and (max-height: 740px) {
  :root { --hdr: 44px; }
  .stencil-small { font-size: 22px; }
  #sign .plaque.small, .tin-label { font-size: 12px; padding: 4px 8px; }
  #game { gap: 4px; padding: 2px 2px calc(46px + env(safe-area-inset-bottom)); }
  #boardArea { flex-basis: min(100vw - 4px, 100% - 96px, 700px); }
  #side { max-width: min(520px, 92vw); gap: 4px; }
  #side:not(.sheet-open) .slate {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 4px;
    grid-template-areas: "top top top" "c0 turn c1" "hint hint hint";
    padding: 2px 6px 3px; border-width: 6px;
  }
  #side:not(.sheet-open) .slate-top { grid-area: top; }
  #side:not(.sheet-open) .slate-status { font-size: 13.5px; line-height: 1.05; min-height: 0; }
  #side:not(.sheet-open) .hint.dim { display: none; }
  #side:not(.sheet-open) .cols { display: contents; }
  #side:not(.sheet-open) #col0 { grid-area: c0; }
  #side:not(.sheet-open) #col1 { grid-area: c1; border-left: 0; }
  #side:not(.sheet-open) .col { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: baseline; justify-content: center; gap: 4px; padding: 0 0 0 12px !important; }
  #side:not(.sheet-open) .col .pname { font-size: 15px !important; flex: 0 1 auto; min-width: 0; }
  #side:not(.sheet-open) .col .remain { flex: 0 0 auto; }
  #side:not(.sheet-open) .col .pname .arrow { width: 14px; height: 10px; margin-top: -5px; }
  #side:not(.sheet-open) .col .tally { display: none; }
  #side:not(.sheet-open) .col .remain { font-size: 26px; flex-basis: auto; }
  #side:not(.sheet-open) .turnrow { grid-area: turn; margin: 0; gap: 4px; align-self: center; }
  #side:not(.sheet-open) .slots { gap: 3px; }
  #side:not(.sheet-open) .slot { width: 33px; height: 24px; font-size: 15px; }
  #side:not(.sheet-open) .slot.miss { font-size: 13px; }
  #side:not(.sheet-open) .tsum { min-width: 26px; }
  #side:not(.sheet-open) .tsum span { display: none; }
  #side:not(.sheet-open) .tsum b { font-size: 20px; }
  #side:not(.sheet-open) .hint { grid-area: hint; font-size: 14px; line-height: 1.05; min-height: 0; }
  .controls .plaque { padding: 3px 3px !important; font-size: 10.5px !important; line-height: 1.05 !important; }
}
