/* =============================
   Discord-ish Theme — easily themed via variables
   ============================= */
:root{
  --bg-0:#0f1216;
  --bg-1:#161a20;
  --bg-2:#1d232c;
  --bg-3:#232b36;
  --text-0:#f2f4f8;
  --text-1:#c7ced9;
  --muted:#9aa6b2;
  --accent:#5865f2; /* Discord-ish blurple */
  --accent-2:#4e5de3;
  --red:#f25f5c;
  --green:#2ea043;
  --yellow:#f2c744;
  --surface:#0b0e12;

  --radius:14px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --font: "Oxygen", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  /* Scrollbar colors */
  --scroll-track: rgba(255,255,255,0.02);
  --scroll-thumb: rgba(88,101,242,0.18);
  --scroll-thumb-strong: rgba(88,101,242,0.30);
  --scroll-width: 10px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg-0);
  color:var(--text-0);
  font-family:var(--font);
}

/* App layout */
.app{
  display:grid;
  grid-template-columns: 280px 1fr 300px;
  grid-template-rows: 100vh;
  gap:0;
}

/* Left rail */
.left-rail{
  background:var(--bg-1);
  border-right:1px solid #0c1118;
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.brand{
  font-weight:800;
  letter-spacing:.3px;
  color:var(--text-0);
  padding:6px 10px;
  border-radius:10px;
  background:linear-gradient(180deg, var(--bg-2), transparent);
}
.section{display:flex;flex-direction:column;gap:8px}
.section-title{font-size:.78rem;text-transform:uppercase;color:var(--muted);letter-spacing:.08em;padding:0 8px}
.section-title-row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.section-actions{display:flex;align-items:center;gap:6px}
.mini-btn{
  border:1px solid #0c1118;
  background:var(--bg-2);
  color:var(--text-1);
  border-radius:8px;
  padding:4px 8px;
  cursor:pointer;
  font-size:.72rem;
  text-transform:none;
  letter-spacing:0;
}
.mini-btn:hover{color:var(--text-0);border-color:#152033}
.list{display:flex;flex-direction:column;gap:6px;overflow:auto;max-height:35vh}
.list-item{
  width:100%;
  display:flex; align-items:center; gap:10px;
  background:transparent;
  border:0;
  border-radius:10px;
  color:var(--text-1);
  padding:8px 10px;
  cursor:pointer;
  text-align:left;
}
.list-item:hover{background:var(--bg-2); color:var(--text-0)}
.list-item.is-active{background:linear-gradient(180deg,var(--bg-3),var(--bg-2)); color:var(--text-0); outline:1px solid rgba(255,255,255,.06)}
.list-item .dot{width:8px;height:8px;border-radius:50%;background:var(--muted);}
.list-item.is-active .dot{background:var(--accent)}
.list-item .label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis; flex:1; min-width:0}
.list-empty{
  padding:10px;
  color:var(--muted);
  font-size:.82rem;
  line-height:1.45;
}
.list-meta{
  font-size:.72rem;
  color:var(--muted);
}
.dm-close{ margin-left:12px; color:var(--muted); cursor:pointer; padding:2px 6px; border-radius:6px }
.dm-close:hover{ color:var(--text-0); background:rgba(255,255,255,0.02) }

/* Unread DM badge */
.unread-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:20px;
  height:20px;
  padding:0 6px;
  margin-left:auto;
  margin-right:4px;
  background:var(--red);
  color:white;
  font-size:11px;
  font-weight:700;
  border-radius:10px;
  line-height:1;
}

/* Highlight DMs with unread messages */
.list-item.has-unread{
  font-weight:700;
  color:var(--text-0);
}

.list-item.has-unread .label{
  font-weight:700;
}

