/* Encircle online: layout and look. Mobile first; wide screens get a second column for the table talk. */
:root{--paper:#FFF8F1;--paper-2:#FFF1E4;--peach:#F7D5AB;--blush:#FED2BC;--red:#FF5757;--red-deep:#E03E3C;--gold:#FFBD59;--ink:#3E1F1D;--ink-soft:#6E4A42;--line:#EACBB5;--card:#fff;
  --good:#3E8A2A;--warn:#D2402F;--display:"League Spartan","Arial Black",Helvetica,Arial,sans-serif;--text:"Figtree",Helvetica,Arial,sans-serif;
  --shadow:0 1px 2px rgba(62,31,29,.06),0 6px 20px rgba(62,31,29,.07)}
*{box-sizing:border-box}
[hidden]{display:none!important}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);font:400 16px/1.5 var(--text);-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
h1,h2{font-family:var(--display);letter-spacing:-.01em;line-height:1.1;margin:0}
h1{font-size:34px}h2{font-size:22px}
a{color:inherit}
.sub{color:var(--ink-soft);font-weight:400;font-size:14px;margin:4px 0 0}
.err{color:var(--warn);font-size:14px;margin:8px 0 0;min-height:1.2em}

/* header */
.bar{background:#1C1A1A;display:flex;align-items:center;justify-content:space-between;padding:10px 16px}
.bar img{height:32px;width:auto}
.back{color:#fff;text-decoration:none;font-weight:600;font-size:14px}
main{max-width:560px;margin:0 auto;padding:16px 16px 48px}

/* cards, buttons, inputs */
.card{background:var(--card);border:1px solid var(--line);border-radius:20px;padding:16px;margin:12px 0;box-shadow:var(--shadow)}
.lbl{margin:14px 0 8px;font:700 12px/1 var(--text);letter-spacing:.14em;text-transform:uppercase;color:var(--red-deep)}
.card>.lbl:first-child{margin-top:0}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;font:700 16px var(--text);padding:12px 18px;border-radius:999px;border:2px solid transparent;cursor:pointer;text-decoration:none;text-align:center;min-height:46px;transition:transform .08s,background .15s}
.btn:active{transform:scale(.97)}
.btn.red{background:var(--red-deep);color:#fff}
.btn.red:hover{background:#c93432}
.btn.ghost{background:transparent;color:var(--ink);border-color:var(--line)}
.btn.ghost:hover{background:var(--paper-2)}
.btn.xl{display:flex;width:100%;font-size:18px;padding:15px 18px;margin:12px 0 0}
.btn:disabled{opacity:.4;cursor:default}
.btn[aria-pressed="true"]{background:var(--peach);border-color:var(--gold)}
.btn:focus-visible,.seg button:focus-visible,summary:focus-visible,.icon:focus-visible,select:focus-visible,input:focus-visible{outline:3px solid var(--red);outline-offset:2px}
.link{background:none;border:0;color:var(--ink-soft);font:600 14px var(--text);padding:10px 4px;cursor:pointer}
.link:hover{color:var(--ink)}
.icon{width:40px;height:40px;border-radius:50%;border:2px solid var(--line);background:#fff;color:var(--ink);font:700 18px var(--display);cursor:pointer}
select,input[type=text],input:not([type]){font:600 15px var(--text);padding:11px 12px;border-radius:12px;border:2px solid var(--line);background:var(--paper);color:var(--ink);min-width:0}
.seg{display:flex;gap:8px}
.seg button{flex:1;font:700 22px var(--display);padding:11px;border-radius:14px;border:2px solid var(--line);background:var(--paper);color:var(--ink);cursor:pointer}
.seg button[aria-pressed="true"],.seg button.on{border-color:var(--red-deep);background:var(--red-deep);color:#fff}
.seg.small button{font-size:18px;padding:8px}
.opt{display:flex;gap:10px;align-items:flex-start;margin-top:12px;font-weight:600;font-size:15px}
.opt input{width:20px;height:20px;margin-top:2px;accent-color:var(--red-deep)}
.opt.speed{align-items:center;justify-content:space-between}
.dot{display:inline-block;width:14px;height:14px;border-radius:50%;border:2px solid var(--ink);vertical-align:-2px;flex:none}
.ico{width:22px;height:22px;flex:none}

/* start */
.hero{text-align:center;padding:4px 0 2px}
.word{width:min(64%,260px);height:auto;margin:6px auto}
.lede{color:var(--ink-soft);font-size:17px;margin:6px auto 12px;max-width:34em}
.modes{display:grid;gap:0}
.mode h2{margin-bottom:2px}
.seats{display:grid;gap:8px}
.seat{display:flex;align-items:center;gap:10px}
.seat .nm{font-weight:700;width:62px}
.seat select{flex:1}
.or{text-align:center;color:var(--ink-soft);font-size:14px;margin:14px 0 6px}
.join{display:flex;gap:8px}
.join input{flex:1;text-transform:uppercase;letter-spacing:.3em;text-align:center;font:700 20px var(--display)}
.row{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin:6px 0}
.opts summary,.key summary,#logbox summary{font-weight:700;cursor:pointer}

/* lobby */
.code{display:flex;gap:8px;justify-content:center;margin:8px 0 12px}
.code span{width:52px;height:64px;display:grid;place-items:center;background:var(--paper-2);border:2px solid var(--line);border-radius:14px;font:800 36px var(--display)}
.share{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}
.share .btn{flex:1 1 120px}
.lseats{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.lseats li{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line);border-radius:14px;background:var(--paper)}
.lseats .who{flex:1;min-width:0}
.lseats .who b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lseats .open{color:var(--ink-soft);font-style:italic}
.lseats select{font-size:13px;padding:8px}
.hostbar{display:grid;gap:8px;margin-top:12px}
.field{display:grid;gap:6px;margin-top:14px;font-weight:700;font-size:14px}

/* game */
.game{display:block}
.topbar{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:8px;min-height:44px}
.turn{justify-self:center;display:inline-flex;align-items:center;gap:8px;max-width:100%;font:700 18px var(--display);padding:7px 16px;border-radius:999px;background:var(--paper-2);border:2px solid var(--line);text-align:center}
.turn .sub{margin:0;font-size:13px}
.strip{display:flex;gap:8px;overflow-x:auto;padding:4px 2px 8px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.strip::-webkit-scrollbar{display:none}
@media (min-width:760px){.strip{flex-wrap:wrap;overflow:visible}}
.chip{flex:none;display:flex;align-items:center;gap:6px;padding:7px 11px;border-radius:14px;background:#fff;border:2px solid var(--line);font-size:14px;white-space:nowrap}
.chip.now{border-color:var(--ink);box-shadow:0 0 0 3px var(--gold)}
.chip.out{opacity:.5}.chip.out b{text-decoration:line-through}
.chip b{font-weight:700}
.chip .n{color:var(--ink-soft);font-weight:600}
.pact{font-size:12px;background:var(--paper-2);border:1px solid var(--line);border-radius:999px;padding:1px 8px}
.pill{font-size:12px;border-radius:999px;padding:1px 8px;background:var(--peach)}
.boardwrap{background:#fff;border:1px solid var(--line);border-radius:24px;padding:8px;box-shadow:var(--shadow)}
#board{display:block;width:100%;max-width:520px;margin:0 auto;touch-action:manipulation;user-select:none;-webkit-user-select:none}
.cell{fill:transparent;cursor:pointer;transition:fill .15s}
.cell.safe{fill:var(--paper-2);stroke:var(--ink);stroke-width:1.6}
.cell.legal{fill:rgba(244,191,106,.45)}
.cell.move{fill:rgba(244,191,106,.85)}
.cell.capture{fill:rgba(236,98,93,.55)}
.cell.pick{fill:rgba(94,35,82,.4)}
.cell.blocked{fill:rgba(62,31,29,.12);cursor:not-allowed}
.piece{transition:transform .22s ease,opacity .28s ease}
.piece .halo{fill:none;stroke:transparent;stroke-width:3}
.piece.sel .halo{stroke:var(--ink);stroke-dasharray:3 2}
.piece.danger .halo{stroke:var(--red);stroke-width:3.5;animation:pulse 1s ease-in-out infinite alternate}
@keyframes pulse{to{opacity:.35}}

.coach{margin:10px 0 4px;padding:12px 14px;border-radius:16px;border:1px solid var(--line);border-left:6px solid var(--gold);background:#fff;box-shadow:var(--shadow)}
.coach b{display:block;font:700 18px var(--display);line-height:1.2}
.coach p{margin:4px 0 0;font-size:15px;color:var(--ink-soft)}
.coach.warn{border-left-color:var(--warn);background:#FFF3F0}
.coach.good{border-left-color:var(--good);background:#F3FAF0}
.coach.wait{border-left-color:var(--line);background:var(--paper-2)}
.rule{display:flex;gap:8px;align-items:flex-start;margin-top:10px;padding:8px 10px;border-radius:10px;background:var(--paper-2);font-size:14px}
.rule span{flex:1}
.rule button{border:0;background:none;font-size:20px;line-height:1;cursor:pointer;color:var(--ink-soft)}
.msg{margin:6px 0 0;text-align:center;font-weight:600;font-size:14px;color:var(--ink-soft);min-height:20px}
.actions,.tools{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}
.actions .btn{flex:1 1 150px}
.tools .btn{flex:1 1 90px;min-height:44px;font-size:15px}
.badge{background:var(--red-deep);color:#fff;border-radius:999px;padding:0 7px;font-size:12px}
.keys{list-style:none;margin:10px 0 0;padding:0;display:grid;gap:10px;font-size:14px}
.keys li{display:flex;gap:10px;align-items:flex-start}
.sw{display:inline-block;width:22px;height:22px;border-radius:6px;border:1px solid var(--ink-soft);flex:none}
.sw.move{background:rgba(244,191,106,.85)}.sw.capture{background:rgba(236,98,93,.55)}
.sw.danger{background:#fff;border:3px solid var(--red);animation:pulse 1s ease-in-out infinite alternate}
#logList{margin:8px 0 0;padding-left:20px;font-size:14px;max-height:200px;overflow:auto}

/* table talk: a drawer on phones, a side column on wide screens */
.chat{position:fixed;left:0;right:0;bottom:0;z-index:30;margin:0;border-radius:22px 22px 0 0;max-height:82vh;display:none;flex-direction:column;gap:8px;box-shadow:0 -8px 30px rgba(62,31,29,.25)}
.chat.open{display:flex}
.chat-head{display:flex;justify-content:space-between;align-items:center}.chat-head .lbl{margin:0}
.chat-list{list-style:none;margin:0;padding:0;overflow:auto;min-height:120px;max-height:36vh;display:flex;flex-direction:column;gap:8px}
.msgb{display:flex;gap:8px;align-items:flex-start;max-width:92%}
.msgb .bub{background:var(--paper-2);border:1px solid var(--line);border-radius:4px 16px 16px 16px;padding:7px 11px;font-size:15px;line-height:1.35;min-width:0;overflow-wrap:anywhere}
.msgb .who{display:block;font-size:12px;font-weight:700;color:var(--ink-soft);margin-bottom:1px}
.msgb.me{align-self:flex-end;flex-direction:row-reverse}
.msgb.me .bub{background:#FFE9D2;border-radius:16px 4px 16px 16px}
.msgb.whisper .bub{border-style:dashed;background:#F4EEF8;border-color:#C9B3D4}
.msgb .lock{font-size:12px;color:#6a4a7a;margin-left:4px;font-weight:600}
.msgsys{align-self:center;font-size:13px;color:var(--ink-soft);background:var(--paper-2);border-radius:999px;padding:3px 12px;text-align:center}
.deal{align-self:stretch;border:2px solid var(--gold);background:#FFFBEF;border-radius:16px;padding:10px 12px;font-size:15px}
.deal b{font-family:var(--display);font-size:16px}
.deal .acts{display:flex;gap:8px;margin-top:8px}
.deal .acts .btn{flex:1;min-height:40px;font-size:15px;padding:8px}
.deal .res{margin-top:6px;font-size:13px;font-weight:700;color:var(--ink-soft)}
.deal.ok{border-color:#9CCB88;background:#F3FAF0}.deal.no{border-color:var(--line);background:var(--paper-2);opacity:.85}
.typing{margin:0;font-size:13px;color:var(--ink-soft);font-style:italic}
.signals{display:flex;gap:6px;flex-wrap:wrap}
.signals button{font:600 13px var(--text);padding:7px 11px;border-radius:999px;border:1px solid var(--line);background:var(--paper);color:var(--ink);cursor:pointer}
.signals button.pri{background:var(--gold);border-color:var(--gold)}
.pactform{display:none;gap:6px;flex-wrap:wrap;align-items:center;font-size:14px;padding:8px;border:1px dashed var(--gold);border-radius:12px}
.pactform.on{display:flex}
.pactform select{font-size:13px;padding:7px}
.chat-form{display:grid;grid-template-columns:1fr auto;gap:8px}
.chat-form select{grid-column:1/3;font-size:14px;padding:9px}
.chat-form input{font:16px var(--text)}

/* how-to-play sheet */
.backdrop{position:fixed;inset:0;background:rgba(62,31,29,.45);z-index:40}
.sheet{position:fixed;z-index:41;background:var(--paper);box-shadow:0 0 40px rgba(62,31,29,.35);overflow:auto;padding:16px;left:0;right:0;bottom:0;max-height:85vh;border-radius:22px 22px 0 0;animation:up .22s ease}
@keyframes up{from{transform:translateY(40px);opacity:0}}
.sheet-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:6px}
.sheet h2{font-size:26px}
.rules{padding-left:20px}.rules li{margin:8px 0}

/* end */
.endcard{text-align:center}
.placing{list-style:none;padding:0;font:600 19px var(--display)}
.stats{display:flex;gap:10px;margin:16px 0}
.stats div{flex:1;background:var(--paper);border:1px solid var(--line);border-radius:14px;padding:12px;text-align:center}
.stats b{display:block;font:700 28px var(--display)}.stats span{font-size:13px;color:var(--ink-soft)}
footer{max-width:560px;margin:0 auto;padding:0 16px 24px;font-size:12.5px;color:var(--ink-soft)}

@media (min-width:760px){
  main{max-width:860px}
  .modes{grid-template-columns:1fr 1fr;gap:16px}
  .modes .card{margin:12px 0}
  #lobby,#end{max-width:520px;margin-inline:auto}
}
@media (min-width:980px){
  main{max-width:1040px}
  #play .game{display:grid;grid-template-columns:minmax(0,560px) minmax(320px,1fr);gap:24px;align-items:start}
  .chat{position:sticky;top:12px;display:flex;max-height:calc(100vh - 24px);border-radius:20px;box-shadow:var(--shadow);margin-top:12px}
  .chat #chatClose{display:none}
  .chat-list{max-height:none;flex:1;min-height:260px}
  #chatToggle{display:none}
  .sheet{left:auto;top:0;right:0;bottom:0;width:420px;max-height:none;border-radius:0;animation:slide .22s ease}
  @keyframes slide{from{transform:translateX(40px);opacity:0}}
}
@media (max-width:380px){
  main{padding-inline:12px}
  .code span{width:44px;height:56px;font-size:30px}
}
@media (prefers-reduced-motion:reduce){.piece,.cell,.btn{transition:none}.piece.danger .halo,.sw.danger{animation:none}.sheet,.tip{animation:none}}

/* ---------- start screen: matches the main site (gradient hero, big lowercase title, photos) ---------- */
body.on-start{background:linear-gradient(172deg,var(--peach),var(--blush)) fixed}
body.on-start footer{display:none}
body.on-start main{padding-top:20px;padding-bottom:20px}
.kicker{font:700 13px/1.2 var(--text);letter-spacing:.14em;text-transform:uppercase;color:var(--ink-soft);margin:0}
.big{font:800 clamp(56px,13vw,92px)/.9 var(--display);letter-spacing:-.035em;margin:10px 0 12px;color:var(--ink)}
.big .dotc{color:var(--red)}
.start-copy .lede{margin:0 0 16px;color:var(--ink);max-width:28em;font-size:18px}
.photos{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.photos figure{margin:0;border-radius:22px;overflow:hidden;box-shadow:0 22px 40px -24px rgba(80,30,15,.55);aspect-ratio:4/3}
.photos img{width:100%;height:100%;object-fit:cover;display:block}
.priv{margin:14px 0 0;font-size:12.5px;color:var(--ink-soft);max-width:34em}
.startcard{margin:16px 0 0}
.resume{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--paper-2);border-radius:14px;padding:8px 8px 8px 14px;margin-bottom:12px}
.resume .btn{min-height:38px;padding:8px 16px}
.tabs{display:flex;gap:6px;background:var(--paper-2);border-radius:999px;padding:5px;margin-bottom:12px}
.tabs button{flex:1;font:700 15px var(--text);padding:10px 8px;border:0;border-radius:999px;background:transparent;color:var(--ink-soft);cursor:pointer}
.tabs button[aria-selected="true"]{background:#fff;color:var(--ink);box-shadow:0 1px 4px rgba(62,31,29,.18)}
.tabs button:focus-visible{outline:3px solid var(--red)}
.foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px;border-top:1px solid var(--line);padding-top:6px}
.foot .opts{margin:0;font-size:14px}.foot summary{font-weight:700;cursor:pointer;color:var(--ink-soft);padding:8px 4px}
.foot .opts[open]{flex-basis:100%}
.foot:has(.opts[open]){flex-wrap:wrap}
@media (min-width:900px){
  main:has(#start:not([hidden])){max-width:1120px}
  .start-grid{display:grid;grid-template-columns:1.05fr 1fr;gap:clamp(28px,5vw,64px);align-items:center;min-height:calc(100vh - 52px - 40px)}
  .startcard{margin:0;max-width:480px;justify-self:end;width:100%}
  .photos figure{aspect-ratio:auto;height:clamp(150px,26vh,230px)}
  .big{font-size:clamp(60px,7vw,88px)}
}
@media (min-width:900px) and (max-height:700px){
  .big{font-size:clamp(52px,7vw,80px);margin:6px 0 8px}
  .start-copy .lede{margin-bottom:12px;font-size:17px}
  .photos figure{height:clamp(110px,20vh,170px)}
  .startcard{padding:14px}
  .seats{gap:6px}.seat select{padding:8px 10px}
  .seg button{padding:8px}
}
@media (max-width:899px){
  .photos figure{aspect-ratio:21/9}
  .startcard{margin-top:16px}
}

/* ---------- sleeker controls (compact sizing, one place to tune) ---------- */
select{appearance:none;-webkit-appearance:none;font:600 14px var(--text);padding:8px 30px 8px 12px;min-height:38px;border:1.5px solid var(--line);border-radius:10px;
  background:var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236E4A42' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center}
input[type=text],input:not([type]){font-size:15px;padding:8px 12px;min-height:38px;border-width:1.5px;border-radius:10px}
.seg{gap:6px}
.seg button{font:700 16px var(--text);padding:0;height:36px;border-width:1.5px;border-radius:10px}
.seg.small button{height:32px;font-size:14px}
.btn{font-size:15px;padding:9px 16px;min-height:40px}
.btn.xl{font-size:16px;padding:11px 16px;min-height:44px;margin-top:14px}
.tabs{padding:4px;margin-bottom:10px}
.tabs button{font-size:14px;padding:7px 8px}
.lbl{margin:12px 0 6px;font-size:11px}
.seats{gap:6px}
.seat .nm{font-size:14px;width:56px}
.seat .dot{width:12px;height:12px}
.sub{font-size:13px}
.join input{font-size:17px;letter-spacing:.25em}
.opt{font-size:14px;margin-top:10px}
.opt input{width:17px;height:17px}
.startcard{padding:14px 16px}
.lseats select{min-height:34px;padding:6px 28px 6px 10px;font-size:13px}
.chat-form select{min-height:34px}
.signals button{font-size:12.5px;padding:6px 10px}
.icon{width:36px;height:36px;font-size:16px}
.tools .btn{min-height:40px;font-size:14px}
@media (max-width:899px){
  .seg button{height:42px}
  select,input[type=text],input:not([type]){min-height:42px}
  .btn.xl{min-height:48px}
}

/* ---------- start card: dark and gold (like the main site's story section), with slim one-line seats ---------- */
.startcard{background:#2A1714;color:#FFE9D2;border:0;box-shadow:0 24px 50px -22px rgba(30,10,5,.8);position:relative;overflow:hidden}
.startcard::after{content:"";position:absolute;right:-70px;top:-70px;width:190px;height:190px;border-radius:50%;border:2px solid rgba(255,189,89,.22);box-shadow:0 0 0 18px rgba(255,189,89,.05),0 0 0 36px rgba(255,189,89,.035);pointer-events:none}
.startcard>*{position:relative;z-index:1}
.startcard .sub{color:#d9b7a2}
.startcard .tabs{background:rgba(0,0,0,.35)}
.startcard .tabs button{color:#d9b7a2}
.startcard .tabs button[aria-selected="true"]{background:#FFE9D2;color:#2A1714;box-shadow:none}
.startcard .resume{background:rgba(255,233,210,.08)}
.startcard .resume .btn{background:var(--gold);color:#2A1714}
.btn.gold{background:var(--gold);color:#2A1714}
.btn.gold:hover{background:#ffcb78}
.startcard .head{display:flex;justify-content:space-between;align-items:center;margin:2px 0 2px}
.startcard .head b{font:700 15px var(--display);letter-spacing:.01em}
.chips{display:flex;gap:6px}
.chips button{width:36px;height:30px;border-radius:9px;border:1.5px solid rgba(255,233,210,.28);background:transparent;color:#FFE9D2;font:700 14px var(--text);cursor:pointer;padding:0}
.chips button[aria-pressed="true"]{background:var(--gold);border-color:var(--gold);color:#2A1714}
.lines{margin-top:2px}
.line{display:flex;align-items:center;gap:10px;padding:9px 0;border-bottom:1px solid rgba(255,233,210,.12)}
.line:last-child{border-bottom:0}
.line b{flex:1;font-size:14px;font-weight:700}
.line .dot{border-color:#FFE9D2}
.tog{display:inline-flex;background:rgba(0,0,0,.35);border-radius:999px;padding:3px}
.tog button{border:0;background:none;color:#d9b7a2;border-radius:999px;padding:5px 11px;font:700 12.5px var(--text);cursor:pointer}
.tog button[aria-pressed="true"]{background:#FFE9D2;color:#2A1714}
.tog button:focus-visible,.chips button:focus-visible{outline:2px solid var(--gold);outline-offset:2px}
.startcard .sum{margin:6px 0 0;text-align:center;color:#d9b7a2;font-size:13px}
.startcard .btn.xl{margin-top:12px}
.startcard .or{color:#d9b7a2}
.startcard .join input{background:rgba(0,0,0,.35);border-color:rgba(255,233,210,.25);color:#FFE9D2}
.startcard .join input::placeholder{color:#a98d7c}
.startcard .btn.ghost{color:#FFE9D2;border-color:rgba(255,233,210,.35)}
.startcard .btn.ghost:hover{background:rgba(255,233,210,.1)}
.startcard .err{color:#ff9d8f}
.startcard .foot{border-top-color:rgba(255,233,210,.15)}
.startcard .link,.startcard .foot summary{color:#d9b7a2}
.startcard .link:hover,.startcard .foot summary:hover{color:#FFE9D2}
.startcard .opt{color:#FFE9D2}
.startcard .opt select{background-color:rgba(0,0,0,.35);border-color:rgba(255,233,210,.25);color:#FFE9D2}
.startcard .opt select option{color:#2A1714}
.startcard .opt input{accent-color:var(--gold)}
@media (min-width:900px){ .startcard{padding:16px 18px} }


/* ---------- the game screen ----------
   Phones: one column (turn, players, board, coach, buttons, key, log) with the chat as a drawer.
   Desktop: no page scroll. Chat, key and controls on the left; the board fills the right. */
.stage,.side{display:contents}
.topbar{order:1}#strip{order:2}.boardwrap{order:3}#coach{order:4}#msg{order:5}.actions{order:6}.tools{order:7}.key{order:8}#logbox{order:9}
#play .game{display:flex;flex-direction:column}
.key summary{font-weight:700;cursor:pointer}
.keys .sws{display:flex;gap:8px;align-items:center;font-size:13px;color:var(--ink-soft);flex-wrap:wrap}
.keys .sws .sw{margin-left:6px}.keys .sws .sw:first-child{margin-left:0}
@media (min-width:980px){
  body.in-game main{max-width:1560px;padding:12px 20px}
  body.in-game footer{display:none}
  #play .game{display:grid;grid-template-columns:minmax(330px,420px) minmax(0,1fr);gap:20px;height:calc(100vh - 52px - 24px);min-height:520px;align-items:stretch}
  .side{display:flex;flex-direction:column;gap:8px;min-height:0;grid-column:1;grid-row:1}
  .stage{display:flex;flex-direction:column;min-height:0;grid-column:2;grid-row:1;align-items:stretch}
  .topbar,#strip,.boardwrap,#coach,#msg,.actions,.tools,.key,#logbox,#chat{order:0}
  .strip{flex-wrap:wrap;overflow:visible;padding:0;flex:none;gap:6px}
  .chip{padding:5px 9px;font-size:13px;border-radius:12px}
  .chat{position:static;display:flex;flex:1 1 0;min-height:0;max-height:none;margin:0;border-radius:20px;box-shadow:var(--shadow)}
  .chat #chatClose{display:none}
  .chat-list{flex:1 1 0;min-height:0;max-height:none}
  #chatToggle{display:none}
  .key{margin:0;padding:10px 14px;flex:none}
  .keys{gap:7px;margin-top:8px;font-size:13px}
  .tools{margin:0;flex:none}.tools .btn{min-height:38px;padding:7px 12px;flex:1 1 80px}
  #logbox{margin:0;flex:none;padding:10px 14px}
  #logList{max-height:130px}
  .topbar{flex:none}
  #helpBtn{display:none}
  .boardwrap{flex:1 1 0;min-height:0;display:flex;align-items:center;justify-content:center;padding:6px}
  #board{height:100%;width:auto;max-width:100%;max-height:100%;aspect-ratio:1/1;margin:0}
  .coach{flex:none;margin:8px 0 0;padding:9px 14px}
  .coach b{font-size:16px}.coach p{font-size:14px;margin-top:2px}
  .msg{flex:none;margin:4px 0 0}
  .actions{flex:none;margin:6px 0 0}
  .actions .btn{flex:1 1 140px}
  .sheet{width:420px}
}
@media (min-width:980px) and (max-height:760px){
  .coach p{display:none}.coach.warn p,.coach.good p{display:block}
  .keys li:nth-child(1) span,.keys li:nth-child(2) span{font-size:12.5px}
}


/* ---------- game polish: brand background, minimal chips and key, dark table-talk with the Dons' table ---------- */
body.in-game,body.in-lobby,body.on-end{background:linear-gradient(172deg,var(--peach),var(--blush)) fixed}
.topbar{order:1}#strip{order:2}.boardwrap{order:3}.tools{order:4}#coach{order:5}#msg{order:6}.actions{order:7}.key{order:8}#logbox{order:9}
.chip{padding:5px 11px;gap:7px;border-width:1.5px;font-size:13.5px}
.chip .dot{width:12px;height:12px}
.chip .pill{background:var(--gold);font-weight:700}
.key{display:flex;gap:6px 14px;flex-wrap:wrap;align-items:center;padding:8px 12px;border-radius:14px;background:rgba(255,255,255,.65);border:1px solid var(--line);font-size:12.5px;font-weight:600;color:var(--ink-soft);margin:6px 0}
.key .k{display:inline-flex;align-items:center;gap:5px}
.key .ico{width:18px;height:18px}.key .sw{width:16px;height:16px;border-radius:5px}
.boardwrap{background:#fff;box-shadow:0 18px 40px -22px rgba(80,30,15,.5)}
.tools{margin:6px 0 2px}.tools .btn{min-height:36px;padding:6px 10px;font-size:13.5px;font-weight:700}
.tools #undo{flex:0 1 auto}
.eyebrow{margin:0;font:700 12px/1.1 var(--text);letter-spacing:.14em;text-transform:uppercase;color:var(--gold)}
.chat{background:#2A1714;color:#FFE9D2;border:0;padding:0;gap:0;overflow:hidden;box-shadow:0 24px 50px -22px rgba(30,10,5,.8)}
.chat-head{background:linear-gradient(180deg,rgba(42,23,20,.35),#2A1714 96%),url("../../images/s_table.webp") center 30%/cover;padding:14px 16px 22px;min-height:84px;align-items:flex-start}
.chat-head .sub{color:#e6cdbb;margin:4px 0 0;font-size:12.5px}
.chat-head .link{color:#e6cdbb}
.chat-list,.typing,.pactform,.chat-form{margin-inline:14px}
.chat-list{margin-top:2px;padding-bottom:6px}
.typing{color:#d9b7a2}
.chat-form{margin-block:8px 14px;grid-template-columns:1fr auto auto}
.chat-form input{background:rgba(0,0,0,.35);border-color:rgba(255,233,210,.25);color:#FFE9D2}
.chat-form input::placeholder{color:#a98d7c}
.chat-form .btn{min-height:38px;padding:7px 12px}
.chat .btn.ghost{color:#FFE9D2;border-color:rgba(255,233,210,.35)}
.pactform{display:none;gap:8px;flex-wrap:wrap;align-items:center;font-size:14px;padding:10px;border:1px dashed var(--gold);border-radius:12px;margin-bottom:6px}
.pactform.on{display:flex}
.pactform select{background-color:rgba(0,0,0,.35);border-color:rgba(255,233,210,.25);color:#FFE9D2;font-size:13px;padding:6px 26px 6px 10px;min-height:32px}
.pactform select option{color:#2A1714}
.chat .sub{color:#d9b7a2}
@media (max-width:979px){.chat{padding:0;max-height:84vh}.chat-head{min-height:70px}}
@media (min-width:980px){.topbar,#strip,.boardwrap,.tools,#coach,#msg,.actions,.key,#logbox,#chat{order:0}}

/* readable text inside the dark chat */
.chat .bub,.chat .deal,.chat .msgsys{color:var(--ink)}
.chat .msgb .who{color:var(--ink-soft)}
.chat .msgsys{background:rgba(255,233,210,.14);color:#e6cdbb}
.chat .deal .res{color:var(--ink-soft)}
.tools .btn{flex:1 1 0}
.tools #undo{flex:1 1 0}

/* lobby and end: dark cards with Encircle imagery, like the start card */
.lobby,.endcard{background:#2A1714;color:#FFE9D2;border:0;box-shadow:0 24px 50px -22px rgba(30,10,5,.8);overflow:hidden}
.lobby .sub,.endcard .lede,.endcard .stats span{color:#d9b7a2}
.lobbyhead{margin:-16px -16px 14px;padding:16px;min-height:96px;background:linear-gradient(180deg,rgba(42,23,20,.35),#2A1714 96%),url("../../images/s_table.webp") center 30%/cover}
.lobbyhead .sub{margin:4px 0 0;color:#e6cdbb}
.lobby .code span{background:rgba(0,0,0,.35);border-color:rgba(255,233,210,.25);color:var(--gold)}
.lobby .lbl{color:var(--gold)}
.lobby .btn.ghost,.endcard .btn.ghost{color:#FFE9D2;border-color:rgba(255,233,210,.35)}
.lobby .btn.ghost:hover,.endcard .btn.ghost:hover{background:rgba(255,233,210,.1)}
.lobby .btn.red{background:var(--gold);color:#2A1714}
.lobby .lseats li{background:rgba(255,233,210,.07);border-color:rgba(255,233,210,.15)}
.lobby .lseats .open,.lobby .lseats .sub{color:#d9b7a2}
.lobby .lseats select,.lobby .field input{background-color:rgba(0,0,0,.35);border-color:rgba(255,233,210,.25);color:#FFE9D2}
.lobby .lseats select option{color:#2A1714}
.lobby .seg button{background:transparent;border-color:rgba(255,233,210,.28);color:#FFE9D2}
.lobby .seg button.on{background:var(--gold);border-color:var(--gold);color:#2A1714}
.lobby .opt{color:#FFE9D2}.lobby .opt input{accent-color:var(--gold)}
.lobby .link{color:#d9b7a2}
.lobby .field{color:#FFE9D2}
.endcard h1{font:800 clamp(36px,6vw,52px)/1 var(--display);letter-spacing:-.02em;margin:6px 0}
.endimg{width:100%;height:190px;object-fit:cover;object-position:center 55%;border-radius:16px;margin-bottom:14px;display:block}
.endcard .kicker{color:var(--gold)}
.endcard .stats div{background:rgba(255,233,210,.08);border-color:rgba(255,233,210,.15)}
.endcard .placing{color:#FFE9D2}
.endcard .btn.xl{margin-top:10px}


/* ---------- desktop alignment: both columns start and end on the same lines, board area is square ---------- */
.cell.safe{fill:#E6BF92;stroke:var(--ink);stroke-width:1.6}
.msgsys.move{align-self:flex-start;background:rgba(255,233,210,.1);color:#d9b7a2;font-size:12.5px;border-radius:8px;padding:2px 10px;text-align:left}
.msg:empty{display:none}
.actions:not(:has(.btn:not([hidden]))){display:none}
.tools:not(:has(.btn:not([hidden]))){display:none}
@media (min-width:980px){
  #play .game{align-items:stretch}
  .side,.stage{gap:0}
  .side>*,.stage>*{margin:0}
  .side>*+*,.stage>*+*{margin-top:8px}
  .strip{flex-wrap:nowrap;overflow:hidden;height:44px;min-height:44px;align-items:center;padding:0;gap:6px}
  .strip .chip{flex:1 1 0;min-width:0;justify-content:center;padding:5px 6px;gap:5px;font-size:12.5px}
  .strip .chip b{overflow:hidden;text-overflow:ellipsis}
  .topbar{height:44px;min-height:44px;flex:none}
  .boardwrap{flex:1 1 0;min-height:0;aspect-ratio:1/1;align-self:center;width:auto;max-width:100%;padding:8px}
  #board{width:100%;height:100%;max-height:none;aspect-ratio:auto}
  .coach{margin-top:8px}
  .key{flex:none}
}
.cell.legal{fill:rgba(255,189,89,.2)}
.cell.legal:hover{fill:rgba(255,189,89,.7)}
.cell.move:hover,.cell.capture:hover{filter:brightness(.95)}

/* ---------- desktop game layout, final: the board is a square as tall as the window; everything else stacks under the chat ---------- */
@media (min-width:980px){
  body.in-game main{max-width:1500px;padding:12px 20px}
  #play .game{display:grid;grid-template-columns:minmax(340px,430px) minmax(0,1fr);grid-template-rows:auto auto minmax(110px,1fr) auto auto auto auto auto;
    column-gap:28px;row-gap:0;height:calc(100vh - 52px - 24px);min-height:560px;align-items:stretch}
  .stage,.side{display:contents}
  .topbar,#strip,#chat,#coach,#msg,.actions,.tools,.key{grid-column:1;margin:0;order:0}
  .topbar{grid-row:1;height:44px;min-height:44px}
  #strip{grid-row:2;margin-top:2px}
  #chat{grid-row:3;margin-top:8px;min-height:0}
  #coach{grid-row:4;margin-top:8px;padding:8px 12px;border-radius:14px;box-shadow:none}
  #msg{grid-row:5;margin-top:4px;min-height:0;font-size:13px}
  .actions{grid-row:6;margin-top:8px}
  .tools{grid-row:7;margin-top:8px}
  .key{grid-row:8;margin-top:8px}
  .boardwrap{grid-column:2;grid-row:1 / -1;order:0;justify-self:center;align-self:stretch;height:100%;width:auto;aspect-ratio:1/1;max-width:100%;margin:0;padding:10px;flex:none;display:block}
  #board{width:100%;height:100%;max-height:none;aspect-ratio:auto}
  #helpBtn{display:none}
  .coach b{font-size:15px}.coach p{font-size:13px;margin-top:2px}
  .coach .rule{margin-top:6px;padding:6px 8px;font-size:12.5px}
  .actions .btn{min-height:38px;padding:6px 12px;font-size:14px}
  .tools .btn{min-height:36px}
  .turn{font-size:15px;padding:5px 12px;max-width:100%}
  .turn .sub{font-size:12px}
}
@media (min-width:980px) and (max-height:700px){
  .coach p{display:none}.coach.warn p,.coach.good p{display:block}
  #strip{height:38px;min-height:38px}
}
@media (min-width:980px){
  #play .game{min-height:0}
  .boardwrap{height:auto;width:min(100%,calc(100vh - 52px - 24px));aspect-ratio:1/1;align-self:start;justify-self:center}
}

/* ---------- final polish: no pill/menu, solid buttons, a wider left column ---------- */
.btn.solid{background:#fff;color:var(--ink);border:2px solid var(--line);box-shadow:0 2px 0 rgba(62,31,29,.14),0 6px 14px -8px rgba(62,31,29,.35);font-weight:700}
.btn.solid:hover{background:var(--paper-2)}
.btn.solid:active{box-shadow:0 0 0 rgba(0,0,0,0);transform:translateY(1px)}
.btn.solid:disabled{opacity:.45;box-shadow:none}
.btn.solid[aria-pressed="true"]{background:var(--gold);border-color:var(--gold)}
@media (min-width:980px){
  #play .game{grid-template-columns:minmax(340px,600px) minmax(0,calc(100vh - 52px - 24px));grid-template-rows:auto minmax(110px,1fr) auto auto auto auto auto;justify-content:center;column-gap:32px}
  #strip{grid-row:1;margin-top:0}
  #chat{grid-row:2}
  #coach{grid-row:3}
  #msg{grid-row:4}
  .actions{grid-row:5}
  .tools{grid-row:6}
  .key{grid-row:7}
  .boardwrap{grid-row:1 / -1}
  .tools .btn{min-height:40px;font-size:14px}
}
@media (min-width:980px){
  /* the board gets its full height first; the left column takes the rest, between 340 and 600 px */
  #play .game{grid-template-columns:clamp(340px,calc(100vw - (100vh - 76px) - 120px),600px) minmax(0,1fr);justify-content:stretch}
}

.stepper{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 12px;border:1px solid rgba(255,233,210,.15);border-radius:12px;background:rgba(255,233,210,.07);font-weight:700;font-size:14px}
.step{display:inline-flex;align-items:center;gap:10px}
.step button{width:34px;height:34px;border-radius:50%;border:1.5px solid rgba(255,233,210,.35);background:transparent;color:#FFE9D2;font:700 18px var(--text);cursor:pointer;line-height:1}
.step button:disabled{opacity:.3;cursor:default}
.step b{min-width:22px;text-align:center;font:700 18px var(--display)}
