﻿@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Thème Eclipse — sombre brun avec accent jaune Minecraft/Compétitif */
  --bg0:     #0a0500;   /* fond le plus sombre */
  --bg:      #120a02;   /* main / éditeur */
  --bg1:     #1a0f00;   /* sidebar / topbar */
  --bg2:     #0f172a;   /* cartes (slate façon old) */
  --bg3:     #1e293b;   /* hover */
  --bg4:     #334155;   /* actif */
  --bg5:     #475569;   /* surface haute */

  --border:  #1e293b;
  --border2: #334155;
  --border3: #facc1533;   /* jaune 20 % — signature Eclipse */
  --border4: #facc1566;

  --text:    #f8fafc;
  --muted:   #a1a1aa;
  --muted2:  #71717a;

  /* Accent jaune + ambre */
  --accent:  #facc15;
  --accent2: #d97706;

  --ok:      #22c55e;
  --warn:    #f59e0b;
  --danger:  #ef4444;

  /* Pas d'arrondis forts — look "pixel/gaming" */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;
  --r-pill: 999px;

  --sh-sm: 0 2px 0 rgba(0,0,0,.35);
  --sh-md: 0 6px 0 rgba(0,0,0,.4);
  --sh-lg: 0 20px 60px rgba(0,0,0,.65), 0 0 40px rgba(250,204,21,.08);

  --t-fast: .12s ease;
  --t: .2s cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

body {
  font-family: 'Montserrat', 'Inter', 'Segoe UI', Roboto, -apple-system, sans-serif;
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    linear-gradient(180deg, rgba(10,5,0,.78), rgba(10,5,0,.9)),
    radial-gradient(circle at 20% 10%, rgba(250,204,21,.08), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(217,119,6,.08), transparent 45%),
    url("https://i.imgur.com/1GsYpa4.gif") center / cover fixed,
    var(--bg0);
  position: relative;
}

body::after {
  content: '';
  position: fixed; inset: 0;
  background: url("https://i.imgur.com/knmkxJ4.gif") center / cover fixed;
  opacity: .16;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 0;
}

/* Motif pixel subtil (comme old Eclipse) */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.36)),
    url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.025' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Panel principal : top navbar + main */
#app { position: relative; z-index: 1; height: 100vh; display: flex; flex-direction: column; }

/* ========== Top Navbar Eclipse ========== */
.eclipse-nav {
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 18px;
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.25));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  position: relative;
  z-index: 50;
}

.nav-logo {
  display: flex; align-items: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform var(--t);
}
.nav-logo:hover { transform: scale(1.05); }
.nav-logo img {
  height: 52px; width: auto; object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(250,204,21,.5));
}

.nav-links {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-item {
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255,255,255,.7);
  transition: var(--t-fast);
  white-space: nowrap;
  flex: 0 0 auto;
  border: 0; background: transparent;
  font-family: inherit;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active {
  background: #fff;
  color: #020617;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.nav-item.locked {
  opacity: .42;
}

/* Partie droite : pills */
.nav-right {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}

.nav-pill {
  display: flex; align-items: center; gap: 10px;
  height: 44px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  color: #fff;
  font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .04em;
  font-family: inherit;
  transition: var(--t-fast);
  cursor: pointer;
}
.nav-pill:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); }

.nav-guild { padding: 0 0 0 14px; overflow: hidden; width: 220px; }
.nav-guild .sel,
.nav-guild .c-select { height: 100%; border: 0; background: transparent; }
.nav-guild .c-select-trigger {
  height: 44px; border: 0; padding: 0 14px 0 10px; background: transparent;
  color: #fff; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
.nav-guild .c-select-trigger:hover { background: transparent; }
.nav-pill-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  flex-shrink: 0;
}

.nav-invite .nav-ico { color: var(--accent); }
.nav-invite:hover .nav-ico { color: #fde047; }

.nav-user { gap: 8px; padding: 0 12px 0 8px; }
.nav-user .bot-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent);
  display: grid; place-items: center;
  color: #020617; font-weight: 900; font-size: 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.nav-user .bot-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-user .bot-name {
  color: #fff; font-weight: 800; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.nav-ico { display: inline-grid; place-items: center; color: inherit; width: 16px; }