.spacer{flex:1}
.me-row{
  display:flex;align-items:center;gap:10px;
  padding:10px;
  border-radius:12px;
  background:var(--bg-2);
  border:1px solid #0c1118;
}
.me-info{display:flex;flex-direction:column;min-width:0}
.me-name{font-weight:700}
.me-sub{font-size:.8rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.me-actions{display:flex;gap:6px;margin-left:auto}
.me-actions button{
  background:var(--bg-3);
  border:1px solid #0c1118;
  color:var(--text-1);
  border-radius:10px;
  padding:6px 8px;
  cursor:pointer;
}
.me-actions button:hover{color:var(--text-0); border-color:#152033}

/* Chat column */
.chat-col{display:flex;flex-direction:column;background:var(--bg-0)}
.chat-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px;
  border-bottom:1px solid #0c1118;
  background: linear-gradient(180deg, var(--bg-1), transparent);
}

/* Header logo (replaced updates button) */
.chat-header .header-logo{display:flex; align-items:center; gap:10px}
.chat-header .header-logo img{
  width:66px; height:67px; max-width:36px; max-height:36px;
  object-fit:contain; border-radius:8px; display:block;
}
.chat-title #context-title{font-weight:800}
.subtitle{font-size:.84rem; color:var(--muted)}
.chat-tools{display:flex;align-items:center;gap:10px}
.search{
  width:260px; background:var(--bg-2); color:var(--text-0);
  border:1px solid #0c1118; border-radius:12px; padding:8px 10px;
}
.icon-btn{
  background:var(--bg-2); color:var(--text-1);
  border:1px solid #0c1118; border-radius:10px; padding:8px 10px; cursor:pointer;
}
.icon-btn:hover{color:var(--text-0); border-color:#152033}
.icon-btn.is-live{
  color:var(--text-0);
  border-color:rgba(90, 201, 122, 0.55);
  box-shadow:0 0 0 1px rgba(90, 201, 122, 0.18) inset;
}

.messages{
  flex:1;
  overflow:auto;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.msg{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:12px;
  padding:6px 10px;
  border-radius:12px;
}
.msg:hover{background:rgba(255,255,255,.02)}
.msg .meta{color:var(--muted); font-size:.82rem; text-align:right; padding-top:2px}
.msg .meta .name{font-weight:700; color:var(--text-1)}
.msg .meta .time{display:block; font-size:.75rem}
.msg .bubble{
  background: var(--bg-2);
  border:1px solid #0c1118;
  padding:10px 12px;
  border-radius:12px;
  color:var(--text-0);
  line-height:1.45;
  word-wrap:anywhere;
}
.msg .bubble a{color:var(--accent); text-decoration:none}
.msg .bubble a:hover{text-decoration:underline}
.msg .actions{margin-top:4px; display:flex; gap:8px}
.msg .btn-icon{
  background:transparent; border:0; color:var(--muted); cursor:pointer; padding:2px 4px;
}
.msg .btn-icon:hover{color:var(--text-1)}

.composer-wrap{
  border-top:1px solid #0c1118;
  background: linear-gradient(0deg, var(--bg-1), transparent);
  padding:12px 16px 8px 16px;
}
#composer{
  display:flex; align-items:flex-end; gap:10px; background:var(--bg-2);
  border:1px solid #0c1118; border-radius:14px; padding:8px;
  position: relative;
}

/* Emote trigger button */
.emote-trigger{
  background:transparent;
  border:0;
  font-size:20px;
  cursor:pointer;
  padding:4px 8px;
  border-radius:8px;
  line-height:1;
  flex-shrink:0;
}
.emote-trigger:hover{
  background:rgba(255,255,255,0.05);
}

/* Emote picker popup */
.emote-picker{
  position:absolute;
  bottom:calc(100% + 8px);
  left:8px;
  width:280px;
  background:var(--bg-1);
  border:1px solid #0c1118;
  border-radius:12px;
  box-shadow:var(--shadow);
  z-index:100;
}

.emote-picker-header{
  padding:10px 12px;
  border-bottom:1px solid #0c1118;
  font-weight:700;
  font-size:.9rem;
  color:var(--text-0);
}

.emote-grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:8px;
  padding:12px;
  max-height:300px;
  overflow-y:auto;
}

.emote-item{
  background:transparent;
  border:1px solid transparent;
  border-radius:8px;
  padding:8px;
  cursor:pointer;
  transition:all .15s ease;
  display:flex;
  align-items:center;
  justify-content:center;
}

.emote-item:hover{
  background:var(--bg-2);
  border-color:#0c1118;
}

.emote-item img{
  width:40px;
  height:40px;
  object-fit:contain;
  display:block;
}

/* Inline emotes in messages */
.emote-inline{
  width:32px;
  height:32px;
  object-fit:contain;
  vertical-align:middle;
  display:inline-block;
  margin:0 2px;
}

#message-input{
  flex:1; background:transparent; color:var(--text-0);
  border:0; outline:none; resize:none; font-family:var(--font);
  max-height:180px;
}
.primary{
  background:var(--accent); color:white;
  border:0; border-radius:12px; padding:8px 12px; cursor:pointer;
  font-weight:700;
}
.primary:hover{filter:brightness(.98)}
.hint{font-size:.8rem;color:var(--muted)}

