/* Cartes de bingo — Classes Numériques */
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif; background: #f8fafc; color: #1f2937; }
header {
  background: linear-gradient(135deg, #7c3aed, #db2777); color: #fff; padding: 10px 18px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 12px; flex: 1 1 280px; min-width: 0; }
.brand > div { min-width: 0; }
.brand .logo { font-size: 2rem; }
.brand h1 { margin: 0; font-size: 1.35rem; }
.brand .subtitle { margin: 0; font-size: .85rem; opacity: .92; overflow-wrap: anywhere; }
nav { display: flex; gap: 8px; }
.nav-btn {
  background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 8px;
  padding: 6px 12px; font-size: .9rem; cursor: pointer; text-decoration: none; font-family: inherit;
}
.nav-btn:hover, .nav-btn.active { background: rgba(255,255,255,.32); }

.layout { display: flex; min-height: calc(100vh - 60px); }
#sidebar { width: 330px; flex: 0 0 330px; background: #fff; border-right: 1px solid #e5e7eb; padding: 14px; overflow-y: auto; }
#sidebar.hidden { display: none; }
.sidebar-head h2 { margin: 0 0 4px; font-size: 1.1rem; }
.sidebar-head .hint { margin: 0 0 10px; font-size: .85rem; color: #6b7280; }
.activity { border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.activity .head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px; background: #faf5ff; border: 0; cursor: pointer; text-align: left; font-family: inherit; font-size: .9rem; }
.activity .head:hover { background: #f3e8ff; }
.activity .tp-num { background: #7c3aed; color: #fff; border-radius: 6px; padding: 2px 6px; font-size: .75rem; font-weight: 700; }
.activity .tp-title { flex: 1; font-weight: 600; }
.activity .tp-level { font-size: .75rem; color: #6b7280; white-space: nowrap; }
.activity .body { display: none; padding: 10px 12px; font-size: .88rem; border-top: 1px solid #e5e7eb; }
.activity.open .body { display: block; }
.activity .body h3 { font-size: .8rem; text-transform: uppercase; color: #7c3aed; margin: 10px 0 4px; }
.activity .body ol { margin: 4px 0; padding-left: 20px; }
.activity .body li { margin-bottom: 3px; }
.activity .question { background: #faf5ff; border-left: 3px solid #a855f7; padding: 5px 8px; margin: 5px 0; border-radius: 0 6px 6px 0; }
.activity .prof-note { background: #fefce8; border: 1px solid #fde68a; border-radius: 8px; padding: 4px 10px 8px; margin-top: 10px; }

#main { flex: 1; min-width: 0; padding: 16px; max-width: 1100px; margin: 0 auto; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tab { border: 2px solid #ddd6fe; background: #fff; color: #5b21b6; border-radius: 999px; padding: 8px 16px; font-weight: 700; cursor: pointer; font-family: inherit; font-size: .95rem; }
.tab.active { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.hidden { display: none !important; }
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card h2 { margin: 0 0 10px; font-size: 1.1rem; }
.lbl { display: block; font-weight: 700; margin: 10px 0 4px; }
.lbl:first-child { margin-top: 0; }
input[type="text"], input[type="number"], textarea, select {
  width: 100%; border: 2px solid #d1d5db; border-radius: 10px; padding: 8px 10px; font: inherit; background: #fff; color: inherit;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #7c3aed; }
.help { font-size: .86rem; color: #6b7280; margin: 6px 0 10px; font-weight: 400; }
code { background: #f3e8ff; border-radius: 4px; padding: 1px 5px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.center, .center { justify-content: center; text-align: center; }
.spacer, .grow { flex: 1; }
.count { font-weight: 700; color: #5b21b6; }
.count.bad { color: #b91c1c; }
.msg { font-weight: 600; color: #b91c1c; }
.msg.ok { color: #15803d; }
.btn { background: #7c3aed; color: #fff; border: 2px solid #7c3aed; border-radius: 10px; padding: 8px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { background: #6d28d9; }
.btn.ghost { background: #fff; color: #5b21b6; border-color: #c4b5fd; }
.btn.ghost:hover { background: #f5f3ff; }
.btn.big { font-size: 1.3rem; padding: 12px 34px; }
.btn:disabled { opacity: .5; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid #ddd6fe; background: #faf5ff; color: #5b21b6; border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-weight: 600; }
.chip:hover { background: #ede9fe; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.opts label { font-weight: 700; font-size: .9rem; display: flex; flex-direction: column; gap: 4px; }

/* cartes */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.sheet { background: #fff; border: 2px solid #7c3aed; border-radius: 12px; padding: 10px; break-inside: avoid; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.sheet-head strong { font-size: 1.05rem; color: #5b21b6; overflow-wrap: anywhere; }
.sheet-head span { font-size: .75rem; color: #6b7280; white-space: nowrap; }
.bcard { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 0; border: 2px solid #1f2937; }
.bcell {
  border: 1px solid #1f2937; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 3px; font-weight: 700; overflow: hidden; overflow-wrap: anywhere; hyphens: auto; line-height: 1.15; background: #fff;
  font-size: clamp(.6rem, calc(5.2rem / var(--n) / var(--len, 1)), 1.15rem);
}
.bcell.free { background: #ede9fe; color: #5b21b6; font-size: 1.4rem; }
.bcard.play { max-width: 560px; margin: 0 auto; }
.bcard.play .bcell { cursor: pointer; font-size: clamp(.75rem, calc(8rem / var(--n) / var(--len, 1)), 1.5rem); user-select: none; border: 1px solid #1f2937; font-family: inherit; color: inherit; }
.bcard.play .bcell:hover { background: #faf5ff; }
.bcard.play .bcell.on { background: #a855f7; color: #fff; }
.bcard.play .bcell.win { background: #16a34a; color: #fff; }
.banner { margin: 14px auto 0; max-width: 560px; text-align: center; font-size: 2.2rem; font-weight: 900; color: #fff; background: linear-gradient(135deg, #16a34a, #65a30d); border-radius: 14px; padding: 10px; animation: pop .5s; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* tirage */
.called { min-height: 150px; display: flex; align-items: center; justify-content: center; text-align: center; background: #faf5ff; border: 3px dashed #c4b5fd; border-radius: 16px;
  font-size: clamp(1.6rem, 6vw, 3.6rem); font-weight: 900; color: #4c1d95; padding: 16px; overflow-wrap: anywhere; margin-bottom: 8px; }
.called.def { font-size: clamp(1.2rem, 4vw, 2.2rem); font-weight: 700; }
.called-sub { min-height: 1.8em; text-align: center; font-size: 1.15rem; color: #6b7280; margin-bottom: 10px; }
.history { display: flex; flex-wrap: wrap; gap: 6px; }
.history span { background: #ede9fe; color: #4c1d95; border-radius: 8px; padding: 4px 10px; font-weight: 600; }
.history span:first-child { background: #7c3aed; color: #fff; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  #sidebar { width: 100%; flex: none; border-right: none; border-bottom: 1px solid #e5e7eb; max-height: 45vh; }
  .brand h1 { font-size: 1.1rem; }
  #main { padding: 10px; }
}

@media print {
  header, #sidebar, .tabs, .no-print, #tab-words, #tab-draw, #tab-play { display: none !important; }
  body { background: #fff; }
  .layout { display: block; min-height: 0; }
  #main { padding: 0; max-width: none; }
  #tab-cards { display: block !important; }
  .cards { gap: 8mm; }
  .cards.per-2 { grid-template-columns: 1fr; }
  .cards.per-4, .cards.per-6 { grid-template-columns: 1fr 1fr; }
  .cards.per-2 .sheet { max-width: 150mm; margin: 0 auto; width: 100%; }
  .cards.per-6 .sheet { max-width: 78mm; margin: 0 auto; width: 100%; }
  .cards.per-2 .sheet:nth-child(2n), .cards.per-4 .sheet:nth-child(4n), .cards.per-6 .sheet:nth-child(6n) { break-after: page; }
  .sheet { border-color: #000; }
  .sheet-head strong { color: #000; }
  .bcell.free { background: #eee; color: #000; }
  @page { margin: 10mm; }
}
