/* style.css — HSC English Master Guide design system */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6fb; --bg2: #e9edf6; --card: #ffffff; --text: #1c2333; --muted: #64748b;
  --line: #dde3ee; --accent: #2563eb; --accent2: #1e40af; --accent-soft: #dbeafe;
  --good: #15803d; --good-soft: #dcfce7; --bad: #dc2626; --bad-soft: #fee2e2;
  --warn: #b45309; --warn-soft: #fef3c7; --star: #a16207; --star-soft: #fef9c3;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 8px 24px -12px rgba(16, 24, 40, .18);
  --radius: 14px; --side-w: 264px;
}
[data-theme="dark"] {
  --bg: #0d1220; --bg2: #0a0e1a; --card: #151c2e; --text: #e7ecf5; --muted: #8b96ab;
  --line: #273048; --accent: #3b82f6; --accent2: #60a5fa; --accent-soft: #1e2b4d;
  --good: #4ade80; --good-soft: #0c2e1a; --bad: #f87171; --bad-soft: #3a1420;
  --warn: #fbbf24; --warn-soft: #33260a; --star: #fde047; --star-soft: #2e2a0a;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 10px 30px -12px rgba(0, 0, 0, .6);
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans Bengali', 'Hind Siliguri', 'SolaimanLipi', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.7; font-size: 15.5px;
  transition: background .3s, color .3s;
}
.en { font-family: Georgia, 'Times New Roman', serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--card);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 60;
  transition: transform .3s;
}
.main-wrap { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
#view { flex: 1; padding: 22px clamp(14px, 3vw, 34px) 60px; max-width: 1160px; width: 100%; margin: 0 auto; }
.foot { padding: 18px; text-align: center; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--line); }

.logo { display: flex; gap: 12px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.logo-mark {
  width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font: 800 22px/42px Georgia, serif; text-align: center; flex: none;
}
.logo b { font-size: 15.5px; display: block; }
.logo small { color: var(--muted); font-size: 11px; }

#nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-link, .nav-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); font-size: 14.5px; cursor: pointer; font-weight: 600;
}
.nav-link:hover, .nav-head:hover { background: var(--bg); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-head i { margin-left: auto; font-style: normal; color: var(--muted); transition: transform .25s; }
.nav-group.open .nav-head i { transform: rotate(180deg); }
.nav-sub { display: none; padding: 2px 0 6px 14px; }
.nav-group.open .nav-sub { display: block; animation: fadein .25s; }
.nav-sub a { display: block; padding: 7px 12px; font-size: 13.5px; color: var(--muted); border-left: 2px solid var(--line); }
.nav-sub a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.micro { font-size: 10.5px; color: var(--muted); margin-top: 6px; }

.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 10px clamp(14px, 3vw, 34px); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 17px; color: var(--text); flex: none;
}
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.crumbs b { color: var(--text); }
.top-search { margin-left: auto; }
.top-search input {
  width: min(380px, 38vw); padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 13.5px; font-family: inherit;
}
.top-search input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.backdrop { display: none; }

