/* ---------------------------------------------------------------
   SSLC Percentage Calculator — professional light theme
----------------------------------------------------------------*/

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --line: #e6eaf2;
  --line-strong: #d7dde9;
  --text: #16213e;
  --heading: #0d1730;
  --muted: #67738d;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff4ff;
  --good: #15803d;
  --good-soft: #eaf7ef;
  --warn: #b45309;
  --warn-soft: #fdf3e6;
  --bad: #b91c1c;
  --bad-soft: #fdeeee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 26px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 22px; }

h1, h2, h3 { color: var(--heading); letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }

a { color: var(--brand); text-decoration: none; }

/* ---------- Top bar ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 11px; color: inherit; flex-shrink: 0; }

.logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #38bdf8);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.32);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 700; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand-text small { font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.topnav { display: flex; gap: 22px; }
.topnav a {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: 0.15s;
}
.topnav a:hover { color: var(--brand); border-bottom-color: var(--brand); }

.topnav-support {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #dbe6ff;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s;
}

.topnav-support:hover { background: #e3ecff; border-color: #c5d6ff; }
.topnav-support:active { transform: translateY(1px); }

.topnav .nav-short { display: none; }
.topnav .nav-fit.is-short .nav-full { display: none; }
.topnav .nav-fit.is-short .nav-short { display: inline; }
.brand.is-compact .brand-text small { display: none; }
.brand.is-icon .brand-text { display: none; }

/* ---------- Intro ---------- */

.intro { text-align: center; padding: 54px 22px 30px; }

.eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #dbe6ff;
  padding: 5px 13px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.intro h1 { font-size: clamp(30px, 5vw, 42px); font-weight: 800; margin-bottom: 12px; }
.intro p { max-width: 640px; margin: 0 auto; color: var(--muted); font-size: 15.5px; }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding-bottom: 26px;
}

.layout > * { min-width: 0; }

