/* Word Elevator page. Colors only through the site's variables (tokens.css); the word grid board is
   /games/shared/wordgrid/board.css. Red Flare's rule holds: red is a filled block (light text on it), a line or a
   border on dark, never text. */

.we {
  --we-wood: color-mix(in oklab, var(--color-bg) 82%, var(--char-900));
  --we-wood-top: var(--color-bg);
  --we-wood-side: color-mix(in oklab, var(--color-bg) 55%, var(--char-900));
}
/* each kind of piece has its own color (tokens.css section 9): --k is it, --k-on is text on it */
.we .k-post, .we [data-mode="post"], .we [data-kind="post"] { --k: var(--wew-post); --k-on: var(--wew-on-post); }
.we .k-floor, .we [data-mode="floor"], .we [data-kind="floor"] { --k: var(--wew-floor); --k-on: var(--wew-on-floor); }
.we .k-tie, .we [data-mode="tie"], .we [data-kind="tie"] { --k: var(--wew-tie); --k-on: var(--wew-on-tie); }
.we main { color: var(--iron-ink); }
.we :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- start ---------- */
.we-card { max-width: 620px; margin: 0 auto; padding: 22px; border: 1px solid var(--iron-rule); border-radius: 14px;
  background: var(--iron-card); display: grid; gap: 16px; }
.we-start, .we-end { padding: 28px var(--gutter) 56px; }
.we-how { display: grid; gap: 8px; color: var(--iron-soft); }
.we-how p { margin: 0; }
.we-how b { color: var(--iron-ink); }
.we-choice { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.we-choice[hidden] { display: none; }
.we-choice legend { padding: 0; margin-bottom: 8px; font-family: var(--font-accent); font-size: 12px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; }
.we-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.we-chips button, .we-small { padding: 9px 14px; border: 1px solid var(--iron-rule); border-radius: 999px; background: transparent;
  color: var(--iron-ink); font: inherit; font-size: 15px; cursor: pointer; }
.we-chips button[aria-pressed="true"] { border-color: var(--ember); background: var(--ember); color: var(--on-ember); }
.we-small:hover, .we-chips button:hover { border-color: var(--iron-soft); }
.we-go { justify-self: start; padding: 12px 30px; border: 0; border-radius: 10px; font-family: var(--font-accent); font-size: 16px;
  font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--on-ember); background: var(--ember); cursor: pointer; }
.we-go:hover { background: var(--ember-hover); }
.we-go:disabled { opacity: .5; cursor: default; }
.we-status, .we-best { margin: 0; color: var(--iron-soft); }
.we-status:empty, .we-best:empty { display: none; }

.we-help-btn { justify-self: start; }

/* ---------- home, code, join and lobby (online, Nov 16 2026): mgbWord's screens in Word Elevator's colors ---------- */
.we-card[hidden] { display: none; }
.we-home { gap: 12px; }
.we-message { margin: 0; padding: 10px 12px; font-weight: 700; background: var(--iron-bg-alt); border-left: 3px solid var(--ember); }
.we-message[hidden] { display: none; }
.we-big { display: grid; grid-template-columns: 52px 1fr auto; gap: 2px 12px; align-items: center; width: 100%; min-height: 80px; padding: 14px;
  border: 1px solid var(--iron-rule); border-radius: 12px; background: var(--iron-bg-alt); color: var(--iron-ink); font: inherit; text-align: left; cursor: pointer; }
