/* ============ Thème MomoGaming : bleu ciel, blanc, jaune ============ */
:root {
  --bg: #eef6ff;
  --panel: #ffffff;
  --panel2: #f2f8ff;
  --line: #d9e7fa;
  --text: #0d1f52;
  --muted: #6479a3;
  --blue: #1f7bff;
  --blue-d: #0c4fd1;
  --sky: #8fd0ff;
  --navy: #0b1c4f;
  --yellow: #ffd21a;
  --yellow-d: #d8a600;
  --green: #17b866;
  --red: #ff4258;
  --amber: #e69a00;
  --r: 18px;
  --shadow: 0 10px 30px rgba(31, 123, 255, .12), 0 2px 6px rgba(13, 31, 82, .06);
  --font-title: 'Fredoka', 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cg fill='%23ffd21a' opacity='.35'%3E%3Crect x='34' y='24' width='6' height='22' rx='3'/%3E%3Crect x='26' y='32' width='22' height='6' rx='3'/%3E%3C/g%3E%3Cg fill='%231f7bff' opacity='.12'%3E%3Crect x='164' y='120' width='7' height='26' rx='3.5'/%3E%3Crect x='154.5' y='129.5' width='26' height='7' rx='3.5'/%3E%3C/g%3E%3Ccircle cx='120' cy='60' r='4' fill='%231f7bff' opacity='.12'/%3E%3Ccircle cx='60' cy='170' r='3' fill='%23ffd21a' opacity='.5'/%3E%3C/svg%3E"),
    radial-gradient(1200px 500px at 50% -120px, #cfe8ff 0%, transparent 70%),
    linear-gradient(180deg, #f5faff 0%, var(--bg) 100%);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; }
h1, h2, h3, .title { font-family: var(--font-title); font-weight: 700; letter-spacing: .2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.wrap { max-width: 980px; margin: 0 auto; padding: 18px 16px 70px; }
.wrap.narrow { max-width: 580px; }

/* ---------- En-tête ---------- */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-title); font-weight: 700; font-size: 17px; color: var(--navy); }
.brand .avatar { width: 42px; height: 42px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(31,123,255,.35); background: var(--sky); }
.brand small { display: block; color: var(--blue); font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; margin-top: 1px; }
.pills { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pill { background: #fff; border: 2px solid var(--line); border-radius: 99px; padding: 8px 15px; font-size: 13.5px; font-weight: 800; cursor: pointer; color: var(--muted); transition: .15s; }
.pill:hover { color: var(--text); border-color: #bcd5f6; }
.pill.on { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 3px 0 var(--blue-d); }
.pill .n { background: var(--red); color: #fff; border-radius: 99px; padding: 0 7px; margin-left: 4px; font-size: 11px; }

.banner { display: block; width: 100%; border-radius: 22px; box-shadow: var(--shadow); border: 4px solid #fff; background: #fff; aspect-ratio: 1156 / 186; object-fit: cover; }
.banner.strip { aspect-ratio: auto; height: 84px; object-position: center; margin-bottom: 14px; }

/* ---------- Panneaux ---------- */
.panel { background: var(--panel); border: 1px solid #e3eefc; border-radius: 22px; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 14px; font-size: 20px; color: var(--navy); }

/* ---------- Boutons (style "jeu") ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  font-family: var(--font-title); font-weight: 600; font-size: 16px; letter-spacing: .2px;
  padding: 12px 20px; border-radius: 14px; background: #fff; color: var(--text);
  border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line);
  transition: transform .08s, box-shadow .08s, filter .15s, background .15s; user-select: none; }
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.btn.yellow { background: var(--yellow); color: var(--navy); border-color: var(--yellow); box-shadow: 0 4px 0 var(--yellow-d); }
.btn.blue { background: linear-gradient(180deg, #3b8dff, var(--blue)); color: #fff; border-color: var(--blue); box-shadow: 0 4px 0 var(--blue-d); }
.btn.red { background: var(--red); color: #fff; border-color: var(--red); box-shadow: 0 4px 0 #c51f35; }
.btn.ghost { background: #fff; }
.btn.sm { padding: 8px 13px; font-size: 14px; border-radius: 11px; box-shadow: 0 3px 0 var(--line); }
.btn.sm.yellow { box-shadow: 0 3px 0 var(--yellow-d); }
.btn.sm.blue { box-shadow: 0 3px 0 var(--blue-d); }
.btn.sm.red { box-shadow: 0 3px 0 #c51f35; }
.btn.block { width: 100%; }
.btn.xl { padding: 17px 22px; font-size: 20px; border-radius: 18px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 8px; border-radius: 10px; display: grid; place-items: center; transition: .15s; }
.icon-btn:hover { color: var(--red); background: #fff0f2; }

/* ---------- Champs ---------- */
.lbl { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; margin: 20px 0 10px; color: var(--navy); }
.lbl .k { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-family: var(--font-title); font-size: 14px; box-shadow: 0 2px 0 var(--blue-d); transition: .2s; flex: none; }
.lbl.done .k { background: var(--green); box-shadow: 0 2px 0 #0e8a4a; font-size: 0; }
.lbl.done .k::after { content: '✓'; font-size: 15px; }
input[type=text], input[type=password] {
  width: 100%; padding: 14px 16px; font: inherit; font-weight: 700; font-size: 16px; border-radius: 14px; border: 2px solid var(--line);
  background: #fff; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #9fb0cf; font-weight: 600; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31,123,255,.15); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); }

.msg { padding: 12px 14px; border-radius: 12px; margin-top: 12px; font-size: 14.5px; font-weight: 700; }
.msg.err { background: #ffeef0; color: #c4192e; border: 1px solid #ffd0d6; }
.msg.ok { background: #e6f9ef; color: #0d7a42; border: 1px solid #bdeed3; }

/* ---------- Sélecteur de rang ---------- */
.ranks { display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); gap: 8px; }
.rk { position: relative; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 12px 4px 9px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; box-shadow: 0 3px 0 var(--line);
  transition: transform .12s, border-color .12s, background .12s, box-shadow .12s; }
.rk:hover:not(:disabled) { transform: translateY(-2px); border-color: #a9cbf8; }
.rk:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.rk .nm { font-size: 12.5px; font-weight: 800; color: var(--muted); text-align: center; line-height: 1.1; }
.rk.sel { border-color: var(--blue); background: #eaf3ff; box-shadow: 0 3px 0 var(--blue); }
.rk.sel .nm { color: var(--blue-d); }
.rk.good { border-color: var(--green); background: #e6f9ef; box-shadow: 0 3px 0 var(--green); }
.rk.good .nm { color: #0d7a42; }
.rk.bad { border-color: var(--red); background: #ffeef0; box-shadow: 0 3px 0 var(--red); }
.rk.bad .nm { color: #c4192e; }
.rk .tag { position: absolute; top: -10px; right: -6px; font-size: 12px; font-weight: 900; padding: 2px 8px; border-radius: 99px; color: #fff; }
.rk.good .tag { background: var(--green); }
.rk.bad .tag { background: var(--red); }
.rk:disabled { cursor: default; }
.rk svg { filter: drop-shadow(0 4px 6px rgba(13,31,82,.25)); }
.divs { margin-top: 12px; animation: slide .22s ease; }
.divs-head { font-size: 14px; font-weight: 800; margin: 0 0 8px 2px; color: var(--navy); }
.divs-head .muted { font-weight: 700; }
@keyframes slide { from { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 560px) { .ranks.tiers { grid-template-columns: repeat(3, 1fr); } .rk .nm { font-size: 11.5px; } }

/* ---------- Statuts ---------- */
.st { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.st.pending { background: #fff4d6; color: #a86e00; }
.st.queued { background: #e3f0ff; color: var(--blue-d); }
.st.played { background: #e6f9ef; color: #0d7a42; }
.st.rejected { background: #ffeef0; color: #c4192e; }

/* ---------- Bandeau envois ouverts / fermés ---------- */
.gate { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 16px; font-weight: 800; font-size: 15px; margin-bottom: 16px; border: 2px solid; background: #fff; }
.gate.open { border-color: #bdeed3; color: #0d7a42; }
.gate.closed { border-color: #ffd0d6; color: #c4192e; }
.gate .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }
.gate.open .dot { animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }
.gate .clock { margin-left: auto; font-family: var(--font-title); font-size: 20px; font-variant-numeric: tabular-nums; background: #e6f9ef; padding: 2px 10px; border-radius: 10px; }
.gate .clock:empty { display: none; }

/* ---------- Progression ---------- */
.bar { height: 14px; background: #e3eefc; border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--blue), #4fb3ff); transition: width .3s ease;
  background-size: 30px 30px; background-image: linear-gradient(90deg, var(--blue), #4fb3ff), repeating-linear-gradient(45deg, rgba(255,255,255,.25) 0 10px, transparent 10px 20px); background-blend-mode: overlay; }

/* ---------- Fenêtres ---------- */
.modal { position: fixed; inset: 0; background: rgba(11, 28, 79, .45); backdrop-filter: blur(5px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fadein .15s ease; }
@keyframes fadein { from { opacity: 0; } }
.modal-box { background: #fff; border-radius: 22px; padding: 24px; max-width: 430px; width: 100%; box-shadow: 0 25px 70px rgba(11,28,79,.35); animation: pop .2s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.modal-msg { font-size: 16.5px; line-height: 1.45; font-weight: 700; color: var(--navy); }
.modal-acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); padding: 13px 20px; border-radius: 14px; font-weight: 800; font-size: 15px; z-index: 110; box-shadow: 0 12px 30px rgba(11,28,79,.25); animation: toastin .25s cubic-bezier(.2,1.4,.4,1); }
@keyframes toastin { from { transform: translate(-50%, 20px); opacity: 0; } }
.toast.ok { background: var(--green); color: #fff; }
.toast.err { background: var(--red); color: #fff; }

/* ---------- Confettis ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

.bounce { animation: bounce 1.3s ease-in-out infinite; }
@keyframes bounce { 50% { transform: translateY(-6px); } }

/* Bouton Discord */
.btn.discord { background: #5865f2; color: #fff; border-color: #5865f2; box-shadow: 0 4px 0 #3c45a5; text-decoration: none; }
.btn.discord:active { box-shadow: none; }
