:root {
  --ink-950: #0b0d12;
  --ink-900: #12141c;
  --ink-800: #1a1d28;
  --ink-700: #242836;
  --ink-600: #333849;
  --ink-500: #4a5066;

  --parchment: #e9e7e1;
  --parchment-dim: #a9a9ac;
  --parchment-faint: #74767f;

  --signal: #5eead4;
  --signal-dim: #3fae9c;
  --ember: #e8956a;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

.brand-logo,
.hero-logo,
.loading-mark,
.typing-logo {
  color: var(--signal);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--ink-950);
  color: var(--parchment);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button, select, textarea, input {
  font-family: inherit;
  color: inherit;
}

::selection {
  background: var(--signal-dim);
  color: var(--ink-950);
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--ink-950);
  transition: opacity .5s ease;
}

.loading-screen.hide {
  opacity: 0;
  pointer-events: none;
}

.loading-mark {
  width: 96px;
  height: 96px;
  animation: mark-breathe 2s ease-in-out 2.2s infinite alternate;
}

@keyframes mark-breathe {
  from { transform: scale(1); }
  to { transform: scale(1.035); }
}

.loading-node {
  opacity: 0;
  animation: node-in 0.7s cubic-bezier(.2,.8,.2,1) forwards;
}

.node-a { animation-delay: 0s; transform: translate(0, -38px) scale(0.4); }
.node-b { animation-delay: .08s; transform: translate(34px, 16px) scale(0.4); }
.node-c { animation-delay: .16s; transform: translate(-34px, 16px) scale(0.4); }

@keyframes node-in {
  0% { opacity: 0; }
  100% { opacity: 1; transform: translate(0, 0) scale(1); }
}

.prism-edge,
.prism-line {
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  opacity: 0;
  animation: line-draw 0.7s ease forwards;
  animation-delay: .75s;
}

.prism-line:nth-of-type(3) { animation-delay: .85s; }
.prism-line:nth-of-type(4) { animation-delay: .95s; }

@keyframes line-draw {
  0% { stroke-dashoffset: 260; opacity: 0; }
  15% { opacity: 0.55; }
  100% { stroke-dashoffset: 0; opacity: 0.55; }
}

.prism-edge {
  animation-name: edge-draw;
}

@keyframes edge-draw {
  0% { stroke-dashoffset: 260; opacity: 0; }
  15% { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

.pulse-ring {
  opacity: 0;
  animation: pulse-emit 0.9s ease-out forwards;
  animation-delay: 1.5s;
}

@keyframes pulse-emit {
  0% { r: 0; opacity: 0.7; }
  100% { r: 46; opacity: 0; }
}

.loading-text {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--parchment-faint);
}

.loading-dots span {
  opacity: 0.2;
  animation: dot-blink 1.2s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes dot-blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .loading-mark { animation: none; }
  .loading-node { animation: none; opacity: 1; transform: none; }
  .prism-edge, .prism-line { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .pulse-ring { animation: none; opacity: 0; }
  .loading-dots span { animation: none; opacity: 1; }
}

.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--ink-900);
  border-right: 1px solid var(--ink-700);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 8px;
}

.brand-logo {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--parchment);
}

.btn-new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  color: var(--parchment);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.btn-new-chat:hover {
  border-color: var(--signal-dim);
  background: var(--ink-700);
}

.plus {
  color: var(--signal);
  font-weight: 600;
}

.history {
  flex: 1;
  margin-top: 18px;
  overflow-y: auto;
}

.history-empty {
  font-size: 12.5px;
  color: var(--parchment-faint);
  padding: 8px 6px;
  line-height: 1.5;
}

.history-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--parchment-dim);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item:hover,
.history-item.active {
  background: var(--ink-800);
  color: var(--parchment);
}

.sidebar-bottom {
  border-top: 1px solid var(--ink-700);
  padding-top: 12px;
}

.model-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.model-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--parchment-faint);
  padding-left: 2px;
}

#modelSelect {
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--ink-800);
  flex-shrink: 0;
}

.icon-btn {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--parchment-dim);
}

.topbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--parchment-dim);
  flex: 1;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--parchment-faint);
  border: 1px solid var(--ink-700);
  padding: 4px 10px;
  border-radius: 999px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.15);
}

