@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --sm-bg: #1d2839;
  --sm-surface: #233247;
  --sm-card: #273c58;
  --sm-border: #2a5484;
  --sm-green: #10b981;
  --sm-green-light: #34d399;
  --sm-blue: #0ea5e9;
  --sm-gold: #fbbf24;
  --sm-red: #f87171;
  --sm-purple: #8b5cf6;
  --sm-text: #e8f4fc;
  --sm-muted: #86b3d0;
  --sm-radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body.sm-hub, body.sm-body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--sm-bg);
  color: var(--sm-text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Hub */
.sm-hub-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--sm-border);
  background: #1d2839ee; backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 50;
}
.sm-hub-hero {
  text-align: center; padding: 48px 24px 32px;
  background: linear-gradient(180deg, #10b98114 0%, transparent 60%);
}
.sm-hub-badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: var(--sm-green); border: 1px solid #10b98144; padding: 6px 14px;
  border-radius: 20px; margin-bottom: 16px;
}
.sm-hub-hero h1 {
  font-size: clamp(1.8rem, 5vw, 2.4rem); font-weight: 700;
  background: linear-gradient(135deg, var(--sm-green-light), var(--sm-blue));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 12px;
}
.sm-hub-hero p { color: var(--sm-muted); max-width: 600px; margin: 0 auto; font-size: 15px; }
.sm-hub-content { padding: 0 24px 48px; max-width: 860px; margin: 0 auto; }
.sm-hub-footer { text-align: center; padding: 24px; font-size: 12px; color: var(--sm-muted); border-top: 1px solid var(--sm-border); }
.sm-hub-footer a { color: var(--sm-green-light); text-decoration: none; }
.sm-breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--sm-muted); margin-bottom: 24px; flex-wrap: wrap; }
.sm-breadcrumb a { color: var(--sm-green-light); text-decoration: none; }

.sm-stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 28px; }
.sm-stat-box { text-align: center; padding: 16px; background: var(--sm-card); border-radius: 12px; border: 1px solid var(--sm-border); }
.sm-stat-box .num { font-size: 24px; font-weight: 700; color: var(--sm-green-light); font-family: 'IBM Plex Mono', monospace; }
.sm-stat-box .lbl { font-size: 11px; color: var(--sm-muted); margin-top: 4px; }

.sm-stat-pill {
  display: flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: 20px; background: var(--sm-surface); border: 1px solid var(--sm-border);
  font-size: 11px; font-weight: 600;
}
.sm-stat-pill i { color: var(--sm-gold); font-size: 10px; }

.sm-section-title {
  font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--sm-green-light); margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}

