/* =====================================================================
   Classic ChatGPT skin for Muse Chat / Gemini Chat Studio
   This file is loaded AFTER the inline <style>, so every rule here
   overrides the legacy visual layer while leaving all DOM + JS intact.
   ===================================================================== */

:root {
  color-scheme: light;
  --chatgpt-sidebar: #171717;
  --chatgpt-sidebar-hover: #212121;
  --chatgpt-sidebar-active: #2a2b32;
  --chatgpt-sidebar-text: #ececf1;
  --chatgpt-sidebar-muted: #8e8ea0;
  --chatgpt-sidebar-border: rgba(255, 255, 255, 0.08);
  --chatgpt-main: #ffffff;
  --chatgpt-main-dark: #343541;
  --chatgpt-text: #0d0d0d;
  --chatgpt-muted: #6e6e6e;
  --chatgpt-border: #d9d9e3;
  --chatgpt-hover: #ececf1;
  --chatgpt-input: #ffffff;
  --chatgpt-code-bg: #f6f8fa;
  --chatgpt-user-avatar: #0d0d0d;
}

[data-theme="dark"] {
  color-scheme: dark;
  --chatgpt-main: #343541;
  --chatgpt-main-dark: #343541;
  --chatgpt-text: #ececf1;
  --chatgpt-muted: #9aa0a6;
  --chatgpt-border: #565869;
  --chatgpt-hover: #3e3f4b;
  --chatgpt-input: #40414f;
  --chatgpt-code-bg: #0d0d0d;
  --chatgpt-user-avatar: #0d0d0d;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

body {
  background: var(--chatgpt-main);
  color: var(--chatgpt-text);
  font-family: "Söhne", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", system-ui, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before { display: none !important; }

.app {
  max-width: none;
  width: 100%;
  background: var(--chatgpt-main) !important;
  backdrop-filter: none;
  color: var(--chatgpt-text);
  animation: none;
}

.chat-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-rows: 1fr;
  overflow: hidden;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--chatgpt-main);
}

/* ---------- Sidebar (pure white, like Gemini/Notion) ---------- */
.sidebar {
  width: 260px;
  padding: 0;
  background: #ffffff !important;
  border-right: 1px solid var(--chatgpt-border) !important;
  display: flex;
  flex-direction: column;
  color: #202124;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  padding: 0 16px;
  color: #202124 !important;
  font-size: 1.05rem;
  font-weight: 600;
  border-bottom: 1px solid var(--chatgpt-border);
}

.sidebar-mark {
  width: 24px;
  height: 24px;
}

.sidebar-mark::before,
.welcome-mark::before {
  width: 78%;
  height: 78%;
}

.new-chat-btn {
  width: calc(100% - 32px);
  min-height: 44px;
  margin: 16px 16px 8px;
  padding: 0 14px;
  border: 1px solid var(--chatgpt-border) !important;
  border-radius: 8px !important;
  background: #fafafb !important;
  color: #202124 !important;
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.new-chat-btn:hover {
  background: var(--chatgpt-hover) !important;
  animation: none;
  transform: none;
}

.sidebar-search {
  margin: 4px 16px 8px;
}
#chatSearchInput {
  width: 100%;
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--chatgpt-border) !important;
  border-radius: 8px;
  background: #fafafb !important;
  color: #202124 !important;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
#chatSearchInput::placeholder { color: var(--chatgpt-muted); }
#chatSearchInput:focus {
  background: #ffffff !important;
  box-shadow: 0 0 0 2px var(--chatgpt-hover) !important;
  border-color: var(--chatgpt-muted) !important;
}

/* Hide the legacy nav rail (聊天 / 最近活动) for a cleaner ChatGPT look */
.side-nav { display: none !important; }

.chat-history-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 16px 8px;
  margin: 4px 0 16px;
}
.chat-history-list::-webkit-scrollbar { width: 6px; }
.chat-history-list::-webkit-scrollbar-track { background: transparent; }
.chat-history-list::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.14); border-radius: 3px; }

.chat-history-item {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease;
  animation: none;
  transform: none;
}
.chat-history-item:hover {
  background: var(--chatgpt-hover);
}
.chat-history-item.active {
  background: var(--chatgpt-hover);
}

