/* Orix — design tokens, light/dark, components */
@font-face { font-family: 'Geist'; font-weight: 100 900; font-display: swap; src: url('/fonts/geist-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geist'; font-weight: 100 900; font-display: swap; src: url('/fonts/geist-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Geist Mono'; font-weight: 100 900; font-display: swap; src: url('/fonts/geist-mono-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-weight: 100 900; font-display: swap; src: url('/fonts/geist-mono-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r-sm: 10px; --r: 16px; --r-lg: 22px; --r-xl: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f2f0; --bg-2: #efedea; --surface: #e9e6e3; --card: #ece9e6; --card-2: #f8f7f6; --raised: #ffffff;
  --ink: #1b1a19; --ink-2: #45403c; --muted: #7b756f; --faint: #a8a29c;
  --line: rgba(27, 26, 25, .09); --line-2: rgba(27, 26, 25, .16);
  --accent: #1b1a19; --on-accent: #ffffff; --accent-soft: rgba(27, 26, 25, .06);
  --danger: #c4362b; --warn: #a8670c; --ok: #1f7a4a; --info: #2c5fa8;
  --notice-bg: #f6efe0; --notice-line: #e5d6b4;
  --glass: rgba(236, 233, 230, .72); --glass-line: rgba(255, 255, 255, .5);
  --rail: #0b0b0b; --rail-ink: #e9e6e3;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f0e0e; --bg-2: #141312; --surface: #171615; --card: #1d1c1a; --card-2: #121110; --raised: #232120;
  --ink: #f2efec; --ink-2: #cfc9c3; --muted: #9a938c; --faint: #6b655f;
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .15);
  --accent: #f2efec; --on-accent: #121110; --accent-soft: rgba(255, 255, 255, .07);
  --danger: #ef6a5e; --warn: #e0a24a; --ok: #5ec48d; --info: #7aa7e8;
  --notice-bg: #25201a; --notice-line: #3d3426;
  --glass: rgba(28, 27, 26, .72); --glass-line: rgba(255, 255, 255, .08);
  --rail: #000000; --rail-ink: #e9e6e3;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 600; }
p { margin: 0 0 .8em; }
::selection { background: color-mix(in srgb, var(--ink) 18%, transparent); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hide, [hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: .6rem; }
.col { display: flex; flex-direction: column; gap: .6rem; }
.grow { flex: 1; min-width: 0; }
.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 15px; height: 15px; } .ico.lg { width: 22px; height: 22px; }
.logo { display: inline-flex; align-items: center; gap: .55rem; font-weight: 600; letter-spacing: -.03em; font-size: 1.35rem; text-decoration: none; }
.logo svg { width: 1.25em; height: 1.25em; }
.logo-mark { color: currentColor; }

#wallpaper { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: none; image-rendering: pixelated; }
body.has-wallpaper #wallpaper { display: block; }
#app { min-height: 100dvh; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 42px; padding: 0 1.1rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--raised); font-weight: 500; font-size: .92rem; transition: transform .15s var(--ease), background .15s, opacity .15s; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--card); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn-primary:hover { background: var(--accent); opacity: .9; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-danger { color: var(--danger); }
.btn-sm { height: 34px; padding: 0 .85rem; font-size: .85rem; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 12px; }
.btn-block { width: 100%; }
.input, .select, textarea.input { width: 100%; height: 42px; border: 1px solid var(--line-2); background: var(--raised); border-radius: 12px; padding: 0 .9rem; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.pill { display: inline-flex; align-items: center; gap: .4rem; height: 34px; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--raised) 70%, transparent); font-size: .85rem; color: var(--ink-2); }
button.pill:hover { background: var(--raised); }
.badge { display: inline-flex; align-items: center; height: 19px; padding: 0 .5rem; border-radius: 999px; font-size: .68rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; background: var(--accent-soft); color: var(--muted); font-family: var(--mono); }
.badge-slow { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge-limited { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge-fast, .badge-ultraspeed { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--raised); transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(16px); background: var(--on-accent); }
.switch input:focus-visible + i { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- login ---------- */
.login { display: grid; grid-template-columns: minmax(380px, 480px) 1fr; min-height: 100dvh; }
.login-left { background: #121212; color: #f2efec; padding: 3rem 3rem 2rem; display: flex; flex-direction: column; }
.login-left .logo { color: #f2efec; font-size: 1.5rem; }
.login-form { margin: auto 0; display: flex; flex-direction: column; gap: 1rem; padding: 3rem 0; }
.login-form h1 { font-size: 1.6rem; }
.login-form p { color: #a39d96; margin: 0; }
.btn-everysm { background: #efece9; color: #111; height: 48px; border-radius: 14px; font-weight: 600; width: 100%; border: 0; }
.btn-everysm:hover { background: #fff; }
.e-mark { width: 22px; height: 22px; color: #5865f2; flex: none; }
.login-note { font-size: .82rem; color: #8d8780; line-height: 1.5; }
.login-note a { color: #cfc9c3; }
.login-warn { display: flex; gap: .6rem; background: #1c1b1a; border: 1px solid #2a2826; border-radius: 14px; padding: .8rem .9rem; font-size: .84rem; color: #bdb7b0; }
.login-warn .ico { color: #e0a24a; margin-top: 2px; }
.login-foot { display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: .8rem; color: #8d8780; justify-content: center; }
.login-foot a, .login-foot button { text-decoration: none; background: none; border: 0; color: inherit; font-size: inherit; padding: 0; } .login-foot a:hover, .login-foot button:hover { color: #fff; }
.login-right { background: #efefef; color: #1b1a19; display: grid; place-items: center; padding: 2rem; position: relative; overflow: hidden; background-image: radial-gradient(#d4d4d4 1px, transparent 1px); background-size: 22px 22px; }
:root[data-theme='dark'] .login-right { background-color: #1a1918; color: #f2efec; background-image: radial-gradient(#2a2826 1px, transparent 1px); }
.login-hero { display: flex; flex-direction: column; align-items: center; gap: 1.6rem; text-align: center; max-width: 520px; }
.orbit { position: relative; width: 340px; height: 340px; }
.orbit .ring { position: absolute; border: 1px solid color-mix(in srgb, currentColor 14%, transparent); border-radius: 50%; inset: 0; }
.orbit .ring.r2 { inset: 46px; }
.orbit .core { position: absolute; inset: 120px; border-radius: 50%; background: color-mix(in srgb, currentColor 8%, transparent); display: grid; place-items: center; }
.orbit .core svg { width: 38px; height: 38px; }
.orbit .sat { position: absolute; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, currentColor 9%, var(--bg)); border: 1px solid var(--line); display: grid; place-items: center; animation: float 6s ease-in-out infinite; }
.orbit .s1 { top: -20px; left: 150px; } .orbit .s2 { top: 150px; right: -20px; animation-delay: -1.5s; }
.orbit .s3 { bottom: -20px; left: 150px; animation-delay: -3s; } .orbit .s4 { top: 150px; left: -20px; animation-delay: -4.5s; }
@keyframes float { 50% { transform: translateY(-5px); } }
.hero-title { font-size: clamp(2rem, 4vw, 2.7rem); font-weight: 500; letter-spacing: -.035em; line-height: 1.12; }
.hero-title span { color: var(--muted); display: block; }
.hero-sub { color: var(--muted); font-size: .95rem; max-width: 420px; }
.hero-pills { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }

/* ---------- chat shell ---------- */
.chat-shell { display: grid; grid-template-columns: 288px 1fr; height: 100dvh; overflow: hidden; }
.chat-shell.collapsed { grid-template-columns: 0 1fr; }
.sidebar { background: var(--surface); border-top-right-radius: var(--r-xl); border-bottom-right-radius: var(--r-xl); display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); width: 288px; transition: transform .3s var(--ease); }
.chat-shell.collapsed .sidebar { transform: translateX(-100%); }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1rem .6rem 1.2rem; }
.sb-head .logo { font-size: 1.3rem; }
.sb-new { margin: .5rem .8rem; height: 44px; display: flex; align-items: center; gap: .6rem; padding: 0 .9rem; border-radius: 12px; background: color-mix(in srgb, var(--ink) 8%, transparent); border: 0; font-weight: 500; text-align: left; }
.sb-new:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.sb-search { margin: .2rem .8rem .4rem; position: relative; }
.sb-search .ico { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.sb-search input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid transparent; background: color-mix(in srgb, var(--ink) 5%, transparent); padding: 0 .8rem 0 2.3rem; outline: none; font-size: .88rem; }
.sb-search input:focus { border-color: var(--line-2); background: var(--raised); }
.sb-nav { padding: .2rem .8rem; }
.sb-link { display: flex; align-items: center; gap: .65rem; padding: .55rem .8rem; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-size: .92rem; }
.sb-link:hover, .sb-link.active { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.sb-list { flex: 1; min-height: 0; overflow-y: auto; padding: .4rem .8rem; scrollbar-width: thin; }
.sb-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: .9rem .6rem .3rem; font-family: var(--mono); }
.sb-item { display: flex; align-items: center; gap: .3rem; border-radius: 10px; padding: 0 .3rem 0 .7rem; height: 36px; cursor: pointer; font-size: .9rem; color: var(--ink-2); }
.sb-item:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.sb-item.active { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
.sb-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-item .acts { display: none; gap: 2px; }
.sb-item:hover .acts, .sb-item:focus-within .acts { display: flex; }
.sb-item .acts button { width: 26px; height: 26px; border: 0; background: transparent; border-radius: 7px; display: grid; place-items: center; color: var(--muted); }
.sb-item .acts button:hover { background: var(--accent-soft); color: var(--ink); }
.sb-empty { padding: 1rem .8rem; color: var(--muted); font-size: .85rem; }
.hit { padding: .5rem .7rem; border-radius: 10px; cursor: pointer; font-size: .85rem; }
.hit:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.hit b { display: block; font-weight: 500; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit small { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sb-foot { padding: .7rem .8rem .9rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .5rem; }
.user-chip { display: flex; align-items: center; gap: .65rem; padding: .45rem .5rem; border-radius: 12px; border: 0; background: transparent; width: 100%; text-align: left; }
.user-chip:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #ff6aa2, #7a6cff 45%, #3fd1ff 75%, #5df2a3); flex: none; overflow: hidden; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: .8rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.legal-links { display: flex; flex-wrap: wrap; gap: .2rem .9rem; padding: 0 .6rem; font-size: .74rem; color: var(--muted); }
.legal-links a, .legal-links button { color: inherit; text-decoration: none; background: none; border: 0; padding: 0; font-size: inherit; }
.legal-links a:hover, .legal-links button:hover { color: var(--ink); text-decoration: underline; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.topbar { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.2rem; }
.topbar .spacer { flex: 1; }
.model-btn { display: inline-flex; align-items: center; gap: .5rem; height: 38px; padding: 0 .9rem; border-radius: 12px; border: 1px solid transparent; background: transparent; font-weight: 500; max-width: 60vw; }
.model-btn:hover { background: var(--accent-soft); }
.model-btn span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-wrap { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.thread { max-width: 780px; margin: 0 auto; padding: 1rem 1.2rem 2rem; display: flex; flex-direction: column; gap: 1.6rem; }
.msg-user { align-self: flex-end; max-width: 85%; background: var(--card); border-radius: 18px; padding: .65rem 1rem; white-space: pre-wrap; word-break: break-word; }
.msg-user-wrap { align-self: flex-end; display: flex; align-items: flex-start; gap: .3rem; max-width: 85%; }
.msg-user-wrap .msg-user { align-self: auto; max-width: none; }
.msg-user-wrap .edit { opacity: 0; width: 28px; height: 28px; margin-top: .3rem; border: 0; background: transparent; border-radius: 8px; color: var(--muted); display: grid; place-items: center; transition: opacity .15s; }
.msg-user-wrap:hover .edit, .msg-user-wrap .edit:focus-visible { opacity: 1; }
.msg-user-wrap .edit:hover { background: var(--accent-soft); color: var(--ink); }
.editbox { display: flex; flex-direction: column; gap: .5rem; width: min(560px, 78vw); }
.editbox textarea { height: auto; padding: .6rem .8rem; line-height: 1.5; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: .35rem; height: 26px; padding: 0 .6rem; margin: .1rem .25rem 0 0; border-radius: 999px; background: var(--accent-soft); font-size: .76rem; color: var(--ink-2); }
.chip button { border: 0; background: transparent; padding: 0; display: grid; place-items: center; color: var(--muted); }
.followups { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.toolrow.plan { align-items: flex-start; }
.msg-ai { width: 100%; }
.msg-ai .head { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .8rem; margin-bottom: .4rem; font-family: var(--mono); }
.msg-ai .head .logo-mark { width: 16px; height: 16px; color: var(--ink); }
.md { word-break: break-word; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin: 1.3em 0 .5em; } .md h1 { font-size: 1.4rem; } .md h2 { font-size: 1.2rem; } .md h3 { font-size: 1.05rem; }
.md ul, .md ol { padding-left: 1.4em; margin: 0 0 .9em; } .md li { margin: .2em 0; }
.md a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
.md a:hover { text-decoration-color: var(--ink); }
.md blockquote { margin: 0 0 .9em; padding: .1em 1em; border-left: 3px solid var(--line-2); color: var(--ink-2); }
.md code { font-family: var(--mono); font-size: .86em; background: var(--accent-soft); padding: .12em .38em; border-radius: 6px; }
.md pre { margin: 0 0 1em; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--card-2); position: relative; }
.md pre code { display: block; background: none; padding: 1rem 1.1rem; overflow-x: auto; font-size: .84rem; line-height: 1.6; }
.md pre .copy { position: absolute; top: .5rem; right: .5rem; opacity: 0; transition: opacity .15s; }
.md pre:hover .copy { opacity: 1; }
.md table { border-collapse: collapse; margin: 0 0 1em; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line-2); padding: .4rem .7rem; text-align: left; }
.md th { background: var(--accent-soft); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md img { border-radius: 10px; }
.cite { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 6px; background: var(--accent-soft); color: var(--ink-2); font-size: .66rem; font-weight: 600; vertical-align: 2px; margin: 0 1px; cursor: pointer; font-family: var(--mono); border: 0; }
.cite:hover { background: var(--ink); color: var(--on-accent); }
.typing::after { content: ''; display: inline-block; width: 8px; height: 1em; background: var(--ink); margin-left: 3px; vertical-align: -2px; animation: blink 1s steps(2) infinite; border-radius: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.status-line { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ink); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.sources { display: flex; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 .9rem; }
.src { display: flex; align-items: center; gap: .55rem; padding: .45rem .7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); text-decoration: none; font-size: .78rem; max-width: 250px; transition: border-color .15s, transform .15s var(--ease); }
.src:hover, .src.flash { border-color: var(--ink); transform: translateY(-1px); }
.src .n { width: 18px; height: 18px; border-radius: 6px; background: var(--accent-soft); display: grid; place-items: center; font-size: .65rem; font-weight: 600; font-family: var(--mono); flex: none; }
.src .t { min-width: 0; } .src .t b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src .t small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details { margin: 0 0 .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); font-size: .85rem; }
.details summary { cursor: pointer; padding: .5rem .8rem; color: var(--muted); display: flex; align-items: center; gap: .5rem; list-style: none; }
.details summary::-webkit-details-marker { display: none; }
.details > div { padding: 0 .9rem .7rem; color: var(--ink-2); white-space: pre-wrap; max-height: 260px; overflow: auto; }
.toolrow { display: flex; align-items: center; gap: .6rem; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 12px; font-size: .82rem; margin: 0 0 .5rem; background: var(--card-2); }
.toolrow .nm { font-family: var(--mono); font-size: .78rem; }
.toolrow .pv { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.toolrow .ok { color: var(--ok); }
.notice { display: flex; gap: .7rem; padding: .75rem .9rem; border-radius: 14px; background: var(--notice-bg); border: 1px solid var(--notice-line); font-size: .86rem; margin: 0 0 .8rem; color: var(--ink-2); }
.notice .ico { color: var(--warn); margin-top: 2px; }
.msg-acts { display: flex; gap: .2rem; margin-top: .5rem; opacity: .7; }
.msg-acts button { height: 30px; padding: 0 .55rem; border: 0; background: transparent; border-radius: 8px; color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; }
.msg-acts button:hover { background: var(--accent-soft); color: var(--ink); }
.errcard { border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--card-2); overflow: hidden; max-width: 640px; }
.errcard .top { display: flex; gap: 1rem; padding: 1.2rem 1.4rem; align-items: center; }
.errcard .ic { width: 46px; height: 46px; border-radius: 50%; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); display: grid; place-items: center; flex: none; }
.errcard .bot { border-top: 1px solid var(--line); padding: 1rem 1.4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .88rem; }
.empty { max-width: 700px; margin: 0 auto; padding: 8vh 1.2rem 2rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.empty h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 500; letter-spacing: -.04em; }
.empty h1 span { color: var(--muted); display: block; }
.suggest { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: .5rem; }
.related { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .8rem; color: var(--muted); }
.related button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: .2rem .7rem; font-size: .78rem; color: var(--ink-2); }
.related button:hover { background: var(--accent-soft); }

.composer-wrap { padding: 0 1.2rem 1rem; }
.composer { max-width: 780px; margin: 0 auto; background: var(--raised); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow); padding: .7rem .8rem .6rem 1.1rem; transition: border-color .15s; }
.composer:focus-within { border-color: var(--ink); }
.composer textarea { width: 100%; resize: none; border: 0; outline: none; background: transparent; max-height: 220px; line-height: 1.5; padding: .3rem 0; min-height: 28px; }
.composer-bar { display: flex; align-items: center; gap: .4rem; margin-top: .2rem; flex-wrap: wrap; }
.tgl { display: inline-flex; align-items: center; gap: .4rem; height: 32px; padding: 0 .75rem; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; font-size: .8rem; color: var(--ink-2); }
.tgl:hover { background: var(--accent-soft); }
.tgl[aria-pressed='true'] { background: var(--ink); color: var(--on-accent); border-color: var(--ink); }
.tgl[disabled] { opacity: .4; pointer-events: none; }
.send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; transition: transform .15s var(--ease), opacity .15s; }
.send:hover { transform: scale(1.06); } .send[disabled] { opacity: .3; pointer-events: none; }
.disclaimer { max-width: 780px; margin: .55rem auto 0; text-align: center; font-size: .74rem; color: var(--muted); line-height: 1.45; }
.disclaimer a { color: inherit; }

/* ---------- dropdown / modal / toast ---------- */
.menu { position: fixed; z-index: 60; min-width: 230px; max-width: 360px; max-height: min(70vh, 520px); overflow-y: auto; background: var(--raised); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: .4rem; animation: pop .14s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: .6rem .7rem .25rem; font-family: var(--mono); }
.menu-item { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .7rem; border: 0; background: transparent; border-radius: 10px; text-align: left; font-size: .88rem; text-decoration: none; }
.menu-item:hover, .menu-item[aria-selected='true'] { background: var(--accent-soft); }
.menu-item .grow b { display: block; font-weight: 500; } .menu-item .grow small { color: var(--muted); }
.menu-sep { height: 1px; background: var(--line); margin: .3rem 0; }
.backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 1rem; animation: fade .15s; backdrop-filter: blur(3px); }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: 90dvh; overflow-y: auto; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-xl); padding: 1.6rem; box-shadow: 0 24px 80px rgba(0,0,0,.35); animation: pop .18s var(--ease); }
.modal h2 { font-size: 1.3rem; margin-bottom: .4rem; display: flex; align-items: center; gap: .55rem; }
.modal .actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; }
.toast { background: var(--ink); color: var(--on-accent); padding: .65rem 1rem; border-radius: 12px; font-size: .88rem; box-shadow: var(--shadow); animation: pop .2s var(--ease); max-width: 360px; }
.toast.err { background: var(--danger); color: #fff; }
.consent { position: fixed; left: 1rem; bottom: 1rem; z-index: 80; width: min(420px, calc(100vw - 2rem)); background: var(--raised); border: 1px solid var(--line-2); border-radius: 20px; padding: 1.2rem; box-shadow: 0 12px 48px rgba(0,0,0,.2); animation: pop .25s var(--ease); }
.consent h3 { font-size: 1rem; margin-bottom: .35rem; }
.consent p { font-size: .84rem; color: var(--muted); margin-bottom: .9rem; }
.consent .btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.cat { display: flex; gap: 1rem; align-items: flex-start; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.cat:last-child { border: 0; } .cat b { display: block; } .cat small { color: var(--muted); }

/* ---------- dashboard shell (dev / settings) ---------- */
.dash { min-height: 100dvh; padding: 14px 14px 14px 94px; }
.rail { position: fixed; left: 14px; top: 14px; bottom: 14px; width: 64px; background: var(--rail); border-radius: 24px; display: flex; flex-direction: column; align-items: center; padding: 1rem 0; gap: .35rem; z-index: 20; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.rail .logo { color: var(--rail-ink); margin-bottom: .8rem; }
.rail .logo svg { width: 26px; height: 26px; }
.rail-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--rail-ink); opacity: .75; background: transparent; border: 0; text-decoration: none; position: relative; transition: background .15s, opacity .15s; }
.rail-btn:hover { opacity: 1; background: rgba(255,255,255,.1); }
.rail-btn.active { opacity: 1; background: rgba(255,255,255,.16); }
.rail-btn[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: 54px; background: #000; color: #fff; padding: .25rem .6rem; border-radius: 8px; font-size: .78rem; white-space: nowrap; pointer-events: none; z-index: 5; }
.rail .sp { flex: 1; }
.dash-main { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 3rem; display: flex; flex-direction: column; gap: 1.4rem; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.dash-head h1 { font-size: 1.7rem; }
.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); border: 1px solid var(--glass-line); border-radius: var(--r-lg); padding: 1.3rem; }
.section-title { font-size: .95rem; font-weight: 600; margin-bottom: .8rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.stat { background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--glass-line); border-radius: 22px; padding: 1.1rem 1.2rem 1.2rem; }
.stat-top { display: flex; align-items: center; gap: .7rem; margin-bottom: .8rem; }
.stat-ico { width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 8%, transparent); display: grid; place-items: center; color: var(--ink-2); }
.stat-label { font-family: var(--mono); font-size: .76rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.stat-val { font-size: 2.1rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.stat-sub { color: var(--muted); font-size: .78rem; margin-top: .4rem; }
.getstarted { position: relative; border-radius: 22px; padding: 1.2rem 1.3rem; background: #0e0e12; color: #ececec; border: 1px solid transparent; max-width: 460px; isolation: isolate; }
.getstarted::before { content: ''; position: absolute; inset: -1.5px; z-index: -2; border-radius: 23.5px; background: linear-gradient(135deg, #ff2f6d, #6a2cff 55%, #2a6bff); }
.getstarted::after { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 22px; background: #0e0e12; }
.getstarted h3 { font-size: .8rem; color: #9b9ba3; font-weight: 500; margin-bottom: .8rem; }
.gs-step { display: flex; align-items: center; gap: .8rem; padding: .35rem 0; color: #a8a8b0; font-size: .92rem; }
.gs-step .dot { width: 30px; height: 30px; border-radius: 50%; background: #1d1d22; display: grid; place-items: center; flex: none; }
.gs-step.done .dot { color: #fff; } .gs-step.cur { color: #fff; } .gs-step.cur .dot { background: #fff; color: #111; }
.code { border-radius: 18px; overflow: hidden; background: #17171a; color: #e6e3df; border: 1px solid rgba(255,255,255,.08); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: .55rem .9rem; border-bottom: 1px solid rgba(255,255,255,.08); font-size: .84rem; color: #c9c5c0; gap: .6rem; flex-wrap: wrap; }
.code-body { display: flex; overflow-x: auto; font-family: var(--mono); font-size: .82rem; line-height: 1.75; padding: .8rem 0; }
.code-body .ln { padding: 0 .9rem 0 1rem; color: #6c6862; text-align: right; user-select: none; flex: none; white-space: pre; }
.code-body pre { margin: 0; padding-right: 1.2rem; flex: 1; }
.code-body pre code { background: none; padding: 0; font: inherit; }
.tabs { display: inline-flex; gap: .2rem; background: rgba(255,255,255,.08); padding: 3px; border-radius: 10px; }
.tab { border: 0; background: transparent; color: #bdb8b2; height: 28px; padding: 0 .75rem; border-radius: 8px; font-size: .78rem; }
.tab[aria-selected='true'] { background: #fff; color: #111; }
.code .hljs { background: none; color: #e6e3df; }
.code .hljs-keyword, .code .hljs-built_in, .code .hljs-literal { color: #c4a1ff; }
.code .hljs-string, .code .hljs-regexp { color: #a5e3a0; }
.code .hljs-number, .code .hljs-attr { color: #ffb86b; }
.code .hljs-title, .code .hljs-function, .code .hljs-variable, .code .hljs-params { color: #8ec7ff; }
.code .hljs-comment { color: #7b766f; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th { text-align: left; font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: .55rem .7rem; border-bottom: 1px solid var(--line-2); font-weight: 500; }
table.t td { padding: .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 24px; }
.chart .bar { flex: 1; background: color-mix(in srgb, var(--ink) 22%, transparent); border-radius: 6px 6px 3px 3px; min-height: 3px; position: relative; transition: background .15s; }
.chart .bar:hover { background: var(--ink); }
.chart .bar::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--on-accent); padding: .2rem .5rem; border-radius: 6px; font-size: .7rem; white-space: nowrap; opacity: 0; pointer-events: none; z-index: 2; }
.chart .bar:hover::after { opacity: 1; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; font-family: var(--mono); margin-top: .4rem; }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
.model-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.mcard { background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--glass-line); border-radius: 20px; padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .7rem; }
.mcard .nm { font-size: 1.02rem; font-weight: 600; word-break: break-all; }
.mcard .meta { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.mcard .id { font-family: var(--mono); font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: .6rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .82rem; color: var(--muted); }
.set-row { display: flex; align-items: center; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border: 0; } .set-row .grow b { display: block; font-weight: 500; } .set-row .grow small { color: var(--muted); }
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; margin-top: 1rem; }
.app-card { display: flex; gap: .8rem; align-items: center; padding: .8rem; border: 1px solid var(--line); border-radius: 16px; background: var(--card-2); }
.app-card img, .app-card .ph { width: 36px; height: 36px; border-radius: 10px; object-fit: contain; background: #fff; flex: none; padding: 4px; }
.app-card .ph { display: grid; place-items: center; background: var(--accent-soft); font-weight: 600; color: var(--ink-2); }
.app-card .grow b { display: block; font-size: .9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-card .grow small { color: var(--ok); }
.skeleton { background: linear-gradient(90deg, var(--card), var(--card-2), var(--card)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 12px; height: 56px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.callout { border: 1px solid var(--notice-line); background: var(--notice-bg); border-radius: 14px; padding: .8rem 1rem; font-size: .88rem; display: flex; gap: .7rem; }
.callout .ico { color: var(--warn); margin-top: 2px; }
.keybox { font-family: var(--mono); font-size: .82rem; background: var(--card-2); border: 1px dashed var(--line-2); border-radius: 12px; padding: .8rem 1rem; word-break: break-all; user-select: all; }

/* ---------- legal pages ---------- */
.legal-page { background: var(--bg); min-height: 100dvh; }
.legal-top { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--line); gap: 1rem; flex-wrap: wrap; }
.legal-nav { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.legal-nav a { text-decoration: none; } .legal-nav a:hover, .legal-nav a[aria-current] { color: var(--ink); }
.legal { max-width: 760px; margin: 0 auto; padding: 2.5rem 1.2rem 5rem; }
.legal h1 { font-size: 2.2rem; margin-bottom: .4rem; }
.legal .upd { color: var(--muted); font-size: .85rem; margin-bottom: 2rem; }
.legal h2 { font-size: 1.2rem; margin: 2rem 0 .6rem; }
.legal p, .legal li { color: var(--ink-2); }
.legal ul { padding-left: 1.3rem; }
.legal table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 1rem 0; display: block; overflow-x: auto; }
.legal th, .legal td { border: 1px solid var(--line-2); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.legal th { background: var(--accent-soft); }
.legal a { text-underline-offset: 3px; }
.todo { background: var(--notice-bg); border: 1px dashed var(--notice-line); padding: 0 .3em; border-radius: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; } .login-right { display: none; } .login-left { padding: 2rem 1.4rem 1.4rem; min-height: 100dvh; }
  .chat-shell, .chat-shell.collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(310px, 88vw); transform: translateX(-100%); box-shadow: 0 0 60px rgba(0,0,0,.3); }
  .chat-shell:not(.collapsed) .sidebar { transform: none; }
  .chat-shell:not(.collapsed)::after { content: ''; position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35); }
  .chat-shell:not(.collapsed) .sidebar { z-index: 40; }
  .dash { padding: 10px 10px 86px; }
  .rail { left: 50%; transform: translateX(-50%); top: auto; bottom: 10px; width: auto; height: 62px; flex-direction: row; padding: 0 .8rem; border-radius: 22px; }
  .rail .logo { margin: 0 .4rem 0 0; } .rail .sp { display: none; } .rail-btn[data-tip]:hover::after { display: none; }
  .two { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; gap: .1rem; } .kv dd { margin-bottom: .6rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ========== v2: composer, persona, metrics, characters ========== */
.sb-head { padding: 1.1rem 1rem .4rem 1.2rem; }
.sb-group-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: .8rem 1.2rem .2rem; font-family: var(--mono); }
.sb-item-more { opacity: 0; width: 26px; height: 26px; border: 0; background: transparent; border-radius: 7px; display: grid; place-items: center; color: var(--muted); flex: none; }
.sb-item:hover .sb-item-more, .sb-item:focus-within .sb-item-more { opacity: 1; }
.sb-item-more:hover { background: var(--accent-soft); color: var(--ink); }
.sb-foot .uname { display: block; font-size: .88rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-scrim { display: none; }

/* model + effort controls */
.pill-effort { height: 38px; border-radius: 12px; border-color: transparent; background: transparent; gap: .4rem; }
.pill-effort:hover { background: var(--accent-soft); }
.pill-effort[disabled] { opacity: .4; pointer-events: none; }
.pill-effort .el { font-weight: 500; }
.mtag { font-family: var(--mono); font-size: .72rem; color: var(--muted); background: var(--accent-soft); padding: .1rem .45rem; border-radius: 6px; }

/* composer — unified controls */
.composer { padding: .55rem .6rem .5rem .9rem; border-radius: 24px; }
.composer textarea { padding: .45rem .2rem; }
.composer-bar { gap: .35rem; margin-top: .15rem; }
.ctl { display: inline-flex; align-items: center; gap: .4rem; height: 34px; padding: 0 .7rem; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: .82rem; color: var(--ink-2); transition: background .15s, border-color .15s, color .15s; }
.ctl:hover { background: var(--accent-soft); }
.ctl .ico { opacity: .8; }
.ctl[aria-pressed="true"] { background: var(--ink); color: var(--on-accent); border-color: var(--ink); }
.ctl[aria-pressed="true"] .ico { opacity: 1; }
.ctl[disabled] { opacity: .4; pointer-events: none; }
#c-attach { padding: 0; width: 34px; justify-content: center; }
.limit-note { font-size: .7rem; color: var(--muted); }
.send { width: 40px; height: 40px; }

/* AI message head + avatars */
.msg-ai .head { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .82rem; margin-bottom: .45rem; }
.msg-ai .head .logo-mark { width: 20px; height: 20px; color: var(--ink); }
.msg-ai .head .who { font-weight: 600; color: var(--ink); font-family: var(--font); letter-spacing: -.01em; }
.ai-ava, .char-ava { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; flex: none; background: color-mix(in srgb, var(--accent, #8b5cf6) 22%, var(--card)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #8b5cf6) 45%, transparent); }
.char-ava.lg { width: 76px; height: 76px; font-size: 40px; border-radius: 24px; }

/* Orix state bars */
.orix-state { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin: 0 0 .7rem; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); font-size: .78rem; }
.statev { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); }
.statev .meter { width: 54px; height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.statev .meter i { display: block; height: 100%; border-radius: 999px; }
.statev.mood .meter i { background: #ec4899; } .statev.mood .ico { color: #ec4899; }
.statev.energy .meter i { background: #f59e0b; } .statev.energy .ico { color: #f59e0b; }
.statev.stress .meter i { background: #ef4444; } .statev.stress .ico { color: #ef4444; }
.orix-state .focus { margin-left: auto; color: var(--ink-2); font-style: italic; }

/* thinking box */
.think-box { margin: 0 0 .7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); overflow: hidden; }
.think-box summary { cursor: pointer; padding: .5rem .8rem; color: var(--muted); display: flex; align-items: center; gap: .5rem; list-style: none; font-size: .84rem; }
.think-box summary::-webkit-details-marker { display: none; }
.think-box .think-body { padding: 0 .9rem .7rem; color: var(--ink-2); white-space: pre-wrap; font-size: .86rem; line-height: 1.6; max-height: 320px; overflow: auto; border-top: 1px solid var(--line); padding-top: .6rem; }
.think-box summary .spinner { margin-left: auto; }

/* message footer metrics */
.foot { margin-top: .5rem; }
.metrics { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--faint); font-size: .74rem; font-family: var(--mono); margin-top: .35rem; }
.metrics .ico { width: 13px; height: 13px; }
.metrics .dot-sep { opacity: .5; }
.status-line .live-tps { margin-left: auto; font-family: var(--mono); font-size: .74rem; color: var(--faint); }

/* character empty state / greeting */
.char-empty { gap: .8rem; }
.char-greet { max-width: 520px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: .9rem 1.1rem; font-style: italic; color: var(--ink-2); }

/* characters page */
.dash-plain .dash-main { padding-top: .5rem; }
.ch-page { max-width: 1080px; }
.ch-top { display: flex; align-items: center; gap: .8rem; padding: .4rem 0 1rem; }
.ch-title h1 { font-size: 1.9rem; letter-spacing: -.03em; margin-bottom: 1rem; }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.ch-card { border: 1px solid var(--line); border-radius: 20px; background: var(--card-2); padding: 1.1rem; display: flex; flex-direction: column; gap: 1rem; transition: border-color .15s, transform .15s var(--ease), box-shadow .15s; position: relative; overflow: hidden; }
.ch-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); opacity: .8; }
.ch-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line-2)); box-shadow: var(--shadow); }
.ch-card-top { display: flex; align-items: center; gap: .8rem; }
.ch-card-top .char-ava { width: 46px; height: 46px; font-size: 24px; border-radius: 15px; }
.ch-card-top b { display: block; font-weight: 600; }
.ch-card-top small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ch-card-foot { display: flex; align-items: center; gap: .4rem; }
.ch-card-foot .btn-primary { flex: 1; }
.ch-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: .7rem; padding: 2.5rem 1rem; color: var(--muted); text-align: center; border: 1px dashed var(--line-2); border-radius: 20px; }
.emoji-pick { width: 52px; height: 52px; font-size: 26px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--raised); cursor: pointer; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: .4rem; }
.emoji-opt { font-size: 26px; height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.emoji-opt:hover { background: var(--accent-soft); border-color: var(--line-2); }

@media (max-width: 900px) {
  .chat-shell:not(.collapsed) .sb-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.4); }
  .chat-shell:not(.collapsed)::after { content: none; }
}

/* ========== v3: scrollbars, hero, composer ========== */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 20%, transparent) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; min-height: 44px; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--ink) 42%, transparent); }
::-webkit-scrollbar-thumb:active { background-color: color-mix(in srgb, var(--ink) 58%, transparent); }
/* chat + sidebar: scrollbar only shows while hovering the area (no permanent grey rail) */
.thread-wrap, .sb-list { scrollbar-gutter: stable; scrollbar-color: transparent transparent; }
.thread-wrap:hover, .sb-list:hover, .thread-wrap:focus-within { scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent; }
.thread-wrap::-webkit-scrollbar-thumb, .sb-list::-webkit-scrollbar-thumb { background-color: transparent; }
.thread-wrap:hover::-webkit-scrollbar-thumb, .sb-list:hover::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--ink) 22%, transparent); }
.thread-wrap::-webkit-scrollbar-thumb:hover, .sb-list::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--ink) 45%, transparent); }
.sb-list::-webkit-scrollbar { width: 10px; }
.md pre code, .think-box .think-body, .menu { scrollbar-width: thin; }
.md pre code::-webkit-scrollbar, .think-box .think-body::-webkit-scrollbar { height: 8px; width: 8px; }

/* empty state: hero + composer centered together */
.main.is-empty { justify-content: center; }
.main.is-empty .topbar { position: absolute; inset: 0 0 auto 0; z-index: 2; }
.main.is-empty .thread-wrap { flex: 0 0 auto; overflow: visible; }
.main.is-empty .thread { padding-bottom: 0; }
.main.is-empty .composer-wrap { padding-top: .4rem; }
.main.is-empty .disclaimer { margin-top: .9rem; }
.empty { padding: 0 1.2rem; gap: 1.1rem; max-width: 760px; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: .45rem; padding: .32rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); font-size: .8rem; color: var(--ink-2); }
.hero-eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent); }
.empty h1 { font-size: clamp(2.3rem, 5.6vw, 3.7rem); line-height: 1.03; letter-spacing: -.045em; font-weight: 600; }
.empty h1 span { display: block; background: linear-gradient(95deg, #ff2f6d, #8b5cf6 55%, #3b82f6); background-size: 160% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: heroShift 9s ease-in-out infinite alternate; }
@keyframes heroShift { to { background-position: 100% 0; } }
.hero-sub { max-width: 520px; color: var(--muted); font-size: 1.02rem; line-height: 1.6; margin: 0; }
.hero-feats { display: flex; flex-wrap: wrap; gap: .5rem .5rem; justify-content: center; }
.hero-feats span { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--ink-2); font-family: var(--mono); padding: .25rem .6rem; border-radius: 8px; background: var(--accent-soft); }
.hero-feats .ico { width: 14px; height: 14px; }
.suggest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; width: 100%; max-width: 640px; margin-top: .4rem; }
.card-sug { display: flex; align-items: center; gap: .7rem; text-align: left; padding: .75rem .9rem; border-radius: 16px; border: 1px solid var(--line); background: var(--card-2); font-size: .88rem; color: var(--ink-2); transition: transform .15s var(--ease), border-color .15s, background .15s; }
.card-sug:hover { transform: translateY(-1px); border-color: var(--line-2); background: var(--raised); color: var(--ink); }
.card-sug .ico { flex: none; width: 18px; height: 18px; color: var(--muted); }

/* composer v3 */
.composer-wrap { padding: .4rem 1.2rem 1rem; }
.composer { max-width: 760px; border-radius: 28px; border: 1px solid var(--line-2); background: var(--raised); padding: .85rem .8rem .65rem 1.2rem; box-shadow: 0 1px 0 color-mix(in srgb, #fff 6%, transparent) inset, 0 12px 40px -16px rgba(0,0,0,.28); transition: border-color .18s, box-shadow .18s, background .18s; }
.composer:hover { border-color: color-mix(in srgb, var(--ink) 28%, transparent); }
.composer:focus-within { border-color: color-mix(in srgb, var(--ink) 60%, transparent); box-shadow: 0 0 0 4px var(--accent-soft), 0 16px 50px -16px rgba(0,0,0,.4); }
.composer.drag { border-style: dashed; border-color: #8b5cf6; background: color-mix(in srgb, #8b5cf6 7%, var(--raised)); }
.composer textarea { font-size: 1rem; line-height: 1.55; min-height: 32px; max-height: 260px; padding: .3rem 0; }
.composer textarea::placeholder { color: var(--faint); }
.composer-bar { margin-top: .35rem; gap: .4rem; }
.kbd-hint { font-family: var(--mono); font-size: .68rem; color: var(--faint); opacity: 0; transition: opacity .2s; white-space: nowrap; }
.composer:focus-within .kbd-hint { opacity: 1; }
.kbd-hint kbd { font-family: inherit; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 .3rem; }
.char-count { font-family: var(--mono); font-size: .7rem; color: var(--faint); }
.char-count.warn { color: var(--warn); }
.send { width: 42px; height: 42px; box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--ink) 45%, transparent); transition: transform .15s var(--ease), opacity .2s, box-shadow .2s; }
.send.idle { opacity: .28; box-shadow: none; pointer-events: none; }
.send:not(.idle):hover { transform: scale(1.07) rotate(-4deg); }
.send .ico { width: 20px; height: 20px; stroke-width: 2.2; }
.ctl { height: 36px; padding: 0 .8rem; background: color-mix(in srgb, var(--ink) 4%, transparent); border-color: transparent; }
.ctl:hover { background: var(--accent-soft); border-color: var(--line); }
.ctl[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
#c-attach { width: 36px; }
@media (max-width: 900px) {
  .suggest-grid { grid-template-columns: 1fr; }
  .kbd-hint { display: none; }
  .main.is-empty { justify-content: flex-end; }
  .main.is-empty .thread-wrap { flex: 1 1 auto; overflow-y: auto; }
}

/* v3.1 tuning */
.empty { max-width: 860px; gap: .95rem; }
.empty h1 { font-size: clamp(2rem, 4.4vw, 3.15rem); text-wrap: balance; }
.empty h1 span { white-space: nowrap; }
@media (max-width: 560px) { .empty h1 span { white-space: normal; } }
.hero-sub { font-size: .98rem; max-width: 500px; }
.suggest-grid { gap: .55rem; }
.card-sug { padding: .65rem .85rem; font-size: .85rem; }
.main.is-empty .composer-wrap { padding-top: .9rem; }

/* v3.2 conversation polish: one compact "activity" strip instead of stacked grey boxes */
.thread { max-width: 760px; gap: 2rem; }
.activity { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .4rem; margin: 0 0 .75rem; }
.activity:empty, .activity:not(:has(.think-box, .toolrow)) { display: none; }
.activity .think, .activity .tools { display: contents; }
.think-box { margin: 0; border-radius: 999px; border-color: transparent; background: var(--accent-soft); flex: 0 0 auto; }
.think-box summary { padding: .3rem .75rem; font-size: .78rem; gap: .4rem; }
.think-box[open] { flex: 1 1 100%; border-radius: 16px; border-color: var(--line); background: var(--card-2); }
.think-box[open] summary { color: var(--ink-2); }
.toolrow { margin: 0; padding: .3rem .7rem; border-radius: 999px; border-color: transparent; background: var(--accent-soft); font-size: .76rem; gap: .45rem; flex: 0 0 auto; }
.toolrow .pv { display: none; }
.toolrow.plan { flex: 1 1 100%; border-radius: 14px; background: var(--card-2); border-color: var(--line); padding: .5rem .8rem; }
.toolrow.plan .pv { display: block; }
.toolrow .ico:last-child { color: var(--ok); }
.srcs .sources { margin: 0 0 1rem; gap: .4rem; }
.src { padding: .35rem .65rem; border-radius: 999px; background: var(--accent-soft); border-color: transparent; font-size: .76rem; max-width: 230px; }
.src:hover, .src.flash { background: var(--card); border-color: var(--line-2); transform: none; }
.src .n { width: 17px; height: 17px; border-radius: 50%; background: var(--ink); color: var(--on-accent); font-size: .62rem; }
.src .t small { display: none; }
.md { font-size: 1rem; line-height: 1.75; color: var(--ink); }
.md h1, .md h2, .md h3 { letter-spacing: -.02em; }
.md p { margin-bottom: 1em; }
.msg-user { background: color-mix(in srgb, var(--ink) 9%, transparent); border-radius: 20px 20px 6px 20px; padding: .7rem 1.05rem; font-size: .98rem; }
.msg-ai .head { margin-bottom: .6rem; }
.msg-ai .head .who { font-size: .9rem; }
.mtag { display: none; }
.msg-ai:hover .mtag { display: inline; }
.msg-acts { opacity: 0; transition: opacity .15s; margin-top: .6rem; }
.msg-ai:hover .msg-acts, .msg-ai:last-of-type .msg-acts, .msg-ai:focus-within .msg-acts { opacity: 1; }
.metrics { opacity: .75; }
.followups { margin-top: 1rem; }
.followups .pill { border-radius: 14px; height: auto; padding: .45rem .8rem; background: var(--card-2); }

/* v3.3: sharper composer (less pill-shaped) + single mode selector */
.composer { max-width: 780px; border-radius: 14px; padding: .75rem .75rem .6rem 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 10px 30px -18px rgba(0,0,0,.45); }
.composer:focus-within { box-shadow: 0 0 0 3px var(--accent-soft), 0 10px 30px -16px rgba(0,0,0,.5); }
.composer textarea { font-size: .98rem; min-height: 30px; }
.composer-bar { margin-top: .4rem; padding-top: .5rem; border-top: 1px solid var(--line); gap: .5rem; flex-wrap: nowrap; }
.ctl-sq { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 9px; background: transparent; border: 1px solid var(--line-2); }
.ctl-sq:hover { background: var(--accent-soft); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--accent-soft); }
.seg-btn { display: inline-flex; align-items: center; gap: .4rem; height: 28px; padding: 0 .7rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 500; transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap; }
.seg-btn:hover:not([disabled]):not([aria-checked="true"]) { color: var(--ink); }
.seg-btn[aria-checked="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.25), 0 0 0 1px var(--line); }
.seg-btn[disabled] { opacity: .35; pointer-events: none; }
.seg-btn .ico { width: 14px; height: 14px; }
.seg-btn[data-mode="fast"][aria-checked="true"] .ico { color: #f59e0b; }
.seg-btn[data-mode="auto"][aria-checked="true"] .ico { color: #8b5cf6; }
.seg-btn[data-mode="deep"][aria-checked="true"] .ico { color: #ec4899; }
.send { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
.send:not(.idle):hover { transform: translateY(-1px); }
.send .ico { width: 18px; height: 18px; }
.send.idle { opacity: .3; }
.kbd-hint { margin-right: .2rem; }
.menu { border-radius: 12px; }
.menu-item { border-radius: 8px; align-items: flex-start; }
.menu-item[disabled] { opacity: .4; pointer-events: none; }
.menu-item .mi-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; flex: none; color: var(--ink-2); }
.menu-item small { display: block; font-size: .74rem; }
.card-sug { border-radius: 12px; }
.hero-eyebrow, .hero-feats span { border-radius: 8px; }
@media (max-width: 640px) {
  .seg-btn span { display: none; }
  .seg-btn { padding: 0 .6rem; }
}

/* ========== v4: navbar, hero, palette, share, responsive ========== */
.kbd { font-family: var(--mono); font-size: .7rem; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: .05rem .4rem; background: var(--card-2); color: var(--ink-2); }
button.sb-link { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.sb-flag { display: grid; place-items: center; color: var(--ok); flex: none; }
.sb-flag .ico { width: 13px; height: 13px; }

/* navbar */
.topbar { height: 58px; padding: 0 .9rem; gap: .4rem; flex: none; }
.tb-title { min-width: 0; flex: 0 1 auto; }
.tb-title-btn { display: flex; align-items: center; gap: .55rem; max-width: min(46vw, 560px); height: 40px; padding: 0 .75rem; border: 0; border-radius: 10px; background: transparent; font-weight: 600; font-size: .98rem; letter-spacing: -.01em; transition: background .15s; }
.tb-title-btn:not(.inert):hover, .tb-title-btn.editing { background: var(--accent-soft); }
.tb-title-btn.inert { cursor: default; pointer-events: none; }
.tb-title-btn.inert .tb-caret { display: none; }
.tb-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tb-text.placeholder { color: var(--muted); font-weight: 500; }
.tb-caret { color: var(--muted); display: grid; place-items: center; }
.tb-edit { min-width: 200px; width: min(40vw, 420px); height: 30px; border: 1px solid var(--ink); border-radius: 8px; background: var(--raised); padding: 0 .6rem; font: inherit; font-weight: 600; outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.tb-chip { display: inline-flex; align-items: center; gap: .3rem; height: 22px; padding: 0 .55rem; border-radius: 999px; font-size: .7rem; font-weight: 600; font-family: var(--mono); letter-spacing: .01em; flex: none; }
.tb-chip[hidden] { display: none; }
.tb-chip .ico { width: 12px; height: 12px; }
.tb-chip.private { background: var(--accent-soft); color: var(--muted); }
.tb-chip.shared { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tb-chip.arch { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tb-share[hidden] { display: none; }
.tb-share { height: 34px; border-radius: 9px; gap: .4rem; }
.model-btn { border-radius: 10px; border: 1px solid var(--line); }

/* message actions */
.msg-acts { gap: .1rem; align-items: center; }
.msg-acts button { border-radius: 8px; }
.acts-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 .35rem; flex: none; }
.msg-acts [data-fb] { padding: 0 .5rem; }
.msg-acts [data-fb][aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); }
.msg-acts [data-fb="1"][aria-pressed="true"] { color: var(--ok); }
.msg-acts [data-fb="-1"][aria-pressed="true"] { color: var(--danger); }
.msg-acts button.on { color: #8b5cf6; background: var(--accent-soft); }
#c-mic.rec { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); border-color: var(--danger); animation: recPulse 1.2s ease-in-out infinite; }
@keyframes recPulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--danger) 20%, transparent); } }

.scroll-down { position: absolute; left: 50%; bottom: 9.2rem; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--raised); color: var(--ink-2); display: grid; place-items: center; box-shadow: var(--shadow); z-index: 6; transition: transform .15s var(--ease); }
.scroll-down:hover { transform: translateX(-50%) translateY(-2px); color: var(--ink); }

/* slash menu */
.composer-wrap { position: relative; }
.slash-menu { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% - .25rem); width: min(780px, calc(100% - 2.4rem)); background: var(--raised); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 14px 44px rgba(0,0,0,.35); padding: .35rem; z-index: 30; animation: pop .14s var(--ease); }
.slash-item { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .5rem .65rem; border: 0; border-radius: 9px; background: transparent; text-align: left; }
.slash-item[aria-selected="true"], .slash-item:hover { background: var(--accent-soft); }
.slash-item b { font-weight: 500; font-family: var(--mono); font-size: .86rem; }
.slash-item small { display: block; color: var(--muted); font-size: .76rem; }
.mi-ico { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; flex: none; color: var(--ink-2); }

/* command palette */
.pal-back { position: fixed; inset: 0; z-index: 85; background: rgba(0,0,0,.5); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 1rem 1rem; animation: fade .15s; }
.pal { width: min(660px, 100%); background: var(--bg); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 28px 90px rgba(0,0,0,.5); overflow: hidden; animation: pop .16s var(--ease); }
.pal-in { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-in input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 1.02rem; color: var(--ink); }
.pal-list { max-height: min(56vh, 440px); overflow-y: auto; padding: .4rem; }
.pal-sec { font-family: var(--mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: .6rem .7rem .25rem; }
.pal-item { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .5rem .7rem; border: 0; border-radius: 9px; background: transparent; text-align: left; }
.pal-item[aria-selected="true"] { background: var(--accent-soft); }
.pal-item b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
.pi-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.pal-empty { padding: 1.6rem; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 1rem; align-items: center; padding: .55rem 1rem; border-top: 1px solid var(--line); font-size: .74rem; color: var(--muted); }
.pal-foot .sem { margin-left: auto; color: #8b5cf6; }

/* share / prompts / shortcuts dialogs */
.share-row { display: flex; gap: .5rem; margin-top: .8rem; }
.share-row .input { font-family: var(--mono); font-size: .8rem; }
.pl-list { display: flex; flex-direction: column; gap: .3rem; max-height: 240px; overflow-y: auto; margin-top: .6rem; }
.pl-item { display: flex; align-items: center; gap: .3rem; border: 1px solid var(--line); border-radius: 10px; padding: .2rem .3rem .2rem 0; }
.pl-use { flex: 1; text-align: left; border: 0; background: transparent; padding: .5rem .8rem; border-radius: 9px; min-width: 0; }
.pl-use:hover { background: var(--accent-soft); }
.pl-use b { display: block; font-weight: 500; }
.pl-use small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv-list { display: flex; flex-direction: column; gap: .5rem; margin-top: .8rem; }
.kv-row { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.kv-row .kbd { min-width: 96px; text-align: center; }

/* public shared page */
.share-page { min-height: 100dvh; background: var(--bg); }
.share-top { display: flex; align-items: center; gap: .6rem; padding: .8rem clamp(1rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line); }
.share-main { max-width: 820px; margin: 0 auto; padding: 2rem 1.2rem 4rem; }
.share-head h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); margin: .9rem 0 1.6rem; letter-spacing: -.03em; line-height: 1.1; }
.share-thread { padding: 0; max-width: none; }
.share-foot { margin-top: 2.5rem; display: flex; flex-direction: column; gap: 1rem; align-items: flex-start; }

/* hero v2: aurora + rotating words */
.thread { position: relative; isolation: isolate; }
.hero { position: relative; }
.hero-aurora { position: absolute; left: 50%; top: -6%; width: min(980px, 130vw); height: 440px; transform: translateX(-50%); z-index: -1; pointer-events: none; filter: blur(34px); opacity: .9;
  background: radial-gradient(38% 52% at 24% 42%, color-mix(in srgb, #ff2f6d 26%, transparent), transparent 70%), radial-gradient(36% 52% at 70% 34%, color-mix(in srgb, #8b5cf6 24%, transparent), transparent 70%), radial-gradient(34% 46% at 52% 78%, color-mix(in srgb, #3b82f6 20%, transparent), transparent 70%);
  animation: aurora 16s ease-in-out infinite alternate; }
@keyframes aurora { from { transform: translateX(-52%) scale(1) rotate(-2deg); } to { transform: translateX(-48%) scale(1.12) rotate(3deg); } }
.hero-sub .rot { display: inline-grid; vertical-align: bottom; text-align: left; min-width: 11.5ch; }
.hero-sub .rot b { grid-area: 1 / 1; opacity: 0; font-weight: 600; color: var(--ink); animation: rotWord 12s infinite; white-space: nowrap; }
.hero-sub .rot b:nth-child(2) { animation-delay: 3s; } .hero-sub .rot b:nth-child(3) { animation-delay: 6s; } .hero-sub .rot b:nth-child(4) { animation-delay: 9s; }
@keyframes rotWord { 0% { opacity: 0; transform: translateY(.45em); } 4%, 22% { opacity: 1; transform: none; } 27%, 100% { opacity: 0; transform: translateY(-.45em); } }
@media (prefers-reduced-motion: reduce) { .hero-sub .rot b:first-child { opacity: 1 !important; } .hero-aurora { animation: none !important; } }
.hero-feats span { background: color-mix(in srgb, var(--ink) 5%, transparent); }

/* touch devices: no hover to reveal actions */
@media (hover: none) { .msg-acts, .msg-user-wrap .edit, .sb-item-more { opacity: 1 !important; } }

/* responsive */
@media (min-width: 1500px) { .thread { max-width: 860px; } .composer, .disclaimer { max-width: 860px; } .slash-menu { width: min(860px, calc(100% - 2.4rem)); } }
@media (max-width: 900px) { .scroll-down { bottom: 8.4rem; } }
@media (max-width: 760px) {
  .main.is-empty .topbar { position: static; }
  .main.is-empty .tb-text.placeholder { display: none; }
  .seg-btn[aria-checked="true"] span { display: inline; }
  .topbar { padding: 0 .4rem; gap: .2rem; height: 54px; }
  .tb-chip span, .tb-share span { display: none; }
  .tb-chip { padding: 0 .4rem; }
  .tb-title-btn { max-width: 44vw; padding: 0 .5rem; }
  .model-btn { max-width: 34vw; padding: 0 .5rem; }
  .model-btn .bd { display: none; }
  #palette-btn { display: none; }
  .composer-wrap { padding: .2rem .6rem calc(.6rem + env(safe-area-inset-bottom)); }
  .composer { padding: .65rem .65rem .5rem .8rem; }
  .thread { padding: .8rem .9rem 1.5rem; gap: 1.6rem; }
  .msg-user-wrap { max-width: 94%; }
  .empty { padding: 0 .5rem; }
  .empty h1 { font-size: clamp(1.9rem, 9vw, 2.4rem); }
  .hero-sub .rot { min-width: 0; display: inline; }
  .hero-sub .rot b { display: none; }
  .hero-sub .rot b:first-child { display: inline; opacity: 1; animation: none; }
  .hero-feats { display: none; }
  .msg-acts span { display: none; }
  .tb-edit { min-width: 120px; width: 44vw; }
  .pal-back { padding-top: 6vh; }
  .share-main { padding-top: 1.2rem; }
}
@media (max-width: 420px) { .seg-btn { padding: 0 .5rem; } .ctl-sq { width: 30px; } .send { width: 32px; height: 32px; } }

/* ========== v5: plain background, preferences, new chat features ========== */
.hero-aurora { display: none !important; }
body { background: var(--bg); }
/* account preferences (set on <html> by userprefs.js) */
html[data-text="sm"] { --md-fs: .92rem; }
html[data-text="lg"] { --md-fs: 1.12rem; }
.md { font-size: var(--md-fs, 1rem); }
.msg-user { font-size: calc(var(--md-fs, 1rem) - .02rem); }
.composer textarea { font-size: var(--md-fs, 1rem); }
html[data-width="narrow"] .thread, html[data-width="narrow"] .composer, html[data-width="narrow"] .disclaimer { max-width: 660px; }
html[data-width="wide"] .thread, html[data-width="wide"] .composer, html[data-width="wide"] .disclaimer { max-width: 960px; }
html[data-density="compact"] .thread { gap: 1.1rem; }
html[data-density="compact"] .md { line-height: 1.55; }
html[data-density="compact"] .md p { margin-bottom: .6em; }
html[data-metrics="0"] .metrics { display: none; }
html[data-ostate="0"] .orix-state { display: none; }
html[data-ts="0"] .mtime { display: none; }
html.no-motion *, html.no-motion *::before, html.no-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

/* message timestamps */
.mtime { font-family: var(--mono); font-size: .7rem; color: var(--faint); margin-left: .2rem; }
.u-actions { display: flex; flex-direction: column; gap: 2px; }

/* code blocks: bar with language, download, copy; collapse long ones */
.md pre { position: relative; }
.pre-bar { display: flex; align-items: center; gap: .3rem; padding: .3rem .5rem .3rem .9rem; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 4%, transparent); font-size: .74rem; }
.pre-bar .lang { font-family: var(--mono); color: var(--muted); text-transform: lowercase; }
.pre-btn { display: inline-flex; align-items: center; gap: .3rem; height: 26px; padding: 0 .5rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: .74rem; }
.pre-btn:hover { background: var(--accent-soft); color: var(--ink); }
.md pre.collapsed code { max-height: 360px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.pre-more { display: block; width: 100%; border: 0; border-top: 1px solid var(--line); background: var(--card-2); color: var(--ink-2); padding: .45rem; font-size: .78rem; }
.pre-more:hover { background: var(--accent-soft); }
.md pre .copy { display: none; }

/* tables with CSV copy */
.tbl { position: relative; margin: 0 0 1em; overflow-x: auto; }
.tbl table { margin: 0; }
.tbl-csv { position: sticky; left: 0; display: inline-flex; align-items: center; gap: .3rem; margin-top: .4rem; border: 0; background: transparent; color: var(--muted); font-size: .74rem; padding: .15rem .3rem; border-radius: 6px; }
.tbl-csv:hover { background: var(--accent-soft); color: var(--ink); }
.src-copy { display: inline-flex; align-items: center; gap: .35rem; border: 1px dashed var(--line-2); background: transparent; border-radius: 999px; padding: .3rem .65rem; font-size: .74rem; color: var(--muted); }
.src-copy:hover { color: var(--ink); background: var(--accent-soft); }

/* floating text-selection toolbar */
.sel-bar { position: fixed; z-index: 70; display: flex; gap: 2px; padding: 3px; background: var(--ink); color: var(--on-accent); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.35); animation: pop .12s var(--ease); }
.sel-bar button { display: inline-flex; align-items: center; gap: .35rem; height: 30px; padding: 0 .6rem; border: 0; border-radius: 7px; background: transparent; color: inherit; font-size: .8rem; }
.sel-bar button:hover { background: color-mix(in srgb, var(--on-accent) 16%, transparent); }

/* find in conversation */
.findbar { display: flex; align-items: center; gap: .4rem; margin: 0 .9rem .3rem; padding: .35rem .5rem .35rem .8rem; border: 1px solid var(--line-2); border-radius: 10px; background: var(--raised); box-shadow: var(--shadow); color: var(--muted); }
.findbar input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; }
.findbar .fcount { font-family: var(--mono); font-size: .72rem; white-space: nowrap; }
.findbar button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.findbar button:hover { background: var(--accent-soft); color: var(--ink); }
mark.find-hit { background: color-mix(in srgb, #facc15 45%, transparent); color: inherit; border-radius: 3px; }
mark.find-hit.cur { background: #facc15; color: #111; }

/* sidebar: filters, tools, multi-select, resize */
.sb-tools { display: flex; align-items: center; gap: .3rem; padding: .2rem .8rem .1rem; }
.sb-filters { display: flex; flex: 1; gap: 2px; padding: 2px; border-radius: 9px; background: var(--accent-soft); min-width: 0; }
.sb-filters button { flex: 1; height: 26px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 500; white-space: nowrap; padding: 0 .3rem; }
.sb-filters button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 0 0 1px var(--line); }
.sb-tool { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); flex: none; }
.sb-tool:hover, .sb-tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); }
.sb-chk { accent-color: var(--ink); margin-right: .4rem; flex: none; }
.sb-item.sel { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.sb-selbar { display: flex; align-items: center; gap: .4rem; padding: .6rem .8rem; border-top: 1px solid var(--line); font-size: .8rem; background: var(--surface); }
.sb-selbar.hide { display: none; }
.sidebar { position: relative; }
.sb-resize { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; z-index: 5; }
.sb-resize::after { content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 2px; background: transparent; transition: background .15s; }
.sb-resize:hover::after, body.resizing .sb-resize::after { background: var(--ink); opacity: .35; }
body.resizing { cursor: col-resize; user-select: none; }
.chat-shell { grid-template-columns: var(--sbw, 288px) 1fr; }
.chat-shell.collapsed { grid-template-columns: 0 1fr; }
.sidebar { width: var(--sbw, 288px); }
@media (max-width: 900px) { .chat-shell, .chat-shell.collapsed { grid-template-columns: 1fr; } .sb-resize { display: none; } }
.card-sug.resume { border-style: dashed; }
.card-sug.resume span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* settings: segmented controls inside rows */
.set-row .seg { flex: none; }
.set-row .seg-btn { height: 30px; padding: 0 .75rem; }
.set-row .seg-btn[aria-checked="true"] { background: var(--ink); color: var(--on-accent); box-shadow: none; }
.set-row .select { height: 36px; }
@media (max-width: 640px) { .set-row { flex-wrap: wrap; } .set-row .seg { flex-wrap: wrap; } .set-row .seg-btn span { display: inline; } }

/* print / save as PDF: just the conversation */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .sidebar, .sb-scrim, .topbar, .composer-wrap, .scroll-down, .findbar, .msg-acts, .u-actions, .followups, .related, .pre-bar, .pre-more, .tbl-csv, .src-copy, .sel-bar, .toasts, .consent, #wallpaper { display: none !important; }
  .chat-shell { display: block !important; height: auto !important; }
  .main, .thread-wrap { overflow: visible !important; height: auto !important; }
  .thread { max-width: none !important; padding: 0 !important; }
  .md pre.collapsed code { max-height: none !important; -webkit-mask-image: none; mask-image: none; }
  .msg-ai, .msg-user-wrap, pre, table { break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
}

/* ───────── v6 ───────── */
textarea.input { height: auto; padding: .6rem .9rem; line-height: 1.5; resize: vertical; }
.lbl { display: block; font-size: .8rem; font-weight: 600; margin: 0 0 .35rem; color: var(--ink); }
#c-enh.busy { opacity: .5; pointer-events: none; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* context meter in the navbar */
.ctx-meter { display: inline-flex; align-items: center; gap: .4rem; font: 500 .72rem var(--mono, ui-monospace, monospace); color: var(--muted, #888); padding: .25rem .5rem; border: 1px solid var(--line-2); border-radius: 999px; cursor: help; }
.ctx-meter .bar { width: 34px; height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.ctx-meter .bar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; transition: width .3s; }
.ctx-meter[data-lvl="mid"] .bar i { background: #d9a400; }
.ctx-meter[data-lvl="hi"] .bar i { background: #e5484d; }
@media (max-width: 760px) { .ctx-meter { display: none; } }

/* tags */
.tag-edit { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .6rem; min-height: 28px; }
.tag-chip { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .35rem .2rem .6rem; border-radius: 999px; background: var(--raised); border: 1px solid var(--line-2); font-size: .8rem; }
.tag-chip button { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 0; background: transparent; color: inherit; cursor: pointer; }
.tag-chip button:hover { background: var(--line-2); }
.sb-tagbar { display: flex; flex-wrap: wrap; gap: .3rem; padding: .1rem .9rem .5rem; }
.sb-tagbar[hidden] { display: none; }
.tag-pill { border: 1px solid var(--line-2); background: transparent; color: inherit; border-radius: 999px; padding: .1rem .5rem; font-size: .7rem; cursor: pointer; opacity: .75; }
.tag-pill:hover, .tag-pill[aria-pressed="true"] { opacity: 1; background: var(--ink); color: var(--on-accent); border-color: var(--ink); }
.sb-tag { font-style: normal; font-size: .62rem; opacity: .55; margin-left: .35rem; white-space: nowrap; }

/* bookmarks */
.msg-acts [data-bm][aria-pressed="true"] { color: #d9a400; }
.msg-acts [data-bm][aria-pressed="true"] svg { fill: currentColor; }
.bm-list { display: flex; flex-direction: column; gap: .5rem; max-height: 55dvh; overflow-y: auto; margin: .6rem 0; }
.bm-item { text-align: left; border: 1px solid var(--line-2); background: var(--raised); color: inherit; border-radius: 12px; padding: .7rem .85rem; cursor: pointer; display: flex; flex-direction: column; gap: .25rem; }
.bm-item:hover { border-color: var(--ink); }
.bm-t { font-weight: 600; font-size: .85rem; }
.bm-t small { font-weight: 400; opacity: .6; }
.bm-b { font-size: .8rem; opacity: .75; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* html preview */
.modal:has(.pv-wrap) { width: min(960px, 100%); }
.pv-wrap { background: repeating-conic-gradient(var(--line-2) 0 25%, transparent 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line-2); border-radius: 12px; padding: .6rem; display: flex; justify-content: center; }
.pv-wrap iframe { width: 100%; height: 55dvh; border: 0; border-radius: 8px; background: #fff; transition: width .2s; max-width: 100%; }

/* zen mode */
.chat-shell.zen { grid-template-columns: 1fr !important; }
.chat-shell.zen .sidebar, .chat-shell.zen .sb-scrim, .chat-shell.zen .topbar, .chat-shell.zen .disclaimer, .chat-shell.zen .kbd-hint { display: none !important; }
.chat-shell.zen .thread { max-width: 760px; }

/* ───────── pixel wallpaper everywhere (opt-in): chat surfaces let it show through ───────── */
.rail-btn[aria-pressed="true"], #wp-btn[aria-pressed="true"] { color: var(--ink); background: var(--raised); }
body.has-wallpaper .chat-shell, body.has-wallpaper .main { background: transparent; }
body.has-wallpaper .sidebar { background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(12px); }
body.has-wallpaper .topbar { background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(10px); }
body.has-wallpaper .thread { background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(8px); border-radius: 18px; }
body.has-wallpaper .thread:empty { background: transparent; backdrop-filter: none; }
body.has-wallpaper .main.is-empty .thread { background: transparent; backdrop-filter: none; }