.we-big::after { content: "›"; grid-row: 1 / span 2; grid-column: 3; font-size: 24px; color: var(--iron-soft); }
.we-big:hover { border-color: var(--iron-soft); }
.we-big__ico { grid-row: span 2; width: 52px; height: 52px; display: grid; place-items: center; font-size: 28px; border-radius: 10px; background: var(--iron-card); }
.we-big__ico .we-shelbot { width: 42px; height: 42px; }
.we-big b { font-size: 19px; }
.we-big__sub { grid-column: 2; font-size: 14px; color: var(--iron-soft); }
.we-big--hot { background: var(--ember); border-color: var(--ember); color: var(--on-ember); }
.we-big--hot:hover { background: var(--ember-hover); border-color: var(--ember-hover); }
.we-big--hot .we-big__sub, .we-big--hot::after { color: var(--on-ember); opacity: .85; }
.we-big--hot .we-big__ico { background: var(--char-950); }
.we-bar2 { display: flex; align-items: center; gap: 6px; margin: -6px 0 -4px -10px; }
.we-back { min-width: 44px; min-height: 44px; font-size: 28px; line-height: 1; background: none; border: 0; color: inherit; cursor: pointer; }
.we-h { margin: 0; font-family: var(--font-accent); font-size: 20px; letter-spacing: .08em; text-transform: uppercase; }
.we-note { margin: 0; font-size: 14px; color: var(--iron-soft); }
.we-note:empty { display: none; }
.we-center { text-align: center; }
.we-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; width: 100%; max-width: 330px; margin: 0 auto; }
.we-slots span { aspect-ratio: 1 / 1.1; display: grid; place-items: center; font: 700 28px/1 var(--font-accent); border-radius: 8px; border: 2px solid var(--iron-rule); }
.we-slots span.cur { border-color: var(--ember); }
.we-slots span.full { background: var(--paper-card); color: var(--paper-title); border-color: transparent; }
.we-keys { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.we-keys button { aspect-ratio: 1 / 1.08; padding: 0; font: 700 20px/1 var(--font-accent); cursor: pointer; border: 0; border-radius: 6px;
  background: var(--paper-card); color: var(--paper-title); }
.we-keys button:active { transform: translateY(2px); }
.we-keys .del { font-family: inherit; background: var(--iron-bg-alt); color: var(--iron-ink); }
.we-keys .paste { grid-column: 1 / -1; aspect-ratio: auto; min-height: 46px; font: 700 15px/1 var(--font-body); background: var(--iron-bg-alt); color: var(--iron-ink); }
.we-field { display: grid; gap: 6px; }
.we-field > span { font-family: var(--font-accent); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.we-field input { padding: 11px 12px; border: 1px solid var(--iron-rule); border-radius: 8px; background: var(--iron-bg-alt); color: var(--iron-ink); font: inherit; font-size: 17px; }
.we-faces { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.we-faces button { aspect-ratio: 1; font-size: 22px; line-height: 1; padding: 0; cursor: pointer; background: var(--iron-bg-alt); border: 1px solid var(--iron-rule); border-radius: 6px; }
.we-faces button[aria-pressed="true"] { background: var(--ember); border-color: var(--ember); }
.we-invite { display: grid; gap: 8px; justify-items: center; padding: 14px; text-align: center; background: var(--iron-bg-alt); border: 1px solid var(--iron-rule); border-radius: 10px; }
.we-invite span { font-family: var(--font-accent); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--iron-soft); }
.we-invite b { font: 700 34px/1.1 var(--font-accent); letter-spacing: .14em; }
.we-invite .we-go { justify-self: center; }
.we-people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.we-people li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--iron-bg-alt); border-radius: 8px; font-weight: 700; min-width: 0; }
.we-people .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.we-people small { font-weight: 400; color: var(--iron-soft); }
#lobby-settings { display: grid; gap: 14px; }
.we-summary { display: flex; flex-wrap: wrap; gap: 6px; }
.we-summary span { padding: 6px 12px; border: 1px solid var(--iron-rule); border-radius: 999px; font-size: 14px; }

/* online, in the game: everyone's height in the bar, a ranking at the end */
.we-cover__small { font-size: 14px; }
.we-cover__small:empty { display: none; }
.we-rank { margin: 0; padding: 0 0 0 1.4em; display: grid; gap: 6px; }
.we-rank[hidden] { display: none; }
.we-rank li { padding-left: 4px; }
.we-rank b { font-family: var(--font-accent); }
.we-rank small { color: var(--iron-soft); }

/* ---------- How to play (opens over the page) ---------- */
.we-sheet[hidden] { display: none; }
.we-sheet { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: color-mix(in oklab, var(--char-950) 60%, transparent); backdrop-filter: blur(6px); }
.we-help { width: 100%; max-width: 720px; max-height: calc(100vh - 32px); overflow: auto; gap: 10px; background: var(--iron-bg); color: var(--iron-ink); }
.we-help:focus { outline: none; }
.we-help__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.we-help h3 { margin: 10px 0 0; font-family: var(--font-accent); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--iron-soft); }
.we-help p, .we-help ul { margin: 0; line-height: 1.5; }
.we-help ul { padding-left: 1.2em; display: grid; gap: 5px; }
.we-help b { color: var(--iron-ink); }
.we-key { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; background: var(--k); vertical-align: 0; }
.we-help .we-go { justify-self: start; margin-top: 8px; }

