/* Nova Linx — layout, type and colour system modelled on the Lumen reference app (own branding) */

:root {
  --paper: #f7f8fa; --raised: #fff; --rail: #f7f8fa; --ink: #1c1c1c; --muted: #8a8a8e; --line: #e6e6e8;
  --copper: #1c1c1c; --copper-ink: #fff; --stone: #efeff1; --accent: #d3e7fb; --accent-ink: #3d7ec4;
  --code: #231f1b; --code-fg: #f6f1ea; --scrim: #00000052;
  --shadow-card: 0 0 0 1px #0000000d, 0 8px 28px -18px #00000047;
  --shadow-pop: 0 0 0 1px #0000000d, 0 18px 40px -12px #00000038;
  --font: Outfit, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: Fraunces, "Iowan Old Style", Palatino, Georgia, serif;
  --sidebar-w: 288px;
  --col: 48rem;
  color-scheme: light;
  /* legacy aliases used by feature widgets */
  --bg: var(--paper); --surface: var(--raised); --surface-elevated: var(--raised); --text: var(--ink);
  --text-muted: var(--muted); --text-faint: var(--muted); --border: var(--line); --border-soft: var(--line);
  --chip-bg: var(--stone); --chip-hover: var(--stone); --send: var(--accent-ink); --rail-w: 0px;
}
html[data-theme="dark"] {
  --paper: #000; --raised: #141414; --rail: #000; --ink: #f5f5f7; --muted: #8e8e93; --line: #2a2a2a;
  --copper: #f5f5f7; --copper-ink: #000; --stone: #2c2c2e; --accent: #1a3d66; --accent-ink: #9ec9f5;
  --scrim: #000000b8; --shadow-card: 0 0 0 1px #ffffff14; --shadow-pop: 0 0 0 1px #ffffff14, 0 18px 40px -12px #000000cc;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font); font-size: 16px; line-height: 1.5; background: var(--paper); color: var(--ink);
  overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--copper) 28%, transparent); color: var(--ink); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 300; background: var(--raised); color: var(--ink); padding: 8px 16px; border-radius: 999px; box-shadow: var(--shadow-card); text-decoration: none; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink);
}
.btn-icon:hover { background: var(--stone); }

/* Logo tile (Nova Linx N-orbit mark on a rounded square) */
.logo-tile {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  background: var(--copper); color: var(--copper-ink); flex-shrink: 0;
}
.logo-tile.tiny { width: 24px; height: 24px; border-radius: 6px; }
.logo-tile.tiny svg { width: 13px; height: 13px; }

/* ---------- Shell ---------- */
.shell { position: relative; display: flex; height: 100%; width: 100%; }
.app { position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0; height: 100%; }

/* ---------- Sidebar / drawer ---------- */
.sidebar {
  position: fixed; inset: 0; z-index: 60; width: 100%; display: flex; flex-direction: column;
  background: var(--rail); color: var(--ink); transform: translateX(-100%); visibility: hidden;
  transition: transform .26s cubic-bezier(.2,.8,.2,1), visibility 0s linear .26s;
  padding-top: env(safe-area-inset-top);
}
.sidebar.open { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.2,.8,.2,1); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: var(--scrim); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 8px 8px 0 20px; }
.sidebar-brand { font-size: 1.875rem; line-height: 1.2; font-weight: 500; letter-spacing: -.01em; }
.sidebar-home { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px 16px; }
.btn-new-chat {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 48px; padding: 0 20px; border: 0;
  border-radius: 999px; background: var(--stone); color: var(--ink); font-size: 1.125rem; text-align: left;
}
.btn-new-chat:hover { filter: brightness(1.06); }
.sidebar-nav { display: flex; flex-direction: column; margin-top: 4px; }
.sidebar-nav-item {
  display: flex; align-items: center; gap: 16px; width: 100%; height: 48px; padding: 0 8px; border: 0;
  border-radius: 999px; background: transparent; color: var(--ink); font-size: 1.125rem; text-align: left;
}
.sidebar-nav-item:hover, .sidebar-nav-item.active { background: var(--stone); }
.sidebar-nav-item svg { flex-shrink: 0; }
.sidebar-section-label { padding: 32px 8px 8px; font-size: 1rem; color: var(--muted); }
.notebook-list { display: flex; flex-direction: column; }
.notebook-item { display: flex; align-items: center; border-radius: 999px; }
.notebook-item:hover { background: var(--stone); }
.notebook-item-main { flex: 1; min-width: 0; display: flex; align-items: center; height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--ink); font-size: 1.0625rem; text-align: left; }
.notebook-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notebook-delete { width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted); border-radius: 50%; opacity: 0; }
.notebook-item:hover .notebook-delete, .notebook-item:focus-within .notebook-delete { opacity: 1; }
.thread-list { display: flex; flex-direction: column; }
.thread-item { position: relative; display: flex; align-items: center; border-radius: 999px; }
.thread-item:hover, .thread-item.active { background: var(--stone); }
.thread-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px; border: 0; background: transparent; color: var(--ink); font-size: 1.125rem; text-align: left; }
.thread-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-time { display: none; }
.thread-answering { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-ink); flex-shrink: 0; animation: pulseDot 1s ease-in-out infinite; }
.thread-item.answering .thread-answering { display: inline-block; }
@keyframes pulseDot { 50% { opacity: .3; } }
.thread-pin, .thread-delete { width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; opacity: 0; }
.thread-item:hover .thread-pin, .thread-item:hover .thread-delete, .thread-item:focus-within .thread-pin, .thread-item:focus-within .thread-delete, .thread-pin.on { opacity: 1; }
.thread-pin:hover, .thread-delete:hover { color: var(--ink); }
@media (hover: none) { .thread-item.active .thread-pin, .thread-item.active .thread-delete { opacity: .8; } }
.thread-empty { display: none; padding: 6px 8px; color: var(--muted); font-size: 1rem; }
.thread-empty.visible { display: block; }

