/*
 * widget.css — Mercurius Ⅰ Chat Widget Styles (Full-Screen Redesign)
 *
 * All classes are namespaced with "merc-" to avoid collisions on host pages.
 */

@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@400;600;700&family=Space+Mono:wght@400;700&display=swap');

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  --merc-navy:       #122e1e;
  --merc-gold:       #C9922A;
  --merc-gold-light: #E8B84B;
  --merc-slate:      #edf4ef;
  --merc-white:      #ffffff;
  --merc-text:       #1a1714;
  --merc-muted:      #6b7a6e;
  --merc-radius:     16px;
  --merc-shadow:     0 20px 60px rgba(0, 0, 0, 0.18);

  /* Derived / internal */
  --merc-gold-dim:   rgba(201, 146, 42, 0.15);
  --merc-navy-dim:   rgba(18, 46, 30, 0.06);
  --merc-green:      #22c55e;
  --merc-yellow:     #eab308;
  --merc-red:        #ef4444;
  --merc-gray:       #94a3b8;
}

/* ============================================================
   Keyframes
   ============================================================ */
@keyframes merc-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes merc-blink {
  0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-3px); }
}

@keyframes merc-slide-down {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes merc-unlock-flash {
  0%   { background: rgba(13, 37, 24, 0.9); }
  20%  { background: rgba(201, 146, 42, 0.35); }
  60%  { background: rgba(201, 146, 42, 0.12); }
  100% { background: rgba(13, 37, 24, 0.9); }
}

/* ============================================================
   Toggle Button  (#merc-toggle)
   ============================================================ */
#merc-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99998;
  height: 48px;
  padding: 0 20px 0 14px;
  border-radius: 24px;
  background: #122e1e;
  border: 1.5px solid rgba(201, 146, 42, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 0 rgba(201,146,42,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
#merc-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(0,0,0,0.45), 0 0 0 4px rgba(201,146,42,0.12);
  border-color: #C9922A;
}

#merc-toggle:active {
  transform: scale(0.96);
}

.merc-monogram {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #C9922A;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.merc-toggle-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(250, 248, 244, 0.85);
  white-space: nowrap;
}

.merc-toggle-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
  animation: merc-pulse-dot 2s ease-in-out infinite;
}

@keyframes merc-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ============================================================
   Full-Screen Panel  (#merc-panel)
   ============================================================ */
#merc-panel {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  display: flex;
  flex-direction: row;
  background: #0f1f14;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
  border: none;
  box-shadow: none;
}

#merc-panel.merc-open {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

/* ============================================================
   Sidebar  (.merc-sidebar)
   ============================================================ */
.merc-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #0d2518;
  border-right: 1px solid rgba(201, 146, 42, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.merc-sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(201, 146, 42, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.merc-sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #122e1e;
  border: 1.5px solid #C9922A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #C9922A;
  flex-shrink: 0;
}

.merc-sidebar-brand-text {
  min-width: 0;
}

.merc-sidebar-brand-name {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #faf8f4;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.merc-sidebar-brand-sub {
  font-family: 'Space Mono', monospace;
  font-size: 9.5px;
  color: rgba(201, 146, 42, 0.6);
  white-space: nowrap;
  margin-top: 1px;
}

.merc-sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,146,42,0.2) transparent;
}

.merc-sidebar-body::-webkit-scrollbar { width: 3px; }
.merc-sidebar-body::-webkit-scrollbar-track { background: transparent; }
.merc-sidebar-body::-webkit-scrollbar-thumb { background: rgba(201,146,42,0.2); border-radius: 2px; }

.merc-sidebar-section {
  margin-bottom: 20px;
}

.merc-sidebar-section-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(201, 146, 42, 0.5);
  padding: 0 6px;
  margin-bottom: 6px;
}

/* Mode buttons */
.merc-mode-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(250, 248, 244, 0.55);
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.merc-mode-btn:hover {
  background: rgba(201, 146, 42, 0.08);
  color: rgba(250, 248, 244, 0.85);
}

.merc-mode-btn.active {
  background: rgba(201, 146, 42, 0.12);
  color: #faf8f4;
}

.merc-mode-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.merc-mode-btn:disabled:hover {
  background: transparent;
  color: rgba(250, 248, 244, 0.55);
}

.merc-mode-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(201, 146, 42, 0.3);
  flex-shrink: 0;
  transition: background 0.15s;
}

.merc-mode-btn.active .merc-mode-dot {
  background: #C9922A;
}

.merc-mode-lock {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.4;
}

