:root {
  --bg: #f5fbf7;
  --surface: #ffffff;
  --surface-soft: #f6fdf9;
  --text: #234338;
  --muted: #5f7a6f;
  --p-blue: #d9efe7;
  --p-green: #d8f3e3;
  --p-lila: #e6f6ee;
  --accent: #72c8a1;
  --accent-strong: #57af89;
  --border: #d7ede2;
  --shadow: 0 10px 28px rgba(39, 95, 72, 0.12);
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #121a2b;
  --surface-soft: #162136;
  --text: #e5edf9;
  --muted: #9fb1cc;
  --accent: #5ea782;
  --accent-strong: #79cda1;
  --border: #25344f;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", "Trebuchet MS", sans-serif; color: var(--text); background: var(--bg); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.3rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { text-decoration: none; color: var(--text); font-weight: 700; }
.nav { display: flex; gap: .65rem; align-items: center; }
.nav a { text-decoration: none; color: var(--text); }
.nav a:hover { color: var(--accent-strong); }
.container { max-width: 1140px; margin: 1.2rem auto; padding: 0 1rem 2rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 1rem; }
.hero h1 { margin: 0 0 .6rem; }
.hero input { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: .7rem .85rem; }
.live-topic-window {
  margin-top: .6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  max-height: 280px;
  overflow: auto;
}
.live-topic-window.hidden { display: none; }
.live-topic-item {
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
}
.live-topic-item:last-child { border-bottom: 0; }
.live-topic-item small { color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 1rem 0; }
.topic-list { display: grid; gap: .7rem; }
.topic-item { border: 1px solid var(--border); border-radius: 10px; padding: .7rem; background: var(--surface-soft); }
.topic-item p { margin: .35rem 0; color: var(--muted); }
.category-segment { margin-bottom: 1rem; }
.subcategory-grid { display: grid; gap: .8rem; }
.subcategory-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: .8rem; }
.subcategory-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.subcategory-head h3 { margin: 0; }
.subcategory-head p { margin: .3rem 0 0; color: var(--muted); }
.subcategory-topics { margin-top: .7rem; display: grid; gap: .6rem; }
.hidden { display: none; }
.btn { border: 0; border-radius: 10px; padding: .55rem .9rem; cursor: pointer; background: var(--accent); color: #133327; text-decoration: none; font-weight: 600; }
.btn:hover { background: var(--accent-strong); color: #ffffff; }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--text); }
.btn-outline:hover { background: #ecf9f2; color: #1b3f31; }
.auth-card { max-width: 430px; margin: 2rem auto; }
.auth-card form { display: grid; gap: .65rem; }
.auth-card input { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: .65rem; }
.content-html { line-height: 1.6; }
.content-html pre { background: #0f172a; color: #e2e8f0; padding: .7rem; border-radius: 8px; overflow-x: auto; }
.hl { background: #d9f5e7; color: #1f4f3b; padding: 0 .1rem; border-radius: 3px; }
.site-footer { margin-top: 1rem; padding: 1rem; text-align: center; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; }
.quiz-sim select { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: .6rem; margin-top: .35rem; margin-bottom: .8rem; }
.quiz-progress { margin: .4rem 0 .8rem; color: var(--muted); font-weight: 600; }
.quiz-options { display: grid; gap: .6rem; margin: .8rem 0; }
.quiz-option { border: 1px solid var(--border); border-radius: 10px; padding: .55rem .7rem; background: var(--surface-soft); cursor: pointer; }
.quiz-option input { margin-right: .45rem; }
.quiz-results { display: grid; gap: .7rem; margin-top: .8rem; }

@media (max-width: 800px) {
  .topbar { padding: .8rem; }
  .nav { flex-wrap: wrap; justify-content: flex-end; }
}