/* Responsive — cacher les labels secondaires sur petit écran */
@media (max-width: 1100px) {
  .eclipse-nav { padding: 0 14px; gap: 10px; }
  .nav-logo img { height: 42px; }
  .nav-item { padding: 8px 10px; font-size: 11px; }
  .nav-invite-label { display: none; }
  .nav-user .bot-name { display: none; }
  .nav-guild { width: 180px; }
  .nav-pill { padding: 0 10px; }
}
@media (max-width: 900px) {
  .eclipse-nav { gap: 8px; }
  .nav-links { justify-content: flex-start; gap: 2px; }
  .nav-item { padding: 8px 9px; }
  .nav-guild { width: 160px; }
  .nav-user { display: none; }
}
@media (max-width: 720px) {
  .eclipse-nav { height: auto; min-height: 72px; flex-wrap: wrap; padding: 10px 12px; }
  .nav-links { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .nav-right { margin-left: auto; }
}

/* ========== Main / pages ========== */
.main {
  flex: 1; min-width: 0; overflow-y: auto;
  display: flex; flex-direction: column;
  background: transparent;
  padding: 32px 24px 40px;
}
.main > .page,
.main > .page-empty,
.main > .hook-frame { width: 100%; max-width: 1280px; margin: 0 auto; }
.page-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; text-align: center; padding: 40px;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.login-modal {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  background: rgba(2, 6, 23, .92);
  border: 1px solid rgba(250,204,21,.24);
  border-radius: 12px;
  padding: 34px 28px;
  box-shadow: var(--sh-lg);
}
.login-modal img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(250,204,21,.5));
}
.login-modal h1 {
  margin: 6px 0 0;
  font-size: 28px;
  text-transform: uppercase;
  font-weight: 900;
}
.login-modal p,
.login-note {
  margin: 0;
  color: var(--muted);
  max-width: 520px;
}

.page {
  display: flex; flex-direction: column;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.page-head {
  display: flex; align-items: center; gap: 16px;
  padding: 0 4px 28px;
  background: transparent;
  border: 0;
  position: relative;
}
/* Soulignement jaune sous le titre de page (comme "LEADERBOARDS" sur image 1) */
.page-head::after {
  content: '';
  position: absolute;
  left: 4px; bottom: 14px;
  width: 56px; height: 3px;
  background: var(--accent);
  border-radius: 2px;
}
.page-icon {
  width: 48px; height: 48px; border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 18%, #020617);
  border: 1px solid rgba(250,204,21,.35);
  display: grid; place-items: center; color: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(250,204,21,.2);
}
.page-title-wrap { flex: 1; min-width: 0; }
.page-title { margin: 0; font-size: 26px; font-weight: 900; color: #fff; letter-spacing: -.01em; text-transform: uppercase; }
.page-sub   { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }
.page-body {
  display: flex; flex-direction: column;
  padding: 0;
}

/* Section cards (style old Eclipse) */
.section {
  background: rgba(2, 6, 23, .55);
  border: 1px solid rgba(250,204,21,.15);
  border-radius: 12px;
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0,0,0,.25);
}
.section-title {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(250,204,21,.15);
  font-size: 11px; text-transform: uppercase; letter-spacing: .14em; font-weight: 800;
  color: var(--accent);
  background: rgba(0,0,0,.3);
}
.section-body {
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}

/* Field */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; font-weight: 700; }
.field-hint { font-size: 12px; color: var(--muted2); margin-top: 2px; }

/* Toggle */
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; inset: 0;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: 14px;
  transition: var(--t-fast);
}
.switch-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: var(--t-fast);
}
.switch input:checked + .switch-slider { background: var(--accent); border-color: var(--accent2); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); background: #fff; }
.toggle-label { cursor: pointer; font-size: 13px; color: var(--text); font-weight: 500; }

/* Checkbox grid (logs events) */
.checkbox-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 20px;
}

