/* Couleurs, typographie et composants communs. Mêmes teintes que l'application Windows et la page d'écoute. */
:root {
  color-scheme: dark;
  --bg: #0b1020; --bg2: #18224a; --surface: #121a33; --sheet: #151c36;
  --card: rgba(255,255,255,.055); --card-2: rgba(255,255,255,.03); --card-hover: rgba(255,255,255,.08);
  --line: rgba(255,255,255,.09); --line-strong: rgba(255,255,255,.2);
  --text: #eef1ff; --muted: #95a1c4; --faint: #6c7799;
  --accent: #6d8bff; --accent2: #a06bff; --accent-soft: rgba(109,139,255,.15); --accent-line: rgba(109,139,255,.55);
  --glow: rgba(109,139,255,.45);
  --ok: #3ddc97; --ok-soft: rgba(61,220,151,.12); --ok-line: rgba(61,220,151,.45);
  --warn: #ffc247; --warn-soft: rgba(255,194,71,.12); --warn-line: rgba(255,194,71,.4);
  --bad: #ff5d6c; --bad-soft: rgba(255,93,108,.12); --bad-line: rgba(255,93,108,.5);
  --radius: 16px; --radius-sm: 11px;
  --gutter: 16px;
  --header-h: 60px;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
}
@media (min-width: 720px) { :root { --gutter: 24px; } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg);
  background-image: radial-gradient(110% 60% at 25% 0%, var(--bg2), var(--bg) 70%); background-attachment: fixed;
  overflow-x: hidden;
}
@media (min-width: 720px) { body { font-size: 15.5px; } }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 5.2vw, 38px); font-weight: 720; }
h2 { font-size: clamp(20px, 3.6vw, 26px); font-weight: 680; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
.container.narrow { max-width: 760px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* ---- logo */
.logo { width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 4px 16px var(--glow); }
.logo svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }

/* ---- boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font-weight: 600; font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; -webkit-tap-highlight-color: transparent; }
.btn:hover { background: var(--card-hover); border-color: var(--line-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 20px rgba(109,139,255,.28); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: var(--bad-line); background: var(--bad-soft); color: #ffd6da; }
.btn.danger:hover { background: rgba(255,93,108,.2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--card); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.large { min-height: 54px; padding: 0 26px; font-size: 17px; border-radius: 14px; }
.btn.block { display: flex; width: 100%; }
.btn.icon-only { width: 44px; padding: 0; }
.btn.icon-only.small { width: 36px; }
.btn .ico { width: 18px; height: 18px; }
.button_to { display: inline; margin: 0; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; }

/* ---- cartes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
@media (min-width: 720px) { .card { padding: 22px; } }
.card.tight { padding: 14px 16px; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-title h2, .card-title h3 { margin: 0; }
.card-title .ico { color: var(--accent); }
.step-num { width: 26px; height: 26px; flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 750; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }

/* ---- pastilles d'état */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card-2); font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.chip.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.chip.bad { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft); }
.chip.accent { color: #c9d4ff; border-color: var(--accent-line); background: var(--accent-soft); }
.chip.live .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

/* ---- messages */
.flash-zone { padding-top: 14px; }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); margin-bottom: 10px; animation: flash-in .25s ease-out; }
.flash .ico { margin-top: 2px; }
.flash p { margin: 0; flex: 1; }
.flash.notice { border-color: var(--ok-line); background: var(--ok-soft); }
.flash.notice .ico { color: var(--ok); }
.flash.alert { border-color: var(--warn-line); background: var(--warn-soft); }
.flash.alert .ico { color: var(--warn); }
.flash button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } }
.notice-box { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--accent-line); background: var(--accent-soft); }
.notice-box > .ico { color: var(--accent); margin-top: 2px; width: 20px; height: 20px; }
.notice-box.warn { border-color: var(--warn-line); background: var(--warn-soft); }
.notice-box.warn > .ico { color: var(--warn); }
.notice-box p:last-child { margin-bottom: 0; }

/* ---- formulaires */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .form input[type=text], .form input[type=email], .form input[type=password], .form input[type=search],
.form input[type=datetime-local], .form input[type=date], .form select, .form textarea {
  width: 100%; min-height: 46px; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: rgba(0,0,0,.22); color: var(--text); font-size: 16px; /* 16px : pas de zoom automatique sur iPhone */
  transition: border-color .15s, box-shadow .15s; }