.composer-foot{
  margin-top:6px; display:flex; align-items:center; gap:10px; color:var(--muted); font-size:.85rem;
}

/* Reply bar */
.reply-bar{
  display:flex; 
  align-items:center; 
  justify-content:space-between;
  gap:12px;
  background:var(--bg-2);
  border:1px solid #0c1118;
  border-bottom:0;
  border-radius:14px 14px 0 0;
  padding:8px 12px;
  margin-bottom:-1px;
}

.reply-info{
  flex:1;
  min-width:0;
}

.reply-label{
  font-size:.8rem;
  color:var(--muted);
  margin-bottom:2px;
}

.reply-preview{
  font-size:.85rem;
  color:var(--text-1);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.reply-cancel{
  background:transparent;
  border:0;
  color:var(--muted);
  cursor:pointer;
  padding:4px 6px;
  border-radius:6px;
  flex-shrink:0;
}

.reply-cancel:hover{
  color:var(--text-0);
  background:rgba(255,255,255,0.05);
}

/* Reply reference in messages */
.reply-reference{
  display:flex;
  gap:8px;
  margin-bottom:6px;
  padding:6px 8px;
  background:rgba(0,0,0,0.15);
  border-left:3px solid var(--accent);
  border-radius:4px;
  font-size:.85rem;
}

.reply-content{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
  flex:1;
}

.reply-author{
  font-weight:600;
  font-size:.82rem;
}

.reply-text{
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}


/* Right rail */
.right-rail{
  background:var(--bg-1);
  border-left:1px solid #0c1118;
  display:flex; flex-direction:column;
}
.users-header{
  padding:12px 14px; border-bottom:1px solid #0c1118;
  display:flex; align-items:baseline; gap:10px;
}
.users-list{padding:10px; overflow:auto}
.user-row{
  display:flex; justify-content:space-between; align-items:center;
  padding:8px 10px; border-radius:10px; color:var(--text-1);
}
.user-row:hover{background:var(--bg-2); color:var(--text-0)}
.user-left{display:flex; align-items:center; gap:10px}
.status-dot{width:8px;height:8px;border-radius:50%}
.dot-online{background:var(--green)} .dot-offline{background:#556070}
.user-name{font-weight:600}
.user-sub{font-size:.78rem;color:var(--muted)}
.voice-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-left:8px;
  padding:2px 7px;
  border-radius:999px;
  border:1px solid rgba(90, 201, 122, 0.28);
  background:rgba(90, 201, 122, 0.1);
  color:#9ae6b4;
  font-size:.72rem;
  line-height:1;
  vertical-align:middle;
}
.voice-pill.is-muted{
  border-color:rgba(255,255,255,0.12);
  background:rgba(255,255,255,0.06);
  color:var(--muted);
}

/* GIF / image messages */
.msg-image{
  display:block;
  margin-top:8px;
  max-width:420px;
  max-height:360px;
  width:auto;
  height:auto;
  border-radius:8px;
  box-shadow:0 6px 18px rgba(0,0,0,0.35);
}

/* GIFs in chat should be smaller to avoid layout jump */
.msg-image.msg-gif{
  max-height:100px;
  object-fit:contain;
}

/* GIF picker grid tweaks */
.gif-grid{max-height:260px;overflow:auto}
.gif-item{background:transparent;border:0;padding:0;cursor:pointer;border-radius:6px}
.gif-item img{display:block;max-width:160px;max-height:120px;object-fit:cover;border-radius:6px}

/* Ensure gif picker sits above other UI */
#gif-picker{z-index:120}
#voice-audio-mount{display:none}

/* Updates UI removed; header uses logo */

/* Scroll helpers */
.sticky-bottom-shadow{box-shadow: inset 0 -12px 12px -12px rgba(0,0,0,.4)}

/* Responsive (later we’ll refine, but decent now) */
@media (max-width: 1100px){
  .app{grid-template-columns:240px 1fr 260px}
  .search{width:200px}
}
@media (max-width: 900px){
  .app{grid-template-columns:220px 1fr}
  .right-rail{display:none}
}
/* ==== Auth Screen ==== */
.auth-screen{
  position:fixed; inset:0; display:grid; place-items:center;
  background: radial-gradient(1200px 800px at 50% -10%, rgba(88,101,242,.18), transparent 60%), var(--bg-0);
  z-index: 50;
}
.auth-card{
  width:min(480px, 92vw);
  background:var(--bg-1);
  border:1px solid #0c1118;
  border-radius:16px;
  box-shadow: var(--shadow);
  padding:22px 22px 18px;
  text-align:center;
}
.auth-brand{
  display:inline-block; font-weight:900; letter-spacing:.4px;
  padding:6px 10px; border-radius:10px; margin-bottom:8px;
  background:linear-gradient(180deg, var(--bg-2), transparent);
}
.auth-sub{color:var(--muted); margin:0 0 14px}
.auth-actions{display:flex; flex-direction:column; gap:10px; margin:12px 0}
.auth-btn{
  padding:10px 12px; border-radius:12px; cursor:pointer; font-weight:700;
  border:1px solid #0c1118; background:var(--bg-2); color:var(--text-0);
}
.auth-btn.primary{ background:var(--accent); color:white; border:0; }
.auth-btn.ghost:hover{ border-color:#152033; color:var(--text-0) }
.auth-note{font-size:.82rem; color:var(--muted); line-height:1.5}
.auth-note a{color:var(--text-0); text-decoration:none; border-bottom:1px solid rgba(255,255,255,.18)}
.auth-note a:hover{color:#fff; border-bottom-color:rgba(88,101,242,.85)}

/* ==== Auth form inputs and errors ==== */
.auth-form{ display:flex; flex-direction:column; gap:10px; margin:12px 0 8px; }
.auth-label{ font-size:.9rem; color:#aab7c7; text-align:left; }
.auth-input{
  padding:10px 12px; border-radius:12px; border:1px solid #0c1118;
  background:var(--bg-2); color:var(--text-0); outline:none;
}
.auth-input:focus{ border-color:#1b2a44; box-shadow: 0 0 0 3px rgba(88,101,242,.15); }
.auth-error{
  background: rgba(220, 38, 38, .12);
  border:1px solid rgba(220, 38, 38, .35);
  color: #fecaca;
  padding:8px 10px; border-radius:10px; font-size:.9rem;
}
.auth-actions .auth-btn.primary + .auth-btn{ background:var(--bg-2); }
/* Username modal */
#username-dialog {
  width: min(420px, 92vw);
  border: 1px solid #0c1118;
  background: var(--bg-1);
  color: var(--text-0);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}
#username-dialog::backdrop, #room-dialog::backdrop, #join-dialog::backdrop, #color-dialog::backdrop { background: rgba(0,0,0,.6); }
#username-dialog h2, #room-dialog h2, #join-dialog h2, #color-dialog h2 { margin: 0 0 6px; }
.username-sub { color: var(--muted); margin: 0 0 14px; }
.username-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
#room-dialog, #join-dialog, #color-dialog {
  width: min(420px, 92vw);
  border: 1px solid #0c1118;
  background: var(--bg-1);
  color: var(--text-0);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}

/* =====================
   Site Loader (moved from inline index.html)
   ===================== */

/* Overlay */
.site-loader{
  position: fixed;
  inset: 0;
  z-index: 199;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 500px at 20% 20%, rgba(88,101,242,.22), transparent 60%),
    radial-gradient(700px 400px at 80% 30%, rgba(78,93,227,.18), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--surface));
  color: var(--text-0);
  font-family: var(--font);
  opacity: 1;
  transition: opacity .35s ease, visibility .35s ease;
  visibility: visible;
}

html.site-loading, body.site-loading{ height:100%; overflow:hidden; }

.site-loader[data-state="hidden"]{ opacity:0; visibility:hidden; pointer-events:none; }

.site-loader__card{ width:min(520px, calc(100vw - 40px)); border-radius:var(--radius); background:rgba(22,26,32,.72); border:1px solid rgba(199,206,217,.12); box-shadow:var(--shadow); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); padding:22px 22px 18px; }
.site-loader__top{ display:flex; align-items:center; gap:14px; margin-bottom:14px; }
.site-loader__brand{ width:56px; height:56px; border-radius:12px; box-shadow:0 10px 24px rgba(0,0,0,.25); position:relative; overflow:hidden; display:flex; align-items:center; justify-content:center; background:transparent; }
.site-loader__brand img{ width:100%; height:100%; object-fit:contain; display:block; border-radius:10px; }
@keyframes sheen{ 0%{ transform: translateX(-40%) rotate(18deg); opacity:0 } 35%{ opacity:1 } 100%{ transform: translateX(40%) rotate(18deg); opacity:0 } }
.site-loader__title{ font-weight:700; letter-spacing:.2px; font-size:16px; line-height:1.1 }
.site-loader__subtitle{ margin-top:4px; color:var(--text-1); font-size:13px }
.site-loader__mid{ display:grid; grid-template-columns:54px 1fr; gap:14px; align-items:center; margin:10px 0 14px }
.ring{ width:54px; height:54px; border-radius:999px; background: conic-gradient(from 90deg, rgba(88,101,242,0) 0 18%, rgba(88,101,242,.95) 35%, rgba(78,93,227,.85) 60%, rgba(88,101,242,0) 85% 100%); -webkit-mask: radial-gradient(circle at center, transparent 56%, #000 58%); mask: radial-gradient(circle at center, transparent 56%, #000 58%); filter: drop-shadow(0 10px 14px rgba(88,101,242,.22)); animation: spin 1s linear infinite }
@keyframes spin{ to{ transform: rotate(360deg) } }
.status{ display:flex; flex-direction:column; gap:6px }
.status__line{ display:flex; justify-content:space-between; gap:12px; font-size:12px; color:var(--muted); font-family:var(--mono) }
.bar{ height:10px; border-radius:999px; background:rgba(35,43,54,.9); border:1px solid rgba(199,206,217,.10); overflow:hidden; position:relative }
.bar__fill{ height:100%; width:20%; border-radius:999px; background:linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow:0 10px 30px rgba(88,101,242,.25); animation: load 2.2s ease-in-out infinite }
@keyframes load{ 0%{ width:18%; transform:translateX(-4%); opacity:.9 } 50%{ width:42%; transform:translateX(0%); opacity:1 } 100%{ width:18%; transform:translateX(4%); opacity:.9 } }
.site-loader .dots{ display:inline-flex; align-items:center; gap:4px; margin-left:6px }
.site-loader .dot{ width:6px; height:6px; border-radius:999px; background:rgba(242,244,248,.35); animation:bounce 1s ease-in-out infinite }
.site-loader .dot:nth-child(2){ animation-delay:.12s; background:rgba(88,101,242,.65) }
.site-loader .dot:nth-child(3){ animation-delay:.24s; background:rgba(78,93,227,.65) }
@keyframes bounce{ 0%,100%{ transform:translateY(0); opacity:.55 } 50%{ transform:translateY(-4px); opacity:1 } }
.site-loader__hint{ margin-top:12px; font-size:12px; color:var(--text-1); opacity:.9; display:flex; justify-content:space-between; gap:10px }
.kbd{ font-family:var(--mono); font-size:11px; padding:2px 8px; border-radius:999px; background:rgba(29,35,44,.85); border:1px solid rgba(199,206,217,.10); color:var(--muted); white-space:nowrap }
@media (prefers-reduced-motion: reduce){ .ring, .bar__fill, .site-loader__brand::after, .site-loader .dot{ animation:none !important } }

/* -------------------------
   Custom scrollbars (WebKit + Firefox)
   Applied to scrollable panels: lists, messages, users, and site loader
   ------------------------- */
.list, .messages, .users-list, .site-loader, .list-item, body {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: var(--scroll-thumb) transparent;
}

/* WebKit scrollbars */
.list::-webkit-scrollbar, .messages::-webkit-scrollbar, .users-list::-webkit-scrollbar, body::-webkit-scrollbar {
  width: var(--scroll-width);
  height: var(--scroll-width);
}

.list::-webkit-scrollbar-track, .messages::-webkit-scrollbar-track, .users-list::-webkit-scrollbar-track, body::-webkit-scrollbar-track {
  background: var(--scroll-track);
}

.list::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb, .users-list::-webkit-scrollbar-thumb, body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(88,101,242,0.18), rgba(78,93,227,0.18));
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.list::-webkit-scrollbar-thumb:hover, .messages::-webkit-scrollbar-thumb:hover, .users-list::-webkit-scrollbar-thumb:hover, body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(88,101,242,0.30), rgba(78,93,227,0.30));
}