.sidebar-foot { border-top: 1px solid var(--line); padding: 12px 12px max(12px, env(safe-area-inset-bottom)); flex-shrink: 0; max-height: 70dvh; overflow-y: auto; }
.sidebar-profile { display: flex; align-items: center; gap: 12px; padding: 4px 0 0 4px; }
.sidebar-avatar, .avatar-circle {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: var(--copper); color: var(--copper-ink); font-weight: 600; font-size: 1rem; border: 0;
  background-size: cover; background-position: center;
}
.sidebar-profile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-profile-name { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile-sub { font-size: .75rem; color: var(--muted); }
.sidebar-settings { color: var(--ink); }
.sidebar-settings[aria-expanded="true"] { background: var(--stone); }

/* Inline settings (in the drawer footer, like the reference) */
.settings-inline { padding: 4px 0 12px; }
.settings-sheet { display: flex; flex-direction: column; gap: 12px; }
.settings-field { display: flex; flex-direction: column; gap: 6px; }
.settings-field-label { font-size: .875rem; color: var(--muted); }
.settings-input { width: 100%; height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--stone); color: var(--ink); font-size: 1rem; outline: none; }
.settings-input:focus { box-shadow: 0 0 0 2px var(--accent-ink); }
.seg { display: flex; gap: 8px; }
.seg-btn { flex: 1; height: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--stone); color: var(--ink); font-size: .875rem; }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--copper-ink); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; font-size: .9375rem; }
.settings-row label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.settings-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-ink); }
.settings-inline .settings-inline, .settings-row .settings-inline { display: flex; gap: 6px; padding: 0; }
.settings-btn { height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--stone); color: var(--ink); font-size: .875rem; }
.settings-btn.danger { background: transparent; color: #e5484d; box-shadow: inset 0 0 0 1px var(--line); }
.settings-actions { display: flex; }
.settings-done { align-self: flex-start; height: 40px; padding: 0; border: 0; background: transparent; color: var(--ink); font-size: 1rem; }
.settings-note { font-size: .75rem; color: var(--muted); }
.sidebar-avatar.has-photo, .avatar-circle.has-photo { color: transparent; }

/* Sidebar panels (Search / Images / Videos / Library) — full screen like the reference */
.sidebar.panel-open .sidebar-home, .sidebar.panel-open .sidebar-header, .sidebar.panel-open .sidebar-foot { display: none; }
.sidebar-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
.sidebar-panel-bar { display: flex; align-items: center; gap: 4px; min-height: 56px; padding: 0 4px; flex-shrink: 0; }
.sidebar-panel-title { font-size: 1.125rem; }
.sidebar-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 20px 24px; position: relative; }
.panel-title-lg { font-size: 1.875rem; font-weight: 500; letter-spacing: -.01em; margin: 8px 0 12px; }
.panel-search-input { width: 100%; height: 48px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--stone); color: var(--ink); font-size: 1rem; outline: none; margin-bottom: 12px; }
.panel-search-input::placeholder { color: var(--muted); }
.panel-empty { color: var(--muted); padding: 12px 0; }
.panel-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.panel-action { height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--stone); color: var(--ink); text-align: left; }
.library-list { display: flex; flex-direction: column; }
.library-row { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 4px; border: 0; background: transparent; color: var(--ink); font-size: 1.125rem; text-align: left; border-radius: 12px; }
.library-row:hover { background: var(--stone); padding: 0 12px; }
.lib-meta { color: var(--muted); font-size: .9375rem; }