.chat-history-button {
  flex: 1;
  min-width: 0;
  padding: 9px 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #202124 !important;
  text-align: left;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-history-item.active .chat-history-button { font-weight: 600; color: #174ea6 !important; }
.chat-history-button:hover { color: #202124 !important; }

.chat-history-delete {
  width: 24px;
  height: 24px;
  min-width: 24px;
  margin-right: 4px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--chatgpt-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.chat-history-item:hover .chat-history-delete { opacity: 1; }
.chat-history-delete:hover {
  background: #fee2e2;
  color: #dc2626;
  transform: none;
}

.chat-history-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--chatgpt-muted);
  font-size: 0.82rem;
  font-style: italic;
  border: 1px dashed var(--chatgpt-border);
  border-radius: 10px;
  margin: 12px 8px;
}

.sidebar-footer {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--chatgpt-border);
  background: transparent;
  color: var(--chatgpt-muted) !important;
  font-size: 0.72rem;
  line-height: 1.6;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-bottom: 10px;
  padding: 9px 6px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--chatgpt-muted) !important;
  font: inherit;
  font-size: 0.84rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.logout-btn:hover {
  background: var(--chatgpt-hover);
  color: #202124 !important;
}

/* ---------- Header ---------- */
.header {
  min-height: 60px;
  padding: 0 24px;
  background: var(--chatgpt-main);
  border-bottom: 1px solid var(--chatgpt-border);
  transition: none;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}
.mobile-menu-btn { display: none; }
.logo-chip { display: none !important; }

.title-wrap { display: none !important; }

.model-selector-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

#modelSelect {
  min-width: 0;
  padding: 8px 12px;
  border: none;
  border-radius: 9px;
  background: transparent !important;
  color: var(--chatgpt-text) !important;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
#modelSelect:hover { background: var(--chatgpt-hover); }
#modelSelect:focus {
  box-shadow: none !important;
  border-color: transparent !important;
}

.model-info {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--chatgpt-hover);
  color: var(--chatgpt-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.model-info::before {
  content: "i";
  font-family: Georgia, serif;
  font-size: 0.82rem;
  font-style: italic;
}
.model-info:hover {
  background: var(--chatgpt-muted);
  color: #ffffff;
  transform: none;
}

.model-tooltip {
  top: 100%;
  right: 0;
  margin-top: 8px;
  padding: 14px;
  background: var(--chatgpt-main);
  border: 1px solid var(--chatgpt-border);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  font-size: 0.8rem;
  color: var(--chatgpt-text);
  min-width: 220px;
  z-index: 100;
  display: none;
}
.model-tooltip.visible { display: block; }
.model-tooltip h4 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--chatgpt-text);
}
.model-tooltip p {
  margin: 4px 0;
  color: var(--chatgpt-muted);
  line-height: 1.5;
}
.model-badge {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 4px;
  border-radius: 999px;
  background: var(--chatgpt-hover);
  color: var(--chatgpt-text);
  font-size: 0.7rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-right::before { content: none; }

.header-export-btn,
.header-logout-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--chatgpt-muted);
  font-size: 0;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.header-export-btn::before { content: "↓"; font-size: 1.25rem; }
.header-logout-btn::before { content: "↪"; font-size: 1.05rem; }
.header-export-btn:hover,
.header-logout-btn:hover {
  background: var(--chatgpt-hover);
  color: var(--chatgpt-text);
  transform: none;
}

/* ---------- Messages feed ---------- */
#messages {
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 20px 24px;
  gap: 28px;
  background: transparent;
  scroll-behavior: smooth;
}
#messages:empty::before { content: none; }
#messages:empty::after { display: none; width: 0; height: 0; }