.status-pill.thinking .status-dot {
  background: var(--ember);
  box-shadow: 0 0 0 3px rgba(232, 149, 106, 0.18);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.chat {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.empty-state {
  margin: auto;
  text-align: center;
  max-width: 480px;
  padding: 40px 20px;
}

.hero-logo {
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
}

.logo-mark polygon,
.logo-mark line {
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  animation: draw-in 1s ease forwards;
}

.logo-mark polygon { animation-delay: 0s; }
.logo-mark line:nth-of-type(2) { animation-delay: .35s; }
.logo-mark line:nth-of-type(3) { animation-delay: .5s; }
.logo-mark line:nth-of-type(4) { animation-delay: .65s; }

@keyframes draw-in {
  to { stroke-dashoffset: 0; }
}

.logo-mark {
  transform-origin: 50% 50%;
}

.typing-logo {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  animation: spin 1.1s linear infinite;
  transform-origin: 50% 50%;
}

.typing-logo polygon,
.typing-logo line {
  animation: none;
  stroke-dashoffset: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .logo-mark polygon,
  .logo-mark line {
    animation: none;
    stroke-dashoffset: 0;
  }
  .typing-logo {
    animation: none;
  }
}

.empty-state h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--parchment);
}

.empty-state p {
  color: var(--parchment-faint);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 22px;
}

.suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-chip {
  background: var(--ink-900);
  border: 1px solid var(--ink-700);
  color: var(--parchment-dim);
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}

.suggestion-chip:hover {
  border-color: var(--signal-dim);
  color: var(--parchment);
}

.messages {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
}

.msg-role {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--parchment-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg.user {
  align-items: flex-end;
}

.msg.user .msg-role { color: var(--signal-dim); }

.msg.user .msg-bubble {
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
  padding: 12px 16px;
  max-width: 72%;
  font-size: 14.5px;
  line-height: 1.6;
}

.msg.assistant .msg-bubble {
  border-left: 2px solid var(--signal);
  padding: 2px 0 2px 16px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--parchment);
}

.msg.assistant .msg-bubble p { margin: 0 0 12px; }
.msg.assistant .msg-bubble p:last-child { margin-bottom: 0; }

.msg.assistant .msg-bubble h1,
.msg.assistant .msg-bubble h2,
.msg.assistant .msg-bubble h3 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--parchment);
  margin: 20px 0 10px;
  line-height: 1.3;
}
.msg.assistant .msg-bubble h1:first-child,
.msg.assistant .msg-bubble h2:first-child,
.msg.assistant .msg-bubble h3:first-child { margin-top: 0; }
.msg.assistant .msg-bubble h1 { font-size: 19px; }
.msg.assistant .msg-bubble h2 { font-size: 17px; }
.msg.assistant .msg-bubble h3 { font-size: 15px; }

.msg.assistant .msg-bubble ul,
.msg.assistant .msg-bubble ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.msg.assistant .msg-bubble li { margin-bottom: 4px; }
.msg.assistant .msg-bubble li::marker { color: var(--signal-dim); }

.msg.assistant .msg-bubble blockquote {
  margin: 0 0 12px;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--ink-600);
  color: var(--parchment-dim);
  font-style: italic;
}

.msg.assistant .msg-bubble a {
  color: var(--signal);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg.assistant .msg-bubble hr {
  border: none;
  border-top: 1px solid var(--ink-700);
  margin: 16px 0;
}

.msg.assistant .msg-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 13.5px;
}
.msg.assistant .msg-bubble th,
.msg.assistant .msg-bubble td {
  border: 1px solid var(--ink-700);
  padding: 7px 10px;
  text-align: left;
}
.msg.assistant .msg-bubble th {
  background: var(--ink-800);
  font-weight: 600;
  color: var(--parchment);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.msg.assistant .msg-bubble tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.015);
}

.msg.assistant .msg-bubble code {
  font-family: var(--font-mono);
  background: var(--ink-800);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}

.msg.assistant .msg-bubble pre {
  position: relative;
  background: var(--ink-900);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 0 0 14px;
  overflow-x: auto;
}

.msg.assistant .msg-bubble pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.55;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  color: var(--parchment-dim);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s ease, border-color .12s ease, color .12s ease;
}

.msg.assistant .msg-bubble pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  border-color: var(--signal-dim);
  color: var(--parchment);
}

.msg.error .msg-bubble {
  border-left-color: #e8746a;
  color: #e8a49e;
}

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--signal);
  animation: blink 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: .15s; }
