/* CaisseOutils — design partagé, mobile-first */
:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #1c2433;
  --muted: #5d6b82;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-soft: #e8effe;
  --border: #e3e9f2;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(37, 99, 235, .08);
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
}

.container { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; }

/* ── Header ─────────────────────────────── */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 0; flex-wrap: wrap;
}
.brand {
  font-weight: 800; font-size: 1.3rem; color: var(--text);
  text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.brand .logo-dot {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px;
}
.brand small { color: var(--primary); font-weight: 800; }
.main-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.main-nav a {
  color: var(--muted); text-decoration: none; font-size: .95rem;
  padding: 8px 12px; border-radius: 8px;
}
.main-nav a:hover, .main-nav a.active { background: var(--primary-soft); color: var(--primary-dark); }

/* ── Hero ───────────────────────────────── */
.hero {
  background: linear-gradient(180deg, #eef3ff 0%, var(--bg) 100%);
  padding: 56px 0 40px; text-align: center;
}
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); margin: 0 0 12px; line-height: 1.25; }
.hero p.lead { color: var(--muted); font-size: 1.1rem; max-width: 640px; margin: 0 auto; }

/* ── Cards ──────────────────────────────── */
.tools-grid {
  display: grid; gap: 18px; padding: 36px 0;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .tools-grid { grid-template-columns: repeat(3, 1fr); } }

.tool-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 22px; text-decoration: none; color: inherit;
  box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column; gap: 10px;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(37,99,235,.14); }
.tool-card .icon { display: inline-flex; color: var(--primary); }
.tool-card .icon svg { width: 2rem; height: 2rem; }
.tool-card h2, .tool-card h3 { margin: 0; font-size: 1.15rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .95rem; flex: 1; }
.tool-card .cta { color: var(--primary); font-weight: 700; font-size: .95rem; }

/* ── Content sections ───────────────────── */
.prose { padding: 12px 0 8px; }
.prose h2 { font-size: 1.45rem; margin: 34px 0 10px; }
.prose p { color: #33415c; }

/* ── Tool panel ─────────────────────────── */
.tool-panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 22px; margin: 28px 0;
}
.tool-panel h2 { margin-top: 0; font-size: 1.25rem; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 8px; font-size: .98rem; }
.field .hint { font-size: .85rem; color: var(--muted); font-weight: 400; }