.list::-webkit-scrollbar-corner, .messages::-webkit-scrollbar-corner, .users-list::-webkit-scrollbar-corner, body::-webkit-scrollbar-corner {
  background: transparent;
}

/* Toast / notification styles */
.toasts{
  position:fixed;
  right:18px;
  bottom:18px;
  display:flex;
  flex-direction:column-reverse;
  gap:10px;
  z-index:9999;
  pointer-events:none;
}
.toast{
  pointer-events:auto;
  min-width:200px;
  max-width:420px;
  background:rgba(11,14,18,0.92);
  color:var(--text-0);
  padding:10px 12px;
  border-radius:10px;
  box-shadow:var(--shadow);
  border:1px solid rgba(255,255,255,0.04);
  opacity:0;
  transform:translateY(8px);
  transition:opacity .18s ease, transform .18s ease;
  font-size:.95rem;
}
.toast.show{ opacity:1; transform:translateY(0); }
.toast.success{ background: linear-gradient(90deg, rgba(46,160,67,0.06), rgba(46,160,67,0.03)); border-color: rgba(46,160,67,0.16); }
.toast.error{ background: linear-gradient(90deg, rgba(242,95,92,0.06), rgba(242,95,92,0.03)); border-color: rgba(242,95,92,0.16); }
.toast.info{ background: linear-gradient(90deg, rgba(88,101,242,0.06), rgba(78,93,227,0.03)); border-color: rgba(88,101,242,0.16); }
.toast .title{ font-weight:700; margin-bottom:4px }
.toast .msg{ line-height:1.25 }

