/* Cribbage: a felt table with a walnut pegboard as the centrepiece. Cards come from the shared card kit. */
.cb {
  --cb-text: #dfe9ff; --cb-muted: #8aa3c4; --cb-strong: #fff; --cb-panel: #0b1328; --cb-line: #1c2b4a; --cb-accent: #55d6ff; --cb-hot: #ffd166;
  --cb-me: #55d6ff; --cb-opp: #ff7a8f; --cb-h: 520px;
  max-width: 1000px; margin: 0 auto; padding: 10px 8px 14px; color: var(--cb-text); position: relative; font-variant-numeric: tabular-nums;
  user-select: none; -webkit-user-select: none;
}
.cb [hidden] { display: none !important; }
.cb-top { display: flex; justify-content: space-between; align-items: center; gap: 8px 10px; flex-wrap: wrap; margin: 0 0 8px; }
.cb-opts { display: flex; gap: 8px 10px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--cb-muted); flex: 1 1 340px; min-width: 0; }
.cb-opts label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.cb-sel { display: inline-flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; }
.cb-lt { font-size: 12px; font-weight: 600; }
.cb-opts select { background: var(--cb-panel); color: var(--cb-text); border: 1px solid var(--cb-line); border-radius: 8px; padding: 0 6px; min-height: 40px; font-size: 13.5px; font-family: inherit; }
.cb-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.cb-btn { background: var(--cb-panel); color: var(--cb-text); border: 1px solid var(--cb-line); border-radius: 9px; padding: 0 13px; min-height: 40px; font-weight: 700; font-size: 13.5px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; -webkit-tap-highlight-color: transparent; font-family: inherit; touch-action: manipulation; }
@media (hover: hover) { .cb-btn:hover:not(:disabled) { border-color: var(--cb-accent); } }
.cb-btn:disabled { opacity: .45; cursor: default; }
.cb-btn:active:not(:disabled) { transform: translateY(1px); }
.cb-btn-primary { background: #ffd166; color: #1a1200; border-color: #ffd166; }
@media (hover: hover) { .cb-btn-primary:hover:not(:disabled) { background: #ffe08a; border-color: #ffe08a; } }
.cb-btn[aria-pressed="true"]:not(.cb-icon) { border-color: var(--cb-hot); color: var(--cb-hot); box-shadow: 0 0 10px rgba(255, 209, 102, .25); }
.cb-icon { width: 40px; padding: 0; }
.cb-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#cb-sound[aria-pressed="false"] .on, #cb-sound[aria-pressed="true"] .off { display: none; }
.cb-btn:focus-visible, .cb select:focus-visible, .cb .ck-card:focus-visible, .cb-step button:focus-visible { outline: 2px solid var(--cb-accent); outline-offset: 2px; }

/* the table */
.cb-stage { position: relative; height: var(--cb-h); border-radius: 18px; overflow: hidden; touch-action: manipulation;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .28), inset 0 10px 30px rgba(0, 0, 0, .3), 0 0 22px rgba(85, 214, 255, .12); }
.cb-board { position: absolute; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 5px 7px rgba(0, 0, 0, .5)); }
.cb-board-svg { display: block; overflow: visible; }
.cb-peg { will-change: transform; }
.cb-peg-move { filter: drop-shadow(0 0 5px rgba(255, 255, 255, .7)); }
.cb-plus { animation: cb-plus 1.25s ease-out forwards; pointer-events: none; }
@keyframes cb-plus { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-16px); } }

.cb-cards { position: absolute; inset: 0; outline: none; }
.cb .ck-card { transition: transform .34s cubic-bezier(.2, .8, .3, 1), width .3s, height .3s, opacity .3s, filter .25s, box-shadow .2s; box-shadow: 0 2px 5px rgba(0, 0, 0, .45); touch-action: manipulation; }
.cb.cb-snap .ck-card { transition: none !important; }
.cb .ck-card.cb-mine { cursor: pointer; }
.cb .ck-card.cb-sel { box-shadow: 0 0 0 2px var(--cb-hot), 0 0 16px rgba(255, 209, 102, .75); }
.cb .ck-card.cb-can { box-shadow: 0 0 0 2px rgba(85, 214, 255, .85), 0 0 12px rgba(85, 214, 255, .5); }
.cb .ck-card.cb-cant { filter: brightness(.62) saturate(.7); }
.cb .ck-card.cb-dead { filter: brightness(.55) saturate(.6); }
.cb .ck-card.cb-gone { opacity: 0; pointer-events: none; }
.cb .ck-card.cb-hint { box-shadow: 0 0 0 2px #7dffb0, 0 0 16px rgba(125, 255, 176, .75); }
.cb .ck-card.cb-pulse { animation: cb-pulse .56s ease-out; z-index: 400 !important; }
@keyframes cb-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 209, 102, .9); scale: 1; } 40% { box-shadow: 0 0 0 4px rgba(255, 209, 102, .95), 0 0 22px rgba(255, 209, 102, .9); scale: 1.09; } 100% { box-shadow: 0 0 0 2px rgba(255, 209, 102, 0); scale: 1; } }
.cb .ck-card.cb-flip { animation: cb-flip .26s ease-out; }
@keyframes cb-flip { from { scale: .05 1; } to { scale: 1 1; } }
.cb .ck-card.cb-shake { animation: cb-shake .3s; }
@keyframes cb-shake { 25% { rotate: -4deg; } 75% { rotate: 4deg; } }
.cb-deckstack { position: absolute; border-radius: 7px; background: rgba(0, 0, 0, .35); box-shadow: 2px 2px 0 rgba(0, 0, 0, .3); pointer-events: none; }
.cb-tag { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); background: #ffd166; color: #1a1200; font-size: 11px; font-weight: 800; border-radius: 9px; padding: 1px 6px; white-space: nowrap; z-index: 2; pointer-events: none; }
.cb .ck-card:has(.cb-tag) { overflow: visible; }

