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

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-tertiary: #242836;
  --bg-hover: #2a2e3d;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0b0;
  --text-muted: #5f6577;
  --accent: #f59e0b;
  --accent-dim: rgba(245,158,11,0.15);
  --border: #2a2e3d;
  --user-bg: #1c2333;
  --error: #ef4444;
  --success: #22c55e;
  --radius: 10px;
  --sidebar-w: 290px;
  --font: 'DM Sans', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

html, body { height: 100%; font-family: var(--font); background: var(--bg-primary); color: var(--text-primary); }

/* === LAYOUT === */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); background: var(--bg-secondary); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; transition: transform 0.2s;
}
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.sidebar-header h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
.sidebar-header h1 span { color: var(--accent); }
.sidebar-header p { font-size: 11px; color: var(--text-muted); margin-top: 4px; letter-spacing: 0.5px; text-transform: uppercase; }

.new-chat-btn {
  margin: 12px 16px; padding: 10px 16px; background: var(--accent); color: #000; border: none;
  border-radius: var(--radius); font-family: var(--font); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: all 0.15s; letter-spacing: -0.2px;
}
.new-chat-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }

.conv-list { flex: 1; overflow-y: auto; padding: 8px; }
.conv-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 2px;
  transition: background 0.1s; border-left: 3px solid transparent;
}
.conv-item:hover { background: var(--bg-hover); }
.conv-item.active { background: var(--bg-tertiary); border-left-color: var(--accent); }
.conv-item .title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* === FOLDER TREE === */
.folder-item { margin-bottom: 2px; }
.folder-header {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: background 0.1s; user-select: none;
}
.folder-header:hover { background: var(--bg-hover); }
.folder-header .folder-arrow { font-size: 10px; width: 14px; transition: transform 0.15s; color: var(--text-muted); }
.folder-header .folder-arrow.open { transform: rotate(90deg); }
.folder-header .folder-icon { font-size: 14px; }
.folder-header .folder-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-header .folder-count { font-size: 10px; color: var(--text-muted); font-family: var(--mono); }
.folder-header .folder-actions { display: none; gap: 2px; }
.folder-header:hover .folder-actions { display: flex; }
.folder-header .folder-actions button {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px;
  padding: 1px 4px; border-radius: 4px;
}
.folder-header .folder-actions button:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.folder-children { padding-left: 16px; overflow: hidden; }
.folder-children.collapsed { display: none; }
.folder-depth-0 > .folder-header { font-weight: 700; color: var(--text-primary); }
.folder-depth-0 > .folder-header .folder-icon { font-size: 15px; }
.breadcrumb { padding: 6px 20px; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); display: none; align-items: center; gap: 4px; background: var(--bg-secondary); }
.breadcrumb.visible { display: flex; }
.breadcrumb span { cursor: pointer; transition: color 0.1s; }
.breadcrumb span:hover { color: var(--accent); }
.breadcrumb .bc-sep { color: var(--text-muted); cursor: default; opacity: 0.5; }
.breadcrumb .bc-current { color: var(--text-secondary); cursor: default; }
.unfiled-label {
  padding: 8px 10px 4px; font-size: 10px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600;
}
/* Move-to dropdown */
.move-menu {
  position: absolute; right: 0; top: 100%; z-index: 100; min-width: 180px;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); padding: 4px; display: none;
}
.move-menu.active { display: block; }
.move-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px;
  cursor: pointer; font-size: 12px; color: var(--text-secondary); transition: background 0.1s;
}
.move-menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.move-menu-item.current { color: var(--accent); font-weight: 600; }
.folder-export-menu {
  position: absolute; right: 0; top: 100%; z-index: 100; min-width: 200px;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); padding: 6px; display: block;
}
.folder-export-menu .fex-header {
  padding: 6px 10px; font-size: 11px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.folder-export-menu .fex-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px;
  cursor: pointer; font-size: 12px; color: var(--text-secondary); transition: background 0.1s;
}
.folder-export-menu .fex-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.folder-export-menu .fex-item small { color: var(--text-muted); margin-left: auto; font-size: 10px; }
.new-folder-inline {
  display: flex; gap: 6px; padding: 4px 8px; margin: 4px 0;
}
.new-folder-inline input {
  flex: 1; padding: 5px 8px; background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--accent); border-radius: 6px; font-family: var(--font); font-size: 12px; outline: none;
}

