:root {
  --primary: #0079d3;
  --primary-hover: #24a0ed;
  --primary-light: #eaf5fc;
  --success: #26834a;
  --success-light: #eaf6ee;
  --warning: #9b5c00;
  --warning-light: #fff4df;
  --danger: #d92d3a;
  --danger-light: #fff0f1;
  --info: #006cbf;
  --info-light: #eaf5fc;

  --bg-main: #f6f7f8;
  --bg-surface: #ffffff;
  --bg-card: #f6f7f8;
  --bg-hover: #eaedef;
  --text-main: #1a1a1b;
  --text-muted: #576f76;
  --border: #edeff1;
  --border-subtle: #d3d6da;
  --code-bg: #1d2535;
  --sidebar-w: 280px;
  --shadow: 0 1px 2px rgba(26, 26, 27, 0.08);
  --radius: 4px;
  --radius-pill: 9999px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --primary: #24a0ed;
  --primary-hover: #53b4f4;
  --primary-light: #142f43;
  --success: #46d160;
  --success-light: #193124;
  --warning: #ffb000;
  --warning-light: #392c12;
  --danger: #ff5360;
  --danger-light: #3a1d22;
  --info: #7193ff;
  --info-light: #182541;
  --bg-main: #1d2535;
  --bg-surface: #252f40;
  --bg-card: #303b4e;
  --bg-hover: #39465a;
  --text-main: #f6f7f8;
  --text-muted: #b1bdc7;
  --border: #3d4858;
  --border-subtle: #576f76;
  --code-bg: #111827;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  z-index: 20;
  transition: transform 0.3s ease;
}

.brand {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  font-size: 1.8rem;
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary);
}

.brand-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-nav {
  padding: 1rem 0.75rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.25rem;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--primary);
  color: #ffffff;
  font-weight: 600;
}

.nav-item .badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: var(--bg-card);
  color: var(--text-muted);
}

.nav-item.active .badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
}

.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-main);
}

/* Top Navigation Bar */
.topbar {
  height: 64px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
  z-index: 10;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.4rem;
  cursor: pointer;
}

.search-box {
  position: relative;
  width: 320px;
}

.search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-box input:focus {
  border-color: var(--primary);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Pomodoro Bar in Topbar */
.pomo-widget {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.pomo-time {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--warning);
}

.pomo-btn {
  background: var(--primary);
  border: none;
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
}

.pomo-btn.running {
  background: var(--danger);
}

/* Page Views */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.view-section {
  display: none;
  max-width: 1050px;
  margin: 0 auto;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Headers */
.view-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
}

.view-header h2 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.view-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Cards & Components */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.summary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.summary-card h4 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

/* Note Alert Boxes */
.note-box {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin: 1.25rem 0;
  font-size: 0.92rem;
  border-left: 4px solid var(--primary);
  background: rgba(59, 130, 246, 0.1);
  color: var(--text-main);
}

.note-box.alert-warning {
  border-left-color: var(--warning);
  background: rgba(245, 158, 11, 0.1);
}

.note-box.alert-info {
  border-left-color: var(--info);
  background: rgba(6, 182, 212, 0.1);
}

.note-box.alert-danger {
  border-left-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.note-box strong {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
  background: var(--bg-surface);
}

.data-table th, .data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--bg-card);
  font-weight: 700;
  color: var(--text-main);
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

/* Code Blocks */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: #38bdf8;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  line-height: 1.5;
}

/* Study Plan Timeline */
.plan-timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.day-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.day-card.completed {
  border-color: var(--success);
}

