/* ======================================================================
   Système de design des pages (hors plateau de jeu)
   Fond violet uni, typo graphique, l'hexagone des losanges du jeu
   comme forme signature (boutons, puces, jetons).
   ====================================================================== */
@font-face {
  font-family: 'Unbounded';
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/unbounded/unbounded-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/unbounded/unbounded-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Unbounded';
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/unbounded/unbounded-latin-900-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/instrument-sans/instrument-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/instrument-sans/instrument-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/instrument-sans/instrument-sans-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/instrument-sans/instrument-sans-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}
/* Police du plateau TV */
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/barlow-condensed/barlow-condensed-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/barlow-condensed/barlow-condensed-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/barlow-condensed/barlow-condensed-latin-700-normal.woff2') format('woff2');
}

:root {
  --bg: #0e0819;
  --surface: #171028;
  --surface-2: #211735;
  --surface-3: #2c2045;
  --line: rgba(196, 176, 255, 0.13);
  --line-strong: rgba(196, 176, 255, 0.26);
  --text: #f5f1ff;
  --muted: #a598c2;
  --faint: #6d6189;
  --violet: #7b3fef;
  --lilac: #c4b0ff;
  --orange: #ff8a1f;
  --orange-2: #ffa54d;
  --ink: #170a02;
  --green: #3ad671;
  --red: #ff5a76;
  --font: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Unbounded', 'Instrument Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-board: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  /* Hexagone allongé : la découpe des losanges du jeu */
  --cut: 12px;
  --hex: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% 50%, calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 50%);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.page {
  min-height: 100vh;
  background:
    radial-gradient(60rem 40rem at 105% -10%, rgba(123, 63, 239, 0.28), transparent 60%),
    radial-gradient(40rem 30rem at -10% 110%, rgba(123, 63, 239, 0.12), transparent 60%),
    var(--bg);
}

/* grain très léger */
body.page::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: var(--text);
  text-decoration-color: var(--orange);
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  margin: 0 0 0.4em;
  line-height: 1.05;
  font-weight: 700;
}

::selection {
  background: var(--orange);
  color: var(--ink);
}

/* ---------- Typo ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(38px, 6.4vw, 88px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}
.h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 4.4vw, 52px);
  letter-spacing: -0.03em;
  line-height: 1;
}
.h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 2.6vw, 30px);
  letter-spacing: -0.02em;
}
.h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.lead {
  font-size: clamp(17px, 1.6vw, 21px);
  color: var(--muted);
  max-width: 40em;
  margin: 0;
}
.kicker,
.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--lilac);
  margin-bottom: 14px;
}
.kicker::before {
  content: '';
  width: 18px;
  height: 10px;
  background: var(--orange);
  clip-path: polygon(4px 0, 14px 0, 100% 50%, 14px 100%, 4px 100%, 0 50%);
}
.muted {
  color: var(--muted);
}
.faint {
  color: var(--faint);
}
.small {
  font-size: 14px;
}
.accent {
  color: var(--orange);
}

/* ---------- Mise en page ---------- */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}
.page-head {
  flex: 1 1 520px;
  margin: 12px 0 40px;
}
.page-head .h1 {
  margin-bottom: 14px;
}
.section {
  margin-top: 72px;
}
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.section-head .h2 {
  margin: 0;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}
.split > aside {
  position: sticky;
  top: 88px;
}
.grid {
  display: grid;
  gap: 18px;
}
.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.row.end {
  justify-content: flex-end;
}
.row.between {
  justify-content: space-between;
}
.stack > * + * {
  margin-top: 14px;
}
.hidden {
  display: none !important;
}
.center {
  text-align: center;
}

