/* ============================================================
   Rafa AI · Premium interface layer
   Loaded after cyber.css. Builds the Obsidian design system on
   top of the existing theme tokens without replacing features.
   ============================================================ */

:root {
  --sidebar-w: 268px;
  --surface-line: color-mix(in srgb, var(--stroke) 78%, transparent);
  --surface-raised: color-mix(in srgb, var(--surface-2) 88%, var(--bg));
  --accent-line: color-mix(in srgb, var(--accent) 32%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 42%, transparent);
  --content-w: 880px;
}

html[data-theme="obsidian"] { --image-text: #e9d5ff; }
html[data-theme="obsidian"] .brand-mark .mark-ring { display: none; }
html[data-theme="obsidian"] .brand-mark,
html[data-theme="obsidian"] .login-page .logo {
  background: linear-gradient(135deg, #b69cff, #8b5cf6 46%, #22d3ee 108%);
  color: #0b0616;
  box-shadow: 0 10px 26px -14px rgba(139, 92, 246, .75), inset 0 1px 0 rgba(255, 255, 255, .5);
}

/* ---------- Ambient shell ---------- */
body {
  padding: 16px;
  letter-spacing: -.005em;
}
html[data-theme="obsidian"] body {
  background:
    radial-gradient(1000px 700px at 10% -14%, rgba(139, 92, 246, .20), transparent 62%),
    radial-gradient(820px 620px at 104% 4%, rgba(34, 211, 238, .10), transparent 60%),
    radial-gradient(720px 560px at 48% 116%, rgba(232, 121, 249, .12), transparent 66%),
    linear-gradient(170deg, #110a1c 0%, #09060f 55%, #06040a 100%);
  background-attachment: fixed;
}
html[data-theme="obsidian"] .backdrop span { opacity: calc(var(--blob-opacity) * .70); }
html[data-theme="obsidian"] .backdrop .mesh { opacity: .12; }
html[data-theme="obsidian"] .backdrop i { opacity: .18; }

.app {
  width: min(1440px, 100%);
  height: min(940px, calc(100dvh - 32px));
  border-radius: 22px;
  border-color: var(--glass-border);
  background:
    radial-gradient(120% 85% at 6% -18%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 55%),
    radial-gradient(90% 70% at 104% 110%, color-mix(in srgb, var(--accent-2) 6%, transparent), transparent 58%),
    radial-gradient(70% 60% at 50% 112%, color-mix(in srgb, var(--accent-3) 5%, transparent), transparent 65%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-1) 94%, #000), color-mix(in srgb, var(--bg-deep) 95%, #000));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .04) inset,
    0 48px 120px -60px rgba(0, 0, 0, .9),
    0 0 0 1px rgba(0, 0, 0, .35);
  backdrop-filter: none;
  animation: premiumShell .5s var(--ease-out) both;
}
.app::before {
  background: linear-gradient(150deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .02) 26%, transparent 52%, color-mix(in srgb, var(--accent) 32%, transparent) 84%, color-mix(in srgb, var(--accent-3) 20%, transparent) 96%, rgba(255, 255, 255, .08));
}

/* ---------- Type & icons ---------- */
button, input, select, textarea { letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
svg { flex: none; }
.brand h1 { letter-spacing: -.03em; text-shadow: none; }
.hero-title, .topbar-title { text-wrap: balance; }

/* ---------- Topbar ---------- */
.topbar {
  flex: none;
  min-height: 62px;
  padding: 0 clamp(14px, 2vw, 22px);
  gap: 12px;
  border-bottom: 1px solid var(--surface-line);
  background: color-mix(in srgb, var(--surface-1) 72%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
  backdrop-filter: blur(18px);
}
.topbar-left { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .icon-btn { width: 36px; height: 36px; border-radius: 10px; color: var(--muted); }
.topbar .icon-btn svg { width: 18px; height: 18px; }
.topbar .brand { flex: none; gap: 9px; }
.topbar .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 6px 16px -10px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.topbar .brand h1 { font-size: 14px; font-weight: 650; }
.topbar-divider { width: 1px; height: 20px; margin: 0 2px; background: var(--stroke); flex: none; }
.topbar-title {
  min-width: 0;
  max-width: 38ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
}
.header-actions { gap: 6px; }
.header-actions form { display: flex; }

#status.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  margin: 0 2px 0 0;
  padding: 0 10px;
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
#status::before {
  width: 6px;
  height: 6px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 15%, transparent);
}
#status.offline { color: var(--muted); }

.header-actions .ghost,
.header-actions .model-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--surface-line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface-2) 46%, transparent);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  box-shadow: none;
}
.header-actions a.ghost { text-decoration: none; }
.header-actions .ghost svg { width: 15px; height: 15px; }
.header-actions .ghost:hover,
.header-actions .model-chip:hover {
  border-color: var(--stroke-strong);
  background: color-mix(in srgb, var(--surface-3) 66%, transparent);
  color: var(--text);
  box-shadow: 0 8px 22px -18px rgba(0, 0, 0, .8);
}
.model-chip .model-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.model-chip .model-name { color: var(--text-2); }
.voice-ghost { color: var(--accent-text); }
.voice-ghost:hover { color: var(--text); }
.logout-btn { color: var(--muted); }
.logout-btn:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.logout-btn svg { width: 17px; height: 17px; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  gap: 0;
  padding: 14px 10px 12px;
  border-right: 1px solid var(--surface-line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-1) 90%, transparent), color-mix(in srgb, var(--bg-deep) 96%, transparent));
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, .025);
}
body.sidebar-collapsed .sidebar { margin-left: calc(var(--sidebar-w) * -1); }
.sidebar-head { padding: 2px 4px 12px; }
.sidebar-brand { gap: 10px; }
.brand-mark.mini {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 6px 16px -10px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .32);
}
.sidebar-brand-text strong { font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
.sidebar-brand-text span { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .14em; }
#sidebar-close { width: 30px; height: 30px; color: var(--muted); }

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 2px 8px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 20%, transparent) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { border-radius: 999px; background: color-mix(in srgb, var(--muted) 18%, transparent); }
.side-section { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.side-group-label {
  margin: 0 8px 1px;
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.sidebar-tools .side-group-label { margin-top: 0; }

.new-chat {
  justify-content: flex-start;
  gap: 8px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 17%, transparent), color-mix(in srgb, var(--accent) 9%, transparent));
  color: color-mix(in srgb, var(--accent-text) 88%, #ffffff);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}
.new-chat svg { width: 15px; height: 15px; }
.new-chat:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 24%, transparent), color-mix(in srgb, var(--accent) 13%, transparent));
  color: #fff;
  box-shadow: 0 8px 22px -16px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .1);
  transform: none;
}
.sidebar-search {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--surface-line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-deep) 42%, transparent);
  box-shadow: none;
}
.sidebar-search svg { width: 14px; height: 14px; color: var(--muted); }
.sidebar-search input { padding: 0; font-size: 11.5px; }
.sidebar-search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.chat-list {
  gap: 1px;
  max-height: clamp(140px, 29vh, 300px);
  min-height: 72px;
  padding: 2px 0 0;
}
.chat-group {
  margin: 9px 8px 3px;
  padding: 0;
  color: color-mix(in srgb, var(--muted) 68%, transparent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
}
.chat-group:first-child { margin-top: 4px; }
.chat-row { border-radius: 8px; }
.chat-row:hover { background: color-mix(in srgb, var(--surface-3) 58%, transparent); }
.chat-row.active {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}
.chat-open {
  gap: 8px;
  padding: 7px 6px 7px 9px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 11.8px;
}
.chat-row.active .chat-open { color: var(--text); font-weight: 600; }
.chat-row.active .chat-open::before {
  content: "";
  width: 3px;
  height: 14px;
  flex: none;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.chat-time { font-size: 9.5px; color: color-mix(in srgb, var(--muted) 62%, transparent); }
.chat-delete { width: 24px; height: 24px; font-size: 13px; }
.chat-list-empty {
  margin: 4px 0;
  padding: 16px 10px;
  border: 1px dashed var(--surface-line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 34%, transparent);
  font-size: 11px;
  line-height: 1.5;
}

.theme-dock {
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--surface-line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-deep) 38%, transparent);
  box-shadow: none;
}
.theme-chip {
  flex-direction: row;
  gap: 6px;
  justify-content: center;
  height: 30px;
  padding: 0 4px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 600;
}
.theme-chip:hover { background: color-mix(in srgb, var(--surface-3) 55%, transparent); }
.theme-chip.active {
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.theme-dot { width: 11px; height: 11px; }
.theme-chip[data-theme="cyber"] .theme-dot { background: linear-gradient(135deg, #4d9bff, #ff4fb8 70%, #22d3ee); }
.theme-chip[data-theme="obsidian"] .theme-dot { background: linear-gradient(135deg, #8b5cf6, #22d3ee); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
.theme-chip[data-theme="slate"] .theme-dot { background: linear-gradient(135deg, #2dd4bf, #7dd3fc 60%, #e8c07d); }
.theme-swatch.obsidian { background: linear-gradient(135deg, #8b5cf6, #22d3ee); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }

.side-tools { display: flex; flex-direction: column; gap: 1px; }
.side-action {
  height: 34px;
  gap: 9px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}
.side-ico { width: 20px; height: 20px; display: grid; place-items: center; color: color-mix(in srgb, var(--muted) 92%, transparent); }
.side-ico svg { width: 16px; height: 16px; }
.side-action:hover {
  background: color-mix(in srgb, var(--surface-3) 56%, transparent);
  color: var(--text);
  box-shadow: none;
}
.side-action:hover .side-ico { color: var(--accent-text); }
.side-action.voice { color: var(--text-2); }
.side-action.voice .side-ico { color: var(--accent-text); }
.side-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-new {
  margin-left: auto;
  padding: 2px 6px;
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: .04em;
}
.side-new.danger {
  min-width: 16px;
  border-color: rgba(255, 96, 124, .42);
  background: rgba(255, 96, 124, .16);
  color: #ffb3c1;
  text-align: center;
  font-weight: 800;
  animation: alert-pulse 2.4s ease-in-out infinite;
}
@keyframes alert-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 96, 124, 0); }
  50% { box-shadow: 0 0 0 3px rgba(255, 96, 124, .12); }
}
.side-pill {
  margin-left: auto;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 9.5px;
}
.sidebar-foot { padding: 9px 6px 0; border-top: 1px solid var(--surface-line); }
.side-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: color-mix(in srgb, var(--muted) 72%, transparent);
  font-size: 9.5px;
  line-height: 1.4;
}
.side-note svg { width: 11px; height: 11px; flex: none; opacity: .8; }

/* ---------- Chat workspace ---------- */
#chat {
  padding: 26px max(18px, calc((100% - var(--content-w)) / 2)) 12px;
  gap: 18px;
  background-image: radial-gradient(58% 40% at 50% 0%, color-mix(in srgb, var(--accent) 4%, transparent), transparent 72%);
  scrollbar-color: color-mix(in srgb, var(--muted) 22%, transparent) transparent;
}
.message { max-width: 86%; gap: 11px; align-items: flex-start; }
.message.user { max-width: 78%; }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 10.5px;
  font-weight: 700;
}
.message.assistant .avatar {
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 26%, transparent), color-mix(in srgb, var(--accent-2) 12%, transparent));
  color: var(--accent-text);
  box-shadow: none;
}
.message.user .avatar {
  border: 1px solid var(--surface-line);
  background: color-mix(in srgb, var(--surface-3) 60%, transparent);
  color: var(--text-2);
}
.bubble {
  padding: 11px 14px 12px;
  border-radius: 14px 14px 14px 4px;
  border: 1px solid var(--surface-line);
  background: color-mix(in srgb, var(--surface-2) 62%, transparent);
  box-shadow: 0 8px 24px -22px rgba(0, 0, 0, .8);
}
.message.user .bubble {
  border-radius: 14px 14px 4px 14px;
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  background:
    radial-gradient(120% 100% at 16% 0%, rgba(255, 255, 255, .12), transparent 56%),
    linear-gradient(140deg, color-mix(in srgb, var(--accent) 74%, #1b1030), color-mix(in srgb, var(--accent) 42%, #0d0b14));
  color: #f7f4ff;
  box-shadow: 0 14px 32px -24px var(--accent-glow);
}
.message.user .msg-head { color: rgba(247, 244, 255, .62); }
.msg-head {
  gap: 7px;
  margin-bottom: 4px;
  font-size: 9.5px;
  letter-spacing: .02em;
}
.msg-head .who { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; }
.msg-head time { font-size: 9.5px; opacity: .72; }
.msg-body { font-size: 13.5px; line-height: 1.68; }
.msg-body p { margin: .5em 0; }
.msg-body code { border-radius: 5px; background: rgba(0, 0, 0, .42); font-size: .88em; }
.msg-body pre { border-radius: 10px; padding: 12px 13px; }
.copy-btn {
  margin-top: 7px;
  padding: 3px 9px;
  font-size: 9.5px;
  border-color: var(--surface-line);
  background: color-mix(in srgb, var(--surface-3) 48%, transparent);
}
.message.error .bubble { background: color-mix(in srgb, var(--danger) 7%, transparent); }

.typing { font-size: 12px; }
.typing i { width: 5px; height: 5px; }
.typing span { font-size: 11.5px; }

/* ---------- Welcome / suggestion cards ---------- */
.welcome-hero {
  width: 100%;
  max-width: 780px;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: clamp(10px, 2.5vh, 26px) 0;
  animation: heroIn .5s var(--ease-out) both;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 46%, transparent);
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero-live {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 14%, transparent);
  animation: pulse 2.6s ease-in-out infinite;
}
.hero-title {
  margin: 2px 0 0;
  max-width: 20ch;
  color: var(--text);
  font-size: clamp(26px, 3.1vw, 36px);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -.035em;
}
.hero-sub {
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.62;
}
.hero-cards {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}
.hero-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 13px 13px 13px 12px;
  border: 1px solid var(--surface-line);
  border-radius: 13px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), transparent),
    color-mix(in srgb, var(--surface-2) 50%, transparent);
  color: var(--text);
  text-align: left;
  transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
  animation: heroCardIn .45s var(--ease-out) both;
}
.hero-card:nth-child(2) { animation-delay: .05s; }
.hero-card:nth-child(3) { animation-delay: .1s; }
.hero-card:nth-child(4) { animation-delay: .15s; }
.hero-card:hover {
  border-color: color-mix(in srgb, var(--accent) 44%, transparent);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .035), transparent),
    color-mix(in srgb, var(--accent) 8%, var(--surface-2));
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -26px var(--accent-glow);
}
.hero-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent-text);
}
.hero-icon svg { width: 18px; height: 18px; }
.hero-card:nth-child(2) .hero-icon,
.hero-card:nth-child(4) .hero-icon {
  border-color: color-mix(in srgb, var(--accent-2) 20%, transparent);
  background: color-mix(in srgb, var(--accent-2) 8%, transparent);
  color: var(--accent-2);
}
.hero-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero-copy strong { font-size: 12.5px; font-weight: 650; }
.hero-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10.5px; }
.hero-arrow { margin-left: auto; color: var(--muted); opacity: .4; display: grid; place-items: center; transition: opacity var(--dur-fast), transform var(--dur-fast); }
.hero-arrow svg { width: 15px; height: 15px; }
.hero-card:hover .hero-arrow { opacity: 1; transform: translateX(2px); color: var(--accent-text); }
.hero-quick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);
}
.hero-link svg { width: 13px; height: 13px; }
.hero-link:hover { color: var(--text); background: color-mix(in srgb, var(--surface-3) 46%, transparent); border-color: var(--surface-line); }