/* Site legal footer */
.site-legal{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:18px;
  padding:14px 16px 18px;
  border-top:1px solid rgba(255,255,255,.04);
  background:linear-gradient(180deg, rgba(11,14,18,0), rgba(11,14,18,.65));
  color:var(--muted);
  font-size:.84rem;
}
.site-legal__brand{
  margin-right:auto;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:rgba(242,244,248,.72);
}
.site-legal a{
  color:var(--text-1);
  text-decoration:none;
}
.site-legal a:hover{color:var(--text-0)}

/* Legal pages */
.legal-body{
  min-height:100vh;
  margin:0;
  background:
    radial-gradient(1000px 520px at 12% 0%, rgba(88,101,242,.23), transparent 60%),
    radial-gradient(760px 420px at 88% 12%, rgba(46,160,67,.12), transparent 55%),
    linear-gradient(180deg, #091018 0%, #0f1216 45%, #121922 100%);
}

.legal-shell{
  width:min(1180px, calc(100vw - 40px));
  margin:0 auto;
  padding:32px 0 56px;
}

.legal-topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:28px;
}

.legal-mark{
  display:inline-flex;
  align-items:center;
  gap:12px;
  color:var(--text-0);
  text-decoration:none;
  font-weight:700;
  letter-spacing:.04em;
}

