/* Quintessential: dark laboratory wood, parchment, brass. Shared by phone, TV and splash. */
:root {
  --bg: #17100a; --panel: #251a10; --panel2: #31241a; --line: #4a3726; --ink: #f3e6c8; --dim: #b39f80;
  --gold: #e0ad4c; --gold2: #ffd27a; --ok: #7fd67f; --red: #ff6b5a;
  --F: #e04a2f; --W: #2f6fe0; --E: #3aa847; --A: #f0c02c; --Q: #f7f2e4; --X: #171419;
  --display: 'Cinzel', Georgia, serif; --serif: 'Crimson Pro', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--serif); font-size: 17px; -webkit-tap-highlight-color: transparent; }
body { background: radial-gradient(ellipse at 50% -10%, #3a2614 0%, var(--bg) 60%) fixed; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: .02em; margin: .3em 0; }
h1 { color: var(--gold2); } h2 { color: var(--gold); font-size: 1.25em; } h3 { color: var(--dim); font-size: .85em; text-transform: uppercase; letter-spacing: .12em; }
button { font: inherit; color: var(--ink); background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: .55em 1em; cursor: pointer; }
button.primary { background: linear-gradient(#e7b55a, #b8812c); color: #24160a; border-color: #f5cf86; font-weight: 700; }
button.ghost { background: transparent; }
button:disabled { opacity: .45; }
button.wide { width: 100%; margin-top: 10px; }
.dim { color: var(--dim); } .small { font-size: .85em; }
#toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #000d; color: var(--ink); padding: 10px 16px; border-radius: 12px; opacity: 0; transition: opacity .2s; z-index: 90; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }
#conn { position: fixed; top: 6px; left: 50%; transform: translateX(-50%); background: #a33; color: #fff; padding: 2px 10px; border-radius: 10px; font-size: 13px; display: none; z-index: 95; }
#conn.down { display: block; }

/* dice: a rounded square with a 3×3 pip grid */
.die { display: inline-grid; width: 34px; height: 34px; border-radius: 8px; padding: 5px; margin: 2px; vertical-align: middle;
  grid-template-areas: "p1 p2 p3" "p4 p5 p6" "p7 p8 p9"; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  box-shadow: inset 0 -3px 0 #0005, inset 0 2px 0 #fff4, 0 2px 4px #0008; position: relative; }
.die i { width: 70%; height: 70%; border-radius: 50%; place-self: center; background: #fff; box-shadow: inset 0 1px 1px #0006; }
.die.c-F { background: var(--F); } .die.c-W { background: var(--W); } .die.c-E { background: var(--E); }
.die.c-A { background: var(--A); } .die.c-A i { background: #3a2a00; }
.die.c-Q { background: var(--Q); } .die.c-Q i { background: #6b5a3a; }
.die.c-X { background: var(--X); border: 2px solid #8d5cff; } .die.c-X i { background: #b99cff; }
.die.sm { width: 24px; height: 24px; border-radius: 6px; padding: 3px; margin: 1px; }
.die.lg { width: 52px; height: 52px; border-radius: 11px; padding: 7px; }
/* a card on the table: dice sit on their flask's square in the art */
.cface { position: relative; display: inline-block; line-height: 0; vertical-align: top; }
.cface img { display: block; height: auto; }
.fs { position: absolute; width: 17%; aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; }
.fs .die, .ghostdie .die { width: 100%; height: 100%; margin: 0; padding: 12%; border-radius: 18%; }
.ghostdie { position: fixed; z-index: 90; pointer-events: none; display: grid; }
.die.sel { outline: 3px solid var(--gold2); outline-offset: 2px; transform: translateY(-4px); }
.chip { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin: 0 2px; border: 1px solid #0006; }
.chip.c-F { background: var(--F); } .chip.c-W { background: var(--W); } .chip.c-E { background: var(--E); } .chip.c-A { background: var(--A); }
.chip.c-Q { background: var(--Q); box-shadow: 0 0 6px #fff8; } .chip.c-X { background: var(--X); border-color: #8d5cff; }
.chip.c-any { background: conic-gradient(var(--F) 0 25%, var(--W) 0 50%, var(--E) 0 75%, var(--A) 0); }

.recipe { display: inline-flex; align-items: center; gap: 3px; font-size: .85em; white-space: nowrap; margin-right: 6px; }
.recipe .fl { display: inline-flex; align-items: center; }
.recipe .fl b { font-size: .8em; color: var(--dim); margin-left: -1px; }
.recipe .fl.x b { color: #ff9a5a; }
.recipe .arrow { color: var(--gold); margin: 0 2px; }
.recipe .outw { font-size: .8em; color: var(--gold2); border: 1px solid var(--line); border-radius: 6px; padding: 0 4px; }
.pv { display: inline-flex; align-items: center; gap: 2px; font-size: .9em; flex-wrap: wrap; }
.pv .ar { color: var(--dim); }
.pv.q b { color: var(--gold2); text-shadow: 0 0 8px #ffd27a88; }
.pv em { color: var(--dim); font-size: .85em; margin-left: 4px; }
.tag { display: inline-block; font-size: .78em; border-radius: 6px; padding: 0 6px; background: #4a3726; margin-right: 4px; }
.tag.go { background: #2f5d2f; color: #d9ffd9; }

/* ---------- phone ---------- */
.ph { padding: 0 10px 90px; max-width: 560px; margin: 0 auto; }
.top { position: sticky; top: 0; z-index: 20; background: #17100aee; backdrop-filter: blur(6px); margin: 0 -10px; padding: 6px 10px 4px; border-bottom: 1px solid var(--line); }
.strip { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.who { flex: 1 0 auto; min-width: 62px; border-radius: 9px; padding: 3px 7px; background: var(--panel); border-bottom: 3px solid var(--pc); font-size: .82em; display: grid; line-height: 1.15; }
.who.on { background: #4a3520; box-shadow: 0 0 0 2px var(--gold) inset; }
.who.me .nm { text-decoration: underline; text-decoration-color: var(--pc); }
.who .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96px; }
.who .wk { color: var(--pc); letter-spacing: 1px; font-size: .8em; min-height: 1em; }
.tb { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.tb .rd { flex: 1; font-family: var(--display); color: var(--gold); font-size: .9em; }
.tb .fin { color: var(--red); }
.tb .nav { padding: .3em .7em; font-size: .9em; }
.status { margin: 10px 0 6px; padding: 10px 12px; border-radius: 14px; background: var(--panel); }
.status.mine { background: linear-gradient(135deg, #4b3215, #2c1d0e); border: 1px solid var(--gold); box-shadow: 0 0 18px #e0ad4c33; }
.status .big { font-family: var(--display); font-size: 1.2em; }
.walk { margin-top: 8px; padding: 10px; border-radius: 12px; background: #1e2a3a; border: 1px solid #5a7bb0; font-size: .95em; }
.walk .wb { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.moves { display: grid; gap: 7px; margin: 8px 0 12px; }
.mv { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 14px; background: var(--panel); width: 100%; }
.mv:active { background: var(--panel2); }
.mv .lt { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 700; background: #5a4128; color: var(--gold2); }
.mv .lt.A { background: #7a2d1c; } .mv .lt.B { background: #1f4a7a; } .mv .lt.C { background: #6b5014; } .mv .lt.D { background: #3c5a2c; } .mv .lt.P, .mv .lt.S { background: #4a3a5a; }
.mv .th { width: 44px; height: 60px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.mv .mt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mv .mt b { font-weight: 700; }
.mv.keep { background: #2a2016; }
.mv.danger b { color: var(--red); }
.bids { display: flex; flex-wrap: wrap; gap: 4px; font-size: .8em; }
.bids .bs { background: #0003; border-radius: 6px; padding: 0 5px; color: var(--dim); }
.bids .bs b { color: var(--gold2); }
.nope { font-size: .85em; color: var(--dim); padding: 2px 6px; }
.seg { display: flex; gap: 4px; background: #0004; padding: 3px; border-radius: 12px; }
.seg button { flex: 1; border: 0; background: transparent; padding: .45em; font-size: .9em; }
.seg button.on { background: var(--gold); color: #24160a; font-weight: 700; }
.pool { margin: 10px 0; }
.tray { display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; border-radius: 14px; background: #0b0805; border: 1px solid var(--line); min-height: 52px; align-items: center; }
.tray .die { width: 40px; height: 40px; }
.tray.pick .die { cursor: pointer; }
.tray.small .die { width: 24px; height: 24px; padding: 3px; }
.tray.empty { color: var(--dim); font-size: .9em; }
.lab h3 .dim { text-transform: none; letter-spacing: 0; }
.labg { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.labg.sm { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.lc { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border-radius: 10px; padding: 4px; border: 1px solid #0000; position: relative; }
.lc .cface img { width: 100%; border-radius: 7px; }
.lc > .meeple { position: absolute; top: 2px; right: 2px; width: 14px; height: 17px; }
.lc .lcn { justify-content: center; text-align: center; font-size: .72em; }
.lc.k-multiforge { border-color: #6b5014; } .lc.k-pure { border-color: var(--gold); }
.lcb { min-width: 0; flex: 1; }
.lcn { font-size: .82em; font-weight: 700; line-height: 1.1; display: flex; align-items: center; gap: 4px; }
.meeple { display: inline-block; width: 12px; height: 14px; background: var(--pc); border-radius: 6px 6px 3px 3px; box-shadow: 0 0 0 1px #0008; flex: 0 0 auto; }
.feed { margin-top: 12px; }
.feed .fl1 { padding: 4px 0; border-bottom: 1px solid #ffffff10; font-size: .93em; }
.feed .fl1.mine { background: #e0ad4c14; }
.feed .rnd { font-family: var(--display); color: var(--gold); }
.undo { position: fixed; right: 12px; bottom: 84px; z-index: 30; background: #3a2a14; border-color: var(--gold); box-shadow: 0 6px 18px #000a; }
.pairs { display: grid; gap: 8px; margin: 10px 0; }
.pair { display: flex; align-items: center; gap: 6px; background: var(--panel); border-radius: 14px; padding: 8px; text-align: left; }
.pair img { width: 44px; height: 60px; object-fit: cover; border-radius: 5px; }
.pair .mt { display: flex; flex-direction: column; gap: 4px; }
.badge { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000; }
.badge.c-F { background: var(--F); } .badge.c-W { background: var(--W); } .badge.c-E { background: var(--E); } .badge.c-A { background: var(--A); }

/* sheets */
#sheet { position: fixed; inset: 0; z-index: 60; display: none; }
#sheet.open { display: block; }
#sheet.min { inset: auto 0 0 0; }
#sheet .scrim { position: absolute; inset: 0; background: #000a; }
#sheet .sh { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: #20160d; border-top: 2px solid var(--gold); border-radius: 20px 20px 0 0; padding: 14px 14px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px #000c; max-width: 560px; margin: 0 auto; display: grid; gap: 7px; }
#sheet .sh .sh { position: static; border: 0; box-shadow: none; padding: 0; max-height: none; border-radius: 0; background: none; }
#sheet.min .sh { position: static; border-radius: 16px 16px 0 0; }
.chain h2.made { display: flex; align-items: center; gap: 12px; font-size: 1.25em; margin: 0; }
.chain h2.made b { color: var(--gold2); }
.pickc { display: flex; flex-wrap: wrap; gap: 7px; }
.cb { display: inline-flex; align-items: center; gap: 6px; }
.cardhead { display: flex; gap: 12px; align-items: flex-start; }
.cardhead img { width: 96px; border-radius: 8px; }
.cardhead p { margin: .3em 0; }
.bigcard img { width: min(70vw, 300px); display: block; margin: 0 auto; border-radius: 12px; box-shadow: 0 8px 24px #000c; }
.bidtabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bidtabs.sm { grid-template-columns: repeat(6, 1fr); }
.bidtabs.sm .bt span:not(.bti) { display: none; }
.bt { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; font-size: .78em; text-align: center; }
.bt img { width: 48px; height: 64px; object-fit: cover; border-radius: 5px; }
.bidtabs.sm .bt img { width: 34px; height: 46px; }
.bt.on { border-color: var(--gold); background: #4a3520; }
.bti { font-size: 1.8em; line-height: 1.2; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.gc { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px; font-size: .85em; text-align: center; }
.gc img { width: 64px; height: 88px; object-fit: cover; border-radius: 6px; }
.gc.on { border-color: var(--gold); background: #4a3520; }
.achs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.ach { background: var(--panel); border-radius: 10px; padding: 5px; font-size: .72em; text-align: center; display: grid; gap: 2px; justify-items: center; }
.ach.own { box-shadow: inset 0 -3px 0 var(--pc); } .ach b { color: var(--pc); }
.brow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.bslot { background: var(--panel); border-radius: 10px; padding: 5px; display: grid; justify-items: center; font-size: .78em; text-align: center; gap: 2px; }
.bslot img { width: 42px; height: 58px; object-fit: cover; border-radius: 5px; }
.bslot.empty { color: var(--dim); place-items: center; }
.bb { display: inline-block; min-width: 20px; padding: 0 4px; border-radius: 6px; background: var(--pc); color: #111; font-weight: 700; margin: 1px; }
.sups { display: flex; flex-wrap: wrap; gap: 10px; } .sup { font-weight: 700; }
details { background: var(--panel); border-radius: 12px; padding: 6px 8px; margin: 4px 0; }
summary { cursor: pointer; }
.end { text-align: center; padding: 24px 6px; }
.end.won h1 { color: var(--gold2); text-shadow: 0 0 22px #ffd27a88; }
.score { width: 100%; border-collapse: collapse; margin: 12px 0; }
.score td, .score th { padding: 6px 4px; border-bottom: 1px solid #ffffff14; text-align: left; }
.score tr.win { background: #e0ad4c1c; }
.btnrow { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.vid { position: fixed; inset: 0; background: #000; z-index: 99; display: grid; place-items: center; gap: 8px; }
.vid video { width: 100%; max-height: 85vh; }
.join, .lobbyv { padding: 22px 16px; max-width: 520px; margin: 0 auto; display: grid; gap: 12px; }
.join input { font: inherit; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #0b0805; color: var(--ink); }
.seat-row { padding: 6px 0; border-bottom: 1px solid #ffffff10; display: flex; gap: 8px; align-items: center; }
.tagg { margin-left: auto; color: var(--dim); font-size: .85em; }
#cs-pill { display: none !important; }
.park { background: transparent; padding: 0; } .park summary { color: var(--dim); padding: 6px 4px; } .park .mv { margin-top: 6px; }
.tag.best { background: #6b5014; color: var(--gold2); } .tag.warn { background: #5a2a1a; color: #ffc2a8; }
.mv .mt .tag { align-self: flex-start; }

/* supply strip (top bar) and the pinned dice dock */
.supply { display: flex; align-items: center; gap: 5px; margin-top: 5px; font-size: .78em; cursor: pointer; }
.supply .sp { min-width: 26px; text-align: center; border-radius: 6px; padding: 1px 4px; font-weight: 700; color: #fff; text-shadow: 0 1px 1px #0008; }
.sp.c-F { background: var(--F); } .sp.c-W { background: var(--W); } .sp.c-E { background: var(--E); } .sp.c-A { background: var(--A); color: #3a2a00; text-shadow: none; }
.sp.c-Q { background: var(--Q); color: #4a3a1a; text-shadow: none; } .sp.c-X { background: var(--X); box-shadow: inset 0 0 0 1px #8d5cff; }
.sp.low { outline: 2px solid #ffb347; } .sp.out { opacity: .5; text-decoration: line-through; outline: 2px solid var(--red); }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: #0e0905f2; border-top: 1px solid var(--gold); padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; box-shadow: 0 -6px 16px #000a; }
.dock .dl { font-size: .75em; color: var(--dim); line-height: 1.1; text-align: center; flex: 0 0 auto; } .dock .dl b { display: block; font-size: 1.4em; color: var(--gold2); }
.dock .tray { flex: 1; padding: 2px; min-height: 0; background: none; border: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.dock .tray .die { width: 34px; height: 34px; flex: 0 0 auto; }
.dock .tray.empty { color: var(--dim); }