/* ---------- Composer ---------- */
.composer-wrap {
  padding: 8px max(18px, calc((100% - var(--content-w)) / 2)) calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg-deep) 46%, transparent) 76%);
}
.composer-shell {
  border: 1px solid var(--stroke);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 48%),
    color-mix(in srgb, var(--surface-1) 88%, transparent);
  box-shadow:
    0 20px 44px -30px rgba(0, 0, 0, .9),
    inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(14px);
}
.composer-shell:focus-within {
  border-color: color-mix(in srgb, var(--mode-accent) 52%, transparent);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--mode-accent) 11%, transparent),
    0 22px 46px -30px color-mix(in srgb, var(--mode-accent) 38%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .06);
}
.mode-tabs {
  gap: 2px;
  padding: 7px 9px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tab {
  flex: none;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.mode-tab svg { width: 14px; height: 14px; }
.mode-tab .mode-label { font-size: 11px; }
.mode-tab:hover { background: color-mix(in srgb, var(--surface-3) 50%, transparent); color: var(--text); }
.mode-tab[aria-selected="true"] {
  color: var(--mode-text);
  background: var(--mode-soft);
  border-color: color-mix(in srgb, var(--mode-accent) 30%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.mode-pane { padding: 5px 13px 6px; gap: 5px; }
.mode-pane:not([hidden]) { animation: paneIn .2s var(--ease-out) both; }
#message,
#image-prompt,
#video-prompt,
#song-theme {
  padding: 7px 3px;
  min-height: 42px;
  font-size: 14px;
  line-height: 1.55;
}
#image-prompt, #video-prompt, #song-theme { min-height: 54px; max-height: 132px; }
#message::placeholder, #image-prompt::placeholder, #video-prompt::placeholder, #song-theme::placeholder {
  color: color-mix(in srgb, var(--muted) 76%, transparent);
}
.composer-tools { gap: 1px; align-items: center; }
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 550;
}
.tool-btn svg { width: 15px; height: 15px; }
.tool-btn:hover { background: color-mix(in srgb, var(--surface-3) 58%, transparent); color: var(--text); }
.tool-btn.active { color: var(--accent-text); background: var(--accent-soft); }
.tool-btn.recording { color: #fecaca; background: color-mix(in srgb, var(--danger) 14%, transparent); }
.tool-btn.recording svg { animation: pulse 1.2s ease-in-out infinite; }
.tool-btn.stop { color: #fca5a5; background: color-mix(in srgb, var(--danger) 10%, transparent); }
.tool-btn.stop svg { width: 12px; height: 12px; }
.send-btn,
.composer-shell[data-mode="image"] .send-btn,
.composer-shell[data-mode="video"] .send-btn,
.composer-shell[data-mode="song"] .send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  margin-left: 6px;
  padding: 0 13px;
  border-radius: 9px;
  background:
    radial-gradient(120% 120% at 22% -30%, rgba(255, 255, 255, .24), transparent 46%),
    linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 58%, #2a1454));
  color: #fff;
  font-size: 11.5px;
  font-weight: 650;
  box-shadow: 0 8px 20px -12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .22);
  transition: transform var(--dur-fast), filter var(--dur-fast), box-shadow var(--dur-fast);
}
.send-btn svg { width: 14px; height: 14px; }
.send-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 12px 24px -12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .28); }
.send-btn:active:not(:disabled) { transform: translateY(0); }
.send-btn:disabled,
.composer-shell[data-mode="image"] .send-btn:disabled,
.composer-shell[data-mode="video"] .send-btn:disabled,
.composer-shell[data-mode="song"] .send-btn:disabled,
.create-btn:disabled {
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
  border: 1px solid var(--surface-line);
  color: color-mix(in srgb, var(--muted) 66%, transparent);
  box-shadow: none;
  filter: none;
  opacity: 1;
}
#image-send, #video-send, #song-send { padding: 0 13px; }

