/* MondouQuiz — ambiance soirée de bar : ardoise sombre, ambre chaud, néons discrets */
:root {
  --bg: #12151c;
  --bg2: #1a1f2b;
  --card: #212837;
  --card2: #2a3246;
  --line: #333c52;
  --text: #f6f0e4;
  --muted: #9aa3b8;
  --gold: #f5b83d;
  --gold-dark: #c98f14;
  --red: #e5484d;
  --blue: #3b9eff;
  --green: #3ecf8e;
  --pink: #ff5fa2;
  --radius: 18px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  --display: "Avenir Next Condensed", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 15% -10%, rgba(245, 184, 61, .13), transparent 60%),
    radial-gradient(800px 500px at 100% 10%, rgba(255, 95, 162, .09), transparent 60%),
    radial-gradient(700px 600px at 50% 120%, rgba(59, 158, 255, .08), transparent 60%);
  background-attachment: fixed;
  line-height: 1.45; font-size: 17px; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); letter-spacing: .01em; margin: 0 0 .4em; line-height: 1.1; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h2 { font-size: 1.6rem; } h3 { font-size: 1.2rem; }
a { color: var(--gold); }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.wrap { width: min(1100px, 100% - 32px); margin: 0 auto; padding: 24px 0 60px; }
.narrow { width: min(560px, 100% - 28px); margin: 0 auto; padding: 22px 0 60px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* Logo */
.logo { font-family: var(--display); font-weight: 800; font-size: 1.5rem; display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.logo i { font-style: normal; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--gold), #ff8a3d); box-shadow: 0 4px 0 var(--gold-dark); font-size: 22px; }
.logo b { color: var(--gold); }

/* Cartes & formulaires */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.card.flat { box-shadow: none; background: var(--bg2); }
label { display: block; font-weight: 700; margin: 0 0 6px; font-size: .92rem; color: #d9d2c2; }
.field { margin-bottom: 14px; }
input:not([type=checkbox]), select {
  width: 100%; padding: 14px 16px; font: inherit; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: 14px; outline: none; transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--gold); }
input::placeholder { color: #667089; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 5px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.switch:last-child { border-bottom: 0; }
.switch small { display: block; color: var(--muted); font-weight: 400; }
.switch input { appearance: none; flex: none; width: 52px; height: 30px; border-radius: 30px; background: var(--line); position: relative; cursor: pointer; transition: .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 25px; }

/* Boutons */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800; letter-spacing: .01em;
  padding: 14px 22px; border-radius: 14px; color: #1b1405; background: linear-gradient(180deg, #ffd25e, var(--gold));
  box-shadow: 0 4px 0 var(--gold-dark); transition: transform .08s, box-shadow .08s, filter .15s; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-dark); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
.btn.big { padding: 18px 28px; font-size: 1.15rem; border-radius: 16px; }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: var(--card2); color: var(--text); box-shadow: 0 4px 0 #181d29; }
.btn.red { background: linear-gradient(180deg, #ff6b70, var(--red)); color: #fff; box-shadow: 0 4px 0 #a02a2e; }
.btn.green { background: linear-gradient(180deg, #5fe0a8, var(--green)); color: #06281a; box-shadow: 0 4px 0 #228a5d; }
.btn.small { padding: 8px 14px; font-size: .9rem; border-radius: 10px; box-shadow: 0 3px 0 var(--gold-dark); }
.btn.small.ghost { box-shadow: 0 3px 0 #181d29; }
.btn.tiny { padding: 4px 9px; font-size: .8rem; border-radius: 8px; box-shadow: none; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; padding: 6px; }

/* Accueil */
.hero { text-align: center; padding: 40px 0 10px; }
.hero h1 span { color: var(--gold); text-shadow: 0 0 30px rgba(245, 184, 61, .35); }
.hero p { color: var(--muted); font-size: 1.15rem; max-width: 560px; margin: 0 auto 28px; }
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 26px 0; }
.tile { display: block; text-decoration: none; color: var(--text); background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 26px 22px; transition: transform .15s, border-color .15s, box-shadow .15s; position: relative; overflow: hidden; }
.tile:hover { transform: translateY(-4px) rotate(-.4deg); border-color: var(--gold); box-shadow: 0 14px 30px rgba(0, 0, 0, .35); }
.tile .ico { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.tile h3 { font-size: 1.5rem; }
.tile p { color: var(--muted); margin: 0; font-size: .95rem; }
.joinbox { display: flex; gap: 10px; max-width: 420px; margin: 0 auto; }
.joinbox input { text-transform: uppercase; text-align: center; font-family: var(--display); font-size: 1.6rem; letter-spacing: .3em; font-weight: 800; }

/* Choix de thèmes */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.theme-chip { cursor: pointer; user-select: none; padding: 12px 10px; border-radius: 14px; background: var(--bg); border: 2px solid var(--line); text-align: center; font-weight: 700; font-size: .92rem; transition: .15s; position: relative; }
.theme-chip .e { font-size: 1.7rem; display: block; }
.theme-chip.on { border-color: var(--c, var(--gold)); background: color-mix(in srgb, var(--c, var(--gold)) 16%, var(--bg)); }
.theme-chip.on::after { content: "✓"; position: absolute; top: 5px; right: 9px; color: var(--c, var(--gold)); font-weight: 900; }
.seg { display: flex; background: var(--bg); border-radius: 14px; padding: 4px; border: 2px solid var(--line); gap: 4px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 70px; border: 0; font: inherit; font-weight: 700; color: var(--muted); background: transparent; padding: 10px 8px; border-radius: 10px; cursor: pointer; }
.seg button.on { background: var(--gold); color: #1b1405; }
.stepper { display: flex; align-items: center; gap: 0; }
.stepper button { width: 46px; height: 48px; border: 2px solid var(--line); background: var(--card2); color: var(--text); font-size: 1.4rem; font-weight: 800; cursor: pointer; }
.stepper button:first-child { border-radius: 14px 0 0 14px; } .stepper button:last-child { border-radius: 0 14px 14px 0; }
.stepper input { border-radius: 0; text-align: center; font-weight: 800; border-left: 0; border-right: 0; width: 80px; }

/* Pastilles, badges */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; font-size: .82rem; font-weight: 800; background: var(--card2); color: var(--text); }
.pill.gold { background: var(--gold); color: #1b1405; }
.pill.green { background: rgba(62, 207, 142, .18); color: var(--green); }
.pill.red { background: rgba(229, 72, 77, .18); color: #ff8e92; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: #555d73; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.teamdot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }

/* Jeu — éléments communs */
.qcard { background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 22px; }
.qmeta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.qtheme { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; padding: 6px 14px; border-radius: 99px; background: color-mix(in srgb, var(--c) 22%, var(--bg)); color: var(--c); border: 2px solid var(--c); }
.qtext { font-family: var(--display); font-weight: 800; font-size: clamp(1.45rem, 4.6vw, 2.2rem); line-height: 1.2; margin: 6px 0 18px; }
.diff { letter-spacing: 2px; color: var(--gold); font-size: .95rem; }
.timerbar { height: 12px; background: var(--bg); border-radius: 12px; overflow: hidden; margin-bottom: 14px; border: 1px solid var(--line); }
.timerbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--green), var(--gold) 60%, var(--red)); background-size: 100vw 100%; transform-origin: left; }
.choices { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.choice {
  --c: var(--blue); position: relative; appearance: none; border: 0; font: inherit; color: #fff; text-align: left; cursor: pointer;
  background: var(--c); border-radius: 16px; padding: 16px 16px 16px 62px; min-height: 76px; font-weight: 700; font-size: 1.08rem; line-height: 1.25;
  box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 55%, #000); display: flex; align-items: center; transition: transform .08s, box-shadow .08s, opacity .25s, filter .25s;
}
.choice:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 55%, #000); }
.choice::before { content: attr(data-l); position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: rgba(0, 0, 0, .25); font-family: var(--display); font-weight: 900; font-size: 1.3rem; }
.choice:nth-child(1) { --c: #e5484d; } .choice:nth-child(2) { --c: #3b82f6; } .choice:nth-child(3) { --c: #d99a12; } .choice:nth-child(4) { --c: #2fb67c; }
.choices.vf .choice { justify-content: center; padding-left: 16px; font-size: 1.5rem; min-height: 96px; }
.choices.vf .choice::before { display: none; }
.choices.vf .choice:nth-child(1) { --c: #2fb67c; } .choices.vf .choice:nth-child(2) { --c: #e5484d; }
.choice:disabled { cursor: default; }
.choice.picked { outline: 4px solid #fff; outline-offset: 2px; }
.choice.dim { opacity: .3; filter: grayscale(.7); }
.choice.right { outline: 4px solid #fff; animation: pop .5s; }
.choice.right::after { content: "✓"; position: absolute; right: 14px; font-size: 1.7rem; font-weight: 900; }
.choice .cnt { margin-left: auto; padding-left: 10px; font-family: var(--display); font-size: 1.5rem; opacity: .95; }
.choice.right .cnt { margin-right: 36px; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
.numinput { display: flex; gap: 10px; }
.numinput input { font-size: 1.6rem; font-weight: 800; text-align: center; }
.waiting { text-align: center; padding: 28px 10px; }
.waiting .big { font-size: 3rem; display: block; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.banner { padding: 14px 18px; border-radius: 14px; font-weight: 800; text-align: center; font-size: 1.15rem; }
.banner.good { background: rgba(62, 207, 142, .16); color: var(--green); border: 2px solid var(--green); }
.banner.bad { background: rgba(229, 72, 77, .14); color: #ff8e92; border: 2px solid var(--red); }
.banner.neutral { background: var(--card2); border: 2px solid var(--line); }
.paused { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 18, .82); backdrop-filter: blur(6px); display: grid; place-items: center; text-align: center; }
.paused h1 { font-size: clamp(3rem, 10vw, 6rem); }

/* Classements */
.rank { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rank li { display: flex; align-items: center; gap: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.rank li.me { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--bg2)); }
.rank .pos { font-family: var(--display); font-weight: 900; font-size: 1.4rem; width: 38px; text-align: center; color: var(--muted); }
.rank li:nth-child(1) .pos { color: var(--gold); } .rank li:nth-child(2) .pos { color: #cfd5e3; } .rank li:nth-child(3) .pos { color: #cd8a52; }
.rank .nm { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .nm small { display: block; font-weight: 500; color: var(--muted); }
.rank .pts { font-family: var(--display); font-weight: 900; font-size: 1.4rem; }
.rank .gain { font-size: .85rem; color: var(--green); font-weight: 800; margin-left: 6px; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin: 20px 0; min-height: 260px; }
.podium .step { width: min(190px, 30%); text-align: center; }
.podium .who { font-weight: 900; font-size: 1.2rem; margin-bottom: 6px; word-break: break-word; }
.podium .bar { border-radius: 16px 16px 0 0; display: flex; flex-direction: column; align-items: center; padding-top: 10px; font-family: var(--display); font-weight: 900; animation: rise 1s cubic-bezier(.2, .9, .3, 1.2) both; }
.podium .bar b { font-size: 2.4rem; } .podium .bar span { font-size: 1.2rem; opacity: .85; }
.podium .s1 .bar { height: 190px; background: linear-gradient(180deg, #ffd25e, var(--gold-dark)); color: #3b2a00; animation-delay: .6s; }
.podium .s2 .bar { height: 140px; background: linear-gradient(180deg, #dfe4ef, #8e98b0); color: #20263a; animation-delay: .3s; }
.podium .s3 .bar { height: 105px; background: linear-gradient(180deg, #e0a06a, #8d5a2d); color: #2d1a08; }
@keyframes rise { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
.podium .bar { transform-origin: bottom; }

/* Joueur (mobile) */
.phone { width: min(520px, 100%); margin: 0 auto; padding: 14px 14px 90px; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 2px 14px; }
.me-chip { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.score-chip { font-family: var(--display); font-weight: 900; font-size: 1.3rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; color: var(--gold); }
.teamlist { display: grid; gap: 8px; }
.teamopt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--bg); border: 2px solid var(--line); cursor: pointer; font-weight: 700; }
.teamopt.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--bg)); }
.teamopt small { margin-left: auto; color: var(--muted); font-weight: 500; }
.teamopt.full { opacity: .45; pointer-events: none; }

/* Admin */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.tabs button { border: 0; font: inherit; font-weight: 800; padding: 10px 16px; border-radius: 12px; background: var(--card); color: var(--muted); cursor: pointer; border: 1px solid var(--line); }
.tabs button.on { background: var(--gold); color: #1b1405; border-color: var(--gold); }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 8px; }
table.list td { padding: 8px; border-top: 1px solid var(--line); vertical-align: middle; }
table.list .num { text-align: right; font-family: var(--display); font-weight: 900; font-size: 1.15rem; }
.adj { display: inline-flex; gap: 4px; }
.qrbox { background: #fff; border-radius: 16px; padding: 10px; width: 100%; max-width: 280px; margin: 0 auto; }
.qrbox img { width: 100%; display: block; }
.big-code { font-family: var(--display); font-weight: 900; font-size: 3.2rem; letter-spacing: .25em; color: var(--gold); }
.log { max-height: 260px; overflow: auto; font-size: .88rem; color: var(--muted); }
.log div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.modal { position: fixed; inset: 0; background: rgba(8, 10, 15, .78); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal .card { max-width: 380px; width: 100%; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line); padding: 12px 20px; border-radius: 14px; font-weight: 700; z-index: 90; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: up .25s; }
.toast.err { border-color: var(--red); color: #ff9da0; }
@keyframes up { from { transform: translate(-50%, 20px); opacity: 0; } }
.conn { position: fixed; top: 0; left: 0; right: 0; background: var(--red); color: #fff; text-align: center; font-weight: 800; padding: 6px; z-index: 100; font-size: .9rem; }
.ctrlbar { position: sticky; bottom: 0; z-index: 20; background: linear-gradient(180deg, transparent, var(--bg) 30%); padding: 18px 0 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.ctrlbar .btn { flex: 1; min-width: 130px; }

/* Écran TV */
body.tv { font-size: clamp(18px, 1.6vw, 30px); overflow: hidden; height: 100vh; }
.tvwrap { height: 100vh; display: flex; flex-direction: column; padding: 2.2vh 3vw; gap: 2vh; }
.tvhead { display: flex; justify-content: space-between; align-items: center; gap: 2vw; }
.tvhead .logo { font-size: 1.6em; }
.tvmain { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 2.4vh; }
.tvq { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 4.2vw, 4.6rem); line-height: 1.12; text-align: center; }
.tv .choices { gap: 1.6vh 1.6vw; }
.tv .choice { font-size: clamp(1.2rem, 2.2vw, 2.4rem); min-height: 11vh; padding-left: 5.2vw; border-radius: 22px; cursor: default; }
.tv .choice::before { width: 3.4vw; height: 3.4vw; min-width: 38px; min-height: 38px; font-size: 1.8vw; left: 1vw; }
.tv .choices.vf .choice { font-size: 3vw; min-height: 15vh; }
.tv .timerbar { height: 2vh; border-radius: 2vh; }
.timer-num { font-family: var(--display); font-weight: 900; font-size: 3.2em; line-height: 1; min-width: 2.2ch; text-align: center; }
.timer-num.low { color: var(--red); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }
.tv .rank li { padding: 1.2vh 1.6vw; border-radius: 18px; }
.tv .rank .pos, .tv .rank .pts { font-size: 1.5em; }
.tvcols { display: grid; grid-template-columns: 1fr 1fr; gap: 3vw; align-items: start; }
.tvlobby { display: grid; grid-template-columns: minmax(260px, 30vw) 1fr; gap: 3vw; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 1vh 1vw; align-content: flex-start; }
.chip { background: var(--card); border: 2px solid var(--line); border-radius: 99px; padding: .3em .9em; font-weight: 800; display: inline-flex; align-items: center; gap: .5em; animation: pop .5s; }
.intro { text-align: center; }
.intro .big { font-size: 8vw; display: block; }
.intro h1 { font-size: 6vw; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

@media (max-width: 760px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .choices { grid-template-columns: 1fr; }
  .choices.vf { grid-template-columns: 1fr 1fr; }
  .tvlobby { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
