* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #1a1a1a;
  --sidebar: #111111;
  --surface: #222222;
  --border: #333333;
  --accent: #cc785c;
  --accent-light: #e8956d;
  --text: #ececec;
  --text-dim: #8a8a8a;
  --text-muted: #444444;
  --user-bg: #2a2a2a;
  --bot-bg: #1a1a1a;
  --radius: 12px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans Bengali', 'Sora', sans-serif;
  height: 100vh;
  height: 100dvh;
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: 260px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.brand-name {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.new-chat-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 8px;
  font-family: 'Noto Sans Bengali', sans-serif;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.new-chat-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
}

.sidebar-section {
  padding: 14px 16px 6px;
  font-size: 11px;
  font-family: 'Sora', sans-serif;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
}

.mode-list {
  padding: 0 8px;
  flex: 1;
  overflow-y: auto;
}

.mode-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  transition: all 0.15s;
  margin-bottom: 2px;
  font-family: 'Sora', sans-serif;
}

.mode-item:hover { background: var(--surface); color: var(--text); }
.mode-item.active { background: rgba(204,120,92,0.15); color: var(--accent-light); font-weight: 500; }
.mode-item .m-icon { font-size: 16px; }

.sidebar-footer {
  padding: 12px 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.user-card-photo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
  flex-shrink: 0;
  background: var(--border);
}

.user-card-info {
  flex: 1;
  overflow: hidden;
}

.user-card-name {
  font-size: 13px;
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-email {
  font-size: 10px;
  font-family: 'Sora', sans-serif;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-dim);
  font-size: 12px;
  font-family: 'Sora', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  background: #2a2a2a;
  border-color: #555;
  color: var(--text);
}

.action-btn.logout-btn:hover {
  background: rgba(255,80,80,0.1);
  border-color: rgba(255,80,80,0.35);
  color: #ff8888;
}

body.light {
  --bg: #f5f5f5;
  --sidebar: #ffffff;
  --surface: #eeeeee;
  --border: #dddddd;
  --text: #111111;
  --text-dim: #555555;
  --text-muted: #aaaaaa;
  --user-bg: #e8e8e8;
  --bot-bg: #f5f5f5;
}

.api-status-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.api-status-text {
  font-size: 12px;
  font-family: 'Sora', sans-serif;
}

.api-status-text.ok { color: #6bcf7f; }
.api-status-text.err { color: #ff6b6b; }

.api-status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: #6bcf7f;
  border-radius: 50%;
  margin-right: 6px;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%,100%{opacity:1} 50%{opacity:0.3}
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
}

.model-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: 'Sora', sans-serif;
  color: var(--text-dim);
  cursor: pointer;
  position: relative;
  user-select: none;
}

.model-badge:hover {
  border-color: var(--accent);
}

.model-dot {
  width: 6px; height: 6px;
  background: #6bcf7f;
  border-radius: 50%;
  animation: blink 2s infinite;
}

.model-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 240px;
  z-index: 50;
  overflow-y: auto;
  max-height: 360px;
}

.model-dropdown.show {
  display: block;
}

.model-option {
  padding: 10px 14px;
  font-size: 12px;
  font-family: 'Sora', sans-serif;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-option:hover {
  background: rgba(204,120,92,0.1);
  color: var(--text);
}

.model-option.active {
  color: var(--accent-light);
  background: rgba(204,120,92,0.08);
}

.model-option .check {
  margin-left: auto;
  color: var(--accent-light);
  font-size: 14px;
}

.intensity-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.int-label {
  font-size: 12px;
  font-family: 'Sora', sans-serif;
  color: var(--text-dim);
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px; height: 13px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.int-val {
  font-size: 12px;
  font-family: 'Sora', sans-serif;
  color: var(--accent);
  width: 18px;
}

.chat {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.chat::-webkit-scrollbar { width: 4px; }
.chat::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 40px 24px;
  text-align: center;
  animation: fadeUp 0.5s ease;
}

.w-icon {
  font-size: 56px;
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)}
}

.w-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-family: 'Sora', sans-serif;
}

.w-sub {
  font-size: 14px;
  color: var(--text-dim);
  max-width: 380px;
  line-height: 1.7;
  margin-bottom: 32px;
}

.w-credit {
  font-size: 13px;
  color: var(--text-dim);
  font-family: 'Noto Sans Bengali', sans-serif;
  text-align: center;
  max-width: 340px;
  line-height: 1.8;
  margin-top: 10px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(204,120,92,0.05);
}