/* ---------- playing ---------- */
body.we[data-view="play"] .site-header, body.we[data-view="play"] .site-footer { display: none; }
body.we[data-view="play"] { padding-top: 0; }
.we-play { padding: 14px var(--gutter) 24px; max-width: 1700px; margin: 0 auto; display: grid; gap: 14px; }
.we-play[hidden], .we-end[hidden] { display: none; }
.we-bar { display: flex; align-items: center; gap: 10px 28px; flex-wrap: wrap; justify-content: center; }
.we-stat { display: grid; justify-items: center; }
.we-stat[hidden] { display: none; }
.we-stat > span { font-family: var(--font-accent); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--iron-soft); }
.we-stat b { font-family: var(--font-accent); font-size: 26px; font-variant-numeric: tabular-nums; }
.we-stat--low b { padding: 0 8px; border-radius: 6px; color: var(--on-ember); background: var(--ember); }

.we-table { position: relative; display: grid; gap: 18px; align-items: start; }
@media (min-width: 1000px) {
  .we-table { grid-template-columns: minmax(300px, 400px) minmax(240px, 290px) minmax(0, 1fr); }
}
.we-words { display: grid; gap: 10px; }
.we-left { margin: 0; text-align: center; font-size: 14px; color: var(--iron-soft); }

.we-side { display: grid; gap: 12px; align-content: start; }
.we-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.we-modes button { padding: 10px 6px 8px; border: 1px solid var(--iron-rule); border-bottom: 5px solid var(--k); border-radius: 10px;
  background: transparent; color: var(--iron-ink); font: 700 17px var(--font-body); cursor: pointer; }
.we-modes button:hover { border-color: var(--k); }
.we-modes button[aria-pressed="true"] { border-color: var(--k); background: var(--k); color: var(--k-on); }
.we-modes button:disabled { opacity: .35; cursor: default; }
.we-modes kbd { font: 11px var(--font-accent); opacity: .7; }
.we-need { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--iron-rule); border-radius: 10px; font-size: 14px; }
.we-need p { margin: 0; }
.we-need span { display: inline-block; min-width: 3.6em; padding-left: 7px; margin-right: 4px; border-left: 4px solid var(--k); color: var(--iron-soft); }
.we-need b { font-family: var(--font-accent); font-size: 16px; }
.we-need__h { font-family: var(--font-accent); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--iron-soft); }
.we-msg { margin: 0; min-height: 2.8em; font-size: 14px; color: var(--iron-soft); }
.we-tray { display: grid; gap: 6px; max-height: 48vh; overflow: auto; }
.we-empty { margin: 0; font-size: 14px; color: var(--iron-soft); }
.we-chip { display: flex; gap: 4px; transition: opacity .5s, transform .5s; }
.we-chip.gone { opacity: 0; transform: translateY(14px) scale(.92); }
.we-chip__use { flex: 1; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--iron-rule);
  border-radius: 9px; background: var(--iron-bg-alt); color: var(--iron-ink); font: inherit; cursor: pointer; text-align: left; }
.we-chip__use:hover { border-color: var(--iron-ink); }
.we-chip__word { font-family: var(--font-accent); font-size: 14px; letter-spacing: .06em; min-width: 6.5em; }
.we-chip__bar { display: flex; gap: 2px; flex-wrap: wrap; }
.we-chip__bar i { width: 8px; height: 12px; border-radius: 1px; background: var(--k, var(--we-wood)); }
.we-chip--cut .we-chip__bar i { opacity: .6; }
.we-chip--nofit { opacity: .45; }
.we-chip__use b { margin-left: auto; font-family: var(--font-accent); color: var(--iron-soft); }
.we-chip__cut { width: 38px; border: 1px solid var(--iron-rule); border-radius: 9px; background: transparent; color: var(--iron-ink); cursor: pointer; }
.we-cutrow { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 0 4px 12px; }
.we-cutrow button { padding: 5px 10px; border: 1px solid var(--iron-rule); border-radius: 999px; background: transparent; color: var(--iron-ink); font: 13px var(--font-accent); cursor: pointer; }
.we-confirm[hidden] { display: none; }
.we-confirm { display: grid; gap: 6px; padding: 10px 12px; border: 2px solid var(--ember); border-radius: 10px; background: var(--iron-card); }
.we-confirm span { font-size: 14px; color: var(--iron-soft); }
.we-confirm div { display: flex; gap: 8px; align-items: center; }
.we-go--sm { padding: 8px 16px; font-size: 13px; }
#undo { justify-self: start; font-size: 13px; padding: 6px 12px; }