.col-side { display: flex; flex-direction: column; gap: 22px; }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card + .card { margin-top: 0; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.card-head h2 { font-size: 18px; font-weight: 700; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.hint strong { color: var(--text); font-weight: 600; }

.footnote { font-size: 12.5px; color: var(--muted); margin-top: 16px; line-height: 1.6; }

/* ---------- Fields / tabs ---------- */

.field { margin-bottom: 18px; }

.board-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.board-pick label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.board-pick select {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 30px 8px 11px;
  cursor: pointer;
  outline: none;
  text-align-last: left;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%2367738d' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

.board-pick select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tabs {
  display: flex;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 16px;
}

.tab {
  font: inherit;
  flex: 1;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  padding: 11px 14px;
  cursor: pointer;
  transition: 0.16s;
}

.tab:hover { color: var(--text); background: #eef1f8; }

.tab.active {
  color: var(--brand-dark);
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

.link-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  background: none;
  border: 0;
  padding: 12px 2px 0;
  cursor: pointer;
}

.link-btn:hover { text-decoration: underline; }

/* ---------- Grade counters (simple grade entry) ---------- */

.grade-counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr));
  gap: 10px;
  margin-top: 14px;
}

.counter {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 11px 12px;
  transition: 0.15s;
}

.counter:hover { border-color: var(--line-strong); background: #fff; }

.counter-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.counter-top .dot {
  width: 9px;
  height: 20px;
  border-radius: 5px;
  background: var(--gc);
  flex: none;
}

.counter-top .cg { font-size: 15px; font-weight: 800; color: var(--heading); }
.counter-top .cb { font-size: 11.5px; color: var(--muted); margin-left: auto; }

.counter-ctrl { display: flex; align-items: center; gap: 8px; }

.counter-ctrl .step {
  font: inherit;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
  transition: 0.14s;
}

.counter-ctrl .step:hover { background: var(--brand-soft); border-color: var(--brand); }
.counter-ctrl .step:active { transform: scale(0.94); }

.counter-ctrl input {
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  width: 100%;
  min-width: 44px;
  color: var(--heading);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 7px 4px;
  outline: none;
  -moz-appearance: textfield;
}

.counter-ctrl input::-webkit-outer-spin-button,
.counter-ctrl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.counter-ctrl input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 4px;
}

.seg {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: 0.15s;
}

.seg:hover { color: var(--text); background: #eef1f8; }

.seg.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

/* ---------- Table ---------- */

.table-wrap { overflow-x: auto; margin-top: 4px; }

.marks-table { width: 100%; border-collapse: collapse; min-width: 560px; }

.marks-table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  white-space: nowrap;
}

.marks-table th.num, .marks-table td.num { text-align: center; }
.marks-table th.c-sl, .marks-table td.c-sl { width: 36px; text-align: center; }
.marks-table th.c-subject { width: auto; }
.marks-table th.c-got, .marks-table th.c-max, .marks-table th.c-grade { width: 88px; }
.marks-table th.c-pct { width: 74px; }
.marks-table th.c-act, .marks-table td.c-act { width: 46px; text-align: center; }

.marks-table tbody td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.marks-table tbody tr:last-child td { border-bottom: 0; }
.marks-table tbody tr:hover td { background: #fbfcff; }

.sl { font-size: 12.5px; font-weight: 700; color: var(--muted); }

.pct-cell {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

input[type="text"],
input[type="number"],
select {
  font: inherit;
  width: 100%;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 10px;
  outline: none;
  transition: 0.15s;
}

input[type="number"] { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

select { cursor: pointer; font-weight: 600; text-align: center; text-align-last: center; }

input::placeholder { color: #a4adc2; font-weight: 400; }

input:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input.invalid {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.13);
  background: var(--bad-soft);
}

.del {
  font: inherit;
  font-size: 17px;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #a8b1c4;
  cursor: pointer;
  transition: 0.15s;
}

.del:hover { background: var(--bad-soft); border-color: #f6cccc; color: var(--bad); }
.del:disabled { opacity: 0.35; cursor: not-allowed; background: transparent; border-color: transparent; }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.row-actions .opt { margin-left: auto; }

/* ---------- Buttons ---------- */

.btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 9px;
  padding: 9px 15px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: 0.15s;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--muted);
}
.btn-ghost:hover { color: var(--text); border-color: #b9c2d4; background: var(--surface-2); }

.btn-soft {
  background: var(--brand-soft);
  border-color: #dbe6ff;
  color: var(--brand-dark);
}
.btn-soft:hover { background: #e3ecff; }

.opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.opt input { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }

/* ---------- Expected-subjects field (grade count mode) ---------- */

.total-field {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
}

.total-field label { font-weight: 600; }

.total-field input {
  font: inherit;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 6px;
  width: 58px;
  outline: none;
  -moz-appearance: textfield;
}

.total-field input::-webkit-outer-spin-button,
.total-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.total-field input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.total-live {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #dbe6ff;
  border-radius: 999px;
  padding: 4px 10px;
}

.total-live.warn { color: var(--warn); background: var(--warn-soft); border-color: #f6e0c4; }
.total-live.ok { color: var(--good); background: var(--good-soft); border-color: #cdebd8; }

/* ---------- Note callout ---------- */

.note {
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid #f6e0c4;
  border-left: 3px solid var(--warn);
  border-radius: 9px;
  padding: 11px 13px;
}

.note strong { color: #8a4108; }

/* ---------- Grade tag (grade count table) ---------- */

.grade-tag {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--heading);
}

.grade-tag i {
  width: 9px;
  height: 22px;
  border-radius: 5px;
  flex: none;
}

.grade-tag small {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
}

/* ---------- Result card ---------- */

.result-card {
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(56, 189, 248, 0.14), transparent 62%),
    linear-gradient(180deg, #ffffff, #fbfcff);
  border-color: #dce4f6;
}

.eyebrow-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.big {
  font-size: clamp(44px, 7vw, 56px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
  color: var(--heading);
  margin: 8px 0 2px;
  font-variant-numeric: tabular-nums;
}

.big .unit { font-size: 24px; font-weight: 700; color: var(--brand); margin-left: 3px; }

.range { font-size: 12.5px; color: var(--muted); min-height: 19px; }

.bar {
  height: 8px;
  border-radius: 999px;
  background: #e9edf6;
  overflow: hidden;
  margin: 14px 0 16px;
}

.bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #38bdf8);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.pills { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: #f1f4fa;
  border: 1px solid var(--line);
  color: var(--muted);
}

.pill.good { background: var(--good-soft); border-color: #cdebd8; color: var(--good); }
.pill.warn { background: var(--warn-soft); border-color: #f6e0c4; color: var(--warn); }
.pill.bad  { background: var(--bad-soft);  border-color: #f6d2d2; color: var(--bad); }
.pill.brand { background: var(--brand-soft); border-color: #dbe6ff; color: var(--brand-dark); }

/* ---------- Stats ---------- */

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 18px; }

.stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
}

.stat .label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 21px;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Subject distribution ---------- */

.dist { display: flex; flex-direction: column; gap: 11px; }

.dist-empty { font-size: 13px; color: var(--muted); }

.dist-row { display: flex; align-items: center; gap: 10px; }

.dist-name {
  flex: 0 0 40%;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dist-track {
  flex: 1;
  height: 7px;
  background: #eef1f8;
  border-radius: 999px;
  overflow: hidden;
}

.dist-track i { display: block; height: 100%; border-radius: 999px; transition: width 0.45s ease; }

.dist-val {
  flex: 0 0 70px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Grade scale ---------- */

#scale { padding-bottom: 26px; }

.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(168px, 100%), 1fr));
  gap: 10px;
}

.grade-item {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 13px;
}

.grade-item .swatch {
  width: 11px;
  height: 34px;
  border-radius: 6px;
  flex: none;
}

.grade-item .g { font-size: 14.5px; font-weight: 800; color: var(--heading); }
.grade-item .r { font-size: 11.5px; color: var(--muted); display: block; line-height: 1.45; }

/* ---------- FAQ ---------- */

#faq { padding-bottom: 34px; }

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 18px;
}

.card.faq h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.card.faq p { font-size: 13.5px; color: var(--muted); line-height: 1.65; }
.card.faq strong { color: var(--text); font-weight: 600; }

/* ---------- SEO sections (board links + headings) ---------- */

.section-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  margin: 34px 0 6px;
}

.section-sub {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 18px;
}

.board-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.board-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  box-shadow: var(--shadow);
  transition: 0.15s;
}

.board-links a:hover { background: var(--brand-soft); border-color: #c5d6ff; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 22px 0 30px;
}

.site-footer p { font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.7; }

.site-footer .credit {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 18px;
  margin-top: 10px;
}

.footer-link,
.footer-support-btn {
  display: inline-block;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}

.footer-link:hover,
.footer-support-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Support / Donate modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 28px;
  position: relative;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.22);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.15s ease;
}

.modal-close-btn:hover { background: var(--line); }

.modal-box h2 { font-size: 20px; margin: 0 0 12px; padding-right: 32px; }
.modal-box p { font-size: 13.5px; line-height: 1.6; color: var(--muted); margin: 0 0 12px; }

.support-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  background: var(--surface-2);
}

.support-tab {
  flex: 1;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 8px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
}

.support-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.support-panel { display: none; }
.support-panel.active { display: block; }

.support-note { font-size: 12.5px; color: var(--muted); margin: 4px 0 16px; }

.support-qr-wrap { display: flex; justify-content: center; margin: 6px 0 16px; }

.support-qr-wrap img {
  width: 190px;
  height: 190px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

.support-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.support-id-row code { flex: 1; font-size: 13.5px; color: var(--text); word-break: break-all; }

.support-copy-btn {
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
}

.support-copy-btn:hover { background: var(--surface-2); }

.support-amounts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.support-amount-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}

.support-amount-btn.active { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }

.support-pay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: var(--brand);
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
}

.support-pay-btn:hover { background: var(--brand-dark); }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .intro { padding-top: 44px; }
}

