/* ==========================================================
   Hangout - themes, glass, motion
   ========================================================== */
:root {
  --accent: #5865f2;
  --accent-hover: color-mix(in srgb, var(--accent) 82%, black);
  --green: #23a55a;
  --red: #f23f43;
  --yellow: #f0b232;
  --glass-opacity: 80;
  --glass-blur: 14;
  --font-size: 16px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --default-bg: radial-gradient(1200px 700px at 12% 8%, #3b3f8f66, transparent 60%),
                radial-gradient(900px 600px at 90% 90%, #8b3fa066, transparent 60%),
                linear-gradient(135deg, #14151c, #1b1c26);
}

/* Themes */
[data-theme="dark"]   { --bg-1:#1e1f22; --bg-2:#2b2d31; --bg-3:#313338; --bg-4:#383a40; --bg-5:#404249; --text:#f2f3f5; --muted:#949ba4; --line:#ffffff14; }
[data-theme="ash"]    { --bg-1:#1a1a1e; --bg-2:#242429; --bg-3:#2c2c32; --bg-4:#35353c; --bg-5:#3f3f47; --text:#eeeef2; --muted:#9a9aa6; --line:#ffffff14; }
[data-theme="onyx"]   { --bg-1:#000000; --bg-2:#0a0a0c; --bg-3:#101013; --bg-4:#1a1a1f; --bg-5:#24242a; --text:#f4f4f6; --muted:#8a8a94; --line:#ffffff18; --default-bg: linear-gradient(135deg,#000,#0a0a12); }
[data-theme="light"]  { --bg-1:#e3e5e8; --bg-2:#f2f3f5; --bg-3:#ffffff; --bg-4:#ebedef; --bg-5:#dcdee1; --text:#060607; --muted:#5c5e66; --line:#00000014; --default-bg: linear-gradient(135deg,#e9ecff,#fbeaff); }
[data-theme="aurora"] { --bg-1:#07141a; --bg-2:#0c2129; --bg-3:#0f2a33; --bg-4:#15384a; --bg-5:#1b4a5c; --text:#e9fbff; --muted:#7fb2c2; --line:#7ff0ff18;
  --default-bg: radial-gradient(900px 600px at 15% 10%, #00e5a555, transparent 60%), radial-gradient(900px 600px at 85% 80%, #5b6bff55, transparent 60%), linear-gradient(135deg,#06131a,#0b2230); }
[data-theme="sunset"] { --bg-1:#1d0d17; --bg-2:#2a1220; --bg-3:#341729; --bg-4:#441e35; --bg-5:#57284a; --text:#fff1ec; --muted:#c99aa8; --line:#ffb08a18;
  --default-bg: radial-gradient(900px 600px at 10% 15%, #ff7a4a55, transparent 60%), radial-gradient(900px 600px at 90% 85%, #ff3f8e55, transparent 60%), linear-gradient(135deg,#1c0b15,#2b1020); }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--font-size);
  background: var(--bg-1);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 50%, transparent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-5); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; border: 3px solid transparent; }

/* Background layer */
#bgLayer {
  position: fixed; inset: 0; z-index: 0;
  background: var(--default-bg);
  background-size: cover; background-position: center;
  transition: background .6s var(--ease);
}

/* Glass */
.glass {
  background: color-mix(in srgb, var(--tint, var(--bg-2)) calc(var(--glass-opacity) * 1%), transparent);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 1px)) saturate(140%);
  backdrop-filter: blur(calc(var(--glass-blur) * 1px)) saturate(140%);
  transition: background .35s var(--ease);
}
.glass-card {
  background: color-mix(in srgb, var(--bg-2) calc(var(--glass-opacity) * 1%), transparent);
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 1px)) saturate(140%);
  backdrop-filter: blur(calc(var(--glass-blur) * 1px)) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px #0006;
}

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: .9rem;
  transition: transform .15s var(--spring), background .2s, box-shadow .25s, opacity .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn.ghost { background: var(--bg-5); }
.btn.ghost:hover { background: color-mix(in srgb, var(--bg-5) 80%, var(--text)); }
.btn.danger { background: var(--red); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.block { width: 100%; padding: 12px; }
.btn.small { padding: 6px 12px; font-size: .8rem; }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.nitro-btn { background: linear-gradient(90deg, #ff73fa, #7a7cff, #3fe0ff, #ff73fa); background-size: 300% 100%; color: #fff; animation: flow 6s linear infinite; padding: 12px 28px; font-size: 1rem; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  color: var(--muted); transition: background .18s, color .18s, transform .15s var(--spring);
}
.icon-btn:hover { background: var(--bg-5); color: var(--text); }
.icon-btn:active { transform: scale(.88); }
.icon-btn.off { color: var(--red); }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; font-size: .75rem; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.field input, .field textarea, .row input, #dmSearch {
  background: var(--bg-1); border: 1px solid transparent; border-radius: 8px; padding: 11px 12px;
  color: var(--text); font-size: .95rem; font-weight: 400; resize: vertical; width: 100%;
  transition: border-color .2s, box-shadow .25s, background .2s;
}
.field input:focus, .field textarea:focus, .row input:focus, #dmSearch:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.field input[type=color] { padding: 2px; height: 42px; cursor: pointer; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.form-error { color: var(--red); font-size: .85rem; min-height: 1.2em; margin-bottom: 10px; }
.form-error.ok { color: var(--green); }
.badge { background: var(--red); color: #fff; border-radius: 10px; min-width: 18px; height: 18px; padding: 0 5px; font-size: .7rem; display: inline-grid; place-items: center; font-weight: 700; }

/* ---------- Auth ---------- */
.auth { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(440px, 100%); padding: 32px; text-align: center; animation: pop .6s var(--spring) both; }
.auth-card h1 { font-size: 1.6rem; margin: 14px 0 6px; font-weight: 800; }
.auth-card form { text-align: left; margin-top: 22px; }
.brand-mark { width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; display: grid; place-items: center; font-size: 28px; color: #fff; background: var(--accent); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 55%, transparent); animation: float 4s ease-in-out infinite; }
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-1); border-radius: 10px; padding: 4px; margin-top: 22px; }
.seg-btn { position: relative; z-index: 1; padding: 9px; font-weight: 600; font-size: .9rem; color: var(--muted); transition: color .25s; }
.seg-btn.active { color: var(--text); }
.seg-thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); background: var(--bg-5); border-radius: 7px; transition: transform .4s var(--spring); }
.seg.reg .seg-thumb { transform: translateX(100%); }
#confirmGroup { animation: slideDown .35s var(--ease) both; }

/* ---------- App layout ---------- */
.app { position: fixed; inset: 0; z-index: 1; display: grid; grid-template-columns: 72px 264px 1fr; animation: fade .5s var(--ease) both; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; }
.rail-btn {
  width: 48px; height: 48px; border-radius: 50%; background: var(--bg-3); color: var(--text); font-size: 20px;
  display: grid; place-items: center; position: relative;
  transition: border-radius .3s var(--spring), background .25s, color .25s, transform .2s var(--spring);
}
.rail-btn:hover, .rail-btn.active { border-radius: 16px; background: var(--accent); color: #fff; }
.rail-btn.gem:hover, .rail-btn.gem.active { background: linear-gradient(135deg, #ff73fa, #7a7cff); }
.rail-btn:active { transform: scale(.9); }
.rail-btn::before { content: ""; position: absolute; left: -12px; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--text); transition: height .3s var(--spring); }
.rail-btn.active::before { height: 36px; }
.rail-btn:hover:not(.active)::before { height: 20px; }
.rail-sep { width: 32px; height: 2px; background: var(--line); border-radius: 2px; }
.rail-sep.wide { width: 100%; margin: 8px 0; }

.sidebar { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.sidebar-search { padding: 10px; border-bottom: 1px solid var(--line); }
.sidebar-search input { padding: 7px 10px; font-size: .85rem; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 8px; }
.side-heading { padding: 16px 10px 6px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); text-transform: none; }
.side-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px;
  color: var(--muted); font-weight: 500; text-align: left; margin-bottom: 2px;
  transition: background .18s, color .18s, transform .2s var(--ease), padding .25s var(--ease);
}
.side-item i { width: 24px; text-align: center; font-size: 1.05rem; }
.side-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item:hover { background: color-mix(in srgb, var(--bg-5) 60%, transparent); color: var(--text); transform: translateX(2px); }
.side-item.active { background: var(--bg-5); color: var(--text); }
.dm-item { animation: slideRight .35s var(--ease) both; }

.user-panel { display: flex; align-items: center; gap: 4px; padding: 8px; background: color-mix(in srgb, var(--bg-1) 70%, transparent); border-top: 1px solid var(--line); }
.user-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 8px; text-align: left; transition: background .2s; }
.user-info:hover { background: var(--bg-5); }
.user-info .names { min-width: 0; line-height: 1.2; }
.user-info .n1 { font-weight: 600; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info .n2 { font-size: .72rem; color: var(--muted); }
.user-actions { display: flex; }

.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-radius: 0; }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; animation: viewIn .45s var(--ease) both; }
.view-body { flex: 1; overflow-y: auto; padding: 20px 28px; }
.topbar { height: 48px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 16px; border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 #0002; }
.topbar-title { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.topbar-title i { color: var(--muted); }
.divider-v { width: 1px; height: 24px; background: var(--line); }
.pill-tabs { display: flex; gap: 6px; }
.pill { padding: 4px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; font-size: .9rem; display: inline-flex; gap: 6px; align-items: center; transition: background .2s, color .2s, transform .15s var(--spring); }
.pill:hover { background: var(--bg-5); color: var(--text); }
.pill.active { background: var(--bg-5); color: var(--text); }
.pill:active { transform: scale(.94); }
.pill.add { background: var(--green); color: #fff; }
.pill.add.active { background: color-mix(in srgb, var(--green) 25%, transparent); color: var(--green); }

/* ---------- Avatars ---------- */
.avatar { position: relative; width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: .85rem; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.lg { width: 40px; height: 40px; font-size: 1rem; }
.avatar.xl { width: 80px; height: 80px; font-size: 2rem; }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); border: 3px solid var(--bg-2); box-sizing: content-box; transition: background .3s; }
.avatar.xl .dot { width: 18px; height: 18px; border-width: 5px; right: -4px; bottom: -4px; }
.avatar .dot.on { background: var(--green); }
.name-nitro { background: linear-gradient(90deg, #ff9bfb, #8f91ff, #52e7ff, #ff9bfb); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: flow 5s linear infinite; }
.nitro-badge { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, #ff73fa, #7a7cff); color: #fff; font-size: 8px; vertical-align: middle; margin-left: 4px; }

/* ---------- Friends list ---------- */
.friends-head { font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.friend-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border-top: 1px solid var(--line); cursor: pointer; transition: background .2s, transform .25s var(--ease); animation: slideUp .4s var(--ease) both; }
.friend-row:hover { background: color-mix(in srgb, var(--bg-5) 60%, transparent); transform: translateX(3px); }
.friend-row .who { flex: 1; min-width: 0; }
.friend-row .who b { font-weight: 600; }
.friend-row .who small { display: block; color: var(--muted); font-size: .78rem; }
.friend-row .acts { display: flex; gap: 8px; }
.round-btn { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; color: var(--muted); transition: transform .2s var(--spring), color .2s, background .2s; }
.round-btn:hover { transform: scale(1.12); color: var(--text); }
.round-btn.ok:hover { color: var(--green); }
.round-btn.no:hover { color: var(--red); }
.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 70px 20px; color: var(--muted); animation: pop .5s var(--spring) both; }
.empty i { font-size: 3rem; opacity: .5; }
.add-box { max-width: 640px; }
.add-box h2 { margin-bottom: 6px; }
.add-row { display: flex; gap: 10px; margin-top: 16px; padding: 8px; background: var(--bg-1); border-radius: 10px; border: 1px solid transparent; transition: border-color .2s, box-shadow .25s; }
.add-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.add-row input { flex: 1; background: none; border: 0; outline: 0; padding: 6px 8px; }

/* ---------- Chat ---------- */
.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; display: flex; flex-direction: column; scroll-behavior: smooth; }
.chat-intro { padding: 16px; margin-top: auto; }
.chat-intro h2 { font-size: 1.8rem; margin: 10px 0 4px; }
.date-div { display: flex; align-items: center; gap: 10px; margin: 16px 16px 6px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.date-div::before, .date-div::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg { position: relative; display: flex; gap: 16px; padding: 2px 16px; }
.msg.anim { animation: msgIn .35s var(--ease) both; }
.msg.first { margin-top: 14px; }
.msg:hover { background: color-mix(in srgb, var(--bg-1) 25%, transparent); }
.msg .gutter { width: 40px; flex: none; font-size: .68rem; color: var(--muted); opacity: 0; text-align: right; padding-top: 4px; transition: opacity .15s; }
.msg:hover .gutter { opacity: 1; }
.msg .body { min-width: 0; flex: 1; line-height: 1.45; }
.msg .head { display: flex; gap: 8px; align-items: baseline; }
.msg .head .author { font-weight: 600; cursor: pointer; }
.msg .head .author:hover { text-decoration: underline; }
.msg .head time { font-size: .72rem; color: var(--muted); }
.msg .text { word-wrap: break-word; overflow-wrap: anywhere; }
.msg .text code { background: var(--bg-1); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, Consolas, monospace; font-size: .88em; }
.msg .text a { color: color-mix(in srgb, var(--accent) 60%, white); }
.msg.pending .text { opacity: .55; }
.msg.failed .text { color: var(--red); }
.msg .tools { position: absolute; right: 16px; top: -14px; display: flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .22s var(--ease); pointer-events: none; }
.msg:hover .tools { opacity: 1; transform: none; pointer-events: auto; }
.compact .msg.first { margin-top: 6px; }
.compact .msg { gap: 10px; }

.composer-wrap { padding: 0 16px 20px; flex: none; }
.composer { position: relative; display: flex; align-items: flex-end; gap: 4px; background: var(--bg-4); border-radius: 10px; padding: 6px 8px; transition: box-shadow .25s; }
.composer:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.composer textarea { flex: 1; background: none; border: 0; outline: 0; resize: none; max-height: 200px; padding: 8px; line-height: 1.4; }
.composer textarea:disabled { cursor: not-allowed; }
.icon-btn.send { color: var(--accent); }
.icon-btn.send:hover { background: var(--accent); color: #fff; }
.emoji-picker { position: absolute; right: 0; bottom: 52px; width: 300px; padding: 10px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px #0008; animation: pop .3s var(--spring) both; transform-origin: bottom right; z-index: 20; }
.emoji-picker button { font-size: 1.3rem; padding: 4px; border-radius: 6px; transition: transform .15s var(--spring), background .15s; }
.emoji-picker button:hover { background: var(--bg-5); transform: scale(1.25); }

/* ---------- Popout / profile card ---------- */
.popout { position: fixed; z-index: 60; width: 300px; animation: pop .28s var(--spring) both; }
.profile-card { overflow: hidden; width: 100%; }
.profile-card .banner { height: 100px; background-size: cover; background-position: center; }
.profile-card .pc-body { padding: 0 16px 16px; }
.profile-card .pc-av { margin-top: -40px; margin-bottom: 8px; }
.profile-card .pc-av .avatar { border: 6px solid color-mix(in srgb, var(--bg-2) 100%, transparent); box-sizing: content-box; }
.profile-card h3 { font-size: 1.25rem; }
.profile-card .un { color: var(--muted); font-size: .85rem; }
.profile-card .box { margin-top: 12px; padding: 12px; background: color-mix(in srgb, var(--bg-1) 60%, transparent); border-radius: 10px; font-size: .85rem; }
.profile-card .box b { display: block; font-size: .7rem; letter-spacing: .04em; margin-bottom: 4px; color: var(--muted); }

/* ---------- Nitro ---------- */
.nitro { max-width: 980px; margin: 0 auto; width: 100%; }
.nitro-hero { position: relative; text-align: center; padding: 64px 24px; border-radius: 20px; overflow: hidden; background: linear-gradient(135deg, #2a1466, #4b1c8f 45%, #ad3dc9); color: #fff; margin-bottom: 24px; }
.nitro-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; position: relative; }
.nitro-hero p { max-width: 520px; margin: 12px auto 24px; opacity: .9; position: relative; }
.nitro-hero .btn { position: relative; }
.orb { position: absolute; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, #ff73fa88, transparent 65%); top: -140px; left: -80px; animation: drift 9s ease-in-out infinite alternate; }
.perks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.perk { padding: 20px; border-radius: 14px; background: color-mix(in srgb, var(--bg-2) 80%, transparent); border: 1px solid var(--line); transition: transform .3s var(--spring), border-color .25s, box-shadow .3s; animation: slideUp .5s var(--ease) both; }
.perk:nth-child(2) { animation-delay: .05s; } .perk:nth-child(3) { animation-delay: .1s; } .perk:nth-child(4) { animation-delay: .15s; } .perk:nth-child(5) { animation-delay: .2s; } .perk:nth-child(6) { animation-delay: .25s; }
.perk:hover { transform: translateY(-6px) rotate(-.6deg); border-color: #a66bff; box-shadow: 0 16px 40px #a66bff33; }
.perk i { font-size: 1.5rem; margin-bottom: 12px; background: linear-gradient(135deg, #ff73fa, #7a7cff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.perk h3 { margin-bottom: 6px; }
.perk p { color: var(--muted); font-size: .9rem; }

/* ---------- Settings ---------- */
.settings-overlay { position: fixed; inset: 0; z-index: 50; display: flex; background: color-mix(in srgb, var(--bg-3) calc(var(--glass-opacity) * 1%), transparent); -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 1px)); backdrop-filter: blur(calc(var(--glass-blur) * 1px)); animation: settingsIn .4s var(--ease) both; }
.settings-overlay.closing { animation: settingsOut .25s var(--ease) both; }
.settings-nav { flex: 1 0 218px; display: flex; justify-content: flex-end; background: color-mix(in srgb, var(--bg-2) 70%, transparent); padding: 60px 6px 20px 20px; }
.settings-nav-inner { width: 190px; }
.snav { width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 8px 10px; border-radius: 6px; margin-bottom: 2px; color: var(--muted); font-weight: 500; transition: background .18s, color .18s, transform .2s var(--ease); }
.snav:hover { background: var(--bg-5); color: var(--text); transform: translateX(3px); }
.snav.active { background: color-mix(in srgb, var(--accent) 30%, var(--bg-5)); color: var(--text); }
.snav.danger { color: var(--red); }
.settings-content { flex: 1 1 800px; overflow-y: auto; padding: 60px 40px 80px; }
.settings-inner { position: relative; max-width: 740px; }
.ssec { animation: viewIn .4s var(--ease) both; }
.ssec h2 { font-size: 1.3rem; margin-bottom: 20px; }
.ssec h3 { font-size: .8rem; letter-spacing: .03em; color: var(--muted); margin: 24px 0 10px; }
.close-x { position: fixed; top: 40px; right: 40px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--muted); color: var(--muted); display: grid; place-items: center; transition: transform .35s var(--spring), color .2s, border-color .2s; }
.close-x:hover { transform: rotate(90deg) scale(1.1); color: var(--text); border-color: var(--text); }
.card-block { padding: 18px; border-radius: 12px; background: color-mix(in srgb, var(--bg-2) 85%, transparent); border: 1px solid var(--line); }
.account-top { display: flex; gap: 16px; align-items: center; }
.account-top h3 { margin: 0; color: var(--text); font-size: 1.15rem; letter-spacing: 0; }
.profile-grid { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.preview-label { font-size: .75rem; font-weight: 700; margin-bottom: 8px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.theme-tile { position: relative; border-radius: 12px; overflow: hidden; border: 2px solid transparent; text-align: left; background: var(--bg-2); transition: transform .3s var(--spring), border-color .2s, box-shadow .3s; }
.theme-tile:hover { transform: translateY(-4px) scale(1.03); }
.theme-tile.active { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.theme-tile .sw { height: 64px; display: grid; grid-template-columns: 22% 32% 1fr; }
.theme-tile .lbl { padding: 8px 10px; font-size: .82rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.theme-tile.locked { opacity: .75; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; transition: transform .25s var(--spring), border-color .2s; box-shadow: inset 0 0 0 1px #0004; }
.swatch:hover { transform: scale(1.15); }
.swatch.active { border-color: var(--text); }
.slider { display: block; margin-bottom: 16px; font-size: .85rem; font-weight: 600; }
.slider span { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); }
.slider b { color: var(--text); }
input[type=range] { width: 100%; accent-color: var(--accent); height: 6px; cursor: pointer; }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row input { appearance: none; width: 40px; height: 22px; border-radius: 12px; background: var(--bg-5); position: relative; cursor: pointer; transition: background .25s; }
.switch-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .3s var(--spring); }
.switch-row input:checked { background: var(--green); }
.switch-row input:checked::after { transform: translateX(18px); }
.nitro-status { text-align: center; padding: 32px; }
.nitro-status h3 { color: var(--text); font-size: 1.2rem; margin: 10px 0 6px; letter-spacing: 0; }
.nitro-status p { margin-bottom: 18px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 10px 30px #0007; animation: toastIn .45s var(--spring) both; max-width: 320px; }
.toast.out { animation: toastOut .3s var(--ease) both; }
.toast.err i { color: var(--red); } .toast.ok i { color: var(--green); } .toast.info i { color: var(--accent); }

/* ---------- Keyframes ---------- */
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: scale(.85) translateY(10px) } to { opacity: 1; transform: none } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }
@keyframes slideRight { from { opacity: 0; transform: translateX(-12px) } to { opacity: 1; transform: none } }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px) scale(.995) } to { opacity: 1; transform: none } }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
@keyframes settingsIn { from { opacity: 0; transform: scale(1.06) } to { opacity: 1; transform: none } }
@keyframes settingsOut { to { opacity: 0; transform: scale(1.06) } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.9) } to { opacity: 1; transform: none } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px) } }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
@keyframes flow { to { background-position: 300% 0 } }
@keyframes drift { to { transform: translate(120px, 60px) scale(1.15) } }

.no-motion *, .no-motion *::before, .no-motion *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .rail { display: none; }
  .app { grid-template-columns: 220px 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .settings-nav { flex-basis: 150px; padding-left: 8px; }
  .settings-content { padding: 60px 16px; }
  .close-x { top: 12px; right: 12px; }
}
@media (max-width: 600px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: absolute; inset: 0; z-index: 3; }
  body.in-chat .sidebar { display: none; }
  body.in-chat .mobile-back { display: grid; }
}
.mobile-back { display: none; position: absolute; top: 8px; right: 10px; z-index: 5; }