/* Codebreaker — the vault card sits on the Arcade kit's paper page as a slab of dark steel. */
.cb-page .k-ex { color: var(--cbx-good); }
.cb-page .k-nr { color: #b7860b; }

/* ---- mode tabs ---- */
.cb-tabs { display: flex; gap: 6px; padding: 5px; margin: 0 0 12px; background: var(--cbx-soft); border-radius: 16px; }
.cb-tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; background: transparent; font: 900 14px var(--cbx-body); color: var(--cbx-muted); cursor: pointer; padding: 6px 4px; }
.cb-tabs button[aria-selected="true"] { background: #fff; color: var(--cbx-ink); box-shadow: 0 2px 0 var(--cbx-line), 0 6px 14px rgba(42,29,23,.08); }

/* ---- the steel card ---- */
.cb-card {
  min-width: 0; overflow-x: clip;
  --steel: #1f2635; --steel-2: #2c3547; --well: #141a26; --txt: #eef2fa; --dim: #9aa6bd;
  --ex: #2fd08a; --nr: #ffc93c;
  position: relative; color: var(--txt); border-radius: 24px; padding: 14px 14px 16px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.018) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, var(--steel-2), var(--steel));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 2px 0 #0b0e15, 0 18px 40px rgba(20,26,40,.35);
}
.cb-vault { position: relative; height: 170px; margin: -4px -6px 4px; }
.cb-vault canvas { position: relative; z-index: 1; }
.cb-vault2d { position: absolute; inset: 0; display: grid; place-items: center; font-size: 84px; filter: drop-shadow(0 8px 14px rgba(0,0,0,.4)); }
.cb-vault.has3d .cb-vault2d { display: none; }