.we-stage { overflow: auto; max-height: calc(100vh - 110px); border: 1px solid var(--iron-rule); border-radius: 12px; background: var(--char-950); }
.we-stage svg { display: block; margin: 0 auto; }

/* the building (draw.js) */
.f-front { fill: var(--we-wood); } .f-top { fill: var(--we-wood-top); } .f-side { fill: var(--we-wood-side); }
/* built pieces carry a tint of their kind's color; back pieces are a little darker so the front ones read first */
.k-post .f-front { fill: color-mix(in oklab, var(--we-wood) 62%, var(--k)); } .k-post .f-top { fill: color-mix(in oklab, var(--we-wood-top) 64%, var(--k)); }
.k-floor .f-front { fill: color-mix(in oklab, var(--we-wood) 80%, var(--k)); } .k-floor .f-top { fill: color-mix(in oklab, var(--we-wood-top) 84%, var(--k)); }
.k-tie .f-front { fill: color-mix(in oklab, var(--we-wood) 70%, var(--k)); } .k-tie .f-top { fill: color-mix(in oklab, var(--we-wood-top) 70%, var(--k)); }
[class*="k-"] .f-side { fill: color-mix(in oklab, var(--we-wood-side) 80%, var(--k)); }
.back { filter: brightness(.8); }
.cut .f-front { stroke: var(--char-950); stroke-width: 1; stroke-dasharray: 3 3; }
.we-piece { cursor: pointer; }
.we-piece:hover { filter: brightness(1.2); }
.doomed .f-front, .doomed .f-top, .doomed .f-side { fill: var(--char-950); stroke: var(--flare); stroke-width: 2; }
.ghost { opacity: .75; pointer-events: none; animation: we-ghost 1s ease-in-out infinite alternate; }
.ghost .f-front, .ghost .f-top, .ghost .f-side { fill: var(--k); stroke: var(--color-bg); stroke-width: 1.5; stroke-dasharray: 4 3; }
@keyframes we-ghost { from { opacity: .45; } to { opacity: .9; } }
.early { opacity: .42; }
.fresh { animation: we-fresh .9s ease-out; }
@keyframes we-fresh { 0% { filter: brightness(1.8); } 100% { filter: none; } }
.g-front { fill: var(--char-700); } .g-top { fill: var(--char-500); } .g-side { fill: var(--char-800); }
.we-plan { stroke: var(--char-700); stroke-width: 1; stroke-dasharray: 4 5; }
.we-plan.now { stroke: var(--char-500); }
rect.we-open { fill: none; stroke: var(--k, var(--color-border)); stroke-width: 1.4; stroke-dasharray: 4 3; pointer-events: none; }
.we-dim, .we-tie, .we-plan { pointer-events: none; }
.we-num { cursor: pointer; }
.we-num .we-dim__pill { stroke: var(--k); stroke-width: 2; }
.we-num.wait { opacity: .5; }
.we-dim__line { stroke: var(--color-border); stroke-width: 1.2; }
.we-dim__pill { fill: var(--char-950); stroke: var(--color-border); stroke-width: 1; }
.we-dim__txt { fill: var(--color-bg); font: 700 13px var(--font-accent); }
.we-dim--main .we-dim__txt { font-size: 15px; }
.we-dim--gap .we-dim__line { stroke: var(--k); }
.we-dim--gap .we-dim__pill { stroke: var(--k); stroke-width: 2; }
.we-tie__line { stroke: var(--k); stroke-width: 2; stroke-dasharray: 5 4; }
.we-tie .we-dim__pill { stroke: var(--k); stroke-width: 2; }
.we-tie.aimed .we-tie__line { stroke-width: 3.5; }
.we-tie--later { opacity: .45; }
.we-aim { fill: none; stroke: var(--color-bg); stroke-width: 2.5; }
.we-hit { fill: transparent; cursor: pointer; }
.we-rail { stroke: var(--char-500); stroke-width: 2; }
.we-car__front, .we-car__top, .we-car__side { fill: var(--flare); stroke: var(--flare-deep); }
.we-car__top { filter: brightness(1.25); } .we-car__side { filter: brightness(.7); }
.we-car__txt { fill: var(--on-flare); font: 700 12px var(--font-accent); }

