:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --sidebar: #101216;
  --panel: #0d0f12;
  --panel-2: #15181d;
  --panel-3: #1a1e24;
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.13);
  --text: #f2f3f5;
  --muted: #9ca3af;
  --muted-2: #6f7784;
  --accent: #d9ff61;
  --accent-soft: rgba(217,255,97,.12);
  --shadow: 0 18px 60px rgba(0,0,0,.32);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, textarea { font: inherit; }
button { color: inherit; }

.app-shell { display: flex; width: 100%; height: 100dvh; background: var(--bg); }
.sidebar { width: 272px; flex: 0 0 272px; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--line); padding: 14px 12px 12px; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 16px; }
.brand { border: 0; background: transparent; display: flex; align-items: center; gap: 10px; padding: 4px; cursor: pointer; }
.brand-mark, .model-orb { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, #efffa4, #a5d63b); color: #111; font-weight: 900; box-shadow: 0 0 22px rgba(217,255,97,.18); }
.brand-name { font-weight: 700; letter-spacing: -.02em; }
.icon-button { border: 1px solid transparent; background: transparent; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; color: var(--muted); transition: .18s ease; }
.icon-button:hover { color: var(--text); background: var(--panel-3); border-color: var(--line); }
.mobile-only { display: none; }
.new-chat { width: 100%; border: 1px solid var(--line-strong); background: linear-gradient(180deg, #1a1e23, #15181d); border-radius: 12px; padding: 11px 13px; display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 650; box-shadow: 0 6px 20px rgba(0,0,0,.14); }
.new-chat:hover { background: #20242a; border-color: rgba(255,255,255,.18); }
.sidebar-section { margin-top: 22px; }
.section-label { color: var(--muted-2); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; padding: 0 10px 8px; }
.side-item { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; border-radius: 9px; padding: 9px 10px; color: var(--muted); text-align: left; cursor: pointer; }
.side-item:hover, .side-item.active { color: var(--text); background: rgba(255,255,255,.055); }
.side-item.active { box-shadow: inset 2px 0 var(--accent); }
.side-icon { width: 18px; text-align: center; color: #b8c0ca; }
.conversations { flex: 1; min-height: 0; overflow: hidden; }
.conversation-list { display: flex; flex-direction: column; gap: 2px; overflow: auto; max-height: 100%; }
.conversation-item { border: 0; background: transparent; color: var(--muted); padding: 9px 10px; border-radius: 9px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.conversation-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
.sidebar-bottom { border-top: 1px solid var(--line); padding-top: 12px; }
.status-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8bd22e; box-shadow: 0 0 12px rgba(139,210,46,.45); }
.status-card strong, .profile-copy strong { display: block; font-size: 13px; }
.status-card small, .profile-copy small { display: block; margin-top: 2px; color: var(--muted-2); font-size: 11px; }
.profile-button { width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; text-align: left; }
.profile-button:hover { background: rgba(255,255,255,.05); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #242931; color: #dce1e7; font-size: 12px; font-weight: 700; }
.profile-copy { flex: 1; }
.chevron { color: var(--muted-2); }

.main-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; background: radial-gradient(circle at 50% -10%, rgba(217,255,97,.035), transparent 34%), var(--panel); }
.topbar { height: 64px; flex: 0 0 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(13,15,18,.78); backdrop-filter: blur(18px); position: relative; z-index: 5; }
.model-picker { position: relative; }
.model-button { border: 0; background: transparent; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: pointer; text-align: left; }
.model-button:hover { background: rgba(255,255,255,.05); }
.model-orb { width: 27px; height: 27px; border-radius: 8px; font-size: 13px; }
.model-button strong, .model-option strong { display: block; font-size: 14px; }
.model-button small, .model-option small { display: block; color: var(--muted-2); font-size: 11px; margin-top: 2px; }
.model-menu { display: none; position: absolute; top: calc(100% + 8px); left: 0; width: 320px; padding: 8px; border: 1px solid var(--line-strong); background: #15181d; border-radius: 14px; box-shadow: var(--shadow); }
.model-picker.open .model-menu { display: block; }
.model-option { width: 100%; border: 0; background: transparent; border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 28px 1fr 20px; gap: 10px; text-align: left; cursor: pointer; }
.model-option:hover, .model-option.selected { background: rgba(255,255,255,.055); }
.menu-note { color: var(--muted-2); font-size: 11px; line-height: 1.5; padding: 8px 10px 4px; }
.topbar-actions { display: flex; gap: 4px; }

.chat-scroll { flex: 1; overflow: auto; scroll-behavior: smooth; }
.chat-content { width: min(920px, calc(100% - 36px)); min-height: 100%; margin: 0 auto; padding: 54px 0 180px; }
.welcome { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 0 70px; text-align: center; }
.welcome-orb { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, #f0ffa5, #8dbd34); color: #111; font-size: 25px; font-weight: 900; box-shadow: 0 0 60px rgba(217,255,97,.12); margin-bottom: 20px; }
.welcome h1 { margin: 0; font-size: clamp(30px, 4vw, 43px); letter-spacing: -.045em; line-height: 1.05; }
.welcome h1 span { color: #e8eea9; }
.welcome p { max-width: 610px; color: var(--muted); line-height: 1.65; margin: 15px 0 30px; font-size: 14px; }
.prompt-grid { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.prompt-card { display: grid; grid-template-columns: 32px 1fr 20px; gap: 10px; align-items: center; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 14px; padding: 14px; text-align: left; cursor: pointer; transition: .18s ease; }
.prompt-card:hover { background: rgba(255,255,255,.05); border-color: var(--line-strong); transform: translateY(-1px); }
.prompt-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-soft); color: #dffb8c; }
.prompt-card strong { display: block; font-size: 13px; }
.prompt-card small { display: block; color: var(--muted-2); margin-top: 4px; font-size: 11px; }
.prompt-arrow { color: var(--muted-2); }
.messages { display: flex; flex-direction: column; gap: 28px; }
.message-row { display: flex; gap: 13px; align-items: flex-start; animation: appear .2s ease; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.message-row.user { justify-content: flex-end; }
.message-avatar { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.message-row.assistant .message-avatar { background: linear-gradient(135deg, #efffa4, #a5d63b); color: #111; }
.message-row.user .message-avatar { background: #252a31; color: #dfe3e8; order: 2; border-radius: 50%; }
.message-body { max-width: min(760px, 82%); min-width: 0; }
.message-row.user .message-body { background: #20242a; border: 1px solid rgba(255,255,255,.06); padding: 11px 14px; border-radius: 17px 17px 5px 17px; }
.message-row.assistant .message-body { padding-top: 3px; }
.message-meta { display: flex; gap: 8px; align-items: center; color: var(--muted-2); font-size: 11px; margin-bottom: 5px; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.72; font-size: 14px; color: #e7e9ec; }
.message-row.user .message-text { color: #f0f1f3; line-height: 1.55; }
.message-tools { display: flex; gap: 3px; margin-top: 8px; opacity: .7; }
.message-tool { border: 0; background: transparent; color: var(--muted-2); cursor: pointer; padding: 4px 7px; border-radius: 7px; font-size: 11px; }
.message-tool:hover { background: rgba(255,255,255,.05); color: var(--text); }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: #9ba2ad; animation: blink 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .12s; }.typing i:nth-child(3) { animation-delay: .24s; }
@keyframes blink { 0%,80%,100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

.composer-wrap { position: relative; width: min(920px, calc(100% - 36px)); margin: 0 auto; padding-bottom: 15px; }
.composer-shell { border: 1px solid var(--line-strong); background: #171a1f; border-radius: 19px; box-shadow: 0 14px 50px rgba(0,0,0,.28); transition: border-color .18s ease, box-shadow .18s ease; }
.composer-shell:focus-within { border-color: rgba(217,255,97,.24); box-shadow: 0 16px 55px rgba(0,0,0,.35), 0 0 0 3px rgba(217,255,97,.035); }
#messageInput { display: block; width: 100%; min-height: 54px; max-height: 190px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); padding: 17px 18px 6px; line-height: 1.5; }
#messageInput::placeholder { color: #747c87; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 5px 8px 8px 10px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 3px; }
.tool-button { width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); border-radius: 9px; cursor: pointer; }
.tool-button:hover:not(:disabled) { background: rgba(255,255,255,.06); color: var(--text); }
.tool-button:disabled { opacity: .28; cursor: not-allowed; }
.composer-hint { color: #626a75; font-size: 10px; margin-right: 6px; }
.send-button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #e9ecf0; color: #111; font-size: 19px; font-weight: 800; cursor: pointer; transition: .18s ease; }
.send-button:disabled { opacity: .25; cursor: not-allowed; }
.send-button:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(255,255,255,.12); }
.attachment-preview { display: none; gap: 8px; padding: 10px 12px 0; }
.attachment { position: relative; width: 72px; height: 72px; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: #101216; }
.attachment img { width: 100%; height: 100%; object-fit: cover; }
.attachment button { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(0,0,0,.72); color: white; cursor: pointer; }
.footer-note { text-align: center; color: #565d67; font-size: 10px; padding: 9px 0 0; }

.sidebar-backdrop { display: none; }
@media (max-width: 800px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; transform: translateX(-101%); transition: transform .22s ease; box-shadow: 20px 0 70px rgba(0,0,0,.45); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
  .sidebar.open + .sidebar-backdrop { display: block; }
  .mobile-only { display: block; }
  .topbar { padding: 0 10px; }
  .chat-content, .composer-wrap { width: min(100% - 20px, 920px); }
  .chat-content { padding-top: 28px; }
  .welcome { padding-bottom: 35px; }
  .prompt-grid { grid-template-columns: 1fr; }
  .composer-hint { display: none; }
  .message-body { max-width: 88%; }
}
@media (max-width: 480px) {
  .model-button small { display: none; }
  .topbar-actions .icon-button:first-child { display: none; }
  .welcome h1 { font-size: 30px; }
  .welcome p { font-size: 13px; }
}