input[type="text"], input[type="number"], input[type="date"], textarea, select {
  width: 100%; padding: 12px 14px; font-size: 1rem;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { min-height: 180px; resize: vertical; }

input[type="range"] { width: 100%; accent-color: var(--primary); }

.checks { display: grid; gap: 10px; }
.checks label {
  display: flex; align-items: center; gap: 10px; font-weight: 500;
  background: var(--bg); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 10px; cursor: pointer; margin: 0;
}
.checks input { width: 18px; height: 18px; accent-color: var(--primary); }
.checks code { background: #eef2f7; padding: 1px 7px; border-radius: 6px; font-size: .9em; }

.btn {
  display: inline-block; border: none; cursor: pointer;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 1rem;
  padding: 13px 26px; border-radius: 10px; text-decoration: none;
  transition: background .15s ease;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: #eef2f7; color: var(--text); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.field-error { color: var(--bad); font-weight: 600; min-height: 1.4em; margin: 10px 0 0; }

.result-box {
  background: var(--bg); border: 1.5px dashed var(--border);
  border-radius: 10px; padding: 18px; margin-top: 18px;
}
.result-box .big {
  font-size: 1.6rem; font-weight: 800; color: var(--primary-dark);
  word-break: break-all; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.result-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.result-row:last-child { border-bottom: none; }
.result-row .k { color: var(--muted); }
.result-row .v { font-weight: 700; }

.stats-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px;
}
@media (min-width: 560px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
.stat {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; text-align: center;
}
.stat .n { font-size: 1.5rem; font-weight: 800; color: var(--primary-dark); }
.stat .l { font-size: .85rem; color: var(--muted); }

/* strength meter */
.strength-wrap { margin-top: 14px; }
.strength-bar { height: 10px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.strength-fill { height: 100%; width: 0; border-radius: 99px; transition: width .3s ease, background .3s ease; }
.strength-label { font-weight: 700; margin-top: 6px; font-size: .95rem; }

/* tables */
.table-wrap { overflow-x: auto; margin-top: 14px; }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.data th, table.data td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { background: var(--bg); font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
table.data tbody tr:hover { background: #f8fbff; }

/* FAQ */
.faq { margin: 8px 0 30px; }
.faq details {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 10px; padding: 4px 18px;
}
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--primary); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: #33415c; margin-top: 0; }

/* related tools */
.related { padding: 10px 0 40px; }
.related h2 { font-size: 1.3rem; }
.related-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }

/* breadcrumbs */
.crumbs { font-size: .88rem; color: var(--muted); padding: 18px 0 0; }
.crumbs a { color: var(--primary); text-decoration: none; }

/* footer */
.site-footer {
  border-top: 1px solid var(--border); background: var(--card);
  margin-top: 30px; padding: 30px 0; color: var(--muted); font-size: .92rem;
}
.footer-inner { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary); }

/* ── Timer display ──────────────────────── */
.timer-display {
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--primary-dark);
  letter-spacing: .02em;
  line-height: 1.2;
}
.timer-display.finished { color: var(--bad); animation: timer-pulse 1s ease-in-out infinite; }
@keyframes timer-pulse { 50% { opacity: .5; } }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* tabs (sélecteurs de mode : TVA, pourcentage) */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  border: 1.5px solid var(--border); background: #fff; color: var(--muted);
  font-weight: 700; font-size: .95rem; padding: 10px 18px; border-radius: 10px;
  cursor: pointer; font-family: inherit;
}
.tab:hover { border-color: var(--primary); color: var(--primary-dark); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Pièce & dés (pile-ou-face, lancer-de-de) ─── */
.coin-stage { display: flex; justify-content: center; padding: 12px 0 6px; }
.coin {
  width: 132px; height: 132px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ffe9a8, #f5c542 55%, #c98a12);
  border: 6px solid #a86e0d;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; font-weight: 800; color: #7c4a03;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.coin.flipping { animation: coin-flip .95s ease-in-out; }
@keyframes coin-flip {
  0% { transform: rotateY(0); }
  100% { transform: rotateY(1800deg); }
}
.dice-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 18px; }
.die {
  width: 66px; height: 66px; border-radius: 14px;
  background: var(--card); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.45rem; font-weight: 800; color: var(--primary-dark);
  box-shadow: var(--shadow);
}
.die.rolling { animation: die-roll .55s ease; }
@keyframes die-roll {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(1); }
}
.history-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.history-chip {
  background: var(--bg); border: 1px solid var(--border); border-radius: 99px;
  padding: 5px 13px; font-size: .88rem; font-weight: 600; color: var(--text);
}

.brand-logo { width: 30px; height: 30px; border-radius: 8px; vertical-align: -8px; margin-right: 10px; }

/* ── Générateur de pseudo ─── */
.pseudo-list { display: grid; gap: 10px; margin-top: 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .pseudo-list { grid-template-columns: repeat(2, 1fr); } }
.pseudo-item {
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 13px 16px; font-size: 1.05rem; font-weight: 700; color: var(--primary-dark);
  cursor: pointer; font-family: inherit; text-align: left;
  transition: border-color .15s ease, background .15s ease;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.pseudo-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.pseudo-item .copy-hint { font-size: .78rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pseudo-item.copied { border-color: var(--ok); background: #eafbef; }
.pseudo-item.copied .copy-hint { color: var(--ok); }

/* ── Convertisseur de bases ─── */
.field-error { color: var(--bad); font-size: .9rem; font-weight: 600; margin-top: 4px; min-height: 1.4em; }
.steps-line { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .95rem; word-break: break-all; color: var(--text); }

.qr-wrap { text-align: center; margin-top: 18px; }
.qr-canvas { width: 100%; max-width: 300px; height: auto; image-rendering: pixelated; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.qr-empty { color: var(--muted); margin: 26px 0; }
.qr-error { color: var(--bad); font-weight: 600; margin: 18px 0; }

.draw-stage { text-align: center; margin-bottom: 6px; }
.draw-rolling { font-size: 1.5rem; font-weight: 800; color: var(--primary-dark); min-height: 2.4em; }
.winner-card { display: flex; align-items: center; gap: 12px; background: #fff; border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 16px; margin-top: 10px; }
.winner-rank { background: var(--primary); color: #fff; font-weight: 800; border-radius: 8px; padding: 4px 10px; }
.winner-name { font-size: 1.15rem; font-weight: 700; }
.winner-card.pop { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.number-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; min-height: 40px; }
.number-chip { background: var(--primary-soft); color: var(--primary-dark); font-weight: 800; font-size: 1.1rem; padding: 6px 14px; border-radius: 999px; }

/* ── Oui ou non (décideur) ─── */
.decision-result {
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  font-weight: 800; text-align: center; min-height: 2.2em;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.decision-result.yes { color: var(--ok); }
.decision-result.no { color: var(--bad); }
.decision-result.reveal { animation: decision-pop .5s ease; }
@keyframes decision-pop {
  0% { transform: scale(.6); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* ── Générateur de citations ─── */
.quote-card {
  background: var(--bg); border-left: 4px solid var(--primary);
  border-radius: 10px; padding: 22px 20px; margin-top: 6px;
}
.quote-text { font-size: 1.25rem; font-style: italic; line-height: 1.6; margin: 0; }
.quote-author { margin: 12px 0 0; color: var(--muted); font-weight: 700; }
.quote-card.swap { animation: quote-swap .4s ease; }
@keyframes quote-swap { 0% { opacity: 0; transform: translateY(8px); } 100% { opacity: 1; } }

.data-table-wrap { overflow-x: auto; margin: 18px 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.data-table th, .data-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: center; white-space: nowrap; }
.data-table th { background: var(--primary-soft); color: var(--primary-dark); }
.data-table tbody tr:nth-child(even) td { background: #f8fafd; }

/* ── Sélecteur de couleur ─── */
.color-top { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
input[type="color"] { width: 76px; height: 56px; padding: 5px; border: 1.5px solid var(--border); border-radius: 10px; background: #fff; cursor: pointer; }
.color-swatch { height: 110px; border-radius: 12px; border: 1px solid var(--border); margin: 18px 0 6px; background-color: #2563eb; transition: background-color .15s ease; }
.num-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.num-row .field { margin-bottom: 0; }
.copy-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; margin-top: 8px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 1rem; cursor: pointer; color: var(--text); }
.copy-line:hover { border-color: var(--primary); }
.copy-line .k { color: var(--muted); font-weight: 700; font-size: .85rem; }
.copy-line .v { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700; word-break: break-all; }
.copy-line .ok { color: var(--ok); font-weight: 700; font-size: .85rem; min-width: 64px; text-align: right; }

/* ── Extracteur d'emails ─── */
.email-list { list-style: none; margin: 12px 0 0; padding: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .95rem; word-break: break-all; }
.email-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.email-list li:last-child { border-bottom: none; }
.email-empty { color: var(--muted); }

/* Bandeau de consentement aux cookies */
.cookie-banner{position:fixed;left:0;right:0;bottom:0;z-index:1000;background:#1e293b;color:#fff;padding:1rem 1.25rem;display:flex;gap:1rem;align-items:center;justify-content:space-between;flex-wrap:wrap;box-shadow:0 -2px 12px rgba(0,0,0,.25)}
.cookie-banner[hidden]{display:none}
.cookie-banner p{margin:0;flex:1 1 240px;font-size:.92rem;line-height:1.45}
.cookie-actions{display:flex;gap:.5rem}
.cookie-actions button{border:0;border-radius:.5rem;padding:.55rem 1.15rem;font-weight:600;cursor:pointer;font-size:.92rem}
#cookie-accept{background:#2563eb;color:#fff}
#cookie-accept:hover{background:#1d4ed8}
#cookie-refuse{background:transparent;color:#fff;border:1px solid rgba(255,255,255,.55)}