.cb-lab { position: absolute; font-size: 11px; font-weight: 700; color: rgba(223, 233, 255, .72); text-align: center; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis; z-index: 402; pointer-events: none; letter-spacing: .02em; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.cb-count { position: absolute; z-index: 402; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 12px; background: rgba(4, 8, 20, .72); border: 1px solid rgba(255, 255, 255, .16); color: #fff; font-weight: 800; line-height: 1; pointer-events: none; }
.cb-count b { font-size: 24px; }
.cb-count i { font-style: normal; font-size: 9.5px; font-weight: 700; color: var(--cb-muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }
.cb-count.bump b { animation: ck-pop .25s; }
.cb-cap { position: absolute; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; font-size: 15px; font-weight: 800; color: #fff; pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, .75); line-height: 1.15; }
.cb-cap { opacity: 0; transition: opacity .16s; z-index: 402; }
.cb-cap.on { opacity: 1; }
.cb-cap .who { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: rgba(223, 233, 255, .8); }
.cb-cap .say { color: var(--cb-capc, #fff); }
.cb-cap b.tot { display: inline-flex; min-width: 26px; height: 24px; padding: 0 6px; align-items: center; justify-content: center; border-radius: 12px; background: #ffd166; color: #1a1200; font-size: 14px; text-shadow: none; }

.cb-chip { position: absolute; display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 12px; background: rgba(6, 11, 26, .78); border: 1px solid rgba(255, 255, 255, .12); min-height: 34px; max-width: 46%; transition: box-shadow .25s, border-color .25s; white-space: nowrap; z-index: 405; }
.cb-chip.cur { border-color: var(--cb-chipc); box-shadow: 0 0 0 1px var(--cb-chipc), 0 0 14px color-mix(in srgb, var(--cb-chipc) 55%, transparent); }
.cb-chip .dot { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, var(--cb-chipc) 45%, #0008 130%); flex: none; box-shadow: 0 0 6px var(--cb-chipc); }
.cb-chip .nm { font-size: 13px; font-weight: 800; color: #fff; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cb-chip .sc { font-size: 19px; font-weight: 800; color: #fff; }
.cb-chip .of { font-size: 11px; color: var(--cb-muted); font-weight: 600; }
.cb-chip .dl { font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #1a1200; background: #ffd166; border-radius: 8px; padding: 2px 6px; }
.cb-chip .say { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 8px; background: #fff; color: #10182c; font-size: 13px; font-weight: 800; border-radius: 10px; padding: 3px 9px; animation: ck-pop .2s; }

.cb-act { position: absolute; z-index: 410; display: flex; align-items: center; align-content: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.cb-act .msg { font-size: 13px; font-weight: 700; color: rgba(223, 233, 255, .9); text-shadow: 0 1px 2px rgba(0, 0, 0, .6); text-align: right; white-space: normal; line-height: 1.2; }
.cb-act .cb-btn { min-height: 44px; }
.cb-act.cb-act-wide { justify-content: center; gap: 12px; }
.cb-step { display: inline-flex; align-items: center; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .2); background: rgba(6, 11, 26, .8); }
.cb-step button { width: 44px; height: 44px; background: none; border: 0; color: #fff; font-size: 22px; font-weight: 800; cursor: pointer; font-family: inherit; touch-action: manipulation; }
.cb-step output { min-width: 40px; text-align: center; font-size: 20px; font-weight: 800; color: #ffd166; }
.cb-dots i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-left: 3px; animation: cb-dots 1s infinite; }
.cb-dots i:nth-child(2) { animation-delay: .15s; } .cb-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes cb-dots { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.cb-coachbox { position: absolute; z-index: 420; background: #070d1f; border: 1px solid rgba(125, 255, 176, .45); border-radius: 12px; padding: 7px 10px; font-size: 12.5px; line-height: 1.35; color: var(--cb-text); display: flex; align-items: center; gap: 10px; }
.cb-coachbox b { color: #7dffb0; }
.cb-coachbox .cb-btn { min-height: 40px; padding: 0 10px; font-size: 12.5px; flex: none; }
.cb-coachbox p { margin: 0; white-space: normal; }
.cb-note { color: var(--cb-muted); }

.cb-sum { position: absolute; z-index: 450; background: #070d1f; border: 1px solid #2b4470; border-radius: 14px; padding: 10px 12px; overflow: auto; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: ck-fade .2s; -webkit-overflow-scrolling: touch; }
.cb-sum h4 { margin: 0; font-size: 14px; color: #fff; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cb-sum h4 small { font-size: 11.5px; font-weight: 600; color: var(--cb-muted); }
.cb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; align-items: start; padding: 5px 8px; border-radius: 9px; background: rgba(255, 255, 255, .045); border-left: 3px solid var(--cb-rowc, #55d6ff); }
.cb-row .t { font-size: 12.5px; font-weight: 800; color: #fff; }
.cb-row .t i { font-style: normal; font-weight: 600; color: var(--cb-muted); margin-left: 6px; letter-spacing: .02em; }
.cb-row .t i .r { color: #ff8fa0; }
.cb-row .n { grid-row: 1 / 3; grid-column: 2; font-size: 21px; font-weight: 800; color: #ffd166; align-self: center; min-width: 26px; text-align: right; }
.cb-row .w { font-size: 12px; color: #b9c9e6; white-space: normal; line-height: 1.3; }
.cb-sum .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; position: sticky; bottom: -10px; margin-bottom: -10px; padding: 6px 0 10px; background: #070d1f; z-index: 2; }
.cb-sum .foot span { font-size: 12px; color: var(--cb-muted); white-space: normal; }
.cb-sum .foot .cb-btn { min-height: 44px; margin-left: auto; }

.cb-curtain { position: absolute; z-index: 500; display: flex; align-items: center; justify-content: center; background: rgba(4, 8, 20, .97); border-top: 1px solid #2b4470; }
.cb-curtain-in { text-align: center; padding: 8px 12px; }
.cb-curtain-in p { font-size: 19px; font-weight: 800; color: #fff; margin: 0 0 10px; }
.cb-curtain-in .cb-btn { min-height: 46px; }
.cb .ck-toast { z-index: 600; top: 46%; }

.cb-status { text-align: center; font-size: 14px; color: var(--cb-text); min-height: 22px; margin: 8px 0 0; font-weight: 600; }
.cb-side { margin: 8px auto 0; max-width: 720px; }
.cb-last { font-size: 13px; color: var(--cb-muted); text-align: center; line-height: 1.45; }
.cb-last b { color: var(--cb-text); }

/* dialogs */
.cb-overlay { position: fixed; inset: 0; background: rgba(2, 5, 14, .72); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.cb-overlay:not([hidden]) .cb-dialog { animation: ck-pop .22s cubic-bezier(.2, .9, .3, 1.2); }
.cb-dialog { background: #0b1328; color: #dfe9ff; border: 1px solid #244b6b; border-radius: 16px; padding: 20px; width: min(100%, 480px); max-height: calc(100% - 16px); overflow: auto; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .55); user-select: text; -webkit-user-select: text; }
.cb-dialog[data-view="rules"], .cb-dialog[data-view="stats"] { width: min(100%, 560px); text-align: left; }
.cb-dialog h3 { margin: 0 0 10px; color: #fff; font-size: 22px; text-align: center; }
.cb-dialog h4 { margin: 14px 0 6px; color: #ffd166; font-size: 14px; letter-spacing: .02em; }
.cb-dialog p { margin: 0 0 10px; opacity: .92; font-size: 14px; line-height: 1.5; }
.cb-dialog ul { margin: 0 0 8px; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.cb-dialog .big { font-size: 34px; font-weight: 800; color: #fff; margin: 2px 0 6px; }
.cb-dialog .big i { font-style: normal; color: var(--cb-muted); font-size: 22px; margin: 0 6px; }
.cb-dialog .sk { display: inline-block; background: #ffd166; color: #1a1200; font-weight: 800; border-radius: 10px; padding: 3px 10px; font-size: 13px; margin-bottom: 10px; }
.cb-dlg-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.cb-dlg-btns .cb-btn { min-height: 44px; min-width: 110px; }
.cb-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 8px 0; }
.cb-cell { background: rgba(255, 255, 255, .05); border-radius: 10px; padding: 7px 6px; text-align: center; }
.cb-cell b { display: block; font-size: 19px; color: #fff; }
.cb-cell span { font-size: 11.5px; color: var(--cb-muted); }
.cb-troph { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.cb-tr { display: flex; gap: 8px; align-items: center; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); border-radius: 10px; padding: 6px 8px; opacity: .62; text-align: left; }
.cb-tr.got { opacity: 1; border-color: rgba(255, 209, 102, .5); background: rgba(255, 209, 102, .08); }
.cb-tr svg { width: 22px; height: 22px; flex: none; fill: none; stroke: #8aa3c4; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cb-tr.got svg { stroke: #ffd166; }
.cb-tr b { display: block; font-size: 12.5px; color: #fff; } .cb-tr span { font-size: 11.5px; color: var(--cb-muted); line-height: 1.25; display: block; }
.cb-new-tr { margin: 8px 0 0; display: flex; flex-direction: column; gap: 5px; }
.cb-lv { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0; }
.cb-lv td, .cb-lv th { padding: 4px 6px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.cb-lv th { color: var(--cb-muted); font-weight: 600; font-size: 12px; }

@media (prefers-reduced-motion: reduce) {
  .cb .ck-card, .cb-peg { transition: none !important; }
  .cb .ck-card.cb-pulse, .cb .ck-card.cb-flip, .cb .ck-card.cb-shake, .cb-dots i, .cb-plus { animation-duration: .01s; }
}
@media (max-width: 700px) {
  .cb { padding: 8px 4px 12px; }
  .cb-opts { flex: 1 1 100%; justify-content: center; }
  .cb-tools { flex: 1 1 100%; justify-content: center; }
  .cb-lt { display: none; }
  .cb-btn { padding: 0 10px; }
  .cb-stage { border-radius: 14px; }
  .cb-chip { padding: 3px 8px 3px 6px; gap: 5px; } .cb-chip .sc { font-size: 17px; } .cb-chip .nm { font-size: 12.5px; max-width: 7.5em; }
  .cb-cap { font-size: 14px; }
  .cb-troph { grid-template-columns: 1fr; }
  .cb-dialog { padding: 16px 14px; }
}

/* full screen: the table fills what the stage gives it */
.cb.cb-fit { max-width: none; height: 100%; margin: 0; padding: 6px 8px 8px; display: flex; flex-direction: column; overflow: hidden; }
.cb-fit .cb-top { flex: none; justify-content: center; margin-bottom: 6px; }
.cb-fit .cb-stage { flex: 1 1 auto; min-height: 0; height: auto; }
.cb-fit .cb-status { flex: none; margin-top: 5px; }
.cb-fit .cb-side { display: none; }
.cb-fit .cb-side:has(.bt-strip:not([hidden])) { display: block; flex: none; }
.cb.cb-short { display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); column-gap: 8px; row-gap: 4px; align-content: start; }
.cb-short .cb-top { grid-column: 1; grid-row: 1; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 5px; margin: 0; }
.cb-short .cb-opts { flex-direction: column; align-items: stretch; flex: none; gap: 5px; }
.cb-short .rg-modes { max-width: none; }
.cb-short .rg-mode { min-height: 40px; flex-direction: row; gap: 5px; font-size: 12px; padding: 3px 4px; }
.cb-short .rg-mode svg { display: none; } .cb-short .rg-mode-t { white-space: normal; line-height: 1.1; overflow: visible; text-overflow: clip; }
.cb-short .cb-sel { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; }
.cb-short .cb-lt { display: none; }
.cb-short .cb-sel label { min-width: 0; } .cb-short .cb-sel select { width: 100%; min-height: 40px; font-size: 12px; min-width: 0; padding: 0 2px; }
.cb-short .cb-tools { flex: none; flex-wrap: wrap; gap: 4px; justify-content: flex-start; } .cb-short .cb-tools .cb-btn:not(.cb-icon) { flex: 1 1 auto; min-width: 0; }
.cb-short .cb-btn { min-height: 40px; font-size: 12px; padding: 0 6px; } .cb-short .cb-icon { width: 40px; padding: 0; flex: none; }
.cb-short .cb-status { grid-column: 1; grid-row: 2; margin: 0; font-size: 12.5px; text-align: left; }
.cb-short .cb-side { grid-column: 1; grid-row: 3; margin: 0; overflow: auto; }
.cb-short .cb-stage { grid-column: 2; grid-row: 1 / 4; height: 100%; }
.cb-short .cb-act .cb-btn { min-height: 40px; }
@media (max-width: 720px) { .cb.cb-short { grid-template-columns: 200px minmax(0, 1fr); } .cb-short .cb-sel select { font-size: 11px; } }
@media (max-width: 720px) { .cb-short .rg-mode { font-size: 11px; } }