.typing-indicator span:nth-child(3) { animation-delay: .3s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

.composer {
  flex-shrink: 0;
  padding: 12px 22px 18px;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--ink-900);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-lg);
  padding: 10px 10px 10px 16px;
  transition: border-color .15s ease;
}

.composer-box:focus-within {
  border-color: var(--signal-dim);
}

.composer-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-size: 14.5px;
  line-height: 1.5;
  max-height: 200px;
  padding: 6px 0;
}

.composer-input::placeholder {
  color: var(--parchment-faint);
}

.send-btn {
  background: var(--signal);
  color: var(--ink-950);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .12s ease, background .15s ease;
}

.send-btn:hover { background: var(--signal-dim); }
.send-btn:active { transform: scale(0.92); }

.send-btn:disabled {
  background: var(--ink-700);
  color: var(--parchment-faint);
  cursor: not-allowed;
}

.composer-hint {
  text-align: center;
  font-size: 11px;
  color: var(--parchment-faint);
  margin: 10px 0 0;
}

.chat::-webkit-scrollbar, .history::-webkit-scrollbar { width: 8px; }
.chat::-webkit-scrollbar-thumb, .history::-webkit-scrollbar-thumb {
  background: var(--ink-700);
  border-radius: 999px;
}

a:focus-visible, button:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.img-gen-card {
  border: 1px solid var(--ink-600);
  background: var(--ink-900);
  border-radius: var(--radius-lg);
  padding: 22px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.img-gen-stage {
  width: 140px;
  height: 140px;
}

.img-gen-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--parchment-faint);
  letter-spacing: 0.03em;
  text-align: center;
}

.prism-build-frame {
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  animation: prism-frame-draw 2.4s ease-in-out infinite;
}
.prism-build-frame.line-2 { animation-delay: 0.15s; }
.prism-build-frame.line-3 { animation-delay: 0.3s; }

@keyframes prism-frame-draw {
  0%   { stroke-dashoffset: 140; opacity: 0.2; }
  25%  { stroke-dashoffset: 0;   opacity: 1; }
  70%  { stroke-dashoffset: 0;   opacity: 1; }
  100% { stroke-dashoffset: -140; opacity: 0.2; }
}

.prism-particle {
  opacity: 0;
  animation: particle-pulse 2.4s ease-in-out infinite;
}
@keyframes particle-pulse {
  0%, 30%  { opacity: 0; transform: scale(0.4); }
  50%      { opacity: 1; transform: scale(1); }
  75%, 100%{ opacity: 0; transform: scale(0.4); }
}

.prism-particle:nth-child(1) { animation-delay: 0s;    transform-origin: 60px 55px; }
.prism-particle:nth-child(2) { animation-delay: 0.25s; transform-origin: 45px 68px; }
.prism-particle:nth-child(3) { animation-delay: 0.5s;  transform-origin: 75px 68px; }
.prism-particle:nth-child(4) { animation-delay: 0.75s; transform-origin: 60px 40px; }
.prism-particle:nth-child(5) { animation-delay: 1s;    transform-origin: 50px 50px; }
.prism-particle:nth-child(6) { animation-delay: 1.25s; transform-origin: 70px 60px; }

.img-gen-result {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-700);
  display: block;
}

.img-gen-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  color: var(--parchment);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}

.img-gen-download:hover {
  border-color: var(--signal-dim);
  background: var(--ink-700);
}

.beta-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ember);
  background: rgba(232, 149, 106, 0.12);
  border: 1px solid rgba(232, 149, 106, 0.35);
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 2px;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--ink-700);
}

.sidebar-link-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  color: var(--parchment-dim);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.sidebar-link-btn:hover {
  border-color: var(--signal-dim);
  color: var(--parchment);
  background: var(--ink-700);
}

.contributor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 60;
}

.contributor-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.contributor-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 300px;
  max-width: 85vw;
  background: var(--ink-900);
  border-left: 1px solid var(--ink-700);
  padding: 20px;
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 61;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contributor-drawer.open {
  transform: translateX(0);
}

.contributor-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.contributor-drawer-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0;
  color: var(--parchment);
}

.contributor-drawer-sub {
  font-size: 12.5px;
  color: var(--parchment-faint);
  line-height: 1.5;
  margin: 0;
}

.contributor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contributor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
}

.contributor-item:hover {
  background: var(--ink-800);
}

.contributor-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--signal-dim);
  color: var(--ink-950);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.contributor-name {
  font-size: 13.5px;
  color: var(--parchment);
}