/* ---------- cards & grids ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; animation: fadein .35s;
}
.grid { display: grid; gap: 16px; margin-bottom: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.hero h1 { font-size: clamp(20px, 3vw, 27px); margin-bottom: 8px; }
.hero p { color: var(--muted); max-width: 760px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.small-hero { padding: 18px 22px; }
.sec-title { margin: 26px 0 12px; font-size: 19px; }
.section-head { margin: 20px 0 12px; }

/* ---------- stats ---------- */
.stat-card { display: flex; gap: 14px; align-items: center; padding: 16px 18px; }
.stat-ic { font-size: 26px; width: 50px; height: 50px; display: grid; place-items: center; background: var(--accent-soft); border-radius: 12px; flex: none; }
.stat-v { font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat-l { font-size: 13px; color: var(--muted); }
.stat-s { font-size: 12px; color: var(--accent); }

/* ---------- buttons & badges ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 700;
  font-size: 14px; cursor: pointer; font-family: inherit; transition: transform .15s, box-shadow .15s, background .2s;
  text-decoration: none !important; margin: 3px 4px 3px 0;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-green { background: var(--good); border-color: var(--good); color: #fff; }
.btn-red { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-big { font-size: 17px; padding: 13px 26px; }
.btn-block { width: 100%; justify-content: center; margin-top: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.badge {
  display: inline-block; padding: 2.5px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); vertical-align: middle;
}
.badge-green { background: var(--good-soft); color: var(--good); }
.badge-red { background: var(--bad-soft); color: var(--bad); }
.badge-amber { background: var(--warn-soft); color: var(--warn); }
.badge-board { background: var(--star-soft); color: var(--star); }

/* ---------- topic cards ---------- */
.topic-card { display: block; color: var(--text); transition: transform .2s, box-shadow .2s; }
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.tc-top { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.topic-card h3 { font-size: 17.5px; margin-bottom: 2px; }
.bn-title { color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.tc-meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }

/* ---------- lesson content ---------- */
.topic-head h1 { font-size: clamp(21px, 3vw, 28px); margin: 6px 0 2px; }
.th-top { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.lesson h3, .cheats h3, .mistakes h3 { margin-bottom: 12px; }
.lesson h4 { margin: 18px 0 8px; font-size: 16.5px; }
.lesson p { margin-bottom: 10px; }
.lesson ul, .lesson ol { margin: 8px 0 14px 22px; }
.lesson li { margin-bottom: 6px; }
.lesson h3 { border-bottom: 2px solid var(--accent-soft); padding-bottom: 8px; }

.ex-card {
  border-left: 4px solid var(--accent); background: var(--bg); border-radius: 0 10px 10px 0;
  padding: 10px 14px; margin: 10px 0;
}
.ex-card .en { font-size: 16px; font-style: italic; }
.ex-card .bn { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.pair-card { border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.pair-row { padding: 4px 8px; border-radius: 6px; margin-bottom: 4px; font-size: 15.5px; }
.pair-row.bad { background: var(--bad-soft); }
.pair-row.good { background: var(--good-soft); }
.pair-card .bn { font-size: 13px; color: var(--muted); }
.formula-box {
  font-family: 'Courier New', monospace; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: 14px; font-weight: 700;
  overflow-x: auto; white-space: pre-wrap;
}
.note { border-radius: 10px; padding: 12px 16px; margin: 12px 0; font-size: 14.5px; }
.note-tip { background: var(--accent-soft); border-left: 4px solid var(--accent); }
.note-warn { background: var(--bad-soft); border-left: 4px solid var(--bad); }
.note-star { background: var(--star-soft); border-left: 4px solid var(--star); }
.steps-card { background: var(--bg); border-radius: 10px; padding: 14px 16px 14px 8px; margin: 12px 0; }
.steps-card ol { margin-left: 24px; }
.steps-card li { margin-bottom: 8px; font-weight: 600; }

.cheat-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; margin: 10px 0;
  background: linear-gradient(135deg, var(--card), var(--bg));
}
.cheat-name { font-weight: 800; color: var(--accent); margin-bottom: 6px; }
.cheat-when { font-size: 13.5px; margin-top: 6px; }
.mistakes ul { margin-left: 20px; }
.mistakes li { margin-bottom: 8px; }
.mistakes { border-top: 3px solid var(--warn); }
.sources ul { margin-left: 20px; font-size: 13.5px; }

/* ---------- tables ---------- */
.tbl-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.8px; margin: 10px 0; }
.tbl th { text-align: left; background: var(--bg); padding: 9px 10px; border: 1px solid var(--line); font-size: 12.5px; }
.tbl td { padding: 8px 10px; border: 1px solid var(--line); vertical-align: top; }
.vocab-tbl td { font-size: 13px; }

/* ---------- practice engine ---------- */
.eng-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.eng-mode { font-size: 14.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#eng-clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 18px; padding: 5px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.timer-warn { background: var(--warn-soft) !important; color: var(--warn) !important; }
.timer-danger { background: var(--bad-soft) !important; color: var(--bad) !important; animation: pulse 1s infinite; }
.q-card { border-top: 3px solid var(--accent); }
.q-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.q-text .en { font-size: 16.5px; line-height: 1.75; }
.pre-sent { background: var(--bg); padding: 10px 14px; border-radius: 10px; margin-top: 8px; font-style: italic; }
.q-title-line { font-weight: 700; margin-bottom: 8px; }
.hint-btn { margin: 10px 0; }
.hint-box { background: var(--star-soft); border-radius: 10px; padding: 10px 14px; margin: 8px 0; font-size: 14px; }
.opts { display: grid; gap: 9px; margin-top: 12px; }
.opt {
  display: flex; gap: 12px; align-items: center; text-align: left; padding: 11px 14px; border-radius: 11px;
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-size: 15px;
  color: var(--text); font-family: inherit; transition: border .2s, background .2s;
}
.opt:hover { border-color: var(--accent); }
.opt-key { font-weight: 800; color: var(--muted); font-family: Georgia, serif; flex: none; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt:disabled { cursor: default; }
.feedback { border-radius: 11px; padding: 12px 16px; margin-top: 12px; font-size: 14.5px; animation: fadein .3s; }
.feedback.good { background: var(--good-soft); border-left: 4px solid var(--good); }
.feedback.bad { background: var(--bad-soft); border-left: 4px solid var(--bad); }
.feedback .tbl { margin: 8px 0; background: var(--card); }
.fill-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.fill-inp, .cloze-inp {
  padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card);
  color: var(--text); font-size: 15px; font-family: Georgia, serif; min-width: 200px;
}
.cloze-inp { min-width: 90px; width: 110px; padding: 5px 8px; font-size: 14px; margin: 0 2px; }
.cloze-p { margin: 8px 0; line-height: 2.3; font-size: 15.5px; }
.clue-box { background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.clue-head { font-size: 13.5px; margin-bottom: 8px; }
.clue-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  cursor: pointer; font-size: 13.5px; font-family: Georgia, serif; color: var(--text);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.order-seq { min-height: 52px; border: 2px dashed var(--line); border-radius: 12px; padding: 8px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.seq-item { text-align: left; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--accent); background: var(--accent-soft); cursor: pointer; font-size: 14.5px; font-family: Georgia, serif; color: var(--text); }
.order-pool { display: flex; flex-direction: column; gap: 7px; margin: 10px 0; }
.chip-chunk { text-align: left; padding: 9px 13px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; font-size: 14.5px; font-family: Georgia, serif; color: var(--text); }
.chip-chunk:hover { border-color: var(--accent); }
.chip-chunk:disabled { opacity: .35; }
.q-nav { display: flex; justify-content: space-between; margin: 16px 0 10px; }
.bar-wrap { display: flex; align-items: center; gap: 10px; }
.bar-wrap.slim { gap: 6px; }
.bar { flex: 1; height: 9px; background: var(--bg2); border-radius: 999px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; transition: width .5s; }

.write-ta {
  width: 100%; min-height: 130px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--text); font-size: 15px; font-family: inherit; resize: vertical; margin-top: 10px;
}
.write-ta.big { min-height: 220px; font-family: Georgia, serif; }
.write-ta:focus { outline: 2px solid var(--accent); border-color: transparent; }
.word-count { margin: 6px 0 8px; }
.model-box { border: 2px solid var(--good); border-radius: 12px; padding: 14px 16px; margin-top: 12px; background: var(--good-soft); }
.model-label { font-weight: 800; color: var(--good); margin-bottom: 8px; }
.model-ans { font-size: 15.5px; background: var(--card); border-radius: 10px; padding: 12px 14px; }
.model-ans p { margin-bottom: 9px; }
.model-box .exp { margin-top: 10px; font-size: 14px; }
.pts { margin-top: 10px; font-size: 14px; }
.pts ul { margin: 6px 0 0 20px; }
.self-mark { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; font-weight: 700; }

/* exam */
.exam-layout { display: grid; grid-template-columns: 1fr 230px; gap: 18px; align-items: start; }
.exam-side { position: sticky; top: 76px; }
.palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; }
.pal-btn {
  padding: 8px 0; border-radius: 8px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
  font-weight: 700; font-size: 13px; color: var(--text);
}
.pal-btn.answered { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.pal-btn.active { outline: 2.5px solid var(--accent); }
.result-card { text-align: center; border-top: 4px solid var(--accent); }
.score-ring {
  width: 130px; height: 130px; border-radius: 50%; margin: 14px auto; display: grid; place-items: center;
  position: relative;
}
.score-ring b { font-size: 30px; background: var(--card); width: 104px; height: 104px; border-radius: 50%; display: grid; place-items: center; }
.big { font-size: 17px; margin: 8px 0; }
.good { color: var(--good); } .bad { color: var(--bad); } .ok { color: var(--warn); }
.muted { color: var(--muted); } .small { font-size: 13px; }
.review-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 15px; margin: 10px 0; }
.review-item.right { border-left: 4px solid var(--good); }
.review-item.wrong { border-left: 4px solid var(--bad); }
.review-item.skip { border-left: 4px solid var(--muted); }
.rv-head { margin-bottom: 6px; }
.rv-ol { margin: 8px 0 8px 22px; font-family: Georgia, serif; font-size: 14.5px; }
.exp { font-size: 14px; }

/* mode grid */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.mode-btn {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding: 14px 15px; border-radius: 13px;
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer; text-align: right; color: var(--text); font-family: inherit;
  transition: transform .18s, border .18s;
}
.mode-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.mode-ic { font-size: 22px; }
.practice-topic { display: flex; flex-direction: column; gap: 8px; }
.pt-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pt-btns { display: flex; flex-wrap: wrap; gap: 2px; }
.weak-card { border-left: 4px solid var(--bad); }
.mini-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.mini-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 11px; background: var(--bg); color: var(--text); font-size: 14px;
}
a.mini-item:hover { background: var(--accent-soft); text-decoration: none; }
.check-item { display: flex; gap: 10px; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 14.5px; align-items: flex-start; }
.check-item:hover { background: var(--bg); }
.check-item input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 4px; flex: none; }
.check-item.done span { text-decoration: line-through; color: var(--muted); }

.subnav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.subnav.wrap { margin: 0 0 14px; }
.vocab-tools { padding: 14px 16px; }
.vocab-search { width: 100%; padding: 11px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--text); font-size: 15px; font-family: inherit; }
.sel { padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-family: inherit; font-size: 13.5px; }
.board-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; }

