/* Crazy Eights: the table, hands, suit picker and dialogs. Card look from /shared/cards/cards.css,
   layout and buttons from cb-arcade.css. */
.ce-page [hidden], .ce-dlg [hidden] { display: none !important; }

.ce-tabs { display: flex; gap: 6px; margin: 0 0 10px; background: var(--cbx-soft); padding: 4px; border-radius: 14px; }
.ce-tabs button { flex: 1; border: 0; background: transparent; padding: 10px 8px; border-radius: 11px; font: 900 15px var(--cbx-body); color: var(--cbx-muted); cursor: pointer; }
.ce-tabs button[aria-selected="true"] { background: #fff; color: var(--cbx-ink); box-shadow: 0 2px 6px rgba(42, 29, 23, .12); }

.ce-card { padding: 12px; }
.ce-banner, .cbx-card .ce-banner { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: #3a1f14; color: #fff; font: 800 15px/1.4 var(--cbx-body); }
.ce-banner b { color: #ffd66b; }
.ce-score { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: center; margin: 0 0 8px; font: 800 14px var(--cbx-body); color: var(--cbx-ink-2); }
.ce-score > b { color: var(--cbx-accent); text-transform: uppercase; font-size: 12px; letter-spacing: .08em; }
.ce-score span b { display: inline-block; min-width: 26px; padding: 1px 7px; border-radius: 99px; background: var(--cbx-soft); text-align: center; color: var(--cbx-ink); }

/* ---- the felt ---- */
.ce-table { position: relative; border-radius: 18px; padding: 10px 10px 14px; overflow: hidden; color: #fff; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .12), inset 0 10px 30px rgba(0, 0, 0, .18); }
.ce-opps { display: flex; justify-content: space-around; gap: 6px; min-height: 76px; }
.ce-opp { --cw: 26px; display: grid; justify-items: center; gap: 4px; padding: 6px 8px; border-radius: 14px; transition: background .2s; min-width: 0; }
.ce-opp .ce-fan { --ov: -.62; min-height: calc(var(--cw) * 1.4); }
.ce-opp .cb-card.down { box-shadow: inset 0 0 0 2px #fff, 0 1px 2px rgba(0, 0, 0, .3); }
.ce-oname, .ce-mename { display: flex; align-items: baseline; gap: 6px; font: 900 14px var(--cbx-body); white-space: nowrap; }
.ce-oname span, .ce-mename span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.ce-oname b, .ce-mename b { font: 800 12px var(--cbx-body); padding: 1px 7px; border-radius: 99px; background: rgba(0, 0, 0, .25); }
.ce-opp.turn { background: rgba(255, 214, 107, .22); box-shadow: inset 0 0 0 2px #ffd66b; }
.ce-opp.turn .ce-oname b { background: #ffd66b; color: #3a2a00; }
.ce-none { font: 800 12px var(--cbx-body); opacity: .7; line-height: calc(var(--cw) * 1.4); }
.ce-opps[data-n="3"] .ce-opp { --cw: 22px; padding: 6px 4px; }
.ce-opps[data-n="3"] .ce-oname span { max-width: 56px; }

.ce-mid { --cw: 74px; display: flex; align-items: center; justify-content: center; gap: 26px; margin: 12px 0 6px; }
.ce-stock { position: relative; display: grid; justify-items: center; gap: 4px; border: 0; padding: 0; background: none; color: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ce-stock:disabled { cursor: default; }
.ce-stack { position: relative; display: block; width: var(--cw); height: calc(var(--cw) * 1.4); }
.ce-stack .cb-card { position: absolute; left: 0; top: 0; }
.ce-stack .u1 { transform: translate(3px, 3px); z-index: -1; }
.ce-stack .u2 { transform: translate(6px, 6px); z-index: -2; }
.ce-stack { isolation: isolate; }
.ce-lbl { font: 800 12px var(--cbx-body); opacity: .85; }
.ce-stock.go .ce-stack .cb-card:first-child { animation: ce-nudge 1.4s ease-in-out infinite; }
@keyframes ce-nudge { 0%, 100% { box-shadow: inset 0 0 0 calc(var(--w) * .05) #fff, 0 0 0 0 rgba(255, 214, 107, 0); } 50% { box-shadow: inset 0 0 0 calc(var(--w) * .05) #fff, 0 0 0 5px #ffd66b, 0 0 18px 4px rgba(255, 214, 107, .7); transform: translateY(-4px); } }
.ce-pile { position: relative; width: var(--cw); height: calc(var(--cw) * 1.4); }
.ce-pile .cb-card { position: absolute; left: 0; top: 0; cursor: default; transform: rotate(var(--r, 0deg)); }
.ce-pile .cb-card.top { box-shadow: 0 0 0 1px var(--cb-card-edge), 0 6px 14px rgba(0, 0, 0, .3); animation: ce-land .25s ease-out; }
@keyframes ce-land { from { transform: rotate(var(--r)) scale(1.08); } }
.ce-now { width: 64px; display: grid; justify-items: center; gap: 2px; }
.ce-now > span:not(.any) { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: #fff; font-size: 34px; line-height: 1; box-shadow: 0 0 0 4px #ffd66b, 0 4px 10px rgba(0, 0, 0, .3); animation: ce-pop .35s ease-out; }
.ce-now small { font: 900 12px var(--cbx-body); text-transform: capitalize; }
.ce-now .any { font: 900 14px/1.2 var(--cbx-body); text-align: center; color: #ffd66b; }
.red { color: #c8283c; } .blk { color: #1f2433; }
@keyframes ce-pop { from { transform: scale(.4); opacity: 0; } }

.ce-prompt, .cbx-card .ce-prompt { margin: 4px 0 8px; min-height: 44px; text-align: center; font: 900 16px/1.3 var(--cbx-body); color: #fff; display: grid; align-content: center; gap: 2px; }
.ce-prompt small { font: 800 13px var(--cbx-body); color: rgba(255, 255, 255, .8); }
.ce-prompt .me { color: #fff; }
.ce-prompt .go { color: #ffd66b; }
.ce-prompt .bad { color: #ffd0c8; }

.ce-me { display: grid; justify-items: center; gap: 6px; }
.ce-mename.turn { color: #ffd66b; }
.ce-hand { --cw: 62px; width: 100%; display: grid; gap: 18px; padding-top: 14px; min-height: calc(62px * 1.4 + 14px); }
.ce-row { justify-content: center; }
.ce-hand .cb-card { transition: transform .15s ease, box-shadow .15s ease, filter .15s; }
.ce-hand .cb-card.ok { transform: translateY(-12px); box-shadow: 0 0 0 3px #ffd66b, 0 6px 14px rgba(0, 0, 0, .3); }
.ce-hand .cb-card.ok:active { transform: translateY(-6px); }
.ce-hand .cb-card.dim { filter: brightness(.68) saturate(.6); }
.ce-hand .cb-card.new { animation: ce-glow 1.2s ease-in-out infinite; }
.ce-hand .cb-card.fresh { box-shadow: 0 0 0 3px #fff, 0 0 16px 4px rgba(255, 255, 255, .7); transform: translateY(-6px); }
@keyframes ce-glow { 50% { box-shadow: 0 0 0 4px #ffd66b, 0 0 20px 6px rgba(255, 214, 107, .9); } }
.ce-hand .cb-card.nope { animation: ce-shake .35s; }
@keyframes ce-shake { 25% { translate: -5px 0; } 75% { translate: 5px 0; } }
.ce-empty, .cbx-card .ce-empty { margin: 20px 0; text-align: center; font: 900 16px var(--cbx-body); color: #ffd66b; }
@media (hover: hover) { .ce-hand .cb-card.ok:hover { transform: translateY(-18px); } }

.ce-splash { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; background: rgba(15, 40, 28, .55); pointer-events: none; z-index: 5; }
.ce-splash > span { display: grid; place-items: center; width: 110px; height: 110px; border-radius: 50%; background: #fff; font-size: 76px; line-height: 1; box-shadow: 0 0 0 6px #ffd66b, 0 12px 30px rgba(0, 0, 0, .4); }
.ce-splash b { font: 900 22px var(--cbx-body); color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.ce-splash.pop > span { animation: ce-spin .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ce-spin { from { transform: scale(.2) rotate(-120deg); } }

.ce-fly { position: fixed; z-index: 2000; pointer-events: none; transform-origin: 0 0; }
.ce-fly .cb-card { box-shadow: 0 10px 24px rgba(0, 0, 0, .35); }

/* ---- buttons and setup ---- */
.ce-actions, .ce-foot { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.ce-actions:not(:has(> :not([hidden]))) { display: none; }
.ce-actions .cbx-btn, .ce-foot .cbx-btn { min-height: 48px; }
.ce-send { display: grid; gap: 8px; margin-top: 10px; }
.ce-send .cbx-btn.gold { min-height: 60px; font-size: 19px; }
.ce-setup { display: grid; gap: 8px; margin-top: 12px; padding: 10px; border-radius: 14px; background: var(--cbx-soft); }
.ce-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ce-opt > span { font: 900 13px var(--cbx-body); color: var(--cbx-ink-2); }
.ce-seg { display: flex; gap: 4px; background: #fff; padding: 3px; border-radius: 99px; }
.ce-seg button, .ce-seg label span { display: block; border: 0; padding: 7px 12px; border-radius: 99px; background: transparent; font: 900 13px var(--cbx-body); color: var(--cbx-muted); cursor: pointer; white-space: nowrap; }
.ce-seg button[aria-pressed="true"], .ce-seg label:has(input:checked) span { background: var(--cbx-accent); color: #fff; }
.ce-seg.wide { background: var(--cbx-soft); margin-bottom: 8px; }
.ce-seg.wide label { flex: 1; text-align: center; }
.ce-seg.wide input { display: none; }

/* ---- the result ---- */
.ce-result { margin-top: 12px; padding: 16px 12px; border-radius: 16px; background: var(--cbx-paper); }
.ce-result h2 { margin: 0 0 4px; font: 900 26px var(--cbx-display); }
.ce-big { font-size: 46px; line-height: 1; }
.cbx-card .ce-sub, .cbx-card .ce-why { margin: 0 0 8px; font: 800 15px var(--cbx-body); color: var(--cbx-muted); }
.ce-left { display: grid; gap: 10px; margin: 10px 0 14px; }
.ce-leftrow { display: grid; justify-items: center; gap: 4px; font: 800 13px var(--cbx-body); color: var(--cbx-ink-2); --cw: 40px; }

/* ---- dialogs (they sit in the top layer) ---- */
.ce-dlg { border: 0; padding: 0; border-radius: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); font-family: var(--cbx-body); color: var(--cbx-ink); }
.ce-dlg::backdrop { background: rgba(42, 29, 23, .5); }
.ce-dlg-card { padding: 20px; }
.ce-dlg h2 { margin: 0 0 6px; font: 900 24px var(--cbx-display); text-align: left; }
.ce-dlg p { margin: 0 0 12px; font: 800 15px/1.45 var(--cbx-body); color: var(--cbx-muted); }
.ce-suits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.ce-suits button { display: grid; justify-items: center; gap: 2px; padding: 14px 6px 12px; border: 3px solid var(--cbx-line); border-radius: 18px; background: #fff; font: 900 17px var(--cbx-body); color: #1f2433; cursor: pointer; box-shadow: 0 4px 0 var(--cbx-line); }
.ce-suits button.red { color: #c8283c; }
.ce-suits button i { font-style: normal; font-size: 58px; line-height: 1; }
.ce-suits button:hover, .ce-suits button:focus-visible { border-color: var(--cbx-accent); }
.ce-suits button:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--cbx-line); }
.ce-cancel { display: block; width: 100%; border: 0; background: none; padding: 10px; font: 800 14px var(--cbx-body); color: var(--cbx-muted); cursor: pointer; text-decoration: underline; }
.ce-field { display: grid; gap: 4px; margin: 0 0 10px; font: 900 13px var(--cbx-body); color: var(--cbx-ink-2); }
.ce-field input { font: 800 17px var(--cbx-body); padding: 11px 12px; border: 2px solid var(--cbx-line); border-radius: 12px; }
.ce-dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.ce-mine { margin-top: 14px; border-top: 2px solid var(--cbx-line); padding-top: 10px; }
.ce-mine h3 { margin: 0 0 6px; font: 900 14px var(--cbx-body); }
.ce-mine ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ce-mine a { display: block; padding: 9px 12px; border-radius: 10px; background: var(--cbx-soft); font: 800 14px var(--cbx-body); color: var(--cbx-ink); text-decoration: none; }

@media (min-width: 640px) {
  .ce-table { padding: 16px 18px 20px; }
  .ce-mid { --cw: 92px; gap: 40px; }
  .ce-hand { --cw: 78px; min-height: calc(78px * 1.4 + 14px); }
  .ce-opp { --cw: 32px; }
  .ce-opps[data-n="3"] .ce-opp { --cw: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .ce-hand .cb-card, .ce-pile .cb-card.top, .ce-splash.pop > span, .ce-now > span { animation: none !important; transition: none !important; }
}
