/* ============ Lumio: pure black, smooth buttons, neon star while Lumio answers ============ */
:root {
  color-scheme: dark;
  --bg: #000;
  --sidebar: #000;
  --panel: #070707;
  --panel-hover: #141414;
  --line: #1a1a1a;
  --text: #f4f4f6;
  --muted: #8f929c;
  --accent: #b7a3ff;
  --accent-strong: #9276ff;
  --neon: #5ef2ff;
  --neon-2: #c26bff;
  --user: #101010;
  --danger: #ff8a8a;
  --radius: 18px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button {
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease),
              box-shadow .3s var(--ease), transform .2s var(--ease), opacity .2s;
}
button:active:not(:disabled) { transform: scale(.96); }
button:disabled { cursor: not-allowed !important; opacity: .45; }
input, textarea, select { transition: border-color .25s, box-shadow .3s; }
.hidden { display: none !important; }
#boot { background: #000 !important; color: var(--muted) !important; }
a { color: #c4b6ff; text-decoration: none; transition: color .2s; }
a:hover { color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); font-size: 12px; }
.error-text { color: var(--danger); }
.fine { text-align: center; color: #6d707b; font-size: 11px; margin: 9px 0 0; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Layout ---------- */
.app { min-height: 100vh; display: flex; }
.sidebar {
  width: 268px; flex: 0 0 268px; background: var(--sidebar);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 15px 12px 12px; gap: 14px; min-height: 100vh; z-index: 20;
}
.sidebar-top { display: grid; gap: 6px; }
.brand-row { display: flex; align-items: center; gap: 10px; padding: 5px 9px 18px; }
.brand-mark {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px;
  background: linear-gradient(145deg, #e3dbff, #8871ed); color: #000; font-size: 21px; font-weight: 700;
  animation: glow 4s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 18px #9a80ff33; }
  50% { box-shadow: 0 0 32px #9a80ff77; }
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.5px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: -2px; }
.brand-star { color: var(--accent); font-size: 21px; display: inline-block; text-shadow: 0 0 12px #b7a3ff88; }

.side-btn, .history-item, .link-btn, .icon-btn, .chip, .btn {
  border: 0; color: var(--text); background: transparent; border-radius: 11px;
}
.side-btn {
  text-align: left; display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; min-height: 40px; color: #d9dae0;
}
.side-btn:hover { background: var(--panel-hover); transform: translateX(3px); }
#new-chat-btn { background: #141414; border: 1px solid #242424; }
#new-chat-btn:hover { background: #1c1c1c; border-color: #3a3a3a; box-shadow: 0 0 18px -8px var(--accent-strong); }
.side-btn:disabled:hover { background: transparent; transform: none; }
.side-label { padding: 5px 10px 0; font-size: 11px; font-weight: 650; color: #6f7280; text-transform: uppercase; letter-spacing: .09em; }
.history { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; min-height: 60px; }
.history-item { display: flex; align-items: center; gap: 4px; padding: 0 4px 0 0; border-radius: 11px; }
.history-item:hover { background: var(--panel-hover); }
.history-item.active { background: #151515; box-shadow: inset 2px 0 0 var(--accent); }
.history-title {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 9px 10px;
  color: #c8c9d0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 11px;
}
.history-item:hover .history-title { color: #fff; }
.side-foot {
  border-top: 1px solid var(--line); padding: 12px 7px 3px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; overflow: hidden;
}
.side-foot #user-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-btn { padding: 7px 9px; color: #c9c1ff; }
.link-btn:hover { background: var(--panel-hover); color: #fff; }

.main { min-width: 0; flex: 1; display: flex; flex-direction: column; min-height: 100vh; position: relative; background: #000; }
.topbar {
  height: 64px; flex: 0 0 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 25px; border-bottom: 1px solid #101010; background: #000;
  position: sticky; top: 0; z-index: 10;
}
.model-pill { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.toggle {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #c0c1ca;
  background: #0a0a0a; border: 1px solid var(--line); border-radius: 99px; padding: 7px 10px;
  transition: border-color .25s, box-shadow .3s;
}
.toggle:hover { border-color: #333; }
.toggle:has(input:checked) { border-color: var(--accent-strong); box-shadow: 0 0 14px -6px var(--accent-strong); }
.toggle input { accent-color: var(--accent-strong); }
.learn-pill {
  font-size: 12px; color: #c9c1ff; border: 1px solid #3b2f66; background: #0a0812;
  padding: 5px 11px; border-radius: 99px; max-width: 260px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 #9276ff33; }
  50% { box-shadow: 0 0 14px 2px #9276ff44; }
}
.icon-btn {
  width: 37px; height: 37px; display: inline-grid; place-items: center;
  color: #c9cad2; font-size: 18px; border: 1px solid transparent;
}
.icon-btn:hover { background: var(--panel-hover); border-color: #2a2a2a; }
.icon-btn.small { width: 28px; height: 28px; font-size: 13px; opacity: .6; }
.history-item:hover .icon-btn.small { opacity: 1; }
.mobile-only { display: none; }

.view { width: 100%; }
#chat-view { width: 100%; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.empty {
  width: min(760px, calc(100% - 36px)); margin: auto auto 22px; padding-top: 10vh;
  text-align: center; animation: rise .6s var(--ease) both;
}
.empty::before {
  content: "✦"; display: grid; place-items: center; width: 55px; height: 55px; margin: 0 auto 22px;
  border: 1px solid #3b2f66; border-radius: 18px; color: #c8baff; background: radial-gradient(circle at 35% 25%, #2a2050, #000 70%);
  font-size: 28px; box-shadow: 0 0 55px #9b82ff22; animation: float 5s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.empty h1 { font-size: clamp(26px, 3.2vw, 37px); line-height: 1.18; letter-spacing: -1.3px; font-weight: 650; margin: 0 0 11px; }
.empty p { margin: 0 auto 23px; font-size: 14px; }
.suggestions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid #242424; background: #0a0a0a; color: #c8c9d1;
  padding: 9px 12px; font-size: 12px; border-radius: 999px;
}
.chip:hover { background: #151515; border-color: #3a3a3a; color: #fff; transform: translateY(-1px); box-shadow: 0 0 16px -8px var(--accent-strong); }

/* ---------- Messages ---------- */
.messages { width: min(800px, calc(100% - 36px)); margin: 0 auto; padding: 25px 0 32px; flex: 1; }
.msg { display: flex; gap: 14px; padding: 6px 0 18px; animation: msg-in .5s var(--ease) both; }
.msg.user { flex-direction: row-reverse; }
.avatar {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
  display: grid; place-items: center; background: linear-gradient(135deg, #e3dbff, #8871ed);
  color: #000; font-weight: 700; font-size: 13px; box-shadow: 0 0 18px -4px #9a80ff;
}
.msg.user .avatar { background: #181818; color: #ddd; box-shadow: none; font-size: 11px; }
.msg-body { min-width: 0; flex: 1; }
.msg.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.user-text {
  background: var(--user); border: 1px solid #1f1f1f; padding: 12px 16px;
  border-radius: 20px 20px 6px 20px; max-width: min(78%, 620px);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.user-images { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.user-images img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid #222; }

.md { padding: 4px 0; overflow-wrap: anywhere; color: #e8e8ed; }
.md p { margin: 0 0 10px; }
.md h3, .md h4, .md h5, .md h6 { margin: 16px 0 6px; color: #fff; letter-spacing: -.2px; }
.md ul, .md ol { padding-left: 22px; margin: 6px 0 10px; }
.md li { margin: 3px 0; }
.md blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--accent-strong); color: var(--muted); }
.md strong { color: #fff; }
.md a { border-bottom: 1px solid #3b2f66; }
.md code {
  background: #111; border: 1px solid #1f1f1f; padding: 1px 6px; border-radius: 7px;
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-block {
  border: 1px solid #1c1c1c; border-radius: 14px; overflow: hidden; margin: 12px 0;
  background: #050505; box-shadow: 0 12px 30px -18px #000;
}
.code-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px 6px 14px; background: #0b0b0b; color: var(--muted); font-size: 12px;
}
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.code-block code { font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: none; border: 0; padding: 0; }
.sources { margin-top: 10px; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sources a { border: 1px solid #222; padding: 3px 9px; border-radius: 999px; transition: border-color .2s, color .2s; }
.sources a:hover { border-color: var(--accent-strong); color: #fff; }
.actions { display: flex; gap: 6px; margin-top: 8px; opacity: .7; transition: opacity .25s; }
.msg:hover .actions { opacity: 1; }
.reveal { animation: reveal .65s var(--ease) both; }
@keyframes reveal {
  from { opacity: 0; transform: scale(.97) translateY(8px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* ---------- Neon star: floats and flies while Lumio answers, then explodes into the reply ---------- */
.star-wrap { position: relative; height: 84px; display: flex; align-items: center; gap: 14px; overflow: visible; }
.neon-star { position: relative; width: 44px; height: 44px; flex: none; animation: star-fly 5.5s ease-in-out infinite; }
.neon-star svg {
  width: 100%; height: 100%; fill: #fff;
  animation: star-pulse 1.4s ease-in-out infinite;
}
.neon-star.boom { animation: star-boom .6s ease-in forwards; }
.star-label { color: var(--muted); font-size: 13.5px; transition: opacity .2s; animation: shimmer 2.2s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes star-fly {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(120px, -16px) rotate(90deg); }
  50%  { transform: translate(50px, 18px) rotate(180deg); }
  75%  { transform: translate(-70px, -10px) rotate(270deg); }
  100% { transform: translate(0, 0) rotate(360deg); }
}
@keyframes star-pulse {
  0%, 100% { filter: drop-shadow(0 0 3px var(--neon)) drop-shadow(0 0 10px var(--neon)) drop-shadow(0 0 22px var(--neon-2)); }
  50%      { filter: drop-shadow(0 0 6px var(--neon)) drop-shadow(0 0 18px var(--neon)) drop-shadow(0 0 36px var(--neon-2)); }
}
@keyframes star-boom {
  0%   { transform: scale(1) rotate(0deg); opacity: 1; }
  35%  { transform: scale(1.7) rotate(120deg); filter: brightness(2.2); opacity: 1; }
  100% { transform: scale(0) rotate(360deg); opacity: 0; }
}
.spark {
  position: fixed; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  pointer-events: none; z-index: 999;
  box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
  animation: spark .8s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes spark {
  0%   { transform: translate(0, 0) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.1); opacity: 0; }
}

/* ---------- Composer ---------- */
.composer-wrap { width: 100%; padding: 14px 22px 18px; margin-top: auto; background: linear-gradient(180deg, transparent, #000 24%); }
.composer-inner { width: min(800px, 100%); margin: 0 auto; }
.composer {
  display: flex; align-items: flex-end; gap: 9px; border: 1px solid #242424; background: #0a0a0a;
  border-radius: 24px; padding: 9px 10px; box-shadow: 0 12px 45px #00000080;
  transition: border-color .3s, box-shadow .3s;
}
.composer:focus-within { border-color: #6a5aa0; box-shadow: 0 0 0 3px #a58bff14, 0 0 30px -12px var(--accent-strong); }
#input {
  flex: 1; min-width: 0; resize: none; max-height: 180px; min-height: 28px; border: 0; outline: 0;
  background: transparent; color: var(--text); padding: 6px 2px; line-height: 1.5;
}
#input::placeholder { color: #6f7280; }
#attach-btn { font-size: 23px; flex: 0 0 35px; color: #6f7280; }
.send {
  width: 36px; height: 36px; flex: 0 0 36px; border: 0; border-radius: 50%;
  background: var(--accent); color: #000; font-size: 19px; font-weight: 700;
  display: grid; place-items: center;
}
.send:hover:not(:disabled) { background: #d4caff; transform: translateY(-1px) scale(1.05); box-shadow: 0 0 18px -2px var(--accent); }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 4px 8px; color: var(--muted); font-size: 12px; }
.att { position: relative; width: 66px; height: 66px; animation: msg-in .3s var(--ease) both; }
.att img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; border: 1px solid #333; }
.att button {
  position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid #333; background: #000; color: #fff; font-size: 14px; line-height: 1;
}

/* ---------- Image creation, schedule, panels ---------- */
.panel-wrap { width: min(760px, calc(100% - 36px)); margin: 35px auto; animation: rise .5s var(--ease) both; }
.panel-wrap h2 { font-size: 25px; letter-spacing: -.6px; margin: 0 0 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row > * { min-width: 0; }
.row.end { justify-content: flex-end; }
.stack input, .stack textarea, .stack select,
#settings-dialog input[type="text"], #settings-dialog input[type="email"], #settings-dialog input[type="password"] {
  width: 100%; background: #0a0a0a; color: var(--text); border: 1px solid #242424;
  border-radius: 12px; padding: 12px 13px; outline: none;
}
.stack input:focus, .stack textarea:focus, .stack select:focus {
  border-color: #7968b2; box-shadow: 0 0 16px -6px var(--accent-strong);
}
.btn { border: 1px solid #242424; background: #111; padding: 10px 14px; }
.btn:hover:not(:disabled) { background: #1a1a1a; border-color: #3a3a3a; transform: translateY(-1px); }
.btn.primary { color: #000; background: var(--accent); border-color: transparent; font-weight: 650; }
.btn.primary:hover:not(:disabled) { background: #d4caff; box-shadow: 0 0 22px -6px var(--accent); }
.img-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.img-card {
  margin: 0; border: 1px solid #1c1c1c; border-radius: 16px; overflow: hidden;
  background: var(--panel); min-height: 120px; animation: msg-in .5s var(--ease) both;
}
.img-card img { width: 100%; display: block; }
.img-card figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px; }
.img-card .star-wrap { height: 120px; padding: 0 16px; }
.sch-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid #1c1c1c; border-radius: 16px; padding: 13px 15px; background: var(--panel);
  transition: border-color .25s, transform .25s, box-shadow .3s; animation: msg-in .4s var(--ease) both;
}
.sch-item:hover { border-color: #3a2f5c; transform: translateY(-1px); box-shadow: 0 10px 30px -18px var(--accent-strong); }
.sch-item.done { opacity: .45; }
.sch-item.done strong { text-decoration: line-through; }
.sch-main { min-width: 0; }
.sch-actions { display: flex; gap: 6px; flex: none; }
.coming-soon { border: 1px solid #1c1c1c; background: var(--panel); border-radius: 14px; padding: 18px; color: #b9bac4; }
.disabled-note { color: #7a7d88; font-size: 11px; margin: 0 0 0 4px; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: #000; }
.auth-card {
  width: min(420px, 100%); background: var(--panel); border: 1px solid #1c1c1c; border-radius: 24px;
  padding: 30px; box-shadow: 0 24px 80px #0008, 0 0 60px -30px var(--accent-strong);
  animation: rise .6s var(--ease) both;
}
.auth-card .brand { display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; margin-bottom: 26px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form h2 { font-size: 22px; letter-spacing: -.5px; margin: 0 0 5px; }
.auth-form input {
  background: #000; color: var(--text); border: 1px solid #222; border-radius: 12px; padding: 12px 13px; outline: none;
}
.auth-form input:focus { border-color: #8a78c5; box-shadow: 0 0 16px -6px var(--accent-strong); }
.auth-form .btn { width: 100%; }
.auth-switch { color: var(--muted); text-align: center; font-size: 12px; margin: 3px 0 0; }

/* ---------- Settings, memory, toasts ---------- */
#settings-dialog {
  color: var(--text); background: #050505; border: 1px solid #1c1c1c; border-radius: 20px;
  padding: 23px; width: min(520px, calc(100% - 28px)); max-height: 85vh; overflow: auto;
  box-shadow: 0 30px 90px -20px #000;
}
#settings-dialog::backdrop { background: #000a; backdrop-filter: blur(6px); }
#settings-dialog h2, #settings-dialog h3 { margin: 0; }
.check { display: flex; align-items: center; gap: 10px; color: #d0d1d8; }
.check input { accent-color: var(--accent-strong); }
.end { justify-content: flex-end; }
.mem-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid #1c1c1c; border-radius: 12px; padding: 9px 11px; font-size: 14px;
}
.mem-item span { min-width: 0; overflow-wrap: anywhere; }
#toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel); border: 1px solid #3a2f5c; color: #ececf3; padding: 11px 15px;
  border-radius: 14px; max-width: 340px; box-shadow: 0 0 24px -10px var(--accent-strong);
  animation: rise .35s var(--ease) both;
}

/* ---------- Small screens: sidebar slides in ---------- */
@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-105%);
    transition: transform .25s var(--ease); box-shadow: 20px 0 60px #000;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: inline-grid; }
  .topbar { padding: 0 12px; }
  .composer-wrap { padding: 12px 12px 16px; }
  .empty { padding-top: 7vh; }
  .empty h1 { letter-spacing: -.8px; }
  .toggle { font-size: 11px; padding: 6px 8px; }
  .learn-pill { display: none; }
}
@media (max-width: 480px) {
  .topbar-right { gap: 3px; }
  .toggle { max-width: 116px; }
  .empty { width: calc(100% - 26px); }
  .suggestions { gap: 6px; }
  .chip { padding: 8px 10px; }
  .row { flex-wrap: wrap; }
  .row > * { flex: 1 1 120px; }
  .auth-card { padding: 23px; }
  .user-text { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
