/* =========================================================================
   Kdeb : identité « casino / poker », partagée par le site et le panel
   Tapis vert sombre, or, cartes ivoire, couleurs des rôles du bot.
   ========================================================================= */

:root {
  /* Salle et tapis */
  --bg: #08130f;
  --felt: #0d3b2b;
  --felt-light: #145a41;
  --surface: #0e1f18;
  --surface-2: #132a21;
  --surface-3: #1a362b;

  /* Texte */
  --text: #efe9da;
  --muted: #a5b5ac;
  --faint: #6f8579;

  /* Or et cartes */
  --gold: #d4af37;
  --gold-light: #f0d77a;
  --gold-dark: #a8862a;
  --gold-ink: #1d1604;
  --ivory: #f6f0e1;
  --ink: #18201c;
  --suit-red: #c0392b;
  --line: rgba(212, 175, 55, 0.16);
  --line-strong: rgba(212, 175, 55, 0.42);

  /* Rôles (mêmes teintes que les embeds du bot) */
  --civil: #2ecc71;
  --impostor: #e0564a;
  --mrwhite: #b07cc6;
  --blurple: #5865f2;
  --danger: #e5534b;

  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.35);
  --container: 1120px;
  --gutter: 16px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(20, 90, 65, 0.55), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font-body);
  overflow-x: hidden;
}

/* Grain léger du tapis, par-dessus tout le fond */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  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='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

img { max-width: 100%; display: block; }
a { color: var(--gold-light); text-underline-offset: 3px; }
a:hover { color: var(--gold); }
code {
  font: 0.88em/1.4 ui-monospace, "Cascadia Code", Consolas, monospace;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--gold-light);
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

.gold-text {
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 60%, var(--gold-dark));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