.w-credit strong {
  color: var(--accent-light);
  font-weight: 600;
}

.suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 500px;
  width: 100%;
}

.sug-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  font-family: 'Noto Sans Bengali', sans-serif;
}

.sug-card:hover {
  border-color: var(--accent);
  background: rgba(204,120,92,0.08);
  transform: translateY(-2px);
}

.sug-icon { font-size: 22px; margin-bottom: 6px; }
.sug-text { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

.msg-group {
  padding: 0;
  animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
  from{opacity:0;transform:translateY(10px)}
  to{opacity:1;transform:translateY(0)}
}

.msg-row {
  display: flex;
  padding: 10px 24px;
  gap: 14px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}

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

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-avatar.bot-av {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
}

.msg-avatar.user-av {
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 14px;
}

.msg-content { flex: 1; max-width: calc(100% - 60px); }

.user-row .msg-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.msg-name {
  font-size: 12px;
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.user-row .msg-name { text-align: right; }

.msg-bubble {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.user-row .msg-bubble {
  background: var(--user-bg);
  border: 1px solid var(--border);
  border-radius: 16px 4px 16px 16px;
  padding: 12px 16px;
  display: inline-block;
  max-width: 100%;
}

.roast-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(204,120,92,0.12);
  border: 1px solid rgba(204,120,92,0.25);
  color: var(--accent-light);
  font-size: 10px;
  font-family: 'Sora', sans-serif;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.friendly-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(107,207,127,0.12);
  border: 1px solid rgba(107,207,127,0.25);
  color: #6bcf7f;
  font-size: 10px;
  font-family: 'Sora', sans-serif;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.typing-row {
  display: flex;
  padding: 10px 24px;
  gap: 14px;
  max-width: 820px;
  margin: 0 auto;
  animation: fadeUp 0.3s ease;
}

.typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 8px 0;
}

.td {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.5;
  animation: tdBounce 1.2s ease infinite;
}
.td:nth-child(2){animation-delay:.2s}
.td:nth-child(3){animation-delay:.4s}

@keyframes tdBounce {
  0%,60%,100%{transform:translateY(0);opacity:.5}
  30%{transform:translateY(-6px);opacity:1}
}

.msg-divider {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}

.msg-divider hr {
  border: none;
  border-top: 1px solid var(--border);
}

.input-area {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px 20px;
  background: var(--bg);
  flex-shrink: 0;
}

.input-box {
  max-width: 820px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 10px 16px;
  gap: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}

.input-box:focus-within {
  border-color: rgba(204,120,92,0.45);
  box-shadow: 0 2px 16px rgba(0,0,0,0.22), 0 0 0 3px rgba(204,120,92,0.07);
}

.inline-preview-area {
  padding: 4px 2px 2px;
}

.inline-thumb-card {
  display: inline-flex;
  align-items: center;
  position: relative;
  border-radius: 12px;
  overflow: visible;
  cursor: pointer;
}

.inline-thumb-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
}

.inline-file-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: default;
}

.inline-file-icon {
  width: 32px;
  height: 32px;
  background: rgba(204,120,92,0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
  flex-shrink: 0;
}

.inline-file-name {
  font-size: 12px;
  font-family: Sora, sans-serif;
  color: var(--text);
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: #555;
  border: 2px solid var(--bg);
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  z-index: 5;
  transition: background 0.15s;
}
.inline-remove-btn:hover { background: #e74c3c; }

textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Noto Sans Bengali', sans-serif;
  font-size: 15px;
  resize: none;
  min-height: 26px;
  max-height: 180px;
  line-height: 1.6;
  scrollbar-width: none;
  padding: 0;
}

textarea::placeholder { color: var(--text-muted); }
textarea::-webkit-scrollbar { display: none; }

.input-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-bottom-left {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.input-bottom-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.send-btn {
  width: 34px; height: 34px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.send-btn:hover { background: var(--accent-light); transform: scale(1.05); }
.send-btn:active { transform: scale(0.95); }
.send-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; background: var(--surface); }

.send-btn svg { width: 16px; height: 16px; fill: white; }

.mic-btn {
  width: 34px; height: 34px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  color: var(--text-dim);
}

.mic-btn:hover { color: var(--text); background: rgba(255,255,255,0.07); }
.mic-btn.listening {
  background: rgba(204,120,92,0.15);
  border-color: var(--accent);
  color: var(--accent-light);
  animation: micPulse 1s ease infinite;
}

@keyframes micPulse {
  0%,100%{ box-shadow: 0 0 0 0 rgba(204,120,92,0.4); }
  50%{ box-shadow: 0 0 0 6px rgba(204,120,92,0); }
}

.mic-btn svg { width: 16px; height: 16px; }

#ttsBtn.tts-off {
  color: #555 !important;
  opacity: 0.45;
}

.input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Sora', sans-serif;
  margin-top: 10px;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.no-key-warn {
  background: rgba(255,100,100,0.08);
  border: 1px solid rgba(255,100,100,0.2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: #ff8888;
  text-align: center;
  max-width: 820px;
  margin: 0 auto 10px;
}

.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #111;
  overflow: hidden;
}

.login-bg::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(204,120,92,0.18) 0%, transparent 70%);
  top: -150px;
  left: -150px;
  animation: orb1 8s ease-in-out infinite;
}

