/* Towers of Wyoming: the shared look for splash, phone and TV. Prairie dusk: plum sky, a warm
   horizon, copper pennies, cream cards in four suit colours. No web fonts, no remote anything:
   the party rig is offline, so every asset is local (test/pages.test.ts fails on an external URL). */
:root {
  --dusk: #1d1326; --dusk2: #2b1c38; --dusk3: #3d2a4d; --line: #5f476e;
  --ink: #f7ecdc; --dim: #c9b3c6; --paper: #fbe9cf; --inkd: #2a1a2e;
  --copper: #e0915a; --copper2: #a85a28; --peach: #f2a65a;
  --good: #7fe0a0; --bad: #ff7b6b;
  /* the four suits: bright on the dusk, dark on a cream card */
  --S: #9dbcf2; --H: #ff7685; --C: #74d690; --D: #ffc857;
  --Sd: #26375e; --Hd: #c2263a; --Cd: #1c7a3f; --Dd: #a85d06;
  /* the kit's shared end screen (client/endscreen.ts), in this game's colours */
  --cs-end-bg: linear-gradient(to top, #6b3a3f 0%, #3d2a4d 26%, #1d1326 70%); --cs-end-fg: #f7ecdc; --cs-end-dim: #c9b3c6;
  --cs-end-accent: #f2a65a; --cs-end-win: #f2a65a; --cs-end-loss: #9dbcf2;
  --display: "Rockwell", "Roboto Slab", "Courier New", Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); font: 500 16px/1.4 var(--body); background: var(--dusk) linear-gradient(to top, #6b3a3f 0%, #3d2a4d 22%, #1d1326 62%) fixed;
  -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; }
h1 { color: var(--peach); font-size: 32px; line-height: 1.1; letter-spacing: .01em; }
h2 { color: var(--paper); font-size: 20px; }
button { background: var(--dusk3); border: 1.5px solid var(--line); color: var(--ink); padding: 10px 14px; border-radius: 10px;
  font: inherit; font-weight: 700; cursor: pointer; }
button.primary { background: var(--peach); border-color: var(--peach); color: var(--inkd); }
button:disabled { opacity: .38; cursor: default; }
select, input { font: inherit; padding: 8px; border-radius: 8px; background: var(--dusk2); color: var(--ink); border: 1.5px solid var(--line); }
a { color: var(--peach); }
.muted, .hint, .tagg { color: var(--dim); }
.tagg { font-size: 13px; margin-left: 6px; }
.av { border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.sg { font-style: normal; } .sg.s-S { color: var(--S); } .sg.s-H { color: var(--H); } .sg.s-C { color: var(--C); } .sg.s-D { color: var(--D); }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(160px); background: var(--paper); color: var(--inkd);
  padding: 10px 18px; border-radius: 10px; transition: transform .25s; z-index: 50; max-width: 92vw; font-weight: 700; }
#toast.show { transform: translateX(-50%) translateY(0); }
/* on a seat the bottom of the screen is the hand and the buttons: a toast sits over the building site instead */
body.phone #toast { bottom: 200px; white-space: nowrap; } body.phone #toast:not(.show) { transform: translateX(-50%) translateY(400px); }
#conn { position: fixed; top: 8px; right: 8px; background: var(--bad); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: 13px; display: none; z-index: 60; }
#conn.show { display: block; }

/* ---- kit phone shell: join + lobby ---- */
.join, .lobbyv { max-width: 480px; margin: 0 auto; padding: 24px 16px; display: grid; gap: 12px; }
.join input { font-size: 20px; padding: 12px; }
.join button, .lobbyv button { font-size: 17px; padding: 12px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow button { flex: 1 1 auto; }
.seat-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; background: #0006; border-radius: 10px; margin: 4px 0; }
.levers { display: grid; gap: 6px; }
.levers label { display: grid; grid-template-columns: minmax(0, 9.5em) minmax(0, 1fr); align-items: center; gap: 8px; color: var(--dim); font-weight: 700; font-size: 14px; }
.levers select { min-width: 0; width: 100%; padding: 6px; font-size: 14px; }

/* ---- shared pieces: the Sky, the piles, the building site ---- */
.sky { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sky-label { white-space: nowrap; color: var(--dim); font-weight: 700; font-size: 13px; } .sky-label b { color: var(--copper); font-size: 1.35em; }
.sky-pennies { display: flex; gap: 3px; flex: none; }
.sky-pennies i { width: 15px; height: 15px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffd2a6, #e0915a 45%, #8a4a20); box-shadow: 0 1px 2px #0008; }
.sky-pennies i.gone { background: none; box-shadow: none; border: 1.5px dashed #ffffff38; }
.sky-pennies i.falling { animation: pennyfall 1.2s ease-in; }
@keyframes pennyfall { from { background: radial-gradient(circle at 35% 30%, #ffd2a6, #e0915a 45%, #8a4a20); border-color: transparent; transform: translateY(0); } to { transform: translateY(300%); opacity: 0; } }
.sky-piles { margin-left: auto; display: flex; flex-direction: column; gap: 1px; white-space: nowrap; color: var(--dim); font-size: 12px; line-height: 1.2; font-weight: 600; }
.dk { display: inline-flex; align-items: center; gap: 4px; } .dk b { color: var(--ink); }
.dk i { width: 9px; height: 12px; border-radius: 2px; display: inline-block; }
.dk-back { background: repeating-linear-gradient(45deg, var(--copper2) 0 2px, var(--dusk3) 2px 4px); border: 1px solid var(--copper); }
.dk-face { background: var(--paper); border: 1px solid #0006; }

.plots { --nameh: 40px; position: relative; display: flex; gap: 8px; height: 100%; min-height: 0; }
.lot { flex: var(--piles, 1) 1 0; min-width: 0; display: flex; flex-direction: column; }
.lot-piles { flex: 1; min-height: 0; display: flex; gap: 6px; justify-content: center; align-items: stretch; padding: 0 4px;
  box-shadow: inset 0 -3px 0 #b77a5a; background: linear-gradient(to top, #f2a65a1f, transparent 55%); border-radius: 8px 8px 0 0; }
.lot.up .lot-piles { box-shadow: inset 0 -3px 0 var(--peach); background: linear-gradient(to top, #f2a65a47, transparent 70%); }
.lot-name { height: var(--nameh); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; }
.lot-name b { color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; } .lot.up .lot-name b { color: var(--peach); }
.lot.out { opacity: .5; } .lot-gone { align-self: center; font-size: 12px; color: var(--dim); text-align: center; }
.pile { position: relative; flex: 1 1 0; min-width: 0; max-width: 84px; padding: 0; border: 0; border-radius: 6px 6px 0 0; background: none; color: var(--ink); cursor: default; transition: opacity .2s; }
.pile .slabs { position: absolute; inset: 0 0 3px; display: flex; flex-direction: column-reverse; }
.pile .slabs i { flex: none; height: calc(100% / var(--rows)); border: 1px solid #0007; border-radius: 3px; background: var(--c); box-shadow: inset 0 2px 0 #ffffff40; }
.pile.s-S { --c: var(--S); } .pile.s-H { --c: var(--H); } .pile.s-C { --c: var(--C); } .pile.s-D { --c: var(--D); }
.pile.bare .slabs::after { content: ""; height: calc(100% / var(--rows)); border: 1.5px dashed #ffffff55; border-radius: 3px; }
.pile-n { position: absolute; left: -4px; right: -4px; bottom: calc(var(--n) / var(--rows) * 100% + 5px); text-align: center; font-weight: 800; font-size: 15px; line-height: 1.1; color: var(--c, var(--dim)); text-shadow: 0 1px 2px #000c; pointer-events: none; z-index: 3; }
.pile-n em { display: block; width: max-content; margin: 0 auto 3px; padding: 2px 6px; border-radius: 99px; font-style: normal; font-size: 13px; background: var(--paper); color: var(--inkd); text-shadow: none; }
.pile.fit { cursor: pointer; background: #7fe0a026; box-shadow: inset 0 0 0 2px var(--good), 0 0 14px #7fe0a066; }
.pile.dim { opacity: .38; }
.pile.hot .slabs i:last-child { box-shadow: 0 0 0 2px var(--paper), 0 0 10px var(--paper); }
.pile.hot.bare .slabs::after { border-color: var(--paper); }
.skyline { position: absolute; left: 0; right: 0; bottom: calc(var(--nameh) + 3px + (100% - var(--nameh) - 3px) * var(--sky) / var(--rows)); border-top: 2px dashed var(--copper); pointer-events: none; z-index: 2; }
.skyline span { position: absolute; left: 2px; bottom: 2px; font-size: 11px; font-weight: 700; color: var(--copper); white-space: nowrap; text-shadow: 0 1px 2px #000; }

/* ---- the phone: a fixed skeleton that never scrolls the page (the rig's panels are 960x540 with
   no scrollbar: a control below the fold there is not a control) ---- */
.g { position: fixed; inset: 0; display: grid; grid-template-rows: auto auto auto auto minmax(0, 1fr) auto; gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; overflow: hidden; }
.g-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.g-title { font: 700 18px var(--display); color: var(--peach); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.help { flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 20px; }
.help.pulse { animation: helppulse 1.6s ease-in-out infinite; border-color: var(--peach); }
@keyframes helppulse { 50% { box-shadow: 0 0 0 6px #f2a65a55; } }
#cs-pres-slot { display: flex; justify-content: center; min-height: 0; }
.g-coach { background: var(--dusk2); border-left: 4px solid var(--peach); border-radius: 6px 12px 12px 6px; padding: 8px 12px; font-size: 15px; line-height: 1.3; min-height: 56px; display: flex; align-items: center; }
.g:not(.mine) .g-coach { border-left-color: var(--line); color: var(--dim); }
.g-plots { min-height: 0; }
.g-mine { display: grid; gap: 10px; }
.g-hand { display: flex; gap: 5px; justify-content: center; min-height: 78px; align-items: flex-end; padding-top: 10px; }
.g-none { color: var(--dim); align-self: center; }
.card { flex: 1 1 0; min-width: 0; max-width: 58px; height: 66px; padding: 0; border-radius: 9px; font: 400 30px/1 var(--body); background: var(--paper); border: 2px solid #0005; transition: transform .12s, box-shadow .12s, opacity .12s; }
.card.s-S { color: var(--Sd); } .card.s-H { color: var(--Hd); } .card.s-C { color: var(--Cd); } .card.s-D { color: var(--Dd); }
.card:disabled { opacity: 1; }
.g.mine .card:not(.can) { opacity: .45; }
.card.picked { transform: translateY(-10px); box-shadow: 0 0 0 3px var(--good), 0 8px 16px #0009; }
.g-btns { display: flex; gap: 8px; }
.g-btns button { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 6px 8px; font-size: 15px; line-height: 1.15; }
.g-btns .undo { flex: 1.5 1 0; font-size: 13.5px; }
.g-btns [hidden] { display: none; }

/* The kit's pill (table-dock.ts: "Table", or "Sound") opens the sheet with what happened, and the phone's
   sound switches. Its own spot is the bottom right corner, which is where this page keeps its buttons, so
   it is moved up beside "?" and the header keeps a gap for it (.g-pillgap). Off the top centre and the
   top right: the rig's launcher owns those on a panel. */
body.phone #cs-pill { top: max(8px, env(safe-area-inset-top)); bottom: auto; left: 60px; right: auto; height: 40px; width: 96px; padding: 0 6px;
  font-size: 13.5px; white-space: nowrap; text-align: center; }
.g-pillgap { flex: none; width: 96px; }

/* A rig panel or a phone on its side: use the width. The building site left, your hand right. Nothing a
   player presses is below the fold, and the top centre stays clear for the launcher's own strip. */
@media (min-width: 720px) and (max-height: 640px) {
  .g { max-width: none; grid-template-columns: 1.35fr 1fr; grid-template-rows: auto auto auto minmax(0, 1fr); column-gap: 16px; padding: 8px 16px 10px; }
  .g-head { grid-column: 1; grid-row: 1; } .g > .sky { grid-column: 2; grid-row: 1; }
  #cs-pres-slot { grid-column: 1 / -1; grid-row: 2; }
  .g-coach { grid-column: 2; grid-row: 3; min-height: 44px; }
  .g-plots { grid-column: 1; grid-row: 3 / 5; }
  .g-mine { grid-column: 2; grid-row: 4; align-content: center; }
  body.phone #cs-pill { left: 64px; top: 8px; }
  body.phone #toast { left: 30%; bottom: 60px; }
  .g-head .g-title { max-width: 260px; }
  .card { height: 74px; }
  .lobbyv { max-width: 900px; grid-template-columns: 1fr 1fr; align-items: start; padding: 44px 16px 10px; gap: 8px 16px; }
  .lobbyv h1 { grid-column: 1 / -1; font-size: 26px; }
  .lobbyv > div:nth-child(2) { grid-row: span 4; }
  .join { padding-top: 44px; }
}

/* ---- coach marks (table/client/coach.ts draws them; these are its classes) ---- */
.coach { position: fixed; inset: 0; z-index: 2300; color: var(--ink); -webkit-user-select: none; user-select: none; animation: cmin .18s ease-out; }
@keyframes cmin { from { opacity: 0; } to { opacity: 1; } }
.cm-svg { position: absolute; inset: 0; display: block; }
.cm-dim { fill: rgba(14, 8, 20, .84); }
.cm-ring { fill: none; stroke: var(--peach); stroke-width: 2; }
.cm-ln { stroke: var(--paper); stroke-width: 2; stroke-linecap: round; }
.cm-dot { fill: var(--peach); stroke: var(--inkd); stroke-width: 1.5; }
.cm-call { position: absolute; padding: 9px 12px 10px; border-radius: 14px; font-size: 14.5px; line-height: 1.33; background: var(--dusk2); border: 1.5px solid var(--peach); box-shadow: 0 10px 28px #000a; }
.cm-call .cm-n { float: left; width: 22px; height: 22px; margin: 0 8px 0 0; border-radius: 50%; display: grid; place-items: center; background: var(--peach); color: var(--inkd); font: 700 13px/1 var(--body); }
.cm-call .cm-t { font: 700 15.5px/22px var(--display); color: var(--paper); }
.cm-call .cm-b { margin-top: 3px; clear: both; } .cm-call .cm-b b { color: #fff; }
.cm-measure { visibility: hidden; left: -9999px; top: 0; pointer-events: none; }
.cm-none { text-align: center; }
.cm-pager { position: absolute; display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 16px; background: #150d1cf7; border: 1px solid var(--line); box-shadow: 0 8px 26px #000a; }
.cm-pager button { min-height: 44px; padding: 0 16px; font-size: 16px; border-radius: 12px; }
.cm-pager .cm-close { width: 44px; padding: 0; font-size: 26px; line-height: 1; border-radius: 50%; flex: none; }
.cm-pager .cm-count { flex: 1; text-align: center; color: var(--dim); font-weight: 700; white-space: nowrap; }
.cm-last { position: absolute; left: 8px; right: 8px; display: flex; overflow: auto; overscroll-behavior: contain; }
.cm-lastin { margin: auto; width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto; padding: 14px 16px 16px; border-radius: 18px; border: 2px solid var(--peach); background: var(--dusk2); font-size: 15px; line-height: 1.4; -webkit-user-select: text; user-select: text; }
.cm-lastin .cm-kick { text-align: center; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; color: var(--peach); }
.cm-lastin h2 { margin: 0 0 8px; text-align: center; font-size: 22px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.cm-lastin ul { margin: 0; padding-left: 1.2em; } .cm-lastin li { margin: 0 0 6px; } .cm-lastin b { color: #fff; }

/* ---- splash + help ---- */
.wrap { max-width: 860px; margin: 0 auto; padding: 28px 18px 60px; }
.hero h1 { font-size: clamp(36px, 7vw, 60px); }
.hero .mark { display: flex; align-items: flex-end; gap: 6px; height: 74px; margin-bottom: 14px; border-bottom: 3px solid #b77a5a; width: max-content; padding: 0 10px; position: relative; }
.hero .mark i { width: 26px; border-radius: 3px 3px 0 0; background: repeating-linear-gradient(to top, var(--c) 0 7px, #0006 7px 8px); }
.hero .mark::after { content: ""; position: absolute; left: -14px; right: -14px; top: 12px; border-top: 2px dashed var(--copper); }
.byline { color: var(--paper); font-weight: 700; margin: 4px 0 2px; }
.tag { font-size: 1.2em; color: var(--dim); margin: 6px 0 4px; }
.cta { display: inline-block; margin: 14px 10px 6px 0; padding: 12px 20px; border-radius: 12px; background: var(--peach); color: var(--inkd); font-weight: 800; text-decoration: none; }
.cta.alt { background: var(--dusk3); color: var(--ink); border: 1.5px solid var(--line); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 26px; }
.how div { background: var(--dusk2); border-radius: 12px; padding: 12px 14px; } .how h3 { color: var(--peach); margin-bottom: 4px; }
.rooms { margin-top: 30px; } .rooms .room { display: flex; justify-content: space-between; align-items: center; background: var(--dusk2); border-radius: 12px; padding: 10px 14px; margin: 6px 0; }
.rooms .code { font-family: var(--display); color: var(--peach); letter-spacing: 3px; font-size: 22px; }
#rejoin { display: none; background: var(--dusk2); border-left: 4px solid var(--peach); border-radius: 8px; padding: 12px 16px; margin-top: 18px; } #rejoin.show { display: block; }
footer { margin-top: 40px; color: var(--dim); font-size: .9em; }
.helppage h2 { margin: 26px 0 6px; } .helppage li { margin-bottom: 6px; } .helppage .back { text-decoration: none; font-weight: 700; }
.helppage figure { margin: 22px 0; } .helppage figure img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); display: block; }
.helppage figure.phone img { max-width: 300px; margin: 0 auto; }
.helppage figcaption { color: var(--dim); margin-top: 8px; font-size: .95em; }
.helppage table { border-collapse: collapse; margin: 8px 0; } .helppage td, .helppage th { border: 1px solid var(--line); padding: 5px 12px; text-align: center; }