@media (max-width: 680px) {
  .topnav { gap: 8px; }
  .topnav a:not(.nav-fit) { display: none; }
  .topnav .nav-fit { font-size: 12px; white-space: nowrap; }
  .topnav-support { font-size: 11.5px; padding: 5px 10px; }
  .topbar-inner { gap: 10px; }
  .brand { gap: 8px; min-width: 0; }
  .brand-text small { font-size: 10px; }
  .row-actions .opt { margin-left: 0; }
}

@media (max-width: 420px) {
  .topbar-inner { gap: 8px; }
  .topnav { gap: 6px; }
  .topnav-support { padding: 5px 8px; }
  .topnav .nav-fit .nav-full { display: none; }
  .topnav .nav-fit .nav-short { display: inline; }
}

@media (max-width: 340px) {
  .brand-text { display: none; }
}

@media (max-width: 700px) {
  .marks-table { min-width: 0; }
  .marks-table thead th { font-size: 10px; letter-spacing: 0.05em; padding: 8px 6px; }
  .marks-table th.c-sl, .marks-table td.c-sl { width: 26px; }
  .marks-table th.c-got, .marks-table th.c-max, .marks-table th.c-grade { width: 66px; }
  .marks-table th.c-pct { width: 62px; }
  .marks-table th.c-act, .marks-table td.c-act { width: 36px; }
  .marks-table tbody td { padding: 6px 4px; }
}