/* Tool buttons */
.merc-tool-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(250, 248, 244, 0.5);
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  margin-bottom: 1px;
}

.merc-tool-btn:hover {
  background: rgba(201, 146, 42, 0.07);
  color: rgba(250, 248, 244, 0.8);
}

.merc-tool-btn.tool-active {
  background: rgba(201, 146, 42, 0.1);
  color: #C9922A;
}

.merc-tool-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar footer */
.merc-sidebar-footer {
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(201, 146, 42, 0.12);
  flex-shrink: 0;
}

.merc-streak-badge {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #C9922A;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.merc-info-btn {
  background: none;
  border: none;
  color: rgba(250, 248, 244, 0.35);
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  letter-spacing: 0.03em;
  transition: color 0.15s;
}
.merc-info-btn:hover { color: rgba(250, 248, 244, 0.7); }

/* ============================================================
   Main area  (.merc-main)
   ============================================================ */
.merc-main {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  min-width: 0;
}

.merc-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* Main header */
.merc-main-header {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(201, 146, 42, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(13, 37, 24, 0.5);
}

.merc-main-header-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(250, 248, 244, 0.7);
}

.merc-main-header-mode {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  color: #C9922A;
  background: rgba(201, 146, 42, 0.1);
  border: 1px solid rgba(201, 146, 42, 0.25);
  border-radius: 20px;
  padding: 3px 10px;
  letter-spacing: 0.05em;
}

.merc-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(250, 248, 244, 0.45);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.merc-close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(250, 248, 244, 0.9);
}

/* Flash animation on mode unlock */
.merc-main-header.merc-unlock-flash {
  animation: merc-unlock-flash 1.8s ease forwards;
}

/* ============================================================
   Messages  (.merc-messages)
   ============================================================ */
.merc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,146,42,0.2) transparent;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.merc-messages::-webkit-scrollbar { width: 4px; }
.merc-messages::-webkit-scrollbar-track { background: transparent; }
.merc-messages::-webkit-scrollbar-thumb { background: rgba(201,146,42,0.2); border-radius: 2px; }

/* ============================================================
   Topic Tags  (starter chips)
   ============================================================ */
.merc-topic-tags {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 12px;
}

.merc-topic-tags-label {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(201, 146, 42, 0.5);
  margin-bottom: 4px;
}

.merc-tag {
  background: rgba(201, 146, 42, 0.07);
  border: 1px solid rgba(201, 146, 42, 0.2);
  border-radius: 10px;
  color: rgba(250, 248, 244, 0.7);
  font-family: 'Josefin Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
  max-width: 420px;
  text-align: left;
}

.merc-tag:hover {
  background: rgba(201, 146, 42, 0.14);
  border-color: rgba(201, 146, 42, 0.45);
  color: #faf8f4;
}

/* ============================================================
   Message Bubbles
   ============================================================ */
.merc-msg {
  margin-bottom: 20px;
  animation: merc-fade-in 0.2s ease;
  display: flex;
  flex-direction: column;
}

.merc-msg-user {
  align-items: flex-end;
  max-width: 60%;
  align-self: flex-end;
}

.merc-msg-bot {
  align-items: flex-start;
  max-width: 75%;
  align-self: flex-start;
}

.merc-msg-system {
  align-self: center;
  max-width: 480px;
  width: 100%;
  align-items: center;
}

.merc-msg-notice {
  align-self: center;
  max-width: 480px;
  text-align: center;
  margin-bottom: 16px;
  font-family: 'Space Mono', monospace;
  font-size: 10.5px;
  color: rgba(201, 146, 42, 0.65);
  padding: 6px 16px;
  letter-spacing: 0.03em;
  border-top: 1px solid rgba(201, 146, 42, 0.1);
  border-bottom: 1px solid rgba(201, 146, 42, 0.1);
}

.merc-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
}

.merc-msg-user .merc-bubble {
  background: rgba(201, 146, 42, 0.15);
  border: 1px solid rgba(201, 146, 42, 0.25);
  color: #faf8f4;
  border-radius: 14px 14px 4px 14px;
}

.merc-msg-bot .merc-bubble {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(250, 248, 244, 0.9);
  border-radius: 14px 14px 14px 4px;
}