.msg-row {
  display: flex !important;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 0;
  animation: chgMsg 0.25s ease both;
}
@keyframes chgMsg {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-row.user { justify-content: flex-end; }
.msg-row.assistant { justify-content: flex-start; }
.msg-row.user,
.msg-row.assistant { animation: chgMsg 0.25s ease both !important; }

/* Avatars: replace the grey "G" bubble with the Gemini star; drop user avatar */
.msg-avatar { display: none !important; }

.msg-row.assistant::before {
  content: "";
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  margin: 4px 10px 0 0;
  display: block;
  background: linear-gradient(145deg, #4285f4 8%, #8e7bea 48%, #db80a5 92%);
  clip-path: polygon(50% 0%, 61% 37%, 100% 50%, 61% 63%, 50% 100%, 39% 63%, 0% 50%, 39% 37%);
  filter: drop-shadow(0 3px 5px rgba(87, 106, 210, 0.25));
}

/* Bubbles: classic ChatGPT means plain, borderless text rows */
.msg-bubble {
  display: flex;
  flex-direction: column;
  max-width: min(700px, 90%);
  padding: 0;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--chatgpt-text);
  animation: none;
}

.msg-bubble.user {
  background: transparent !important;
  color: var(--chatgpt-text) !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  margin-left: auto;
  text-align: left;
}
.msg-bubble.assistant {
  background: transparent !important;
  color: var(--chatgpt-text) !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding-left: 0;
}
[data-theme="dark"] .msg-bubble.user { color: var(--chatgpt-text) !important; }

.msg-bubble .msg-content { order: 1; white-space: normal; }
.msg-bubble .msg-meta { order: 2; }
.msg-bubble .msg-timestamp { order: 3; }

.msg-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
  opacity: 1;
}
.msg-meta > span { display: none; }

.msg-actions {
  display: flex;
  gap: 2px;
  margin: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.msg-row:hover .msg-actions,
.msg-bubble.error .msg-actions { opacity: 1; }

.msg-action-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--chatgpt-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.msg-action-btn:hover {
  background: var(--chatgpt-hover);
  color: var(--chatgpt-text);
  transform: none;
}

.msg-timestamp { display: none; }

/* Copy/delete legacy twins keep in line with the ChatGPT look */
.copy-btn,
.delete-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--chatgpt-muted);
  font-size: 0.75rem;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.copy-btn:hover { background: var(--chatgpt-hover); color: var(--chatgpt-text); }
