/* ---- cribbage layout (card width --cw is set on #board by layout()) ---- */
main.table{gap:6px;padding-bottom:6px;min-width:0}
.hud{display:flex;justify-content:center;gap:14px;font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums;min-height:18px;white-space:nowrap;overflow:hidden}
.hud b{color:var(--ink);font-weight:700}
.hud .mode{color:var(--gold);font-weight:700;overflow:hidden;text-overflow:ellipsis;min-width:0}
#board{position:relative;flex:1;min-height:0;width:100%;display:flex;flex-direction:column;gap:6px;overflow:hidden;--cw:60px}
/* the peg board: two lanes, a front peg and a back peg each */
#pegs{display:flex;flex-direction:column;gap:5px;padding:7px 10px;border-radius:10px;background:var(--panel);min-width:0}
.lane{display:grid;grid-template-columns:76px minmax(0,1fr) 34px;gap:8px;align-items:center}
.lane .who{font-size:12.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lane .dl{font-style:normal;background:var(--gold);color:#1d1500;border-radius:50%;display:inline-grid;place-items:center;width:15px;height:15px;font-size:10px;font-weight:800;margin-left:2px}
.lane .sc{text-align:right;font-variant-numeric:tabular-nums;font-size:15px}
.trk{position:relative;height:14px;border-radius:7px;background:linear-gradient(#5a3c1f,#43290f);box-shadow:inset 0 2px 3px rgba(0,0,0,.5);margin:0 7px}
.trk u{position:absolute;top:2px;bottom:2px;width:1px;background:rgba(255,255,255,.18)}
.trk .pg{position:absolute;top:50%;width:12px;height:12px;margin:-6px 0 0 -6px;border-radius:50%;transition:left .45s ease}
.l0 .pg{background:#4fc3f7}.l1 .pg{background:#ef5350}
.pg.front{box-shadow:0 0 0 2px #fff6,0 1px 4px rgba(0,0,0,.6);z-index:2}.pg.back{opacity:.5;transform:scale(.8)}
/* opponent */
#opps{display:flex;justify-content:center}
.opp{display:flex;align-items:center;gap:10px;padding:6px 12px;border-radius:12px;background:var(--panel);border:2px solid transparent;transition:border-color .3s,box-shadow .3s;min-width:0;width:100%;max-width:440px;min-height:52px}
.opp.turn{border-color:var(--gold);box-shadow:0 0 14px -4px var(--gold)}
.opp .who{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.opp .nm{font-weight:700;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.opp .nm small{color:var(--gold);font-weight:700;font-size:11px;margin-left:4px}
.opp .meta{font-size:11.5px;color:var(--muted);white-space:nowrap}
.opp .tk{color:var(--gold);font-weight:600}
.opp .tk i{display:inline-block;width:4px;height:4px;border-radius:50%;background:var(--gold);margin-left:2px;animation:bob 1s infinite}
.opp .tk i:nth-child(2){animation-delay:.15s}.opp .tk i:nth-child(3){animation-delay:.3s}
@keyframes bob{0%,80%,100%{opacity:.25;transform:none}40%{opacity:1;transform:translateY(-3px)}}
.obacks{display:flex}.obacks i{width:16px;height:23px;border-radius:3px;margin-left:-8px;background:repeating-linear-gradient(45deg,#1e4d8c,#1e4d8c 3px,#2a63ad 3px,#2a63ad 6px);border:1px solid #fff8;box-shadow:0 1px 2px rgba(0,0,0,.4)}
.obacks i:first-child{margin-left:0}
/* the table: crib + starter on the left, the pegging row and the count in the middle */
#felt{position:relative;flex:1;min-height:0;display:flex;gap:10px;align-items:center;justify-content:center;padding:4px 6px;min-width:0}
.fside{display:flex;flex-direction:column;gap:30px;align-items:center;flex:none;padding-bottom:14px}
.fpile{position:relative;width:var(--sw);height:calc(var(--sw)*1.4);flex:none}
.fpile .card,.fpile .cstack .card{width:var(--sw);position:absolute;left:0;top:0}
.fpile .cstack{position:absolute;inset:0}.fpile .cstack .card:nth-child(2){left:3px;top:3px}.fpile .cstack .card:nth-child(3){left:6px;top:6px}.fpile .cstack .card:nth-child(4){left:9px;top:9px}
.fpile .lbl{position:absolute;top:calc(100% + 4px);left:50%;transform:translateX(-50%);font-size:11px;color:var(--muted);white-space:nowrap;pointer-events:none}
.fmid{position:relative;flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:6px}
.prow{position:relative;width:100%;height:calc(var(--sw)*1.4 + 6px)}
.prow .card{position:absolute;top:0;width:var(--sw)}
.prow .card.mine{box-shadow:0 0 0 2px #4fc3f7,0 2px 5px rgba(0,0,0,.4)}.prow .card.theirs{box-shadow:0 0 0 2px #ef5350,0 2px 5px rgba(0,0,0,.4)}
.pcount{display:flex;align-items:baseline;gap:6px;min-height:34px}.pcount small{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px}.pcount b{font-size:30px;color:var(--gold);font-variant-numeric:tabular-nums}
.pop{position:absolute;left:50%;top:38%;transform:translate(-50%,0);z-index:20;padding:5px 12px;border-radius:14px;font-weight:800;font-size:14px;white-space:nowrap;pointer-events:none;animation:popup 1.7s ease-out forwards;box-shadow:0 4px 14px rgba(0,0,0,.45)}
.pop.me{background:#4fc3f7;color:#04202c}.pop.opp{background:#ef5350;color:#fff}
@keyframes popup{0%{opacity:0;transform:translate(-50%,10px) scale(.8)}15%{opacity:1;transform:translate(-50%,0) scale(1.08)}80%{opacity:1}100%{opacity:0;transform:translate(-50%,-26px)}}
#board .card .tl span{font-size:.85em}
#status{width:100%;max-width:560px;align-self:center;min-height:2.9em;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;font-size:13.5px;line-height:1.35;background:var(--panel);border-radius:10px;padding:3px 10px}
#status b{color:var(--gold)}#status .hint{font-size:12.5px;color:#b3e5fc}
#me{display:flex;flex-direction:column;gap:2px;min-width:0}
#hand{position:relative;width:100%;height:calc(var(--cw)*1.4 + 22px);flex:none}
#hand .card{position:absolute;top:18px;width:var(--cw);cursor:pointer;touch-action:manipulation;transition:top .15s,box-shadow .15s,opacity .2s,left .25s}
#hand .card.sel{top:0;box-shadow:0 0 0 3px var(--gold),0 8px 16px rgba(0,0,0,.45)}
#hand .card.ok{box-shadow:0 0 0 2px rgba(255,213,79,.7)}
#hand .card.dim{opacity:.45;cursor:not-allowed}
#hand .card:focus{outline:none}#hand .card:focus-visible{outline:3px solid var(--gold);outline-offset:2px;z-index:30}
@media (hover:hover){ #hand .card:not(.sel):not(.dim):hover{top:10px} }
nav.bar{position:relative;display:flex;gap:8px;justify-content:center;padding:8px 10px 10px;background:rgba(0,0,0,.22)}
nav.bar button{flex:1;max-width:170px;min-height:44px;min-width:0;padding-left:8px;padding-right:8px}
nav.bar button.ghost{background:rgba(255,255,255,.14)}
nav.bar button i{margin-right:4px;opacity:.9}
nav.bar button[hidden]{display:none}
.gh .hbtn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:40px;min-height:40px;padding:0 11px;border-radius:10px;border:0;background:rgba(255,255,255,.12);color:var(--ink);text-decoration:none;font:600 14px system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;flex:none}
@media (max-width:640px){ .gh .hbtn .txt{display:none} .gh .hbtn{padding:0;width:40px} }
.toast{bottom:calc(84px + var(--safe-b))}
/* the show */
.reveal.show{--cw:50px;display:flex;align-items:center;justify-content:center;gap:4px;margin:8px 0;flex-wrap:wrap}
.reveal.show .card{position:relative;left:auto;top:auto;width:var(--cw);flex:none}
.reveal.show .card.starter{box-shadow:0 0 0 3px var(--gold)}
.reveal.show .plus{color:var(--muted);font-weight:800;padding:0 2px}
table.res.sc td{padding:3px 6px}table.res.sc tr.tot td{border-top:1px solid rgba(255,255,255,.25);font-size:15px}
.banner.nineteen{color:var(--gold);font-size:30px;text-align:center;margin:10px 0 4px}
.rules{padding-left:20px;font-size:14px;line-height:1.5}.rules li{margin-bottom:6px}
@media (max-width:480px){ .hud{gap:10px;font-size:12px} nav.bar{gap:6px;padding:7px 8px 8px} .lane{grid-template-columns:62px minmax(0,1fr) 30px} }
@media (max-height:500px) and (orientation:landscape){ .gh{padding-top:calc(4px + var(--safe-t));padding-bottom:4px} main.table{padding-top:3px;gap:3px} nav.bar{padding:4px 8px 5px} nav.bar button{min-height:40px} #opps,#pegs{display:none} }
/* modal bits (level cards, as in checkers/pool/rummy) */
table.res td.n b{color:#fff}
.box .note{font-size:12.5px;color:#b9c9bf;margin:6px 0 0}
.stats td.n,.stats th.n{text-align:right}
.box .warn{color:#ffcc80;font-size:13.5px}
.bigicon{font-size:34px;margin-bottom:6px;color:#ffd54f}
.box .lead{font-size:14px;color:#dfe8e2;margin:0 0 10px}
.lvlist{display:grid;grid-template-columns:minmax(0,1fr);gap:8px;margin:8px 0 4px}
.box button.lv{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 12px;align-items:center;text-align:left;background:#1b2620;color:#f4f8f5;border-radius:12px;padding:10px 12px;min-height:64px;white-space:normal;box-shadow:inset 0 0 0 1px rgba(255,255,255,.12);font-weight:400;width:100%}
.box button.lv.on{box-shadow:inset 0 0 0 2px #ffd54f;background:#27331f}
.box button.lv .badge2{grid-row:span 3;width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font:800 17px system-ui,sans-serif;color:#1d1500}
.box button.lv .t1{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px;min-width:0}
.box button.lv .t1 b{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.box button.lv .t1 span{font-size:12.5px;color:#b9c9bf;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.box button.lv .bl{font-size:12px;color:#cfdad3;line-height:1.35}
.box button.lv .meta{display:flex;flex-direction:column;align-items:flex-start;gap:7px;font-size:12px;color:#b9c9bf;min-width:0}
.bar10{display:flex;gap:2px;flex:none}
.bar10 i{width:7px;height:8px;border-radius:2px;background:#3a4a41}
.box button.lv.boss{background:linear-gradient(135deg,#2c2610,#1b2620 60%)}
.box button.lv.locked{background:#161c19;box-shadow:inset 0 0 0 1px rgba(255,255,255,.08);cursor:not-allowed}
.box button.lv.locked .badge2,.box button.lv.locked .t1,.box button.lv.locked .bl,.box button.lv.locked .bar10{opacity:.45;filter:grayscale(.7)}
.box button.lv .lock{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:700;color:#e3ecd0}
.box button.lv .lock i{color:#ffd54f}
.rec{display:flex;gap:12px;font-variant-numeric:tabular-nums;white-space:nowrap;font-size:11.5px;color:#9fb5a8;letter-spacing:.2px}
.rec > span{display:inline-flex;align-items:baseline;gap:4px}
.rec b{font-weight:800;font-size:13px;color:#fff}
.rec .rw b{color:#8be0a4}.rec .rl b{color:#ff9e94}
.box .banner.pete{color:#ffd54f;font-size:22px}
.box h2 .fa-crown{color:#ffd54f}
