/* Jetons repris de Lorcana Scout — identiques sur tous les outils. */
:root {
  color-scheme: dark;
  --paper: #0a0a0f; --slab: #12121a; --slab-2: #1a1a26; --rule: #1e1e2e;
  --rule-strong: #2d2d4a;
  --ink: #e2e8f0; --ink-2: #9ca3af; --ink-3: #6b7280;
  --accent: #818cf8; --accent-soft: #221f45;
  --good: #27AE60; --warn: #F5A623; --warn-soft: #2a2113; --bad: #E74C3C;
  --amber: #F5A623; --amethyst: #9B59B6; --emerald: #27AE60;
  --ruby: #E74C3C; --sapphire: #2980B9; --steel: #7F8C8D;
  --heading: #ffffff;
  --header-bg: rgba(10,10,15,.95);
  --ui-bg: #1a1a26; --ui-border: #2d2d4a; --ui-fg: #e2e8f0; --ui-fg-strong: #fff;
}

html[data-theme="light"] {
  color-scheme: light;
  --paper: #f6f6fa; --slab: #ffffff; --slab-2: #eeeef5; --rule: #dcdbe6;
  --rule-strong: #c9c7d6;
  --ink: #14131c; --ink-2: #55536a; --ink-3: #8a889e;
  --accent: #4f46e5; --accent-soft: #e7e5fb;
  --good: #1e7a4e; --warn: #a76a12; --warn-soft: #fbf1de; --bad: #bb3a39;
  --amber: #d99b2b; --amethyst: #7b4fb5; --emerald: #1e8f5e;
  --ruby: #c9393f; --sapphire: #2f6fb0; --steel: #6b7180;
  --heading: #14131c;
  --header-bg: rgba(255,255,255,.95);
  --ui-bg: #ffffff; --ui-border: #d5d3e0; --ui-fg: #3f3d56; --ui-fg-strong: #14131c;
}
* { box-sizing: border-box; }
body {
  background: var(--paper); color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15.5px; line-height: 1.55; margin: 0; padding: 0 0 60px;
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 18px; }
h1, h2, h3 { font-weight: 600; color: var(--heading); text-wrap: balance; }
h1 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 21px; margin: 0; }
h3.sub-h { font-size: 17px; margin: 26px 0 4px; }
header.mast { padding: 26px 0 18px; }
header.mast h1, header.mast .eyebrow { display: none; }   /* repris par la barre */
/* Retour au portail + bascule de thème — identiques sur tous les outils. */
/* En-tête commune aux cinq outils ; seule la largeur de .app-bar-inner
   change d'un outil à l'autre (ici celle de .wrap). La barre est placée hors
   de .wrap pour occuper toute la largeur, son contenu restant centré. */
