:root {
  --bg: #f6efe0;
  --bg-2: #efe4cc;
  --card: #fffaf0;
  --ink: #1f1a17;
  --muted: #6b5f55;
  --line: #dccfb4;
  --red: #d62839;
  --red-dark: #9e1b29;
  --gold: #c9a227;
  --gold-soft: #f3e3a6;
  --silver: #9aa3ad;
  --shadow: 0 2px 0 rgba(31, 26, 23, .08), 0 10px 30px -12px rgba(31, 26, 23, .25);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f;
    --bg-2: #211b15;
    --card: #241d17;
    --ink: #f4ead7;
    --muted: #b3a48f;
    --line: #3b3127;
    --gold-soft: #4a3d14;
    --shadow: 0 2px 0 rgba(0, 0, 0, .3), 0 10px 30px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17130f; --bg-2: #211b15; --card: #241d17; --ink: #f4ead7; --muted: #b3a48f;
  --line: #3b3127; --gold-soft: #4a3d14; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Inter, system-ui, sans-serif;
  overflow-x: hidden;
}
a { color: inherit; }
h1, h2 { font-family: Fraunces, Georgia, serif; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 4vw, 2rem); margin: 0 0 1rem; text-align: center; }

/* ---------- En-tête ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; }
.brand-badge {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--red); color: #fff; font: 14px Bungee, sans-serif;
}
.lang-toggle {
  border: 2px solid var(--ink); background: transparent; color: var(--ink);
  font: 700 14px Inter, sans-serif; padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.lang-toggle:hover { background: var(--ink); color: var(--bg); }

main { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ---------- Héros ---------- */
.hero { text-align: center; padding: 28px 0 40px; }
.hero h1 {
  font-family: Bungee, sans-serif; font-weight: 400;
  font-size: clamp(2.4rem, 10vw, 5.5rem); line-height: .95; margin: 0 0 12px;
  color: var(--red);
  text-shadow: 3px 3px 0 var(--ink);
}
.tagline { font-family: Fraunces, serif; font-style: italic; font-size: clamp(1.05rem, 3vw, 1.4rem); margin: 0 0 18px; color: var(--muted); }
.counter { font-size: 1.1rem; margin: 0 0 28px; }
.counter strong { font: 1.6rem Bungee, sans-serif; color: var(--ink); }

.big-button {
  --size: min(62vw, 260px);
  width: var(--size); height: var(--size); border-radius: 50%;
  border: 0; cursor: pointer; position: relative;
  background: radial-gradient(circle at 35% 30%, #ff6b78, var(--red) 45%, var(--red-dark));
  color: #fff; font: clamp(1.6rem, 7vw, 2.6rem) Bungee, sans-serif; letter-spacing: .04em;
  box-shadow: 0 14px 0 #6d121c, 0 26px 40px -10px rgba(0, 0, 0, .45), inset 0 -8px 20px rgba(0, 0, 0, .25);
  transition: transform .08s, box-shadow .08s;
  animation: wobble 3.5s ease-in-out infinite;
}
.big-button:hover { filter: brightness(1.06); }
.big-button:active, .big-button.pressed {
  transform: translateY(12px);
  box-shadow: 0 2px 0 #6d121c, 0 8px 20px -10px rgba(0, 0, 0, .45), inset 0 -4px 12px rgba(0, 0, 0, .25);
  animation: none;
}
@keyframes wobble {
  0%, 86%, 100% { rotate: 0deg; }
  89% { rotate: -4deg; } 92% { rotate: 4deg; } 95% { rotate: -2deg; }
}
.big-sub { margin: 26px 0 0; font-size: .9rem; color: var(--muted); }
.demo-note { margin: 8px auto 0; display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--gold-soft); font-size: .85rem; }

/* ---------- Roi ---------- */
.king {
  text-align: center; padding: 26px 18px 22px; margin: 0 auto 48px; max-width: 640px;
  border-radius: var(--radius); background: linear-gradient(160deg, var(--gold-soft), var(--card));
  border: 3px solid var(--gold); box-shadow: var(--shadow); position: relative;
}
.king-crown { font-size: 2.6rem; line-height: 1; margin-top: -48px; filter: drop-shadow(0 4px 2px rgba(0,0,0,.2)); }
.king h2 { margin: 6px 0 8px; }
.king-name { font: clamp(1.6rem, 6vw, 2.4rem) Bungee, sans-serif; margin: 0; word-break: break-word; }
.king-msg { font-family: Fraunces, serif; font-style: italic; margin: 6px 0; }
.king-gift, .king-paid, .king-none { color: var(--muted); margin: 4px 0; }
.king-paid strong { color: var(--ink); }