.merc-msg-system .merc-bubble {
  background: rgba(201, 146, 42, 0.06);
  border: 1px solid rgba(201, 146, 42, 0.15);
  color: rgba(201, 146, 42, 0.8);
  border-radius: 10px;
  font-size: 12px;
  padding: 8px 14px;
  font-family: 'Space Mono', monospace;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

/* Bubble markdown styles */
.merc-bubble h3 { font-size: 14px; font-weight: 700; margin: 10px 0 6px; color: #E8B84B; }
.merc-bubble p { margin: 0 0 8px; }
.merc-bubble p:last-child { margin-bottom: 0; }
.merc-bubble ul, .merc-bubble ol { padding-left: 18px; margin: 6px 0 8px; }
.merc-bubble li { margin-bottom: 4px; }
.merc-bubble code { background: rgba(201,146,42,0.12); border-radius: 4px; padding: 1px 5px; font-family: 'Space Mono', monospace; font-size: 12px; }
.merc-bubble strong { color: rgba(250,248,244,0.95); font-weight: 700; }
.merc-bubble em { font-style: italic; }

/* Timestamp */
.merc-timestamp {
  font-size: 10px;
  color: rgba(250, 248, 244, 0.2);
  font-family: 'Space Mono', monospace;
  margin-top: 4px;
  padding: 0 4px;
}
.merc-msg-user .merc-timestamp { text-align: right; }

/* ============================================================
   Typing Indicator
   ============================================================ */
.merc-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px 14px 14px 4px;
  width: fit-content;
}

.merc-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(201,146,42,0.5);
  animation: merc-blink 1.2s ease-in-out infinite;
}
.merc-typing span:nth-child(2) { animation-delay: 0.2s; }
.merc-typing span:nth-child(3) { animation-delay: 0.4s; }

/* ============================================================
   Confidence Meter
   ============================================================ */
.merc-confidence {
  margin-top: 6px;
  padding: 0 4px;
}

.merc-confidence-label {
  font-size: 10px;
  color: rgba(250,248,244,0.35);
  font-family: 'Space Mono', monospace;
  margin-bottom: 3px;
}

.merc-confidence-unverified {
  font-size: 10px;
  color: rgba(250,248,244,0.2);
  font-family: 'Space Mono', monospace;
}

.merc-confidence-bar-track {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  width: 120px;
}

