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

:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-solid: #ffffff;
  --sidebar: rgba(246, 246, 246, 0.8);
  --sidebar-solid: #f6f6f6;
  --text: #1d1d1f;
  --text2: #6e6e73;
  --text3: #86868b;
  --accent: #0071e3;
  --accent-light: #f5f5f7;
  --accent-dark: #0077ed;
  --border: rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1;
  letter-spacing: -0.01em;
}

/* ── Sidebar ──────────────────────────────────── */
.sidebar {
  width: 280px;
  background: var(--sidebar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

.sidebar-header {
  padding: 32px 24px 24px;
  border-bottom: none;
}

.sidebar-header h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 4px;
}

.sidebar-header p {
  font-size: 14px;
  color: var(--text2);
  font-weight: 400;
  margin-top: 0;
}

/* ── Mode Switcher ─────────────────────────────── */
.mode-switcher {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  margin: 12px 0 4px;
}

.mode-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text2);
  background: transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.mode-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.mode-item.active {
  background: var(--accent-light, rgba(108, 99, 255, 0.08));
  color: var(--accent);
}

.mode-icon {
  font-size: 20px;
  line-height: 1;
}

.mode-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.btn-new {
  margin: 20px 20px 16px;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-new:hover {
  background: var(--accent-dark);
  transform: scale(1.02);
}

.btn-new:active {
  transform: scale(0.98);
}

.project-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}