@media (max-width: 560px) {
  .card { padding: 17px; }
  .card-head { flex-wrap: wrap; }
  .board-pick { flex: 1 1 auto; min-width: 0; }
  .board-pick select { width: 100%; min-width: 0; }
  .segmented { width: 100%; }
  .seg { flex: 1 1 auto; text-align: center; padding: 8px 10px; }
  .stats { grid-template-columns: 1fr 1fr; }

  .marks-table, .marks-table tbody { display: block; }
  .marks-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .marks-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    position: relative;
    padding: 11px 32px 9px 0;
    border-bottom: 1px solid var(--line);
  }
  .marks-table tbody tr:last-child { border-bottom: 0; }
  .marks-table tbody tr:hover td { background: transparent; }
  .marks-table tbody td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
  }
  .marks-table td.c-sl { display: none; }
  .marks-table td.c-subject { flex: 1 1 100%; min-width: 0; }
  .marks-table td.c-got, .marks-table td.c-max { flex: 0 0 70px; }
  .marks-table td.c-grade { flex: 1 1 120px; max-width: 190px; min-width: 0; }
  .marks-table td.c-pct { flex: 0 0 66px; white-space: nowrap; }
  .marks-table td.c-act { position: absolute; top: 11px; right: 0; }
  .marks-table td.c-got::before,
  .marks-table td.c-max::before,
  .marks-table td.c-grade::before,
  .marks-table td.c-pct::before {
    display: block;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
  }
  .marks-table td.c-got::before { content: "Got"; }
  .marks-table td.c-max::before { content: "Max"; }
  #gradesTable td.c-max::before { content: "Pts"; }
  .marks-table td.c-grade::before { content: "Grade"; }
  .marks-table td.c-pct::before { content: "%"; }
  #gradesTable td.c-pct::before { content: "Band"; }
  .marks-table input, .marks-table select { width: 100%; height: 40px; padding: 0 9px; }
  .marks-table td.c-pct, #gradesTable td.c-max { line-height: 40px; }
}

@media (max-width: 400px) {
  .marks-table tbody tr { padding-right: 30px; }
  .marks-table td.c-got { flex-basis: 62px; }
  .marks-table td.c-max { flex-basis: 56px; }
  .marks-table td.c-grade { flex-basis: 70px; }
  .marks-table td.c-pct { flex: 0 0 auto; }
  .del { width: 26px; height: 26px; font-size: 15px; }
  .tab { font-size: 13px; padding: 10px 6px; }
  .intro h1 { font-size: 27px; }
  .intro { padding: 30px 16px 24px; }
  .wrap { padding: 0 14px; }
}

/* ---------- Print ---------- */

@media print {
  body { background: #fff; }
  .topbar, .topnav, .row-actions, #faq, .site-footer, .btn, .opt, .modal-backdrop { display: none !important; }
  .wrap { max-width: 100%; padding: 0 12px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .card { box-shadow: none; border: 1px solid #d5dae6; break-inside: avoid; min-width: 0; }
  .intro { padding: 12px 0; }
  .marks-table { min-width: 0; }
  .table-wrap { overflow: visible; }
  .marks-table th.c-act, .marks-table td.c-act { display: none; }
}
