@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Themes ── */
:root {
  --bg:      #0d0d0d;
  --bgCard:  #111111;
  --border:  #1f1f1f;
  --borderM: #2a2a2a;
  --tTitle:  #f0f0f0;
  --text:    #d4d4d4;
  --tMid:    #777777;
  --tDim:    #555555;
  --p1:      #7ACEA8;
  --p2:      #7B6FA8;
  --p3:      #C47FAE;
  --p4:      #5ECFCF;
  --p1bg:    #0d1a14;
  --p2bg:    #110f1a;
  --p3bg:    #1a0f16;
  --p4bg:    #0d1a1a;
  --danger:  #e87b7b;
  --warn:    #e8b84b;
  --ok:      #5eaa7a;
  --orange:  #e8914b;
  --dangerbg:#1a0f0f;
  --warnbg:  #1a160a;
  --okbg:    #0d1612;
  --orangebg:#1a1308;
  --acc:     var(--p1);
  --accbg:   var(--p1bg);
  --r: 10px;
}

[data-theme="solar"] {
  --bg:      #f5f0e8;
  --bgCard:  #fefcf7;
  --border:  #e8e0d0;
  --borderM: #d4c8b0;
  --tTitle:  #1a1408;
  --text:    #3a3020;
  --tMid:    #7a6c58;
  --tDim:    #9a8c78;
  --p1:      #89C4F4;
  --p2:      #fab1a0;
  --p3:      #F2C96D;
  --p4:      #A8C97F;
  --p1bg:    #e8f4ff;
  --p2bg:    #fff0ec;
  --p3bg:    #fef8e8;
  --p4bg:    #eef6e8;
  --danger:  #e05050;
  --warn:    #d4920a;
  --ok:      #4a9a5a;
  --orange:  #d4720a;
  --dangerbg:#ffeaea;
  --warnbg:  #fff8e8;
  --okbg:    #eef7ee;
  --orangebg:#fff4e8;
}

/* ── Base ── */
html { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100%;
}
a { color: inherit; text-decoration: none; }

/* ── Site header ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  padding: 13px 24px;
}

.site-header__logo {
  font-family: 'Space Mono', monospace;
  font-size: 14px; font-weight: 700;
  color: var(--tTitle);
  flex: 1;
  letter-spacing: .3px;
}

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; flex: 1;
}
.breadcrumb__sep { color: var(--border); font-size: 10px; }
.breadcrumb__link { color: var(--tMid); transition: color .15s; }
.breadcrumb__link:hover { color: var(--text); }
.breadcrumb__current { color: var(--tTitle); font-weight: 600; }

.theme-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--tMid);
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, color .15s;
  flex-shrink: 0;
}
.theme-btn:hover { border-color: var(--borderM); color: var(--text); }

/* ── Progress bar ── */
.pbar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.pbar--md { height: 4px; }
.pbar__fill {
  height: 100%;
  border-radius: 2px;
  background: var(--acc);
  transition: width .3s ease;
  will-change: width;
}