.history-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-row .history-item {
  flex: 1;
}

.history-delete-btn {
  background: transparent;
  border: none;
  color: var(--parchment-faint);
  font-size: 13px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease, background .15s ease;
  flex-shrink: 0;
}

.history-row:hover .history-delete-btn {
  opacity: 1;
}

.history-delete-btn:hover {
  color: #e8746a;
  background: var(--ink-800);
}

.calert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  transition: opacity .15s ease;
}

.calert-overlay.open {
  opacity: 1;
}

.calert-box {
  background: var(--ink-900);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-lg);
  padding: 22px;
  max-width: 320px;
  width: 90%;
  transform: scale(0.95);
  transition: transform .15s ease;
}

.calert-overlay.open .calert-box {
  transform: scale(1);
}

.calert-message {
  color: var(--parchment);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 18px;
}

.calert-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.calert-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--ink-600);
}

.calert-btn-secondary {
  background: var(--ink-800);
  color: var(--parchment-dim);
}
.calert-btn-secondary:hover {
  border-color: var(--signal-dim);
}

.calert-btn-primary {
  background: #e8746a;
  color: var(--ink-950);
  border-color: #e8746a;
  font-weight: 600;
}
.calert-btn-primary:hover {
  background: #e8958c;
}

.hero-logo.idle-pulse {
  animation: hero-breathe 0.9s ease-in-out;
}

@keyframes hero-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.hero-logo.spin-once {
  animation: spin-360-once 0.8s ease-in-out;
}

@keyframes spin-360-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-logo.spin-once {
    animation: none;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 10px;
}

.topbar-btn {
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  color: var(--parchment-dim);
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.topbar-btn:hover {
  border-color: var(--signal-dim);
  color: var(--parchment);
  background: var(--ink-700);
}

.topbar-btn-highlight {
  background: rgba(94, 234, 212, 0.1);
  border-color: var(--signal-dim);
  color: var(--signal);
  font-weight: 600;
}

.topbar-btn-highlight:hover {
  background: rgba(94, 234, 212, 0.18);
}

.subscription-overlay {
  position: fixed;
  inset: 0;
  background: var(--ink-950);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  overflow-y: auto;
  padding: 40px 20px;
}

.subscription-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.subscription-modal {
  position: relative;
  max-width: 720px;
  width: 100%;
  margin: auto;
}

.subscription-close {
  position: absolute;
  top: -8px;
  right: 0;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  color: var(--parchment-dim);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  transition: border-color .15s ease, color .15s ease;
}

.subscription-close:hover {
  border-color: var(--signal-dim);
  color: var(--parchment);
}

.subscription-head {
  text-align: center;
  margin-bottom: 32px;
  padding-top: 20px;
}

.subscription-head h2 {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--parchment);
  margin: 0 0 8px;
}

.subscription-head p {
  color: var(--parchment-faint);
  font-size: 14px;
  margin: 0;
}

.subscription-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.plan-card {
  position: relative;
  background: var(--ink-900);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
}

.plan-card-highlight {
  border-color: var(--signal-dim);
  background: linear-gradient(180deg, rgba(94,234,212,0.06), transparent 40%), var(--ink-900);
}

.plan-badge {
  position: absolute;
  top: -11px;
  left: 22px;
  background: var(--signal);
  color: var(--ink-950);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
}

.plan-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--parchment-dim);
  margin-bottom: 6px;
}

.plan-price {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--parchment);
  margin-bottom: 18px;
}

.plan-price span {
  font-size: 13px;
  font-weight: 500;
  color: var(--parchment-faint);
}

.plan-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.plan-benefits li {
  font-size: 13px;
  color: var(--parchment-dim);
  padding-left: 20px;
  position: relative;
  line-height: 1.5;
}

.plan-benefits li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--signal);
  font-weight: 700;
}

.plan-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--ink-600);
}

.plan-btn-secondary {
  background: var(--ink-800);
  color: var(--parchment-faint);
  cursor: not-allowed;
}

.plan-btn-primary {
  background: var(--signal);
  color: var(--ink-950);
  border-color: var(--signal);
}

.plan-btn-primary:hover {
  background: var(--signal-dim);
}

.subscription-note {
  text-align: center;
  font-size: 11.5px;
  color: var(--parchment-faint);
  margin-top: 20px;
}

.typing-cursor {
  display: inline-block;
  color: var(--signal);
  animation: cursor-blink 0.8s step-end infinite;
  margin-left: 2px;
}