.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.sidebar-footer button {
  width: 100%; padding: 8px; background: var(--bg-tertiary); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 12px;
  cursor: pointer; transition: all 0.15s;
}
.sidebar-footer button:hover { background: var(--bg-hover); color: var(--text-primary); }

/* === MAIN CHAT === */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--bg-secondary);
}
.model-select {
  padding: 6px 12px; background: var(--bg-tertiary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; font-family: var(--font);
  font-size: 13px; cursor: pointer; outline: none;
}
.model-select:focus { border-color: var(--accent); }
.topbar-actions { display: flex; gap: 8px; }
.topbar-btn {
  padding: 6px 12px; background: var(--bg-tertiary); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 8px; font-family: var(--font);
  font-size: 12px; cursor: pointer; transition: all 0.15s;
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* === MESSAGES === */
.messages { flex: 1; overflow-y: auto; padding: 24px; scroll-behavior: smooth; }
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.message { max-width: 820px; margin: 0 auto 20px; padding: 16px 20px; border-radius: var(--radius); line-height: 1.65; font-size: 14.5px; }
.message.user { background: var(--user-bg); border: 1px solid var(--border); }
.message.assistant { background: transparent; }
.message .role { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px; }
.message.user .role { color: var(--accent); }
.message .content { color: var(--text-primary); white-space: pre-wrap; word-break: break-word; line-height: 1.65; }
.message .content.md-rendered { white-space: normal; }
.message .content.md-rendered p { margin: 0 0 12px 0; }
.message .content.md-rendered p:last-child { margin-bottom: 0; }
.message .content.md-rendered h1,.message .content.md-rendered h2,.message .content.md-rendered h3 { margin: 16px 0 8px; color: var(--accent); font-weight: 700; }
.message .content.md-rendered h1 { font-size: 18px; }
.message .content.md-rendered h2 { font-size: 16px; }
.message .content.md-rendered h3 { font-size: 14px; }
.message .content.md-rendered ul,.message .content.md-rendered ol { margin: 8px 0 12px 20px; }
.message .content.md-rendered li { margin: 4px 0; }
.message .content.md-rendered pre { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; overflow-x: auto; margin: 10px 0; }
.message .content.md-rendered pre code { background: none; padding: 0; }
.message .content.md-rendered blockquote { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 8px 0; color: var(--text-secondary); font-style: italic; }
.message .content.md-rendered table { border-collapse: collapse; margin: 10px 0; width: 100%; }
.message .content.md-rendered th,.message .content.md-rendered td { border: 1px solid var(--border); padding: 6px 10px; font-size: 13px; text-align: left; }
.message .content.md-rendered th { background: var(--bg-tertiary); font-weight: 600; }
.message .content.md-rendered hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.message .content.md-rendered strong { font-weight: 700; }
.message .content.md-rendered a { color: var(--accent); }
.message .content code { font-family: var(--mono); background: var(--bg-tertiary); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.message .content .generated-image { max-width: 280px; border-radius: 8px; margin: 8px 0; cursor: pointer; border: 1px solid var(--border); transition: transform 0.15s; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.message .content .generated-image:hover { transform: scale(1.02); box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.image-thumb-wrap { display: inline-block; position: relative; }
.image-thumb-wrap .expand-hint { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.7); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 4px; opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.image-thumb-wrap:hover .expand-hint { opacity: 1; }
.lightbox-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; opacity: 0; transition: opacity 0.2s; }
.lightbox-overlay.active { opacity: 1; }
.lightbox-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
.lightbox-actions { position: fixed; top: 16px; right: 16px; z-index: 10000; display: flex; gap: 8px; }
.lightbox-actions button { background: rgba(255,255,255,0.2); border: none; color: #fff; padding: 10px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.lightbox-actions button:hover { background: rgba(255,255,255,0.4); }
.lightbox-overlay img { max-width: 90vw; max-height: 85vh; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); touch-action: pinch-zoom; }
@media (max-width: 600px) { .lightbox-actions { top: auto; bottom: 16px; right: 50%; transform: translateX(50%); } .lightbox-overlay img { max-width: 95vw; max-height: 75vh; } }
.image-context-menu { position: fixed; z-index: 1000; min-width: 180px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); padding: 4px; display: none; }
.image-context-menu.active { display: block; }
.image-context-menu .ctx-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-secondary); transition: background 0.1s; }
.image-context-menu .ctx-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.message .msg-actions { display: none; gap: 4px; position: absolute; top: 8px; right: 8px; }
.message:hover .msg-actions { display: flex; }
.message { position: relative; }
.msg-actions button {
  background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-muted);
  padding: 3px 8px; border-radius: 6px; font-size: 11px; cursor: pointer;
  font-family: var(--font); transition: all 0.1s;
}
.msg-actions button:hover { color: var(--text-primary); border-color: var(--accent); }