/* Revision mode hero card */
.sm-revision-hero {
  display: block; text-decoration: none; color: inherit;
  background: linear-gradient(135deg, #064e3b 0%, var(--sm-card) 60%);
  border: 1px solid var(--sm-green); border-radius: 20px; padding: 28px;
  margin-bottom: 28px; transition: transform 0.25s, box-shadow 0.25s;
}
.sm-revision-hero:hover { transform: translateY(-3px); box-shadow: 0 0 30px #10b98122; }
.sm-revision-hero h2 { font-size: 1.3rem; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.sm-revision-hero h2 i { color: var(--sm-gold); }
.sm-revision-hero p { font-size: 14px; color: var(--sm-muted); margin-bottom: 14px; }
.sm-revision-hero .sm-cta { font-size: 14px; font-weight: 600; color: var(--sm-green-light); }

/* Chapter cards */
.sm-chapter-card {
  display: flex; align-items: stretch; gap: 16px; text-decoration: none; color: inherit;
  background: var(--sm-card); border: 1px solid var(--sm-border); border-radius: var(--sm-radius);
  padding: 20px; margin-bottom: 14px; transition: all 0.25s; position: relative; overflow: hidden;
}
.sm-chapter-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--ch-color, var(--sm-green));
}
.sm-chapter-card:hover { border-color: var(--ch-color, var(--sm-green)); transform: translateX(4px); }
.sm-chapter-num { font-size: 11px; font-weight: 800; color: var(--sm-muted); font-family: 'IBM Plex Mono', monospace; }
.sm-chapter-icon {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  background: var(--ch-color, var(--sm-green)); background: color-mix(in srgb, var(--ch-color, #10b981) 20%, transparent);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--ch-color, var(--sm-green));
}
.sm-chapter-body { flex: 1; min-width: 0; }
.sm-chapter-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sm-chapter-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--sm-muted); text-transform: uppercase; }
.sm-chapter-body h3 { font-size: 1rem; font-weight: 700; line-height: 1.35; }
.sm-chapter-body > p { font-size: 13px; color: var(--sm-muted); margin: 6px 0 10px; }
.sm-chapter-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; color: var(--sm-muted); }
.sm-chapter-meta i { margin-right: 4px; color: var(--sm-green); }
.sm-chapter-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 11px; color: var(--sm-muted); }
.sm-chapter-progress-bar { flex: 1; height: 4px; background: var(--sm-surface); border-radius: 2px; overflow: hidden; }
.sm-chapter-progress-bar div { height: 100%; background: var(--ch-color, var(--sm-green)); border-radius: 2px; transition: width 0.4s; }
.sm-ch-score { font-size: 11px; color: var(--sm-gold); margin-top: 6px; display: block; }
.sm-chapter-arrow { display: flex; align-items: center; color: var(--sm-muted); font-size: 14px; }

.sm-badge {
  font-size: 10px; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap;
}
.sm-badge.done { background: #10b98122; color: var(--sm-green-light); border: 1px solid #10b98144; }
.sm-badge.progress { background: #0ea5e922; color: var(--sm-blue); border: 1px solid #0ea5e944; }
.sm-badge.new { background: var(--sm-surface); color: var(--sm-muted); border: 1px solid var(--sm-border); }

/* Analytics */
.sm-analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.sm-analytics-card {
  background: var(--sm-surface); border: 1px solid var(--sm-border); border-radius: var(--sm-radius);
  padding: 18px; text-align: center;
}
.sm-analytics-card.highlight { border-color: var(--sm-green); background: #10b98110; }
.sm-analytics-icon { font-size: 20px; color: var(--sm-green); margin-bottom: 8px; }
.sm-analytics-stat { font-size: 1.6rem; font-weight: 700; font-family: 'IBM Plex Mono', monospace; }
.sm-analytics-lbl { font-size: 11px; color: var(--sm-muted); margin-top: 4px; }
.sm-analytics-section { background: var(--sm-card); border: 1px solid var(--sm-border); border-radius: var(--sm-radius); padding: 20px; margin-bottom: 16px; }
.sm-analytics-section h3 { font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; color: var(--sm-green-light); }
.sm-analytics-row { margin-bottom: 14px; }
.sm-analytics-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.sm-analytics-ch-num { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 6px; }
.sm-analytics-bars { display: grid; gap: 4px; }
.sm-bar-group { display: grid; grid-template-columns: 60px 1fr 40px; align-items: center; gap: 8px; font-size: 10px; color: var(--sm-muted); }
.sm-bar-track { height: 6px; background: var(--sm-surface); border-radius: 3px; overflow: hidden; }
.sm-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s; }
.sm-bar-fill.progress { background: var(--sm-green); }
.sm-bar-fill.quiz { background: var(--sm-blue); }
.sm-rev-history { display: flex; flex-direction: column; gap: 8px; }
.sm-rev-history-item { display: flex; align-items: center; gap: 12px; font-size: 13px; padding: 10px; background: var(--sm-surface); border-radius: 8px; }
.sm-rev-history-item strong { color: var(--sm-green-light); margin-left: auto; }
.sm-rev-date { font-size: 11px; color: var(--sm-muted); }
.sm-muted { color: var(--sm-muted); font-size: 14px; }

/* Chapter page */
.sm-app { min-height: 100vh; display: flex; flex-direction: column; max-width: 960px; margin: 0 auto; }
.sm-header {
  position: sticky; top: 0; z-index: 100; background: #1d2839ee;
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--sm-border); padding: 12px 20px 0;
}
.sm-header-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.sm-header-left { display: flex; align-items: center; gap: 10px; }
.sm-back { display: flex; align-items: center; gap: 6px; color: var(--sm-muted); text-decoration: none; font-size: 13px; font-weight: 500; }
.sm-back:hover { color: var(--sm-green-light); }
.sm-title-block h1 { font-size: clamp(0.9rem, 3vw, 1.05rem); font-weight: 700; line-height: 1.35; color: var(--sm-green-light); }
.sm-title-block p { font-size: 11px; color: var(--sm-muted); margin-top: 2px; }
.sm-progress-wrap { padding-bottom: 12px; }
.sm-progress-bar { height: 6px; background: var(--sm-surface); border-radius: 3px; overflow: hidden; }
.sm-progress-fill { height: 100%; background: linear-gradient(90deg, var(--sm-green), var(--sm-blue)); border-radius: 3px; transition: width 0.4s; }
.sm-progress-label { font-size: 11px; color: var(--sm-muted); margin-top: 6px; }

.sm-tab-nav {
  display: flex; gap: 4px; padding: 8px 16px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--sm-border); background: var(--sm-surface);
}
.sm-tab-nav::-webkit-scrollbar { display: none; }
.sm-tab {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border: none; border-radius: 20px;
  background: transparent; font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--sm-muted); cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.sm-tab i { font-size: 11px; }