.legal-mark img{
  width:44px;
  height:44px;
  object-fit:contain;
  border-radius:12px;
  box-shadow:0 12px 30px rgba(0,0,0,.28);
}

.legal-back{
  color:var(--text-1);
  text-decoration:none;
  padding:10px 14px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  backdrop-filter:blur(12px);
}

.legal-back:hover{
  color:var(--text-0);
  border-color:rgba(88,101,242,.38);
}

.legal-hero{
  position:relative;
  overflow:hidden;
  padding:40px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:28px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.09), rgba(255,255,255,.02)),
    rgba(16,22,30,.72);
  box-shadow:0 24px 80px rgba(0,0,0,.34);
  backdrop-filter:blur(16px);
}

.legal-hero::after{
  content:"";
  position:absolute;
  inset:auto -80px -120px auto;
  width:280px;
  height:280px;
  border-radius:999px;
  background:radial-gradient(circle, rgba(88,101,242,.34), transparent 68%);
  pointer-events:none;
}

.legal-eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-bottom:14px;
  padding:7px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  font-size:.78rem;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:#d7deea;
}

.legal-hero h1{
  margin:0;
  max-width:10ch;
  font-size:clamp(2.7rem, 6vw, 5rem);
  line-height:.94;
  letter-spacing:-.04em;
}

