/* KUBE MIND — Study tools, modals, print, shortcuts */

.topbar-study-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.topbar-study-btn:hover {
  color: var(--phase-light);
  border-color: var(--phase);
}

.kube-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 24px;
  overflow-y: auto;
}
.kube-modal-overlay.open {
  display: flex;
}

.kube-modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: min(560px, 100%);
  max-height: calc(100vh - 100px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.kube-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kube-modal-head h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
}
.kube-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}
.kube-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.trap-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  min-height: 160px;
  cursor: pointer;
  transition: transform 0.2s;
}
.trap-card:hover {
  border-color: var(--phase);
}
.trap-card-q {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}
.trap-card-a {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--phase-light);
  line-height: 1.6;
}
.trap-card.flipped .trap-card-a {
  display: block;
}
.trap-nav {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.trap-nav button {
  flex: 1;
  min-width: 100px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg4);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.trap-nav button.primary {
  background: var(--phase-dim);
  border-color: var(--phase);
  color: var(--phase-light);
}

.practice-q {
  font-size: 15px;
  line-height: 1.65;
  margin-bottom: 16px;
}
.practice-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.practice-opt {
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.practice-opt:hover {
  border-color: var(--phase);
}
.practice-opt.correct {
  border-color: var(--green, #10b981);
  background: rgba(16, 185, 129, 0.12);
}
.practice-opt.wrong {
  border-color: var(--red, #ef4444);
  background: rgba(239, 68, 68, 0.1);
}
.practice-score {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
}

.shortcuts-grid {
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.shortcuts-grid kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg4);
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
}

.dashboard-progress {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.dash-phase-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg3);
  border-radius: 10px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}
.dash-phase-row:hover {
  border-color: var(--phase, #0078d4);
  transform: translateX(4px);
}
.dash-phase-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-phase-info {
  flex: 1;
}
.dash-phase-name {
  font-weight: 600;
  font-size: 14px;
}
.dash-phase-detail {
  font-size: 10px;
  color: var(--text-dim, #5a6478);
  font-family: var(--font-mono, monospace);
  margin-top: 2px;
}

/* ── Exam Q&A try-first mode ── */
.qa-try-panel {
  padding: 12px 16px 14px 48px;
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  visibility: visible !important;
  max-height: none !important;
  overflow: visible !important;
}
.qa-item:not(.open) .qa-answer {
  max-height: 0 !important;
  overflow: hidden !important;
}
.qa-opt-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.qa-opt-btn:hover:not(:disabled) {
  border-color: var(--phase, #50a8e8);
}
.qa-opt-btn.correct {
  border-color: var(--green, #10b981);
  background: rgba(16, 185, 129, 0.12);
}
.qa-opt-btn.wrong {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}
.qa-opt-btn:disabled {
  cursor: default;
  opacity: 0.85;
}
.qa-reveal-btn {
  align-self: flex-start;
  padding: 6px 12px;
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  color: var(--text-muted);
  background: none;
  border: 1px dashed var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.qa-reveal-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
.qa-item.qa-solved .qa-q-badge {
  background: rgba(16, 185, 129, 0.2);
  color: var(--green, #10b981);
}
.qa-try-status {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 4px;
  font-family: var(--font-mono, monospace);
}

/* ── Per-section reading checklist ── */
.kube-section-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 20px;
}
.kube-chk {
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  color: var(--text-dim, #5a6478);
  background: var(--bg3, #1c2333);
}
.kube-chk.done {
  border-color: rgba(16, 185, 129, 0.45);
  color: var(--green, #10b981);
  background: rgba(16, 185, 129, 0.08);
}
.kube-chk.topic-done {
  font-weight: 600;
}

/* ── Dashboard badges ── */
.dash-badge {
  font-size: 9px;
  font-family: var(--font-mono, monospace);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 600;
}
.dash-badge.reading {
  color: #50a8e8;
  border: 1px solid rgba(80, 168, 232, 0.4);
  background: rgba(80, 168, 232, 0.1);
}
.dash-badge.exam {
  color: var(--green, #10b981);
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.1);
}
.dash-phase-bar {
  height: 4px;
  background: var(--bg4);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.dash-phase-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s;
}
.dash-phase-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.resume-banner {
  display: none;
  margin: 0 auto 24px;
  max-width: 900px;
  padding: 12px 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.resume-banner.show {
  display: flex;
}
.resume-banner a {
  color: var(--azure-light, #50a8e8);
  font-weight: 600;
  text-decoration: none;
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 100px;
  z-index: 400;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  font-size: 16px;
}
.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
}
body.kube-tts-active .back-to-top {
  bottom: 100px;
}

/* ── Brand: consistent KUBE logo on every page ── */
.topbar-logo .logo-text,
.nav-logo .logo-text {
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: 18px !important;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, #50a8e8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}
.topbar-logo .logo-cube,
.nav-logo .logo-cube {
  width: 28px !important;
  height: 28px !important;
  flex-shrink: 0;
}
.topbar-logo .logo-cube svg,
.nav-logo .logo-cube svg {
  width: 28px !important;
  height: 28px !important;
}
.topbar-logo,
.nav-logo {
  gap: 10px !important;
}

/* Phase topbar — unified tab dots + layout (matches phase 1–2) */
.tab-p1 .dot { background: #7c3aed; }
.tab-p2 .dot { background: #0078d4; }
.tab-p3 .dot { background: #059669; }
.tab-p4 .dot { background: #d97706; }
.tab-p5 .dot { background: #00bcf2; }

.phase-tab {
  font-family: var(--font-body, 'DM Sans', sans-serif);
}

.topbar-logo {
  gap: 10px !important;
  min-width: var(--sidebar-w, 280px);
}

/* Phase topbar — hide tab row scrollbar only (full tab labels & logo unchanged) */
.phase-tabs {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.phase-tabs::-webkit-scrollbar {
  display: none;
  height: 0;
}

.topbar-right {
  flex-shrink: 0;
}

/* Footer brand — same azure gradient as top (not phase orange/green/etc.) */
.social-brand-name,
.social-brand .logo-text {
  font-family: var(--font-display, 'Syne', sans-serif) !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, #fff 30%, #50a8e8) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  letter-spacing: 2px !important;
}
.social-brand .logo-mind,
.social-brand > span:not(.logo-text):not(.brand-lockup) {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: rgba(80, 168, 232, 0.9) !important;
  letter-spacing: 3px !important;
}
.brand-lockup--footer {
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
}
.social-logo-cube {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.social-logo-cube svg {
  width: 32px !important;
  height: 32px !important;
}
.footer-copy span,
.page-footer .footer-copy span {
  color: rgba(80, 168, 232, 0.85) !important;
}

/* ── Site footer (index + phase pages) ── */
.site-footer.social-footer,
.page-footer .social-footer {
  padding: 40px 0 32px;
  text-align: center;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  margin-top: 24px;
}

.social-footer .social-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.social-footer .social-brand-name {
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--phase-light, var(--azure-light, #50a8e8)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.social-tagline {
  font-size: 12px;
  color: var(--text-muted, #8892a4);
  margin-bottom: 24px;
  font-family: var(--font-mono, monospace);
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--bg2, #111827);
  color: var(--text-muted, #8892a4);
  text-decoration: none;
  font-size: 12px;
  font-family: var(--font-body, 'DM Sans', sans-serif);
  transition: all 0.2s;
}

.social-link:hover {
  border-color: var(--phase-light, var(--azure-light, #50a8e8));
  color: var(--text, #e8edf5);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.social-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.social-link.linkedin:hover {
  border-color: #0077b5;
  color: #0077b5;
}
.social-link.instagram:hover {
  border-color: #e4405f;
  color: #e4405f;
}
.social-link.gmail:hover {
  border-color: #ea4335;
  color: #ea4335;
}
.social-link.facebook:hover {
  border-color: #1877f2;
  color: #1877f2;
}

.footer-copy {
  font-size: 11px;
  color: var(--text-dim, #5a6478);
  font-family: var(--font-mono, monospace);
}

.built-with-love {
  font-size: 11px;
  color: var(--text-dim, #5a6478);
  margin-top: 4px;
  font-family: var(--font-mono, monospace);
}

.built-with-love .heart {
  color: #ef4444;
  animation: kube-heartbeat 1.5s ease-in-out infinite;
}

@keyframes kube-heartbeat {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
}

.brand-lockup {
  display: inline-flex;
  align-items: flex-end;
  gap: 6px;
}
.logo-mind-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
}
.logo-mind-wrap .logo-mind {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: 12px;
  font-weight: 700;
  color: rgba(80, 168, 232, 0.9);
  letter-spacing: 3px;
}
.logo-track {
  font-family: var(--font-mono, monospace);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim, #5a6478);
  margin-top: 2px;
  white-space: nowrap;
}

/* ── Sidebar collapse button on blade ── */
.sidebar-collapse-btn {
  position: absolute;
  top: 14px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: var(--bg3, #1c2333);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  z-index: 5;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
  color: var(--phase-light, #50a8e8);
  border-color: var(--phase, #0078d4);
}
.sidebar .sidebar-header {
  position: relative;
  padding-right: 44px;
}
.sidebar {
  scrollbar-width: thin;
  scrollbar-color: #2a3548 #111827;
}
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: #111827;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #2a3548;
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: #3d4a63;
}

.sidebar.collapsed {
  width: 52px !important;
  min-width: 52px;
  overflow: hidden;
}
.sidebar.collapsed .sidebar-phase-badge,
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-weight,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-progress {
  display: none !important;
}
.sidebar.collapsed .sidebar-header {
  padding: 12px 8px;
  min-height: 52px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.sidebar.collapsed .sidebar-collapse-btn {
  position: static;
  margin: 0 auto;
}
.main.expanded {
  margin-left: 52px !important;
}
@media (max-width: 900px) {
  .sidebar-collapse-btn {
    display: none;
  }
}

/* ── Index scroll hint ── */
.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-muted, #8892a4);
  font-size: 12px;
  letter-spacing: 0.5px;
  animation: scrollHintPulse 2s ease-in-out infinite;
  z-index: 2;
}
.scroll-hint:hover {
  color: var(--azure-light, #50a8e8);
}
.scroll-hint-arrow {
  font-size: 18px;
  line-height: 1;
  animation: scrollHintBounce 1.5s ease-in-out infinite;
}
@keyframes scrollHintPulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}
@keyframes scrollHintBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
}

.kube-tts-voice-menu {
  min-width: 200px;
  max-height: 220px;
  overflow-y: auto;
}
.tts-chunk-line {
  margin: 0 0 8px;
  padding: 4px 0;
  opacity: 0.55;
}
.tts-chunk-line.active {
  opacity: 1;
  color: var(--phase-light, #50a8e8);
  border-left: 2px solid var(--phase);
  padding-left: 8px;
}

/* Per-section topic feedback — hidden; end-of-page reaction + note form stays */
.topic-feedback {
  display: none !important;
}

/* ── KUBE study assistant (bottom-right chat) ── */
#kubeChatFab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 450;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(80, 168, 232, 0.45);
  background: linear-gradient(135deg, #0078d4, #50a8e8);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 120, 212, 0.35);
  transition: transform 0.2s;
}
#kubeChatFab:hover {
  transform: scale(1.05);
}
body.kube-tts-active #kubeChatFab {
  bottom: 96px;
}
#kubeChatPanel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 451;
  width: min(360px, calc(100vw - 32px));
  max-height: min(480px, calc(100vh - 120px));
  background: var(--bg2, #111827);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 16px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
body.kube-tts-active #kubeChatPanel {
  bottom: 160px;
}
#kubeChatPanel.open {
  display: flex;
}
.kube-chat-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.kube-chat-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.kube-chat-settings {
  background: none;
  border: none;
  color: var(--text-muted, #8892a4);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.kube-chat-settings:hover {
  color: var(--text, #e8edf5);
}
.kube-chat-settings-panel {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--bg3, #1c2333);
  font-size: 12px;
}
.kube-chat-settings-panel label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted, #8892a4);
  font-size: 11px;
}
.kube-chat-settings-panel select,
.kube-chat-settings-panel input[type='password'] {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--bg2, #111827);
  color: var(--text, #e8edf5);
  font-size: 12px;
}
.kube-chat-settings-panel button#kubeGeminiSave {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: #0078d4;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  margin-bottom: 8px;
}
.kube-chat-settings-note {
  margin: 0;
  font-size: 10px;
  line-height: 1.45;
  color: var(--text-muted, #8892a4);
}
.kube-chat-settings-panel a {
  color: #50a8e8;
}
.kube-chat-msg code {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 4px;
  border-radius: 4px;
}
.kube-chat-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.kube-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted, #8892a4);
  animation: kube-chat-bounce 1.2s ease-in-out infinite;
}
.kube-chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.kube-chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes kube-chat-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}
.kube-chat-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.kube-chat-head strong {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: 14px;
}
.kube-chat-head span {
  font-size: 10px;
  color: var(--text-muted, #8892a4);
  font-family: var(--font-mono, monospace);
}
.kube-chat-close {
  background: none;
  border: none;
  color: var(--text-muted, #8892a4);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.kube-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kube-chat-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text, #e8edf5);
}
.kube-chat-msg.bot {
  align-self: flex-start;
  background: var(--bg3, #1c2333);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.kube-chat-msg.user {
  align-self: flex-end;
  background: rgba(0, 120, 212, 0.2);
  border: 1px solid rgba(80, 168, 232, 0.35);
}
.kube-chat-msg a {
  color: #50a8e8;
  text-decoration: none;
}
.kube-chat-msg a:hover {
  text-decoration: underline;
}
.kube-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.kube-chat-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--bg3, #1c2333);
  color: var(--text, #e8edf5);
  font-family: var(--font-body, 'DM Sans', sans-serif);
  font-size: 13px;
}
.kube-chat-form button {
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  background: #0078d4;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Supabase auth gate ── */
html.kube-auth-locked body {
  overflow: hidden;
}
#kubeAuthGate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 70% 50% at 30% 20%, rgba(124, 58, 237, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(0, 120, 212, 0.15), transparent 60%),
    rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(12px);
}
.kube-auth-card {
  width: min(400px, 100%);
  padding: 28px 26px;
  border-radius: 18px;
  border: 1px solid rgba(80, 168, 232, 0.25);
  background: var(--bg2, #111827);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
.kube-auth-brand {
  text-align: center;
  margin-bottom: 8px;
}
.kube-auth-logo {
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, #0078d4, #50a8e8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.kube-auth-brand p {
  font-size: 12px;
  color: var(--text-muted, #8892a4);
  margin-top: 4px;
}
.kube-auth-lead {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted, #8892a4);
  text-align: center;
  margin: 12px 0 18px;
}
.kube-auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.kube-auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--bg3, #1c2333);
  color: var(--text-muted, #8892a4);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.kube-auth-tab.active {
  border-color: rgba(80, 168, 232, 0.45);
  color: var(--text, #e8edf5);
  background: rgba(0, 120, 212, 0.15);
}
.kube-auth-form label {
  display: block;
  font-size: 11px;
  color: var(--text-muted, #8892a4);
  margin-bottom: 4px;
  margin-top: 10px;
}
.kube-auth-form input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--bg3, #1c2333);
  color: var(--text, #e8edf5);
  font-size: 14px;
}
.kube-auth-hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-muted, #8892a4);
  line-height: 1.4;
}
.kube-auth-error {
  margin-top: 12px;
  font-size: 12px;
  color: #f87171;
}
.kube-auth-info {
  margin-top: 12px;
  font-size: 12px;
  color: #50a8e8;
  line-height: 1.45;
}
.kube-auth-submit {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #0078d4, #50a8e8);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.kube-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.kube-auth-user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
}
.kube-auth-user-label {
  font-size: 11px;
  color: var(--text-muted, #8892a4);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
}
.kube-auth-signout {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--bg3, #1c2333);
  color: var(--text-muted, #8892a4);
  font-size: 10px;
  cursor: pointer;
}
.kube-auth-signout:hover {
  color: var(--text, #e8edf5);
  border-color: rgba(80, 168, 232, 0.35);
}

@media print {
  .topbar,
  .sidebar,
  .sidebar-toggle,
  .scroll-progress,
  .listen-chip,
  #kubeTtsBar,
  .page-footer,
  .topic-feedback,
  .kube-modal-overlay,
  .back-to-top,
  .topbar-study-btn,
  #kubeChatFab,
  #kubeChatPanel,
  #kubeAuthGate,
  .kube-auth-user-menu {
    display: none !important;
  }
  .main {
    margin: 0 !important;
    padding: 20px !important;
    max-width: none !important;
  }
  body {
    background: #fff;
    color: #111;
  }
  .section-title,
  .concept-card,
  table {
    break-inside: avoid;
  }
}