.delete-btn:hover { background: #fee2e2; color: #dc2626; }

/* Code blocks */
.msg-bubble pre {
  background: var(--chatgpt-code-bg) !important;
  color: var(--chatgpt-text);
  border: 1px solid var(--chatgpt-border);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  margin: 12px 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88rem;
}
.msg-bubble :not(pre) > code {
  background: var(--chatgpt-hover);
  padding: 0.12em 0.35em;
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.92em;
}
.msg-bubble.assistant .msg-content ul { list-style: none; padding-inline-start: 0; }
.msg-bubble.assistant .msg-content ul li::marker { content: none; }

/* Loading row */
.msg-bubble.loading {
  background: transparent !important;
  animation: none;
  border: none !important;
}
.loading-indicator { padding: 4px 0; }
.loading-dot { background: var(--chatgpt-text); }
.loading-text { color: var(--chatgpt-muted); font-size: 0.9rem; }

/* Error bubbles become subtle red-tinted cards */
.msg-bubble.error {
  background: rgba(220, 38, 38, 0.05) !important;
  border: 1px solid rgba(220, 38, 38, 0.25) !important;
  border-radius: 12px !important;
  padding: 12px 16px !important;
  color: #dc2626;
}
[data-theme="dark"] .msg-bubble.error {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #f87171;
}
.error-actions { order: 3; margin-top: 8px; }
.retry-btn {
  padding: 6px 14px;
  border: 1px solid var(--chatgpt-border);
  border-radius: 999px;
  background: var(--chatgpt-main);
  color: var(--chatgpt-text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.retry-btn:hover:not(:disabled) {
  border-color: var(--chatgpt-text);
  background: var(--chatgpt-hover);
}
.error-container {
  padding: 0;
  border-radius: 0;
  background: transparent;
  border-left: none;
}

/* Collapse / show-more controls */
.history-control { justify-content: center; margin: 4px 0 12px; }
.collapse-btn,
.collapse-old-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--chatgpt-border);
  border-radius: 999px;
  background: var(--chatgpt-main);
  color: var(--chatgpt-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.collapse-btn:hover,
.collapse-old-btn:hover {
  border-color: var(--chatgpt-muted);
  color: var(--chatgpt-text);
  transform: none;
  box-shadow: none;
}

/* ---------- Welcome / empty state ---------- */
.welcome-state {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 88px 24px 24px;
  text-align: center;
}
.welcome-mark {
  width: 44px;
  height: 44px;
  margin-bottom: 22px;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
}
.welcome-title {
  margin: 0;
  color: var(--chatgpt-text) !important;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  -webkit-text-fill-color: currentColor !important;
  text-fill-color: currentColor;
}
.welcome-subtitle {
  max-width: 460px;
  margin: 10px 0 32px;
  color: var(--chatgpt-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
.prompt-grid {
  width: min(100%, 680px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  text-align: left;
}
.prompt-btn {
  min-height: 76px;
  padding: 16px 18px;
  border: 1px solid var(--chatgpt-border);
  border-radius: 12px;
  background: var(--chatgpt-main);
  color: var(--chatgpt-text);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.prompt-btn::after {
  content: "↗";
  float: right;
  color: #a1a1a1;
  font-size: 1.05rem;
}
.prompt-btn:hover {
  border-color: var(--chatgpt-muted);
  background: var(--chatgpt-hover);
  color: var(--chatgpt-text);
  transform: none;
  box-shadow: none;
  animation: none;
}
[data-theme="dark"] .prompt-btn {
  background: var(--chatgpt-input);
  color: var(--chatgpt-text);
}
[data-theme="dark"] .prompt-btn:hover { background: var(--chatgpt-hover); }

/* ---------- Input area ---------- */
.input-area {
  padding: 20px 24px 28px;
  background: linear-gradient(to top, var(--chatgpt-main) 65%, rgba(0, 0, 0, 0));
  border-top: none;
}
.input-wrap {
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 10px 10px 20px;
  border: 1px solid var(--chatgpt-border);
  border-radius: 26px;
  background: var(--chatgpt-input);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-wrap:focus-within {
  border-color: #a0a0ac;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .input-wrap { background: var(--chatgpt-input); }

.attachment-tools { display: flex; align-items: center; gap: 2px; }
.attach-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--chatgpt-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.attach-btn:hover { background: var(--chatgpt-hover); color: var(--chatgpt-text); }

#input {
  flex: 1;
  min-height: 40px;
  max-height: 150px;
  padding: 9px 6px;
  border: none;
  border-radius: 0;
  background: transparent !important;
  color: var(--chatgpt-text);
  font: inherit;
  font-size: 1rem;
  resize: none;
  outline: none;
  box-shadow: none !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#input:focus {
  transform: none;
  box-shadow: none !important;
  animation: none;
}
#input::placeholder { color: var(--chatgpt-muted); font-weight: 400; }

#send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--chatgpt-user-avatar);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, opacity 0.15s ease;
}
#send:hover {
  background: #404040;
  transform: none;
  box-shadow: none;
  animation: none;
}
#send:active { transform: scale(0.92); animation: none; }
#send:disabled { opacity: 0.35; cursor: not-allowed; filter: none; box-shadow: none; }
#send svg { width: 18px; height: 18px; }
[data-theme="dark"] #send {
  background: #ffffff;
  color: #0d0d0d;
}
[data-theme="dark"] #send:hover { background: #e6e6e6; }

.input-hint {
  max-width: 768px;
  margin: 10px auto 0;
  text-align: center;
  color: var(--chatgpt-muted);
  font-size: 0.72rem;
}

.file-previews {
  max-width: 768px;
  width: 100%;
  margin: 0 auto 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.file-preview {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 4px 26px 4px 8px;
  border: 1px solid var(--chatgpt-border);
  border-radius: 10px;
  background: var(--chatgpt-main);
  color: var(--chatgpt-text);
  font-size: 0.75rem;
}
.file-preview img { width: 30px; height: 30px; border-radius: 5px; object-fit: cover; }
.file-icon { width: 28px; text-align: center; color: var(--chatgpt-muted); font-size: 1.05rem; }
.remove-file {
  position: absolute;
  top: 2px;
  right: 3px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--chatgpt-muted);
  cursor: pointer;
}
.remove-file:hover { background: var(--chatgpt-hover); color: var(--chatgpt-text); }
.attachment-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; color: var(--chatgpt-muted); font-size: 0.78rem; }
.attachment-chip { padding: 3px 8px; border-radius: 6px; background: var(--chatgpt-hover); }

/* ---------- Lock screen ---------- */
#lock-screen { background: var(--chatgpt-main); }
.lock-card {
  max-width: 420px;
  padding: 40px 36px 34px;
  border: 1px solid var(--chatgpt-border);
  border-radius: 20px;
  background: var(--chatgpt-main);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}
.lock-logo {
  width: 52px;
  height: 52px;
  display: grid !important;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 14px;
  background: var(--chatgpt-user-avatar);
  color: #ffffff;
  font: 700 1.5rem "Inter", Arial, sans-serif;
  box-shadow: none;
}
.lock-card h2 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--chatgpt-text);
}
.lock-card p { margin: 0 0 14px; font-size: 0.88rem; color: var(--chatgpt-muted); line-height: 1.6; }
#pwdInput {
  display: block;
  width: 100%;
  max-width: none;
  margin: 16px 0 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--chatgpt-border);
  background: var(--chatgpt-hover);
  color: var(--chatgpt-text);
  font: inherit;
  text-align: left;
  outline: none;
}
#pwdInput::placeholder { text-align: left; color: var(--chatgpt-muted); }
#pwdInput:focus {
  border-color: var(--chatgpt-muted);
  box-shadow: 0 0 0 2px var(--chatgpt-hover);
}
#unlockBtn {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px 0;
  border: none;
  border-radius: 10px;
  background: var(--chatgpt-user-avatar);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