.legal-intro{
  max-width:720px;
  margin:18px 0 0;
  color:var(--text-1);
  font-size:1.03rem;
  line-height:1.75;
}

.legal-meta{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-top:22px;
}

.legal-pill{
  padding:10px 14px;
  border-radius:999px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  color:var(--text-1);
  font-size:.86rem;
}

.legal-grid{
  display:grid;
  grid-template-columns:minmax(0, 260px) minmax(0, 1fr);
  gap:26px;
  margin-top:28px;
}

.legal-nav,
.legal-card{
  border:1px solid rgba(255,255,255,.07);
  border-radius:24px;
  background:rgba(17,24,33,.74);
  box-shadow:0 18px 56px rgba(0,0,0,.24);
  backdrop-filter:blur(14px);
}

.legal-nav{
  position:sticky;
  top:20px;
  align-self:start;
  padding:22px;
}

.legal-nav__title{
  margin:0 0 12px;
  font-size:.82rem;
  text-transform:uppercase;
  letter-spacing:.14em;
  color:var(--muted);
}

.legal-nav ul{
  list-style:none;
  padding:0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.legal-nav a{
  display:block;
  padding:10px 12px;
  border-radius:12px;
  color:var(--text-1);
  text-decoration:none;
  background:rgba(255,255,255,.02);
}

.legal-nav a:hover{
  color:var(--text-0);
  background:rgba(88,101,242,.14);
}

.legal-card{
  padding:30px;
}

.legal-section + .legal-section{
  margin-top:30px;
  padding-top:30px;
  border-top:1px solid rgba(255,255,255,.07);
}

.legal-section h2{
  margin:0 0 12px;
  font-size:1.35rem;
  letter-spacing:-.02em;
}

.legal-section p,
.legal-section li{
  color:var(--text-1);
  line-height:1.75;
}

.legal-section ul{
  margin:14px 0 0;
  padding-left:20px;
}

.legal-note{
  margin-top:16px;
  padding:16px 18px;
  border-radius:16px;
  background:rgba(88,101,242,.09);
  border:1px solid rgba(88,101,242,.16);
  color:#dde4f3;
}

.legal-footer{
  margin-top:24px;
  text-align:center;
  color:var(--muted);
  font-size:.88rem;
}

@media (max-width: 900px){
  .site-legal{
    flex-wrap:wrap;
    justify-content:flex-start;
  }

  .site-legal__brand{
    width:100%;
    margin-right:0;
  }

  .legal-grid{
    grid-template-columns:1fr;
  }

  .legal-nav{
    position:static;
  }

  .legal-hero{
    padding:28px 22px;
  }

  .legal-card{
    padding:22px;
  }
}