/* ── Global hero (main page) ── */
.global-hero {
  padding: 28px 24px 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.global-hero__left { flex: 1; }
.global-hero__counter {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.global-hero__done {
  font-family: 'Space Mono', monospace;
  font-size: 40px;
  font-weight: 700;
  color: var(--tTitle);
  line-height: 1;
}
.global-hero__of {
  font-family: 'Space Mono', monospace;
  font-size: 18px;
  color: var(--tMid);
  line-height: 1;
}
.global-hero__sub {
  font-size: 12px;
  color: var(--tMid);
}
.global-hero__pct {
  font-family: 'Space Mono', monospace;
  font-size: 32px;
  font-weight: 700;
  color: var(--tTitle);
  line-height: 1;
  flex-shrink: 0;
}
.global-bar {
  padding: 14px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.pbar--lg { height: 5px; }

/* ── Subject grid (main page) ── */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
  padding: 20px 24px 80px;
}

.subj-card {
  display: block;
  background: var(--bgCard);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .2s, transform .1s;
}
.subj-card:hover {
  border-color: var(--acc);
  transform: translateY(-2px);
}

.subj-card__accent { height: 4px; background: var(--acc); }

.subj-card__body { padding: 18px 18px 16px; }

.subj-card__name {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--acc);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.subj-card__meta {
  font-size: 12px; color: var(--tMid);
  margin-bottom: 14px;
}

.subj-card__row {
  display: flex; justify-content: space-between;
  align-items: center; margin-top: 8px;
  font-size: 11px;
}
.subj-card__hours { color: var(--tMid); }
.subj-card__pct {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  color: var(--tTitle);
  font-weight: 700;
}

/* ── Subject hero (subject page) ── */
.subj-hero {
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.subj-hero__name {
  font-family: 'Space Mono', monospace;
  font-size: 20px; font-weight: 700;
  color: var(--acc);
  margin-bottom: 4px;
}
.subj-hero__meta {
  font-size: 13px; color: var(--tMid);
  margin-bottom: 16px;
}
.subj-hero__progress {
  display: flex; align-items: center; gap: 12px;
}
.subj-hero__progress .pbar { flex: 1; }
.subj-hero__pct {
  font-size: 12px; font-weight: 600;
  color: var(--tTitle); width: 34px; text-align: right;
}

/* ── Topic list (subject page) ── */
.topic-list {
  max-width: 740px;
  margin: 0 auto;
  padding: 16px 24px 80px;
}

.topic-item {
  display: flex;
  background: var(--bgCard);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color .15s;
}
.topic-item:hover { border-color: var(--borderM); }

/* checkbox zone */
.topic-item__chk {
  flex-shrink: 0; width: 46px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: background .12s;
}
.topic-item__chk:hover { background: rgba(128,128,128,.06); }

/* custom checkbox */
.cb {
  width: 15px; height: 15px;
  border: 1.5px solid var(--borderM);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.cb--on {
  background: var(--acc);
  border-color: var(--acc);
}
.cb--on::after {
  content: '';
  display: block;
  width: 4px; height: 7px;
  border: 1.5px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(42deg) translateY(-1px);
}

/* body (link) zone */
.topic-item__link {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background .12s;
}
.topic-item__link:hover { background: rgba(128,128,128,.04); }
.topic-item.done .topic-item__link { opacity: .4; }

.topic-item__id {
  font-size: 11px; color: var(--tDim);
  width: 22px; flex-shrink: 0;
  font-family: "SF Mono", Consolas, monospace;
}

.topic-item__info { flex: 1; min-width: 0; }
.topic-item__name {
  font-size: 13px; font-weight: 500;
  color: var(--tTitle);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topic-item__desc {
  font-size: 12px; color: var(--tMid);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.topic-item__meta {
  display: flex; align-items: center; gap: 7px;
  flex-shrink: 0;
}
.topic-item__hrs { font-size: 11px; color: var(--tDim); }
.topic-item__arr { font-size: 11px; color: var(--tDim); margin-left: 2px; }

/* ── Badges ── */
.badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px;
  letter-spacing: .3px;
}
.badge--hoch   { color: var(--danger); background: var(--dangerbg); }
.badge--medium { color: var(--warn);   background: var(--warnbg); }
.badge--tief   { color: var(--ok);     background: var(--okbg); }

/* ── Topic detail page ── */
.topic-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.topic-page__eyebrow {
  font-size: 11px; color: var(--tMid);
  font-family: "SF Mono", Consolas, monospace;
  margin-bottom: 6px;
}

.topic-page h1 {
  font-family: 'Space Mono', monospace;
  font-size: 18px; font-weight: 700;
  color: var(--tTitle);
  margin-bottom: 24px;
  line-height: 1.4;
}

.section {
  background: var(--bgCard);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 10px;
}

.section__head {
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase;
  color: var(--tMid);
}

.section__body {
  padding: 16px 18px;
}

.section__body p {
  font-size: 13px; color: var(--text);
  line-height: 1.7; margin-bottom: 10px;
}
.section__body p:last-child { margin-bottom: 0; }
.section__body strong { color: var(--tTitle); font-weight: 600; }
.section__body code {
  background: rgba(128,128,128,.1);
  color: var(--acc);
  padding: 1px 5px; border-radius: 4px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
}

/* concept list */
.concept-list { list-style: none; }
.concept-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px; line-height: 1.7;
  color: var(--text);
}
.concept-list li:first-child { padding-top: 0; }
.concept-list li:last-child  { border-bottom: none; padding-bottom: 0; }
.concept-list li strong { color: var(--acc); }

/* glossary */
.glossary { list-style: none; }
.glossary li {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.glossary li:first-child { padding-top: 0; }
.glossary li:last-child  { border-bottom: none; padding-bottom: 0; }
.glossary code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px; color: var(--acc);
}
.glossary .def { font-size: 13px; color: var(--text); line-height: 1.6; }

/* ── Footer ── */
.site-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 10px 24px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--tMid);
  padding: 5px 14px; border-radius: 6px;
  cursor: pointer; font-size: 12px;
  font-family: inherit;
  transition: border-color .15s, color .15s;
}
.btn-ghost:hover { border-color: var(--danger); color: var(--danger); }