#unlockBtn:hover { opacity: 0.9; filter: none; }

/* ---------- Misc widgets ---------- */
#backToTop {
  right: 20px;
  bottom: 104px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--chatgpt-border);
  background: var(--chatgpt-main);
  color: var(--chatgpt-muted);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
#backToTop:hover {
  background: var(--chatgpt-hover);
  color: var(--chatgpt-text);
  transform: none;
  filter: none;
}

.network-status {
  top: 12px;
  right: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--chatgpt-main);
  border: 1px solid var(--chatgpt-border);
  font-size: 0.78rem;
  color: var(--chatgpt-muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  z-index: 1000;
}
.network-status.online { color: #16a34a; border-color: #16a34a; }
.network-status.offline { color: #dc2626; border-color: #dc2626; }

.sidebar-overlay {
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}

/* Scrollbars in the main feed */
#messages::-webkit-scrollbar { width: 8px; }
#messages::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); border-radius: 4px; }
#messages::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.35); }
[data-theme="dark"] #messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); }
[data-theme="dark"] #messages::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.32); }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .chat-shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    bottom: 0;
    width: 290px;
    z-index: 1000;
    display: flex;
    transition: left 0.28s ease;
    box-shadow: 2px 0 14px rgba(0, 0, 0, 0.3);
  }
  .sidebar.active { left: 0; }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--chatgpt-muted);
    font-size: 1.25rem;
    cursor: pointer;
    margin-right: 4px;
  }
  .mobile-menu-btn:hover { background: var(--chatgpt-hover); color: var(--chatgpt-text); }

  .header { min-height: 56px; padding: 0 14px; }
  #messages { max-width: none; padding: 24px 16px 16px; gap: 22px; }
  .msg-bubble { max-width: 92%; font-size: 0.95rem; }
  .msg-row.assistant::before { margin-right: 8px; }
  .welcome-state { padding: 48px 16px 16px; }
  .welcome-title { font-size: 1.6rem; }
  .prompt-grid { grid-template-columns: 1fr; gap: 9px; }
  .prompt-btn { min-height: 62px; padding: 13px 15px; font-size: 0.86rem; }
  .input-area { padding: 14px 12px 20px; }
  .input-wrap { padding: 7px 7px 7px 14px; }
  #input { font-size: 16px; min-height: 26px; }
  #send { width: 34px; height: 34px; min-height: 34px; }
  .input-hint { display: none; }
  #modelSelect { max-width: 46vw; font-size: 0.85rem; }
  #backToTop { right: 14px; bottom: 84px; }
}