:root {
  --bg: #0f1117; --bg-soft: #161923; --card: #1a1e2b; --card-hover: #212636; --line: #2a3042;
  --text: #e8eaf0; --muted: #969db4; --accent: #6ea8fe; --warm: #f0b354;
  --good: #4cc38a; --bad: #ef6461; --felt: #13261f; --felt-line: #1f3a2f;
  --cw: 62px; /* hand card width (phone) */
  --sw: 34px; /* stack card width */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.top { flex: 0 0 auto; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); box-sizing: content-box; }
.top h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.top .home { text-decoration: none; color: var(--muted); font-size: 26px; line-height: 1; padding: 0 4px 3px 0; }
.top .status { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status b { color: var(--warm); font-weight: 600; }

main { flex: 1 1 auto; min-height: 0; position: relative; }
.tab { position: absolute; inset: 0; overflow: hidden; }

/* bottom tabs (phone) */
.tabs { order: 3; flex: 0 0 auto; display: flex; border-top: 1px solid var(--line); background: var(--bg-soft); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; height: 52px; color: var(--muted); font-size: 13px; font-weight: 600; }
.tabs button.on { color: var(--text); }
.tabs .hubtab { flex: 1.3; }
.tabs .hubtab span { display: inline-block; padding: 6px 16px; border-radius: 99px; background: var(--card); }
.tabs .hubtab.on span { background: var(--accent); color: #0f1117; }

/* ---------- PLAY ---------- */
#tab-play { display: grid; grid-template-columns: 1fr; }
.board { display: flex; flex-direction: column; min-height: 0; height: 100%; padding: 8px 10px 6px; gap: 6px; background: radial-gradient(120% 80% at 50% 45%, var(--felt) 0%, var(--bg) 75%); }
.side { display: none; }

.opps { flex: 0 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.opp { position: relative; background: rgba(26,30,43,.85); border: 1px solid var(--line); border-radius: 10px; padding: 5px 6px 6px; min-width: 0; height: 104px; display: flex; flex-direction: column; transition: border-color .2s, box-shadow .2s, transform .15s; }
.opp.turn { border-color: var(--warm); box-shadow: 0 0 0 1px var(--warm) inset; }
.opp.target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); cursor: pointer; }
.opp.target:active { transform: scale(.97); }
.opp.mate { border-style: dashed; }
.opp .nm { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 4px; align-items: center; }
.opp .nm .hc { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 11px; display: flex; align-items: center; gap: 2px; }
.mini-back { width: 8px; height: 11px; border-radius: 2px; background: #22305a; border: 1px solid #3a4a7c; display: inline-block; }
.opp .tv { font-size: 11px; color: var(--muted); }
.opp .tv b { color: var(--text); font-weight: 700; }
.opp .stk { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.opp .chip { position: absolute; left: 4px; right: 4px; bottom: 4px; text-align: center; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 0; color: #0f1117; }

.center { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.piles { display: flex; gap: 14px; align-items: flex-end; justify-content: center; }
.pile { position: relative; width: 58px; text-align: center; }
.pile .lbl { font-size: 11px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.pile .slot { width: 58px; height: 81px; border-radius: 7px; border: 1.5px dashed var(--line); position: relative; }
.pile .slot > .card { position: absolute; inset: 0; width: 100%; }
.pile.can { cursor: pointer; }
.pile.can .slot { box-shadow: 0 0 0 2px var(--accent); border-radius: 7px; }
.pile .depth { position: absolute; inset: 0; border-radius: 7px; background: #22305a; transform: translate(3px, 3px); border: 1px solid #3a4a7c; }
.msg { min-height: 40px; max-width: 520px; text-align: center; font-size: 14px; color: var(--text); padding: 0 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.msg b { font-weight: 700; }
.msg .sub { color: var(--muted); font-size: 12px; display: block; }

.me { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; }
.mystack { display: flex; align-items: center; gap: 10px; height: 74px; padding: 0 2px; }
.mystack .pilebox { position: relative; height: 70px; width: 120px; flex: 0 0 auto; }
.mystack .info { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); }
.mystack .info .big { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.risk { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; padding: 2px 7px; border-radius: 99px; font-size: 12px; font-weight: 700; color: #0f1117; }

.hand { display: flex; justify-content: center; align-items: flex-end; gap: 4px; height: 128px; padding-top: 12px; }
.hand .card { width: var(--cw); transition: transform .18s ease, box-shadow .18s; cursor: pointer; }
.hand .card.sel { transform: translateY(-12px); box-shadow: 0 0 0 2.5px var(--accent), 0 8px 18px rgba(0,0,0,.5); }
.hand .card.hint { box-shadow: 0 0 0 2.5px var(--warm), 0 8px 18px rgba(0,0,0,.5); }
.hand .card.dim { filter: brightness(.55); }
.card { display: block; border-radius: 7px; aspect-ratio: 100 / 140; box-shadow: 0 2px 6px rgba(0,0,0,.45); background: #f8f3e6; user-select: none; -webkit-user-select: none; }
.card svg { width: 100%; height: 100%; display: block; }
.card.enter { animation: dealIn .35s ease-out both; }
.card.flip { animation: flipIn .35s ease-out both; }
@keyframes dealIn { from { transform: translateY(-40px) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flipIn { from { transform: rotateY(90deg); } to { transform: none; } }
.set.enter { animation: dropIn .4s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes dropIn { from { transform: translateY(-30px) scale(1.15); opacity: 0; } to { opacity: 1; } }

/* a set on a stack: mini cards, alternating cross orientation like the real table */
.empty-stack { border: 1.5px dashed var(--line); border-radius: 6px; margin: auto; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.set { position: absolute; left: 50%; top: 50%; }
.set .card { position: absolute; width: var(--sw); box-shadow: 0 1px 3px rgba(0,0,0,.6); border-radius: 4px; }
.set .cnt { position: absolute; right: -10px; top: -10px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; font-size: 10px; font-weight: 700; padding: 0 5px; z-index: 5; }

.bar { display: flex; gap: 6px; justify-content: center; align-items: center; height: 42px; }
.btn { height: 38px; padding: 0 14px; border-radius: 10px; background: var(--accent); color: #0f1117; font-weight: 700; font-size: 14px; white-space: nowrap; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.96); }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.warm { background: var(--warm); }
.btn.bad { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.q { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; padding: 0; vertical-align: 1px; }

/* overlay (battle, round end, pass the phone) */
.overlay { position: absolute; inset: 0; background: rgba(8,10,14,.72); display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 20; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; width: 100%; max-width: 440px; max-height: 100%; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.panel.pop { animation: pop .22s ease-out; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.panel h2 { margin: 0 0 4px; font-size: 18px; }
.panel .sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.fight { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 92px; flex-wrap: wrap; margin: 6px 0; }
.fight .card { width: 48px; }
.fight .vs { color: var(--muted); font-size: 12px; margin: 0 6px; }
.fight .side-l, .fight .side-r { display: flex; gap: 3px; }
.fight .card.enter { animation: slideIn .3s ease-out both; }
@keyframes slideIn { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.odds-line { text-align: center; font-weight: 700; margin: 4px 0; }
.scores { width: 100%; border-collapse: collapse; font-size: 14px; }
.scores td, .scores th { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.scores td:first-child, .scores th:first-child { text-align: left; }
.scores th { color: var(--muted); font-weight: 600; font-size: 12px; }
.meter { height: 6px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; margin-top: 3px; }
.meter i { display: block; height: 100%; background: var(--warm); border-radius: 99px; transition: width .6s ease; }

.side .sidehead, .sidehead { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 10px 0 6px; display: flex; align-items: center; gap: 6px; }
.log { list-style: none; margin: 0; padding: 0; font-size: 13px; overflow: auto; flex: 1; min-height: 0; }
.log li { padding: 4px 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.log li b { color: var(--text); font-weight: 600; }
.oddsPanel { font-size: 13px; }
.oddsPanel .o-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.oddsPanel .o-row span:last-child { font-weight: 700; }

.tip { position: fixed; z-index: 50; max-width: 290px; background: #222838; border: 1px solid var(--line); color: var(--text); font-size: 13px; padding: 10px 12px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.toast { pointer-events: none; position: fixed; left: 50%; top: calc(52px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 60; background: #222838; border: 1px solid var(--warm); color: var(--text); font-size: 13px; padding: 8px 12px; border-radius: 10px; max-width: min(92vw, 420px); text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: toastIn .2s ease-out; }
@keyframes toastIn { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- TABLE tracker ---------- */
#tab-table { display: flex; flex-direction: column; padding: 10px 12px; gap: 8px; }
.tt-head { display: flex; align-items: center; gap: 8px; }
.tt-title { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.tt-actions { margin-left: auto; display: flex; gap: 6px; }
.tt-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.tt-players { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.tt-side { flex: 0 0 auto; }
.tt-side .history { display: none; }
.pl { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.pl .nm { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pl .nm input { background: transparent; border: 0; color: var(--text); font: inherit; font-weight: 700; width: 100%; min-width: 0; padding: 0; }
.pl .tot { font-size: 12px; color: var(--muted); }
.pl .val { font-size: 20px; font-weight: 800; text-align: right; }
.pl .sets { grid-column: 1 / -1; display: flex; gap: 4px; align-items: center; min-height: 30px; overflow-x: auto; scrollbar-width: none; }
.pl .sets::-webkit-scrollbar { display: none; }
.pl .tset { flex: 0 0 auto; display: flex; align-items: center; gap: 2px; padding: 2px 5px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--line); font-size: 11px; }
.pl .tset svg { width: 18px; height: 18px; display: block; }
.pl .tset.top { border-color: var(--warm); }
.pl .acts { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; }
.pl .acts .steal { margin-left: auto; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; color: #0f1117; }
.unseen { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.unseen .u { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px 2px; text-align: center; font-size: 11px; color: var(--muted); }
.unseen .u svg { width: 22px; height: 22px; display: block; margin: 0 auto; }
.unseen .u b { color: var(--text); font-size: 13px; }
.sheet { position: absolute; inset: 0; background: rgba(8,10,14,.72); display: flex; align-items: flex-end; justify-content: center; z-index: 30; }
.sheet .panel { border-radius: 14px 14px 0 0; max-width: 520px; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pick button { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 4px 2px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.pick button svg { width: 30px; height: 30px; }
.pick button.on { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent) inset; }
.pick button b { color: var(--text); }

/* ---------- LAB / RULES / SETTINGS ---------- */
.lab, .rules, .settings { height: 100%; overflow: auto; padding: 12px; }
.lab { display: grid; grid-template-columns: 1fr; gap: 10px; align-content: start; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; }
.box h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.box .sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.heat { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.heat td, .heat th { text-align: center; padding: 6px 2px; border-radius: 6px; }
.heat th { color: var(--muted); font-weight: 600; }
.heat td { color: #0f1117; font-weight: 700; }
.bars { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.bars .b { display: grid; grid-template-columns: 92px 1fr 54px; gap: 6px; align-items: center; }
.bars .b i { display: block; height: 12px; border-radius: 4px; background: var(--accent); }
.bars .b span:last-child { text-align: right; font-weight: 700; }
.ctrl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.seg button { padding: 4px 9px; border-radius: 7px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--accent); color: #0f1117; font-weight: 700; }
.big-odds { font-size: 34px; font-weight: 800; text-align: center; margin: 4px 0; }

.rules { max-width: 900px; margin: 0 auto; }
.rules h2 { font-size: 16px; margin: 14px 0 6px; }
.rules p, .rules li { color: #cfd3de; font-size: 14px; }
.rules ul { padding-left: 18px; margin: 4px 0; }
.cardlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.cardlist .c { text-align: center; font-size: 12px; color: var(--muted); }
.cardlist .c .card { width: 64px; margin: 0 auto 3px; }
.cardlist .c b { color: var(--text); }

.settings { max-width: 640px; margin: 0 auto; }
.setrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; min-height: 48px; }
.setrow .lab2 { flex: 1; display: flex; align-items: center; gap: 6px; }
.setrow select, .setrow input[type=text] { background-color: var(--bg-soft); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 14px; }
.switch { width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--good); }
.switch.on::after { transform: translateX(18px); }
.switch.off-dis { opacity: .35; pointer-events: none; }
.seats { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.seat { display: flex; gap: 6px; align-items: center; }
.seat input { flex: 1; min-width: 0; }

/* ---------- laptop ---------- */
@media (min-width: 900px) {
  :root { --cw: 110px; --sw: 46px; }
  #app { max-width: 1400px; margin: 0 auto; width: 100%; }
  .tabs { order: 0; border-top: 0; border-bottom: 1px solid var(--line); background: transparent; justify-content: flex-start; padding: 0 12px; }
  .tabs button { flex: 0 0 auto; height: 40px; padding: 0 16px; }
  .tabs .hubtab { flex: 0 0 auto; }
  #tab-play { grid-template-columns: 1fr 300px; }
  .side { display: flex; flex-direction: column; border-left: 1px solid var(--line); padding: 0 14px 12px; min-height: 0; }
  .board { padding: 12px 18px 10px; gap: 10px; }
  .opp { height: 150px; padding: 7px 9px; }
  .opp .nm { font-size: 14px; }
  .opp .tv { font-size: 12px; }
  .pile, .pile .slot { width: 100px; }
  .pile .slot { height: 140px; }
  .piles { gap: 22px; }
  .mystack { height: 96px; }
  .mystack .pilebox { height: 92px; width: 150px; }
  .mystack .info .big { font-size: 26px; }
  .msg { font-size: 16px; }
  .hand { gap: 10px; height: 172px; }
  .bar { height: 48px; }
  .btn { height: 42px; padding: 0 18px; }
  .fight .card { width: 64px; }
  .lab { grid-template-columns: 1fr 1fr; padding: 16px; }
  .tt-grid { flex-direction: row; }
  .tt-side { flex: 0 0 320px; overflow: auto; }
  .tt-side .history { display: block; }
  .pick { grid-template-columns: repeat(6, 1fr); }
}
@media (max-height: 640px) and (max-width: 899px) { :root { --cw: 56px; } .opp { height: 96px; } }
/* online rooms */
.panel .code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .12em; color: var(--warm); font-size: 1.25em; }
.setrow #netCode { width: 84px; text-transform: uppercase; letter-spacing: .1em; font-family: ui-monospace, Menlo, monospace; }
.setrow #netName { width: 140px; }
.setrow input[type=text] { font-size: 16px; }
/* form controls: same dark look in Safari (WebKit ignores colours on native selects) */
select, input[type=text], input[type=number] { -webkit-appearance: none; appearance: none; background-color: var(--bg-soft); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 16px; }
select { padding-right: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23969db4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.setrow:has(#netNote:empty) { display: none; }
.opp .nm > span:first-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.opp .nm .hc { flex: 0 0 auto; }
.hand { min-width: 0; max-width: 100%; }

/* ---------- design pass 2026-10-20 ---------- */
/* tab bar: the active tab reads clearly; the Play pill is only filled when it is on */
.tabs button { transition: color .15s; }
.tabs button.on { color: var(--accent); }
.tabs .hubtab span { background: transparent; box-shadow: inset 0 0 0 1px var(--line); transition: background .15s, color .15s; }
.tabs .hubtab.on span { box-shadow: none; }
.tabs .hubtab.on { color: #0f1117; }

/* tap targets >= 40px without changing the look */
.btn { height: 42px; }
.btn.sm { height: 36px; }
.q { position: relative; }
.q::after { content: ""; position: absolute; inset: -11px; }
.seg button { padding: 8px 12px; }

/* centre table: piles a bit larger, the message never collapses */
.center { justify-content: space-evenly; }
.pile, .pile .slot { width: 64px; }
.pile .slot { height: 90px; }
.pile .lbl { font-size: 12px; }
.msg { min-height: 34px; transition: color .2s; }
.msg.mine { color: var(--warm); font-weight: 700; font-size: 17px; }
.msg.mine .sub { font-weight: 400; }

/* your own area lights up on your turn, like an opponent's box */
.mystack { border-radius: 12px; transition: box-shadow .25s, background .25s; }
.mystack.turn { box-shadow: 0 0 0 1px var(--warm) inset; background: rgba(240,179,84,.06); }
.mystack .pilebox { width: 110px; margin-left: 8px; }
.mystack .pilebox.target { cursor: pointer; border-radius: 10px; box-shadow: 0 0 0 2px var(--accent); }
.risk .q { color: #0f1117; border-color: rgba(15,17,23,.45); }

/* opponent boxes: stacks bigger, money first */
.opp .tv b { font-size: 13px; }
.opp.turn .nm > span:first-child { color: var(--warm); }

/* challenge: attacker and defender in labelled lanes */
.fight.duel { flex-wrap: nowrap; align-items: flex-end; gap: 10px; }
.fight .lane { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.fight .lane .who { font-size: 12px; color: var(--muted); font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fight .vs { align-self: center; text-transform: uppercase; font-weight: 800; letter-spacing: .08em; color: var(--warm); margin: 0 2px 18px; }
.fight .slot0 { display: block; width: 48px; aspect-ratio: 100 / 140; border-radius: 7px; border: 1.5px dashed var(--line); }
.fight .side-l, .fight .side-r { flex-wrap: wrap; justify-content: center; }
.overlay[data-kind="battle"], .overlay[data-kind="offer"] { align-items: flex-start; }

/* table tracker rows: three short lines instead of four */
.pl { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nm val" "tot val" "sets acts"; padding: 7px 10px; gap: 2px 10px; }
.pl > div:empty { display: none; }
.pl .nm { grid-area: nm; } .pl .val { grid-area: val; align-self: center; } .pl .tot { grid-area: tot; }
.pl .sets { grid-area: sets; min-height: 36px; }
.pl .acts { grid-area: acts; grid-column: auto; justify-content: flex-end; flex-wrap: wrap; }
.pl .acts .steal { margin-left: 0; }
@media (max-width: 899px) { .tt-side .sidehead:has(+ .history) { display: none; } }

/* still-hidden counts in one row on the phone */
@media (max-width: 899px) { .unseen { grid-template-columns: repeat(12, 1fr); gap: 3px; } .unseen .u { padding: 3px 0; border-radius: 6px; } .unseen .u svg { width: 18px; height: 18px; } .unseen .u b { font-size: 12px; } }
/* lab: labels on one line */
.bars .b { grid-template-columns: 118px 1fr 46px; }
.bars .b span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* settings: breathing room under Start new game */
.settings .row { margin-bottom: 6px; }
.setrow select[data-set="players"] { width: 64px; }

@media (min-width: 900px) {
  :root { --sw: 58px; }
  .tabs button.on:not(.hubtab) { box-shadow: inset 0 -2px 0 var(--accent); }
  .board { gap: 12px; }
  .opp { height: 170px; }
  .opp .tv b { font-size: 15px; }
  .pile, .pile .slot { width: 116px; }
  .pile .slot { height: 162px; }
  .piles { gap: 26px; }
  .msg.mine { font-size: 20px; }
  .me { width: 100%; max-width: 820px; margin: 0 auto; }
  .mystack { height: 120px; justify-content: center; padding: 0 12px; }
  .mystack .pilebox { height: 112px; width: 170px; }
  .mystack .info { flex: 0 1 auto; }
  .mystack .info .big { font-size: 30px; }
  .hand { height: 200px; gap: 12px; }
  .panel { max-width: 560px; }
  .fight .card, .fight .slot0 { width: 84px; }
  .fight .lane .who { font-size: 13px; }
  .overlay[data-kind="battle"], .overlay[data-kind="offer"] { align-items: center; }
  .tt-players { display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
  .tt-players > .row { grid-column: 1 / -1; }
  #ttPlayers .row select { font-size: 13px; height: 36px; }
  .settings { max-width: 1100px; }
  .scols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; align-items: start; }
}
@media (max-height: 640px) and (max-width: 899px) { .pile, .pile .slot { width: 58px; } .pile .slot { height: 81px; } }
/* shorter laptop screens (e.g. 1280x720): keep the whole table on screen */
@media (min-width: 900px) and (max-height: 819px) {
  .board { padding: 8px 18px 6px; gap: 6px; }
  .opp { height: 120px; }
  .pile, .pile .slot { width: 80px; }
  .pile .slot { height: 112px; }
  .mystack { height: 92px; }
  .mystack .pilebox { height: 88px; }
  .hand { height: 150px; }
}

/* Sound & effects rows (js/fx.js) drawn like the other settings rows */
.fx-set .fx-row { padding: 10px 0; border-top: 0; border-bottom: 1px solid var(--line); font-size: 14px; min-height: 48px; }
.fx-set .switch span { display: none; }
.fx-set .seg button[aria-pressed="true"] { background: var(--accent); color: #0f1117; font-weight: 700; }
.fx-set .fx-why { padding: 6px 0; border-bottom: 1px solid var(--line); }

/* ---------- real table look (2026-10-20): wood kitchen table, poker-size cards, criss-cross stacks ---------- */
/* the kit (css/table.css, js/table.js) is a byte copy of Board and Card Games/_table: never edit it here */
.board.tbl-surface {
  --muted: rgba(246, 236, 214, .74); --text: #f7f0e1;
  background-color: var(--tbl-base);
  background-image: radial-gradient(ellipse 120% 95% at 50% 42%, transparent 52%, var(--tbl-vig) 100%), radial-gradient(ellipse 70% 55% at 50% 38%, var(--tbl-light), transparent 75%), var(--tbl-tex);
  background-size: 100% 100%, 100% 100%, var(--tbl-tex-size);
}
.card.tbl-card { aspect-ratio: 63 / 88; border: 0; background: #fbf7ee; border-radius: calc(var(--card-w, 60px) * .075); overflow: hidden;
  box-shadow: 0 1px 1px rgba(0,0,0,.35), 0 3px 7px rgba(0,0,0,.3); }
.card.tbl-card svg { height: 100%; }
.set .card.tbl-card { border-radius: calc(var(--card-w, 30px) * .075); box-shadow: 0 1px 1px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.35); }
.set .cnt { background: #1b1b1f; color: #fff; border: 0; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.empty-stack.tbl-spot { position: absolute; inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); aspect-ratio: 63 / 88; height: auto; margin: 0; }

/* opponents: seats round the far edge, each with a name plate, their fanned backs and their stack */
.opps { gap: 4px; align-items: start; }
.opp { background: none; border: 0; border-radius: 14px; padding: 2px 2px 3px; height: 116px; align-items: center; justify-content: flex-start; gap: 1px; }
.opp.turn { border: 0; box-shadow: none; background: radial-gradient(closest-side, rgba(255, 214, 140, .2), transparent); }
.opp.turn .tbl-plate { border-color: #f0c35a; color: #ffd98a; box-shadow: 0 0 0 2px rgba(240,195,90,.45), 0 2px 4px rgba(0,0,0,.4); }
.opp.target { border: 0; box-shadow: 0 0 0 2px var(--accent); background: rgba(110, 168, 254, .12); }
.opp.mate .tbl-plate { border-style: dashed; }
.opp .ohand { flex: 0 0 auto; display: flex; justify-content: center; min-height: 22px; }
.ofan { position: relative; }
.ofan > .card { position: absolute; left: 0; bottom: 0; transform-origin: 50% 100%; box-shadow: 0 1px 2px rgba(0,0,0,.45); }
.opp .stk { flex: 1 1 auto; width: 100%; }
.opp .nm { flex: 0 0 auto; max-width: 100%; justify-content: center; gap: 5px; font-size: 11px; }
.opp .nm .tbl-plate { flex: 0 1 auto; min-width: 0; font-size: 11px; line-height: 16px; padding: 1px 6px; }
.opp .nm .tv { font-size: 12px; font-weight: 800; color: #f7e7c0; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.opp .otop { display: none; }
.opp .chip { bottom: 22px; left: 50%; right: auto; transform: translateX(-50%); padding: 1px 8px; white-space: nowrap; z-index: 9; box-shadow: 0 2px 4px rgba(0,0,0,.4); }

/* middle of the table: the draw pile as a real stack, the discard as a messy face-up pile */
.piles { gap: 22px; align-items: center; }
.pile .slot { border: 0; height: auto; aspect-ratio: 63 / 88; --card-w: 64px; border-radius: calc(var(--card-w) * .075); }
.pile .slot.tbl-spot { border: 2px dashed rgba(255, 255, 255, .3); background: rgba(0, 0, 0, .1); }
.pile .slot > .card { height: auto; }
.pile .tbl-deck > .tbl-back { position: absolute; inset: 0; transform: translateY(var(--tbl-rise, 0)); background: #1b2a4e; }
.pile .tbl-pile > .card { transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg)); }
.pile .tbl-badge { z-index: 6; }
.pile .lbl { color: var(--muted); }
.pile.can .slot { box-shadow: 0 0 0 3px var(--accent); }

/* your own place: the stack in front of you, no box round it */
.mystack, .mystack.turn { box-shadow: none; }
.mystack { background: none; }
.mystack.turn { background: radial-gradient(closest-side at 50% 50%, rgba(255, 210, 130, .2), transparent 72%); }
.mystack .info .big { text-shadow: 0 1px 3px rgba(0,0,0,.5); }

/* your hand: held as a fan along the bottom edge */
.hand { position: relative; display: block; height: 140px; padding: 0; gap: 0; }
.hand .card { position: absolute; left: 0; bottom: 2px; width: var(--cw); transform-origin: 50% 100%;
  transform: translate(var(--x, 0), calc(var(--y, 0px) - var(--up, 0px))) rotate(var(--r, 0deg));
  box-shadow: -2px 2px 6px rgba(0,0,0,.35), 0 1px 1px rgba(0,0,0,.3); }
.hand .card.sel { --up: 16px; transform: translate(var(--x, 0), calc(var(--y, 0px) - var(--up, 0px))) rotate(var(--r, 0deg)); box-shadow: 0 0 0 2.5px var(--accent), 0 12px 22px rgba(0,0,0,.45); }
.hand .card.hint { box-shadow: 0 0 0 2.5px var(--warm), 0 8px 18px rgba(0,0,0,.45); }
.hand .card.enter { animation: handIn .35s ease-out both; }
@keyframes handIn { from { translate: 0 -40px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
/* turning a card face up: a 3-D turn on its own axis (keeps its place in the fan or pile) */
.hand .card.flip, .pile .tbl-pile > .card.flip { animation: turnUp .34s ease-out both; }
@keyframes turnUp { from { rotate: y 90deg; } to { rotate: y 0deg; } }

/* challenges are fought on the table; the round totals go on a paper score pad */
.overlay[data-kind="battle"], .overlay[data-kind="offer"] { background: rgba(12, 7, 2, .38); backdrop-filter: none; -webkit-backdrop-filter: none; }
.panel.mat { --muted: rgba(246, 236, 214, .78); background-color: var(--tbl-base); color: #f7f0e1; border: 1px solid rgba(0,0,0,.45);
  background-image: radial-gradient(ellipse 120% 95% at 50% 42%, transparent 52%, var(--tbl-vig) 100%), radial-gradient(ellipse 70% 55% at 50% 38%, var(--tbl-light), transparent 75%), var(--tbl-tex);
  background-size: 100% 100%, 100% 100%, var(--tbl-tex-size); box-shadow: 0 14px 40px rgba(0,0,0,.6); }
.panel.mat .fight .card { --card-w: 48px; }
.panel.mat .fight .slot0 { aspect-ratio: 63 / 88; border-color: rgba(255,255,255,.35); }
.panel.mat .fight .side-r .card:nth-child(2n) { transform: rotate(4deg); }
.panel.mat .fight .side-l .card:nth-child(2n) { transform: rotate(-4deg); }
.panel.mat .fight .lane .who, .panel.mat .sub { color: var(--muted); }
.panel.mat .btn.ghost { background: rgba(20, 12, 4, .55); border-color: rgba(255,255,255,.18); color: #f7f0e1; }
.panel.scorepad { color: #2a2418; border: 0; border-top: 12px solid #b83a33; border-radius: 4px 4px 6px 6px; max-width: 420px;
  background: #fbf6e4;
  box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 16px 40px rgba(0,0,0,.55); }
.panel.scorepad h2 { font-family: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", cursive; font-size: 22px; color: #1f2c55; }
.panel.scorepad .sub, .panel.scorepad .scores th { color: #6d6250; }
.panel.scorepad .scores td, .panel.scorepad .scores th { border-bottom-color: rgba(70, 110, 170, .32); }
.panel.scorepad .scores td b { color: #1f2c55; font-family: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Comic Sans MS", cursive; }
.panel.scorepad .meter { background: rgba(0, 0, 0, .08); }
.panel.scorepad .btn.ghost { background: #efe7d0; color: #2a2418; border-color: #d6ccb4; }

@media (max-height: 640px) and (max-width: 899px) { .opp { height: 104px; } .pile .slot { --card-w: 58px; } .hand { height: 128px; } }
/* small phones (iPhone SE size) */
@media (max-height: 600px) and (max-width: 899px) and (orientation: portrait) {
  .board { gap: 4px; padding-top: 4px; }
  .opp { height: 92px; }
  .pile .slot { --card-w: 50px; }
  .pile, .pile .slot { width: 50px; }
  .msg { min-height: 22px; font-size: 13px; }
  .msg.mine { font-size: 15px; }
  .mystack { height: 62px; }
  .mystack .pilebox { height: 60px; }
  .hand { height: 116px; }
  .bar { height: 40px; }
}
/* phone turned sideways: your stack beside the piles, hand and buttons below */
@media (max-height: 460px) and (max-width: 899px) and (orientation: landscape) {
  .board { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-areas: "opps opps" "stack center" "hand hand" "bar bar"; gap: 3px 8px; padding: 4px 10px 2px; }
  .me { display: contents; }
  .opps { grid-area: opps; }
  .opp { height: 74px; }
  .opp .ohand { min-height: 16px; }
  .center { grid-area: center; flex-direction: row; gap: 8px; justify-content: flex-start; }
  .piles { gap: 14px; }
  .pile .slot { --card-w: 40px; }
  .pile, .pile .slot { width: 40px; }
  .msg { min-height: 0; font-size: 13px; }
  .msg.mine { font-size: 15px; }
  .mystack { grid-area: stack; height: 60px; justify-content: flex-end; }
  .mystack .pilebox { height: 58px; }
  .hand { grid-area: hand; height: 92px; }
  .bar { grid-area: bar; height: 40px; }
}
@media (min-width: 900px) {
  .opps { padding: 0 10px; gap: 14px; }
  .opp { height: 178px; transform: translateY(var(--oy, 0)) rotate(var(--or, 0deg)); }
  .opp .ohand { min-height: 40px; }
  .opp .nm, .opp .nm .tbl-plate { font-size: 13px; }
  .opp .nm .tv { font-size: 15px; }
  .opp .otop { display: inline; font-size: 12px; color: var(--muted); white-space: nowrap; }
  .opp .chip { bottom: 30px; font-size: 12px; }
  .pile .slot { --card-w: 116px; }
  .piles { gap: 40px; }
  .hand { height: 196px; }
  .panel.mat .fight .card { --card-w: 84px; }
}
@media (min-width: 900px) and (max-height: 819px) {
  .opp { height: 132px; }
  .opp .ohand { min-height: 30px; }
  .pile .slot { --card-w: 80px; }
  .hand { height: 156px; }
}

/* edge pass (2026-10-20) */
/* 5-6 players on a phone: the name gets its own line above the money so it can be read */
.opps.tight .opp .nm { flex-direction: column; gap: 0; width: 100%; }
.opps.tight .opp .nm .tbl-plate { max-width: 100%; padding: 1px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opps.tight .opp .nm .tv { font-size: 11px; line-height: 14px; }
.opps.tight .opp .chip { bottom: 34px; }
/* pass screen on a shared phone: the next person's cards wait face down */
.hand .handback { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); }
.hand .handback .card { position: absolute; left: 0; bottom: 0; transform-origin: 50% 100%; }

/* ---------- visibility pass (2026-10-21): the table fills the screen, stacks as big as their seats ---------- */
/* opponents' seats take all the height the rest of the table leaves; js sizes the towers to fit (towerW) */
.opps { flex: 1 1 auto; min-height: 104px; align-items: stretch; }
.opp, .opps.tight .opp { height: auto; min-height: 0; }
.center { flex: 0 0 auto; }
.opp .stk { min-height: 30px; }
.opp .stk .chip, .opps.tight .opp .stk .chip { bottom: 2px; }
.opp .nm .vals { display: inline-flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 0 5px; min-width: 0; }
/* the top set's value (what a challenge wins) is readable on every screen */
.opp .otop { display: inline; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.opps.tight .opp .nm .tv { font-size: 12px; }
@media (max-width: 899px) {
  .opp .nm { flex-direction: column; gap: 1px; width: 100%; }
  .opp .nm .tbl-plate { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .opp .nm .vals { line-height: 15px; }
  /* phone upright: the message sits beside the deck and discard, not in a row of its own */
  .center:not(.drafting) { flex-direction: row; justify-content: center; gap: 14px; padding: 2px 0; }
  .center:not(.drafting) .msg { flex: 0 1 190px; min-height: 0; }
  .center:not(.drafting) .piles { flex: 0 0 auto; }
  .mystack .pilebox { width: 96px; height: 100%; }
}
/* challenges and draft offers in a short space: the set and the fight side by side, smaller cards */
.panel.mat.compact { display: grid; grid-template-columns: auto auto; justify-content: center; column-gap: 16px; padding: 10px 12px; }
.panel.mat.compact > :not(.fight) { grid-column: 1 / -1; }
.panel.mat.compact h2 { font-size: 16px; margin-bottom: 2px; }
.panel.mat.compact .sub { margin-bottom: 4px; }
.panel.mat.compact .fight { min-height: 0; margin: 2px 0; }
.panel.mat.compact .fight .card, .panel.mat.compact .fight .slot0 { width: 42px; --card-w: 42px; }
.panel.mat.compact .row { margin-top: 6px; }
.panel.mat.compact .fight .side-l, .panel.mat.compact .fight .side-r { flex-wrap: nowrap; gap: 0; }
.panel.mat.compact .fight .card + .card { margin-left: -18px; }
.panel.mat.compact .odds-line { margin: 2px 0; font-size: 14px; }
/* laptop: your stack sits beside your hand (front of you), so the far seats get that height */
@media (min-width: 900px) {
  .opp { height: auto; }
  .opp .nm { flex-wrap: nowrap; }
  .opps.tight .opp .nm { flex-direction: column; gap: 2px; width: 100%; }
  .opps.tight .opp .nm .tbl-plate { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .opps.tight .opp .nm .tv { font-size: 15px; }
  .opp .otop { font-size: 13px; }
  .me { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "stack hand" "stack bar"; column-gap: 18px; max-width: 1040px; }
  .mystack { grid-area: stack; flex-direction: column; justify-content: flex-end; align-items: center; height: auto; gap: 4px; padding: 0 6px 6px; }
  .mystack .pilebox { width: 190px; height: 160px; margin: 0; }
  .mystack .info { text-align: center; }
  .hand { grid-area: hand; }
  .bar { grid-area: bar; }
}
@media (min-width: 900px) and (max-height: 819px) {
  .mystack .pilebox { width: 170px; height: 128px; }
  .mystack .info .big { font-size: 26px; }
}
/* phone turned sideways: the buttons sit beside the hand so the seats get the height */
@media (max-height: 460px) and (max-width: 899px) and (orientation: landscape) {
  .board { grid-template-rows: minmax(0, 1fr) auto auto; grid-template-areas: "opps opps" "stack center" "hand bar"; }
  .opps { min-height: 0; }
  .opp .nm, .opps.tight .opp .nm { gap: 0; }
  .hand { height: 104px; }
  .center:not(.drafting) .msg { flex: 1 1 auto; }
  .mystack .pilebox { width: 84px; }
  .bar { flex-wrap: wrap; height: auto; align-content: center; }
}
.opp { justify-content: flex-end; }
/* phone upright with room: deck and discard a size up so the discard's value reads */
@media (max-width: 899px) and (min-height: 641px) and (orientation: portrait) {
  .center:not(.drafting) .pile, .center:not(.drafting) .pile .slot { width: 76px; }
  .center:not(.drafting) .pile .slot { --card-w: 76px; }
}
/* 6 players on the smallest phones: long names still fit their seat */
@media (max-width: 359px) {
  .opps.tight .opp { padding-left: 0; padding-right: 0; }
  .opps.tight .opp .nm .tbl-plate { font-size: 10px; padding: 1px 2px; letter-spacing: -.02em; }
}