/* Chips (multi picker) */
.multi { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg3); border: 1px solid var(--border2);
  padding: 5px 8px 5px 10px; border-radius: var(--r-pill);
  font-size: 12px; color: var(--text);
}
.chip-x {
  background: transparent; border: 0; color: var(--muted);
  padding: 2px; cursor: pointer; display: grid; place-items: center;
  border-radius: var(--r-sm);
}
.chip-x:hover { background: rgba(192,96,96,.2); color: var(--danger); }

/* List items */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  justify-content: space-between;
}
.list-item .li-title { font-weight: 600; font-size: 14px; color: var(--text); }
.list-item .li-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item .li-meta  { font-size: 12px; color: var(--muted); text-align: right; }
.li-actions { display: flex; gap: 6px; margin-top: 6px; justify-content: flex-end; }

/* Ticket buttons cards */
.btn-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.btn-card {
  border: 1px solid var(--border2);
  background: var(--bg2);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t-fast), opacity var(--t-fast), transform var(--t-fast);
}
.btn-card.dragging,
.block.dragging { opacity: .55; }
.btn-card.drag-over,
.block.drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.btn-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border2);
}
.btn-card-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.btn-card-title { flex: 1; font-weight: 600; font-size: 13px; color: var(--text); }
.btn-card-body {
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.btn.danger.ghost { color: #fca5a5; background: transparent; border-color: transparent; box-shadow: none; }
.btn.danger.ghost:hover { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #fecaca; }

/* Toast */
.toast-host { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg3); border: 1px solid var(--border3);
  padding: 12px 16px; border-radius: var(--r-md);
  color: var(--text); font-size: 13px; font-weight: 500;
  box-shadow: var(--sh-lg);
  animation: toastIn .2s ease;
  min-width: 180px;
}
.toast.err { border-color: rgba(239,68,68,.4); background: #2a0f0f; color: #fecaca; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* Hook Builder iframe */
.hook-frame { flex: 1; border: 0; width: 100%; height: 100%; background: var(--bg); }

/* Row utility (deux colonnes) — déjà défini plus haut */

/* ========== Topbar ========== */
.topbar {
  height: 64px;
  background: var(--bg1);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  z-index: 10;
  position: relative;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding-right: 16px; border-right: 1px solid var(--border2);
  margin-right: 6px; height: 40px;
}
.logo-img {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: #020617;
  padding: 3px;
  object-fit: contain;
  border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  box-shadow: 0 0 18px rgba(250,204,21,.25);
  transition: var(--t);
}
.logo-img:hover { transform: scale(1.04); }
.brand-name {
  font-weight: 700; font-size: 17px; letter-spacing: -.01em;
  color: var(--text);
}

.target { display: flex; gap: 8px; flex: 1; max-width: 580px; align-items: center; }
.target .sel { flex: 1; min-width: 0; }

.mode-switch {
  display: flex;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-pill); padding: 4px; gap: 2px;
}
.mode-switch button {
  background: transparent; border: 0; color: var(--muted);
  padding: 8px 16px; border-radius: var(--r-pill); cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  transition: var(--t);
}
.mode-switch button:hover { color: var(--text); }
.mode-switch button.active {
  background: var(--accent);
  color: #020617;
  box-shadow: var(--sh-sm);
  font-weight: 800;
}

/* ========== Layout ========== */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr 1fr;
  min-height: 0;
  gap: 0;
}
.panel {
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--bg1);
}
.panel.left   { border-right: 1px solid var(--border); }
.panel.center { background: var(--bg); }
.panel.right  { border-left: 1px solid var(--border); }

