/* Identité Fakiha : doré et encre. L'étoile à huit branches du logo porte le numéro de place. */
:root {
  --gold: #fdca31;
  --gold-deep: #e08604;
  --gold-pale: #fff6d9;
  --paper: #fffdf6;
  --ink: #1a1206;
  --ink-soft: #5e5138;
  --line: #e4d9b8;
  --ok: #17693b;
  --warn: #8a4b00;
  --error: #a8261c;
  --display: 'El Messiri', Georgia, 'Times New Roman', serif;
  --body: 'Alegreya Sans', 'Gill Sans', 'Trebuchet MS', system-ui, sans-serif;
  --star: polygon(50% 0, 64.6% 14.6%, 85.4% 14.6%, 85.4% 35.4%, 100% 50%, 85.4% 64.6%, 85.4% 85.4%, 64.6% 85.4%, 50% 100%, 35.4% 85.4%, 14.6% 85.4%, 14.6% 64.6%, 0 50%, 14.6% 35.4%, 14.6% 14.6%, 35.4% 14.6%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.5 var(--body);
  font-variant-numeric: lining-nums;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: 48px;
}
[hidden] { display: none !important; }
h1, h2 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.5rem; }
p { margin: 0; }
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 2px; }

.page { max-width: 34rem; margin: 0 auto; display: grid; gap: 24px; }
.wide { max-width: 60rem; }
.brand { display: flex; align-items: center; gap: 12px; padding-top: 20px; }
.brand img { width: 64px; height: 64px; flex: none; }
.muted { color: var(--ink-soft); }
.small { font-size: .9rem; }

/* Formulaires */
form, .stack { display: grid; gap: 16px; }
label, legend { display: grid; gap: 4px; font-weight: 700; padding: 0; }
input, textarea, select {
  width: 100%;
  font: inherit;
  font-weight: 400;
  color: inherit;
  padding: 12px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 6px;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold-deep); outline: none; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 16px; }
.sex { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sex label { position: relative; }
.sex input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sex span { display: block; text-align: center; padding: 12px; border: 2px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.sex input:checked + span { background: var(--gold); border-color: var(--ink); }
.sex input:focus-visible + span { outline: 3px solid var(--gold-deep); outline-offset: 2px; }
.trap { position: absolute; left: -9999px; }

/* Boutons */
button, .button {
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 6px;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.primary { background: var(--gold); }
.primary:hover { background: #f5bb12; }
button:disabled { opacity: .5; cursor: wait; }
.big { width: 100%; min-height: 60px; font-size: 1.2rem; }
.quiet { border-color: var(--line); min-height: 40px; padding: 6px 12px; font-size: .9rem; font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.message { padding: 12px; border-radius: 6px; font-weight: 700; }
.message.error { background: #fbe6e3; color: var(--error); }
.message.ok { background: #e2f3e8; color: var(--ok); }
.message.warn { background: var(--gold-pale); color: var(--warn); }

/* Billet */
.ticket { background: #fff; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; }
.ticket header { background: var(--ink); color: var(--gold); padding: 16px; display: flex; gap: 12px; align-items: center; }
.ticket header img { width: 48px; height: 48px; }
.ticket header h1 { font-size: 1.4rem; }
.ticket .body { padding: 20px; display: grid; gap: 12px; justify-items: center; text-align: center; }
.ticket canvas { width: min(100%, 300px); height: auto; image-rendering: pixelated; }
.ticket .name { font-family: var(--display); font-size: 1.8rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }

/* Espace organisateurs */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--ink); }
.tabs button, .tabs a { border: 0; border-radius: 6px 6px 0 0; background: none; white-space: nowrap; font-weight: 700; padding-inline: 12px; }
.tabs [aria-selected="true"] { background: var(--ink); color: var(--gold); }
.tally { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 8px; }
.tally div { padding: 8px 12px; border-left: 6px solid var(--gold); background: var(--gold-pale); font-variant-numeric: tabular-nums; }
.tally div.side-h { border-left-color: var(--ink); }
.tally strong { display: block; font-family: var(--display); font-size: 1.6rem; line-height: 1.25; font-variant-numeric: lining-nums tabular-nums; }

.camera { position: relative; background: var(--ink); border-radius: 12px; overflow: hidden; aspect-ratio: 1; max-width: 26rem; width: 100%; margin: 0 auto; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera::after { content: ''; position: absolute; inset: 16%; border: 4px solid var(--gold); border-radius: 12px; pointer-events: none; }

.people { list-style: none; margin: 0; padding: 0; display: grid; }
.people li { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.people .who { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: space-between; }
.people .who > div { min-width: 0; overflow-wrap: anywhere; }
.chip { font-weight: 700; font-size: .85rem; padding: 2px 10px; border-radius: 99px; border: 1.5px solid var(--line); white-space: nowrap; }
.chip.present { background: #e2f3e8; color: var(--ok); border-color: transparent; }
.chip.seat-H { background: var(--ink); color: var(--gold); border-color: var(--ink); }
.chip.seat-F { background: var(--gold); color: var(--ink); border-color: var(--gold); }

.invite canvas { width: 180px; height: 180px; image-rendering: pixelated; }
.invite { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.invite > div { flex: 1 1 14rem; min-width: 0; display: grid; gap: 8px; overflow-wrap: anywhere; }

/* Résultat du scan et grand numéro de place */
.sheet {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; background: var(--paper);
  padding: calc(20px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px));
}
.sheet .inner { max-width: 30rem; margin: 0 auto; display: grid; gap: 16px; text-align: center; }
.sheet .name { font-family: var(--display); font-weight: 700; font-size: 2.1rem; line-height: 1.2; overflow-wrap: anywhere; }
.seat-star {
  width: min(82vw, 360px, 52vh); aspect-ratio: 1; margin: 0 auto;
  clip-path: var(--star);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: min(20vw, 5.6rem, 13vh); line-height: 1; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums;
}
.seat-star.H { background: var(--ink); color: var(--gold); }
.seat-star.F { background: var(--gold); color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .seat-star { animation: stamp .22s ease-out; }
  @keyframes stamp { from { transform: scale(1.25) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Feuille d'émargement */
.sign-table { width: 100%; min-width: 36rem; border-collapse: collapse; font-variant-numeric: lining-nums tabular-nums; }
.sign-table th, .sign-table td { border: 1px solid var(--ink); padding: 4px 8px; text-align: left; height: 11mm; overflow-wrap: break-word; }
.sign-table thead { display: table-header-group; }
.sign-table th { height: auto; background: var(--gold-pale); }
.sign-table tr { break-inside: avoid; }
.sign-table .c-seat { width: 16mm; font-weight: 700; }
.sign-table .c-sign { width: 38%; }
.sign-wrap { overflow-x: auto; }
.sign-section { display: grid; gap: 8px; }
@page { size: A4; margin: 12mm; }
@media print {
  body { padding: 0; background: #fff; font-size: 11pt; }
  .no-print { display: none !important; }
  .page { max-width: none; gap: 8px; }
  .sign-section + .sign-section { break-before: page; }
  .sign-table { min-width: 0; width: calc(100% - 2px); margin-left: 1px; }
  .sign-wrap { overflow: visible; }
  .sign-table th { background: none; }
  .brand { padding-top: 0; }
  .brand img { width: 40px; height: 40px; }
  h1 { font-size: 18pt; }
  h2 { font-size: 14pt; }
}