.app-bar {
  position: sticky; top: 0; z-index: 30;
  background: var(--header-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.app-bar-inner {
  max-width: 1000px; margin: 0 auto; padding: 12px 24px;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 16px;
}
.app-bar-end { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.app-title { text-align: center; min-width: 0; }
.app-name {
  font-size: 18px; font-weight: 700; letter-spacing: -.01em;
  background: linear-gradient(90deg, #F5A623, #9B59B6);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.app-sub { color: var(--ink-2); font-size: 12px; margin-top: 2px; }
/* Une seule ligne : la barre garde la meme hauteur d un outil a l autre,
   meme quand le sous-titre est long (nom de tournoi dans Matrice). */
.app-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) {
  .app-bar-inner { padding: 10px 14px; gap: 10px; }
  .app-sub { display: none; }
  .theme-btn span.lbl { display: none; }
}
.portal-link, .theme-btn {
  display: inline-flex; align-items: center;
  border-radius: 12px;
  background: var(--ui-bg); border: 1px solid var(--ui-border); color: var(--ui-fg);
  font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1;
  white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.portal-link { gap: 8px; padding: 6px 12px 6px 6px; }
/* Enfant direct de la grille : sans cela il occuperait toute la colonne. */
.app-bar-inner > .portal-link { justify-self: start; }
.theme-btn   { gap: 6px; padding: 7px 12px; }
.portal-link:hover, .theme-btn:hover { border-color: #4f46e5; color: var(--ui-fg-strong); }
.portal-link .chip {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, #F5A623, #9B59B6);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.eyebrow { font-size: 11.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 0 0 10px; }
.sub { color: var(--ink-2); font-size: 14px; max-width: 82ch; margin: 0; }
.inkdrops { display: inline-flex; gap: 5px; margin-right: 10px; vertical-align: middle; }
.inkdrops span { width: 11px; height: 11px; border-radius: 50%; display: block; }
.dim { color: var(--ink-3); font-weight: 400; }

.panel { background: var(--slab); border: 1px solid var(--rule); border-radius: 16px; padding: 20px 22px; margin: 18px 0; }
.panel .note { font-size: 12.5px; color: var(--ink-2); margin: 10px 0 0; max-width: 100ch; }

.drop {
  border: 2px dashed var(--rule-strong); border-radius: 16px; background: var(--slab-2);
  padding: 42px 20px; text-align: center; color: var(--ink-2); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.drop.busy { cursor: progress; opacity: .6; }
.drop-main { font-size: 17px; font-weight: 600; color: var(--ink); margin: 10px 0 2px; }
.drop-sub { font-size: 12.5px; margin: 0; }
kbd { font: inherit; font-size: 11px; background: var(--slab); border: 1px solid var(--rule);
      border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }

.result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.result-head .spacer { flex: 1 1 auto; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
        background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.fmt { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
select, input[type=number] { font: inherit; font-size: 13px; color: var(--ink); background: var(--slab-2);
        border: 1px solid var(--rule-strong); border-radius: 10px; padding: 5px 8px; }

textarea {
  width: 100%; font-family: Consolas, ui-monospace, monospace; font-size: 13.5px; line-height: 1.5;
  color: var(--ink); background: var(--slab-2); border: 1px solid var(--rule-strong); border-radius: 12px;
  padding: 12px 14px; resize: vertical;
}
table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin-top: 10px; }
th, td { text-align: right; padding: 5px 8px; white-space: nowrap; }
th:nth-child(2), td:nth-child(2) { text-align: left; white-space: normal; width: 100%; }
thead th { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
           font-weight: 700; border-bottom: 1px solid var(--rule); padding-bottom: 7px; }
tbody tr { border-bottom: 1px solid var(--rule); }
tbody tr:last-child { border-bottom: 0; }
tbody tr.low { background: var(--warn-soft); }
td input[type=number] { width: 58px; text-align: right; padding: 3px 5px; }
.ink-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: baseline; }
.score { font-family: Consolas, ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.score.ok { color: var(--good); } .score.mid { color: var(--warn); } .score.bad { color: var(--bad); }

button, .btn { font: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--slab-2); border: 1px solid var(--rule-strong); border-radius: 10px; padding: 6px 14px;
  cursor: pointer; transition: border-color .15s ease, filter .15s ease; }
button:hover { border-color: var(--accent); }
button.primary { background: linear-gradient(135deg, #4f46e5, #7c3aed); border-color: transparent; color: #fff; }
button.primary:hover { filter: brightness(1.1); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

details#preview-box { margin-top: 22px; border-top: 1px solid var(--rule); padding-top: 12px; }
details#preview-box summary { cursor: pointer; font-weight: 600; font-size: 14px; }
#overlay { max-width: 100%; height: auto; margin-top: 12px; border-radius: 12px; border: 1px solid var(--rule); }

.foot { color: var(--ink-3); font-size: 12px; margin-top: 30px; border-top: 1px solid var(--rule); padding-top: 14px; }

select.alt { max-width: 100%; font-size: 13px; padding: 3px 6px; }