.panel-head {
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.panel-foot {
  padding: 12px;
  display: flex; gap: 8px;
  border-top: 1px solid var(--border);
  background: var(--bg1);
}
.panel-foot input { flex: 1; }

.saved-list { flex: 1; overflow-y: auto; padding: 10px; }
.saved-item {
  padding: 11px 12px; border-radius: var(--r-md); cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: var(--t);
  border: 1px solid transparent;
  margin-bottom: 3px;
}
.saved-item:hover {
  background: var(--bg3);
  border-color: var(--border2);
}
.saved-item.active {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg2));
  border-color: var(--border3);
  color: var(--accent);
}
.saved-item .ico { color: var(--muted); flex-shrink: 0; }
.saved-item.active .ico { color: var(--text); }
.saved-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.saved-item .del {
  opacity: 0; background: transparent; border: 0; color: var(--danger); cursor: pointer;
  padding: 4px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  transition: var(--t-fast);
}
.saved-item:hover .del { opacity: .7; }
.saved-item .del:hover { opacity: 1; background: rgba(192,96,96,.15); }

/* ========== Editor ========== */
#editor {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}
.editor-foot {
  padding: 14px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 10px;
  background: var(--bg1);
}
.left-actions, .right-actions { display: flex; gap: 8px; align-items: center; }
.status { padding: 6px 18px; font-size: 12px; min-height: 22px; display: flex; align-items: center; gap: 6px; }
.status.ok  { color: var(--ok); }
.status.err { color: var(--danger); }
.status.ok::before, .status.err::before {
  content:''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* ========== Preview ========== */
.preview-head {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted);
}
.preview {
  flex: 1; overflow-y: auto; padding: 22px;
  /* Le preview reste sombre façon Discord pour le réalisme */
  background: #313338;
  color: #dbdee1;
  --bg2: #2b2d31;
  --bg3: #1e1f22;
  --bg4: #40444b;
  --bg5: #4e5058;
  --border: #1e1f22;
  --border2: #3f4147;
  --border3: #4e5058;
  --muted: #949ba4;
}
.preview .block .children { background: rgba(0,0,0,.25); }