.cb-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 2px 10px; }
.cb-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.1); font: 900 13px var(--cbx-body); color: var(--txt); }
.cb-pill.ghost { background: transparent; border: 1px solid rgba(255,255,255,.16); font-variant-numeric: tabular-nums; }
.cb-pill.turn-you { background: color-mix(in srgb, var(--cbx-accent) 85%, #000); }
.cb-pill.turn-bot { background: #4b5873; }
.cb-banner { margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255,201,60,.14); border: 1px solid rgba(255,201,60,.35); font-weight: 800; font-size: 14px; line-height: 1.4; text-align: center; }

/* ---- pegs ---- */
.cb-peg {
  --c: #556; width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; color: rgba(255,255,255,.92); font: 900 17px/1 system-ui, sans-serif;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
  background:
    radial-gradient(circle at 34% 28%, rgba(255,255,255,.75) 0 9%, rgba(255,255,255,0) 22%),
    radial-gradient(circle at 50% 58%, var(--c) 0 55%, color-mix(in srgb, var(--c) 62%, #000) 100%);
  box-shadow: inset 0 -3px 5px rgba(0,0,0,.28), 0 3px 0 rgba(0,0,0,.35);
}
.cb-slot { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; padding: 0; background: var(--well); box-shadow: inset 0 3px 6px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.06); cursor: pointer; }
.cb-slot.cursor { box-shadow: inset 0 3px 6px rgba(0,0,0,.6), 0 0 0 3px color-mix(in srgb, var(--cbx-accent) 90%, #fff); }
.cb-slot .cb-peg { width: 100%; height: 100%; }
.cb-slot.pop .cb-peg { animation: cb-pop .22s cubic-bezier(.2,1.6,.4,1); }
@keyframes cb-pop { from { transform: scale(.6); } to { transform: scale(1); } }

/* ---- board ---- */
.cb-board { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.cb-row { display: flex; align-items: center; gap: 8px; }
.cb-board .cb-row { padding: 6px 8px; border-radius: 16px; background: rgba(0,0,0,.16); }
.cb-board .cb-row.now { background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); scroll-margin: 70px 0 190px; }   /* clear the sticky pad */
.cb-board .cb-row.future { opacity: .35; }
.cb-board .cb-row.future .cb-slot { cursor: default; }
.cb-n { width: 18px; flex: none; text-align: center; font: 900 12px var(--cbx-body); color: var(--dim); }
.cb-pegs { display: flex; gap: 8px; flex: 1; }
.cb-pins { display: grid; grid-template-columns: repeat(2, 13px); gap: 5px; flex: none; margin-left: auto; padding-right: 2px; }
.cb-pins.five { grid-template-columns: repeat(3, 12px); }
.cb-pins i { width: 13px; height: 13px; border-radius: 50%; background: var(--well); box-shadow: inset 0 2px 3px rgba(0,0,0,.6); }
.cb-pins i.ex { background: radial-gradient(circle at 35% 30%, #c8ffe6, var(--ex) 60%); box-shadow: 0 0 8px rgba(47,208,138,.6); }
.cb-pins i.nr { background: radial-gradient(circle at 35% 30%, #fff3c4, var(--nr) 60%); box-shadow: 0 0 8px rgba(255,201,60,.55); }
.cb-pins.reveal i { animation: cb-pin .3s cubic-bezier(.2,1.6,.4,1) both; }
.cb-pins.reveal i:nth-child(2) { animation-delay: .12s; } .cb-pins.reveal i:nth-child(3) { animation-delay: .24s; }
.cb-pins.reveal i:nth-child(4) { animation-delay: .36s; } .cb-pins.reveal i:nth-child(5) { animation-delay: .48s; }
@keyframes cb-pin { from { transform: scale(0); } to { transform: scale(1); } }
.cb-clue { flex: none; width: 56px; text-align: right; font: 800 11px/1.25 var(--cbx-body); color: var(--dim); }
/* five pegs (Practice Hard) must still fit a 360px phone */
.cb-board.five .cb-row { gap: 6px; padding: 6px; }
.cb-board.five .cb-pegs { gap: 6px; }
.cb-board.five .cb-slot { width: 38px; height: 38px; }
.cb-board.five .cb-peg { font-size: 15px; }
.cb-row.shake { animation: cb-shake .35s; }
@keyframes cb-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

/* ---- input pad (sticks to the bottom of the screen while you play) ---- */
.cb-pad { position: sticky; bottom: 8px; z-index: 3; margin-top: 12px; padding: 10px; border-radius: 18px; background: rgba(20,26,38,.92); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 10px 24px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08); }
.cb-palette { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; }
.cb-palette .cb-peg { width: 42px; height: 42px; cursor: pointer; position: relative; font-size: 17px; }
.cb-palette.eight { max-width: 212px; margin: 0 auto; gap: 8px; }   /* eight colours: two rows of four */
.cb-palette.eight .cb-peg { width: 46px; height: 46px; }
.cb-palette .cb-peg:active { transform: translateY(2px); box-shadow: inset 0 -3px 5px rgba(0,0,0,.28), 0 1px 0 rgba(0,0,0,.35); }
.cb-palette .cb-peg.out { opacity: .32; }
.cb-palette .cb-peg.out::after { content: ''; position: absolute; inset: 20% 46%; background: #fff; border-radius: 2px; transform: rotate(45deg); box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.cb-pad-actions { display: flex; gap: 8px; margin-top: 10px; }
.cb-key { width: 64px; min-height: 52px; border: 0; border-radius: 16px; background: #3a4458; color: #fff; font: 900 20px var(--cbx-body); cursor: pointer; box-shadow: 0 4px 0 #1b202b; }
.cb-key:active { transform: translateY(2px); box-shadow: 0 2px 0 #1b202b; }
.cb-try { flex: 1; }
.cb-card .cbx-btn:disabled { background: #3a4458; color: #8792a8; box-shadow: 0 4px 0 #1b202b; cursor: default; }

/* ---- duel setup ---- */
.cb-setup h2 { margin: 2px 0 4px; font: 900 22px var(--cbx-display); }
.cb-setup h3 { margin: 14px 0 8px; font: 900 15px var(--cbx-body); color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.cb-help { margin: 0 0 12px; color: var(--dim); font-weight: 700; font-size: 14px; line-height: 1.45; }
.cb-levels { display: grid; gap: 8px; }
.cb-level { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-radius: 16px; padding: 10px 12px; cursor: pointer; background: rgba(255,255,255,.06); color: var(--txt); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.cb-level[aria-checked="true"] { background: color-mix(in srgb, var(--cbx-accent) 26%, transparent); box-shadow: inset 0 0 0 2px var(--cbx-accent); }
.cb-level .em { font-size: 26px; }
.cb-level b { display: block; font: 900 16px var(--cbx-body); }
.cb-level small { display: block; color: var(--dim); font-weight: 700; font-size: 13px; }
.cb-level .rec { margin-left: auto; font: 900 12px var(--cbx-body); color: var(--dim); white-space: nowrap; }
.cb-secret { justify-content: center; padding: 8px; border-radius: 16px; background: rgba(0,0,0,.18); }
.cb-secret-pal { margin-top: 10px; }
.cb-setup-actions { display: flex; gap: 8px; margin-top: 12px; }
.cb-setup-actions .cbx-btn { flex: 1; padding: 12px 10px; }
.cb-card .cbx-btn.alt { background: #3a4458; color: #fff; box-shadow: 0 4px 0 #1b202b; }

/* ---- duel: the computer's side ---- */
.cb-enemy { margin: 0 0 12px; padding: 10px 12px; border-radius: 16px; background: rgba(0,0,0,.22); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.cb-enemy-head { display: flex; align-items: center; gap: 10px; }
.cb-bot { font-size: 26px; }
.cb-bot.thinking { animation: cb-think .5s ease-in-out infinite alternate; }
@keyframes cb-think { from { transform: rotate(-8deg); } to { transform: rotate(8deg) translateY(-2px); } }
.cb-enemy-txt { flex: 1; min-width: 0; font-size: 13px; font-weight: 800; color: var(--dim); line-height: 1.3; }
.cb-enemy-txt b { display: block; color: var(--txt); font-size: 15px; }
.cb-mycode { display: flex; gap: 3px; align-items: center; border: 0; border-radius: 12px; padding: 5px 7px; background: rgba(255,255,255,.08); cursor: pointer; }
.cb-mycode .cb-peg { width: 18px; height: 18px; font-size: 8px; box-shadow: inset 0 -1px 2px rgba(0,0,0,.3); }
.cb-mycode.hidden .cb-peg { --c: #4b5568 !important; color: transparent; text-shadow: none; }
.cb-meter { height: 8px; margin: 10px 0 4px; border-radius: 99px; background: var(--well); overflow: hidden; }
.cb-meter i { display: block; height: 100%; width: 100%; border-radius: 99px; background: linear-gradient(90deg, #ff7a59, #ffc93c, #2fd08a); transition: width .6s cubic-bezier(.2,.9,.3,1); }
.cb-left { margin: 0 0 6px; font: 800 12px var(--cbx-body); color: var(--dim); font-variant-numeric: tabular-nums; }
.cb-left b { color: var(--txt); }
.cb-enemy-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cb-enemy-rows .cb-row { gap: 5px; }
.cb-enemy-rows .cb-peg { width: 24px; height: 24px; font-size: 10px; box-shadow: inset 0 -2px 3px rgba(0,0,0,.28), 0 2px 0 rgba(0,0,0,.3); }
.cb-enemy-rows .cb-pins { grid-template-columns: repeat(4, 9px); gap: 3px; }
.cb-enemy-rows .cb-pins i { width: 9px; height: 9px; }
.cb-enemy-rows .cb-n { width: 16px; font-size: 11px; }
.cb-enemy-rows .more { font: 800 12px var(--cbx-body); color: var(--dim); }

/* ---- practice bar ---- */
.cb-practice-bar { display: flex; gap: 6px; margin: 0 0 12px; }
.cb-practice-bar button { flex: 1; min-height: 40px; border: 0; border-radius: 12px; background: rgba(255,255,255,.07); color: var(--dim); font: 900 14px var(--cbx-body); cursor: pointer; }
.cb-practice-bar button[aria-checked="true"] { background: var(--cbx-accent); color: #fff; }

/* ---- results ---- */
.cb-result { margin-top: 4px; }
.cb-result .cbx-kicker { color: var(--dim); }
.cb-res-big { margin: 4px 0 2px; font: 900 clamp(34px, 9vw, 46px)/1.05 var(--cbx-display); color: var(--txt); }
.cb-result .cbx-verdict { color: #ffd27a; }
.cb-vs { margin: 0 0 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.07); font-weight: 900; line-height: 1.4; }
.cb-vs.win { color: #7df0b8; } .cb-vs.lose { color: #ffc27a; } .cb-vs.tie { color: #b9d2ff; }
.cb-answer { display: flex; justify-content: center; gap: 8px; margin: 0 0 14px; }
.cb-answer:empty { display: none; }
.cb-answer::before { content: 'The code'; align-self: center; margin-right: 4px; font: 900 12px var(--cbx-body); color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.cb-answer .cb-peg { width: 34px; height: 34px; font-size: 13px; }
.cb-result .cbx-chips { margin-top: 14px; }
.cb-result .cbx-chips > * { background: rgba(255,255,255,.07); color: var(--dim); }
.cb-result .cbx-chips b { color: var(--txt); }
.cb-dist { display: grid; gap: 4px; margin: 14px auto 0; max-width: 340px; text-align: left; }
.cb-dist .bar { display: flex; align-items: center; gap: 8px; font: 900 12px var(--cbx-body); color: var(--dim); }
.cb-dist .bar span { width: 12px; text-align: right; }
.cb-dist .bar i { display: block; min-width: 22px; padding: 2px 7px; border-radius: 6px; background: #3a4458; color: #fff; font-style: normal; text-align: right; }
.cb-dist .bar.me i { background: var(--cbx-accent); }
.cb-res-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.cb-res-actions .cbx-btn { flex: 1; min-width: 140px; }
.cb-result .cbx-note { color: var(--dim); }

@media (min-width: 560px) {
  .cb-vault { height: 200px; }
  .cb-peg, .cb-slot, .cb-board.five .cb-slot { width: 48px; height: 48px; }
  .cb-palette .cb-peg { width: 50px; height: 50px; }
  .cb-palette.eight { max-width: none; }
  .cb-palette.eight .cb-peg { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  .cb-slot.pop .cb-peg, .cb-pins.reveal i, .cb-row.shake, .cb-bot.thinking { animation: none; }
}
