/* ============================================================
   NGÂN HÀNG BÀI TẬP — giao diện (sáng/tối)
   Tái dùng biến & phong cách của lesson.css cho đồng bộ.
   ============================================================ */

/* ---- Dark (mặc định) ---- */
:root {
  --bg: #0f1117; --bg-2: #0b0d12;
  --card: #171a23; --card-2: #1e222d; --border: #2a2f3a;
  --text: #e6e8ee; --text-strong: #ffffff; --muted: #8b90a0;
  --accent: #6c8cff; --accent-2: #4ade80; --warn: #fbbf24; --danger: #f87171;
  --code-bg: #0b0d12; --code-text: #e6e8ee; --inline-code: #ffd9a0;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.25);
  --sel: rgba(108,140,255,.28);
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f7f8fb; --bg-2: #eef1f6;
  --card: #ffffff; --card-2: #f1f3f8; --border: #e2e6ee;
  --text: #2b2f38; --text-strong: #0f1117; --muted: #6b7280;
  --accent: #4f6ef7; --accent-2: #1aa860; --warn: #b7791f; --danger: #dc2626;
  --code-bg: #0f141c; --code-text: #e6e8ee; --inline-code: #b45309;
  --shadow: 0 8px 30px rgba(20,30,60,.10);
  --shadow-sm: 0 2px 10px rgba(20,30,60,.06);
  --sel: rgba(79,110,247,.20);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
::selection { background: var(--sel); }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.7; padding: 0 16px 100px;
  transition: background .3s ease, color .3s ease; -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 820px; margin: 0 auto; }

/* ---- Nút nổi ---- */
.fab-group { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.fab {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--card); color: var(--text); cursor: pointer; font-size: 18px;
  display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: .18s;
}
.fab:hover { border-color: var(--accent); transform: translateY(-2px); }
#toTop { opacity: 0; pointer-events: none; }
#toTop.show { opacity: 1; pointer-events: auto; }

/* ---- Nav ---- */
.nav-top { padding: 20px 0; display: flex; justify-content: space-between; font-size: 14px; gap: 12px; }
.nav-top a { color: var(--accent); text-decoration: none; }
.nav-top a:hover { text-decoration: underline; }

/* ---- Hero ---- */
.hero { text-align: center; padding: 20px 0 6px; }
.hero .kicker { display: inline-block; background: var(--card-2); border: 1px solid var(--border); color: var(--accent); font-size: 12px; padding: 5px 14px; border-radius: 20px; margin-bottom: 14px; letter-spacing: .4px; }
.hero h1 { font-size: 32px; font-weight: 800; letter-spacing: -1px; color: var(--text-strong); line-height: 1.15; }
.hero p { color: var(--muted); margin-top: 10px; font-size: 15.5px; max-width: 620px; margin-left: auto; margin-right: auto; }

/* ---- Thanh tiến độ tổng ---- */
.dash { background: linear-gradient(135deg, var(--card), var(--card-2)); border: 1px solid var(--border); border-radius: 18px; padding: 24px; margin: 26px 0 20px; box-shadow: var(--shadow); }
.dash .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.dash .top strong { font-size: 15px; color: var(--text-strong); }
.dash .pct { font-size: 28px; font-weight: 800; color: var(--accent-2); }
.bigbar { height: 13px; background: var(--bg-2); border-radius: 20px; overflow: hidden; border: 1px solid var(--border); }
.bigbar > span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 20px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.dash .meta { color: var(--muted); font-size: 13px; margin-top: 12px; display: flex; gap: 18px; flex-wrap: wrap; }
.dash .meta b { color: var(--text); }

/* ---- Bộ lọc cấp độ ---- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 24px; }
.filters button {
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  padding: 8px 16px; border-radius: 20px; font-size: 13.5px; cursor: pointer; transition: .15s; font-family: inherit;
}
.filters button:hover { border-color: var(--accent); color: var(--text); }
.filters button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Nhóm giai đoạn ---- */
.gd-group { margin-bottom: 34px; }
.gd-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.gd-head .gd-num { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border); display: grid; place-items: center; font-weight: 700; color: var(--accent); }
.gd-head h2 { font-size: 20px; font-weight: 700; color: var(--text-strong); }
.gd-head .gd-count { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.gd-desc { color: var(--muted); font-size: 13.5px; margin: 0 0 6px 52px; }
.gd-link { margin: 0 0 14px 52px; }
.gd-link a { color: var(--accent); font-size: 13px; text-decoration: none; }
.gd-link a:hover { text-decoration: underline; }

/* ---- Thẻ bài tập ---- */
.bt {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 12px; padding: 18px 20px; box-shadow: var(--shadow-sm); transition: .15s;
}
.bt:hover { border-color: var(--accent); }
.bt.done { border-color: var(--accent-2); }
.bt-top { display: flex; align-items: flex-start; gap: 12px; }
.bt-check {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; margin-top: 2px;
  border: 2px solid var(--border); background: transparent; cursor: pointer;
  display: grid; place-items: center; font-size: 14px; color: var(--accent-2); transition: .15s; font-family: inherit;
}
.bt-check:hover { border-color: var(--accent-2); }
.bt-check.done { background: var(--accent-2); border-color: var(--accent-2); color: #06210f; font-weight: 800; }
.bt-main { flex: 1; min-width: 0; }
.bt-de { font-size: 15.5px; color: var(--text); }
.bt-de code { background: var(--card-2); padding: 2px 7px; border-radius: 6px; font-size: 13.5px; color: var(--inline-code); border: 1px solid var(--border); }
.bt-tag { display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 20px; font-weight: 600; margin-bottom: 8px; letter-spacing: .3px; }
.tag-co-ban { background: color-mix(in srgb, var(--accent-2) 18%, transparent); color: var(--accent-2); }
.tag-trung-binh { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.tag-kho { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }

.bt-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.bt-actions button {
  background: transparent; border: 1px solid var(--border); color: var(--accent);
  padding: 6px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; transition: .15s; font-family: inherit;
}
.bt-actions button:hover { border-color: var(--accent); background: var(--card-2); }

.bt-reveal { margin-top: 12px; display: none; }
.bt-reveal.show { display: block; }
.bt-hint {
  background: color-mix(in srgb, var(--accent) 10%, transparent); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 10px;
}
.bt-hint b { color: var(--accent); }
.bt-sol { }
.bt-sol .sol-label { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

/* ---- Code trong lời giải ---- */
.bt-reveal pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; overflow-x: auto; margin: 6px 0; font-size: 13.5px; line-height: 1.6;
}
.bt-reveal p { margin-bottom: 10px; font-size: 14.5px; }
.bt-reveal ol, .bt-reveal ul { margin: 0 0 10px 20px; }
.bt-reveal li { margin-bottom: 5px; font-size: 14.5px; }
code { font-family: "SF Mono", "Fira Code", Consolas, monospace; }
pre code { color: var(--code-text); background: none; border: none; padding: 0; }
.c-key { color: #ff7b9c; } .c-str { color: #9ff28f; } .c-num { color: #ffd9a0; }
.c-com { color: #6b7280; font-style: italic; } .c-fn { color: #6c8cff; }
.c-tag { color: #ff7b9c; } .c-attr { color: #ffd9a0; } .c-out { color: #8b90a0; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14.5px; }
footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 34px; }