/* pause and between-rounds covers: blur the table, card in the middle (mgbWord's pause) */
.we-cover[hidden] { display: none; }
.we-cover { position: absolute; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 12px;
  padding: 20px; text-align: center; background: color-mix(in oklab, var(--char-950) 55%, transparent); backdrop-filter: blur(8px); }
.we-cover b { font: 800 clamp(30px, 6vw, 44px)/1 var(--font-heading); color: var(--color-bg); }
.we-cover span { max-width: 34ch; color: var(--color-bg); }
.we-cover .we-go { justify-self: center; }

/* ---------- topped out ---------- */
.we-end__h { margin: 0; font-family: var(--font-accent); font-size: 28px; letter-spacing: .1em; text-transform: uppercase; }
.we-end__score { margin: 0; font-size: 18px; }
.we-end__score b { font-family: var(--font-accent); font-size: 44px; }
.we-end__line { margin: 0; color: var(--iron-soft); }
.we-end__btns { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Shelbot ---------- */
/* her face, from mgbWord (colors: tokens.css section 7, --pl-sb-*) */
.we-shelbot { display: block; overflow: visible; }
.we-shelbot .head { fill: var(--pl-sb-head); } .we-shelbot .shade { fill: var(--pl-sb-shade); } .we-shelbot .ink { fill: var(--pl-sb-ink); }
.we-shelbot .shine { fill: var(--pl-sb-shine); } .we-shelbot .blush { fill: var(--pl-sb-blush); opacity: .7; } .we-shelbot .tongue { fill: var(--pl-sb-blush); }
.we-shelbot .bow { fill: var(--pl-sb-bow); } .we-shelbot .bow-knot { fill: var(--pl-sb-bow-knot); }
.we-shelbot .lnk { fill: none; stroke: var(--pl-sb-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.we-shelbot .ant { stroke: var(--pl-sb-shade); stroke-width: 2; stroke-linecap: round; }
.we-chips--bot button { display: inline-flex; align-items: center; gap: 6px; }
.we-chips--bot .we-shelbot { width: 22px; height: 22px; }
.we-stat > span i { font-style: normal; }
.we-goal { font-size: .55em; color: var(--iron-soft); font-weight: 400; }
.we-sound { min-width: 2.4em; }

/* The last 10 seconds (Nov 26 2026, mgbWord's Board glow): the letters' frame glows amber, then red from 5, with the
   number popping on its corner */
.we-board-wrap { position: relative; }
.we-board-wrap #board { border-radius: 14px; transition: box-shadow .25s; }
.we-words.cd-warn #board { box-shadow: 0 0 0 2px var(--wew-post), 0 0 14px 2px var(--wew-post); }
.we-words.cd-hot #board { box-shadow: 0 0 0 3px var(--ember), 0 0 22px 6px var(--ember); }
.we-count { position: absolute; top: -16px; right: -6px; z-index: 8; min-width: 46px; height: 46px; border-radius: 23px; display: none; place-items: center;
  font: 900 26px var(--font-body); background: var(--wew-post); color: var(--wew-on-post); border: 3px solid var(--char-950); pointer-events: none; }
.we-words.cd-hot .we-count { background: var(--ember); color: var(--on-ember); }
.we-count.on { display: grid; animation: we-count-pop .5s ease; }
@keyframes we-count-pop { 40% { transform: scale(1.45); } }
@media (prefers-reduced-motion: reduce) { .we-count.on { animation: none; } }

/* The other builders on the side of your tower (Nov 26 2026): a tick at their highest point, their face and the number */
.we-rival-mark { cursor: pointer; }
.we-rival-mark__tick { stroke: var(--iron-soft); stroke-width: 1.5; stroke-dasharray: 3 3; }
.we-rival-mark__dot { fill: var(--char-900); stroke: var(--iron-ink); stroke-width: 1.5; }
.we-rival-mark__num { fill: var(--iron-ink); font: 700 12px var(--font-accent); }
.we-rival-mark:hover .we-rival-mark__dot { stroke: var(--ember); }
.we-look[hidden] { display: none; }
.we-look { position: sticky; top: 0; z-index: 2; display: flex; gap: 10px; align-items: center; justify-content: center; font-size: 14px; padding: 8px; background: var(--char-950); }
.we-look button { padding: 6px 14px; border: 1px solid var(--iron-rule); border-radius: 999px; background: transparent; color: var(--iron-ink); font: inherit; font-size: 14px; cursor: pointer; }
.we-look button[aria-pressed="true"] { border-color: var(--ember); background: var(--ember); color: var(--on-ember); }
.we-end__face .we-shelbot { width: 64px; height: 64px; }
.we-end__face:empty { display: none; }

/* ---------- phones and small tablets (Nov 16 2026, Mark's pick "A · All in one" from the phone mockups,
   games/WordElevator/mockups/phone.html): one screen, no scrolling. Building on top (it gets every spare pixel),
   then the handle, what the storey needs, Post / Floor / Tie, a sideways strip of words, and the letters at the
   bottom under the thumb. The handle trades letters for building: elevator.js sets --grid (the letters' width)
   and .we-tall (letters tucked away). On a touchscreen a word is tapped once for its ghost, again to place it. */
.we-handle { display: none; }
.we-short { display: none; }
@media (max-width: 999px) {
  body.we[data-view="play"] { overflow: hidden; }
  .we-play { height: 100dvh; padding: 0; gap: 0; grid-template-rows: auto minmax(0, 1fr); touch-action: manipulation; }
  .we-bar { gap: 6px 8px; padding: 6px 8px; justify-content: space-between; flex-wrap: nowrap; border-bottom: 1px solid var(--iron-rule); }
  .we-stat b { font-size: 18px; }
  .we-stat--low b { padding: 0 4px; }
  .we-sound { min-width: 0; }
  .we-stat > span { font-size: 9px; letter-spacing: .05em; }
  .we-goal { font-size: .5em; }
  .we-stat--round { display: none; }   /* phones: room for Highest, Floor and Words instead */
  #undo .we-long { display: none; }
  .we-play, .we-table { max-width: 100vw; overflow: hidden; }
  .we-bar .we-small { padding: 5px 8px; font-size: 12px; white-space: nowrap; }
  .we-bar .we-long { display: none; }
  .we-bar .we-short { display: inline; font-weight: 700; }
  .we-stat b { white-space: nowrap; }

  .we-table { height: 100%; min-height: 0; gap: 0; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) auto auto auto auto auto;
    grid-template-areas: "stage stage" "handle handle" "need need" "modes undo" "tray tray" "words words"; }
  .we-side { display: contents; }
  .we-stage { grid-area: stage; align-self: stretch; height: 100%; max-height: none; min-height: 0; border: 0; border-radius: 0; }
  .we-need { grid-area: need; display: flex; flex-wrap: wrap; gap: 1px 12px; padding: 5px 12px; border: 0; border-bottom: 1px solid var(--iron-rule); border-radius: 0; font-size: 12.5px; }
  .we-need__h { flex-basis: 100%; font-size: 10px; }
  .we-need span { min-width: 0; }
  .we-need b { font-size: 14px; }
  .we-modes { grid-area: modes; padding: 7px 0 0 10px; }
  .we-modes button { padding: 8px 4px 6px; font-size: 15px; }
  .we-modes kbd { display: none; }
  #undo { grid-area: undo; align-self: end; margin: 0 10px 0 6px; padding: 9px 10px; font-size: 12px; }
  .we-tray { grid-area: tray; display: flex; gap: 6px; max-height: none; overflow-x: auto; overflow-y: hidden; min-height: 54px; padding: 7px 10px 4px; scrollbar-width: none; }
  .we-tray::-webkit-scrollbar { display: none; }
  .we-empty { align-self: center; font-size: 13px; }
  .we-chip { flex: none; }
  .we-chip__use { display: grid; grid-template-columns: auto auto; gap: 3px 6px; padding: 6px 10px; }
  .we-chip__word { min-width: 0; font-size: 13px; }
  .we-chip__bar { grid-column: 1 / -1; grid-row: 2; }
  .we-chip__bar i { width: 6px; height: 8px; }
  .we-chip__use b { margin-left: 0; font-size: 12px; }
  .we-chip--sel .we-chip__use { border: 2px solid var(--k); background: color-mix(in oklab, var(--iron-bg-alt) 75%, var(--k)); }
  .we-chip__cut { width: 32px; }
  .we-cutrow { flex: none; align-items: center; padding: 0; }
  /* Clear space under the letters (Mark, Nov 27 2026): a word traced along the bottom row made the phone think you were
     swiping up to switch apps. The building above gives up the height (its row takes whatever is left). */
  .we-words { grid-area: words; gap: 0; padding: 0 12px calc(64px + env(safe-area-inset-bottom)); }
  .we-words .wg { max-width: var(--grid, 300px); gap: 2px; --wg-gap: calc(var(--grid, 300px) * .022); }
  .we-words .wg-tile { font-size: calc(var(--grid, 300px) * .088); border-radius: 9px; }
  .we-words .wg-word { min-height: 1.35em; }
  .we-words .wg-word__text { font-size: 17px; }
  .we-words .wg-word__note { font-size: 13px; }
  .we-left { display: none; }
  .we-tall .we-words { display: none; }
  /* messages float over the bottom of the building instead of taking a row */
  .we-msg { position: absolute; left: 12px; right: 12px; top: var(--toast-top, 40%); z-index: 5; min-height: 0; text-align: center; font-size: 12.5px; pointer-events: none; }
  .we-msg:not(:empty) { padding: 5px 10px; border-radius: 999px; background: color-mix(in oklab, var(--char-950) 85%, transparent); color: var(--iron-ink); }
  .we-confirm { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 30; }
  /* the handle: a grab bar (drag) plus an arrow and a word saying what a tap does */
  .we-handle { grid-area: handle; display: grid; justify-items: center; gap: 1px; width: 100%; padding: 4px 0 3px; border: 0; border-bottom: 1px solid var(--iron-rule);
    background: var(--char-950); color: var(--iron-soft); cursor: ns-resize; touch-action: none; }
  .we-handle i { width: 44px; height: 4px; border-radius: 2px; background: var(--iron-rule); }
  .we-handle span { display: flex; align-items: center; gap: 5px; font: 600 10px var(--font-accent); letter-spacing: .12em; text-transform: uppercase; }
  .we-handle svg { width: 14px; height: 14px; transition: transform .25s; }
  .we-handle[data-dir="up"] svg { transform: rotate(180deg); }
  .we-handle:active i { background: var(--ember); }
}

/* Guided (Nov 24 2026; the game since Nov 26, ?classic = old rules): no mode buttons, one job at a time in the Storey box */
body.we-guided .we-modes, body.we-guided [data-flow="classic"] { display: none; }
body:not(.we-guided) #go-friends, body:not(.we-guided) #go-code { display: none; }   /* ?classic: solo and Shelbot only (rooms build guided) */
body:not(.we-guided) [data-flow="guided"] { display: none; }
.we-need__job { font-size: 16px; }
.we-need__job b { font-size: 22px; }
.we-need__then { font-size: 12px; color: var(--iron-soft); }
/* Guided: no drag handle (the building centres itself on the next job, the letters keep one size) */
body.we-guided .we-handle { display: none; }
@media (max-width: 999px) {   /* guided phones: no handle or mode row, so Undo sits beside the job and the hint goes */
  body.we-guided .we-table { grid-template-rows: minmax(0, 1fr) auto auto auto; grid-template-areas: "stage stage" "need undo" "tray tray" "words words"; }
  body.we-guided .we-need__then { display: none; }
  body.we-guided #undo { align-self: center; margin-right: 10px; }
}

/* the narrowest phones: the testing button gives up its place so Quit fits */
@media (max-width: 380px) { #end-round { display: none; } }
