:root {
  color-scheme: dark;
  --charcoal: #111214;
  --paper: #e9e8e5;
  --muted: #aaa9a7;
  --subtle: #8e8f92;
  --border: #c7c8ce1c;
  font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  color: var(--paper);
  background: var(--charcoal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 280px; }
body { margin: 0; height: 100vh; height: 100dvh; overflow: hidden; background: var(--charcoal); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
button { border: 1px solid #e9e8e540; border-radius: 5px; background: #deded9; color: #18191b; padding: 12px 18px; font-size: 13px; font-weight: 550; transition: background .2s ease, border-color .2s ease, box-shadow .2s ease; }
button:hover { background: #f0efeb; border-color: #f0efeb80; }
button:disabled { opacity: .38; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #e9e8e5; outline-offset: 4px; }
[hidden] { display: none !important; }
::selection { color: #fff; background: #55565a; }
* { scrollbar-width: thin; scrollbar-color: #57585c #17181a; }

.atmosphere { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: radial-gradient(ellipse at 67% 5%, #292a2c60 0, transparent 58%), linear-gradient(180deg, #17181a 0%, #111214 70%); }
.haze { position: absolute; inset: 0; background: radial-gradient(ellipse at 55% 47%, #94969d0b 0, transparent 50%); animation: haze-drift 24s ease-in-out infinite alternate; }
.abyss { position: absolute; width: min(65vw, 800px); aspect-ratio: 1; left: calc(50% + 135px); top: 44%; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, #08090b 0%, #090a0c 49%, #111214 63%, #33343730 69%, #797b8012 70%, transparent 73%); box-shadow: 0 -28px 100px -45px #c4c8d51c, 0 48px 140px -25px #0007; opacity: .7; }
.abyss::before, .abyss::after { content: ""; position: absolute; border-radius: 50%; }
.abyss::before { inset: 7.5%; border: 1px solid #77798116; box-shadow: inset 0 2px 8px #afb4c209; }
.abyss::after { inset: 11%; border: 1px solid #9197a009; }
.abyss-core { position: absolute; inset: 15%; border-radius: inherit; background: #090a0c88; box-shadow: inset 0 0 72px 10px #0005; }

.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 270px minmax(0, 1fr); height: 100vh; height: 100dvh; width: 100%; max-width: 1920px; margin: auto; }
.sidebar { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 34px 23px 22px; gap: 31px; border-right: 1px solid var(--border); background: #141517c9; }
.brand { display: flex; align-items: center; gap: 12px; width: fit-content; color: var(--paper); text-decoration: none; border-radius: 2px; font-size: 21px; letter-spacing: -.55px; }
.brand strong { color: #b8b8bb; font-weight: 400; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; font-weight: 400; letter-spacing: .12em; }
.nebula-mark { display: grid; flex-shrink: 0; width: 34px; height: 34px; place-items: center; border: 1px solid #c6c7ca5c; border-radius: 50%; box-shadow: inset 0 0 0 5px #e0e2e608; }
.nebula-mark span { width: 12px; height: 12px; border: 1px solid #dedfe68c; border-radius: 50%; }
.new-chat { min-height: 43px; padding: 11px 14px; background: #e0e2e608; border-color: #d1d0ce30; color: #d9d9d7; text-align: left; font-size: 12px; font-weight: 400; }
.new-chat:hover { background: #e0e2e612; border-color: #d1d0ce60; }
#chat-list { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 7px; margin-top: -8px; overflow: auto; }
#chat-list button { flex-shrink: 0; padding: 12px; border: 1px solid transparent; border-radius: 4px; color: var(--muted); background: transparent; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 400; }
#chat-list button:hover { color: var(--paper); border-color: #d1d0ce15; background: #e0e2e606; }
#chat-list button.selected { color: var(--paper); border-color: #d1d0ce26; background: #e0e2e60b; }
.sidebar-bottom { display: flex; align-items: center; gap: 8px; margin-top: auto; color: var(--muted); font-size: 10px; flex-wrap: wrap; }
.environment-label { display: inline-flex; align-items: center; gap: 8px; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #c5c6c8; box-shadow: 0 0 9px #f5f5ff20; }
.quiet { margin-left: auto; padding: 9px; border: 1px solid transparent; color: #b1b1b3; background: transparent; font-size: 12px; font-weight: 400; }
.quiet:hover { background: #e0e2e60a; border-color: #d1d0ce26; }

.conversation { display: flex; flex-direction: column; min-height: 0; min-width: 0; height: 100%; overflow: hidden; }
.topbar { display: flex; flex-shrink: 0; min-width: 0; min-height: 103px; align-items: center; justify-content: space-between; gap: 18px; padding: 26px 36px; border-bottom: 1px solid var(--border); background: #16171930; }
.topbar > div { min-width: 0; }
.topbar h1 { margin: 0 0 6px; font-size: 19px; font-weight: 500; letter-spacing: -.35px; }
.topbar p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.badge { flex-shrink: 0; padding: 7px 11px; border: 1px solid #d1d0ce26; border-radius: 20px; color: #b8b8bb; font-size: 10px; letter-spacing: .035em; white-space: nowrap; }

.login-card { flex: 0 1 auto; align-self: center; width: calc(100% - 64px); max-width: 540px; min-height: 0; margin: auto; padding: 36px 0; overflow-y: auto; animation: arrive .5s ease-out both; }
.access-mark { display: grid; place-items: center; width: 68px; height: 68px; margin-bottom: 26px; border: 1px solid #c6c7ca38; border-radius: 50%; background: #11121470; box-shadow: inset 0 0 0 10px #e0e2e604, 0 0 35px #ffffff04; }
.access-mark span { display: block; width: 27px; height: 27px; border: 1px solid #dedfe660; border-radius: 50%; box-shadow: inset 0 0 0 7px #090a0c; }
.login-card h2 { margin: 0 0 15px; color: var(--paper); font-size: clamp(32px, 3.5vw, 43px); line-height: 1.15; font-weight: 350; letter-spacing: -.055em; }
.login-card p { margin: 0; color: #aaa9a7; font-size: 13px; line-height: 1.75; }
.login-card label { display: block; margin: 31px 0 11px; color: #d0cfcd; font-size: 12px; }
.login-row { display: flex; gap: 10px; }
.login-row input { flex: 1; min-width: 0; min-height: 47px; padding: 13px 15px; border: 1px solid #d1d0ce38; border-radius: 5px; color: var(--paper); background: #151618aa; font-size: 13px; transition: border-color .2s; }
.login-row input:hover { border-color: #d1d0ce60; }
.login-row input::placeholder { color: #8e8f92; }
#login-submit { display: inline-flex; align-items: center; justify-content: center; gap: 19px; min-width: 106px; }
#login-submit span { font-size: 17px; font-weight: 400; }
.login-card small { display: block; margin-top: 15px; color: var(--subtle); font-size: 11px; line-height: 1.7; }

.messages { display: flex; flex: 1; min-height: 0; min-width: 0; flex-direction: column; gap: 24px; padding: 30px max(32px, calc((100% - 820px) / 2)); overflow: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.welcome { margin: auto 0; padding: 30px 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.welcome h2 { margin: 0 0 15px; color: var(--paper); font-size: 29px; font-weight: 350; letter-spacing: -.7px; }
.welcome p { max-width: 550px; margin: 0; }
.bubble { flex-shrink: 0; max-width: 90%; padding: 15px 19px 17px; border: 1px solid #c7c8ce1c; color: #e0dfdd; font-size: 14px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; animation: arrive .24s ease-out; }
.bubble.assistant { align-self: flex-start; border-radius: 3px 14px 14px 14px; background: #1b1c1eaa; }
.bubble.user { align-self: flex-end; border-color: #c7c8ce2b; border-radius: 14px 3px 14px 14px; background: #303134a8; }
.speaker { display: block; margin-bottom: 7px; color: #b5b4b2; font-size: 10px; font-weight: 500; line-height: 1.5; letter-spacing: .025em; white-space: normal; }
.bubble.user .speaker { color: #c6c6c5; }
.working { display: flex; flex-shrink: 0; align-items: center; gap: 12px; padding: 10px max(36px, calc((100% - 820px) / 2)); color: #b8b8bb; font-size: 11px; }
.thinking { display: inline-flex; gap: 5px; }
.thinking i { display: block; width: 4px; height: 4px; border-radius: 50%; background: #d0d0d3; animation: pulse 1.4s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: .17s; }
.thinking i:nth-child(3) { animation-delay: .34s; }
.notice { flex-shrink: 0; margin: 10px 32px; padding: 12px 16px; border: 1px solid #b5a1834d; border-radius: 5px; color: #d2c7b7; background: #302b2455; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.notice button { padding: 6px 9px; margin: 5px 0 0 10px; border-color: #d1d0ce40; font-size: 11px; background: #d7d2c9; }
.composer { flex-shrink: 0; align-self: center; width: 100%; max-width: 940px; padding: 16px 32px 4px; }
.compose-box { display: flex; align-items: flex-end; gap: 12px; padding: 11px; border: 1px solid #d1d0ce38; border-radius: 10px; background: #202123c9; box-shadow: inset 0 1px 0 #ffffff04, 0 8px 35px #0002; transition: border-color .2s ease, box-shadow .2s ease; }
.model-controls { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:7px 14px; margin-bottom:12px; color:var(--muted); font-size:11px; }
.model-choice { display:flex; min-width:0; gap:7px; }
.model-choice select { width:100%; min-width:0; min-height:36px; padding:7px 10px; border:1px solid #d1d0ce38; border-radius:5px; color:var(--paper); background:#202123; font-size:11px; text-overflow:ellipsis; }
.model-choice select:focus-visible { outline:2px solid var(--paper); outline-offset:3px; }
.model-choice button { padding:5px 10px; min-width:36px; color:var(--paper); background:#28292d; border-color:#d1d0ce38; font-size:17px; }
.model-controls small { grid-column:1/-1; font-size:10px; line-height:1.5; color:var(--subtle); }
.compose-box:focus-within { border-color: #d1d0ce75; box-shadow: 0 0 0 3px #d1d0ce08, 0 8px 35px #0002; }
textarea { flex: 1; min-width: 0; min-height: 52px; max-height: min(200px, 25dvh); resize: vertical; padding: 6px 8px; border: 0; border-radius: 3px; color: var(--paper); background: transparent; font-size: 14px; line-height: 1.65; }
textarea::placeholder { color: #929294; }
textarea:focus-visible { outline-offset: 1px; outline: 1px solid #d1d0ce60; }
#send { flex-shrink: 0; display: flex; align-items: center; gap: 12px; min-height: 41px; padding: 10px 14px; white-space: nowrap; font-size: 12px; }
#send span { font-size: 17px; }
.compose-note { display: flex; justify-content: space-between; gap: 15px; padding: 10px 4px; color: var(--subtle); font-size: 10px; line-height: 1.5; }
#counter { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.conversation footer { flex-shrink: 0; padding: 8px 28px 17px; color: #8e8f92; font-size: 10px; line-height: 1.6; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes pulse { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes haze-drift { from { transform: translateX(-2%); opacity: .45; } to { transform: translateX(2%); opacity: .85; } }

@media (max-width: 1000px) and (min-width: 761px) {
  .shell { grid-template-columns: 235px minmax(0, 1fr); }
  .sidebar { padding-left: 19px; padding-right: 19px; }
  .abyss { left: calc(50% + 117px); width: 75vw; }
  .topbar { padding-left: 27px; padding-right: 27px; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  .sidebar { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 17px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { gap: 9px; font-size: 19px; }
  .brand small { display: none; }
  .nebula-mark { width: 30px; height: 30px; }
  .nebula-mark span { width: 10px; height: 10px; }
  .new-chat { margin-left: auto; min-height: 37px; padding: 9px 11px; font-size: 11px; }
  .sidebar-bottom { display: contents; }
  .environment-label { display: none; }
  .quiet { min-height: 37px; margin: 0; padding: 8px; font-size: 11px; }
  #chat-list { order: 5; flex: 1 0 100%; flex-direction: row; max-height: 44px; margin: 1px 0 0; gap: 6px; overflow-x: auto; overflow-y: hidden; }
  #chat-list:empty { display: none; }
  #chat-list button { max-width: min(200px, 65vw); padding: 10px 12px; font-size: 11px; }
  .conversation { height: 100%; }
  .topbar { min-height: 76px; padding: 17px 21px; gap: 12px; }
  .topbar h1 { font-size: 17px; }
  .topbar p { font-size: 10px; }
  .badge { padding: 6px 9px; font-size: 9px; }
  .abyss { width: 135vw; left: 50%; top: 45%; }
  .login-card { width: calc(100% - 42px); max-width: 500px; padding: 28px 0; }
  .access-mark { width: 57px; height: 57px; margin-bottom: 23px; }
  .access-mark span { width: 23px; height: 23px; }
  .login-card h2 { font-size: 35px; }
  .login-card label { margin-top: 25px; }
  .login-card small { font-size: 10px; }
  .messages { gap: 19px; padding: 24px 17px; }
  .welcome { font-size: 13px; }
  .welcome h2 { font-size: 26px; }
  .bubble { max-width: 94%; padding: 13px 16px 15px; font-size: 13px; }
  .working { padding: 9px 21px; font-size: 10px; }
  .notice { margin: 8px 17px; padding: 11px 13px; font-size: 11px; }
  .composer { padding: 12px 15px 2px; }
  .model-controls { grid-template-columns:minmax(0,1fr); gap:6px; margin-bottom:9px; font-size:10px; }
  .model-controls small { font-size:9px; }
  .compose-box { gap: 7px; padding: 8px; border-radius: 8px; }
  textarea { min-height: 50px; padding: 5px; font-size: 13px; }
  #send { min-height: 38px; padding: 9px 11px; gap: 7px; font-size: 11px; }
  .compose-note { gap: 10px; padding: 9px 2px; font-size: 9px; }
  .conversation footer { padding: 6px 20px max(12px, env(safe-area-inset-bottom)); font-size: 9px; }
}

@media (max-width: 390px) {
  .sidebar { padding-left: 13px; padding-right: 13px; gap: 7px; }
  .brand { font-size: 17px; gap: 7px; }
  .nebula-mark { width: 27px; height: 27px; }
  .new-chat { padding: 9px; font-size: 10px; }
  .quiet { padding-left: 5px; padding-right: 5px; font-size: 10px; }
  .login-row { flex-direction: column; }
  #login-submit { min-height: 44px; }
}

@media (max-height: 650px) and (min-width: 761px) {
  .topbar { min-height: 82px; padding-top: 18px; padding-bottom: 18px; }
  .login-card { padding-top: 22px; padding-bottom: 22px; }
  .access-mark { width: 51px; height: 51px; margin-bottom: 17px; }
  .login-card h2 { font-size: 33px; }
  .login-card label { margin-top: 21px; }
  .conversation footer { padding-bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.account-entry { display: inline-flex; align-items:center; gap:18px; padding:14px 19px; margin-top:18px; border:1px solid #55575d; border-radius:7px; color:#e9e8e4; text-decoration:none; background:#282a2e; min-height:44px; }
.account-entry:hover { background:#35373c; }
.account-link { color:#b6b6bd; font-size:12px; text-decoration:none; padding:9px 0; }
.account-link:hover { color:#fff; text-decoration:underline; }
.account-entry:focus-visible,.account-link:focus-visible { outline:2px solid #dadbe0; outline-offset:4px; }