.sm-tab:hover { color: var(--sm-text); background: var(--sm-card); }
.sm-tab.active { background: var(--sm-green); color: #fff; }
.sm-tab.visited:not(.active)::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--sm-green); margin-left: 2px; }

.sm-main { flex: 1; padding: 20px; }
.sm-panel { animation: aeFadeIn 0.35s ease; }
@keyframes aeFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.sm-panel-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sm-panel-header i { font-size: 20px; color: var(--sm-green); }
.sm-panel-header h2 { font-size: 1.2rem; font-weight: 700; }
.sm-panel-intro { font-size: 14px; color: var(--sm-muted); margin-bottom: 16px; }

.sm-objective-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.sm-objective-list li { display: flex; gap: 12px; padding: 14px; background: var(--sm-surface); border-radius: 10px; border: 1px solid var(--sm-border); font-size: 14px; }
.sm-obj-num { width: 28px; height: 28px; border-radius: 8px; background: var(--sm-green); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.sm-theory-section { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--sm-border); }
.sm-theory-section:last-child { border-bottom: none; }
.sm-theory-section h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 12px; color: var(--sm-green-light); }
.sm-theory-content { font-size: 14px; line-height: 1.75; color: var(--sm-text); }
.sm-theory-content p { margin-bottom: 10px; }
.sm-theory-content strong { color: var(--sm-green-light); }
.sm-sa-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 12px;
  background: #0ea5e918; border: 1px solid #0ea5e944; border-radius: 20px;
  font-size: 11px; font-weight: 600; color: var(--sm-blue);
}
.sm-key-points { margin-top: 14px; padding: 14px; background: #10b98110; border-radius: 10px; border-left: 3px solid var(--sm-green); }
.sm-key-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--sm-green); text-transform: uppercase; margin-bottom: 8px; }
.sm-key-points ul { list-style: none; }
.sm-key-points li { font-size: 13px; padding: 4px 0 4px 16px; position: relative; color: var(--sm-muted); }
.sm-key-points li::before { content: '▸'; position: absolute; left: 0; color: var(--sm-green); }