.typing-indicator { display: inline-block; }
.typing-indicator span { display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-right: 4px; animation: pulse 1.2s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* === INPUT === */
.input-area { padding: 16px 24px 20px; border-top: 1px solid var(--border); background: var(--bg-secondary); }
.input-row { display: flex; gap: 10px; max-width: 820px; margin: 0 auto; align-items: flex-end; }
.input-wrapper { flex: 1; position: relative; }
#chat-input {
  width: 100%; padding: 14px 16px; background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--font);
  font-size: 14.5px; resize: none; outline: none; line-height: 1.5; min-height: 52px; max-height: 200px;
  transition: border-color 0.15s;
}
#chat-input:focus { border-color: var(--accent); }
#chat-input::placeholder { color: var(--text-muted); }
.clickable-question {
  display: block; padding: 8px 14px; margin: 4px 0; background: var(--bg-tertiary);
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  color: var(--text-primary); font-size: 13px; line-height: 1.4;
  transition: all 0.15s; text-align: left; width: 100%;
}
.clickable-question:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.send-btn {
  padding: 14px 20px; background: var(--accent); color: #000; border: none;
  border-radius: var(--radius); font-family: var(--font); font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.send-btn:hover { filter: brightness(1.1); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.input-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; text-align: center; }

/* === WELCOME SCREEN === */
.welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; text-align: center; }
.welcome h2 { font-size: 28px; font-weight: 700; letter-spacing: -1px; margin-bottom: 8px; }
.welcome h2 span { color: var(--accent); }
.welcome p { color: var(--text-secondary); font-size: 15px; max-width: 440px; line-height: 1.6; }
.welcome .setup-prompt { margin-top: 24px; padding: 16px 24px; background: var(--accent-dim); border: 1px solid var(--accent); border-radius: var(--radius); }
.welcome .setup-prompt a { color: var(--accent); cursor: pointer; text-decoration: underline; font-weight: 600; }

/* === ONBOARDING === */
.onboarding { margin-top: 32px; width: 100%; max-width: 520px; }
.onboarding-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.onboarding-header h3 { font-size: 15px; font-weight: 600; color: var(--text-secondary); }
.onboarding-skip { font-size: 12px; color: var(--text-muted); cursor: pointer; text-decoration: underline; }
.onboarding-skip:hover { color: var(--text-secondary); }
.onboarding-step {
  display: flex; align-items: flex-start; gap: 14px; padding: 14px 18px;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; transition: all 0.15s; position: relative;
}
.onboarding-step:hover { border-color: var(--accent); background: var(--bg-tertiary); }
.onboarding-step.completed { opacity: 0.5; cursor: default; }
.onboarding-step.completed:hover { border-color: var(--border); background: var(--bg-secondary); }
.onboarding-step .step-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 12px; margin-top: 1px; transition: all 0.2s;
}
.onboarding-step.completed .step-check {
  background: var(--success); border-color: var(--success); color: #000;
}
.onboarding-step .step-content { flex: 1; }
.onboarding-step .step-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.onboarding-step .step-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.onboarding-step .step-action {
  display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600;
  color: var(--accent); text-decoration: none;
}
.onboarding-step.completed .step-action { display: none; }
.onboarding-progress { margin-top: 12px; text-align: center; }
.onboarding-progress-bar {
  height: 4px; background: var(--bg-tertiary); border-radius: 2px; overflow: hidden; margin-bottom: 6px;
}
.onboarding-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s ease; }
.onboarding-progress-text { font-size: 11px; color: var(--text-muted); }