#modelSelect option:disabled {
  color: var(--parchment-faint);
  font-style: italic;
}

.model-note {
  font-size: 11px;
  color: var(--parchment-faint);
  line-height: 1.5;
  margin: 6px 2px 0;
  min-height: 14px;
}

.mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.mode-row::-webkit-scrollbar {
  display: none;
}

.mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--ink-900);
  border: 1px solid var(--ink-600);
  color: var(--parchment-dim);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.mode-btn:hover:not(:disabled) {
  border-color: var(--signal-dim);
  color: var(--parchment);
}

.mode-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mode-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-600);
  transition: background .15s ease;
}

.mode-btn-vibe.active {
  border-color: #e8746a;
  color: #e8a49e;
  background: rgba(232, 116, 106, 0.1);
}
.mode-btn-vibe.active .mode-dot {
  background: #e8746a;
  box-shadow: 0 0 0 3px rgba(232, 116, 106, 0.2);
}

.mode-btn-planning.active {
  border-color: #6ee89a;
  color: #a8f0bf;
  background: rgba(110, 232, 154, 0.1);
}
.mode-btn-planning.active .mode-dot {
  background: #6ee89a;
  box-shadow: 0 0 0 3px rgba(110, 232, 154, 0.2);
}

.mode-btn-debug.active {
  border-color: #e8b45e;
  color: #f0cd8f;
  background: rgba(232, 180, 94, 0.1);
}
.mode-btn-debug.active .mode-dot {
  background: #e8b45e;
  box-shadow: 0 0 0 3px rgba(232, 180, 94, 0.2);
}

.mode-btn-explain.active {
  border-color: #6ea8e8;
  color: #a8c9f0;
  background: rgba(110, 168, 232, 0.1);
}
.mode-btn-explain.active .mode-dot {
  background: #6ea8e8;
  box-shadow: 0 0 0 3px rgba(110, 168, 232, 0.2);
}

.mode-btn-review.active {
  border-color: #b48ee8;
  color: #d3bcf0;
  background: rgba(180, 142, 232, 0.1);
}
.mode-btn-review.active .mode-dot {
  background: #b48ee8;
  box-shadow: 0 0 0 3px rgba(180, 142, 232, 0.2);
}

body.mode-vibe-active {
  --signal: #e8746a;
  --signal-dim: #d15c52;
}

body.mode-planning-active {
  --signal: #6ee89a;
  --signal-dim: #55c47e;
}

body.mode-debug-active {
  --signal: #e8b45e;
  --signal-dim: #d19a3f;
}
body.mode-explain-active {
  --signal: #6ea8e8;
  --signal-dim: #4f8ed1;
}
body.mode-review-active {
  --signal: #b48ee8;
  --signal-dim: #9a6fd1;
}

.active-mode-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  color: var(--parchment);
  font-size: 12px;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.active-mode-chip button {
  background: var(--ink-700);
  border: none;
  color: var(--parchment-dim);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, color .15s ease;
}

.active-mode-chip button:hover {
  background: var(--ink-600);
  color: var(--parchment);
}

.mode-btn-wrap {
  position: relative;
  flex-shrink: 0;
}

.mode-tooltip {
  position: fixed;
  width: 220px;
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 300;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

.mode-tooltip.show {
  opacity: 1;
}

.mode-btn-wrap:hover .mode-tooltip,
.mode-btn-wrap:focus-within .mode-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.mode-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--ink-600);
}

.mode-tooltip ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mode-tooltip li {
  font-size: 11.5px;
  color: var(--parchment-dim);
  line-height: 1.4;
  padding-left: 14px;
  position: relative;
}

.mode-tooltip li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--signal);
}

.float-pill {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  background: var(--ink-900);
  border: 1px solid var(--ink-600);
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}

.float-pill-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--parchment-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.float-pill-btn:hover {
  background: var(--ink-800);
  color: var(--signal);
}

.float-pill-divider {
  width: 20px;
  height: 1px;
  background: var(--ink-600);
  margin: 2px 0;
}

.quick-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 95;
}
.quick-panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.quick-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 320px;
  max-width: 88vw;
  background: var(--ink-900);
  border-left: 1px solid var(--ink-700);
  padding: 20px;
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 96;
  overflow-y: auto;
}
.quick-panel.open {
  transform: translateX(0);
}

.quick-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.quick-panel-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0;
  color: var(--parchment);
}