/* Mind map */
.sm-mindmap { margin-bottom: 24px; }
.sm-mindmap-center {
  text-align: center; padding: 16px 24px; margin: 0 auto 20px; max-width: 280px;
  background: linear-gradient(135deg, var(--sm-green), var(--sm-blue));
  border-radius: 50px; font-weight: 700; font-size: 1.1rem;
}
.sm-mindmap-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.sm-mindmap-branch { background: var(--sm-surface); border: 1px solid var(--sm-border); border-radius: var(--sm-radius); padding: 14px; }
.sm-mindmap-node { font-size: 12px; font-weight: 700; color: var(--sm-green-light); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--sm-border); }
.sm-mindmap-leaves { list-style: none; }
.sm-mindmap-leaves li { font-size: 12px; color: var(--sm-muted); padding: 3px 0 3px 12px; position: relative; }
.sm-mindmap-leaves li::before { content: '•'; position: absolute; left: 0; color: var(--sm-green); }

.sm-summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.sm-summary-card { background: var(--sm-card); border: 1px solid var(--sm-border); border-radius: var(--sm-radius); padding: 16px; }
.sm-summary-card-title { font-size: 12px; font-weight: 700; color: var(--sm-gold); margin-bottom: 10px; }
.sm-summary-card ul { list-style: none; }
.sm-summary-card li { font-size: 12px; color: var(--sm-muted); padding: 3px 0; border-bottom: 1px solid #2a548433; }
.sm-summary-card li:last-child { border-bottom: none; }

/* Quiz */
.sm-quiz-meta { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; color: var(--sm-muted); text-transform: uppercase; margin-bottom: 10px; }
.sm-live-score { color: var(--sm-gold); }
.sm-quiz-progress-bar { height: 6px; background: var(--sm-surface); border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.sm-quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--sm-blue), var(--sm-green)); border-radius: 3px; transition: width 0.4s; }
.sm-quiz-card { background: var(--sm-card); border: 1px solid var(--sm-border); border-radius: var(--sm-radius); padding: 24px; }
.sm-final-card { border-top: 3px solid var(--sm-gold); }
.sm-quiz-question { font-size: 1.05rem; line-height: 1.5; margin-bottom: 18px; font-weight: 600; }
.sm-quiz-options { display: flex; flex-direction: column; gap: 10px; }
.sm-quiz-opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 14px 16px;
  background: var(--sm-surface); border: 1px solid var(--sm-border); border-radius: 12px;
  font-family: inherit; font-size: 14px; color: var(--sm-text); text-align: left; cursor: pointer; transition: all 0.2s;
}
.sm-quiz-opt:hover:not(:disabled) { border-color: var(--sm-green); transform: translateX(4px); }
.sm-quiz-opt.correct { border-color: var(--sm-green); background: #10b98118; }
.sm-quiz-opt.wrong { border-color: var(--sm-red); background: #f8717118; }
.sm-quiz-opt:disabled { cursor: default; transform: none; }
.sm-opt-letter { flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; background: var(--sm-border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.sm-quiz-feedback { margin-top: 14px; padding: 14px; border-radius: var(--sm-radius); font-size: 13px; display: none; line-height: 1.6; }
.sm-quiz-feedback.show { display: block; animation: aeFadeIn 0.3s ease; }
.sm-quiz-feedback.correct { background: #10b98118; border: 1px solid #10b98144; }
.sm-quiz-feedback.wrong { background: #f8717118; border: 1px solid #f8717144; }
.sm-quiz-feedback strong { display: block; margin-bottom: 4px; }

.sm-quiz-summary { text-align: center; padding: 36px 24px; background: var(--sm-surface); border-radius: var(--sm-radius); border: 1px solid var(--sm-border); }
.sm-quiz-summary.passed { border-color: var(--sm-green); background: linear-gradient(180deg, #10b98112, var(--sm-surface)); }
.sm-quiz-summary-icon { font-size: 48px; color: var(--sm-gold); margin-bottom: 16px; }
.sm-quiz-summary h3 { font-size: 1.3rem; margin-bottom: 8px; }
.sm-big-score { font-size: 1.5rem; font-weight: 700; color: var(--sm-green-light); margin: 12px 0; }

/* Cases */
.sm-case-card { background: var(--sm-card); border: 1px solid var(--sm-border); border-radius: var(--sm-radius); padding: 24px; }
.sm-case-card h3 { font-size: 1.1rem; margin-bottom: 12px; color: var(--sm-gold); }
.sm-case-scenario { font-size: 14px; color: var(--sm-muted); line-height: 1.7; margin-bottom: 20px; padding: 16px; background: var(--sm-surface); border-radius: 10px; border-left: 3px solid var(--sm-blue); }
.sm-case-q-label { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--sm-blue); text-transform: uppercase; margin-bottom: 8px; }
.sm-case-question { font-size: 1rem; margin-bottom: 16px; }
.sm-case-nav { display: flex; justify-content: space-between; margin-top: 20px; }
.sm-case-done { font-size: 13px; color: var(--sm-green); }

.sm-revision-notes { list-style: none; display: grid; gap: 8px; }
.sm-revision-notes li {
  font-size: 13px; padding: 12px 14px 12px 32px; background: var(--sm-surface);
  border-radius: 8px; border: 1px solid var(--sm-border); position: relative; color: var(--sm-muted);
}
.sm-revision-notes li::before { content: '✓'; position: absolute; left: 12px; color: var(--sm-green); font-weight: 700; }

.sm-panel-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.sm-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 10px;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: all 0.2s;
}
.sm-btn-primary { background: linear-gradient(135deg, var(--sm-green), #059669); color: #fff; }
.sm-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px #10b98133; }
.sm-btn-ghost { background: var(--sm-surface); color: var(--sm-text); border: 1px solid var(--sm-border); }
.sm-btn-ghost:hover { border-color: var(--sm-green); }
.sm-btn-lg { padding: 16px 28px; font-size: 15px; }

/* Revision mode page */
.sm-revision-intro { text-align: center; padding: 40px 24px; }
.sm-revision-icon { font-size: 56px; color: var(--sm-gold); margin-bottom: 16px; }
.sm-revision-intro h2 { font-size: 1.5rem; margin-bottom: 12px; }
.sm-revision-intro p { color: var(--sm-muted); max-width: 480px; margin: 0 auto 20px; font-size: 14px; }
.sm-revision-features { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 24px; }
.sm-revision-features span { font-size: 11px; padding: 6px 14px; border-radius: 20px; background: var(--sm-surface); border: 1px solid var(--sm-border); }
.sm-rev-ch-label { font-size: 10px; font-weight: 700; color: var(--sm-blue); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.sm-ch-tag { color: var(--sm-green); }

@media (max-width: 640px) {
  .sm-chapter-card { flex-wrap: wrap; }
  .sm-chapter-arrow { display: none; }
  .sm-tab span { display: none; }
  .sm-tab { padding: 10px 12px; }
  .sm-main { padding: 16px; }
}
.sm-difficulty { display:inline-flex; align-items:center; gap:4px; font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; padding:0.2rem 0.55rem; border-radius:999px; margin-left:8px; }
.sm-difficulty.easy { background:rgba(34,197,94,0.15); color:#4ade80; border:1px solid rgba(34,197,94,0.35); }
.sm-difficulty.moderate { background:rgba(245,158,11,0.15); color:#fbbf24; border:1px solid rgba(245,158,11,0.35); }
.sm-difficulty.hard { background:rgba(239,68,68,0.15); color:#f87171; border:1px solid rgba(239,68,68,0.35); }
.sm-formula-box { background:rgba(99,102,241,0.08); border:1px solid rgba(99,102,241,0.25); border-radius:0.75rem; padding:1rem 1.15rem; margin:1rem 0; font-family:ui-monospace,monospace; font-size:0.875rem; line-height:1.6; }
