@import url('/static/fonts/fonts.css');

:root {
  --bg: #0d0c0b;
  --surface: #171513;
  --surface-2: #211e1b;
  --line: #2f2a25;
  --ink: #f3ede4;
  --muted: #a89f93;
  --gold: #e8b04a;
  --gold-ink: #1a1306;
  --red: #e2574c;
  --green: #6cc28a;
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 Inter, system-ui, sans-serif;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
/* halo de projecteur, très léger */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(60% 45% at 50% -5%, rgba(232, 176, 74, .10), transparent 70%);
  pointer-events: none; z-index: -1;
}

h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; margin: 0; }
p { margin: 0; }
a { color: var(--gold); }
svg { flex-shrink: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--gold-ink); padding: 10px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

/* ------------------------------------------------ marque */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: var(--gold); color: var(--gold-ink);
}
.brand-name { font-family: Fraunces, Georgia, serif; font-weight: 700; font-size: 18px; line-height: 1.1; }
.brand-name small { display: block; font: 500 12px/1.2 Inter, sans-serif; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

/* ------------------------------------------------ boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font: 600 15px/1 Inter, sans-serif; cursor: pointer; text-decoration: none;
  transition: transform .18s var(--ease), background-color .18s, border-color .18s, opacity .18s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--gold); color: var(--gold-ink); }
.btn-primary:hover { background: #f0bf61; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 14px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 999px; display: inline-grid; place-items: center;
  background: transparent; border: 1px solid var(--line); color: var(--muted); cursor: pointer;
  transition: color .18s, border-color .18s, transform .18s var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--muted); transform: translateY(-1px); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); }

/* ------------------------------------------------ champs */
.field { display: grid; gap: 8px; }
.field label, .label { font-weight: 600; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.error { color: var(--red); font-size: 14px; min-height: 1.4em; }
.input, select.input {
  width: 100%; min-height: 50px; padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  font: 16px Inter, sans-serif; transition: border-color .18s, box-shadow .18s;
}
.input:hover { border-color: #463f37; }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 176, 74, .18); }
.input[aria-invalid="true"] { border-color: var(--red); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a89f93' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 42px; }
input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.8); cursor: pointer; }

/* ------------------------------------------------ entrée */
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
[data-enter] > * { animation: enter .6s var(--ease) both; }
[data-enter] > *:nth-child(2) { animation-delay: .08s; }
[data-enter] > *:nth-child(3) { animation-delay: .16s; }
[data-enter] > *:nth-child(4) { animation-delay: .24s; }

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

/* ================================================ page code */
.gate { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.gate-top { padding: 24px 0; }
.gate-main { display: grid; place-items: center; padding: 24px 0 48px; }
.gate-card { width: 100%; max-width: 440px; display: grid; gap: 28px; text-align: center; }
.gate-card h1 { font-size: clamp(34px, 6vw, 48px); }
.gate-card .lead { color: var(--muted); font-size: 17px; }
.ticket {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 24px; display: grid; gap: 18px;
}
/* encoches de ticket */
.ticket::before, .ticket::after {
  content: ""; position: absolute; top: 50%; width: 22px; height: 22px; margin-top: -11px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 50%;
}
.ticket::before { left: -12px; clip-path: inset(0 0 0 50%); }
.ticket::after { right: -12px; clip-path: inset(0 50% 0 0); }
.code-boxes { display: flex; justify-content: center; gap: 12px; }
.code-boxes input {
  width: 68px; height: 80px; text-align: center; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  font: 700 34px Fraunces, Georgia, serif; caret-color: var(--gold);
  transition: border-color .18s, box-shadow .18s, transform .18s var(--ease);
}
.code-boxes input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 176, 74, .18); transform: translateY(-2px); }
.code-boxes.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.gate-foot { padding: 20px 0; color: var(--muted); font-size: 13px; text-align: center; }

/* ================================================ programmer */
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(13, 12, 11, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 16px; }
.bot-state { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--green); box-shadow: 0 0 0 4px rgba(108, 194, 138, .15); }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.page-head { padding: 48px 0 32px; display: grid; gap: 10px; }
.page-head h1 { font-size: clamp(32px, 5vw, 52px); }
.page-head p { color: var(--muted); font-size: 17px; max-width: 56ch; }

.layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px; padding-bottom: 64px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.panel h2 { font-size: 24px; margin-bottom: 6px; }
.panel > .hint { margin-bottom: 24px; }
.form { display: grid; gap: 22px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.steps { counter-reset: s; }
.step-num { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--gold); }

.drop {
  position: relative; display: grid; place-items: center; text-align: center; gap: 10px;
  min-height: 190px; padding: 24px; border-radius: var(--radius); cursor: pointer;
  border: 1.5px dashed #4a4239; background: var(--surface-2);
  transition: border-color .2s, background-color .2s, transform .2s var(--ease);
}
.drop:hover, .drop.over { border-color: var(--gold); background: #26221e; }
.drop.over { transform: scale(1.01); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: rgba(232, 176, 74, .12); color: var(--gold); }
.drop strong { font-size: 16px; }
.drop .hint { max-width: 32ch; }
.drop.has-file { border-style: solid; border-color: var(--gold); }
.file-chip { display: flex; align-items: center; gap: 12px; text-align: left; }
.file-chip .name { font-weight: 600; word-break: break-all; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--gold); transition: width .2s linear; }
.progress-wrap { display: none; gap: 8px; }
.progress-wrap.on { display: grid; }
.progress-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

.list { display: grid; gap: 12px; container-type: inline-size; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
  padding: 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line);
  transition: border-color .18s, transform .18s var(--ease);
}
.item:hover { border-color: #463f37; transform: translateY(-2px); }
.date-tile { width: 58px; text-align: center; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); padding: 6px 0; }
.date-tile .d { font: 700 22px/1.1 Fraunces, serif; }
.date-tile .m { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); }
.item-title { font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.item-meta span { display: inline-flex; align-items: center; gap: 5px; }
.item-actions { display: flex; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--muted); }
.pill.live { color: var(--red); border-color: rgba(226, 87, 76, .4); }
.pill.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: pulse 1.4s infinite; }
.pill.scheduled { color: var(--gold); border-color: rgba(232, 176, 74, .35); }
@keyframes pulse { 50% { opacity: .3; } }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty svg { color: #5a5148; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  transition: opacity .2s, transform .2s var(--ease); pointer-events: none; z-index: 20;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ================================================ salle */
.room { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.room-bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.stage-wrap { display: grid; align-content: center; gap: 20px; padding-top: 8px; padding-bottom: 40px; }
.stage {
  position: relative; aspect-ratio: 16 / 9; width: 100%; border-radius: var(--radius); overflow: hidden;
  background: #000; border: 1px solid var(--line); box-shadow: 0 40px 120px -40px rgba(232, 176, 74, .25);
}
.stage video { width: 100%; height: 100%; display: block; background: #000; }
.curtain {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  background: radial-gradient(70% 60% at 50% 40%, #241d14, #0b0a09);
}
.curtain[hidden] { display: none; }
.curtain-inner { display: grid; gap: 14px; justify-items: center; }
.curtain .eyebrow { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.countdown { display: flex; gap: clamp(8px, 2vw, 20px); font-family: Fraunces, serif; }
.countdown div { display: grid; gap: 2px; min-width: clamp(56px, 10vw, 96px); }
.countdown b { font-size: clamp(36px, 7vw, 72px); line-height: 1; font-variant-numeric: tabular-nums; }
.countdown span { font: 500 12px Inter, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.room-info { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.room-info h1 { font-size: clamp(26px, 4vw, 40px); }
.room-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 14px; margin-top: 8px; }
.room-meta span { display: inline-flex; align-items: center; gap: 6px; }
.room-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.note { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 14px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.note svg { color: var(--gold); margin-top: 2px; }

@container (max-width: 470px) {
  .item { grid-template-columns: auto 1fr; }
  .item-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--line); }
}

/* ------------------------------------------------ responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .row-2 { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .btn-block-m { width: 100%; }
  .bot-state .txt { display: none; }
  .item { grid-template-columns: auto 1fr; }
  .item-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .code-boxes input { width: 60px; height: 72px; }
  .room-controls, .room-controls .btn { width: 100%; }
}

/* ------------------------------------------------ dans Discord (activité) */
.in-discord .room-bar { display: none; }
.in-discord .room { grid-template-rows: 1fr; }
.in-discord .stage-wrap { padding-top: 16px; padding-bottom: 16px; }