/* Discord message preview */
.msg { display: flex; gap: 16px; padding: 10px 0; }
.msg-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--bg4);
  flex-shrink: 0; display: grid; place-items: center; color: #fff; font-weight: 600;
  overflow: hidden;
  box-shadow: var(--sh-sm);
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-body { flex: 1; min-width: 0; }
.msg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.msg-author { font-weight: 600; color: #fff; font-size: 15px; }
.msg-bot {
  background: var(--bg5); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 4px; vertical-align: middle;
  display: inline-flex; align-items: center; gap: 3px; line-height: 1;
}
.msg-bot svg { width: 10px; height: 10px; }
.msg-time { color: var(--muted); font-size: 12px; }
.msg-content { color: #d5d5d8; white-space: pre-wrap; word-break: break-word; line-height: 1.45; font-size: 15px; }
.msg-content code { background: rgba(0,0,0,.45); padding: 2px 5px; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.msg-content pre { background: rgba(0,0,0,.45); padding: 10px 12px; border-radius: var(--r-md); overflow: auto; border: 1px solid var(--border); margin: 6px 0; }
.msg-content a { color: #b8b8c0; text-decoration: underline; }

/* Embed */
.embed {
  max-width: 520px;
  background: var(--bg2);
  border-left: 4px solid var(--border4);
  border-radius: var(--r-sm); margin-top: 8px;
  padding: 12px 16px 16px 14px;
  display: grid; grid-template-columns: auto auto; gap: 8px 16px;
  box-shadow: var(--sh-sm);
}
.embed-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.embed-author { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.embed-author img { width: 24px; height: 24px; border-radius: 50%; }
.embed-title { font-weight: 600; color: #fff; font-size: 15px; }
.embed-title a { color: #b8b8c0; }
.embed-desc { color: #d5d5d8; white-space: pre-wrap; font-size: 14px; line-height: 1.45; }
.embed-fields { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 6px; }
.embed-fields.inline { grid-template-columns: repeat(3, 1fr); }
.embed-field-name { font-weight: 600; color: #fff; font-size: 13px; margin-bottom: 2px; }
.embed-field-val { color: #d5d5d8; font-size: 13px; white-space: pre-wrap; }
.embed-image { max-width: 100%; max-height: 300px; border-radius: var(--r-sm); margin-top: 6px; grid-column: 1 / -1; }
.embed-thumb { width: 80px; height: 80px; border-radius: var(--r-sm); object-fit: cover; justify-self: end; }
.embed-footer { font-size: 12px; color: var(--muted); margin-top: 8px; grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.embed-footer img { width: 20px; height: 20px; border-radius: 50%; }

/* V2 components */
.v2-container {
  border-left: 4px solid var(--border4); border-radius: var(--r-sm);
  background: var(--bg2);
  padding: 13px 15px; margin: 8px 0;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--sh-sm);
}
.v2-text { white-space: pre-wrap; font-size: 15px; line-height: 1.45; }
.v2-sep { height: 1px; background: var(--border2); margin: 4px 0; border-radius: 1px; }
.v2-sep.invisible { background: transparent; }
.v2-sep.small { margin: 2px 0; }
.v2-sep.large { margin: 14px 0; }
.v2-section { display: flex; gap: 14px; align-items: flex-start; }
.v2-section-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.v2-thumb { width: 76px; height: 76px; border-radius: var(--r-sm); object-fit: cover; flex-shrink: 0; box-shadow: var(--sh-sm); }
.v2-gallery { display: grid; gap: 4px; border-radius: var(--r-md); overflow: hidden; }
.v2-gallery.c1 { grid-template-columns: 1fr; }
.v2-gallery.c2 { grid-template-columns: 1fr 1fr; }
.v2-gallery.c3 { grid-template-columns: 1fr 1fr 1fr; }
.v2-gallery img,
.v2-gallery video { width: 100%; max-height: 300px; object-fit: cover; background: #000; display: block; }
.v2-gallery .v2-embed-card { width: 100%; aspect-ratio: 16/9; position: relative; display: flex; align-items: center; justify-content: center; text-decoration: none; border-radius: 0; overflow: hidden; }
.v2-embed-card { position: relative; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; overflow: hidden; text-decoration: none; cursor: pointer; transition: transform .15s; }
.v2-embed-card:hover { transform: scale(1.02); }
.v2-embed-card:hover .v2-embed-play { transform: scale(1.1); }
.v2-embed-play { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; box-shadow: 0 4px 20px rgba(0,0,0,.5); transition: transform .15s; padding-left: 4px; }
.v2-embed-badge { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,.75); color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; letter-spacing: .3px; }
.v2-thumb.v2-embed-card { width: 120px; height: 68px; }
.v2-thumb.v2-embed-card .v2-embed-play { width: 32px; height: 32px; font-size: 14px; }
.v2-thumb.v2-embed-card .v2-embed-badge { font-size: 9px; padding: 1px 4px; bottom: 3px; right: 3px; }
.v2-file {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--r-md);
  max-width: 440px;
}
.v2-file-icon {
  width: 36px; height: 46px;
  background: var(--bg4);
  border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--muted);
}
.v2-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.v2-btn {
  padding: 8px 16px; border-radius: var(--r-sm); font-weight: 500; font-size: 14px;
  border: 0; cursor: default; color: #fff;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
  transition: filter var(--t);
}
.v2-btn:hover { filter: brightness(1.15); }
/* Discord button colors (kept for realistic preview of buttons as they appear in Discord) */
.v2-btn.primary   { background: #5865f2; }
.v2-btn.secondary { background: #4e5058; }
.v2-btn.success   { background: #248046; }
.v2-btn.danger    { background: #da373c; }
.v2-btn.link      { background: #4e5058; }
.v2-select {
  display: inline-flex; align-items: center; justify-content: space-between;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  padding: 8px 14px; min-width: 220px; color: var(--muted); font-size: 14px;
}

/* ========== Editor blocks ========== */
.block {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  margin-bottom: 14px;
  overflow: hidden;
  transition: var(--t);
}
.block:hover { border-color: var(--border3); }
.drag-handle {
  width: 28px; height: 28px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  cursor: grab;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  transition: var(--t-fast);
}
.drag-handle:hover { background: var(--bg4); color: var(--text); }
.drag-handle:active { cursor: grabbing; }
.block-head {
  padding: 13px 15px; display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.block-head .caret {
  color: var(--muted); width: 16px; height: 16px;
  display: inline-grid; place-items: center;
  transition: transform var(--t);
}
.block.collapsed .block-head .caret { transform: rotate(-90deg); }
.block-head .block-icon {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--muted); flex-shrink: 0;
}
.block-title { flex: 1; font-weight: 600; font-size: 13px; letter-spacing: .01em; }
.block-actions { display: flex; gap: 2px; }
.block-actions button {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  padding: 6px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  transition: var(--t-fast);
}
.block-actions button:hover { background: var(--bg4); color: var(--text); }
.block-actions button.danger:hover { background: rgba(192,96,96,.15); color: var(--danger); }
.block-body {
  padding: 15px;
  border-top: 1px solid var(--border2);
  display: grid; gap: 10px;
  background: rgba(0,0,0,.2);
}
.block.collapsed .block-body { display: none; }
.block .children {
  padding: 13px;
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: 10px;
  background: rgba(0, 0, 0, .25);
}
.err-msg {
  background: rgba(239,68,68,.08); color: #fecaca;
  border: 1px solid rgba(239,68,68,.3);
  padding: 10px 14px; border-radius: var(--r-md); font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}

/* Forms */
label {
  font-size: 11px; text-transform: uppercase; color: var(--muted);
  letter-spacing: .08em; font-weight: 700;
}
input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--r-md); font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: var(--t-fast);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--border4);
  box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}
input[type="color"] { padding: 2px; height: 36px; cursor: pointer; }
textarea { min-height: 72px; line-height: 1.5; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
details summary {
  list-style: none; padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  cursor: pointer; transition: var(--t-fast);
}
details summary:hover { color: var(--text); border-color: var(--border3); }
details[open] summary { margin-bottom: 10px; color: var(--text); border-color: var(--border3); }
details summary::-webkit-details-marker { display: none; }
details > :not(summary) { margin-bottom: 8px; }

/* ========== Buttons ========== */
.btn {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 8px;
  transition: var(--t);
  box-shadow: var(--sh-sm);
}
.btn:hover {
  background: var(--bg4);
  border-color: var(--border3);
  transform: translateY(-1px);
  box-shadow: var(--sh-md);
}
.btn:active { transform: translateY(0); }
.btn.primary {
  background: #fff;
  color: #020617;
  border: 1px solid rgba(255,255,255,.4);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
  box-shadow: 0 6px 0 rgba(0,0,0,.35);
}
.btn.primary:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 6px 0 rgba(0,0,0,.4); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 4px 0 rgba(0,0,0,.3); }
.btn.success {
  background: #14532d;
  color: #bbf7d0;
  border: 1px solid #166534;
}
.btn.success:hover { background: #166534; border-color: #22c55e; }
.btn.ghost {
  background: transparent; border: 1px solid transparent; box-shadow: none;
}
.btn.ghost:hover { background: var(--bg3); border-color: var(--border2); }
.btn.warn {
  background: #451a03;
  color: #fed7aa;
  border: 1px solid #7c2d12;
}
.btn.warn:hover { background: #7c2d12; border-color: #f59e0b; }
.btn.danger {
  background: #450a0a;
  color: #fecaca;
  border: 1px solid #7f1d1d;
}
.btn.danger:hover { background: #7f1d1d; border-color: #ef4444; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn.icon { padding: 7px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* Dropdown */
.dropdown { position: relative; display: inline-block; }
.menu {
  display: none;
  position: absolute; bottom: calc(100% + 8px); left: 0;
  background: var(--bg2);
  border: 1px solid var(--border3);
  border-radius: var(--r-md);
  min-width: 240px; z-index: 30;
  overflow: hidden;
  box-shadow: var(--sh-lg);
  padding: 6px;
}
.dropdown.open .menu { display: block; animation: menuIn .18s cubic-bezier(.4,0,.2,1); }
@keyframes menuIn {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.menu-item {
  padding: 10px 12px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 500;
  transition: var(--t-fast);
}
.menu-item:hover {
  background: var(--bg4);
  color: #fff;
}
.menu-item .mi-icon { color: var(--muted); width: 16px; display: grid; place-items: center; flex-shrink: 0; }
.menu-item:hover .mi-icon { color: #fff; }

/* Select */
.sel {
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 8px 14px; border-radius: var(--r-md); font-size: 13px;
  outline: none; cursor: pointer; font-family: inherit;
  transition: var(--t-fast);
  height: 40px;
}
.sel:hover { border-color: var(--border3); background: var(--bg3); }
.sel:focus { border-color: var(--border4); box-shadow: 0 0 0 3px rgba(255,255,255,.06); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: 100;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg2);
  border: 1px solid var(--border3);
  border-radius: var(--r-xl);
  padding: 26px;
  min-width: 440px; max-width: 640px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--sh-lg);
  animation: modalIn .22s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal h3 {
  margin: 0 0 4px; font-size: 18px; font-weight: 700;
  color: var(--text);
}
.modal textarea { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--bg4);
  border-radius: var(--r-pill);
  border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--bg5); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* File drop */
.file-drop {
  border: 1.5px dashed var(--border3); border-radius: var(--r-md); padding: 16px;
  text-align: center; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: var(--t);
  background: rgba(0, 0, 0, .25);
}
.file-drop:hover {
  border-color: var(--border4); color: var(--text);
  background: var(--bg2);
}
.file-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg3); padding: 6px 12px; border-radius: var(--r-pill); font-size: 12px;
  border: 1px solid var(--border2);
}
.file-pill button { background: transparent; border: 0; color: var(--danger); cursor: pointer; padding: 2px; display: grid; place-items: center; }

.checkbox {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.checkbox input {
  width: 16px; height: 16px; accent-color: var(--muted); cursor: pointer;
}

/* Segmented control */
.seg {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--r-md); padding: 3px; gap: 2px;
}
.seg button {
  flex: 1; background: transparent; border: 0; color: var(--muted);
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px;
  font-weight: 600; font-family: inherit;
  transition: var(--t-fast);
}
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--bg4);
  color: #fff; box-shadow: var(--sh-sm);
}

/* Empty state */
.empty {
  color: var(--muted); padding: 32px 12px; text-align: center; font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty svg { color: var(--muted2); opacity: .6; }

[title] { position: relative; }

/* ========== Custom select ========== */
.c-select { position: relative; display: block; width: 100%; }
.c-select.as-sel { flex: 1; min-width: 0; width: auto; }

.c-select-trigger {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: space-between;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 0 12px 0 14px;
  height: 40px;
  border-radius: var(--r-md);
  font-size: 13px; font-family: inherit; font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: var(--t-fast);
  text-align: left;
}
.c-select-trigger:hover { background: var(--bg3); border-color: var(--border3); }
.c-select.open .c-select-trigger {
  background: var(--bg3);
  border-color: var(--border4);
  box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}
.c-select-label {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.c-select-chev {
  color: var(--muted); display: grid; place-items: center;
  transition: transform var(--t);
}
.c-select.open .c-select-chev { transform: rotate(180deg); }

.c-select-menu {
  display: none;
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg2);
  border: 1px solid var(--border3);
  border-radius: var(--r-md);
  z-index: 200;
  box-shadow: var(--sh-lg);
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.c-select.open .c-select-menu {
  display: block;
  animation: menuIn .16s cubic-bezier(.4,0,.2,1);
}
.c-select-item {
  padding: 9px 12px; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--r-sm); font-size: 13px; font-weight: 500;
  transition: var(--t-fast);
  color: var(--text);
}
.c-select-item:hover { background: var(--bg4); color: #fff; }
.c-select-item.active { background: var(--bg3); color: #fff; }
.c-select-item.active:hover { background: var(--bg4); }
.c-select-item.dim { color: var(--muted); font-style: italic; }

/* ===== Modal (�dition concours) ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--panel, #1c1c20); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; width: 100%; max-width: 640px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 12px 48px rgba(0,0,0,.5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.06); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.06); }

/* ===== Pills (usernames) ===== */
.pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); font-size: 12px; line-height: 1.6; color: var(--text); }