.idea-chips { gap: 4px; }
.idea-chips button {
  padding: 4px 9px;
  border: 1px solid var(--surface-line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
}
.idea-chips button:hover { color: var(--text); background: color-mix(in srgb, var(--surface-3) 48%, transparent); }
.image-controls { gap: 6px; }
.video-controls #video-add { margin-right: auto; }
#image-size,
#video-model,
.song-controls select {
  height: 34px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  background-color: color-mix(in srgb, var(--bg-deep) 38%, transparent);
  color: var(--text-2);
  font-size: 11px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, color-mix(in srgb, var(--muted) 80%, transparent) 50%),
    linear-gradient(135deg, color-mix(in srgb, var(--muted) 80%, transparent) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
#image-size:focus, #video-model:focus, .song-controls select:focus { border-color: color-mix(in srgb, var(--mode-accent) 46%, transparent); }
.image-controls .gallery-open,
.image-controls .video-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 10.5px;
}
.image-controls .gallery-open svg,
.image-controls .video-add svg { width: 14px; height: 14px; }
.video-count { font-size: 10px; }
.image-status { font-size: 10.5px; line-height: 1.45; }
.composer-shell[data-mode="image"] .image-status,
.composer-shell[data-mode="video"] .image-status,
.composer-shell[data-mode="song"] .image-status { color: var(--muted); }
.composer-foot {
  gap: 9px;
  padding: 0 13px 9px;
  font-size: 9.5px;
}
.paste-hint kbd { padding: 1px 4px; border: 1px solid var(--surface-line); border-radius: 4px; background: color-mix(in srgb, var(--surface-3) 46%, transparent); font-size: 8.5px; }
.char-count { color: color-mix(in srgb, var(--muted) 82%, transparent); }
#speech-language {
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--surface-line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-deep) 42%, transparent);
  font-size: 9.5px;
  color: var(--muted);
}
.composer-shell:not([data-mode="chat"]) .paste-hint,
.composer-shell:not([data-mode="chat"]) #speech-language { display: none; }
.voice-help { padding: 0 4px; font-size: 10.5px; }
.voice-help[hidden] { display: none !important; }