.login-bg::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(116,185,255,0.1) 0%, transparent 70%);
  bottom: -100px;
  right: -100px;
  animation: orb2 10s ease-in-out infinite;
}

@keyframes orb1 {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(80px,60px) scale(1.1); }
  66% { transform: translate(-40px,80px) scale(0.95); }
}

@keyframes orb2 {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(-60px,-50px) scale(1.1); }
  66% { transform: translate(40px,-80px) scale(0.9); }
}

.history-item {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-item:hover { background: var(--surface); }
.history-item.active { background: rgba(204,120,92,0.12); }

.history-del-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 5px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-left: auto;
}

.history-item:hover .history-del-btn { display: flex; }
.history-del-btn:hover { color: #ff8888; background: rgba(255,80,80,0.1); }

.history-list {
  padding: 0 8px;
  overflow-y: auto;
  max-height: 200px;
  flex-shrink: 0;
}

.history-list::-webkit-scrollbar { width: 3px; }
.history-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.history-del-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 5px;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-left: auto;
}

.history-item:hover .history-del-btn { display: flex; }
.history-del-btn:hover { color: #ff8888; background: rgba(255,80,80,0.1); }

.history-title {
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'Noto Sans Bengali', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.history-item.active .history-title { color: var(--accent-light); }

.msg-bubble h1,.msg-bubble h2,.msg-bubble h3 {
  font-family: 'Sora', sans-serif;
  color: var(--text);
  margin: 8px 0 4px;
  line-height: 1.3;
}
.msg-bubble h1 { font-size: 18px; }
.msg-bubble h2 { font-size: 16px; }
.msg-bubble h3 { font-size: 14px; color: var(--accent-light); }
.msg-bubble p { margin-bottom: 4px; line-height: 1.55; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { padding-left: 20px; margin: 4px 0; }
.msg-bubble li { margin-bottom: 2px; line-height: 1.5; }
.msg-bubble strong { color: var(--accent-light); font-weight: 600; }
.msg-bubble em { color: #aaa; font-style: italic; }
.msg-bubble a { color: #74b9ff; text-decoration: none; border-bottom: 1px solid rgba(116,185,255,0.3); }
.msg-bubble a:hover { border-color: #74b9ff; }
body.light .msg-bubble a { color: #0066cc; border-bottom-color: rgba(0,102,204,0.3); }
body.light .msg-bubble a:hover { border-color: #0066cc; }

body.light .nur-card-link { background: rgba(0,0,0,0.04) !important; border-color: rgba(0,0,0,0.1) !important; }
body.light .nur-card-link span[style*="color:#ececec"] { color: #222222 !important; }
.msg-bubble blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 14px;
  margin: 10px 0;
  background: rgba(204,120,92,0.06);
  border-radius: 0 8px 8px 0;
  color: var(--text-dim);
  font-style: italic;
}
.msg-bubble table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
.msg-bubble th { background: rgba(204,120,92,0.15); color: var(--accent-light); padding: 8px 12px; text-align: left; font-size: 12px; }
.msg-bubble td { padding: 7px 12px; border-top: 1px solid var(--border); color: var(--text-dim); }

.msg-bubble code:not(.hljs) {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  color: #e17055;
}
.code-block-wrap {
  position: relative;
  margin: 10px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #161b22;
  padding: 7px 14px;
  font-size: 11px;
  font-family: 'Sora', sans-serif;
  color: #888;
}

.code-toggle-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 11px;
  font-family: 'Sora', sans-serif;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
  text-align: left;
}
.code-toggle-btn:hover { color: var(--accent-light); }

.code-body {
  display: block;
  overflow: hidden;
}
.code-copy-btn {
  background: none;
  border: 1px solid #333;
  color: #888;
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  transition: all 0.2s;
}
.code-copy-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.code-copy-btn.copied { border-color: #6bcf7f; color: #6bcf7f; }
.msg-bubble pre { margin: 0; background: #0d1117 !important; }
.msg-bubble pre code.hljs { padding: 14px 16px; font-size: 13px; line-height: 1.6; background: #0d1117 !important; }

.msg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.msg-row:hover .msg-actions { opacity: 1; }
.msg-copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  font-family: 'Sora', sans-serif;
  transition: all 0.2s;
}
.msg-copy-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.msg-copy-btn.copied { border-color: #6bcf7f; color: #6bcf7f; }

.model-badge {
  font-size: 10px;
  font-family: 'Sora', sans-serif;
  color: #666;
  background: rgba(255,255,255,0.04);
  border: 1px solid #2e2e2e;
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.msg-timestamp {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'Sora', sans-serif;
  margin-top: 4px;
  display: block;
}
.user-row .msg-timestamp { text-align: right; }

.typing-dots { display: flex; gap: 5px; align-items: center; padding: 10px 4px; }
.td {
  width: 8px; height: 8px;
  border-radius: 50%;
  opacity: 0.3;
  animation: tdWave 1.4s ease infinite;
}
.td:nth-child(1) { background: var(--accent); animation-delay: 0s; }
.td:nth-child(2) { background: var(--accent-light); animation-delay: 0.2s; }
.td:nth-child(3) { background: #e8a87c; animation-delay: 0.4s; }
@keyframes tdWave {
  0%,60%,100% { transform: translateY(0) scale(1); opacity: 0.3; }
  30% { transform: translateY(-8px) scale(1.2); opacity: 1; }
}
.typing-text {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Sora', sans-serif;
  margin-left: 4px;
  animation: fadeInOut 2s ease infinite;
}
@keyframes fadeInOut {
  0%,100%{ opacity: 0.4; }
  50%{ opacity: 1; }
}

@media(max-width: 680px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: flex; }
  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }
  .overlay.show { display: block; }
  .intensity-wrap { display: none; }
  .suggestions { grid-template-columns: 1fr; }
  
  
  .input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 10px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 16px));
    background: var(--bg);
    z-index: 20;
  }

  .input-box {
    border-radius: 24px;
    padding: 10px 10px 8px 14px;
  }

  textarea {
    font-size: 16px;
  }

  .chat {
    padding-bottom: 180px;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
  }

  .main {
    height: 100%;
    overflow: hidden;
  }

  .input-hint {
    display: none;
  }
}

.plus-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  position: relative;
}
.plus-btn:hover { color: var(--text); background: rgba(255,255,255,0.07); }
.plus-btn svg { width: 18px; height: 18px; }

.plus-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  min-width: 160px;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.plus-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: Sora, sans-serif;
  color: var(--text);
  transition: background 0.15s;
}
.plus-menu-item:hover { background: var(--hover); }

.img-preview-wrap {
  padding: 8px 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.img-preview-wrap img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.img-preview-wrap .remove-img {
  background: rgba(255,80,80,0.15);
  border: none;
  color: #ff8888;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  font-family: Sora, sans-serif;
}

.chat-img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  display: block;
  transition: opacity 0.2s;
}
.chat-img:hover { opacity: 0.88; }

.file-preview-wrap {
  padding: 8px 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: Sora, sans-serif;
  color: var(--text);
}

.thumb-preview-wrap {
  max-width: 820px;
  margin: 0 auto 0;
  padding: 8px 24px 0;
}

.thumb-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px 10px 6px 8px;
  cursor: pointer;
  position: relative;
  max-width: 240px;
}

.thumb-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: block;
}

.thumb-file-card {
  cursor: default;
}

.thumb-file-icon {
  width: 36px;
  height: 36px;
  background: rgba(204,120,92,0.12);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
  flex-shrink: 0;
}

.thumb-file-name {
  font-size: 12px;
  font-family: Sora, sans-serif;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.thumb-remove {
  background: rgba(255,80,80,0.12);
  border: none;
  color: #ff8888;
  border-radius: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
  line-height: 1;
}
.thumb-remove:hover { background: rgba(255,80,80,0.25); }

.tw-cursor {
  display: inline-block;
  color: #cc785c;
  font-weight: bold;
  margin-left: 1px;
  animation: twBlink 0.6s step-end infinite;
}
@keyframes twBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}