/* Le compte est bon (archetype 05, "chiffres") scoped under .ceb-root. A custom
   board: a prominent target, a row of number tiles, an operator pad and a
   running gap readout. Uses the shared design tokens (gold accent + warm
   neutrals, Cormorant / Lora) with a few local surface variables so the board
   can follow the .mode-dark class independently of the OS colour-scheme. */

.ceb-root {
  --line: #cfc8b8; --ink: #2a2620; --muted: #7d7979;
  --paper: #fbf9f3; --paper-2: #f2eee3;
  --gold: #b68235; --gold-soft: #e7d3a3; --gold-tint: #f6efdd;
  --near: #2e7d32; --bad: #c8503b;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(var(--space-3), 3vw, var(--space-6));
  padding: clamp(var(--space-2), 2.5vw, var(--space-4)) 0;
  inline-size: 100%; max-inline-size: 100%; box-sizing: border-box;
  color: var(--ink); font-family: var(--font-body);
}
/* Board tonality is driven by our own .mode-dark class only (BOARD_SURFACES.md),
   never by the OS colour-scheme. */
.ceb-root.mode-dark {
  --line: #3a4030; --ink: #ece8e2; --muted: #9b9797;
  --paper: #232620; --paper-2: #1c1f19;
  --gold: #d8b65c; --gold-soft: #4a4126; --gold-tint: #2b2820;
  --near: #7bbd7f; --bad: #d9694f;
}

/* ── header: target + gap readout ── */
.ceb-head { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); }
.ceb-target { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ceb-target-lbl {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-family: var(--font-body);
}
.ceb-target-num {
  font-family: var(--font-heading); font-weight: 600;
  font-size: clamp(48px, 15vw, 76px); line-height: 1;
  color: var(--gold); font-variant-numeric: tabular-nums;
}
.ceb-gauge { min-block-size: 22px; }
.ceb-gap { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ceb-gap.near { color: var(--near); font-weight: 600; }
.ceb-hit { font-size: 16px; color: var(--near); font-weight: 700; letter-spacing: 0.02em; }

/* ── tiles ── */
.ceb-tiles {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: clamp(8px, 2vw, 12px); max-inline-size: 100%;
}
.ceb-tile {
  min-inline-size: clamp(52px, 15vw, 68px); block-size: clamp(52px, 15vw, 68px);
  padding: 0 6px;
  display: grid; place-items: center;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-heading); font-weight: 600;
  font-size: clamp(20px, 5vw, 27px); font-variant-numeric: tabular-nums;
  cursor: pointer; user-select: none; transition: transform 0.08s, border-color 0.12s, background 0.12s;
}
.ceb-tile:hover:not(:disabled) { border-color: var(--gold); }
.ceb-tile:active:not(:disabled) { transform: translateY(1px); }
.ceb-tile.derived { background: var(--gold-tint); border-style: dashed; }
.ceb-tile.sel { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 3px var(--gold-soft); }
.ceb-tile.match { border-color: var(--near); color: var(--near); }
.ceb-tile:disabled { opacity: 0.7; cursor: default; }

/* ── preview / instruction line ── */
.ceb-preview {
  min-block-size: 24px; font-size: 18px; color: var(--muted);
  font-variant-numeric: tabular-nums; text-align: center;
}

/* ── operator pad ── */
.ceb-ops { display: flex; justify-content: center; gap: clamp(8px, 2vw, 12px); }
.ceb-op {
  inline-size: clamp(48px, 13vw, 60px); block-size: clamp(48px, 13vw, 60px);
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--ink);
  font-size: clamp(22px, 6vw, 28px); font-weight: 700; line-height: 1;
  cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.ceb-op:hover:not(:disabled) { border-color: var(--gold); }
.ceb-op.sel { border-color: var(--gold); background: var(--gold-soft); color: var(--ink); }
.ceb-op:disabled { opacity: 0.45; cursor: default; }

/* ── actions ── */
.ceb-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.ceb-btn {
  min-block-size: 42px; padding: 0 var(--space-4);
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 15px; font-weight: 600; cursor: pointer;
}
.ceb-btn:hover:not(:disabled) { border-color: var(--gold); }
.ceb-btn:disabled { opacity: 0.45; cursor: default; }
.ceb-btn-fin { border-color: var(--gold); color: var(--gold); }
.ceb-btn-fin:hover:not(:disabled) { background: var(--gold-soft); }

/* ── solution reveal (after a win or giving up) ── */
.ceb-solution {
  inline-size: min(320px, 100%); box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper-2); padding: var(--space-3);
  text-align: center;
}
.ceb-sol-lbl {
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-block-end: var(--space-2);
}
.ceb-sol-line {
  font-family: var(--font-heading); font-size: 19px; font-variant-numeric: tabular-nums;
  color: var(--ink); line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .ceb-tile, .ceb-op { transition: none; }
}
.ceb-root.no-motion .ceb-tile, .ceb-root.no-motion .ceb-op { transition: none; }
