:root {
  --bg: #14112a; --bg2: #1d1938; --panel: #262046; --line: #3a3366;
  --text: #f2eefc; --dim: #a59fc7; --gold: #f2c14e; --red: #e5484d; --green: #46c37b;
  --magic: #8b5cf6; --brute: #e8642c; --cunning: #2fa36b; --royal: #f2c14e;
  --font: Inter, system-ui, sans-serif; --display: Cinzel, serif;
  --on-gold: #2a1d00; --glow1: #f2c14ecc; --glow2: #f2c14e33;
  --card: #fbf8f1; --card-fg: #1e1e1e; --card-line: #d8d2c4;
  --pc1: #221d40; --pc2: #1a1633; --well: #0e0b1e;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.35 var(--font); }
body { min-height: 100dvh; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
#app { max-width: 560px; margin: 0 auto; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); }
#app:has(.tray) { padding-bottom: 0; }

/* ---------- lobby ---------- */
.lobby { padding-top: 6vh; text-align: center; }
.logo { font-family: var(--display); font-weight: 900; font-size: 44px; letter-spacing: 1px; margin: 0;
  background: linear-gradient(180deg, #ffe08a, #e29a2d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tag { color: var(--dim); margin: 4px 0 28px; }
.suits { font-size: 22px; letter-spacing: 10px; margin-bottom: 18px; }
.suits .r { color: var(--red); }
.toplinks { margin: -6px 0 14px; }
.toplinks .link { margin-top: 0; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin: 12px 0; text-align: left; }
.box h3 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; font-size: 16px; }
input.code { text-transform: uppercase; letter-spacing: 6px; font-weight: 800; text-align: center; }
.btn { display: block; width: 100%; padding: 13px; border-radius: 12px; border: 0; background: var(--gold); color: var(--on-gold); font-weight: 800; margin-top: 10px; }
.btn.alt { background: #3a3366; color: var(--text); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--dim); }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 8px; } .row > * { flex: 1; }
.link { background: none; border: 0; color: var(--dim); text-decoration: underline; margin-top: 14px; }
.bigcode { font-family: var(--display); font-size: 52px; font-weight: 900; letter-spacing: 10px; color: var(--gold); text-align: center; margin: 6px 0; }
.status { background: #3b2a12; border: 1px solid #7a5a20; color: #ffd99a; padding: 8px 12px; border-radius: 10px; margin: 6px 0; font-size: 13px; }
.muted { color: var(--dim); font-size: 13px; }

/* ---------- board ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: stretch; gap: 6px; padding: 6px 0 8px; background: var(--bg); }
.who { flex: 1; min-width: 0; padding: 6px 10px; border-radius: 12px; background: var(--panel); border: 2px solid var(--line); color: var(--dim); }
.who b { display: block; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { font-size: 11px; }
.who.on { background: var(--gold); border-color: #fff2c4; color: #4a3500; box-shadow: 0 0 14px #f2c14e88; }
.who.on b { color: var(--on-gold); } .who.on small { font-weight: 800; }
.vs { align-self: center; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.topbar .menu { margin: 0; text-decoration: none; font-size: 20px; padding: 0 4px; }
.side { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; padding: 8px; }
.side.opp { margin-bottom: 8px; background: #2a1626; border-color: #8a3a4c; }
.side.mine { background: #14233d; border-color: #3d78b8; }
.tag { font-style: normal; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; padding: 2px 7px; border-radius: 99px; margin-right: 6px; }
.side.opp .tag { background: #8a3a4c; color: #ffe1e6; } .side.mine .tag { background: #3d78b8; color: #e6f2ff; }
.side.opp .bench-label { color: #e6a3b0; } .side.mine .bench-label { color: #9cc7f2; }
.side .bench { border-radius: 10px; padding: 5px; }
.side.opp .bench { background: #3a1c30; } .side.mine .bench { background: #1b3152; }
.sidehead { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); margin: 0 2px 6px; }
.sidehead b { color: var(--text); font-size: 13px; }
.arena-row { display: flex; gap: 8px; align-items: stretch; }
.bench { display: flex; gap: 6px; flex-wrap: wrap; align-content: flex-start; flex: 1; }
.bench-label, .ko-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); width: 100%; }

/* player card */
.pc { position: relative; border-radius: 12px; background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 30%, var(--pc1)), var(--pc2) 70%);
  border: 2px solid var(--cc); padding: 6px; cursor: pointer; overflow: hidden; }
.pc.magic { --cc: var(--magic); } .pc.brute { --cc: var(--brute); } .pc.cunning { --cc: var(--cunning); } .pc.royal { --cc: var(--royal); }
.pc.big { width: 168px; flex: none; min-height: 196px; }
.pc.small { width: 70px; min-height: 86px; padding: 4px; border-width: 1.5px; }
.pc.ko { filter: grayscale(1); opacity: .35; }
.pc .ic { font-size: 30px; text-align: center; line-height: 1.1; margin: 2px 0 0; }
.pc.small .ic { font-size: 22px; }
.pc .nm { font-weight: 800; font-size: 13px; line-height: 1.1; }
.pc.small .nm { font-size: 10px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc .meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); margin: 2px 0 3px; }
/* drawn as one gradient on the bar itself, so nothing inside it can fail to render */
.hpbar { --c: var(--green); height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--c) 0, var(--c) var(--w, 0%), var(--well) var(--w, 0%), var(--well) 100%); border: 1px solid #ffffff22; }
.hpbar.mid { --c: var(--gold); } .hpbar.low { --c: var(--red); }
.hptxt { font-size: 11px; font-weight: 700; margin-top: 2px; }
.pc.small .hptxt { text-align: center; font-size: 10px; }
.clsb { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fbf8f1; color: #1e1e1e; font-size: 15px; line-height: 1;
  display: grid; place-items: center; box-shadow: 0 1px 3px #0008; }
.clsb.r { color: #c41d24; }
.abil { position: absolute; top: 2px; right: 3px; font-size: 18px; line-height: 1; padding: 3px; cursor: help; filter: drop-shadow(0 0 4px var(--gold)); z-index: 2; }
.pc.small .abil { font-size: 13px; top: 0; right: 0; }
.tip { position: fixed; z-index: 40; max-width: min(260px, 86vw); background: #000e; color: #fff; border: 1px solid var(--gold); border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.3; pointer-events: none; box-shadow: 0 6px 18px #0008; }
.pc.small .clsb { width: 17px; height: 17px; font-size: 12px; top: 2px; left: 2px; }
.pc.pick { animation: pulse 1s infinite; cursor: pointer; }
.pc.drop-ok { outline: 3px dashed var(--gold); outline-offset: 1px; }
.pc.drop-hover { outline-style: solid; transform: scale(1.04); background: color-mix(in srgb, var(--gold) 30%, var(--pc1)); }
.board.drop-board { outline: 3px dashed var(--gold); outline-offset: 3px; border-radius: 18px; }
.float { position: absolute; left: 50%; top: 40%; font-weight: 900; font-size: 26px; color: #fff; text-shadow: 0 0 6px #c41d24, 0 2px 0 #7a0d12; pointer-events: none; z-index: 3; }
.pc.small .float { font-size: 18px; top: 30%; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--glow1); } 50% { box-shadow: 0 0 0 7px var(--glow2); } }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
/* status and Activity icons: top row of the card, right beside the class suit (and clear of the ability star) */
.stat { font-size: 12px; line-height: 1; margin: 0 22px 0 24px; min-height: 22px; display: flex; flex-wrap: wrap; align-items: center; }
.sti { display: inline-block; padding: 2px 3px; cursor: help; }
.pc.big .sti { font-size: 15px; padding: 3px 4px; }
/* attack damage that differs from the printed number right now (hearts, class bonus, shields) */
.admg.up { color: #8dffb5; } .admg.down { color: #ff9c9c; }
.admg.up::after { content: '▲'; font-size: .45em; vertical-align: .5em; margin-left: 1px; }
.admg.down::after { content: '▼'; font-size: .45em; vertical-align: .5em; margin-left: 1px; }
.pc.small .stat { font-size: 10px; margin: -2px 12px 0 15px; min-height: 15px; }
.pc.small .sti { padding: 1px; }
[data-theme="felt"] .pc.small .stat { margin: -3px 10px 0 12px; }
.en { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.chip { font-size: 11px; font-weight: 800; padding: 1px 5px; border-radius: 6px; background: #f3efe6; color: #222; }
.chip.r { color: #c41d24; } .chip.j { background: var(--gold); }
.entot { font-size: 10px; color: var(--dim); margin-top: 3px; }
.atk { font-size: 11px; margin-top: 4px; padding: 4px 6px; border-radius: 6px; background: #0e0b1e66; }
.atop { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.admg { font-weight: 900; font-size: 17px; line-height: 1; color: #fff; }
.admg.r { float: right; font-size: 20px; }
.detail .admg { font-size: 22px; }
.aneed { font-size: 10px; color: var(--dim); margin-top: 1px; }
.atk.ok { background: color-mix(in srgb, var(--green) 25%, transparent); }
.atk.off { opacity: .45; }
.atk.off b { text-decoration: line-through; }
.detail .atkd.off .cost, .detail .atkd.off .muted, .detail .atkd.off .admg { opacity: .45; }
.atk b { font-weight: 800; }

/* log */
.mid { display: flex; gap: 8px; align-items: stretch; margin: 8px 0; }
.deckpile { flex: none; width: 46px; border-radius: 8px; background: repeating-linear-gradient(45deg, #3b2f7a, #3b2f7a 5px, #2c2360 5px, #2c2360 10px); border: 2px solid #f3efe6;
  box-shadow: 2px 2px 0 #f3efe6aa, 4px 4px 0 #f3efe655; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; margin-right: 4px; }
.deckpile b { font-size: 17px; line-height: 1; }
.logstrip { flex: 1; min-width: 0; padding: 8px 10px; background: var(--panel); border-radius: 12px; font-size: 12px; color: var(--dim); cursor: pointer; }
.logstrip div:last-child { color: var(--text); }

/* prompt */
.prompt { background: color-mix(in srgb, var(--gold) 18%, var(--panel)); border: 1px solid var(--gold); border-radius: 14px; padding: 10px; margin: 8px 0; }
.prompt h4 { margin: 0 0 6px; font-size: 14px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }

/* actions */
.actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 8px 0; }
.actions button { padding: 11px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-weight: 800; font-size: 13px; }
.actions button.primary { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.actions button.go { background: var(--gold); color: var(--on-gold); border-color: var(--gold); animation: pulse 1s infinite; }
.actions button small { display: block; font-size: 9px; font-weight: 600; opacity: .9; }
.actions button:disabled { opacity: .4; }
.playinfo { font-size: 12px; color: var(--dim); text-align: center; }

/* hand */
/* the tray (action buttons + your cards) stays pinned to the bottom of the screen while the board scrolls */
.tray { position: sticky; bottom: 0; z-index: 9; margin: 8px -12px 0; padding: 7px 12px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); box-shadow: 0 -8px 16px #00000059; }
.tray .actions { margin: 0 0 4px; }
.tray .actions button { padding: 9px 4px; }
.tray .cards { padding: 5px 2px 2px; }
.hand { display: flex; gap: 8px; margin-top: 5px; }
.hgrp { min-width: 0; }
.hgrp + .hgrp { border-left: 1px solid var(--line); padding-left: 8px; }
.hand h5 { margin: 0 2px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); font-weight: 600; white-space: nowrap; }
.board, .hand, .actions { -webkit-user-select: none; user-select: none; }
.cards { display: flex; padding: 8px 2px 4px; }
.slot { flex: 1 1 0; min-width: 0; max-width: 62px; height: 80px; }
.slot:last-child { flex: 0 0 56px; }
/* a pile laid out to pick from (Treasure Map): cards wrap instead of overlapping */
.cards.grid { flex-wrap: wrap; gap: 8px 5px; }
.cards.grid .slot { flex: 0 0 56px; }
/* playing cards and Activity cards share one size and layout */
.card { position: relative; width: 56px; height: 80px; border-radius: 8px; background: var(--card); color: var(--card-fg); display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: -2px 2px 4px #0007; cursor: grab; border: 2px solid var(--card-line); touch-action: none; transition: transform .12s; }
.card .rk { position: absolute; top: 3px; left: 5px; font-weight: 900; font-size: 15px; line-height: 1; text-align: center; }
.card .rk i { display: block; font-style: normal; font-size: 13px; }
.card .pip { font-size: 28px; line-height: 1; margin-top: 8px; }
.card small { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; opacity: .6; }
.card.r { color: #c41d24; } .card.j { background: linear-gradient(160deg, #ffe08a, #e29a2d); }
.card.actc { background: #d5e6ff; border-color: #9dbdf0; color: #14254d; }
.card.actc .rk { font-size: 16px; left: 3px; }
.card.actc .nmx { font-size: 9.5px; font-weight: 800; line-height: 1.1; text-align: center; padding: 0 3px; margin-top: 12px; overflow-wrap: anywhere; }
.card.sel { border-color: var(--gold); transform: translateY(-6px); }
.card.fresh { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 14px var(--glow1); z-index: 2; }
.card[data-nodrag] { cursor: pointer; }
@media (hover: hover) { .slot:hover .card { transform: translateY(-6px); z-index: 3; } }
.card.drag-src { opacity: .25; }
/* rearranging your hand: a gold bar shows where the card will land */
.card.ins-l { box-shadow: -5px 0 0 var(--gold), -2px 2px 4px #0007; transform: translateX(5px); }
.card.ins-r { box-shadow: 5px 0 0 var(--gold), -2px 2px 4px #0007; transform: translateX(-5px); }
.card.ghost { position: fixed; z-index: 40; pointer-events: none; transform: rotate(4deg) scale(1.12); box-shadow: 0 10px 24px #000b; transition: none; margin: 0; }
body.dragging { cursor: grabbing; }

/* overlays: turn start and attack results */
.overlay { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; background: #000b; padding: 20px; }
.overlay.light { background: #0007; }
.turnbox, .evbox { width: min(400px, 100%); background: var(--bg2); border: 2px solid var(--gold); border-radius: 20px; padding: 22px 18px; text-align: center; box-shadow: 0 12px 40px #000c; animation: pop .22s ease-out; }
.turnbox .big { font-family: var(--display); font-weight: 900; font-size: 34px; line-height: 1.1; margin-bottom: 10px;
  background: linear-gradient(180deg, #ffe08a, #e29a2d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bigbtn { font-size: 20px; padding: 16px; margin-top: 16px; }
.evbox { cursor: pointer; }
.evwho { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--dim); }
.evicon { font-size: 44px; line-height: 1.2; }
.evtitle { font-family: var(--display); font-weight: 900; font-size: 21px; color: var(--gold); margin-bottom: 8px; }
.evline { font-size: 15px; padding: 5px 0; border-top: 1px solid var(--line); }
.evline.warn { color: #ffd99a; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: #000a; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 82dvh; overflow-y: auto;
  background: var(--bg2); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet-panel h3 { margin: 0 0 4px; font-family: var(--display); font-size: 20px; }
.sheet-panel p { margin: 4px 0 10px; color: var(--dim); font-size: 13px; }
.opt { display: block; width: 100%; text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); margin-top: 6px; }
.opt small { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }
.opt.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 20%, var(--panel)); }
.opt:disabled { opacity: .45; }
.detail .atkd { background: var(--panel); border-radius: 12px; padding: 10px; margin-top: 8px; }
.detail .atkd .h { display: flex; justify-content: space-between; font-weight: 800; }
.cost { font-size: 12px; color: var(--dim); }
.cost.ok { color: var(--green); }
.logfull div { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.toast { position: fixed; left: 50%; top: 74px; transform: translateX(-50%); background: #000d; border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px; z-index: 30; max-width: 90vw; font-size: 14px; }
.winner { text-align: center; padding: 18px; }
.winner .logo { font-size: 36px; }

/* coin flips */
.coinbox { width: min(400px, 100%); background: var(--bg2); border: 2px solid var(--gold); border-radius: 20px; padding: 18px; text-align: center; cursor: pointer; animation: pop .2s ease-out; }
.coinset + .coinset { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.coins { display: flex; justify-content: center; gap: 16px; padding: 78px 0 10px; perspective: 600px; }
.coin { position: relative; width: 72px; height: 72px; transform-style: preserve-3d; animation: flipH 1.5s cubic-bezier(.3, .1, .3, 1) forwards; }
.coin.t { animation-name: flipT; }
.coin:nth-child(2) { animation-duration: 1.65s; } .coin:nth-child(3) { animation-duration: 1.8s; }
.cf { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font: 900 32px var(--display); -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background: radial-gradient(circle at 35% 30%, #fff0b8, #d79a22); color: #5a3a00; border: 4px solid #fff2c4; box-shadow: 0 4px 10px #0009; }
.ct { transform: rotateX(180deg); background: radial-gradient(circle at 35% 30%, #f1f1f6, #8f93a8); color: #2b2e3d; border-color: #fafafa; }
@keyframes flipH { 0% { transform: translateY(0) rotateX(0); } 50% { transform: translateY(-70px) rotateX(900deg); } 100% { transform: translateY(0) rotateX(1800deg); } }
@keyframes flipT { 0% { transform: translateY(0) rotateX(0); } 50% { transform: translateY(-70px) rotateX(990deg); } 100% { transform: translateY(0) rotateX(1980deg); } }
.coinres { font-weight: 800; font-size: 17px; color: var(--gold); opacity: 0; animation: pop .3s 1.85s ease-out forwards; }

/* character list */
.rhead { margin: 28px 0 2px; font-family: var(--display); font-size: 17px; color: var(--gold); }
.rhead small { font: 400 12px var(--font); color: var(--dim); margin-left: 6px; }
.rost { border-left: 4px solid var(--cc, var(--line)); }
.detail .rost { margin-top: 18px; padding: 12px 12px 12px 14px; }
.rhead + .rost { margin-top: 10px; }
.rost .h { align-items: center; gap: 10px; margin-bottom: 3px; }
.rname { color: color-mix(in srgb, var(--cc) 72%, #fff); font-size: 16px; }
.rhp { flex: none; padding: 2px 9px; border: 1.5px solid currentColor; border-radius: 999px; background: #00000038; color: color-mix(in srgb, var(--green) 80%, #fff); font-size: 12px; font-weight: 800; letter-spacing: .3px; white-space: nowrap; }
/* ability text is always yellow, in every skin, so it stands out */
.rost .rabil { color: #ffd45e; font-size: 13px; margin: 2px 0; }
.abline, .sheet-panel p.abline { color: #ffd45e; }
.rost.actl { --cc: #7fb7e6; }
.rost .atxt { font-size: 13px; margin-top: 3px; }
.libtabs { margin: 10px 0 12px; }
.library { padding-top: 2vh; }
.library .logo { font-size: 30px; }
.library .tag { margin-bottom: 14px; }
.library .back { display: block; margin: 0 0 10px; }
.library .detail { text-align: left; }
.library .detail p { margin: 4px 0 10px; color: var(--dim); font-size: 13px; }
.rost.magic { --cc: var(--magic); } .rost.brute { --cc: var(--brute); } .rost.cunning { --cc: var(--cunning); } .rost.royal { --cc: var(--royal); }
.ratk { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }

/* ---------- skins ----------
   Classic's values are the base above; Felt table (further down) is the default skin. Terminal only changes colors and fonts: same layout, same emojis.
   Suits: diamonds blue (Magic), clubs green (Brute), spades amber (Cunning), hearts white (classless). */
:root[data-theme="terminal"] {
  --bg: #0b0d10; --bg2: #11151a; --panel: #14181d; --line: #2a313a;
  --text: #e6edf3; --dim: #8b949e; --gold: #d2a8ff; --red: #f85149; --green: #3fd68a;
  --magic: #4da3ff; --brute: #3fd68a; --cunning: #f2b84b; --royal: #f5f7fa;
  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; --display: var(--font);
  --on-gold: #1b0f2e; --glow1: #d2a8ffcc; --glow2: #d2a8ff33;
  --card: #14181d; --card-fg: #e6edf3; --card-line: #3a434e;
  --pc1: #14181d; --pc2: #0f1216; --well: #07090b;
}
[data-theme="terminal"] body { font-size: 14px; letter-spacing: -.2px; }
[data-theme="terminal"] .logo, [data-theme="terminal"] .turnbox .big { background: none; color: var(--gold); letter-spacing: 0; }
[data-theme="terminal"] .logo { font-size: 38px; }
[data-theme="terminal"] .winner .logo { font-size: 30px; }
[data-theme="terminal"] .bigcode { letter-spacing: 8px; }
[data-theme="terminal"] .btn.alt { background: #21262d; border: 1px solid var(--line); }
[data-theme="terminal"] .status { background: #1e1a10; border-color: #5c4a1e; color: var(--cunning); }
[data-theme="terminal"] .who.on { background: #1c1528; border-color: var(--gold); color: var(--gold); box-shadow: none; }
[data-theme="terminal"] .who.on b { color: var(--text); }
[data-theme="terminal"] .side.opp { background: #120e10; border-color: #5a2a2e; }
[data-theme="terminal"] .side.mine { background: #0e1116; border-color: #8b949e; }
[data-theme="terminal"] .side.opp .tag { background: #5a2a2e; color: #ffc9cc; }
[data-theme="terminal"] .side.mine .tag { background: #e6edf3; color: #0b0d10; }
[data-theme="terminal"] .side.opp .bench-label { color: #d99a9e; } [data-theme="terminal"] .side.mine .bench-label { color: var(--dim); }
[data-theme="terminal"] .side.opp .bench { background: #1a1315; } [data-theme="terminal"] .side.mine .bench { background: #161b21; }
[data-theme="terminal"] .hpbar.mid { --c: var(--cunning); }
[data-theme="terminal"] .sD { color: var(--magic); } [data-theme="terminal"] .sC { color: var(--brute); }
[data-theme="terminal"] .sS { color: var(--cunning); } [data-theme="terminal"] .sH { color: var(--royal); }
[data-theme="terminal"] .clsb { background: var(--bg); border: 1px solid currentColor; box-shadow: none; }
[data-theme="terminal"] .chip { background: var(--bg); border: 1px solid var(--line); }
[data-theme="terminal"] .chip.j, [data-theme="terminal"] .card.j { background: var(--card); color: var(--gold); border-color: var(--gold); }
[data-theme="terminal"] .card.actc { background: #1b2028; border-color: #4a5562; color: var(--text); }
[data-theme="terminal"] .deckpile { background: repeating-linear-gradient(45deg, #1b2028, #1b2028 5px, #14181d 5px, #14181d 10px); border-color: #3a434e; box-shadow: 2px 2px 0 #3a434eaa, 4px 4px 0 #3a434e55; }
[data-theme="terminal"] .actions button { font-size: 12px; }
[data-theme="terminal"] .pc .nm { font-size: 12px; } [data-theme="terminal"] .pc.small .nm { font-size: 9.5px; }

/* ---------- Felt table skin (the default) ----------
   Classic's fonts, gold accent and layout. Two changes: the table is felt, and every card
   (Players included) is a cream card sitting on it. data-felt picks the felt color. */
:root[data-theme="felt"] {
  --bg: #1f6b48; --bg2: #164d34; --panel: #1b5c3e; --line: #3f8f68;
  --text: #f6f3e8; --dim: #b7d3c2;
  --magic: #7c4ddb; --brute: #d9571f; --cunning: #23875a; --royal: #c9921a;
  --well: #d9d2c2; --ink2: #6f6858;
  --fuzz: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='a' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 -.42'/%3E%3CfeGaussianBlur stdDeviation='.35'/%3E%3C/filter%3E%3Cfilter id='b' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 -.4'/%3E%3CfeGaussianBlur stdDeviation='.35'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23a)' opacity='.5'/%3E%3Crect width='240' height='240' filter='url(%23b)' opacity='.55'/%3E%3C/svg%3E");
  --nap: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='a' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 -.18'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23a)' opacity='.5'/%3E%3C/svg%3E");
}
[data-theme="felt"][data-felt="purple"] { --bg: #3d3275; --bg2: #2a2256; --panel: #342a66; --line: #62569e; --dim: #c5bfe2; }
[data-theme="felt"][data-felt="blue"] { --bg: #1f5282; --bg2: #173c61; --panel: #1b4770; --line: #4b82b4; --dim: #bcd2e6; }
[data-theme="felt"][data-felt="red"] { --bg: #7c2736; --bg2: #5a1b27; --panel: #6b2130; --line: #ab4f5f; --dim: #e8c6cc; }

html[data-theme="felt"] { min-height: 100%; background:
  radial-gradient(130% 70% at 50% 0%, #ffffff1c, transparent 60%),
  radial-gradient(120% 100% at 50% 45%, transparent 55%, #0000004d),
  var(--fuzz), var(--nap), var(--bg); }
[data-theme="felt"] body { background: transparent; }
[data-theme="felt"] .topbar { background: linear-gradient(#ffffff17, #ffffff12), var(--fuzz), var(--bg); margin: 0 -12px; padding-left: 12px; padding-right: 12px; }

/* table zones: stitched outlines on the felt instead of colored panels */
[data-theme="felt"] .who { background: #0000003d; border-color: #ffffff33; }
[data-theme="felt"] .who.on { background: var(--gold); border-color: #fff2c4; }
[data-theme="felt"] .side { background: #0000001f; border: 1.5px dashed #ffffff59; box-shadow: inset 0 2px 10px #00000033; }
[data-theme="felt"] .side.opp { border-color: #ffb9c4a6; }
[data-theme="felt"] .side.mine { border-color: #b4daffa6; }
[data-theme="felt"] .side.opp .bench { background: #00000033; }
[data-theme="felt"] .side.mine .bench { background: #ffffff1a; }
[data-theme="felt"] .side.opp .bench-label { color: #ffd0d7; } [data-theme="felt"] .side.mine .bench-label { color: #d6eaff; }
[data-theme="felt"] .logstrip { background: #00000042; }
[data-theme="felt"] .actions button:not(.primary):not(.go) { background: #00000047; border-color: #ffffff3d; }
[data-theme="felt"] .btn.alt { background: #00000047; border: 1px solid #ffffff3d; }

/* Player cards: the same cream card as the hand, with the class as a thin colored frame
   and the class suit in the corner like a card index */
[data-theme="felt"] .pc { background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 13%, var(--card)), var(--card) 34%); color: var(--card-fg);
  border: 2px solid var(--card-line); border-radius: 10px; padding: 9px 9px 8px; box-shadow: -2px 3px 5px #00000073; --green: #2fa15f; }
[data-theme="felt"] .pc::before { content: ''; position: absolute; inset: 3px; border: 1.5px solid var(--cc); border-radius: 6px; pointer-events: none; }
[data-theme="felt"] .pc.small { padding: 7px 5px 5px; border-width: 2px; border-radius: 8px; }
[data-theme="felt"] .pc.small::before { inset: 2px; border-width: 1px; border-radius: 5px; }
[data-theme="felt"] .pc.ko { opacity: .45; box-shadow: none; }
/* cards keep their own height: the Arena card never stretches to match the bench */
[data-theme="felt"] .arena-row { align-items: flex-start; }
[data-theme="felt"] .bench { align-self: stretch; }
[data-theme="felt"] .clsb { background: none; box-shadow: none; width: auto; height: auto; font-size: 18px; top: 7px; left: 9px; }
[data-theme="felt"] .pc.small .clsb { font-size: 12px; top: 4px; left: 5px; width: auto; height: auto; }
[data-theme="felt"] .pc .meta, [data-theme="felt"] .pc .aneed, [data-theme="felt"] .pc .entot, [data-theme="felt"] .pc .muted { color: var(--ink2); }
[data-theme="felt"] .hpbar { border-color: #00000030; }
[data-theme="felt"] .pc .atk { background: #1e1e1e0d; box-shadow: inset 0 0 0 1px #1e1e1e12; }
[data-theme="felt"] .pc .atk.ok { background: color-mix(in srgb, var(--green) 24%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 55%, var(--card)); }
[data-theme="felt"] .pc .admg { color: var(--card-fg); }
[data-theme="felt"] .pc .admg.up { color: #0c7f3d; } [data-theme="felt"] .pc .admg.down { color: #c41d24; }
[data-theme="felt"] .tray { background: linear-gradient(#ffffff17, #ffffff12), var(--fuzz), var(--bg); border-top-color: #ffffff40; }
[data-theme="felt"] .hgrp + .hgrp { border-left-color: #ffffff40; }
/* attached energy: tiny cards instead of chips */
[data-theme="felt"] .chip { background: #fff; border: 1px solid var(--card-line); border-radius: 3px; padding: 2px 4px; box-shadow: 0 1px 1px #00000040; }
[data-theme="felt"] .chip.j { background: var(--gold); }
[data-theme="felt"] .pc.drop-hover { background: color-mix(in srgb, var(--gold) 35%, var(--card)); }
[data-theme="felt"] .float { color: #c41d24; text-shadow: 0 0 5px #fff, 0 0 2px #fff; }
[data-theme="felt"] .card { box-shadow: -2px 3px 5px #00000073; }

/* felt color picker (home screen and in-game menu) */
.felts { display: flex; gap: 12px; margin-top: 10px; }
.fsw { width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid #ffffff66; }
.fsw.on { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold); }

/* skin picker (home screen) */
.themes { display: flex; gap: 8px; margin-top: 10px; }
.themes .opt { margin-top: 0; text-align: center; font-weight: 800; }
[data-theme="terminal"] .who small { font-size: 10px; letter-spacing: -.5px; white-space: nowrap; }

/* accounts, leaderboard and game history */
.sheet-panel input { margin-top: 8px; }
.ferr { color: #ff8f8f; font-size: 13px; min-height: 18px; margin-top: 8px; }
.acct .muted { margin: 0; }
.acctrow { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.acctrow b { font-size: 20px; }
.acctrow span { color: var(--gold); font-weight: 800; white-space: nowrap; }
.row2 { display: flex; gap: 8px; }
.row2 .btn { flex: 1; }
.lb { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 10px; }
.lb th { text-align: left; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; padding: 6px 4px; }
.lb td { padding: 9px 4px; border-top: 1px solid var(--line); }
.lb td:first-child { color: var(--dim); width: 28px; }
.lb td:nth-child(2) { font-weight: 800; }
.lb tr.me td { color: var(--gold); }
.hrow { display: flex; align-items: baseline; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.hrow b { width: 42px; }
.hrow.w b { color: var(--gold); }
.hrow.l b { color: var(--dim); }
.hrow span { flex: 1; }
.hrow small { color: var(--dim); }

/* pick your team (draft) */
.draft .dlabel { margin: 10px 0 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.dteam { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: center; }
.dchip { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-weight: 700; font-size: 13px; }
.draft .choices .opt { width: auto; flex: 1 1 45%; margin-top: 0; }
.opt.taken { opacity: .4; }
.dpick, .dchip { border-left: 4px solid var(--cc, var(--line)); }
.dpick.magic, .dchip.magic { --cc: var(--magic); } .dpick.brute, .dchip.brute { --cc: var(--brute); } .dpick.cunning, .dchip.cunning { --cc: var(--cunning); } .dpick.royal, .dchip.royal { --cc: var(--royal); }
.dcols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.dcol { min-width: 0; }
.dcol .dteam { flex-direction: column; align-items: stretch; }
.dcol .dchip { text-align: left; border-radius: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcol + .dcol { border-left: 1px solid var(--line); padding-left: 10px; }
.dcol .dlabel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* home screen: pitch, quick start, resume, footer links */
.pitch { max-width: 420px; margin: 0 auto 12px; font-size: 15px; line-height: 1.4; }
.btn.learn { width: auto; display: inline-block; margin: 0 0 14px; padding: 9px 16px; border-radius: 999px; font-size: 14px; }
.btn small { display: block; font-size: 11px; font-weight: 600; opacity: .8; margin-top: 1px; }
.box .row2 .btn { margin-top: 0; }
.box.resume { border-color: var(--gold); }
.box.resume .btn:first-of-type { margin-top: 0; }
.box.resume .link { display: block; margin: 10px auto 0; font-size: 13px; }
.footlinks { margin-top: 16px; color: var(--dim); font-size: 13px; line-height: 2; }
.footlinks .link { font-size: 13px; }
.footlinks .link { margin-top: 0; }
.qs { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.35; }
.qs > b { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: var(--on-gold); display: grid; place-items: center; font-size: 13px; }
textarea { width: 100%; margin-top: 8px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); font: inherit; font-size: 16px; resize: vertical; }
[data-theme="felt"] .sheet-panel textarea { background: #00000040; }

/* turn pop-up: what the other player did on their turn */
.recap { max-height: 34dvh; overflow-y: auto; margin: 4px 0 8px; padding: 8px 12px 4px; border-radius: 12px; background: #00000038; text-align: left; }
.recap .evwho { margin-bottom: 4px; }
.recap .evline { font-size: 13.5px; padding: 4px 0; }

/* ---------- simple home: three buttons, and the Play sheet ---------- */
.home { max-width: 340px; margin: 0 auto 22px; }
.home .btn { padding: 15px; font-size: 17px; }
.home .btn.alt { font-size: 15px; }
.lobby .toplinks { margin: 0 0 6px; line-height: 2; }
.sheet-panel p.step { margin: 16px 0 0; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.sheet-panel .resume { border: 1px solid var(--gold); border-radius: 14px; padding: 12px; margin: 8px 0 12px; text-align: center; }
.sheet-panel .resume p { margin: 0; }
.sheet-panel .resume .link { display: block; margin: 10px auto 0; font-size: 13px; }
.sheet-panel .resume + input, .sheet-panel .resume + p { margin-top: 0; }
.sheet-panel .link.one { display: block; margin: 10px auto 0; font-size: 13px; }
.sheet-panel .link.one.on { color: var(--gold); text-decoration: none; font-weight: 800; }
.lobby .tag { margin-bottom: 18px; }
.lobby .pitch { margin-bottom: 18px; }
.home { margin-bottom: 18px; }

/* Your games: saved games on the home screen */
.games { max-width: 340px; margin: 0 auto 18px; text-align: left; }
.games h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); text-align: center; font-weight: 600; }
.games .opt { font-weight: 600; }
.games .opt.done { opacity: .7; }

/* Challenges: the button on the leaderboard and the Accept / Decline row under Your games */
.lb td.act { text-align: right; white-space: nowrap; width: 1%; }
.lb td.act .muted { font-size: 12px; font-weight: 400; }
.chalb { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--gold); background: transparent; color: var(--gold); font-size: 12px; font-weight: 800; }
.games .opt.chal .pair { display: flex; gap: 8px; margin-top: 10px; }
.games .opt.chal .pair .btn { margin-top: 0; padding: 10px; font-size: 14px; }
