/* Kayen — charte : rouge Kayen #F73333, cramoisi #D01032, vert tige #37A434, encre #111, papier #FAFAFA, nuit #0E0E10
   Thème sombre par défaut (écrans de jeu) ; classe body.light pour l'espace client et le site. */
@font-face { font-family: 'Montserrat'; src: url('/fonts/montserrat-bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #0e0e10; --bg2: #16161a; --card: #1c1c21; --line: #2e2e36;
  --red: #f73333; --red-d: #d01032; --orange: #ff4236; --flame: #ff6b5e; --green: #37a434; --cream: #ffffff;
  --brand: #f73333; --brand-strong: #d01032; --leaf: #7dca23;
  --txt: #f4f4f6; --muted: #a0a0ab;
  /* Réponses : palette « piments » — Cayenne, Habanero, Jalapeño, Carolina Reaper (chocolat) */
  --a0: #c62828; --a1: #e8590c; --a2: #2e7d32; --a3: #6b3f1d;
  --a0-l: #e53935; --a1-l: #fb7c2c; --a2-l: #43a047; --a3-l: #8d5528;   /* dégradés des tuiles */
  --ic0: #ef5350; --ic1: #ff8a3d; --ic2: #66bb6a; --ic3: #c58a55;      /* icônes sur fond sombre */
  --radius: 14px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--txt); }
body {
  background: radial-gradient(ellipse at 50% 120%, rgba(247, 51, 51, .22), transparent 60%), var(--bg);
  background-attachment: fixed;
}
a { color: var(--flame); }
h1, h2, h3, .brand-font, button, .btn { font-family: 'Montserrat', system-ui, sans-serif; }
.hidden { display: none !important; }
.display { font-family: 'Montserrat', system-ui, sans-serif; font-weight: 700; letter-spacing: -.01em; color: var(--cream); }
.muted { color: var(--muted); }
.center { text-align: center; }

button, .btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: .75em 1.2em; cursor: pointer;
  background: var(--brand-strong); color: var(--btn-ink, #fff); box-shadow: 0 3px 0 var(--btn-shadow, #7a0a1e);
  transition: transform .05s, filter .15s; text-decoration: none; display: inline-flex; align-items: center; gap: .4em; justify-content: center;
}
button:hover, .btn:hover { filter: brightness(1.12); }
button:active, .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-shadow, #7a0a1e); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary, .btn.secondary { background: #2b2424; box-shadow: 0 3px 0 #120f0f; color: var(--txt); }
button.ghost, .btn.ghost { background: transparent; box-shadow: none; border: 1px solid var(--line); color: var(--txt); }
button.green { background: linear-gradient(180deg, #46b852, #23782d); box-shadow: 0 3px 0 #164d1c; }
button.small, .btn.small { padding: .4em .7em; font-size: .85em; }
input, select, textarea {
  font: inherit; color: var(--txt); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: .7em .8em; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); border-color: transparent; }
label { display: block; font-size: .85em; color: var(--muted); margin: .6em 0 .25em; }

.card { background: rgba(29, 25, 25, .92); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }

/* Formes des réponses (accessibilité : forme + couleur) */
.ans-0 { background: linear-gradient(160deg, var(--a0-l), var(--a0)); } .ans-1 { background: linear-gradient(160deg, var(--a1-l), var(--a1)); }
.ans-2 { background: linear-gradient(160deg, var(--a2-l), var(--a2)); } .ans-3 { background: linear-gradient(160deg, var(--a3-l), var(--a3)); }
.shape { font-size: 1.5em; line-height: 0; width: 1.3em; flex: none; display: inline-flex; justify-content: center; color: #fff; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.shape svg { display: block; }
.ic-0 { color: var(--ic0); } .ic-1 { color: var(--ic1); } .ic-2 { color: var(--ic2); } .ic-3 { color: var(--ic3); }
.ic-0, .ic-1, .ic-2, .ic-3 { filter: none; vertical-align: -0.25em; font-size: 1.35em; width: 1.1em; }

/* Barre de temps */
.timebar { height: 10px; background: #2a2222; border-radius: 99px; overflow: hidden; }
.timebar > div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--flame), var(--red)); transform-origin: left; }