/* ---------- Gallery & media ---------- */
.gallery-drawer { background: color-mix(in srgb, var(--bg-deep) 68%, transparent); }
.drawer-card {
  width: min(760px, 100%);
  border-color: var(--stroke);
  border-radius: 16px;
  padding: 16px;
  gap: 12px;
  background: color-mix(in srgb, var(--surface-1) 92%, transparent);
  box-shadow: 0 40px 90px -50px rgba(0, 0, 0, .9);
}
.drawer-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border-color: var(--surface-line);
  background: color-mix(in srgb, var(--surface-3) 48%, transparent);
  color: var(--accent-text);
}
.drawer-icon svg { width: 16px; height: 16px; }
.drawer-title strong { font-size: 13px; }
.drawer-title small { font-size: 10px; }
.gallery {
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 7px;
  max-height: 60vh;
}
.thumb { border-radius: 9px; border-color: var(--surface-line); overflow: hidden; }
.thumb:hover { border-color: var(--accent-line); transform: translateY(-1px); box-shadow: 0 12px 26px -20px var(--accent-glow); }
.gallery-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 30%, transparent);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.lightbox-card, .voice-card, .studio-card, .settings-card, .doc-card, .onboarding-card {
  border-color: var(--stroke);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-1) 94%, transparent);
  box-shadow: 0 40px 100px -52px rgba(0, 0, 0, .95);
}
.lightbox-actions .button-link, .lightbox-actions .ghost, .lightbox-actions .danger { height: 36px; padding: 0 13px; border-radius: 9px; font-size: 11px; }
.drawer-actions .icon-btn { width: 32px; height: 32px; }
.promo-card { border-color: var(--stroke); border-radius: 18px; background: color-mix(in srgb, var(--surface-1) 94%, transparent); }
.song-card { border-radius: 18px; }
.toast {
  bottom: calc(22px + env(safe-area-inset-bottom));
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 11.5px;
  background: color-mix(in srgb, var(--surface-3) 96%, transparent);
}