.day-header {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.day-badge {
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: var(--primary);
  color: white;
}

.day-title {
  font-weight: 700;
  font-size: 1.05rem;
  flex: 1;
  margin-left: 1rem;
}

.day-body {
  padding: 1.25rem;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.session-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s ease;
}

.session-item:hover {
  border-color: var(--primary);
}

.session-checkbox {
  margin-top: 0.25rem;
  width: 18px;
  height: 18px;
  accent-color: var(--success);
  cursor: pointer;
}

.session-info {
  flex: 1;
}

.session-info h5 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.session-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.session-topics {
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.topic-tag {
  background: var(--bg-card);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.session-action-btn {
  padding: 0.4rem 0.85rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  align-self: center;
}

.session-action-btn:hover {
  background: var(--primary-hover);
}

/* Exam Mode Simulation */
.exam-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.exam-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.exam-timer {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.exam-progress {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.exam-nav-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 0.35rem;
  margin-bottom: 1.5rem;
}

.exam-q-btn {
  aspect-ratio: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exam-q-btn.current {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 800;
}

.exam-q-btn.answered {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.exam-q-btn.flagged {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.2);
}

.q-box {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.q-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.q-badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-muted);
}

.q-badge.domain {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}

.q-text {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.q-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.q-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.92rem;
  transition: all 0.15s ease;
}

.q-option:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

.q-option.selected {
  background: rgba(59, 130, 246, 0.15);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.q-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
}

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

.btn-primary {
  background: var(--primary);
  border: none;
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

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

/* Flashcards */
.flashcard-wrapper {
  perspective: 1000px;
  max-width: 600px;
  margin: 2rem auto;
  min-height: 320px;
}

.flashcard {
  width: 100%;
  height: 320px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.card-face.front {
  background: var(--bg-surface);
}

.card-face.back {
  background: var(--bg-card);
  transform: rotateY(180deg);
}

.card-header-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-content-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.6;
}

.card-footer-tip {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.flashcard-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Score Diagnostic Report */
.report-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 750px;
  margin: 1.5rem auto;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.score-badge-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 6px solid var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 1rem auto;
}

.score-num {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
}

.score-denom {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.level-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  background: var(--primary);
  color: white;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-toggle {
    display: block;
  }
  .search-box {
    width: 180px;
  }
  .exam-nav-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* Reading, progress, search and quiz polish */
.view-section { max-width: 1160px; }
.view-header { margin-bottom: 1.5rem; }
.view-header h2 { line-height: 1.25; }
.domain-sections-wrapper { gap: 1.25rem !important; }
.domain-section-card { padding: clamp(1rem, 3vw, 2rem) !important; }
.section-html-content { max-width: 88ch; font-size: 1rem; line-height: 1.78; overflow-x: auto; }
.section-html-content h3, .section-html-content h4 { line-height: 1.35; margin-top: 1.7rem; margin-bottom: 0.7rem; }
.section-html-content p, .section-html-content li { margin-bottom: 0.65rem; }
.section-html-content ul, .section-html-content ol { padding-left: 1.5rem; }
.section-html-content table { min-width: 640px; }
.section-html-content .data-table { margin: 1.25rem 0; }
.session-info h5 { flex-wrap: wrap; }
.domain-progress-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: -0.75rem 0 1.5rem; }
.domain-progress-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; display: grid; grid-template-columns: 1fr auto; gap: 0.55rem 0.75rem; align-items: center; }
.domain-progress-card div { display: flex; flex-direction: column; min-width: 0; }
.domain-progress-card strong { font-size: 0.85rem; }
.domain-progress-card span { color: var(--text-muted); font-size: 0.75rem; }
.domain-progress-card progress { width: 100%; height: 0.55rem; accent-color: var(--success); grid-column: 1; }
.domain-progress-card b { grid-column: 2; grid-row: 2; color: var(--success); font-size: 0.8rem; }
.search-results { position: absolute; top: calc(100% + 0.4rem); left: 0; right: 0; z-index: 40; max-height: 60vh; overflow-y: auto; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.35rem; }
.search-result { display: flex; flex-direction: column; width: 100%; padding: 0.65rem 0.75rem; border: 0; border-radius: 7px; background: transparent; color: var(--text-main); text-align: left; cursor: pointer; }
.search-result:hover, .search-result:focus-visible { background: var(--bg-hover); outline: none; }
.search-result span, .search-empty { color: var(--text-muted); font-size: 0.76rem; }
.search-empty { padding: 0.65rem 0.75rem; }
.quiz-toolbar { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; }
.quiz-toolbar label { font-weight: 700; }
.quiz-toolbar select { background: var(--bg-card); color: var(--text-main); border: 1px solid var(--border); border-radius: 7px; padding: 0.55rem 0.75rem; }
.quiz-toolbar span { color: var(--text-muted); margin-left: auto; }
.quiz-question { margin-bottom: 0.9rem; }
.quiz-question h3 { font-size: 1rem; line-height: 1.55; margin-bottom: 0.9rem; }
.quiz-question .q-option { width: 100%; font: inherit; color: var(--text-main); text-align: left; cursor: pointer; }
.quiz-question .q-option:disabled { cursor: default; opacity: 1; }
.quiz-question .quiz-correct { border-color: var(--success); background: rgba(16, 185, 129, 0.12); }
.quiz-question .quiz-wrong { border-color: var(--danger); background: rgba(239, 68, 68, 0.12); }
.quiz-explanation { margin-top: 0.8rem; padding: 0.75rem; border-radius: 7px; background: var(--bg-main); color: var(--text-muted); }
.quiz-score { margin-bottom: 1rem; font-size: 1.1rem; text-align: center; }
.quiz-actions { display: flex; justify-content: center; padding: 0.5rem 0 2rem; }

@media (max-width: 700px) {
  .content-area { padding: 1rem; }
  .topbar { padding: 0 0.75rem; gap: 0.5rem; }
  .search-box { width: min(52vw, 250px); }
  .pomo-widget { gap: 0.35rem; padding: 0.3rem 0.45rem; }
  .pomo-widget > span:first-child { display: none; }
  .view-header h2 { font-size: 1.45rem; }
  .day-header { flex-wrap: wrap; gap: 0.5rem; }
  .day-title { margin-left: 0.25rem; }
  .session-item { flex-wrap: wrap; }
  .session-action-btn { margin-left: 1.8rem; }
  .domain-progress-grid { grid-template-columns: 1fr; }
  .overall-progress { width: 100%; }
  .quiz-toolbar { flex-wrap: wrap; }
  .quiz-toolbar select { flex: 1; min-width: 180px; }
}

/* Reddit reference: native type, restrained blue/orange, pill actions, square cards. */
html { scroll-behavior: smooth; }
body { line-height: 1.65; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
button { border-radius: var(--radius-pill) !important; }
.app-container { background: var(--bg-main); }
.sidebar { background: var(--bg-surface); border-right-color: var(--border); }
.brand { padding: 1.1rem 1rem; gap: 0.65rem; }
.brand-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #d93a00; color: #fff; font-size: 0.95rem; font-weight: 800; }
.brand-info h1 { color: var(--text-main); font-size: 1rem; font-weight: 650; letter-spacing: 0; }
.brand-info p { font-size: 0.72rem; }
.sidebar-nav { gap: 0.18rem; padding: 0.8rem 0.65rem; }
.nav-section-title { font-size: 0.625rem; letter-spacing: 0.5px; padding: 0.9rem 0.75rem 0.35rem; }
.nav-item { gap: 0.65rem; padding: 0.55rem 0.7rem; border-radius: var(--radius); font-size: 0.84rem; }
.nav-mark { width: 3.1rem; flex: 0 0 3.1rem; color: var(--text-muted); font: 700 0.61rem/1 var(--font-sans); letter-spacing: 0.03em; }
.nav-item.active { background: var(--primary-light); color: var(--primary); border-color: transparent; box-shadow: inset 3px 0 var(--primary); }
.nav-item.active .nav-mark { color: var(--primary); }
.nav-item .badge { background: var(--bg-card); color: var(--text-muted); font-weight: 700; }
.nav-item.active .badge { background: #fff; color: var(--primary); }
.sidebar-footer { padding: 0.8rem; }
.theme-toggle-btn { width: 100%; justify-content: center; border-radius: var(--radius-pill); background: var(--bg-card); border: 0; padding: 0.6rem 0.8rem; }
.topbar { height: 58px; padding: 0 1.25rem; background: #1d2535; border: 0; color: #fff; box-shadow: 0 2px 8px rgba(26, 26, 27, 0.12); }
.mobile-toggle { color: #fff; font-size: 1.2rem; }
.search-box input { height: 38px; background: #f6f7f8; color: #1a1a1b; border: 1px solid transparent; border-radius: 4px; }
.search-box input::placeholder { color: #576f76; }
.search-box input:focus { background: #fff; border-color: #24a0ed; box-shadow: 0 0 0 3px rgba(36, 160, 237, 0.28); }
.search-icon { font-size: 0; width: 12px; height: 12px; border: 2px solid #576f76; border-radius: 50%; left: 0.85rem; }
.search-icon::after { content: ''; width: 5px; height: 2px; position: absolute; background: #576f76; right: -4px; bottom: -2px; transform: rotate(45deg); }
.pomo-widget { gap: 0.65rem; padding: 0.3rem 0.55rem 0.3rem 0.75rem; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: var(--radius-pill); }
.pomo-widget #pomo-mode { color: #d3d6da !important; }
.pomo-time { color: #fff; font-size: 0.88rem; }
.pomo-btn { background: #0079d3; width: 30px; height: 30px; }
.pomo-btn:hover { background: #24a0ed; }
.content-area { padding: clamp(1rem, 3vw, 2rem); }
.view-section { max-width: 1120px; }
.view-header { padding-bottom: 1rem; margin-bottom: 1.25rem; border-color: var(--border); }
.view-header h2 { font-size: clamp(1.45rem, 2.6vw, 1.85rem); font-weight: 550; letter-spacing: -0.02em; gap: 0; }
.view-header p { max-width: 70ch; font-size: 0.92rem; }
.summary-card, .day-card, .exam-container, .report-modal, .q-box, .quiz-question, .flashcard { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 4px !important; box-shadow: none; }
.summary-card { padding: 1.1rem 1.2rem; }
.summary-card:hover { transform: none; border-color: var(--border); }
.day-card { overflow: hidden; }
.day-card.completed { border-color: var(--success); }
.day-header { background: var(--bg-surface); padding: 0.85rem 1rem; }
.day-badge, .level-badge, .topic-tag, .q-badge { border-radius: var(--radius-pill); }
.day-badge { background: var(--primary-light); color: var(--primary); font-size: 0.72rem; letter-spacing: 0.03em; }
.day-title { font-size: 0.97rem; font-weight: 600; }
.day-body { padding: 1rem; }
.session-item { align-items: center; background: var(--bg-surface); border-color: var(--border); border-radius: 4px; padding: 0.85rem; }
.session-item:hover { border-color: #d3d6da; }
.session-checkbox { accent-color: var(--primary); }
.session-info h5 { font-weight: 600; line-height: 1.45; }
.session-action-btn, .btn-primary { background: var(--primary); color: #fff; border: 0; border-radius: var(--radius-pill); font-weight: 700; }
.session-action-btn:hover, .btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { border-radius: var(--radius-pill); color: var(--info); border-color: var(--info); background: transparent; font-weight: 700; }
.topic-tag { padding: 0.2rem 0.55rem; font-size: 0.7rem; }
.view-header + #study-plan-container .summary-card { border-left: 3px solid #d93a00 !important; }
.overall-progress > div:first-child h4 { color: var(--text-main) !important; font-weight: 600 !important; }
.overall-progress > div:last-child > div > div { background: var(--primary) !important; }
.overall-progress > div:last-child > span { color: var(--primary) !important; }
.domain-progress-card { border-radius: 4px; box-shadow: none; }
.domain-progress-card progress { accent-color: var(--primary); }
.domain-progress-card b { color: var(--primary); }
.domain-section-card { padding: clamp(1rem, 3vw, 1.6rem) !important; }
.domain-section-card > div:first-child h3 { color: var(--text-main) !important; font-size: 1.12rem !important; font-weight: 600 !important; }
.section-summary { color: var(--text-muted); border-left: 2px solid #d93a00; padding: 0.2rem 0 0.2rem 0.8rem; font-size: 0.9rem; font-style: normal; }
.section-html-content { max-width: 88ch; color: var(--text-main); line-height: 1.78; }
.section-html-content h3, .section-html-content h4 { font-weight: 600; color: var(--text-main); }
.section-html-content strong { color: var(--text-main); }
.section-html-content .data-table { font-size: 0.84rem; border: 1px solid var(--border); }
.section-html-content .data-table th { background: var(--bg-card); }
.section-html-content .data-table tr:hover td { background: var(--primary-light); }
.note-box { border-radius: 4px; }
.data-table { background: var(--bg-surface); }
.data-table th { background: var(--bg-card); }
.code-block { border-radius: 4px; }
.exam-container { padding: clamp(0.9rem, 2.5vw, 1.4rem); }
.exam-status-bar { background: var(--bg-card); border-radius: 4px; }
.exam-q-btn { border-radius: var(--radius-pill); }
.q-box { background: var(--bg-card); }
.q-option { border-radius: 4px; }
.q-option.selected { border-color: var(--primary); background: var(--primary-light); color: var(--text-main); }
.report-modal { max-width: 900px; }
.score-badge-circle { border-color: var(--primary); }
.score-num { color: var(--text-main); }
.search-results { border-radius: 4px; box-shadow: 0 8px 24px rgba(26, 26, 27, 0.14); }
.search-result { border-radius: 4px; }
.quiz-toolbar, .quiz-score { border-radius: 4px; }
.quiz-question h3 { font-size: 1rem; font-weight: 600; }
.quiz-explanation { border-left: 2px solid var(--success); border-radius: 4px; }
.flashcard { max-width: 700px; }
.card-content-center { line-height: 1.7; }
.flashcard-controls { gap: 0.65rem; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d3d6da; border: 2px solid var(--bg-main); border-radius: 8px; }

@media (max-width: 700px) {
  .topbar { padding: 0 0.7rem; }
  .topbar > div:first-child { gap: 0.55rem !important; }
  .search-box { width: min(55vw, 280px); }
  .pomo-widget { gap: 0.4rem; }
  .pomo-time { font-size: 0.82rem; }
  .content-area { padding: 1rem 0.8rem; }
  .view-header h2 { font-size: 1.45rem; }
  .overall-progress { flex-wrap: wrap; }
  .overall-progress > div:last-child { justify-content: flex-start; }
  .session-item { align-items: flex-start; }
}

[data-theme="dark"] .nav-item.active .badge { background: rgba(255, 255, 255, 0.14); color: #fff; }
[data-theme="dark"] .day-badge { background: #182f48; color: #9dcfff; }
[data-theme="dark"] .q-option.selected { background: #182f48; }
[data-theme="dark"] .section-html-content .data-table tr:hover td { background: #182f48; }
.domain-kicker { margin-bottom: 0.3rem; color: var(--text-muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.session-target-label { margin-right: 0.45rem; color: var(--text-muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.session-tip { margin-top: 0.5rem; color: var(--text-muted); font-size: 0.78rem; line-height: 1.55; }
.session-tip strong { margin-right: 0.25rem; color: var(--text-main); font-weight: 650; }
.theme-toggle-btn:focus-visible, .nav-item:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(36, 160, 237, 0.65); outline-offset: 2px; }
.account-button { padding: 0.5rem 0.85rem; border: 1px solid rgba(255,255,255,0.22); border-radius: var(--radius-pill); background: transparent; color: #fff; font: 650 0.76rem/1.2 var(--font-sans); cursor: pointer; white-space: nowrap; }
.account-button:hover { background: rgba(255,255,255,0.1); }
.account-dialog { width: min(440px, calc(100vw - 2rem)); max-width: none; max-height: calc(100vh - 2rem); margin: auto; padding: 0; border: 1px solid var(--border); border-radius: 8px; color: var(--text-main); background: var(--bg-surface); box-shadow: 0 20px 60px rgba(15, 23, 42, 0.28); }
.account-dialog::backdrop { background: rgba(13, 22, 35, 0.58); backdrop-filter: blur(2px); }
.account-dialog-card { padding: 1.4rem; }
.account-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.account-dialog-heading h2 { font-size: 1.28rem; line-height: 1.3; font-weight: 650; }
.account-close { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: var(--bg-card); color: var(--text-main); font-size: 1.35rem; cursor: pointer; }
.account-description { margin-top: 0.65rem; color: var(--text-muted); font-size: 0.86rem; line-height: 1.55; }
.account-message { margin-top: 1rem; padding: 0.7rem 0.8rem; border-left: 2px solid var(--primary); background: var(--primary-light); color: var(--text-main); font-size: 0.82rem; line-height: 1.45; }
.account-fields { display: grid; gap: 0.45rem; margin-top: 1rem; }
.account-fields label { color: var(--text-main); font-size: 0.78rem; font-weight: 650; }
.account-fields input { width: 100%; min-height: 42px; margin-bottom: 0.35rem; padding: 0.65rem 0.75rem; border: 1px solid var(--border-subtle); border-radius: 4px; background: var(--bg-surface); color: var(--text-main); font: 400 0.9rem var(--font-sans); }
.account-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.8rem; }
.account-actions button { min-height: 38px; padding: 0.5rem 0.9rem; }
.account-secondary-actions { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.85rem; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--info); font: 600 0.78rem var(--font-sans); cursor: pointer; }
.text-button:hover { text-decoration: underline; }
[hidden] { display: none !important; }
@media (max-width: 700px) {
  .account-button { padding: 0.45rem 0.6rem; font-size: 0.68rem; }
  .topbar-right { gap: 0.45rem; }
  .account-dialog-card { padding: 1.1rem; }
}