.chip { display: inline-block; padding: .25em .7em; border-radius: 99px; background: #2b2121; border: 1px solid var(--line); font-size: .85em; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #2b2121; border: 1px solid var(--orange);
  padding: .7em 1.1em; border-radius: 10px; z-index: 1000; max-width: 92vw; box-shadow: 0 8px 30px #000a; }
.conn { position: fixed; top: 8px; right: 8px; font-size: .75em; padding: .25em .6em; border-radius: 99px; background: #4a1012; z-index: 999; }

@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes flicker { 0%, 100% { filter: drop-shadow(0 0 18px rgba(255, 90, 20, .55)); } 50% { filter: drop-shadow(0 0 30px rgba(255, 140, 30, .8)); } }
.pop { animation: pop .35s ease-out both; }
.logo-glow { animation: flicker 2.4s ease-in-out infinite; }
.chip.ans-0 { background: var(--a0); } .chip.ans-1 { background: var(--a1); } .chip.ans-2 { background: var(--a2); } .chip.ans-3 { background: var(--a3); }
.chip .shape { font-size: 1.4em; width: auto; }

/* ---------------------------------------------------------------- thème clair (site, espace client) */
body.light {
  --bg: #fafafa; --bg2: #ffffff; --card: #ffffff; --line: #e4e4e7; --txt: #111111; --muted: #5f5f69; --cream: #111111; --flame: #d01032;
  background: var(--bg); color: var(--txt);
}
body.light .card { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04); }
body.light input, body.light select, body.light textarea { background: #fff; color: var(--txt); border-color: #d4d4d8; }
body.light input:focus, body.light select:focus, body.light textarea:focus { outline-color: var(--brand-strong); }
body.light button.secondary, body.light .btn.secondary { background: #f1f1f3; color: #111; box-shadow: 0 2px 0 #d4d4d8; }
body.light button.ghost, body.light .btn.ghost { color: #111; border-color: #d4d4d8; }
body.light .chip { background: #f1f1f3; border-color: #e4e4e7; color: #111; }
body.light .toast { background: #111; color: #fff; }
.logo-bar { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.logo-bar img { height: 36px; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; border-radius: 99px; padding: .2em .7em; }
.badge.active { background: #e8f6e7; color: #1f6d1d; } .badge.pending { background: #fff4d6; color: #7a5600; } .badge.expired { background: #fde8eb; color: #a0102a; }

/* En-tête de l'espace client */
.kbar { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; z-index: 20; }
.kbar .logo-bar img { height: 40px; }
.kbar-mid { flex: 1; min-width: 0; }
.kbar-user { display: flex; align-items: center; gap: .8rem; font-size: .9rem; }
@media (max-width: 700px) { .kbar-user .muted { display: none; } .kbar { padding: .5rem .8rem; } .kbar .logo-bar img { height: 32px; } }
.page { max-width: 1000px; margin: 1.5rem auto; padding: 0 1rem; display: grid; gap: 1rem; }

/* ---------------------------------------------------------------- personnalisation (abonnés annuels) */
.ans-0, .ans-0 .shape { color: var(--on0, #fff); } .ans-1, .ans-1 .shape { color: var(--on1, #fff); }
.ans-2, .ans-2 .shape { color: var(--on2, #fff); } .ans-3, .ans-3 .shape { color: var(--on3, #fff); }
.shape img { width: 1em; height: 1em; object-fit: contain; display: block; }
img.client-logo { object-fit: contain; max-width: min(60vw, 22rem); max-height: 6rem; width: auto; }
.bar img.client-logo { max-height: 3.2rem; max-width: 14rem; }
.poweredby { position: fixed; right: .8rem; bottom: .6rem; z-index: 30; display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; color: rgba(255, 255, 255, .62) !important; text-decoration: none; padding: .2rem .5rem; border-radius: 99px; background: rgba(0, 0, 0, .35); }
.poweredby img { width: 1rem; height: 1rem; }
.poweredby b { font-family: 'Montserrat', system-ui, sans-serif; color: rgba(255, 255, 255, .85); }
body.light .poweredby { display: none; }
body.has-pw { padding-bottom: 1.7rem; }
.poweredby { pointer-events: auto; }

/* logos d'équipe (image importée ou emoji) */
img.teamlogo { width: 1.25em; height: 1.25em; object-fit: contain; vertical-align: -0.28em; border-radius: .2em; }
html.i18n-wait body { visibility: hidden; }

/* sélecteur de langue */
select.langpick { width: auto; padding: .35em .6em; font-size: .9rem; border-radius: 999px; }
.lp-corner { display: flex; justify-content: flex-end; margin-bottom: .6rem; }

/* Actualités en bas des pages de l'espace client */
.client-news { max-width: 1100px; margin: 1.5rem auto 2rem; padding: 0 1.2rem; }
.client-news .cn-title { font-size: 1.05rem; margin: 0 0 .6rem; }
.cn-list { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cn { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; }
body.light .cn { background: #fff; border-color: #e4e4e7; }
.cn.important { border-left: 4px solid var(--brand-strong); }
.cn-head { display: flex; align-items: baseline; gap: .6rem; }
.cn-head b { flex: 1; min-width: 0; }
.cn-head time { font-size: .8rem; white-space: nowrap; }
.cn-x { padding: .1em .5em !important; font-size: .8rem !important; }
.cn p { margin: .4rem 0 0; white-space: pre-line; line-height: 1.45; }
.cn a { display: inline-block; margin-top: .45rem; font-weight: 700; color: var(--brand-strong); }
