/* Mégafun — jeu de sondage. Rouge Mégafun + or de plateau télé. */
:root {
  --bg: #1C0705;
  --bg-deep: #120403;
  --row: #33100D;
  --line: #6A2520;
  --track: #3D0F0C;
  --red: #8B1816;
  --panel-a: #9A1D1A;
  --panel-b: #7A1512;
  --gold: #F5B800;
  --gold-2: #FFD34D;
  --text: #FFFFFF;
  --soft: #F7E6E3;
  --muted: #DDB8B3;
  --green: #2BC48A;
  --louf: #3B1A47;
  --display: 'Anton', 'Impact', sans-serif;
  --ui: 'Barlow', system-ui, sans-serif;
  --num: 'Barlow Condensed', 'Barlow', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg-deep); color: var(--text); font-family: var(--ui); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
::selection { background: var(--gold); color: var(--bg); }
a { color: var(--gold-2); }
a:hover { color: #fff; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: #B98F8A; }
h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }

/* ---------- phone shell ---------- */
.app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--bg); display: flex; flex-direction: column; padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); gap: 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.logo { width: 118px; height: auto; display: block; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.between { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.title { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.08; text-wrap: balance; }
.h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.num { font-family: var(--num); font-weight: 700; font-variant-numeric: tabular-nums; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); display: inline-block; }

/* ---------- buttons ---------- */
.btn { min-height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--row); color: #fff; font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; text-decoration: none; }
.btn:hover { border-color: var(--gold); color: #fff; }
.btn-primary { min-height: 64px; border-radius: 16px; border: 0; background: var(--gold); color: var(--bg); font-size: 19px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 18px; box-shadow: 0 6px 16px rgba(0,0,0,.4); text-decoration: none; width: 100%; }
.btn-primary:hover { background: var(--gold-2); color: var(--bg); }
.btn-primary:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { min-height: 44px; border-radius: 12px; font-size: 15px; padding: 0 12px; }
.btn-gold { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.btn-ghost { background: transparent; }
.icon-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.icon-btn.on { background: var(--gold-2); border-color: var(--gold-2); color: var(--bg); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.link-btn { background: none; border: 0; color: var(--muted); font-weight: 600; font-size: 15px; padding: 10px 0; text-decoration: none; }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 15px; font-weight: 700; }
.input { min-height: 54px; border-radius: 14px; border: 2px solid var(--line); background: var(--row); color: #fff; font-size: 18px; font-weight: 600; padding: 0 14px; caret-color: var(--gold-2); width: 100%; }
.input:focus { border-color: var(--gold); outline: none; }
textarea.input { padding: 14px 16px; resize: none; line-height: 1.3; }
.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.seg button { min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; color: #fff; font-size: 16px; font-weight: 700; }
.seg button[aria-checked="true"] { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.card { background: var(--row); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.check { display: flex; align-items: center; gap: 12px; }
.check input { accent-color: var(--gold); width: 24px; height: 24px; margin: 0; flex: none; }
.error { background: #3A2C05; border: 1.5px solid var(--gold); color: #FFE9A8; border-radius: 12px; padding: 10px 12px; font-size: 15px; }

/* ---------- question card ---------- */
.qcard { background: linear-gradient(180deg, var(--panel-a) 0%, var(--panel-b) 100%); border: 2px solid var(--gold); border-radius: 18px; padding: 14px 16px; box-shadow: 0 10px 26px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 12px; }
.qcard .q { font-family: var(--display); font-weight: 400; font-size: 24px; line-height: 1.15; text-wrap: balance; }
.qno { font-family: var(--display); font-size: 18px; color: var(--gold-2); }
.clock { font-family: var(--display); font-size: 40px; line-height: .9; font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar > div { height: 100%; background: var(--gold); border-radius: 4px; transition: width .25s linear; }
.urgent .bar > div { background: #fff; }

/* ---------- answers & rows ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--row); border: 1.5px solid var(--gold); border-radius: 10px; padding: 5px 10px; font-size: 14px; font-weight: 600; }
.pill .n { font-family: var(--display); color: var(--gold-2); }
.pill.off { background: transparent; border: 1.5px dashed var(--line); color: var(--muted); }
.pill.off .n { color: var(--muted); }
.row { background: var(--row); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.row.check-me { border: 1.5px solid var(--gold-2); }
.row.louf { background: var(--louf); }
.row.waiting { background: transparent; border: 1px dashed var(--line); }
.row .hd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.row .hd b { font-weight: 700; }
.row .ans { font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.row .ans.draft { color: var(--muted); font-style: italic; font-size: 18px; }
.line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ok { display: inline-flex; align-items: center; gap: 6px; background: var(--gold); color: var(--bg); border-radius: 999px; padding: 4px 11px 4px 5px; font-weight: 700; font-size: 14px; }
.ok b { width: 20px; height: 20px; border-radius: 50%; background: var(--bg); color: var(--gold-2); font-family: var(--display); font-weight: 400; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.tag { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 700; border: 1.5px solid var(--muted); color: var(--soft); }
.tag.gold { background: var(--gold-2); border-color: var(--gold-2); color: var(--bg); }
.hint { font-size: 14px; color: var(--gold-2); font-weight: 600; }
.menu { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.menu button { min-height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: #fff; font-weight: 600; font-size: 14px; padding: 0 10px; }
.menu button.cur { border-color: var(--gold); }

/* ---------- board (DJ reveal) ---------- */
.board-row { display: flex; align-items: center; gap: 10px; background: var(--row); border: 1.5px solid var(--line); border-radius: 12px; padding: 7px 8px 7px 12px; }
.board-row.open { background: linear-gradient(180deg, var(--panel-a) 0%, var(--panel-b) 100%); border-color: var(--gold); }
.board-row.nobody { background: transparent; border-style: dashed; }
.rk { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: var(--bg); font-family: var(--display); font-size: 16px; display: inline-flex; align-items: center; justify-content: center; }
.rk.dim { background: var(--line); color: var(--soft); }
.board-row .t { flex: 1; min-width: 0; }
.board-row .t b { display: block; font-size: 17px; }
.done { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.done i { color: var(--green); }
.tile { min-height: 72px; border-radius: 14px; border: 1.5px solid var(--gold-2); background: var(--row); color: #fff; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 8px 12px; text-align: left; }
.tile .k { font-size: 13px; font-weight: 700; color: var(--gold-2); display: flex; gap: 6px; align-items: center; }
.tile .v { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.tile.louf { background: var(--louf); }
.tile.shown { opacity: .6; }

/* ---------- ranking ---------- */
.winner { background: linear-gradient(180deg, var(--panel-a) 0%, var(--panel-b) 100%); border: 2px solid var(--gold); border-radius: 18px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.crown { flex: none; width: 60px; height: 60px; border-radius: 50%; background: var(--gold); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.trow { display: grid; grid-template-columns: 26px minmax(0, 1fr) 54px 44px; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; background: var(--row); font-size: 15px; }
.trow.head { background: none; padding-top: 0; padding-bottom: 0; font-size: 12px; color: var(--muted); font-weight: 600; }
.trow .r { text-align: right; }
.radio-row { display: flex; align-items: center; gap: 12px; background: var(--row); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.radio-row:has(input:checked) { background: var(--louf); border: 1.5px solid var(--gold-2); }
.radio-row input { accent-color: var(--gold); width: 20px; height: 20px; margin: 0; flex: none; }

/* ---------- lists ---------- */
.list-item { display: flex; align-items: center; gap: 12px; background: var(--row); border-radius: 14px; padding: 12px 14px; color: #fff; text-decoration: none; }
.list-item:hover { color: #fff; outline: 1.5px solid var(--gold); }
.badge { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 9px; background: var(--line); color: var(--soft); white-space: nowrap; }
.badge.live { background: var(--green); color: var(--bg); }
.team-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--row); border-radius: 999px; padding: 6px 6px 6px 12px; font-size: 14px; font-weight: 600; }
.team-chip button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); }
.team-chip .off { color: var(--muted); font-weight: 500; }
.qrbox { background: #fff; color: var(--bg); border-radius: 20px; padding: 16px; display: flex; align-items: center; gap: 16px; }
.qrbox img { width: 148px; height: 148px; flex: none; display: block; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #fff; color: var(--bg); border-radius: 12px; padding: 12px 16px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 10; max-width: 90vw; }
.offline { position: fixed; top: 0; left: 0; right: 0; background: var(--gold); color: var(--bg); text-align: center; font-weight: 700; padding: 6px; font-size: 14px; z-index: 10; }

@media (min-width: 700px) {
  .app { padding-top: 24px; }
}
.urgent-card { background: #3A2C05 !important; border-color: var(--gold) !important; }
sup { line-height: 0; }

/* ---------- projector (1280×720 stage, scaled to fit) ---------- */
body.screen { overflow: hidden; background: #000; }
.stage-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.stage { width: 1280px; height: 720px; flex: none; transform-origin: center; position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #6A120F 0%, #1C0705 60%, #120403 100%); color: #fff;
  display: flex; flex-direction: column; padding: 34px 44px 30px; gap: 24px; }
.s-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.s-logo { width: 180px; height: auto; display: block; flex: none; }
.s-pill { font-family: var(--display); font-size: 28px; color: var(--bg); background: var(--gold); border-radius: 12px; padding: 6px 16px; flex: none; }
.s-q { font-family: var(--display); font-weight: 400; line-height: 1.04; text-wrap: balance; margin: 0; }
.s-timer { flex: none; width: 280px; height: 280px; border-radius: 50%; border: 6px solid var(--gold); background: #3D0F0C; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: background .3s; }
.s-timer.urgent { background: var(--gold); color: var(--bg); }
.s-timer .d { font-family: var(--display); font-size: 120px; line-height: 1; font-variant-numeric: tabular-nums; }
.s-team { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 7px 14px; font-size: 17px; font-weight: 600; }
.s-team.on { background: var(--gold); color: var(--bg); }
.s-team.off { border: 2px dashed #8A3730; color: var(--muted); }
.s-board { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 92px; gap: 14px; align-content: start; background: #2E0907; border: 3px solid #7A1A16; border-radius: 22px; padding: 18px; perspective: 900px; }
.p { position: relative; height: 92px; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.p.open { transform: rotateX(-180deg); }
.p > div { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 14px; border: 3px solid var(--gold); display: flex; align-items: center; gap: 16px; padding: 0 20px; }
.p .front { background: #4E100D; border-color: #6A2520; justify-content: center; font-family: var(--display); font-size: 44px; color: #C07A72; }
.p .back { transform: rotateX(180deg); background: linear-gradient(180deg, #B8261F 0%, #8B1816 100%); }
.p .back.nobody { background: #2E0907; border-style: dashed; border-color: #8A3730; }
.p .rk { width: 42px; height: 42px; font-size: 24px; }
.p .pt { flex: none; width: 60px; height: 60px; border-radius: 10px; background: var(--bg); color: var(--gold-2); font-family: var(--display); font-size: 38px; display: flex; align-items: center; justify-content: center; }
.p .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.p .txt b { font-size: 26px; line-height: 1; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-chip { display: inline-flex; align-items: center; gap: 5px; background: rgba(28, 7, 5, .55); border-radius: 999px; padding: 3px 10px; font-size: 15px; font-weight: 600; color: var(--soft); }
.s-side { flex: none; width: 300px; display: flex; flex-direction: column; gap: 14px; }
.s-card { border-radius: 22px; padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; animation: pop .6s cubic-bezier(.2, .8, .2, 1); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .p { transition: none; } .s-card { animation: none; } }

/* ---------- responsive DJ layout ---------- */
.dj-grid { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.dj-grid > div { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dj-grid > .gc { margin-top: auto; gap: 10px; }
.rooms { display: grid; gap: 8px; }
@media (min-width: 700px) {
  body.dj .app, .app-wide { max-width: 860px; padding-left: 28px; padding-right: 28px; }
  body.dj .app-form { max-width: 600px; }
  .rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  body.dj .app { max-width: 1200px; padding: 24px 32px 28px; }
  body.dj .app-form { max-width: 640px; }
  .dj-grid { display: grid; grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); grid-template-areas: "a l" "c l"; grid-template-rows: auto 1fr; column-gap: 32px; row-gap: 18px; align-items: start; }
  .dj-grid > .ga { grid-area: a; }
  .dj-grid > .gl { grid-area: l; }
  .dj-grid > .gc { grid-area: c; margin-top: 0; }
  .rooms { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .qcard .q { font-size: 28px; }
}
@media (min-width: 1300px) {
  body.dj .app { max-width: 1320px; }
}
/* Team phone on a tablet: keep one readable column, centered */
@media (min-width: 700px) {
  body:not(.dj):not(.screen) .app { max-width: 560px; }
}