.act-chart { display: flex; gap: 6px; align-items: flex-end; height: 120px; margin: 14px 0 6px; }
.act-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.act-col i { width: 100%; max-width: 26px; background: linear-gradient(180deg, var(--accent), var(--accent2)); border-radius: 5px 5px 0 0; min-height: 3px; transition: height .5s; }
.act-col span { font-size: 10.5px; color: var(--muted); }

.test-card { display: flex; flex-direction: column; gap: 8px; }
.cheat-sheet { border-left: 4px solid var(--star); }

@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .exam-layout { grid-template-columns: 1fr; }
  .exam-side { position: static; }
  .palette { grid-template-columns: repeat(10, 1fr); }
}
@media (max-width: 880px) {
  .sidebar { transform: translateX(-105%); box-shadow: var(--shadow); }
  body.side-open .sidebar { transform: none; }
  body.side-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(5, 8, 18, .55); z-index: 55; }
  .main-wrap { margin-left: 0; }
  .top-search { flex: 1; }
  .top-search input { width: 100%; }
  .crumbs { display: none; }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .card { padding: 15px 14px; }
  .palette { grid-template-columns: repeat(6, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .fill-inp { min-width: 140px; }
}

/* ---------- print (cheat sheets) ---------- */
@media print {
  .sidebar, .topbar, .foot, .subnav, #print-cheats, .backdrop { display: none !important; }
  .main-wrap { margin: 0; }
  #view { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; }
  body { background: #fff; color: #000; }
}