/* ---------- Overlay controls ---------- */
.voice-langs button, .voice-gender button, .studio-gender button, .doc-tasks button {
  border-radius: 7px;
  font-size: 11px;
}
.settings-card .ghost, .doc-card .ghost, .voice-card .ghost, .studio-card .ghost { border-radius: 8px; font-size: 11px; }
.settings-label { font-size: 9.5px; letter-spacing: .14em; }
.settings-row { border-radius: 10px; }
.model-card, .gender-card, .theme-option { border-radius: 10px; }
.doc-drop { border-radius: 12px; }
.doc-drop-icon { width: 40px; height: 40px; display: grid; place-items: center; margin: 0 auto 8px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); font-size: 16px; }
.onboarding-card { border-radius: 20px; }
.onboarding-submit { border-radius: 10px; height: 42px; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #3b1d78)); color: #fff; box-shadow: 0 12px 28px -16px var(--accent-glow); }
.login-page .login-card { border-radius: 20px; border-color: var(--stroke); background: linear-gradient(180deg, color-mix(in srgb, var(--surface-1) 96%, transparent), color-mix(in srgb, var(--bg-deep) 96%, transparent)); }
.login-page .logo { border-radius: 14px; }
html[data-theme="obsidian"] .login-page .login-card {
  background:
    radial-gradient(120% 70% at 50% -18%, rgba(139, 92, 246, .10), transparent 56%),
    #111113;
  border-color: #29292d;
  box-shadow: 0 40px 100px -60px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: none;
}
html[data-theme="obsidian"] .login-card h1 { text-shadow: none; }
html[data-theme="obsidian"] .login-page .logo::before,
html[data-theme="obsidian"] .login-page .logo::after { display: none; }
html[data-theme="obsidian"] .login-card button {
  background:
    radial-gradient(120% 120% at 22% -30%, rgba(255, 255, 255, .2), transparent 46%),
    linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: #fff;
  box-shadow: 0 14px 30px -14px rgba(139, 92, 246, .7), inset 0 1px 0 rgba(255, 255, 255, .22);
}
html[data-theme="obsidian"] .login-card input { background: #17171a; border-color: #29292d; }
html[data-theme="obsidian"] .login-card input:focus { border-color: rgba(167, 139, 250, .55); box-shadow: 0 0 0 4px rgba(139, 92, 246, .12); }

/* ---------- Voice chat ---------- */
.voice-mode { padding: clamp(12px, 3vw, 26px); }
.voice-card {
  width: min(520px, 100%);
  gap: 11px;
  padding: 18px;
  align-items: stretch;
  border-radius: 18px;
}
.voice-title strong { font-size: 14px; letter-spacing: -.01em; }
.voice-title small { font-size: 11px; }
.voice-config {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px 12px;
  border: 1px solid var(--surface-line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-2) 36%, transparent);
}
.voice-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.voice-block-head > span {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.voice-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 9px;
  border: 1px solid var(--surface-line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-3) 40%, transparent);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 600;
  transition: border-color .18s, color .18s, background .18s;
}
.voice-mini svg { width: 13px; height: 13px; }
.voice-mini:hover { border-color: var(--stroke-strong); background: color-mix(in srgb, var(--surface-3) 66%, transparent); color: var(--text); }
.voice-langs {
  border-color: var(--surface-line);
  background: color-mix(in srgb, var(--bg-deep) 55%, transparent);
}
.voice-langs button { padding: 7px 6px; font-size: 11px; }
.voice-langs button.active,
.voice-gender button.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.voice-settings { flex-direction: column; gap: 7px; }
.voice-gender {
  width: 100%;
  min-width: 0;
  padding: 3px;
  border-color: var(--surface-line);
  background: color-mix(in srgb, var(--bg-deep) 55%, transparent);
}
.voice-gender button { padding: 6px 4px; font-size: 11px; }
.voice-devices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.voice-devices .voice-device {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
.voice-devices .voice-device span {
  padding-left: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.voice-devices .voice-device select {
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 7px 9px;
  border-color: var(--surface-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-1) 62%, transparent);
  color: var(--text-2);
  font-size: 11px;
}
.voice-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 0 0;
}
.voice-orb { width: 106px; height: 106px; margin: 2px 0; }
.voice-orb b { display: grid; place-items: center; font-size: 0; filter: none; }
.voice-orb b svg { width: 32px; height: 32px; color: var(--text); opacity: .92; }
.voice-state { min-height: 0; padding: 0 8px; color: var(--text-2); font-size: 12px; line-height: 1.45; }
.voice-transcript {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 76px;
  max-height: 26dvh;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-deep) 52%, transparent);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 24%, transparent) transparent;
}
.voice-empty {
  margin: auto;
  padding: 10px;
  max-width: 34ch;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}