.merc-confidence-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.merc-conf-green  { background: #4ade80; }
.merc-conf-yellow { background: #eab308; }
.merc-conf-red    { background: #ef4444; }
.merc-conf-gray   { background: #94a3b8; }

/* ============================================================
   Action Buttons
   ============================================================ */
.merc-actions {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 4px;
}

.merc-action-btn {
  background: transparent;
  border: 1px solid rgba(201,146,42,0.2);
  border-radius: 6px;
  color: rgba(250,248,244,0.45);
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}

.merc-action-btn:hover {
  background: rgba(201,146,42,0.08);
  border-color: rgba(201,146,42,0.4);
  color: rgba(250,248,244,0.8);
}

.merc-action-btn:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.merc-action-btn-why {
  border-color: rgba(201,146,42,0.3) !important;
  color: rgba(201,146,42,0.7) !important;
}
.merc-action-btn-why:hover {
  background: rgba(201,146,42,0.1) !important;
  color: #C9922A !important;
}

/* ============================================================
   Source Citation Chips
   ============================================================ */
.merc-source {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(201,146,42,0.1);
  border: 1px solid rgba(201,146,42,0.3);
  color: #C9922A;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  padding: 2px 7px;
  border-radius: 4px;
  margin: 0 2px;
  white-space: nowrap;
  vertical-align: middle;
}

/* ============================================================
   Input Area  (.merc-input-area)
   ============================================================ */
.merc-input-area {
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(201, 146, 42, 0.12);
  background: rgba(13, 37, 24, 0.5);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.merc-textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(201, 146, 42, 0.2);
  border-radius: 12px;
  color: #faf8f4;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 14px;
  padding: 12px 16px;
  outline: none;
  resize: none;
  line-height: 1.5;
  min-height: 48px;
  max-height: 140px;
  transition: border-color 0.15s;
  overflow-y: auto;
}

.merc-textarea:focus {
  border-color: rgba(201, 146, 42, 0.5);
}

.merc-textarea::placeholder {
  color: rgba(250, 248, 244, 0.45);
}

.merc-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #C9922A;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.merc-send-btn:hover { background: #E8B84B; }
.merc-send-btn:active { transform: scale(0.95); }
.merc-send-btn:disabled { background: rgba(201, 146, 42, 0.25); cursor: default; transform: none; }

.merc-send-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #122e1e;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Voice button */
.merc-voice-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(201, 146, 42, 0.2);
  color: rgba(250,248,244,0.4);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.merc-voice-btn:hover {
  border-color: rgba(201, 146, 42, 0.5);
  color: #C9922A;
}

.merc-voice-btn.merc-voice-active {
  background: rgba(239,68,68,0.15);
  border-color: #ef4444;
  color: #ef4444;
}

/* ============================================================
   Right Panel  (.merc-right-panel)
   ============================================================ */
.merc-right-panel {
  width: 0;
  flex-shrink: 0;
  background: #0d2518;
  border-left: 1px solid rgba(201, 146, 42, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s ease;
}

.merc-right-panel.merc-rp-open {
  width: 420px;
}

.merc-rp-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(201, 146, 42, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.merc-rp-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #C9922A;
}

.merc-rp-close {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: none;
  color: rgba(250,248,244,0.4);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.merc-rp-close:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(250,248,244,0.8);
}

.merc-rp-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,146,42,0.2) transparent;
}

.merc-rp-body::-webkit-scrollbar { width: 4px; }
.merc-rp-body::-webkit-scrollbar-track { background: transparent; }
.merc-rp-body::-webkit-scrollbar-thumb { background: rgba(201,146,42,0.2); border-radius: 2px; }

/* ============================================================
   Summary Panel (inside right panel body)
   ============================================================ */
.merc-summary-panel {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 12.5px;
  color: rgba(241,245,249,0.88);
  line-height: 1.6;
}

.merc-summary-panel.merc-hidden { display: none; }

.merc-summary-panel h4 {
  color: #C9922A;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
  font-family: 'Josefin Sans', sans-serif;
}

.merc-summary-panel ul {
  margin: 4px 0 10px;
  padding-left: 16px;
}

.merc-summary-panel li {
  margin-bottom: 4px;
}

/* ============================================================
   Tooltip (About panel)
   ============================================================ */
.merc-tooltip {
  position: absolute;
  bottom: 80px;
  left: 230px;
  width: 280px;
  background: #122e1e;
  border: 1px solid rgba(201,146,42,0.3);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 12px;
  color: rgba(241,245,249,0.85);
  line-height: 1.6;
  z-index: 100001;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: merc-fade-in 0.18s ease;
}

.merc-tooltip.merc-hidden { display: none; }

.merc-tooltip a {
  color: #C9922A;
  text-decoration: none;
}
.merc-tooltip a:hover { text-decoration: underline; }

/* ============================================================
   Quiz styles (in right panel)
   ============================================================ */
.merc-quiz-empty,
.merc-quiz-loading {
  color: rgba(241, 245, 249, 0.4);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 20px 0;
  margin: 0;
}

.merc-quiz-q {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.merc-quiz-q:last-of-type { border-bottom: none; }

.merc-quiz-qtext {
  color: rgba(241,245,249,0.9);
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 10px;
}

.merc-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.merc-quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  color: rgba(241,245,249,0.7);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.merc-quiz-option:hover {
  background: rgba(201,146,42,0.07);
  border-color: rgba(201,146,42,0.2);
}

.merc-quiz-option input[type="radio"] {
  margin-top: 2px;
  accent-color: #C9922A;
  flex-shrink: 0;
}

.merc-quiz-explanation {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border-left: 2px solid #C9922A;
  border-radius: 0 6px 6px 0;
  font-size: 11.5px;
  color: rgba(241,245,249,0.65);
  line-height: 1.5;
}

.merc-quiz-submit {
  display: block;
  width: 100%;
  padding: 11px;
  background: #C9922A;
  color: #122e1e;
  border: none;
  border-radius: 9px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}

.merc-quiz-submit:hover { background: #E8B84B; }

.merc-quiz-result {
  margin-top: 12px;
  padding: 12px;
  background: rgba(201,146,42,0.08);
  border: 1px solid rgba(201,146,42,0.25);
  border-radius: 9px;
  font-size: 13px;
  color: rgba(241,245,249,0.85);
  text-align: center;
  animation: merc-fade-in 0.3s ease;
}

.merc-quiz-score {
  font-family: 'Space Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #C9922A;
  margin-right: 8px;
}

.merc-quiz-correct .merc-quiz-option input:checked + span { color: #4ade80; }
.merc-quiz-wrong .merc-quiz-option input:checked + span { color: #f87171; }

/* ============================================================
   Concept map
   ============================================================ */
.merc-map-svg {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.merc-map-svg svg {
  max-width: 100%;
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
}

.merc-map-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  font-size: 11px;
  font-family: 'Space Mono', monospace;
  padding-bottom: 8px;
}

/* ============================================================
   Report card
   ============================================================ */
.merc-report-grade {
  font-family: 'Space Mono', monospace;
  font-size: 48px;
  font-weight: 700;
  text-align: center;
  margin: 8px 0 4px;
  line-height: 1;
}

.merc-report-summary {
  color: rgba(241,245,249,0.6);
  font-size: 12.5px;
  text-align: center;
  margin: 0 0 16px;
  font-style: italic;
}

.merc-report-bars { margin-bottom: 14px; }

.merc-report-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: rgba(241,245,249,0.65);
}

.merc-report-bar-row > span:first-child {
  width: 100px;
  flex-shrink: 0;
}

.merc-report-bar-row > span:last-child {
  width: 28px;
  text-align: right;
  color: #C9922A;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
}

.merc-report-bar {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}

.merc-report-bar > div {
  height: 100%;
  background: #C9922A;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.merc-report-section { margin-bottom: 12px; }

.merc-report-section-title {
  font-size: 10px;
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}

.merc-report-section ul { margin: 0; padding-left: 16px; }
.merc-report-section li { color: rgba(241,245,249,0.7); font-size: 12px; margin-bottom: 4px; }

.merc-report-next {
  font-size: 12px;
  color: #C9922A;
  border-top: 1px solid rgba(201,146,42,0.15);
  padding-top: 10px;
  margin-top: 6px;
  font-style: italic;
}

/* ============================================================
   Leaderboard
   ============================================================ */
.merc-lb-table { width: 100%; }

.merc-lb-row {
  display: grid;
  grid-template-columns: 28px 1fr 36px 44px 64px;
  align-items: center;
  gap: 6px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 12.5px;
  color: rgba(241,245,249,0.7);
}

.merc-lb-header {
  font-size: 10px;
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(201,146,42,0.6);
  border-bottom: 1px solid rgba(201,146,42,0.2);
}

.merc-lb-badge {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #C9922A;
}

.merc-lb-me {
  background: rgba(201,146,42,0.07);
  border-radius: 6px;
}

/* ============================================================
   Utility
   ============================================================ */
.merc-hidden { display: none !important; }

/* ============================================================
   Mobile  (<768px)
   ============================================================ */
@media (max-width: 768px) {
  .merc-sidebar {
    display: none;
  }

  .merc-right-panel.merc-rp-open {
    width: 100%;
    position: absolute;
    inset: 0;
    z-index: 10;
  }

  .merc-messages {
    padding: 16px;
  }

  .merc-msg-user {
    max-width: 80%;
  }

  .merc-msg-bot {
    max-width: 90%;
  }

  #merc-toggle {
    bottom: 16px;
    right: 16px;
    height: 44px;
    padding: 0 16px 0 12px;
  }
  .merc-toggle-label { font-size: 11px; }
}

/* ============================================================
   Achievement Toast
   ============================================================ */
.merc-achievement-toast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #122e1e;
  border: 1px solid #C9922A;
  border-radius: 10px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9999;
  pointer-events: none;
  min-width: 200px;
  max-width: 300px;
}
.merc-achievement-toast.merc-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.merc-toast-icon { font-size: 20px; flex-shrink: 0; }
.merc-toast-body { display: flex; flex-direction: column; gap: 2px; }
.merc-toast-title {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #C9922A;
}
.merc-toast-name {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

/* ============================================================
   Onboarding Overlay
   ============================================================ */
.merc-onboard {
  position: absolute;
  inset: 0;
  background: rgba(6, 21, 9, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.merc-onboard.merc-onboard-visible {
  opacity: 1;
  pointer-events: all;
}
.merc-onboard-card {
  background: #122e1e;
  border: 1px solid rgba(201,146,42,0.35);
  border-radius: 14px;
  padding: 36px 32px 28px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.merc-onboard-step { display: none; }
.merc-onboard-step.merc-onboard-step-active { display: block; }
.merc-onboard-icon {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #C9922A;
  margin-bottom: 20px;
}
.merc-onboard-card h2 {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.merc-onboard-card p {
  font-size: 13px;
  color: rgba(241,245,249,0.7);
  line-height: 1.6;
  margin-bottom: 16px;
}
.merc-onboard-modes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  text-align: left;
}
.merc-onboard-mode {
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: rgba(241,245,249,0.8);
  line-height: 1.5;
}
.merc-onboard-mode strong { color: #C9922A; }
.merc-onboard-name-input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(201,146,42,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 13px;
  margin-bottom: 16px;
  box-sizing: border-box;
  outline: none;
}
.merc-onboard-name-input:focus { border-color: #C9922A; }
.merc-onboard-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}
.merc-onboard-dots { display: flex; gap: 6px; align-items: center; flex: 1; }
.merc-onboard-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: background 0.2s;
}
.merc-onboard-dot.active { background: #C9922A; }
.merc-onboard-next {
  background: #C9922A;
  color: #061509;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.2s;
}
.merc-onboard-next:hover { background: #E8B84B; }
.merc-onboard-skip {
  background: transparent;
  border: none;
  color: rgba(241,245,249,0.35);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
}
.merc-onboard-skip:hover { color: rgba(241,245,249,0.6); }

/* ============================================================
   Display Name in Sidebar
   ============================================================ */
.merc-display-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  margin-bottom: 8px;
}
.merc-display-name {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  color: rgba(241,245,249,0.3);
  cursor: pointer;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.04em;
}
.merc-display-name.merc-name-set { color: rgba(201,146,42,0.8); }
.merc-name-edit-btn {
  background: none;
  border: none;
  color: rgba(241,245,249,0.25);
  cursor: pointer;
  font-size: 11px;
  padding: 2px;
  line-height: 1;
}
.merc-name-edit-btn:hover { color: #C9922A; }
.merc-name-inline-input {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(201,146,42,0.4);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  color: #fff;
  font-family: 'Josefin Sans', sans-serif;
  outline: none;
  min-width: 0;
}
.merc-name-save-btn {
  background: #C9922A;
  border: none;
  border-radius: 4px;
  color: #061509;
  font-weight: 700;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
}

/* ============================================================
   Message-level actions (bookmark + share)
   ============================================================ */
.merc-msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.merc-msg:hover .merc-msg-actions { opacity: 1; }
.merc-msg-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: rgba(241,245,249,0.35);
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.merc-msg-action-btn:hover {
  color: #C9922A;
  background: rgba(201,146,42,0.08);
}

/* ============================================================
   Tool panels — shared base styles
   ============================================================ */
.merc-tool-panel {
  padding: 4px 0;
}
.merc-tool-instructions {
  font-size: 12px;
  color: rgba(241,245,249,0.55);
  line-height: 1.55;
  margin-bottom: 12px;
}
.merc-tool-textarea {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,146,42,0.25);
  border-radius: 8px;
  padding: 10px 12px;
  color: rgba(241,245,249,0.9);
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 10px;
  line-height: 1.5;
}
.merc-tool-textarea:focus { border-color: rgba(201,146,42,0.6); }
.merc-tool-submit-btn {
  background: #C9922A;
  color: #061509;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  cursor: pointer;
  width: 100%;
  margin-bottom: 16px;
  transition: background 0.2s;
}
.merc-tool-submit-btn:hover { background: #E8B84B; }
.merc-tool-submit-btn:disabled { background: rgba(201,146,42,0.35); cursor: not-allowed; }

/* ============================================================
   Fact Check result
   ============================================================ */
.merc-fc-result-card { padding: 4px 0; }
.merc-fc-verdict {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.merc-fc-summary {
  font-size: 13px;
  color: rgba(241,245,249,0.85);
  line-height: 1.55;
  margin-bottom: 12px;
}
.merc-fc-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.merc-fc-item {
  font-size: 12px;
  color: rgba(241,245,249,0.75);
  line-height: 1.5;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
}
.merc-fc-nuances {
  font-size: 12px;
  color: rgba(241,245,249,0.6);
  line-height: 1.55;
  margin-bottom: 10px;
}
.merc-fc-lesson {
  background: rgba(201,146,42,0.1);
  border-left: 3px solid #C9922A;
  padding: 10px 12px;
  font-size: 12px;
  color: rgba(241,245,249,0.8);
  border-radius: 0 6px 6px 0;
  line-height: 1.55;
}

/* ============================================================
   Challenge panel
   ============================================================ */
.merc-challenge-card { margin-bottom: 8px; }
.merc-challenge-label {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #C9922A;
  margin-bottom: 8px;
}
.merc-challenge-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.merc-challenge-desc {
  font-size: 12px;
  color: rgba(241,245,249,0.65);
  line-height: 1.55;
  margin-bottom: 12px;
}
.merc-challenge-questions { margin-bottom: 14px; }
.merc-challenge-q-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(241,245,249,0.4);
  margin-bottom: 6px;
}
.merc-challenge-questions ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.merc-challenge-questions li {
  font-size: 12px;
  color: rgba(241,245,249,0.75);
  line-height: 1.5;
  padding-left: 12px;
  position: relative;
}
.merc-challenge-questions li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: #C9922A;
}
.merc-briefing-card { margin-top: 8px; }
.merc-briefing-card h4 {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.merc-briefing-date {
  font-size: 11px;
  color: #C9922A;
  margin-bottom: 12px;
}
.merc-briefing-bullet {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
}
.merc-briefing-bullet strong {
  display: block;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #C9922A;
  margin-bottom: 4px;
}
.merc-briefing-bullet p {
  font-size: 12px;
  color: rgba(241,245,249,0.75);
  line-height: 1.55;
  margin: 0;
}
.merc-briefing-key-q {
  background: rgba(201,146,42,0.1);
  border-left: 3px solid #C9922A;
  padding: 10px 12px;
  font-size: 12px;
  color: rgba(241,245,249,0.85);
  border-radius: 0 6px 6px 0;
  line-height: 1.55;
  margin-top: 4px;
}

/* ============================================================
   Curriculum panel
   ============================================================ */
.merc-curriculum-panel { display: flex; flex-direction: column; gap: 8px; }
.merc-unit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.merc-unit-card:hover {
  background: rgba(201,146,42,0.08);
  border-color: rgba(201,146,42,0.3);
}
.merc-unit-card.merc-unit-in-progress { border-color: rgba(96,165,250,0.4); }
.merc-unit-card.merc-unit-complete { border-color: rgba(74,222,128,0.4); }
.merc-unit-num {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #C9922A;
  flex-shrink: 0;
  width: 20px;
}
.merc-unit-body { flex: 1; min-width: 0; }
.merc-unit-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.merc-unit-desc {
  font-size: 11px;
  color: rgba(241,245,249,0.5);
  line-height: 1.45;
}
.merc-unit-status {
  font-size: 10px;
  color: rgba(241,245,249,0.4);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================
   Achievements panel
   ============================================================ */
.merc-achievements-panel { padding: 4px 0; }
.merc-achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.merc-achievement-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-align: center;
  cursor: default;
  transition: background 0.2s;
}
.merc-achievement-earned {
  background: rgba(201,146,42,0.1);
  border-color: rgba(201,146,42,0.25);
}
.merc-achievement-locked {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
  opacity: 0.5;
}
.merc-achievement-icon { font-size: 20px; }
.merc-achievement-name {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(241,245,249,0.75);
  line-height: 1.3;
}

/* ============================================================
   Bookmarks panel
   ============================================================ */
.merc-bookmarks-panel { display: flex; flex-direction: column; gap: 8px; }
.merc-bookmark-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 10px 12px;
}
.merc-bookmark-text {
  font-size: 12px;
  color: rgba(241,245,249,0.75);
  line-height: 1.5;
  margin-bottom: 8px;
}
.merc-bookmark-actions { display: flex; gap: 8px; }
.merc-bookmark-copy, .merc-bookmark-delete {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: rgba(241,245,249,0.5);
  font-size: 11px;
  cursor: pointer;
  padding: 3px 8px;
  transition: color 0.15s, border-color 0.15s;
}
.merc-bookmark-copy:hover { color: #C9922A; border-color: rgba(201,146,42,0.4); }
.merc-bookmark-delete:hover { color: #f87171; border-color: rgba(248,113,113,0.4); }

/* ============================================================
   Focus-visible outlines (accessibility)
   ============================================================ */
#merc-panel button:focus-visible,
#merc-panel a:focus-visible,
#merc-panel input:focus-visible,
#merc-panel textarea:focus-visible {
  outline: 2px solid #C9922A;
  outline-offset: 2px;
}

/* ============================================================
   Loading spinner
   ============================================================ */
@keyframes merc-spin {
  to { transform: rotate(360deg); }
}
.merc-quiz-loading::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(201, 146, 42, 0.2);
  border-top-color: #C9922A;
  border-radius: 50%;
  animation: merc-spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* ============================================================
   Leaderboard: highlight current user
   ============================================================ */
.merc-lb-row.merc-lb-me {
  background: rgba(201, 146, 42, 0.12);
  border-left: 3px solid #C9922A;
}

/* ============================================================
   Curriculum progress bar + mark complete button
   ============================================================ */
.merc-curriculum-progress {
  margin-bottom: 14px;
}
.merc-curriculum-progress-text {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: rgba(241, 245, 249, 0.5);
  margin-bottom: 6px;
}
.merc-curriculum-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}
.merc-curriculum-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #C9922A, #E8B84B);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.merc-unit-complete-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 10px;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #C9922A;
  background: rgba(201, 146, 42, 0.1);
  border: 1px solid rgba(201, 146, 42, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.merc-unit-complete-btn:hover {
  background: rgba(201, 146, 42, 0.2);
  border-color: rgba(201, 146, 42, 0.5);
}

/* ============================================================
   Curriculum: unit header + expandable lessons
   ============================================================ */
.merc-unit-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 2px 0;
}
.merc-lessons-list {
  margin-top: 8px;
  border-top: 1px solid rgba(201, 146, 42, 0.15);
  padding-top: 8px;
}
.merc-lessons-list.merc-hidden { display: none; }
.merc-lesson-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 8px;
  transition: background 0.15s;
}
.merc-lesson-row:hover { background: rgba(255, 255, 255, 0.03); }
.merc-lesson-row.merc-lesson-done { opacity: 0.5; }
.merc-lesson-row.merc-lesson-next { background: rgba(201, 146, 42, 0.08); }
.merc-lesson-num {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: #C9922A;
  min-width: 18px;
  text-align: center;
}
.merc-lesson-info { flex: 1; }
.merc-lesson-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: rgba(241, 245, 249, 0.85);
}
.merc-lesson-obj {
  font-size: 10px;
  color: rgba(241, 245, 249, 0.4);
  margin-top: 2px;
}
.merc-lesson-status {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  min-width: 24px;
  text-align: center;
}
.merc-lesson-status-done { color: #4ade80; }
.merc-lesson-status-locked { color: rgba(241, 245, 249, 0.15); }
.merc-lesson-start-btn {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0f1f14;
  background: #C9922A;
  border: none;
  border-radius: 6px;
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.merc-lesson-start-btn:hover { background: #E8B84B; }

/* ============================================================
   Offline overlay
   ============================================================ */
#merc-offline-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 31, 20, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
}
.merc-offline-box {
  text-align: center;
  max-width: 320px;
  padding: 40px;
}
.merc-offline-icon {
  font-family: 'Space Mono', monospace;
  font-size: 2.5rem;
  color: rgba(201, 146, 42, 0.4);
  margin-bottom: 16px;
}
.merc-offline-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: rgba(241, 245, 249, 0.85);
  margin-bottom: 10px;
}
.merc-offline-desc {
  font-size: 12px;
  color: rgba(241, 245, 249, 0.45);
  line-height: 1.6;
  margin-bottom: 24px;
}
.merc-offline-retry {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #0f1f14;
  background: #C9922A;
  border: none;
  border-radius: 6px;
  padding: 10px 28px;
  cursor: pointer;
  transition: background 0.15s;
}
.merc-offline-retry:hover { background: #E8B84B; }

/* ============================================================
   Conversation history sidebar
   ============================================================ */
.merc-new-chat-btn {
  color: #C9922A !important;
  border: 1px dashed rgba(201, 146, 42, 0.3) !important;
  background: transparent !important;
  text-align: center !important;
}
.merc-new-chat-btn:hover {
  border-color: rgba(201, 146, 42, 0.6) !important;
  background: rgba(201, 146, 42, 0.08) !important;
}
.merc-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}
.merc-history-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.merc-history-item:hover { background: rgba(255, 255, 255, 0.05); }
.merc-history-item.merc-history-active {
  background: rgba(201, 146, 42, 0.1);
  border-left: 2px solid #C9922A;
}
.merc-history-title {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: rgba(241, 245, 249, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.merc-history-meta {
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  color: rgba(241, 245, 249, 0.25);
}
.merc-history-empty {
  font-size: 10px;
  color: rgba(241, 245, 249, 0.2);
  padding: 8px 10px;
  font-style: italic;
}

/* ============================================================
   Streaming cursor + offline fallback
   ============================================================ */
.merc-stream-cursor {
  display: inline-block;
  width: 6px;
  height: 14px;
  background: #C9922A;
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: merc-blink 0.8s step-end infinite;
}
@keyframes merc-blink {
  50% { opacity: 0; }
}
.merc-msg-streaming .merc-bubble {
  border-color: rgba(201, 146, 42, 0.3);
}
.merc-offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100000;
  background: #7f1d1d;
  color: #fecaca;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 12px;
  text-align: center;
  padding: 8px 16px;
  display: none;
}
.merc-offline-banner.merc-visible {
  display: block;
}
.merc-offline-retry {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-family: 'Josefin Sans', sans-serif;
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 4px;
  margin-left: 10px;
  cursor: pointer;
}
.merc-offline-retry:hover {
  background: rgba(255,255,255,0.25);
}