/* ---------- Navigation ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 68px;
  padding: 0 28px;
  background: rgba(14, 8, 25, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}
.brand svg {
  width: 44px;
  height: 26px;
  flex: none;
}
.brand span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11.5px;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.topbar nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.topbar nav a {
  position: relative;
  white-space: nowrap;
  padding: 8px 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}
.topbar nav a:hover {
  color: var(--text);
}
.topbar nav a.active {
  color: var(--text);
}
.topbar nav a.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -2px;
  height: 2px;
  background: var(--orange);
}
.who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}
.who:hover {
  border-color: var(--lilac);
}
.who .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
}

/* ---------- Boutons (découpe hexagonale) ---------- */
.btn {
  --b-bg: var(--surface-3);
  --b-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 26px;
  border: 0;
  clip-path: var(--hex);
  background: var(--b-bg);
  color: var(--b-fg);
  font: 600 15px/1.1 var(--font);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    transform 0.08s;
}
.btn:hover {
  --b-bg: #3a2b5c;
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible {
  outline: none;
  --b-bg: var(--text);
  --b-fg: var(--bg);
}
.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}
.btn.gold {
  --b-bg: var(--orange);
  --b-fg: var(--ink);
}
.btn.gold:hover {
  --b-bg: var(--orange-2);
}
.btn.green {
  --b-bg: var(--green);
  --b-fg: #04220e;
}
.btn.red {
  --b-bg: var(--red);
  --b-fg: #2a0010;
}
.btn.ghost {
  --b-bg: transparent;
  clip-path: none;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.btn.ghost:hover {
  --b-bg: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--lilac);
}
.btn.on {
  --b-bg: var(--lilac);
  --b-fg: var(--bg);
}
.btn.small {
  --cut: 9px;
  min-height: 34px;
  padding: 6px 16px;
  font-size: 14px;
}
.btn.big {
  --cut: 16px;
  min-height: 56px;
  padding: 14px 36px;
  font-size: 17px;
}
.btn.block {
  width: 100%;
}
.btn .arrow {
  transition: transform 0.15s;
}
.btn:hover .arrow {
  transform: translateX(3px);
}
.btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font: 500 13px var(--font-mono);
}
.icon-btn:hover {
  border-color: var(--lilac);
  background: var(--surface-2);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.icon-btn.wide {
  width: auto;
  padding: 0 14px;
  border-radius: 999px;
  gap: 8px;
  display: inline-flex;
  align-items: center;
}

/* ---------- Surfaces ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
.card.flat {
  background: transparent;
}
.card h2,
.card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.card h2 {
  font-size: 22px;
}
.card h3 {
  font-size: 16px;
}

/* Étiquettes */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font: 500 11.5px/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill.gold {
  color: var(--orange);
  border-color: rgba(255, 138, 31, 0.45);
}
.pill.green {
  color: var(--green);
  border-color: rgba(58, 214, 113, 0.45);
}
.pill.red {
  color: var(--red);
  border-color: rgba(255, 90, 118, 0.45);
}
.pill.solid {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--ink);
}

/* Puces sélectionnables (hexagones) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  --cut: 10px;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 11px 22px;
  border: 0;
  clip-path: var(--hex);
  background: var(--surface-2);
  color: var(--text);
  font: 500 15px var(--font);
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.chip:hover {
  background: var(--surface-3);
}
.chip .count {
  font: 500 11px var(--font-mono);
  color: var(--faint);
  letter-spacing: 0.05em;
}
.chip.on {
  background: var(--orange);
  color: var(--ink);
}
.chip.on .count {
  color: rgba(23, 10, 2, 0.6);
}
.chip.off {
  background: transparent;
  color: var(--faint);
  outline: 1px dashed var(--line-strong);
  outline-offset: -1px;
  clip-path: none;
  border-radius: 999px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.segmented button {
  --cut: 10px;
  padding: 10px 20px;
  border: 0;
  clip-path: var(--hex);
  background: var(--surface-2);
  color: var(--muted);
  font: 500 15px var(--font);
  cursor: pointer;
}
.segmented button:hover {
  color: var(--text);
}
.segmented button.on {
  background: var(--text);
  color: var(--bg);
}

/* ---------- Formulaires ---------- */
label.field {
  display: block;
}
label.field > span,
.field > .lbl {
  display: block;
  margin-bottom: 8px;
  font: 500 12px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
input[type='text'],
input[type='search'],
input[type='number'],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: 400 16px var(--font);
  transition: border-color 0.15s;
}
input:hover,
select:hover,
textarea:hover {
  border-color: rgba(196, 176, 255, 0.4);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--orange);
}
textarea {
  resize: vertical;
  min-height: 70px;
  line-height: 1.45;
}
select option {
  background: var(--surface);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
}

/* Code de partie */
.code-box {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 46px;
  letter-spacing: 0.14em;
  color: var(--text);
}
.code-input {
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  font-size: 30px !important;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
}
.linkline {
  display: flex;
  gap: 8px;
  align-items: center;
}
.linkline input {
  font: 13px var(--font-mono);
  padding: 10px 12px;
}

/* ---------- Modale & toasts ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 4, 15, 0.72);
  backdrop-filter: blur(4px);
  animation: fade 0.15s ease-out;
}
.modal {
  width: min(500px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 28px;
  font-family: var(--font);
  color: var(--text);
  animation: rise 0.2s ease-out;
}
.modal.wide {
  width: min(760px, 100%);
}
.modal h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.modal p {
  font-size: 17px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 8px;
}
.modal .actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 24px;
}
.modal .quote {
  margin: 4px 0 0;
  padding: 14px 18px;
  border-left: 3px solid var(--orange);
  background: var(--surface-2);
  color: var(--text);
  font-size: 19px;
  font-weight: 600;
}
.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 11px 18px 11px 16px;
  border-left: 3px solid var(--orange);
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text);
  font: 500 14px var(--font);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: rise 0.18s ease-out;
}
.toast.error {
  border-left-color: var(--red);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

/* ---------- Pied de page ---------- */
.foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}
.foot a {
  color: var(--muted);
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
  }
  .split > aside {
    position: static;
  }
}
@media (max-width: 760px) {
  .topbar {
    gap: 12px;
    padding: 0 16px;
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    margin: 0 -8px;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .topbar .who {
    margin-left: auto;
  }
  .wrap {
    padding: 28px 16px 60px;
  }
  .section {
    margin-top: 52px;
  }
  .code-box {
    font-size: 36px;
  }
}
