
:root {
  --primary: #1d4ed8; --primary-dark: #1e3a8a; --primary-light: #eff6ff;
  --accent: #0284c7; --bg: #f8fafc; --surface: #ffffff; --text: #0f172a;
  --muted: #475569; --border: #e2e8f0; --radius: 12px;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.65; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.navbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04); }
.nav-inner { max-width: 1280px; margin: 0 auto; padding: 0.75rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.55rem; font-weight: 800; font-size: 1.28rem; color: var(--primary-dark); text-decoration: none !important; }
.brand-badge { background: var(--primary); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 999px; }
.nav-links { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.nav-btn { background: transparent; border: 1px solid transparent; color: var(--muted); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.02em; padding: 0.42rem 0.68rem; border-radius: 8px; cursor: pointer; }
.nav-btn:hover, .nav-btn.active { background: var(--primary-light); color: var(--primary); border-color: #bfdbfe; }
.nav-btn-ai { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.nav-btn-ai.active, .nav-btn-ai:hover { background: #0e7490; color: #ffffff; border-color: #0e7490; }
.hero { background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #0284c7 100%); color: #ffffff; padding: 2.5rem 1.25rem 3rem; }
.hero-inner { max-width: 1280px; margin: 0 auto; }
.hero-tag { display: inline-block; background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.3); padding: 0.28rem 0.8rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.85rem; }
.hero h1 { font-size: clamp(1.65rem, 3.2vw, 2.45rem); font-weight: 800; line-height: 1.22; margin-bottom: 0.65rem; }
.hero p { max-width: 780px; color: #e0f2fe; font-size: 1rem; margin-bottom: 1.35rem; }
.search-bar-wrap { display: flex; gap: 0.65rem; max-width: 760px; flex-wrap: wrap; }
.search-input { flex: 1; min-width: 240px; padding: 0.8rem 1.05rem; border-radius: 10px; border: none; font-size: 0.96rem; box-shadow: 0 6px 20px rgba(0,0,0,0.14); }
.filter-select { padding: 0.8rem 0.95rem; border-radius: 10px; border: none; font-size: 0.92rem; font-weight: 600; color: var(--primary-dark); background: #ffffff; cursor: pointer; }
.container { max-width: 1280px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.35rem; }
.section-header h2 { font-size: 1.5rem; color: var(--primary-dark); }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem; margin-bottom: 1.75rem; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.15rem; box-shadow: var(--shadow); }
.stat-num { font-size: 1.45rem; font-weight: 800; color: var(--primary); }
.stat-lbl { font-size: 0.84rem; color: var(--muted); font-weight: 600; }
.pill-row { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1.35rem; }
.pill { padding: 0.42rem 0.88rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 0.84rem; font-weight: 600; cursor: pointer; }
.pill.active, .pill:hover { background: var(--primary); color: #ffffff; border-color: var(--primary); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1.2rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between; }
.card-tag { display: inline-block; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 0.2rem 0.58rem; border-radius: 6px; background: var(--primary-light); color: var(--primary); margin-bottom: 0.55rem; }
.card h3 { font-size: 1.1rem; color: var(--text); margin-bottom: 0.45rem; }
.card p { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.9rem; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.5rem 0.9rem; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; text-decoration: none !important; }
.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--primary-light); color: var(--primary); border-color: #bfdbfe; }
.btn-outline:hover { background: #dbeafe; }
.btn-success { background: #15803d; color: #ffffff; }
.chapter-view { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow); }
.chapter-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.chapter-view h1 { font-size: 1.8rem; color: var(--primary-dark); margin-bottom: 0.65rem; }
.toc-bar { display: flex; flex-wrap: wrap; gap: 0.45rem; background: #f1f5f9; padding: 0.85rem; border-radius: 10px; margin: 1rem 0 1.25rem; }
.toc-link { font-size: 0.8rem; font-weight: 600; padding: 0.32rem 0.65rem; border-radius: 6px; background: #ffffff; border: 1px solid #cbd5e1; color: var(--primary-dark); }
.block { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.block h2 { font-size: 1.25rem; color: var(--primary); margin-bottom: 0.85rem; }
.note-sec { margin-bottom: 1.25rem; }
.note-sec h3 { font-size: 1.06rem; color: var(--primary-dark); margin-bottom: 0.45rem; }
.note-sec p { margin-bottom: 0.65rem; color: #1e293b; font-size: 0.97rem; }
.item-list { list-style: none; display: grid; gap: 0.6rem; }
.item-list li { background: #f8fafc; border-left: 4px solid var(--primary); padding: 0.7rem 0.95rem; border-radius: 0 8px 8px 0; font-size: 0.94rem; }
.formula-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 0.9rem 1.1rem; font-family: monospace; font-size: 0.92rem; color: #1e3a8a; margin-bottom: 0.55rem; }
.study-table { width: 100%; border-collapse: collapse; margin: 0.85rem 0; font-size: 0.92rem; }
.study-table th, .study-table td { border: 1px solid #cbd5e1; padding: 0.65rem 0.85rem; text-align: left; vertical-align: top; }
.study-table th { background: #eff6ff; color: var(--primary-dark); font-weight: 700; }
.diagram-box { background: #ffffff; border: 1px solid #cbd5e1; border-radius: 12px; padding: 1.15rem; text-align: center; margin: 0.9rem 0; }
.diagram-svg { max-width: 640px; width: 100%; height: auto; }
.qa-card { border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 0.8rem; background: #ffffff; }
.qa-q { font-weight: 700; color: var(--text); margin-bottom: 0.4rem; }
.qa-a { color: #334155; font-size: 0.93rem; white-space: pre-line; }
.mcq-opt { display: block; width: 100%; text-align: left; padding: 0.48rem 0.8rem; margin: 0.32rem 0; border: 1px solid var(--border); border-radius: 7px; background: #f8fafc; cursor: pointer; font-size: 0.9rem; }
.mcq-opt.correct { background: #dcfce7; border-color: #16a34a; color: #14532d; font-weight: 600; }
.mcq-opt.wrong { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }
.notice-banner { background: #fefce8; border: 1px solid #fde047; color: #854d0e; padding: 0.85rem 1.05rem; border-radius: 10px; font-size: 0.9rem; margin-bottom: 1.4rem; }
.ai-shell { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.ai-topbar { background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); color: #ffffff; padding: 1.25rem 1.5rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.85rem; }
.ai-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.ai-messages { min-height: 340px; max-height: 520px; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 0.9rem; background: #f8fafc; }
.chat-bubble { max-width: 82%; padding: 0.85rem 1.05rem; border-radius: 14px; font-size: 0.94rem; white-space: pre-line; }
.chat-user { align-self: flex-end; background: var(--primary); color: #ffffff; border-bottom-right-radius: 4px; }
.chat-bot { align-self: flex-start; background: #ffffff; color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-error { align-self: flex-start; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.ai-suggestions { padding: 0.85rem 1.25rem; border-top: 1px solid var(--border); background: #ffffff; display: flex; gap: 0.45rem; flex-wrap: wrap; }
.ai-input-row { display: flex; gap: 0.6rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); background: #ffffff; }
.ai-input { flex: 1; padding: 0.75rem 0.95rem; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 0.95rem; }
footer { background: #0f172a; color: #cbd5e1; padding: 2.2rem 1.25rem; text-align: center; font-size: 0.88rem; }
footer strong { color: #ffffff; }
@media (max-width: 680px) { .chapter-view { padding: 1.2rem; } .hero { padding: 2rem 1rem 2.4rem; } .chat-bubble { max-width: 94%; } }
@media print { .navbar, .hero, .toc-bar, .btn-row, footer, .notice-banner { display: none !important; } body { background: #fff; font-size: 11pt; } .container { max-width: 100%; padding: 0; } .chapter-view { box-shadow: none; border: none; padding: 0; } .block { page-break-inside: avoid; } }

.nav-btn-account {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}
.nav-btn-account:hover {
  background: #f59e0b;
  color: #ffffff;
  border-color: #f59e0b;
}
.streak-banner {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
}
.streak-flame {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f59e0b;
  color: #ffffff;
  font-weight: 800;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-card {
  background: #ffffff;
  border-radius: 14px;
  max-width: 440px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
}
.auth-field {
  width: 100%;
  padding: 0.68rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.94rem;
  margin-top: 0.3rem;
  margin-bottom: 0.85rem;
}
.creator-card {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
}
