:root {
  --bg: #0d0d0d;
  --bg-elevated: #171717;
  --bg-input: #2a2a2a;
  --border: #2e2e2e;
  --text: #ececec;
  --text-secondary: #8e8e8e;
  --user-msg-bg: #2a2a2a;
  --accent: #10a37f;
  --accent-hover: #0d8c6d;
  --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar – ChatGPT-style */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
}

.sidebar-brand {
  padding: 1rem 1rem 0.75rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.brand-name {
  display: block;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-ultra {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 0.15rem;
}

.new-chat {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.new-chat:hover {
  background: var(--bg-input);
}

.new-chat-icon {
  font-size: 1.1rem;
  opacity: 0.9;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.5rem 0;
}

.about-toggle {
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.about-toggle:hover {
  color: var(--text);
  background: var(--bg-input);
}

/* Main area – header and input stay fixed, only messages scroll */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-width: 768px;
  margin: 0 auto;
  width: 100%;
}

.main-header {
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.stats-bar {
  display: flex;
  gap: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.stats-bar .stat strong {
  color: var(--accent);
  font-weight: 500;
}

.stats-bar .stat-model {
  margin-right: 0.5rem;
  padding-right: 1rem;
  border-right: 1px solid var(--border);
}

.stats-bar #modelName {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--accent);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 1rem;
  overflow: hidden;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 0 1.5rem;
}

.messages::-webkit-scrollbar {
  width: 8px;
}
.messages::-webkit-scrollbar-track {
  background: var(--bg);
}
.messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.message {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.message:last-child {
  border-bottom: none;
}

.message-user {
  flex-direction: row-reverse;
}

.message-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}

.message-user .message-avatar {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.message-content {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  line-height: 1.7;
}

.message-user .message-content {
  background: var(--user-msg-bg);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-left: 0;
  margin-right: 2.5rem;
}

.message-assistant .message-content {
  margin-right: 0;
  margin-left: 2.5rem;
}

.welcome-msg .message-content {
  margin-left: 2.5rem;
}

.welcome-text {
  margin: 0;
  color: var(--text-secondary);
  font-style: italic;
}

.message-content .nonsense-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-content .summary-block {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.message-content .summary-block strong {
  color: var(--accent);
}

.message-content .summary-block .prompt-again {
  margin-top: 0.75rem;
  color: var(--text);
  font-weight: 500;
}

/* Input – ChatGPT-style bar at bottom, always visible */
.input-wrap {
  flex-shrink: 0;
  padding: 1rem 0 1.5rem;
}

.input-box {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
}

.input-box textarea {
  flex: 1;
  min-height: 24px;
  max-height: 200px;
  padding: 0.25rem 0;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  resize: none;
  outline: none;
}

.input-box textarea::placeholder {
  color: var(--text-secondary);
}

.send-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.send-btn:hover {
  background: var(--accent-hover);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* About overlay */
.about-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.about-overlay.visible {
  display: flex;
}

.about-inner {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  max-width: 420px;
}

.about-inner h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.about-inner p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.about-inner p:last-of-type {
  margin-bottom: 1rem;
}

.about-inner strong {
  color: var(--text);
}

.about-close {
  padding: 0.5rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.about-close:hover {
  background: var(--border);
}