.project-item {
  padding: 12px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 4px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.project-item.active {
  background: var(--accent);
  color: #fff;
}

.project-item.active .pj-topic {
  color: #fff;
}

.project-item.active .pj-meta {
  color: rgba(255, 255, 255, 0.8);
}

.project-item .pj-topic {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.project-item .pj-meta {
  font-size: 13px;
  color: var(--text3);
  margin-top: 2px;
}

.project-more {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.btn-more {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text2);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-more:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
}

.btn-more:active {
  transform: scale(0.98);
}

/* ── Main ─────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}

.main-header {
  padding: 24px 40px;
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 24px;
}

.main-header h2 {
  font-size: 28px;
  font-weight: 600;
  flex: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.tab-bar {
  display: flex;
  padding: 0 40px;
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  gap: 0;
}

.tab-btn {
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  padding-bottom: 120px;
}

/* ── Footer ───────────────────────────────────── */
.main-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
  padding: 17px 40px;
  z-index: 5;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  gap: 32px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-info {
  text-align: right;
  font-size: 12px;
  color: var(--text3);
  line-height: 1.6;
}

.footer-info p {
  margin: 0;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Form Elements ────────────────────────────── */
.field { margin-bottom: 20px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.field .hint {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 6px;
}

.field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s;
}

.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.field textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.field textarea.prompt { font-family: "JetBrains Mono", Consolas, monospace; font-size: 13px; min-height: 200px; }

/* ── Buttons ──────────────────────────────────── */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

.btn-primary:active {
  transform: scale(0.98);
}

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

.btn-secondary {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-danger {
  background: #ff3b30;
  color: #fff;
}

.btn-danger:hover {
  background: #ff453a;
}

.btn-danger:active {
  transform: scale(0.98);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ── Generate Panel ───────────────────────────── */
.gen-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 20px;
}

.gen-row .field { flex: 1; margin-bottom: 0; }

.gen-status {
  padding: 14px 18px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  display: none;
}

.gen-status.show { display: block; }
.gen-status.running { background: #f0f4ff; color: #4a5eb5; border: 1px solid #c8d4ff; }
.gen-status.done { background: #eafbf0; color: #1a7a3a; border: 1px solid #b4ecc5; }
.gen-status.error { background: #fff0f0; color: #c53030; border: 1px solid #fcc; }

/* ── Slide Editor ─────────────────────────────── */
.slides-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  background: var(--accent-light);
  margin: -24px -28px 16px -28px;
}

.slides-toolbar.sticky-toolbar {
  position: sticky;
  top: -24px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 16px;
}

.slides-hint {
  font-size: 13px;
  color: var(--text2);
  margin-left: auto;
}

.slide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: start;
  cursor: pointer;
  transition: all 0.2s;
}

.slide-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(108, 99, 255, 0.1);
}

.slide-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.slide-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  line-height: 1;
  padding-top: 4px;
}

.slide-body {
  flex: 1;
}

.slide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.slide-meta {
  display: flex;
  gap: 8px;
}

.btn-copy-md {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-copy-md:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.layout-badge, .act-badge {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.layout-badge {
  background: var(--accent-light);
  color: var(--accent);
}

.act-badge {
  background: #f0f0f0;
  color: var(--text2);
}

.slide-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text);
}

.slide-subtitle {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 8px;
}

.slide-preview-bullets {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.6;
  margin-top: 6px;
}

.slide-preview-text {
  font-size: 13px;
  color: var(--text2);
  margin-top: 6px;
  line-height: 1.5;
}

.slide-preview-highlight {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 8px;
}

.slide-preview-code {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 11px;
  background: #f8f8f8;
  padding: 8px;
  border-radius: 4px;
  margin-top: 6px;
  color: var(--text2);
  overflow: hidden;
}

.slide-preview-comparison {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
}

.comp-col {
  flex: 1;
  padding: 6px;
  background: #f8f8f8;
  border-radius: 4px;
  color: var(--text2);
}

.slide-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.btn-edit {
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit:hover {
  background: var(--accent);
  color: #fff;
}

.slide-body textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

/* ── Output List ──────────────────────────────── */
.output-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}

.output-item .out-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.out-icon.html { background: #e44d26; }
.out-icon.pptx { background: #d24726; }

.output-item .out-info { flex: 1; }
.output-item .out-name { font-size: 14px; font-weight: 500; }
.output-item .out-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }

.output-item .out-actions { display: flex; gap: 6px; }

/* ── Empty State ──────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}

.empty h3 { font-size: 18px; margin-bottom: 8px; color: var(--text2); }
.empty p { font-size: 14px; }

/* ── Scrollbar ────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bbb; }

/* ── Save indicator ───────────────────────────── */
.save-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--success);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s;
  z-index: 100;
  pointer-events: none;
}

.save-toast.show { opacity: 1; transform: translateY(0); }

/* ── Modal ────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  text-align: center;
}

.modal.modal-large {
  width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal .modal-sub {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 20px;
}

.all-projects-list {
  flex: 1;
  overflow-y: auto;
  margin: 16px 0;
  text-align: left;
}

.all-project-item {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.all-project-item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.all-project-item .ap-topic {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.all-project-item .ap-meta {
  font-size: 12px;
  color: var(--text3);
}

.modal #qrContainer {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.modal .share-url {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}

.modal .share-url input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
  color: var(--text);
  background: var(--bg);
}

.modal .share-url input:focus { outline: none; border-color: var(--accent); }

.modal .modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.modal .modal-close {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text3);
  cursor: pointer;
  border: none;
  background: none;
}

.modal .modal-close:hover { color: var(--text); }

/* ── Slide Editor Modal ───────────────────────── */
.modal-slide-editor {
  width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.slide-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.slide-editor-header h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.slide-editor-meta {
  display: flex;
  gap: 8px;
}

.slide-layout-badge, .slide-act-badge {
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
}

.slide-layout-badge {
  background: var(--accent-light);
  color: var(--accent);
}

.slide-act-badge {
  background: #f0f0f0;
  color: var(--text2);
}

.slide-editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.editor-field {
  margin-bottom: 20px;
}

.editor-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.editor-field input,
.editor-field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s;
}

.editor-field input:focus,
.editor-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.editor-field textarea {
  resize: vertical;
  line-height: 1.6;
}

.editor-field textarea.code-editor {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 13px;
  background: #f8f8f8;
}

.comparison-field {
  display: inline-block;
  width: 48%;
  vertical-align: top;
}

.comparison-field:nth-child(odd) {
  margin-right: 2%;
}

.bullets-editor, .annotations-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bullet-item, .annotation-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bullet-item input, .annotation-item input {
  flex: 1;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--error);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: #ff5252;
}

/* ── History Modal ─────────────────────────────── */
.history-list {
  flex: 1;
  overflow-y: auto;
  margin: 16px 0;
  text-align: left;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.history-item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.history-info {
  flex: 1;
}

.history-version {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.history-time {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 4px;
}

.history-note {
  font-size: 13px;
  color: var(--text2);
}

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

/* ── Info Content ──────────────────────────────── */
.info-content {
  text-align: left;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text2);
}

.info-content h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 8px 0;
}

.info-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.info-content li {
  margin: 6px 0;
}

.info-content a {
  color: var(--accent);
  text-decoration: none;
}

.info-content a:hover {
  text-decoration: underline;
}

/* ── Login Overlay ────────────────────────────── */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-overlay.hidden { display: none; }

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.login-logo p {
  font-size: 13px;
  color: var(--text3);
  margin-top: 4px;
}

.login-field {
  margin-bottom: 18px;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.captcha-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.captcha-group input {
  flex: 1;
}

.captcha-img {
  width: 140px;
  height: 46px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  object-fit: contain;
  background: #f0f0f5;
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 6px;
}

.login-btn:hover { background: #5a52e0; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
  text-align: center;
  font-size: 13px;
  color: var(--error);
  margin-top: 12px;
  min-height: 20px;
}

/* ── Demo Hint ────────────────────────────────── */
.demo-hint {
  margin-top: 20px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 1px dashed var(--accent);
  border-radius: 10px;
  text-align: left;
}
.demo-hint-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}
.demo-hint-row {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 2px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.demo-hint-row code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: "SF Mono", "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text);
  border: 1px solid var(--border);
}

/* ── Sidebar Footer ───────────────────────────── */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-switch {
  display: block;
  text-align: center;
  padding: 10px;
  background: rgba(108, 99, 255, 0.08);
  color: var(--accent);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-switch:hover {
  background: rgba(108, 99, 255, 0.15);
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text2);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-logout:hover {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
}

.btn-logout:active {
  transform: scale(0.98);
}

/* ── Desktop Logout ───────────────────────────── */
.btn-logout-desktop {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text2);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-logout-desktop:hover {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
}

.btn-logout-desktop:active {
  transform: scale(0.98);
}

/* ── Mobile Header ────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
}

.hamburger {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s;
}

.hamburger:hover { background: var(--bg); }

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-logout {
  padding: 6px 12px;
  background: none;
  color: var(--text3);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

/* ── Sidebar Overlay (mobile) ─────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 149;
}

.sidebar-overlay.show { display: block; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
  body {
    flex-direction: column;
    padding-top: 52px;
  }

  .mobile-header {
    display: flex;
  }

  /* Sidebar: off-canvas by default, slide in */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* Main area */
  .main {
    width: 100%;
    min-height: calc(100vh - 52px);
  }

  .main-header {
    padding: 12px 16px;
  }

  .main-header h2 {
    font-size: 16px;
  }

  /* Desktop logout hidden on mobile */
  .btn-logout-desktop { display: none; }

  /* Tab bar: horizontal scroll */
  .tab-bar {
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tab-bar::-webkit-scrollbar { display: none; }

  .tab-btn {
    padding: 10px 14px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Tab content */
  .tab-content {
    padding: 16px;
    padding-bottom: 80px;
  }

  /* Cards */
  .card {
    padding: 16px;
    margin-bottom: 12px;
  }

  /* Generate row: stack on mobile */
  .gen-row {
    flex-direction: column;
    gap: 12px;
  }

  .gen-row .field { margin-bottom: 0; }

  .gen-row .btn {
    width: 100%;
    justify-content: center;
  }

  /* Slide cards */
  .slide-card {
    grid-template-columns: 44px 1fr;
    gap: 8px;
    padding: 12px;
  }

  .slide-num {
    font-size: 20px;
  }

  /* Slides toolbar: wrap */
  .slides-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
    margin: -16px -16px 12px -16px;
  }

  .slides-hint {
    width: 100%;
    margin-left: 0;
    font-size: 12px;
  }

  /* Output items: wrap actions */
  .output-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .output-item .out-actions {
    width: 100%;
    display: flex;
    gap: 6px;
  }

  .output-item .out-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: 12px;
    padding: 8px 6px;
  }

  /* Modals: full-width on mobile */
  .modal {
    width: 95vw;
    max-width: 95vw;
    padding: 24px 20px;
    border-radius: 16px;
  }

  .modal.modal-large {
    max-height: 85vh;
  }

  .modal-slide-editor {
    width: 95vw;
  }

  /* Comparison fields stack on mobile */
  .comparison-field {
    width: 100%;
    margin-right: 0 !important;
  }

  /* Footer */
  .main-footer {
    padding: 14px 16px;
  }

  .footer-content {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .footer-links {
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .footer-info {
    text-align: center;
  }

  /* Toast */
  .save-toast {
    top: 60px;
    right: 50%;
    transform: translateX(50%) translateY(-10px);
  }
  .save-toast.show { transform: translateX(50%) translateY(0); }

  /* History items */
  .history-item {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  /* Slide preview comparison */
  .slide-preview-comparison {
    flex-direction: column;
    gap: 8px;
  }

  /* Login card */
  .login-card {
    padding: 28px 24px;
    max-width: 340px;
  }

  /* Empty state */
  .empty {
    padding: 40px 16px;
  }
}

/* Small phones */
@media (max-width: 380px) {
  .tab-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  .tab-content {
    padding: 12px;
  }

  .login-card {
    padding: 24px 18px;
  }
}

/* Landscape tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 220px; }
  .tab-content { padding: 20px; }
}