/* === SETTINGS MODAL === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: none; align-items: center; justify-content: center; z-index: 500; }
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 14px; padding: 28px; width: 480px; max-height: 80vh; overflow-y: auto; }
.modal h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; margin-top: 14px; }
.modal input {
  width: 100%; padding: 10px 14px; background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; font-family: var(--mono); font-size: 13px; outline: none;
}
.modal input:focus { border-color: var(--accent); }
.modal .btn-row { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.modal .btn-save { padding: 8px 20px; background: var(--accent); color: #000; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.modal .btn-cancel { padding: 8px 20px; background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.status { font-size: 12px; margin-top: 8px; }
.status.ok { color: var(--success); }
.status.err { color: var(--error); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
}

/* === 1.4 CONVERSATION PREVIEW TOOLTIP === */
.conv-item { position: relative; }
#preview-tooltip {
  display: none; position: fixed; z-index: 200;
  width: 320px; max-height: 280px; overflow: hidden;
  background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); pointer-events: none;
}
#preview-tooltip.visible { display: block; }
#preview-tooltip .preview-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--accent); }
#preview-tooltip .preview-turn { font-size: 12px; margin-bottom: 6px; line-height: 1.5; }
#preview-tooltip .preview-turn .pr-role { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
#preview-tooltip .preview-turn .pr-text { color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#preview-tooltip .preview-fade { background: linear-gradient(transparent, var(--bg-tertiary)); height: 30px; margin-top: -30px; position: relative; }

/* === 1.6 MODEL BADGE === */
.model-badge {
  display: inline-block; font-size: 10px; color: var(--text-muted); background: var(--bg-tertiary);
  padding: 2px 7px; border-radius: 4px; margin-left: 8px; font-weight: 500; letter-spacing: 0.3px;
  vertical-align: middle;
}
.cost-badge {
  display: inline-block; font-size: 10px; color: var(--success); background: rgba(34,197,94,0.1);
  padding: 2px 7px; border-radius: 4px; margin-left: 6px; font-family: var(--mono);
  vertical-align: middle;
}
.conv-cost { font-size: 10px; color: var(--success); font-family: var(--mono); }

/* === EXPORT DROPDOWN === */
.export-container { position: relative; }
.export-btn {
  padding: 6px 14px; background: var(--accent); color: #000; border: none;
  border-radius: 8px; font-family: var(--font); font-weight: 600; font-size: 12px;
  cursor: pointer; transition: all 0.15s;
}
.export-btn:hover { filter: brightness(1.1); }
.export-panel {
  display: none; position: absolute; right: 0; top: 40px; z-index: 100;
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; width: 340px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.export-panel.active { display: block; }
.export-panel h4 { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.export-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; margin-bottom: 4px; transition: background 0.1s;
}
.export-row:hover { background: var(--bg-hover); }
.export-format { font-size: 13px; font-weight: 500; color: var(--text-primary); min-width: 90px; }
.export-format small { display: block; font-size: 10px; color: var(--text-muted); font-weight: 400; }
.export-destinations { display: flex; gap: 6px; }
.export-dest {
  width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-tertiary); color: var(--text-secondary); font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; position: relative;
}
.export-dest:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.export-dest.disabled { opacity: 0.25; cursor: not-allowed; pointer-events: none; }
.export-dest[title]:hover::after {
  content: attr(title); position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-primary); color: var(--text-secondary); font-size: 10px; padding: 2px 6px;
  border-radius: 4px; white-space: nowrap; border: 1px solid var(--border);
}
.export-divider { height: 1px; background: var(--border); margin: 10px 0; }