.create-panel { max-width: var(--col); margin: 0 auto; padding-bottom: 180px; }
.panel-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 8px 20px; }
.panel-hero-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); background: var(--raised); }
.panel-hero-title { margin-top: 20px; font-size: 1.875rem; line-height: 1.2; font-weight: 500; letter-spacing: -.015em; max-width: 20ch; }
.panel-hero-sub { margin-top: 12px; color: var(--muted); font-size: 1.0625rem; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.template-grid.video .template-card:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.template-card {
  position: relative; aspect-ratio: 1; border: 0; border-radius: 28px; overflow: hidden; color: #fff;
  text-align: left; display: flex; align-items: flex-end; padding: 16px; font-size: 1.0625rem; font-weight: 600;
  box-shadow: var(--shadow-card); transition: transform .15s ease;
}
.template-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.template-card::after { content: ""; position: absolute; inset: 40% 0 0; z-index: 0; background: linear-gradient(transparent, #0000009e); pointer-events: none; }
.template-card span { position: relative; z-index: 1; text-shadow: 0 1px 6px #0006; }
.template-card:active { transform: scale(.98); }
.create-h { font-size: 1rem; font-weight: 500; color: var(--muted); margin: 24px 0 10px; }
.create-status { color: var(--muted); font-size: .875rem; margin: 0 0 12px; text-align: center; }
.create-status:empty { display: none; }
.create-result { display: block; width: 100%; border-radius: 28px; aspect-ratio: 1; object-fit: cover; margin-bottom: 10px; background: var(--stone); }
.create-result-wrap { margin-bottom: 16px; }
.create-result-wrap.loading .create-result { opacity: .45; }
.create-actions { display: flex; gap: 8px; justify-content: center; }
.create-download, .create-open { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 18px; border-radius: 999px; font-size: .9375rem; font-weight: 500; text-decoration: none; }
.create-download { background: var(--accent); color: var(--accent-ink); }
.create-open { background: var(--stone); color: var(--ink); }
.images-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.images-grid button { border: 0; padding: 0; border-radius: 16px; overflow: hidden; aspect-ratio: 1; background: var(--stone); }
.images-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.create-bar {
  position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 5; max-width: var(--col); margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 18px; border-radius: 28px;
  background: var(--raised); box-shadow: var(--shadow-card);
}
html[data-theme="dark"] .create-bar { background: #1a1a1a; }
.create-input { flex: 1; min-width: 0; min-height: 44px; max-height: 160px; padding: 10px 0; border: 0; background: transparent; color: var(--ink); font-size: 1rem; resize: none; outline: none; }
.create-input::placeholder { color: var(--muted); }
.create-send { width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--stone); color: var(--muted); flex-shrink: 0; }
.create-send.ready { background: var(--accent); color: var(--accent-ink); }
.create-send.busy { animation: pulse 1.2s ease-in-out infinite; }
.create-opts { flex-basis: 100%; display: flex; flex-direction: column; gap: 8px; padding: 4px 12px 6px 0; }
.seg.chips .seg-btn { height: 44px; }

/* ---------- Header ---------- */
.top-glow { display: none; }
.header { position: relative; z-index: 20; display: flex; align-items: center; min-height: 56px; padding: env(safe-area-inset-top) 4px 0; flex-shrink: 0; }
.history-toggle svg { width: 24px; height: 24px; }
.overflow-wrap { position: relative; }
.model-btn { display: inline-flex; align-items: center; gap: 4px; height: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font-size: 1rem; white-space: nowrap; }
.model-btn:hover, .model-btn[aria-expanded="true"] { background: var(--stone); }
.model-brand, .model-name { font-weight: 400; }
.model-chevron { display: inline-flex; margin-left: 2px; }
.header-spacer { flex: 1; }
.header-right { display: flex; align-items: center; gap: 4px; padding-right: 8px; }
.temp-btn.active, .temp-btn[aria-pressed="true"] { background: var(--stone); }
.avatar-circle { width: 40px; height: 40px; cursor: pointer; margin-left: 4px; }

.tools-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 130; width: 256px; max-height: calc(100dvh - 80px); overflow-y: auto;
  padding: 4px; border-radius: 16px; background: var(--raised); box-shadow: var(--shadow-pop);
  animation: pop-in .14s ease-out; transform-origin: top left;
}
html[data-theme="dark"] .tools-menu { background: #1c1c1e; }
@keyframes pop-in { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }
.model-menu { display: flex; flex-direction: column; }
.tools-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); font-size: 1rem; text-align: left;
}
.tools-item:hover { background: var(--stone); }
.ti-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ti-text small { font-size: .875rem; color: var(--muted); }
.ti-ic { display: inline-flex; width: 20px; justify-content: center; }
.ti-check { display: inline-flex; visibility: hidden; color: var(--ink); }
.tools-item.active .ti-check, .tools-item[aria-checked="true"] .ti-check { visibility: visible; }
.tools-item.tools-small { min-height: 44px; font-size: .875rem; justify-content: space-between; }
.tools-state { color: var(--muted); font-size: .8125rem; }
.think-toggle.active .tools-state { color: var(--accent-ink); }
.tools-sep { height: 1px; background: var(--line); margin: 4px 8px; }

/* ---------- Chat ---------- */
.chat { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 24px; padding: 24px 16px 16px; scroll-behavior: auto; }
.chat > * { width: 100%; max-width: var(--col); margin-left: auto; margin-right: auto; }
.welcome { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; padding: 0 4px 8px; animation: think-in .45s ease-out; }
.welcome.hidden { display: none; }
.welcome-title { margin-top: 24px; font-family: var(--display); font-weight: 560; font-size: 3rem; line-height: 1; letter-spacing: -.025em; font-optical-sizing: auto; }
.welcome-hello { margin-top: 16px; max-width: 24rem; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.welcome-note { margin-top: 12px; max-width: 24rem; font-size: .9375rem; color: var(--ink); background: var(--stone); padding: 10px 14px; border-radius: 16px; }
.suggestion-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 24px; }
.suggestion-chip { display: inline-flex; align-items: center; height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--stone); color: var(--ink); font-size: .875rem; text-align: left; max-width: 100%; }
.suggestion-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-chip:hover { filter: brightness(1.05); }
html[data-theme="light"] .suggestion-chip:hover { filter: brightness(.97); }

.msg { display: flex; flex-direction: column; min-width: 0; animation: think-in .35s ease-out; }
.msg.user { align-items: flex-end; padding-left: 40px; }
.msg.ai { padding-right: 8px; }
.msg.user .bubble {
  width: fit-content; max-width: 100%; background: var(--stone); color: var(--ink); padding: 12px 16px;
  border-radius: 24px 24px 8px 24px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.user.editing .bubble { box-shadow: 0 0 0 2px var(--accent-ink); }
.bubble-thumb { display: block; max-width: 220px; max-height: 220px; border-radius: 16px; margin-bottom: 8px; object-fit: cover; }
.msg.ai .bubble { color: var(--ink); font-size: 1rem; line-height: 1.6; overflow-wrap: anywhere; }
.msg-who { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .875rem; color: var(--muted); }
.msg-actions { display: flex; align-items: center; margin-top: 4px; margin-left: -10px; }
.msg.user .msg-actions { margin-left: 0; margin-right: -8px; justify-content: flex-end; }
.msg-action { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.msg-action:hover { background: var(--stone); color: var(--ink); }
.msg-action.done { color: var(--accent-ink); }

/* Markdown */
.md > * + * { margin-top: 12px; }
.md h1, .md h2, .md h3, .md h4 { font-weight: 600; line-height: 1.3; margin-top: 20px; }
.md h1 { font-size: 1.375rem; } .md h2 { font-size: 1.25rem; } .md h3 { font-size: 1.125rem; } .md h4 { font-size: 1rem; }
.md > :first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 24px; }
.md li + li { margin-top: 6px; }
.md a { color: var(--accent-ink); text-underline-offset: 2px; }
.md strong { font-weight: 600; }
.md blockquote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); }
.md table { width: 100%; border-collapse: collapse; font-size: .9375rem; display: block; overflow-x: auto; }
.md th { text-align: left; font-weight: 600; }
.md th, .md td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.md :not(pre) > code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875em; background: var(--stone); padding: 2px 6px; border-radius: 6px; }
.code-block { position: relative; border-radius: 16px; background: var(--code); color: var(--code-fg); overflow: hidden; box-shadow: var(--shadow-card); }
html[data-theme="dark"] .code-block { background: #141414; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 0 16px; font-size: .75rem; color: #b8b1a8; }
.code-copy { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-size: .8125rem; }
.code-copy:hover { background: #ffffff14; color: #fff; }
.code-block pre { margin: 0; padding: 10px 16px 16px; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875rem; line-height: 1.55; }
.code-block pre code { background: none; padding: 0; }

/* Thinking: spark + shimmer + wash + ring (reference animations) */
.think-in { animation: think-in .45s ease-out; }
@keyframes think-in { 0% { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.think-head { display: flex; align-items: center; gap: 12px; min-height: 28px; }
.think-text { font-size: 1rem; color: transparent; background-image: linear-gradient(90deg, #5f6368 0%, #4c8dff 35%, #c084fc 50%, #5f6368 70%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; animation: lumen-shimmer 1.5s linear infinite; }
html[data-theme="dark"] .think-text { background-image: linear-gradient(90deg, #8e8e93 0%, #4c8dff 35%, #c084fc 50%, #8e8e93 70%); }
.think-wash { display: block; margin-top: 6px; width: 7.5rem; height: 3px; border-radius: 999px; background-image: linear-gradient(90deg, #0000, #4c8dff, #c084fc, #f0b429, #3ecf8e, #0000); background-size: 200% 100%; animation: lumen-shimmer 1.1s linear infinite; }
@keyframes lumen-shimmer { 0% { background-position: 100%; } to { background-position: 0%; } }
@keyframes lumen-spin { to { transform: rotate(1turn); } }
.spark { position: relative; display: inline-block; flex: none; width: 36px; height: 24px; margin-right: -14px; transform: scale(.62); transform-origin: 0; }
.spark span { position: absolute; top: 0; left: 0; width: 5px; height: 5px; border-radius: 999px; animation-duration: 3.2s; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
.spark span:nth-child(1) { --x0:1px;--a:16px;--b:1px;--c:21px;--d:3px;--e:24px;--f:8px;--g:21px;--h:13px;--i:16px;--j:16px;--k:11px;--l:13px;--m:8px;--n:8px;--o:11px;--p:3px; background: #4c8dff; animation-name: bubble-1; }
.spark span:nth-child(2) { --x0:10px;--a:24px;--b:8px;--c:21px;--d:13px;--e:16px;--f:16px;--g:11px;--h:13px;--i:8px;--j:8px;--k:11px;--l:3px;--m:16px;--n:1px;--o:21px;--p:3px; background: #c084fc; animation-name: bubble-2; }
.spark span:nth-child(3) { --x0:19px;--a:16px;--b:16px;--c:11px;--d:13px;--e:8px;--f:8px;--g:11px;--h:3px;--i:16px;--j:1px;--k:21px;--l:3px;--m:24px;--n:8px;--o:21px;--p:13px; background: #e15b97; animation-name: bubble-3; }
.spark span:nth-child(4) { --x0:28px;--a:8px;--b:8px;--c:11px;--d:3px;--e:16px;--f:1px;--g:21px;--h:3px;--i:24px;--j:8px;--k:21px;--l:13px;--m:16px;--n:16px;--o:11px;--p:13px; background: #f0b429; animation-name: bubble-4; }
@keyframes bubble-1{0%,2%{transform:translate(var(--x0),8px)}5%{transform:translate(var(--x0),1px)}8%{transform:translate(var(--x0),15px)}11%,40%{transform:translate(var(--x0),8px)}50%{transform:translate(var(--a),var(--b))}56%{transform:translate(var(--c),var(--d))}62%{transform:translate(var(--e),var(--f))}68%{transform:translate(var(--g),var(--h))}74%{transform:translate(var(--i),var(--j))}80%{transform:translate(var(--k),var(--l))}86%{transform:translate(var(--m),var(--n))}92%{transform:translate(var(--o),var(--p))}to{transform:translate(var(--x0),8px)}}
@keyframes bubble-2{0%,11%{transform:translate(var(--x0),8px)}14%{transform:translate(var(--x0),1px)}17%{transform:translate(var(--x0),15px)}20%,40%{transform:translate(var(--x0),8px)}50%{transform:translate(var(--a),var(--b))}56%{transform:translate(var(--c),var(--d))}62%{transform:translate(var(--e),var(--f))}68%{transform:translate(var(--g),var(--h))}74%{transform:translate(var(--i),var(--j))}80%{transform:translate(var(--k),var(--l))}86%{transform:translate(var(--m),var(--n))}92%{transform:translate(var(--o),var(--p))}to{transform:translate(var(--x0),8px)}}
@keyframes bubble-3{0%,20%{transform:translate(var(--x0),8px)}23%{transform:translate(var(--x0),1px)}26%{transform:translate(var(--x0),15px)}29%,40%{transform:translate(var(--x0),8px)}50%{transform:translate(var(--a),var(--b))}56%{transform:translate(var(--c),var(--d))}62%{transform:translate(var(--e),var(--f))}68%{transform:translate(var(--g),var(--h))}74%{transform:translate(var(--i),var(--j))}80%{transform:translate(var(--k),var(--l))}86%{transform:translate(var(--m),var(--n))}92%{transform:translate(var(--o),var(--p))}to{transform:translate(var(--x0),8px)}}
@keyframes bubble-4{0%,29%{transform:translate(var(--x0),8px)}32%{transform:translate(var(--x0),1px)}35%{transform:translate(var(--x0),15px)}38%,40%{transform:translate(var(--x0),8px)}50%{transform:translate(var(--a),var(--b))}56%{transform:translate(var(--c),var(--d))}62%{transform:translate(var(--e),var(--f))}68%{transform:translate(var(--g),var(--h))}74%{transform:translate(var(--i),var(--j))}80%{transform:translate(var(--k),var(--l))}86%{transform:translate(var(--m),var(--n))}92%{transform:translate(var(--o),var(--p))}to{transform:translate(var(--x0),8px)}}
.think-ring { position: relative; isolation: isolate; overflow: hidden; margin-top: 12px; padding: 2px; border-radius: 24px; box-shadow: 0 0 28px #7c5cfc6b; }
.think-ring::before, .think-ring::after { content: ""; position: absolute; inset: -60%; background: conic-gradient(#4c8dff, #7c5cfc, #e15b97, #f0b429, #3ecf8e, #4c8dff); animation: lumen-spin 2.4s linear infinite; }
.think-ring::before { z-index: -2; filter: blur(14px); opacity: .7; }
.think-ring::after { z-index: -1; }
.msg.ai .bubble.ring-inner { border-radius: 22px; background: var(--paper); padding: 8px 12px; }

/* Rainbow wave across the top while answering */
body.is-busy .top-glow { display: block; }
.top-glow { pointer-events: none; z-index: 0; position: absolute; top: 0; left: 0; right: 0; height: 52%; overflow: hidden; animation: think-in .6s; -webkit-mask-image: linear-gradient(#000 0% 48%, #0000 100%); mask-image: linear-gradient(#000 0% 48%, #0000 100%); }
.top-glow svg { position: absolute; top: 0; left: 0; width: 200%; height: 100%; filter: blur(22px); }
.top-glow .wave-a { animation: wave-slide 9s linear infinite; }
.top-glow .wave-b { top: 6%; height: 90%; opacity: .85; filter: blur(28px); animation: wave-slide 14s linear infinite reverse; }
@keyframes wave-slide { 0% { transform: translate(0); } to { transform: translate(-50%); } }
.header, .chat, .composer { position: relative; z-index: 1; }
.header { z-index: 20; }

/* ---------- Composer ---------- */
.composer { flex-shrink: 0; padding: 0 12px max(12px, env(safe-area-inset-bottom)); }
.composer > * { max-width: var(--col); margin-left: auto; margin-right: auto; }
.composer-form { width: 100%; }
.composer-ring { border-radius: 999px; }
body.is-busy .composer-ring { position: relative; isolation: isolate; overflow: hidden; padding: 2px; box-shadow: 0 0 28px #7c5cfc6b; }
body.is-busy .composer-ring::before, body.is-busy .composer-ring::after { content: ""; position: absolute; inset: -60%; background: conic-gradient(#4c8dff, #7c5cfc, #e15b97, #f0b429, #3ecf8e, #4c8dff); animation: lumen-spin 2.4s linear infinite; }
body.is-busy .composer-ring::before { z-index: -2; filter: blur(14px); opacity: .7; }
body.is-busy .composer-ring::after { z-index: -1; }
.composer-pill {
  display: flex; align-items: flex-end; gap: 4px; padding: 6px; border-radius: 28px;
  background: var(--raised); box-shadow: var(--shadow-card);
}
html[data-theme="dark"] .composer-pill { background: #1a1a1a; }
.attach-wrap { display: flex; }
.btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); position: relative; }
.btn:disabled { opacity: .4; cursor: default; }
#userInput { flex: 1; min-width: 0; min-height: 44px; max-height: 160px; padding: 10px 4px; border: 0; background: transparent; color: var(--ink); font-size: 1rem; line-height: 1.5; resize: none; outline: none; overflow-y: auto; overflow-wrap: anywhere; }
#userInput::placeholder { color: var(--muted); }
#userInput:disabled { opacity: .7; }
.btn.send { background: var(--accent); color: var(--accent-ink); }
.btn.send:disabled { opacity: 1; }
.btn.send:not(.ready) { opacity: .9; }
.btn.send.ready:hover { filter: brightness(1.05); }
.btn.stop { background: var(--ink); color: var(--paper); }
.btn.voice-live { background: var(--accent); color: var(--accent-ink); }
.btn.voice-live.live-active { background: #e5484d; color: #fff; }
.mic-icon { display: inline-flex; }
.mic-ring { position: absolute; inset: 4px; border-radius: 50%; }
.btn.mic.listening { color: var(--accent-ink); }
.btn.mic.listening .mic-ring { box-shadow: 0 0 0 2px var(--accent-ink); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.composer-pill.listening { box-shadow: 0 0 0 2px var(--accent-ink); }

.mode-bar, .file-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.mode-chip, .file-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 14px; border: 0; border-radius: 999px; background: var(--stone); color: var(--ink); font-size: .875rem; }
.mode-x, .file-chip-x { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1rem; }
.file-chip-name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--stone); font-size: .875rem; }
.edit-cancel { height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--raised); color: var(--ink); font-size: .8125rem; }

/* ---------- + sheet ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 150; }
.sheet-scrim { position: absolute; inset: 0; border: 0; background: #0006; cursor: default; opacity: 0; transition: opacity .2s; }
.sheet-root.open .sheet-scrim { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 48rem; max-height: 88dvh; overflow-y: auto;
  background: var(--paper); color: var(--ink); border-radius: 28px 28px 0 0; padding: 12px 0 max(24px, env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.sheet-root.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 6px; border-radius: 999px; background: color-mix(in oklab, var(--ink) 25%, transparent); margin: 0 auto 16px; }
.sheet-back { border: 0; background: transparent; color: var(--muted); font-size: .9375rem; padding: 4px 20px 10px; }
.sheet-tiles { display: grid; grid-auto-flow: column; grid-auto-columns: 136px; gap: 12px; overflow-x: auto; padding: 0 16px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.sheet-tiles::-webkit-scrollbar { display: none; }
.sheet-tile { scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: 150px; border: 0; border-radius: 28px; background: var(--stone); color: var(--ink); font-size: 1rem; padding: 0; }
.sheet-tile:hover { filter: brightness(1.05); }
.tile-ic { display: inline-flex; background: none; width: auto; height: auto; }
.sheet-rows { display: flex; flex-direction: column; gap: 4px; margin-top: 24px; padding: 0 16px; }
.sheet-row { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 6px 0; border: 0; border-radius: 16px; background: transparent; color: var(--ink); text-align: left; }
.sheet-row:hover .row-ic { background: var(--stone); }
.row-ic { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); background: transparent; flex-shrink: 0; }
html[data-theme="dark"] .row-ic { box-shadow: inset 0 0 0 1px #3a3a3c; }
.sheet-row b { display: block; font-size: 1.0625rem; font-weight: 600; }
.sheet-row small { display: block; font-size: .9375rem; color: var(--muted); }
.sheet-page { padding: 0 20px; }

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  .sidebar { position: static; width: var(--sidebar-w); transform: none; visibility: visible; transition: none; flex-shrink: 0; }
  .sidebar-close, .history-toggle, .sidebar-backdrop { display: none !important; }
  .sidebar-header { padding-left: 20px; }
  .sidebar-brand { font-size: 1.5rem; }
  .sidebar-panel-back { display: none; }
  .sidebar-panel-bar { padding-left: 16px; }
  .sidebar.panel-open .sidebar-home { display: block; }
  .sidebar.panel-open .sidebar-header { display: flex; }
  .sidebar.panel-open .sidebar-foot { display: block; }
  .sidebar-panel { position: fixed; top: 0; bottom: 0; left: var(--sidebar-w); right: 0; z-index: 40; }
  .sidebar-panel-body { padding: 8px 24px 24px; }
  .template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .template-grid.video .template-card:first-child { grid-column: auto; aspect-ratio: 1; }
  .header { padding-left: 12px; }
  .welcome { margin-top: auto; margin-bottom: auto; padding-bottom: 48px; }
  .welcome-title { font-size: 4.5rem; }
  .chat { padding: 24px 24px 16px; }
  .composer { padding: 0 24px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Kept feature widgets (from previous Nova Linx stylesheet) ---------- */
.notebook-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 280px;
}
.notebook-title-input,
.notebook-notes-input {
  width: 100%;
  background: #1e1f20;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  padding: 12px 14px;
  outline: none;
}
html[data-theme="light"] .notebook-title-input,
html[data-theme="light"] .notebook-notes-input {
  background: #fff;
  border-color: rgba(60, 64, 67, 0.12);
}
.notebook-title-input { font-size: 1rem; font-weight: 500; }
.notebook-notes-input {
  flex: 1;
  min-height: 200px;
  resize: vertical;
  font-size: 0.9rem;
  line-height: 1.5;
}
.notebook-save-btn {
  align-self: flex-start;
  border: none;
  border-radius: 999px;
  background: #8ab4f8;
  color: #0b1c33;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 18px;
  cursor: pointer;
}
.notebook-save-btn:hover { filter: brightness(1.05); }
.temp-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 200;
  background: rgba(32, 33, 36, 0.95);
  color: #fdd663;
  border: 1px solid rgba(253, 214, 99, 0.4);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  max-width: min(90vw, 360px);
  text-align: center;
}
.temp-toast.show {
  opacity: 1;
}
html[data-theme="light"] .temp-toast {
  background: rgba(255, 255, 255, 0.96);
  color: #8a6d00;
  border-color: rgba(253, 214, 99, 0.7);
}
/* Attach preview */
.attach-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto 8px;
  max-width: var(--col);
  padding: 0 8px;
  position: relative;
}
.attach-preview[hidden] { display: none !important; }

.attach-preview img,
#attachThumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
}

.attach-clear {
  position: absolute;
  left: 60px;
  top: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #5f6368;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.attach-clear:hover { background: #ea4335; }
/* —— Screen share bar —— */
.screen-share-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 768px;
  margin: 0 auto 10px;
  padding: 8px 12px;
  background: rgba(32, 33, 36, 0.92);
  border: 1px solid rgba(66, 133, 244, 0.35);
  border-radius: 16px;
  box-sizing: border-box;
}
.screen-share-bar[hidden] { display: none !important; }
html[data-theme="light"] .screen-share-bar {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(26, 115, 232, 0.35);
}
.screen-preview {
  width: 72px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.screen-share-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.screen-share-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #8ab4f8;
}
.screen-share-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.screen-stop-btn {
  appearance: none;
  border: 1px solid rgba(234, 67, 53, 0.45);
  background: rgba(234, 67, 53, 0.12);
  color: #f28b82;
  border-radius: 999px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.screen-stop-btn:hover {
  background: rgba(234, 67, 53, 0.22);
}

/* —— Nova Live overlay —— */
.live-overlay {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px 16px 110px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
}
.live-overlay[hidden] { display: none !important; }
.live-panel {
  width: min(420px, 100%);
  background: rgba(32, 33, 36, 0.96);
  border: 1px solid rgba(66, 133, 244, 0.35);
  border-radius: 24px;
  padding: 28px 22px 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  text-align: center;
}
html[data-theme="light"] .live-panel {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(26, 115, 232, 0.3);
}
.live-pulse-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
}
.live-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(66, 133, 244, 0.28);
  animation: live-pulse 1.8s ease-out infinite;
}
.live-pulse.delay { animation-delay: 0.9s; }
@keyframes live-pulse {
  0% { transform: scale(0.55); opacity: 0.85; }
  100% { transform: scale(1.35); opacity: 0; }
}
.live-bars-big {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--voice-live);
  box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.25);
}
.live-bars-big i {
  display: block;
  width: 4px;
  border-radius: 2px;
  background: #fff;
  animation: voice-bar 0.9s ease-in-out infinite;
}
.live-bars-big i:nth-child(1) { height: 14px; }
.live-bars-big i:nth-child(2) { height: 24px; animation-delay: 0.15s; }
.live-bars-big i:nth-child(3) { height: 18px; animation-delay: 0.3s; }
body.live-muted .live-bars-big {
  background: #5f6368;
  box-shadow: none;
}
body.live-muted .live-bars-big i { animation: none; }
body.live-speaking .live-bars-big {
  background: #34a853;
  box-shadow: 0 0 0 4px rgba(52, 168, 83, 0.28);
}
.live-brand {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.live-status {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.2em;
}
.live-snippets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
  text-align: left;
  margin-bottom: 16px;
  min-height: 40px;
}
.live-snip {
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: 12px;
  color: var(--text);
}
.live-snip.user {
  background: rgba(66, 133, 244, 0.14);
  align-self: flex-end;
  max-width: 92%;
}
.live-snip.ai {
  background: rgba(255, 255, 255, 0.06);
  align-self: flex-start;
  max-width: 92%;
}
html[data-theme="light"] .live-snip.ai {
  background: rgba(0, 0, 0, 0.05);
}
.live-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.live-btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.live-btn.mute {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}
.live-btn.mute:hover { background: rgba(255, 255, 255, 0.16); }
.live-btn.mute[aria-pressed="true"] {
  background: rgba(234, 67, 53, 0.2);
  color: #f28b82;
}
.live-btn.end {
  background: #ea4335;
  color: #fff;
}
.live-btn.end:hover { background: #c5221f; }

.btn.voice-live.live-active {
  background: #ea4335;
  box-shadow: 0 0 0 3px rgba(234, 67, 53, 0.28);
}
.btn.voice-live.live-active .voice-bars i {
  animation: voice-bar 0.9s ease-in-out infinite;
}
.btn.voice-live.live-active .voice-bars i:nth-child(2) { animation-delay: 0.15s; }
.btn.voice-live.live-active .voice-bars i:nth-child(3) { animation-delay: 0.3s; }

body.live-mode .composer-pill {
  box-shadow: 0 0 0 1px rgba(66, 133, 244, 0.35);
}


/* Build preview card */
.build-card {
  margin-top: 10px; border: 1px solid var(--border-soft); border-radius: 20px; overflow: hidden;
  background: var(--surface); white-space: normal; width: min(100%, 560px);
}
.build-bar { display: flex; align-items: center; gap: 2px; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--border-soft); }
.build-title { flex: 1; font-size: 0.85rem; font-weight: 600; min-width: 0; }
.build-btn {
  width: 34px; height: 34px; border: none; border-radius: 50%; background: transparent;
  color: var(--text); display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.build-btn:hover, .build-btn.on { background: var(--chip-bg); }
.build-publish {
  border: none; border-radius: 999px; background: var(--send); color: #0b1a33;
  font: 600 0.78rem var(--font); padding: 8px 12px; cursor: pointer; margin: 0 2px; flex-shrink: 0;
}
html[data-theme="light"] .build-publish { color: #fff; }
.build-publish:disabled { opacity: 0.6; }
.build-body { background: #fff; }
.build-card.phone .build-body { background: var(--chip-bg); display: flex; justify-content: center; padding: 12px 0; }
.build-frame { display: block; width: 100%; height: 62vh; min-height: 360px; border: 0; background: #fff; }
.build-card.phone .build-frame { width: 360px; max-width: 94%; height: 600px; border-radius: 24px; border: 1px solid var(--border); }
.build-frame[hidden], .build-code[hidden] { display: none; }
.build-code {
  max-height: 62vh; overflow: auto; margin: 0; padding: 12px; font-size: 0.72rem; line-height: 1.5;
  background: #0d1117; color: #e6edf3; white-space: pre-wrap; word-break: break-word;
}
.build-status { padding: 8px 12px; font-size: 0.8rem; color: var(--text-muted); border-top: 1px solid var(--border-soft); word-break: break-all; }
.build-status a { color: var(--send); }
.build-progress { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 0.9rem; white-space: normal; }
.build-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--send); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.sheet-page[hidden], #sheetMenu[hidden] { display: none; }
.sheet-h { font-size: 1.1rem; font-weight: 600; }
.sheet-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 4px; }
.sheet-empty { font-size: 0.85rem; color: var(--text-faint); padding: 22px 0; }
.sheet-input, .create-input, .settings-input {
  width: 100%; margin-top: 12px; border: 1px solid var(--border-soft); background: var(--chip-bg); color: var(--text);
  border-radius: 16px; padding: 12px 14px; font: 1rem var(--font); resize: none; outline: none;
}
.sheet-input { height: 92px; }
.sheet-input:focus, .create-input:focus, .settings-input:focus { border-color: var(--send); }
.sheet-primary, .create-btn {
  width: 100%; margin-top: 10px; min-height: 46px; border: none; border-radius: 999px;
  background: var(--send); color: #0b1a33; font: 600 0.95rem var(--font); cursor: pointer;
}
html[data-theme="light"] .sheet-primary, html[data-theme="light"] .create-btn { color: #fff; }
.sheet-primary:disabled, .create-btn:disabled { opacity: 0.6; cursor: wait; }
.sheet-secondary { width: 100%; margin-top: 10px; min-height: 46px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font: 600 0.95rem var(--font); cursor: pointer; }
.sheet-btn-row { display: flex; gap: 8px; }
.sheet-result { display: block; width: 100%; margin-top: 12px; border-radius: 22px; aspect-ratio: 1; object-fit: cover; }
.sheet-result[hidden] { display: none; }
.sheet-row-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-link { border: none; background: transparent; color: var(--send); font: 600 0.9rem var(--font); padding: 8px; cursor: pointer; }
.sheet-list-row { display: flex; align-items: center; }
.sheet-list-main {
  flex: 1; min-width: 0; display: block; width: 100%; text-align: left; border: none; background: transparent;
  color: var(--text); font: 0.95rem var(--font); padding: 12px 4px; border-radius: 12px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sheet-list-main.strong { font-weight: 600; margin-top: 8px; }
.sheet-list-main:hover { background: var(--chip-bg); }
.sheet-list-x { width: 36px; height: 36px; border: none; background: transparent; color: var(--text-muted); border-radius: 50%; font-size: 1.1rem; cursor: pointer; }

/* Notebook editor actions */
.notebook-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notebook-actions .notebook-save-btn { flex: 1; }
.notebook-save-btn.secondary { background: var(--chip-bg); color: var(--text); }
.notebook-save-btn.danger { background: transparent; color: #f28b82; border: 1px solid var(--border-soft); }

/* ---------- Overrides for kept feature widgets ---------- */
.notebook-title-input, .notebook-notes-input, html[data-theme="light"] .notebook-title-input, html[data-theme="light"] .notebook-notes-input { background: var(--stone); border: 0; border-radius: 16px; color: var(--ink); }
.notebook-save-btn { background: var(--accent); color: var(--accent-ink); height: 44px; padding: 0 18px; }
.notebook-save-btn.secondary { background: var(--stone); color: var(--ink); }
.notebook-save-btn.danger { background: transparent; color: #e5484d; box-shadow: inset 0 0 0 1px var(--line); border: 0; }
.temp-toast, html[data-theme="light"] .temp-toast { background: var(--ink); color: var(--paper); border: 0; border-radius: 999px; padding: 10px 18px; bottom: 92px; box-shadow: var(--shadow-pop); }
.sheet-input { background: var(--stone); border: 0; border-radius: 16px; }
.sheet-primary, html[data-theme="light"] .sheet-primary { background: var(--accent); color: var(--accent-ink); height: 48px; }
.sheet-secondary { border-color: var(--line); height: 48px; }
.sheet-list-main:hover { background: var(--stone); }
.build-card { border-radius: 24px; border-color: var(--line); background: var(--paper); }
.build-publish, html[data-theme="light"] .build-publish { background: var(--accent); color: var(--accent-ink); }
.screen-share-bar { background: var(--stone); border-radius: 20px; border: 0; }
.live-overlay { background: color-mix(in oklab, var(--paper) 92%, transparent); }
.attach-preview { max-width: var(--col); padding: 0 4px; }
.attach-clear { left: 56px; background: var(--ink); color: var(--paper); }
.voice-bars { display: none; }
.create-bar .create-input { margin: 0; padding: 10px 0; border: 0; border-radius: 0; background: transparent; height: auto; }
.create-bar .create-input:focus { border: 0; }
.settings-input { margin-top: 0; border: 0; }
.model-btn:hover, .model-btn[aria-expanded="true"] { background: transparent; }
.model-btn:hover { opacity: .8; }
.avatar-circle { width: 32px; height: 32px; border-radius: 8px; font-size: .875rem; }
.sidebar-avatar { width: 40px; height: 40px; }
.sheet-tiles { grid-auto-columns: 114px; scroll-padding-inline: 16px; }
.sheet-tile { height: 126px; gap: 12px; font-size: .9375rem; border-radius: 24px; }
.row-ic { width: 44px; height: 44px; border-radius: 14px; }
.sheet-row { min-height: 60px; }
.sheet-row b { font-size: 1rem; }
.sheet-row small { font-size: .875rem; }
.md table { display: table; width: 100%; }
.welcome-note { background: none; padding: 0; border-radius: 0; color: var(--muted); font-size: 1rem; margin-top: 16px; }
body.temp-mode .welcome-hello, body.temp-mode .suggestion-chips { display: none; }
body.temp-mode .welcome-note { display: flex; gap: 14px; align-items: flex-start; }
body.temp-mode .welcome-note::before {
  content: ""; flex: none; width: 40px; height: 40px; margin-top: 2px; background: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10' stroke-dasharray='1.4 2.6'/%3E%3Cpath d='M15.5 8.5 8.5 15.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10' stroke-dasharray='1.4 2.6'/%3E%3Cpath d='M15.5 8.5 8.5 15.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.logo-tile { background: transparent; overflow: hidden; }
.logo-tile img { display: block; width: 100%; height: 100%; }
html[data-theme="dark"] .logo-tile { box-shadow: 0 0 0 1px #ffffff1f; }

/* Typing effects (matched to the reference): send button morphs from accent to ink as soon as there is text,
   the stop control takes the same ink circle while answering, and the pill gets the spinning colour ring. */
html[data-theme="dark"] .composer-pill, html[data-theme="dark"] .create-bar { background: var(--raised); }
.btn.send, .create-send { transition: background-color .12s ease, color .12s ease, transform .12s ease; }
.btn.send.ready, .create-send.ready { background: var(--ink); color: var(--copper-ink); }
.btn.send.ready:active, .create-send.ready:active { transform: scale(.94); }
.btn.stop svg { width: 14px; height: 14px; }
#userInput { caret-color: var(--ink); }
body.is-busy #userInput:disabled { opacity: .7; }
body.is-busy .btn.mic:disabled { opacity: .4; }