.form input:focus, .form select:focus, .form textarea:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form input[type=datetime-local], .form input[type=date] { color-scheme: dark; }
.field-row { display: grid; gap: 16px; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-errors { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--bad-line); background: var(--bad-soft); }
.form-errors h2 { font-size: 15px; margin: 0 0 6px; }
.form-errors ul { margin: 0; padding-left: 18px; }
.field_with_errors { display: contents; }
.field_with_errors input, .field_with_errors select { border-color: var(--bad-line) !important; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
@media (max-width: 519px) { .form-actions .btn { flex: 1 1 100%; } }

/* choix en cartes (qualité…) */
.choices { display: grid; gap: 8px; }
@media (min-width: 560px) { .choices.two { grid-template-columns: 1fr 1fr; } }
.choice { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 58px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--card-2); cursor: pointer; transition: border-color .12s, background .12s; }
.choice:hover { border-color: var(--line-strong); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .radio { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; }
.choice .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: transparent; transition: background .12s; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:checked) .radio { border-color: var(--accent); }
.choice:has(input:checked) .radio::after { background: var(--accent); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.choice b { display: block; font-weight: 650; }
.choice small { display: block; font-size: 13px; line-height: 1.35; }
.choice .tag { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ---- tableaux (cartes sur téléphone) */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 0 12px 10px; }
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--card-2); }
@media (max-width: 759px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: 14px; padding: 6px 4px; margin-bottom: 10px; background: var(--card-2); }
  .table td { border: 0; padding: 6px 12px; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; }
  .table td.main { font-weight: 650; text-align: left; }
  .table td.main::before { display: none; }
}

/* ---- lien copiable */
.copy-field { display: flex; align-items: center; gap: 6px; padding: 5px 5px 5px 14px; border-radius: 13px;
  border: 1px solid var(--line-strong); background: rgba(0,0,0,.25); min-width: 0; }
.copy-field > .btn { flex: 0 0 auto; }
.copy-field code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 600 15px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #dfe5ff; -webkit-user-select: all; user-select: all; }

/* ---- QR code */
.qr-frame { background: #fff; border-radius: 14px; padding: 12px; width: 100%; max-width: 240px; aspect-ratio: 1; }
.qr-frame .qr-svg { width: 100%; height: 100%; }

/* ---- menu de partage (feuille en bas d'écran sur téléphone, menu flottant sur ordinateur) */
.share { position: relative; display: inline-flex; }
.share-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(3,6,16,.55); animation: fade-in .15s ease-out; }
.share-menu { position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
  background: var(--sheet); border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow); animation: sheet-in .22s ease-out; }
.share-menu .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 2px auto 10px; }
.share-menu h3 { font-size: 15px; margin: 0 6px 10px; }
.share-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.share-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px;
  border: 0; background: none; color: var(--text); font-size: 12.5px; font-weight: 550; cursor: pointer; text-align: center; text-decoration: none; }
.share-item:hover { background: var(--card); text-decoration: none; }
.share-badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff;
  font: 800 17px/1 system-ui, sans-serif; background: var(--b, #3a4569); }
.share-badge .ico { width: 22px; height: 22px; stroke-width: 2; }
.share-menu .copy-field { margin-top: 10px; }
@media (min-width: 720px) {
  .share-backdrop { background: transparent; }
  .share-menu { position: absolute; left: 0; right: auto; bottom: auto; top: calc(100% + 8px); width: 360px; padding: 14px;
    border-radius: 16px; border-bottom: 1px solid var(--line-strong); animation: pop-in .15s ease-out; }
  .share-menu.up { top: auto; bottom: calc(100% + 8px); }
  .share-menu.to-left { left: auto; right: 0; }
  .share-menu .grab { display: none; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(30px); opacity: 0; } }
@keyframes pop-in { from { transform: translateY(-4px); opacity: 0; } }

/* ---- bulle « copié » */
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 10px 16px; border-radius: 12px; background: #f1f4ff; color: #0b1020; font-weight: 650; font-size: 14px;
  box-shadow: var(--shadow); animation: toast-in .2s ease-out; pointer-events: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 6px); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