.voice-empty[hidden] { display: none; }
.voice-line {
  max-height: 118px;
  margin: 0;
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.5;
}
.voice-line::before {
  display: block;
  margin-bottom: 2px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  opacity: .72;
}
.voice-line.user::before { content: "Sen"; color: var(--accent-text); }
.voice-line.answer::before { content: "Rafa"; color: var(--text-2); }
.voice-line.user {
  align-self: flex-end;
  max-width: 88%;
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
}
.voice-line.answer {
  max-width: 94%;
  border-color: var(--surface-line);
  background: color-mix(in srgb, var(--surface-2) 52%, transparent);
  color: var(--text-2);
}
.voice-compose { display: flex; gap: 7px; width: 100%; }
.voice-compose input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--surface-line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-deep) 70%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.voice-compose input::placeholder { color: var(--muted); }
.voice-compose input:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.voice-compose input:disabled { opacity: .55; }
.voice-send {
  flex: none;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11.5px;
  font-weight: 700;
  transition: background .18s, color .18s, opacity .18s;
}
.voice-send:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 26%, transparent); color: var(--text); }
.voice-send:disabled { opacity: .38; cursor: not-allowed; }
.voice-actions { gap: 7px; }
.voice-primary {
  height: 40px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 12px;
  letter-spacing: .01em;
}
.voice-actions .ghost { height: 40px; padding: 0 14px; font-size: 11px; }
.voice-hint { font-size: 10px; line-height: 1.45; }

/* ---------- Voice studio ---------- */
.studio-card { width: min(560px, 100%); gap: 10px; padding: 18px; }
.studio-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px 12px;
  border: 1px solid var(--surface-line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-2) 36%, transparent);
}
.studio-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.studio-block-head span {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.studio-block-head small { color: var(--muted); font-size: 9.5px; font-variant-numeric: tabular-nums; }
#studio-text {
  min-height: 86px;
  max-height: 170px;
  border-color: var(--surface-line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-deep) 62%, transparent);
  font-size: 12px;
}
#studio-text:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.studio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.studio-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.studio-field > span {
  padding-left: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.studio-field select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-1) 62%, transparent);
  color: var(--text-2);
  font: inherit;
  font-size: 11px;
}
.studio-field select:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.studio-gender {
  padding: 3px;
  border-color: var(--surface-line);
  background: color-mix(in srgb, var(--bg-deep) 55%, transparent);
}
.studio-gender button { padding: 6px 4px; font-size: 11px; }
.studio-range { padding: 2px 2px 0; font-size: 11px; }
.studio-range b { color: var(--accent-text); font-size: 11px; }
#studio-generate { height: 42px; margin-top: 2px; }
.studio-result {
  gap: 8px;
  padding: 10px;
  border-color: var(--surface-line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 46%, transparent);
}
.studio-result audio { border-radius: 8px; }
.studio-actions .button-link, .studio-actions .ghost { height: 34px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }

/* ---------- Motion ---------- */
@keyframes premiumShell {
  from { opacity: 0; transform: translateY(8px) scale(.995); }
  to { opacity: 1; transform: none; }
}
@keyframes heroIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes heroCardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes paneIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  body { padding: 12px; }
  .app { height: min(940px, calc(100dvh - 24px)); }
  .topbar-title { max-width: 24ch; }
}
@media (max-width: 1024px) {
  .header-actions #model-chip { display: none; }
}
@media (max-width: 900px) {
  body { padding: 0; }
  .app { width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .app::before { display: none; }
  .sidebar {
    width: min(84%, 310px);
    padding-top: calc(14px + env(safe-area-inset-top));
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface-1) 98%, transparent);
    box-shadow: 30px 0 80px rgba(0, 0, 0, .6);
  }
  body.sidebar-collapsed .sidebar { margin-left: 0; }
  .sidebar-scroll { gap: 16px; }
  .chat-list { max-height: none; min-height: 60px; }
  .chat-open { padding: 9px 8px 9px 9px; font-size: 12.5px; }
  .side-action { height: 40px; font-size: 12.5px; }
  .theme-chip { height: 34px; }

  .topbar { min-height: 58px; padding: 0 12px; }
  .topbar .brand h1 { font-size: 13.5px; }
  .topbar-title, .topbar-divider { display: none; }
  .header-actions #voice-quick,
  .header-actions #discord-link,
  .header-actions #install-app { display: inline-flex; }
  .header-actions #voice-quick span,
  .header-actions #discord-link span,
  .header-actions #install-app span,
  .header-actions #model-chip .model-name { display: none; }
  .header-actions #voice-quick,
  .header-actions #discord-link,
  .header-actions #install-app,
  .header-actions #model-chip { width: 36px; padding: 0; }
  #status.status-pill { width: 26px; height: 26px; padding: 0; justify-content: center; margin: 0; }
  #status .status-text { display: none; }
  #status::before { margin: 0; }
  .header-actions #model-chip { display: none; }
  .logout-btn { width: 34px !important; height: 34px !important; }

  #chat { padding: 20px 15px 10px; gap: 15px; }
  .message { max-width: 92%; }
  .message.user { max-width: 86%; }
  .bubble { padding: 10px 13px 11px; }
  .msg-body { font-size: 13.5px; }
  .composer-wrap { padding: 7px 10px calc(10px + env(safe-area-inset-bottom)); }
  .composer-shell { border-radius: 15px; }
  .hero-title { font-size: clamp(24px, 5.4vw, 30px); }
  .hero-cards { gap: 8px; }
}
@media (max-width: 640px) {
  .topbar .brand h1 { display: none; }
  .topbar .brand { gap: 0; }
  .topbar .brand-mark { width: 30px; height: 30px; }
  .header-actions { gap: 4px; }
  .header-actions .icon-btn { width: 32px; height: 32px; }
  #chat { padding: 16px 13px 8px; }
  .welcome-hero { padding: 6px 0 10px; gap: 10px; }
  .hero-title { max-width: 18ch; font-size: 24px; }
  .hero-sub { font-size: 12.5px; }
  .hero-cards { grid-template-columns: 1fr; gap: 7px; margin-top: 6px; }
  .hero-card { padding: 11px; border-radius: 12px; }
  .hero-icon { width: 34px; height: 34px; border-radius: 9px; }
  .hero-quick { gap: 2px; }
  .mode-tab { padding: 0 9px; }
  .tool-btn { height: 34px; }
  .tool-btn .tool-label { display: none; }
  .tool-btn { width: 34px; justify-content: center; padding: 0; }
  .tool-btn.stop { width: auto; padding: 0 9px; }
  .tool-btn.stop .tool-label { display: inline; }
  .send-btn { height: 36px; }
  .composer-foot { padding: 0 12px 8px; }
  .image-controls .gallery-open, .image-controls .video-add { height: 36px; }
  #image-size { height: 36px; }
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .drawer-card { border-radius: 16px 16px 0 0; }

  .voice-mode { padding: 0; }
  .voice-card {
    width: 100%;
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
    justify-content: flex-start;
    gap: 9px;
    padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
  }
  .voice-orb { width: 88px; height: 88px; }
  .voice-orb b svg { width: 28px; height: 28px; }
  .voice-transcript { flex: 1 1 auto; min-height: 96px; max-height: none; }
  .voice-actions { flex-direction: row; }
  .voice-actions .ghost { width: auto; flex: none; }
  .voice-primary { flex: 1; }
  .voice-devices { grid-template-columns: 1fr; }

  .studio-mode { padding: 12px; place-items: center; }
  .studio-card {
    width: min(560px, 100%);
    height: auto;
    max-height: calc(var(--app-height, 100dvh) - 24px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 16px;
  }
}
@media (max-width: 380px) {
  .header-actions #model-chip { display: none; }
  .hero-copy span { white-space: normal; }
  .hero-title { font-size: 22px; }
}

@media (pointer: coarse) {
  .chat-delete { opacity: .7; }
  .copy-btn { opacity: .8; }
  .side-action { height: 42px; }
  .theme-chip { height: 36px; }
  .send-btn { height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .app, .welcome-hero, .hero-card, .mode-pane:not([hidden]) { animation: none !important; }
  .hero-live, .tool-btn.recording svg, #status::before { animation: none !important; }
  .hero-card:hover { transform: none; }
}

/* ---------- Renk seçenekleri ---------- */
.theme-dock {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--stroke));
  border-radius: 13px;
  background:
    radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 58%),
    color-mix(in srgb, var(--surface-2) 62%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.theme-chip {
  flex-direction: column;
  gap: 5px;
  height: auto;
  padding: 7px 2px 6px;
  border-radius: 9px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .01em;
  color: var(--muted);
}
.theme-chip:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.theme-chip.active { color: var(--text); }

.theme-dot {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .24),
    inset 0 -7px 12px rgba(0, 0, 0, .22),
    0 4px 10px -6px rgba(0, 0, 0, .8);
}
.theme-chip[data-theme="cyber"] .theme-dot {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .85) 0 7%, transparent 34%),
    linear-gradient(135deg, #1d4ed8 0%, #4d9bff 36%, #22d3ee 66%, #ff4fb8 100%);
}
.theme-chip[data-theme="obsidian"] .theme-dot {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .8) 0 6%, transparent 32%),
    linear-gradient(135deg, #2e1065 0%, #8b5cf6 44%, #e879f9 76%, #22d3ee 100%);
}
.theme-chip[data-theme="slate"] .theme-dot {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .82) 0 7%, transparent 34%),
    linear-gradient(135deg, #0f766e 0%, #14b8a6 32%, #2dd4bf 58%, #7dd3fc 80%, #f6c66d 100%);
}
.theme-chip[data-theme="cyber"].active {
  border-color: rgba(77, 155, 255, .55);
  background: rgba(77, 155, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 16px -12px #4d9bff;
}
.theme-chip[data-theme="obsidian"].active {
  border-color: rgba(167, 139, 250, .55);
  background: rgba(167, 139, 250, .15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 16px -12px #a78bfa;
}
.theme-chip[data-theme="slate"].active {
  border-color: rgba(45, 212, 191, .55);
  background: rgba(45, 212, 191, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 16px -12px #2dd4bf;
}
.theme-chip.active .theme-dot {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .40),
    0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent),
    0 0 16px color-mix(in srgb, var(--accent) 45%, transparent);
}

.theme-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.theme-option {
  gap: 8px;
  padding: 11px 6px 10px;
  border-radius: 14px;
  border-color: color-mix(in srgb, var(--stroke) 85%, transparent);
  background:
    radial-gradient(100% 70% at 50% 0%, rgba(255, 255, 255, .035), transparent 65%),
    color-mix(in srgb, var(--surface-2) 48%, transparent);
  font-size: .72rem;
}
.theme-option:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--surface-3) 44%, transparent);
  transform: translateY(-2px);
}
.theme-option.active {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent-2) 8%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), 0 10px 24px -20px var(--accent);
}
.theme-swatch {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  position: relative;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .22),
    inset 0 -10px 16px rgba(0, 0, 0, .24),
    0 8px 18px -12px rgba(0, 0, 0, .9);
}
.theme-option .theme-swatch { outline: 1px solid rgba(255, 255, 255, .14); outline-offset: 4px; }
.theme-swatch.cyber {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .85) 0 7%, transparent 34%),
    linear-gradient(135deg, #1d4ed8 0%, #4d9bff 36%, #22d3ee 66%, #ff4fb8 100%);
}
.theme-swatch.obsidian {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .8) 0 6%, transparent 32%),
    linear-gradient(135deg, #2e1065 0%, #8b5cf6 44%, #e879f9 76%, #22d3ee 100%);
}
.theme-swatch.slate {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .82) 0 7%, transparent 34%),
    linear-gradient(135deg, #0f766e 0%, #14b8a6 32%, #2dd4bf 58%, #7dd3fc 80%, #f6c66d 100%);
}
.theme-option.active .theme-swatch {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .34),
    0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent),
    0 10px 24px -16px var(--accent);
}
.theme-option.active .theme-swatch::after {
  content: "\2713";
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: var(--bg-deep);
  background: var(--text);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45);
}
@media (max-width: 560px) {
  .theme-dot { width: 22px; height: 22px; border-radius: 7px; }
  .theme-chip { font-size: 9.5px; padding: 6px 1px 5px; }
  .theme-swatch { width: 34px; height: 34px; border-radius: 11px; }
}

.lang-option {
  border-color: color-mix(in srgb, var(--stroke) 85%, transparent);
  background:
    radial-gradient(100% 70% at 50% 0%, rgba(255, 255, 255, .035), transparent 65%),
    color-mix(in srgb, var(--surface-2) 48%, transparent);
}
.lang-option:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  background: color-mix(in srgb, var(--surface-3) 44%, transparent);
}
.lang-option.active {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent-2) 8%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), 0 10px 24px -20px var(--accent);
}
.lang-option small { color: color-mix(in srgb, var(--muted) 90%, transparent); }
.lang-chip {
  border-color: color-mix(in srgb, var(--stroke) 80%, transparent);
  background: color-mix(in srgb, var(--surface-2) 62%, transparent);
  color: color-mix(in srgb, var(--muted) 92%, transparent);
}
.lang-chip:hover {
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
}