/* ---------- Boutons ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 12px 20px; cursor: pointer;
  font: 800 1rem Inter, sans-serif; margin-top: 12px;
}
.btn:disabled { opacity: .6; cursor: wait; }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-dark); }
.btn-red:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-dark); }
.btn-gold { background: var(--gold); color: #1f1a17; box-shadow: 0 4px 0 #8a6d12; }
.btn-gold:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a6d12; }
.btn-ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn-ghost:hover { border-color: var(--ink); }

/* ---------- Paliers ---------- */
.tiers { margin-bottom: 56px; }
.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tier {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 18px; border-radius: var(--radius); cursor: pointer; color: var(--ink);
  background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow);
  font: inherit; transition: transform .15s, border-color .15s;
}
.tier:hover { transform: translateY(-3px) rotate(-.5deg); border-color: var(--ink); }
.tier-price { font: 1.6rem Bungee, sans-serif; }
.tier-name { font-family: Fraunces, serif; font-weight: 800; font-size: 1.2rem; }
.tier-desc { color: var(--muted); font-size: .92rem; }
.tier-con .tier-price { color: var(--red); }
.tier-super { border-color: var(--silver); }
.tier-super .tier-price { color: var(--silver); }
.tier-platine { background: linear-gradient(135deg, var(--card), #e6eef7 50%, var(--card)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tier-platine { background: linear-gradient(135deg, var(--card), #2c3440 50%, var(--card)); } }
.tier-platine .tier-price { color: #6c8db3; }
.tier-roi { border-color: var(--gold); background: linear-gradient(160deg, var(--gold-soft), var(--card)); }
.tier-roi .tier-price { color: var(--gold); font-size: 1.2rem; }

/* ---------- Mur ---------- */
.wall-section { margin-bottom: 40px; text-align: center; }
/* Liste verticale : #numéro, nom, rang */
.wall {
  list-style: none; margin: 0 auto; padding: 0; max-width: 760px; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card);
}
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-top: 1px solid var(--line); min-width: 0;
}
.row:first-child { border-top: 0; }
.row-num { font: .9rem Bungee, sans-serif; color: var(--red); min-width: 3.2em; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-name { font-weight: 800; font-size: 1.05rem; overflow-wrap: anywhere; }
.row-gift { font-size: .8rem; color: var(--muted); }
.row-tier { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 10px; font-size: .8rem; }
.row-actions a { color: var(--muted); }
.report { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 2px 4px; }
.report:hover { color: var(--red); }
.row-super .row-tier { color: var(--silver); font-weight: 600; }
.row-platine .row-tier {
  font-weight: 800;
  background: linear-gradient(90deg, #6c8db3, #d8e6ff, #6c8db3); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 3s linear infinite;
}
@keyframes shine { from { background-position: 200% 0; } to { background-position: 0 0; } }

/* Podium : or, argent, bronze */
.row-gold, .row-silver, .row-bronze { padding-top: 16px; padding-bottom: 16px; }
.row-gold { background: linear-gradient(90deg, var(--gold-soft), var(--card) 70%); }
.row-gold .row-name { font: 1.35rem Bungee, sans-serif; }
.row-silver .row-name { font-size: 1.2rem; }
.row-gold .row-tier { color: var(--gold); font-weight: 800; }
.row-silver .row-tier { color: var(--silver); font-weight: 800; }
.row-bronze .row-tier { color: #cd7f32; font-weight: 800; }
.row-silver + .row-bronze, .row-gold + .row-silver { border-top-style: dashed; }
.row-bronze { border-bottom: 3px double var(--line); }
.row-dethrone {
  border: 0; border-radius: 999px; padding: 5px 10px; cursor: pointer;
  background: var(--gold); color: #1f1a17; font: 800 .78rem Inter, sans-serif;
}

.crown-wrap { position: relative; display: inline-grid; place-items: center; flex: none; }
.crown { width: 34px; height: 28px; stroke-width: 1.2; stroke-linejoin: round; }
.crown-gold .crown, .crown.crown-gold { fill: url(#g-gold); stroke: #8a6409; }
.crown-silver .crown { fill: url(#g-silver); stroke: #66707b; width: 30px; height: 24px; }
.crown-bronze .crown { fill: url(#g-bronze); stroke: #6e3d12; width: 28px; height: 22px; }
.crown-wrap.crown-gold .crown { width: 40px; height: 32px; animation: glow 2.2s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(242, 194, 48, .5)); }
  50% { filter: drop-shadow(0 0 9px rgba(255, 215, 80, .95)); }
}
/* Étincelles autour de la couronne d'or */
.crown-wrap.crown-gold::before, .crown-wrap.crown-gold::after {
  content: '✦'; position: absolute; color: #ffe27a; font-size: 13px; line-height: 1;
  text-shadow: 0 0 6px #ffd23f; animation: twinkle 1.6s ease-in-out infinite;
}
.crown-wrap.crown-gold::before { top: -8px; right: -6px; }
.crown-wrap.crown-gold::after { bottom: -2px; left: -8px; font-size: 10px; animation-delay: .8s; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(90deg); }
}

.row.fresh { animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.9); opacity: 0; background: var(--gold-soft); } }

@media (max-width: 560px) {
  .row { flex-wrap: wrap; row-gap: 4px; padding: 12px; }
  .row-main { flex-basis: calc(100% - 4.5em); }
  .row-tier { order: 4; margin-left: 3.2em; flex: 1; white-space: normal; }
  .row-actions { order: 5; }
  .crown-wrap + .row-main { flex-basis: calc(100% - 8em); }
}

/* Carte « Roi des Cons » dans les paliers */
.roi-current { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
.roi-current .crown { width: 30px; height: 24px; }
.roi-name { font: 1.15rem Bungee, sans-serif; overflow-wrap: anywhere; }
.roi-amount { font: 1.15rem Bungee, sans-serif; color: var(--gold); }
.roi-empty { font-family: Fraunces, serif; font-style: italic; }
.wall-empty { color: var(--muted); font-style: italic; }

/* ---------- Formulaire ---------- */
.form-dialog {
  border: 0; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 32px));
  background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
}
.form-dialog::backdrop { background: rgba(23, 19, 15, .6); backdrop-filter: blur(3px); }
.form-dialog form { padding: 22px; }
.form-dialog h2 { text-align: left; font-size: 1.5rem; margin-bottom: 14px; }
.form-tier { color: var(--red); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; font-weight: 600; font-size: .92rem; }
.field input {
  font: 400 1rem Inter, sans-serif; padding: 11px 12px; border-radius: 10px;
  border: 2px solid var(--line); background: var(--bg); color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--red); }
.field small { font-weight: 400; color: var(--muted); }
.chars { align-self: flex-end; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--red); flex: none; }
.accept { padding: 10px; border-radius: 10px; background: var(--bg-2); }
#giftFields { padding-left: 12px; border-left: 3px solid var(--line); margin-bottom: 12px; }
.form-error { background: #fde3e5; color: #8a1220; padding: 10px 12px; border-radius: 10px; font-size: .92rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.form-actions .btn { flex: 1 1 200px; }

/* ---------- Divers ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, calc(100% + 40px));
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; transition: transform .3s, visibility .3s; max-width: calc(100vw - 32px); z-index: 10;
  visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.foot { text-align: center; color: var(--muted); font-size: .88rem; padding: 30px 16px 40px; border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }

/* ---------- Page merci / certificat ---------- */
.thanks { text-align: center; padding: 20px 0 50px; }
.thanks h1 { font-family: Bungee, sans-serif; font-weight: 400; color: var(--red); font-size: clamp(2rem, 8vw, 4rem); margin: 0; text-shadow: 3px 3px 0 var(--ink); }
.thanks .sub { font-family: Fraunces, serif; font-size: 1.3rem; margin: 6px 0 4px; }
.thanks .num { font-size: 1.1rem; color: var(--muted); }
.thanks .num strong { font: 1.8rem Bungee, sans-serif; color: var(--ink); }
.cert-wrap { margin: 24px auto; max-width: 900px; }
.cert-wrap canvas { width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); display: block; }
.cert-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.cert-actions .btn { margin: 0; text-decoration: none; display: inline-block; }
.confetti { position: fixed; top: -20px; width: 10px; height: 14px; pointer-events: none; z-index: 20; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Pages texte ---------- */
.prose { max-width: 720px; margin: 0 auto; padding: 10px 0 40px; }
.prose h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); }
.prose h2 { text-align: left; font-size: 1.3rem; margin-top: 1.6rem; }

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