.suit { font-family: var(--font-display); color: var(--gold); }
.suit-red { color: var(--suit-red); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 700 0.95rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

.btn-gold {
  background: linear-gradient(180deg, var(--gold-light), var(--gold) 55%, var(--gold-dark));
  color: var(--gold-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 8px 22px rgba(212, 175, 55, 0.22);
}
.btn-gold:hover { color: var(--gold-ink); filter: brightness(1.06); }

.btn-discord { background: var(--blurple); color: #fff; box-shadow: 0 8px 22px rgba(88, 101, 242, 0.3); }
.btn-discord:hover { color: #fff; filter: brightness(1.1); }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { color: var(--text); background: rgba(212, 175, 55, 0.08); border-color: var(--gold); }

.btn-danger { background: transparent; color: var(--danger); border-color: rgba(229, 83, 75, 0.5); }
.btn-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 26px; font-size: 1.02rem; }

/* ---------- Notices ---------- */
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
}
.notice-error { border-color: rgba(229, 83, 75, 0.5); background: rgba(229, 83, 75, 0.1); }
.notice-gold { border-color: var(--line-strong); background: rgba(212, 175, 55, 0.08); }
.notice p { margin: 0; }

/* ---------- Faux Discord (aperçus) ---------- */
.dc {
  --dc-bg: #313338;
  --dc-embed: #2b2d31;
  --dc-text: #dbdee1;
  --dc-muted: #949ba4;
  --dc-head: #f2f3f5;
  background: var(--dc-bg);
  border-radius: 12px;
  padding: 16px 16px 14px 12px;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  line-height: 1.375;
  color: var(--dc-text);
  text-align: left;
}
.dc-msg { display: flex; gap: 12px; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--felt); padding: 4px; flex-shrink: 0; }
.dc-body { min-width: 0; flex: 1; }
.dc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.dc-name { color: var(--dc-head); font-weight: 700; }
.dc-app { background: var(--blurple); color: #fff; font-size: 0.62rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.dc-time { color: var(--dc-muted); font-size: 0.75rem; }

.dc-embed {
  background: var(--dc-embed);
  border-left: 4px solid var(--embed, var(--blurple));
  border-radius: 4px;
  padding: 10px 14px 12px 12px;
  max-width: 440px;
  display: grid;
  gap: 6px;
}
.dc-embed[hidden] { display: none; }
.dc-embed-title { color: var(--dc-head); font-weight: 700; }
.dc-embed p { margin: 0; }
.dc-embed strong { color: var(--dc-head); }
.dc-field-name { color: var(--dc-head); font-weight: 700; font-size: 0.85rem; }
.dc-embed-footer { color: var(--dc-muted); font-size: 0.75rem; margin-top: 2px; }
.dc-mention { background: rgba(88, 101, 242, 0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }
.dc-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; padding: 0 3px; user-select: none; }

.dc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #fff;
}
.dc-btn-primary { background: #5865f2; }
.dc-btn-secondary { background: #4e5058; }
.dc-btn-success { background: #248046; }
.dc-btn-danger { background: #da373c; }

/* ---------- Formulaires : jetons, interrupteurs, cartes d'option ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 14px; border: 0; padding: 4px 0 6px; margin: 0; }
.chip-option { cursor: pointer; }
.chip-option input { position: absolute; opacity: 0; pointer-events: none; }

/* Jeton : bord à damier ivoire + centre coloré à pointillés */
.chip {
  --chip: #2b3a33;
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: repeating-conic-gradient(from -7deg, var(--ivory) 0 14deg, var(--chip) 14deg 45deg);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4), 0 10px 18px rgba(0, 0, 0, 0.35);
  filter: saturate(0.25) brightness(0.7);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}
.chip::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--chip);
  border: 2px dashed rgba(246, 240, 225, 0.55);
}
.chip > span { position: relative; font: 800 1.35rem/1 var(--font-display); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.chip-1 { --chip: #b8322a; }
.chip-2 { --chip: #1f5fae; }
.chip-3 { --chip: #1b1b1b; }
.chip-option:hover .chip { filter: saturate(0.7) brightness(0.9); transform: translateY(-2px); }
.chip-option input:checked + .chip {
  filter: none;
  transform: translateY(-5px);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--gold), 0 9px 0 rgba(0, 0, 0, 0.35), 0 16px 26px rgba(0, 0, 0, 0.4);
}
.chip-option input:focus-visible + .chip { outline: 2px solid var(--gold-light); outline-offset: 8px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  cursor: pointer;
}
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-text { display: grid; gap: 2px; }
.switch-text small { color: var(--muted); font-size: 0.88rem; }

.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: #33463d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ivory);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}
.switch:checked { background: linear-gradient(180deg, var(--gold-light), var(--gold)); }
.switch:checked::after { transform: translateX(20px); }

.option-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; border: 0; padding: 0; margin: 0; }
.option-card { position: relative; cursor: pointer; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card-body {
  display: grid;
  gap: 4px;
  height: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.option-card-body .icon { font-size: 1.4rem; }
.option-card-body small { color: var(--muted); }
.option-card:hover .option-card-body { border-color: var(--line-strong); }
.option-card input:checked + .option-card-body {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.14), rgba(212, 175, 55, 0.04));
  box-shadow: inset 0 0 0 1px var(--gold);
}
.option-card input:focus-visible + .option-card-body { outline: 2px solid var(--gold-light); outline-offset: 3px; }

/* ---------- Dos de carte (motif losanges) ---------- */
.card-back {
  background-color: #6d1a16;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.07) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.07) 75%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.07) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.07) 75%);
  background-size: 14px 14px;
  box-shadow: inset 0 0 0 6px #6d1a16, inset 0 0 0 7px var(--gold), var(--shadow-sm);
}
.card-back.green { background-color: #0d3b2b; box-shadow: inset 0 0 0 6px #0d3b2b, inset 0 0 0 7px var(--gold), var(--shadow-sm); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 18px;
  right: 18px;
  left: auto;
  z-index: 50;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: #10261d;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--gold);
  box-shadow: var(--shadow);
  animation: toast-in 0.35s ease both;
}
.toast.is-leaving { animation: toast-out 0.3s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-12px); } }

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