.quick-panel-section {
  margin-bottom: 20px;
}

.quick-panel-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--parchment-faint);
  margin: 0 0 8px 2px;
}

.quick-panel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s ease, background .15s ease;
}

.quick-panel-item:hover {
  border-color: var(--signal-dim);
  background: var(--ink-700);
}

.quick-panel-static {
  cursor: default;
}
.quick-panel-static:hover {
  border-color: var(--ink-700);
  background: var(--ink-800);
}

.quick-panel-icon {
  font-size: 16px;
  width: 26px;
  text-align: center;
  flex-shrink: 0;
}

.quick-panel-icon i,
.float-pill-btn i {
  font-size: 15px;
}

.quick-panel-item strong {
  display: block;
  font-size: 13px;
  color: var(--parchment);
  font-weight: 600;
}

.quick-panel-item small {
  display: block;
  font-size: 11px;
  color: var(--parchment-faint);
  margin-top: 2px;
}

.contribute-overlay {
  position: fixed;
  inset: 0;
  background: var(--ink-950);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  padding: 20px;
}
.contribute-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.contribute-modal {
  position: relative;
  background: var(--ink-900);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 420px;
  width: 100%;
}

.contribute-modal h2 {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--parchment);
  margin: 0 0 6px;
}
.contribute-modal p {
  font-size: 13px;
  color: var(--parchment-faint);
  margin: 0 0 18px;
}

.contribute-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contribute-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--parchment-dim);
}

.contribute-form input,
.contribute-form select,
.contribute-form textarea {
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13.5px;
  color: var(--parchment);
  resize: vertical;
}

.contribute-form input:focus,
.contribute-form select:focus,
.contribute-form textarea:focus {
  outline: none;
  border-color: var(--signal-dim);
}

body.focus-mode .sidebar {
  display: none;
}
body.focus-mode .app {
  grid-template-columns: 1fr;
}

body.theme-light {
  --ink-950: #f5f4f1;
  --ink-900: #ffffff;
  --ink-800: #eeece7;
  --ink-700: #ddd9d2;
  --ink-600: #c7c2b8;
  --ink-500: #a8a296;
  --parchment: #1a1a1a;
  --parchment-dim: #4a4a4a;
  --parchment-faint: #767066;
}

.msg.user .msg-bubble,
.msg.assistant .msg-bubble {
  font-size: calc(14.5px * var(--chat-font-scale, 1));
}

.usage-indicator {
  padding: 10px 2px 14px;
  margin-bottom: 4px;
}

.usage-bar-track {
  width: 100%;
  height: 5px;
  background: var(--ink-700);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.usage-bar-fill {
  height: 100%;
  background: var(--signal);
  border-radius: 999px;
  transition: width .3s ease, background .3s ease;
  width: 0%;
}

.usage-bar-fill.usage-warning {
  background: #e8b45e;
}

.usage-bar-fill.usage-full {
  background: #e8746a;
}

.usage-text {
  font-size: 11px;
  color: var(--parchment-faint);
  margin: 0;
}

.calert-limit-overlay {
  background: rgba(0,0,0,0.6);
}

.calert-limit-box {
  max-width: 340px;
  text-align: center;
  border-color: rgba(232, 180, 94, 0.4);
  background: linear-gradient(180deg, rgba(232,180,94,0.06), transparent 50%), var(--ink-900);
}

.calert-limit-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(232, 180, 94, 0.12);
  border: 1px solid rgba(232, 180, 94, 0.35);
  color: #e8b45e;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calert-limit-message {
  text-align: center;
  margin: 0 0 20px;
}

.calert-actions:has(.calert-limit-btn) {
  justify-content: center;
}

.calert-limit-btn {
  background: #e8b45e;
  color: var(--ink-950);
  border-color: #e8b45e;
  font-weight: 700;
  padding: 10px 28px;
}

.calert-limit-btn:hover {
  background: #f0c37a;
}

@media (max-width: 480px) {
  .float-pill {
    right: 10px;
  }
}

@media (max-width: 640px) {
  .mode-tooltip {
    display: none;
  }
}

@media (max-width: 480px) {
  .mode-btn {
    font-size: 11.5px;
    padding: 7px 8px;
  }
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .typing-cursor {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prism-build-frame, .prism-particle { animation: none; opacity: 1; stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .status-pill.thinking .status-dot,
  .typing-indicator span {
    animation: none;
  }
}