/* === LIVE STREAMING === */
.live-toggle {
  display: flex; align-items: center; gap: 8px; padding: 4px 12px;
  border-radius: 20px; border: 1px solid var(--border); background: var(--bg-tertiary);
  cursor: pointer; transition: all 0.2s; font-family: var(--font); font-size: 12px; color: var(--text-muted);
}
.live-toggle.active { border-color: #ef4444; background: rgba(239,68,68,0.15); color: #ef4444; }
.live-toggle .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); transition: all 0.2s; }
.live-toggle.active .live-dot { background: #ef4444; animation: live-pulse 1.5s infinite; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 4px rgba(245,158,11,0.3); } 50% { box-shadow: 0 0 12px rgba(245,158,11,0.6); } }
.live-badge { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); background: #ef4444;
  color: #fff; padding: 4px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  display: none; z-index: 100; animation: live-pulse 1.5s infinite; letter-spacing: 0.5px; }
.live-badge.active { display: block; }
.viewer-count { font-size: 11px; color: var(--text-muted); margin-left: 4px; }

/* === 1.5 AUTH LOGIN SCREEN === */
.auth-overlay {
  position: fixed; inset: 0; background: var(--bg-primary); z-index: 200;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.auth-overlay.hidden { display: none; }
.auth-box { text-align: center; max-width: 380px; padding: 40px 32px; }
.auth-box h1 { font-size: 36px; font-weight: 700; letter-spacing: -1.5px; margin-bottom: 10px; }
.auth-box h1 span { color: var(--accent); }
.auth-box .tagline { color: var(--text-muted); font-size: 15px; margin-bottom: 32px; line-height: 1.6; }
.auth-box input {
  width: 100%; padding: 14px 18px; background: var(--bg-secondary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--font);
  font-size: 15px; outline: none; margin-bottom: 14px; text-align: center;
}
.auth-box input:focus { border-color: var(--accent); }
.auth-box .auth-btn {
  width: 100%; padding: 14px; background: var(--accent); color: #000; border: none;
  border-radius: var(--radius); font-family: var(--font); font-weight: 700; font-size: 15px;
  cursor: pointer; transition: all 0.15s; letter-spacing: -0.3px;
}
.auth-box .auth-btn:hover { filter: brightness(1.1); }
.auth-box .auth-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-box .auth-status { font-size: 13px; margin-top: 12px; }
.auth-box .trial-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; }
.auth-box .learn-more-btn {
  display: inline-block; margin-top: 24px; padding: 9px 24px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: all 0.15s; font-family: var(--font);
}
.auth-box .learn-more-btn:hover { border-color: var(--accent); color: var(--accent); }
.auth-box .auth-footer { margin-top: 20px; font-size: 11px; color: var(--text-muted); line-height: 1.8; }
.auth-box .auth-footer a { color: var(--text-secondary); text-decoration: none; cursor: pointer; }
.auth-box .auth-footer a:hover { color: var(--accent); text-decoration: underline; }
.auth-box .auth-footer .sep { margin: 0 6px; color: var(--border); }

/* === INFO MODAL (Learn More) === */
.info-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  z-index: 200; overflow-y: auto; padding: 40px 20px;
}
.info-overlay.active { display: flex; justify-content: center; align-items: flex-start; }
.info-modal {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 16px;
  max-width: 720px; width: 100%; padding: 36px 40px; position: relative;
  box-shadow: 0 16px 64px rgba(0,0,0,0.6);
}
/* Tab navigation */
.info-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.info-tab {
  padding: 10px 18px; font-size: 13px; font-weight: 500; color: var(--text-muted);
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; font-family: var(--font); transition: all 0.15s;
}
.info-tab:hover { color: var(--text-secondary); }
.info-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.info-tab-content { display: none; }
.info-tab-content.active { display: block; }
/* Avatar / video placeholder */
.showcase-hero {
  background: var(--bg-tertiary); border: 1px dashed var(--border); border-radius: 12px;
  padding: 48px 24px; text-align: center; margin-bottom: 24px; position: relative;
  min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.showcase-hero .placeholder-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }
.showcase-hero .placeholder-text { font-size: 14px; color: var(--text-muted); }
.showcase-hero .placeholder-label {
  position: absolute; top: 12px; right: 12px; font-size: 10px; color: var(--accent);
  background: rgba(245,158,11,0.15); padding: 2px 8px; border-radius: 4px; font-weight: 600;
}
/* Workflow cards */
.workflow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.workflow-card {
  background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; transition: all 0.15s; cursor: default;
}
.workflow-card:hover { border-color: var(--accent); }
.workflow-card .wf-icon { font-size: 24px; margin-bottom: 8px; }
.workflow-card .wf-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.workflow-card .wf-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.workflow-card .wf-badge {
  display: inline-block; font-size: 9px; color: var(--accent); background: rgba(245,158,11,0.15);
  padding: 1px 6px; border-radius: 3px; font-weight: 600; margin-top: 6px;
}
/* Video grid */
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.video-slot {
  background: var(--bg-tertiary); border: 1px dashed var(--border); border-radius: 10px;
  padding: 32px 16px; text-align: center; min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.video-slot .v-icon { font-size: 32px; margin-bottom: 6px; opacity: 0.5; }
.video-slot .v-title { font-size: 12px; color: var(--text-muted); }
.info-modal .close-btn {
  position: absolute; top: 16px; right: 20px; background: none; border: none;
  color: var(--text-muted); font-size: 24px; cursor: pointer;
}
.info-modal h2 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.info-modal h2 span { color: var(--accent); }
.info-modal .tagline { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.info-section { margin-bottom: 24px; }
.info-section h3 { font-size: 15px; font-weight: 600; color: var(--accent); margin-bottom: 8px; letter-spacing: 0.3px; }
.info-section p { font-size: 13.5px; line-height: 1.7; color: var(--text-secondary); }
.info-section ul { list-style: none; padding: 0; }
.info-section li { font-size: 13px; color: var(--text-secondary); padding: 5px 0; padding-left: 20px; position: relative; line-height: 1.6; }
.info-section li::before { content: '→'; position: absolute; left: 0; color: var(--accent); }
.info-plans { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.info-plan {
  flex: 1; min-width: 180px; padding: 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-tertiary); transition: all 0.15s;
}
.info-plan:hover { border-color: var(--accent); }
.info-plan.featured { border-color: var(--accent); background: rgba(245,158,11,0.08); }
.info-plan h4 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.info-plan .price { font-size: 22px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.info-plan .price small { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.info-plan .desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.info-plan .trial { font-size: 11px; color: var(--success); margin-top: 6px; font-weight: 500; }
.info-plan .price-alt { font-size: 13px; color: var(--text-muted); margin-top: 2px; text-decoration: line-through; text-decoration-color: var(--error); }
.info-plan .savings { font-size: 10px; color: var(--success); font-weight: 600; margin-top: 6px; background: rgba(34,197,94,0.12); padding: 3px 8px; border-radius: 4px; display: inline-block; }
.info-plan .plan-cta {
  display: block; width: 100%; margin-top: 12px; padding: 8px 0; font-size: 12px; font-weight: 600;
  border-radius: 6px; cursor: pointer; font-family: var(--font); transition: all 0.15s; text-align: center;
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
}
.info-plan .plan-cta:hover { border-color: var(--accent); color: var(--accent); }
.info-plan.featured .plan-cta {
  background: var(--accent); color: #000; border-color: var(--accent);
}
.info-plan.featured .plan-cta:hover { filter: brightness(1.1); }
.roadmap-item { display: flex; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--text-secondary); }
.roadmap-item .when { min-width: 70px; color: var(--accent); font-weight: 600; font-size: 11px; text-transform: uppercase; }
.auth-learn-more { margin-top: 16px; font-size: 13px; }
.auth-learn-more a { color: var(--accent); cursor: pointer; text-decoration: none; font-weight: 500; }
.auth-learn-more a:hover { text-decoration: underline; }

/* === LANDING AVATAR === */
.avatar-stage {
  width: 140px; height: 140px; margin: 0 auto 8px; position: relative;
}
.avatar-stage svg { width: 100%; height: 100%; }
.avatar-stage .char-svg { display: none; }
.avatar-stage .char-svg.active { display: block; }
/* Toggle button */
.mascot-toggle {
  position: absolute; bottom: -4px; right: -8px; font-size: 16px;
  background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 50%;
  width: 28px; height: 28px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all 0.15s; z-index: 2; padding: 0; line-height: 1;
}
.mascot-toggle:hover { border-color: var(--accent); transform: scale(1.1); }
/* Head animation: looking left → center */
.avatar-head {
  transform-origin: 60px 55px;
  animation: headTurn 3.5s ease-in-out forwards;
}
@keyframes headTurn {
  0%, 45% { transform: rotate(-12deg) translateX(-5px); }
  70% { transform: rotate(2deg) translateX(1px); }
  85%, 100% { transform: rotate(0deg) translateX(0); }
}
/* Eyes animation: looking hard left → snap to center */
.avatar-eyes {
  animation: eyeShift 3.5s ease-in-out forwards;
}
@keyframes eyeShift {
  0%, 35% { transform: translateX(-8px); }
  45% { transform: translateX(-8px); }
  65% { transform: translateX(1px); }
  80%, 100% { transform: translateX(0); }
}
/* Eye blink — first blink right after eyes center */
.avatar-eye-l, .avatar-eye-r {
  animation: blink 3.5s ease-in-out infinite;
}
.avatar-eye-r { animation-delay: 0.1s; }
@keyframes blink {
  0%, 68%, 72%, 84%, 88%, 100% { transform: scaleY(1); }
  70% { transform: scaleY(0.05); }
  86% { transform: scaleY(0.05); }
}
/* Smile appears */
.avatar-smile {
  opacity: 0; animation: smileAppear 3.5s ease-in-out forwards;
}
@keyframes smileAppear {
  0%, 65% { opacity: 0; d: path("M 48 72 Q 60 74 72 72"); }
  80%, 100% { opacity: 1; d: path("M 46 70 Q 60 80 74 70"); }
}
/* Ambient glow on what they're "reading" */
.avatar-glow {
  animation: glowPulse 2s ease-in-out infinite alternate, glowFade 3.5s ease-in-out forwards;
}
@keyframes glowPulse {
  0% { opacity: 0.15; } 100% { opacity: 0.35; }
}
@keyframes glowFade {
  0%, 55% { opacity: 0.3; } 80%, 100% { opacity: 0; }
}
/* Kitten ear twitch */
.ear-twitch-l { animation: earTwitchL 3.5s ease-in-out forwards; transform-origin: 45px 20px; }
.ear-twitch-r { animation: earTwitchR 3.5s ease-in-out forwards; transform-origin: 75px 20px; }
@keyframes earTwitchL {
  0%, 50% { transform: rotate(-3deg); } 60% { transform: rotate(4deg); }
  70% { transform: rotate(-1deg); } 80%, 100% { transform: rotate(0deg); }
}
@keyframes earTwitchR {
  0%, 55% { transform: rotate(3deg); } 65% { transform: rotate(-3deg); }
  75% { transform: rotate(1deg); } 85%, 100% { transform: rotate(0deg); }
}
/* Kitten tail sway */
.tail-sway { animation: tailSway 4s ease-in-out infinite; transform-origin: 85px 85px; }
@keyframes tailSway {
  0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); }
}
/* Kitten whiskers */
.whisker-twitch { animation: whiskerTwitch 2.5s ease-in-out infinite; }
@keyframes whiskerTwitch {
  0%, 100% { transform: rotate(0); } 25% { transform: rotate(2deg); } 75% { transform: rotate(-2deg); }
}
/* Lobster antenna sway */
.antenna-l { animation: antennaL 3s ease-in-out infinite; transform-origin: 52px 18px; }
.antenna-r { animation: antennaR 3s ease-in-out infinite 0.3s; transform-origin: 68px 18px; }
@keyframes antennaL {
  0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(8deg); }
}
@keyframes antennaR {
  0%, 100% { transform: rotate(5deg); } 50% { transform: rotate(-8deg); }
}
/* Lobster claw tap */
.claw-tap-l { animation: clawTapL 2s ease-in-out infinite; transform-origin: 30px 75px; }
.claw-tap-r { animation: clawTapR 2s ease-in-out infinite 0.5s; transform-origin: 90px 75px; }
@keyframes clawTapL {
  0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-6deg); }
}
@keyframes clawTapR {
  0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(6deg); }
}
/* Speech bubble */
.avatar-greeting {
  opacity: 0; transform: translateY(6px);
  animation: greetingAppear 0.5s ease-out 3.5s forwards;
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  margin-bottom: 16px; max-width: 320px; margin-left: auto; margin-right: auto;
}
@keyframes greetingAppear {
  to { opacity: 1; transform: translateY(0); }
}
/* Concierge starters */
.concierge-starters {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  opacity: 0; animation: greetingAppear 0.4s ease-out 4s forwards;
  margin-bottom: 20px;
}
.concierge-chip {
  padding: 6px 14px; font-size: 11.5px; color: var(--text-secondary);
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: 20px; cursor: pointer; font-family: var(--font);
  transition: all 0.15s; white-space: nowrap;
}
.concierge-chip:hover { border-color: var(--accent); color: var(--accent); }
/* Concierge chat widget (hidden until activated) */
.concierge-chat {
  display: none; max-width: 360px; margin: 0 auto 20px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.concierge-chat.active { display: block; }
.concierge-messages {
  max-height: 180px; overflow-y: auto; padding: 12px;
  font-size: 12px; line-height: 1.6;
}
.concierge-messages .msg-bot {
  background: var(--bg-secondary); border-radius: 10px 10px 10px 2px;
  padding: 8px 12px; margin-bottom: 8px; color: var(--text-secondary);
}
.concierge-messages .msg-user {
  background: rgba(245,158,11,0.12); border-radius: 10px 10px 2px 10px;
  padding: 8px 12px; margin-bottom: 8px; color: var(--text-primary); text-align: right;
}
.concierge-input-row {
  display: flex; border-top: 1px solid var(--border);
}
.concierge-input-row input {
  flex: 1; padding: 10px 12px; background: transparent; border: none;
  color: var(--text-primary); font-family: var(--font); font-size: 12px; outline: none;
}
.concierge-input-row button {
  padding: 10px 14px; background: var(--accent); color: #000; border: none;
  font-weight: 600; font-size: 12px; cursor: pointer; font-family: var(--font);
}
/* Trial expiry banner */
.trial-expiry-banner {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
  background: var(--bg-secondary); border-top: 2px solid var(--accent);
  padding: 20px; text-align: center; box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}
.trial-expiry-banner.active { display: block; }
.trial-expiry-banner h3 { font-size: 16px; margin-bottom: 8px; color: var(--text-primary); }
.trial-expiry-banner p { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.trial-expiry-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.trial-expiry-actions button {
  padding: 10px 20px; border-radius: var(--radius); font-family: var(--font);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; border: 1px solid var(--border);
}
.trial-expiry-actions .btn-starter { background: var(--bg-tertiary); color: var(--text-primary); }
.trial-expiry-actions .btn-starter:hover { border-color: var(--accent); }
.trial-expiry-actions .btn-pro { background: var(--accent); color: #000; border-color: var(--accent); }
.trial-expiry-actions .btn-pro:hover { filter: brightness(1.1); }
.trial-expiry-actions .btn-byok { background: transparent; color: var(--text-muted); }
.trial-expiry-actions .btn-byok:hover { color: var(--text-secondary); border-color: var(--text-secondary); }
