:root {
  --header-radius: 16px;   /* <-- header corner roundness (px) */
  --bg-color: #161616; 
  --card-bg: rgba(26, 28, 30, 0.7); 
  --header-bg: #f5f5f5;
  --header-text: #1a1a1a;
  --accent-hdsf: #f1f5f9;
  --accent-bbb: #f1f5f9;
  --text-main: #f1f5f9;
  --text-dim: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);
  --settings-item-icon: #fff;
  --settings-item-sub: #A2A2A2;
  --border-theory-practical: rgba(255,255,255,0.03);
    --category-text-color:  black;
}

body.light-mode,
html.light-mode-pre body {
  --bg-color: #f0f2f5;
  --card-bg: rgba(255, 255, 255, 0.85);
  --header-bg: #2D2D2D;
  --header-text: #ffffff;
  --text-main: #1a1c1e;
  --text-dim: #555e6b;
  --border-color: rgba(0, 0, 0, 0.1);
  --settings-item-icon: #2D2D2D;
  --settings-item-sub: #999;
  --border-theory-practical: rgba(0,0,0,0.04);
   --category-text-color:  #ffffff;
}

html.already-activated #activation-overlay { display: none !important; }
html.already-activated body { overflow: auto; }

/* ===== APP FEEL: no pull-to-refresh / rubber-band reload ===== */
html, body {
  overscroll-behavior-y: none;
}

/* ===== CARDS POP IN when the page opens ===== */
@keyframes cardPop {
  0%   { opacity: 0; transform: translateY(18px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.subject-card.card-pop {
  animation: cardPop 0.55s cubic-bezier(0.22, 1.25, 0.36, 1) backwards;
}
@media (prefers-reduced-motion: reduce) {
  .subject-card.card-pop { animation: none; }
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

* {
  box-sizing: border-box;
}

/* ===== PROTECTION: disable printing ===== */
@media print {
  body * {
    visibility: hidden !important;
  }
  body::before {
    content: "Printing is disabled for this document.";
    visibility: visible;
    display: block;
    text-align: center;
    margin-top: 40vh;
    font-size: 1.2rem;
  }
}

body {
  font-family: 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  margin: 0;
  padding: 15px;
  display: flex;
  flex-direction: column;
  -webkit-user-select: none;
  user-select: none;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.main-header,
.site-footer,
#activation-overlay {
  position: relative;
  z-index: 1;
}

/* ===== ACTIVATION SYSTEM ===== */
body.locked { overflow: hidden; }
body.locked .mcq-link { pointer-events: none; opacity: 0.5; }
#activation-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(12, 13, 14, 0.98);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.activation-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 40px 30px;
  border-radius: 14px;
  text-align: center;
  width: 90%;
  max-width: 400px;
}
.activation-card input {
  width: 100%; padding: 16px; background: #000; border: 1px solid var(--border-color);
  border-radius: 8px; color: #fff; text-align: center; margin-bottom: 20px;
}
.activation-card button {
  width: 100%; padding: 16px; background: var(--accent-bbb); color: #000;
  border: none; border-radius: 8px; font-weight: 800; font-size: 0.9rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ===== UNIFIED HEADER (icon + name + subtitle + action icons) ===== */
.main-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 6px 8px;
  border-radius: var(--header-radius, 16px);
  margin-bottom: 10px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 1;
  border-radius: 10px;
  padding: 4px 6px 4px 0;
  transition: background 0.2s ease;
  user-select: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.header-left:hover { background: rgba(255,255,255,0.05); }

body.light-mode .header-left:hover,
html.light-mode-pre body .header-left:hover {
  background: rgba(0,0,0,0.05);
}

.app-icon {
  width: 43px;
  height: 43px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent-bbb);
  letter-spacing: -0.03em;
  font-family: 'Segoe UI', sans-serif;
  overflow: hidden;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}

body.light-mode .app-icon,
html.light-mode-pre body .app-icon { background: rgba(0,0,0,0.06); }

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.app-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.01em;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-sub {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .app-name, .header-sub {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }
  .app-name { font-size: 1rem; }
  .header-sub { font-size: 0.78rem; }
  .header-right { flex-shrink: 0; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Circular "light background, no border" icon buttons (filter & settings) */
.top-bar-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  text-decoration: none;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.top-bar-icon-btn:hover { background: rgba(255,255,255,0.16); }

.top-bar-icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-dim);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}

.top-bar-icon-btn:hover svg { stroke: var(--text-main); }

body.light-mode .top-bar-icon-btn,
html.light-mode-pre body .top-bar-icon-btn {
  background: rgba(0, 0, 0, 0.06);
}

body.light-mode .top-bar-icon-btn svg,
html.light-mode-pre body .top-bar-icon-btn svg { stroke: var(--text-dim); }

body.light-mode .top-bar-icon-btn:hover svg,
html.light-mode-pre body .top-bar-icon-btn:hover svg { stroke: var(--text-main); }

body.light-mode .top-bar-icon-btn:hover,
html.light-mode-pre body .top-bar-icon-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* ===== FILTER VIEW ===== */
#filter-view { display: block; width: 100%; }
#filter-view.active { display: block; }

.section-container { width: 100%; margin-bottom: 60px; transition: margin-bottom 0.4s ease; }
.section-container.collapsed { margin-bottom: 24px; }

.category-title {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-size: 1.09rem;
  font-weight: 700;
  margin: 12px 0 20px 0;
  padding: 7px 14px;
  border-radius: 6px;
  align-items: center;
  background: #D5D5D5;
  color: var(--category-text-color);
}

.category-title-text { flex: 1; }

.category-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  margin-left: 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--category-text-color);
  transition: background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.category-toggle-btn:hover { background: rgba(0, 0, 0, 0.08); }

.category-toggle-btn.box-open { background: rgba(0,0,0,0.12); }

/* ===== PER-SECTION FILTER BOX (opened by the section chevron) ===== */
.section-filter-box {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: #111111;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 14px;
  min-width: 220px;
  z-index: 9998;
  opacity: 0; pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 16px 48px rgba(0,0,0,0.65);
  text-transform: none;
  cursor: default;
}
.section-filter-box.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

body.light-mode .section-filter-box,
html.light-mode-pre body .section-filter-box { background: #ffffff; border-color: rgba(0,0,0,0.13); box-shadow: 0 16px 48px rgba(0,0,0,0.15); }

.section-filter-header {
  padding: 14px 16px 10px;
  font-size: 0.72rem; font-weight: 700; color: #555;
  letter-spacing: 0.09em; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
}
body.light-mode .section-filter-header,
html.light-mode-pre body .section-filter-header { border-bottom-color: rgba(0,0,0,0.08); color: #999; }

.section-filter-list { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }

.filter-mode-option {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; font-size: 0.9rem; font-weight: 700;
  color: #aaa; border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.filter-mode-text { flex: 1; }
body.light-mode .filter-mode-option,
html.light-mode-pre body .filter-mode-option { color: #666; }
.filter-mode-option:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
body.light-mode .filter-mode-option:hover,
html.light-mode-pre body .filter-mode-option:hover { background: rgba(0,0,0,0.04); color: #111; }
.filter-mode-option.selected { color: #f1f5f9; background: rgba(255,255,255,0.08); }
body.light-mode .filter-mode-option.selected,
html.light-mode-pre body .filter-mode-option.selected { color: #111; background: rgba(0,0,0,0.06); }

.filter-mode-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.filter-mode-icon svg { width: 19px; height: 19px; fill: currentColor; stroke: none; }
.filter-mode-icon-stroke svg { fill: none; stroke: currentColor; }

.filter-mode-check {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent; position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}
body.light-mode .filter-mode-check,
html.light-mode-pre body .filter-mode-check { border-color: rgba(0,0,0,0.25); }
.filter-mode-option.selected .filter-mode-check { background: #f1f5f9; border-color: #f1f5f9; }
.filter-mode-option.selected .filter-mode-check::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: 2px solid #111;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}
body.light-mode .filter-mode-option.selected .filter-mode-check,
html.light-mode-pre body .filter-mode-option.selected .filter-mode-check { background: #111; border-color: #111; }
body.light-mode .filter-mode-option.selected .filter-mode-check::after,
html.light-mode-pre body .filter-mode-option.selected .filter-mode-check::after { border-color: #fff; }

.section-filter-note {
  margin: 0 12px 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem; font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  display: none;
}
.section-filter-note.show { display: block; }

.category-toggle-btn svg { width: 20px; height: 20px; display: block; }

/* Collapsible grid: uses the grid-template-rows 0fr/1fr trick for smooth height animation */
.subject-grid-wrap {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows 0.4s ease, opacity 0.35s ease;
}

.subject-grid-wrap.collapsed {
  grid-template-rows: 0fr;
  opacity: 0;
}

.subject-grid-inner { overflow: hidden; min-height: 0; padding-top: 4px; margin-top: -4px; }

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  width: 100%;
}

.subject-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  transform: translateZ(0);
  will-change: transform;
}

.subject-card:hover {
  border-color: rgba(255,255,255,0.2);
  background: rgba(40, 42, 45, 0.8);
  transform: translateY(-2px);
}

.card-header h1 { font-size: 1.2rem; margin: 0 0 15px 0; color: var(--text-main); }

.links-container { display: flex; flex-direction: column; gap: 4px; }

.mcq-link {
  color: var(--text-dim);
  font-size: 0.99rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;   /* no double-tap-zoom wait: taps register immediately on iPad / phones */
}
.mcq-link:last-child { border-bottom: none; }
.mcq-link:hover { color: var(--accent-bbb); font-weight: 500; }

.badge {
  font-size: 0.75rem; padding: 3px 10px; border-radius: 4px;
  background: rgba(38, 41, 43, 0.8); color: var(--accent-hdsf); font-weight: 500;
}

.site-footer {
  margin-top: auto; padding: 20px; text-align: center;
  font-size: 0.75rem; opacity: 0.6;
}

body.light-mode,
html.light-mode-pre body { background-color: #eef2f7; }

body.light-mode .subject-card,
html.light-mode-pre body .subject-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.07);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

body.light-mode .subject-card:hover,
html.light-mode-pre body .subject-card:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: #121212;
}

body.light-mode .category-title,
html.light-mode-pre body .category-title { background: rgba(26, 28, 30, 0.7); }

body.light-mode .badge,
html.light-mode-pre body .badge { background: rgba(242, 244, 246, 0.95); color: #121212; }

body.light-mode .mcq-link:hover,
html.light-mode-pre body .mcq-link:hover { color: black; }

/* ===== PROFILE EDIT MODAL ===== */
#profile-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 70px 0 0 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

#profile-modal-backdrop.open { opacity: 1; pointer-events: all; }

#profile-modal {
  background: #111111;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 14px;
  padding: 20px;
  width: 260px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7);
}

.pm-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #666;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 16px 0;
}

.pm-image-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }

.pm-avatar-preview {
  width: 52px; height: 52px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.15);
  overflow: hidden; flex-shrink: 0; background: #222;
}

.pm-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.pm-pick-btn {
  flex: 1; padding: 9px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: #ccc;
  font-size: 0.82rem; font-weight: 600; text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pm-pick-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.22); color: #fff; }

.pm-label {
  font-size: 0.75rem; font-weight: 600; color: #555;
  margin-bottom: 7px; display: block;
  letter-spacing: 0.04em; text-transform: uppercase;
}

.pm-input {
  width: 100%; padding: 10px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: #f1f5f9;
  font-size: 0.9rem; font-family: 'Segoe UI', Roboto, sans-serif;
  outline: none; transition: border-color 0.15s ease, background 0.15s ease;
  margin-bottom: 18px;
}

.pm-input:focus { border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.08); }

.pm-actions { display: flex; gap: 8px; }

.pm-btn {
  flex: 1; padding: 10px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 700; border: none;
  transition: background 0.15s ease, transform 0.1s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pm-btn:active { transform: scale(0.97); }

.pm-btn-cancel {
  background: rgba(255,255,255,0.07); color: #888;
  border: 1px solid rgba(255,255,255,0.08);
}
.pm-btn-cancel:hover { background: rgba(255,255,255,0.11); color: #bbb; }

.pm-btn-save { background: #f1f5f9; color: #111; }
.pm-btn-save:hover { background: #ffffff; }

#profile-file-input { display: none; }

/* ===== SETTINGS DROPDOWN ===== */
.settings-dropdown-wrapper { position: relative; display: inline-block; }

#settings-btn.dropdown-open { background: rgba(255,255,255,0.2); }
#settings-btn.dropdown-open svg { stroke: var(--text-main); }

body.light-mode #settings-btn.dropdown-open,
html.light-mode-pre body #settings-btn.dropdown-open { background: rgba(0,0,0,0.14); }
body.light-mode #settings-btn.dropdown-open svg,
html.light-mode-pre body #settings-btn.dropdown-open svg { stroke: var(--text-main); }

.settings-dropdown {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: #111111;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 14px; overflow: hidden;
  min-width: 200px; z-index: 9999;
  opacity: 0; pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 16px 48px rgba(0,0,0,0.65);
}

.settings-dropdown.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

body.light-mode .settings-dropdown,
html.light-mode-pre body .settings-dropdown {
  background: #ffffff; border-color: rgba(0,0,0,0.13);
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}

.settings-dropdown-header {
  padding: 14px 16px 10px;
  font-size: 0.72rem; font-weight: 700; color: #555;
  letter-spacing: 0.09em; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
}

body.light-mode .settings-dropdown-header,
html.light-mode-pre body .settings-dropdown-header { border-bottom-color: rgba(0,0,0,0.08); color: #999; }

.settings-close-btn {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: background 0.15s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.settings-close-btn:hover { background: rgba(255,255,255,0.1); }
body.light-mode .settings-close-btn:hover,
html.light-mode-pre body .settings-close-btn:hover { background: rgba(0,0,0,0.08); }

.settings-close-btn svg {
  width: 10px; height: 10px; stroke: #666;
  fill: none; stroke-width: 2.5; stroke-linecap: round; flex-shrink: 0;
}
.settings-close-btn:hover svg { stroke: #aaa; }
body.light-mode .settings-close-btn:hover svg,
html.light-mode-pre body .settings-close-btn:hover svg { stroke: #444; }

.settings-item {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 16px; transition: background 0.15s ease; text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.settings-item:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,0.06); }
body.light-mode .settings-item:not(:last-child),
html.light-mode-pre body .settings-item:not(:last-child) { border-bottom-color: rgba(0,0,0,0.06); }
.settings-item:hover { background: rgba(255,255,255,0.06); }
body.light-mode .settings-item:hover,
html.light-mode-pre body .settings-item:hover { background: rgba(0,0,0,0.04); }

.settings-item-icon {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s ease;
}
body.light-mode .settings-item-icon,
html.light-mode-pre body .settings-item-icon { background: rgba(0,0,0,0.06); }
.settings-item:hover .settings-item-icon { background: rgba(255,255,255,0.16); }
body.light-mode .settings-item:hover .settings-item-icon,
html.light-mode-pre body .settings-item:hover .settings-item-icon { background: rgba(0,0,0,0.1); }

.settings-item-icon svg {
  width: 16px; height: 16px; stroke: var(--settings-item-icon);
  fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke 0.15s ease;
}
.settings-item:hover .settings-item-icon svg { stroke: var(--settings-item-icon); }
body.light-mode .settings-item:hover .settings-item-icon svg,
html.light-mode-pre body .settings-item:hover .settings-item-icon svg { stroke: #111; }

.settings-item-icon svg.contact-icon path {
  stroke: var(--settings-item-icon) !important;
}
.settings-item-icon svg.contact-icon { stroke: var(--settings-item-icon); fill: none; transition: fill 0.15s ease; }
.settings-item:hover .settings-item-icon svg.contact-icon { fill: none; }
body.light-mode .settings-item:hover .settings-item-icon svg.contact-icon,
html.light-mode-pre body .settings-item:hover .settings-item-icon svg.contact-icon { fill: none; }

.settings-item-text { display: flex; flex-direction: column; gap: 2px; }

.settings-item-label { font-size: 0.88rem; font-weight: 700; color: #e2e8f0; transition: color 0.15s ease; }
body.light-mode .settings-item-label,
html.light-mode-pre body .settings-item-label { color: #1a1c1e; }

.settings-item-sub { font-size: 0.73rem; color: var(--settings-item-sub); font-weight: 500; }
body.light-mode .settings-item-sub,
html.light-mode-pre body .settings-item-sub { color: #999; }

/* ===== FILTER DROPDOWN ===== */
.filter-dropdown-wrapper { position: relative; display: inline-block; }

#filter-btn.dropdown-open { background: rgba(255,255,255,0.2); }
#filter-btn.dropdown-open svg { fill: var(--text-main); }

body.light-mode #filter-btn.dropdown-open,
html.light-mode-pre body #filter-btn.dropdown-open { background: rgba(0,0,0,0.14); }
body.light-mode #filter-btn.dropdown-open svg,
html.light-mode-pre body #filter-btn.dropdown-open svg { fill: var(--text-main); }

#filter-btn svg { stroke: none !important; fill: var(--text-dim); transition: fill 0.2s ease; }
#filter-btn:hover svg { fill: var(--text-main); }
#filter-btn.dropdown-open svg { fill: var(--text-main); }
body.light-mode #filter-btn svg,
html.light-mode-pre body #filter-btn svg { fill: var(--text-dim); }
body.light-mode #filter-btn:hover svg,
html.light-mode-pre body #filter-btn:hover svg { fill: var(--text-main); }

.filter-dropdown {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: #111111; border: 1px solid rgba(255,255,255,0.13);
  border-radius: 14px; overflow: hidden;
  min-width: 210px; z-index: 9999;
  opacity: 0; pointer-events: none;
  transform: translateY(-6px) scale(0.97);
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 16px 48px rgba(0,0,0,0.65);
}
.filter-dropdown.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: all; }

body.light-mode .filter-dropdown,
html.light-mode-pre body .filter-dropdown { background: #ffffff; border-color: rgba(0,0,0,0.13); box-shadow: 0 16px 48px rgba(0,0,0,0.15); }

.filter-dropdown-header {
  padding: 14px 16px 10px;
  font-size: 0.72rem; font-weight: 700; color: #555;
  letter-spacing: 0.09em; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
}
body.light-mode .filter-dropdown-header,
html.light-mode-pre body .filter-dropdown-header { border-bottom-color: rgba(0,0,0,0.08); color: #999; }

.filter-options-list {
  padding: 10px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-option-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; font-size: 0.88rem; font-weight: 700;
  color: #aaa; border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
body.light-mode .filter-option-pill,
html.light-mode-pre body .filter-option-pill { color: #666; }
.filter-option-pill:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
body.light-mode .filter-option-pill:hover,
html.light-mode-pre body .filter-option-pill:hover { background: rgba(0,0,0,0.04); color: #111; }
.filter-option-pill.selected { color: #f1f5f9; background: rgba(255,255,255,0.08); }
body.light-mode .filter-option-pill.selected,
html.light-mode-pre body .filter-option-pill.selected { color: #111; background: rgba(0,0,0,0.06); }

.filter-pill-check {
  width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
}
body.light-mode .filter-pill-check,
html.light-mode-pre body .filter-pill-check { border-color: rgba(0,0,0,0.25); }
.filter-option-pill.selected .filter-pill-check {
  background: #f1f5f9; border-color: #f1f5f9;
}
.filter-option-pill.selected .filter-pill-check::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: 2px solid #111;
  border-top: none; border-left: none;
  transform: rotate(45deg);
}
body.light-mode .filter-option-pill.selected .filter-pill-check,
html.light-mode-pre body .filter-option-pill.selected .filter-pill-check { background: #111; border-color: #111; }
body.light-mode .filter-option-pill.selected .filter-pill-check::after,
html.light-mode-pre body .filter-option-pill.selected .filter-pill-check::after { border-color: #fff; }

.filter-actions {
  display: flex; gap: 8px;
  padding: 8px 12px 12px;
  margin-top: 6px;
}

.filter-btn-cancel, .filter-btn-save {
  flex: 1; padding: 9px; border-radius: 8px;
  font-size: 0.82rem; font-weight: 700; border: none; cursor: pointer;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.filter-btn-cancel {
  background: rgba(255,255,255,0.07); color: #888;
  border: 1px solid rgba(255,255,255,0.1);
}
.filter-btn-cancel:hover { background: rgba(255,255,255,0.12); color: #ccc; }
body.light-mode .filter-btn-cancel,
html.light-mode-pre body .filter-btn-cancel { background: rgba(0,0,0,0.05); color: #666; border-color: rgba(0,0,0,0.1); }
body.light-mode .filter-btn-cancel:hover,
html.light-mode-pre body .filter-btn-cancel:hover { background: rgba(0,0,0,0.09); color: #333; }

.filter-btn-save { background: #f1f5f9; color: #111; }
.filter-btn-save:hover { background: #ffffff; }
body.light-mode .filter-btn-save,
html.light-mode-pre body .filter-btn-save { background: #1a1c1e; color: #fff; }
body.light-mode .filter-btn-save:hover,
html.light-mode-pre body .filter-btn-save:hover { background: #000; }

.contact-support { margin-top: 18px; font-size: 0.82rem; color: var(--text-dim); }
.tg-link { color: #38bdf8; text-decoration: none; margin-left: 5px; font-weight: 600; }
.tg-link:hover { text-decoration: underline; }

/* ===== VIEW MODE BUTTON (By Year / By Subject) ===== */
.mode-dropdown-wrapper { position: relative; display: inline-block; }

#mode-btn.dropdown-open { background: rgba(255,255,255,0.2); }
#mode-btn.dropdown-open svg { stroke: var(--text-main); }
body.light-mode #mode-btn.dropdown-open,
html.light-mode-pre body #mode-btn.dropdown-open { background: rgba(0,0,0,0.14); }
body.light-mode #mode-btn.dropdown-open svg,
html.light-mode-pre body #mode-btn.dropdown-open svg { stroke: var(--text-main); }

/* "Not yet" block, centered in the middle of a section */
.not-yet-block {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--card-bg);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
}


/* ===== STICKY HEADER =====
   The header stays pinned while the blocks scroll underneath it.
   Its translucent card colour is layered over a solid page-colour layer
   (both transition with the same timing as the page), so scrolling content
   never shows through and the light/dark switch stays one smooth fade. */
.main-header {
  position: fixed; /* pinned to the screen: it never moves while scrolling */
  top: 15px;
  left: 15px;
  right: 15px;
  width: auto;
  z-index: 50;
  background: transparent;
  border-color: transparent; /* the visible border is drawn by ::after, above the layers */
}

/* solid layer: same colour + timing as the body, also covers everything above the header */
.main-header::before {
  content: '';
  position: absolute;
  inset: -100px -1px -1px -1px; /* reaches well above the screen edge so nothing shows at the very top */
  z-index: -2;
  background-color: var(--bg-color);
  border-radius: 0 0 var(--header-radius, 16px) var(--header-radius, 16px);
  transition: background-color 0.3s ease;
  pointer-events: none;
}

/* translucent card layer on top of it (the original header look) */
.main-header::after {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: -1;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--header-radius, 16px);
  transition: background-color 0.35s ease, border-color 0.35s ease;
  pointer-events: none;
}

/* the fixed header no longer takes space in the page, so reserve it here
   (--header-h is measured by script.js; 65px is the fallback) */
body { padding-top: calc(15px + var(--header-h, 65px) + 10px); }

/* ===== iOS-STYLE POPOVERS: settings box, "Filter" box, "Filter blocks" box =====
   Each box springs out of its own icon (the icons are 42px wide, so the icon centre is 21px
   from the box's right edge), with a small overshoot, then shrinks back into it on close.
   Translucent blurred "glass" background; the contents fade in just after the box starts growing. */
.settings-dropdown,
.filter-dropdown {
  background: rgba(28, 28, 30, 0.78);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: scale(0.45);
  transform-origin: calc(100% - 21px) 0;
  will-change: transform, opacity;
  /* closing: quick, no bounce */
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.9, 0.6), opacity 0.16s ease-in 0.02s;
}

.settings-dropdown.open,
.filter-dropdown.open {
  opacity: 1;
  transform: scale(1);
  /* opening: spring with a small overshoot, like the iPhone context menu */
  transition: transform 0.5s cubic-bezier(0.22, 1.32, 0.36, 1), opacity 0.18s ease-out;
}

body.light-mode .settings-dropdown,
html.light-mode-pre body .settings-dropdown,
body.light-mode .filter-dropdown,
html.light-mode-pre body .filter-dropdown {
  /* frosted glass on a light page: clearly see-through, a soft sheen, a soft dark rim and a deeper shadow so it reads as glass */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(242, 243, 247, 0.46));
  -webkit-backdrop-filter: blur(30px) saturate(210%);
  backdrop-filter: blur(30px) saturate(210%);
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 22px 60px rgba(20, 24, 40, 0.28), 0 2px 10px rgba(20, 24, 40, 0.1);
}

/* contents fade in a touch after the box starts growing */
.settings-dropdown > *,
.filter-dropdown > * {
  opacity: 0;
  transition: opacity 0.1s ease;
}
.settings-dropdown.open > *,
.filter-dropdown.open > * {
  opacity: 1;
  transition: opacity 0.28s ease 0.06s;
}

@media (prefers-reduced-motion: reduce) {
  .settings-dropdown,
  .filter-dropdown,
  .settings-dropdown.open,
  .filter-dropdown.open {
    transform: none;
    transition: opacity 0.15s ease;
  }
}

/* ===== no divider lines inside the three boxes ===== */
.settings-dropdown-header,
.filter-dropdown-header,
body.light-mode .settings-dropdown-header,
html.light-mode-pre body .settings-dropdown-header,
body.light-mode .filter-dropdown-header,
html.light-mode-pre body .filter-dropdown-header {
  border-bottom: none !important;
}
.settings-item:not(:last-child),
body.light-mode .settings-item:not(:last-child),
html.light-mode-pre body .settings-item:not(:last-child) {
  border-bottom: none !important;
}


/* ===== PROFILE (Edit Profile) POPUP: same iOS pop + glass as the other boxes =====
   It springs out of the profile picture (top-left). The dim layer fades by its COLOUR, not its
   opacity, so the box can still blur the page behind it. */
#profile-modal-backdrop {
  opacity: 1;
  background: rgba(0, 0, 0, 0);
  transition: background-color 0.3s ease;
}
#profile-modal-backdrop.open { background: rgba(0, 0, 0, 0.45); }

#profile-modal {
  background: rgba(28, 28, 30, 0.78);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border-color: rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: scale(0.45);
  transform-origin: 36px -22px;          /* roughly where the profile picture sits, above the box */
  will-change: transform, opacity;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.9, 0.6), opacity 0.16s ease-in 0.02s;
}
#profile-modal-backdrop.open #profile-modal {
  opacity: 1;
  transform: scale(1);
  transition: transform 0.5s cubic-bezier(0.22, 1.32, 0.36, 1), opacity 0.18s ease-out;
}
#profile-modal > * { opacity: 0; transition: opacity 0.1s ease; }
#profile-modal-backdrop.open #profile-modal > * { opacity: 1; transition: opacity 0.28s ease 0.06s; }

@media (prefers-reduced-motion: reduce) {
  #profile-modal, #profile-modal-backdrop.open #profile-modal { transform: none; transition: opacity 0.15s ease; }
}

/* ===== GLASSY CARDS (same frosted look as the menus) =====
   Glass needs something to blur, so a very soft colour glow sits behind the page. */
/* ===== PIN BUTTON (top-right corner of each card) ===== */
.card-header h1 { padding-right: 38px; }

.card-pin-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.75;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.card-pin-btn svg { width: 16px; height: 16px; display: block; pointer-events: none; }
.card-pin-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-main); opacity: 1; }
.card-pin-btn[data-pinned="true"] { color: #f0cf6a; opacity: 1; }
body.light-mode .card-pin-btn:hover,
html.light-mode-pre body .card-pin-btn:hover { background: rgba(0, 0, 0, 0.07); }
body.light-mode .card-pin-btn[data-pinned="true"],
html.light-mode-pre body .card-pin-btn[data-pinned="true"] { color: #2e7d32; }

/* Glass cards: the light sits INSIDE the card (no glow behind it, no colours). */
.subject-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: none;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 18px rgba(255, 255, 255, 0.025);
}
.subject-card:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), inset 0 0 24px rgba(255, 255, 255, 0.045);
}
/* true hairline border (half a pixel on every screen): a 1px border drawn at double size, then scaled to 50% */
.subject-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 200%; height: 200%;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  transform: scale(0.5);
  transform-origin: 0 0;
  pointer-events: none;
  transition: border-color 0.2s ease;
}
.subject-card:hover::after { border-color: rgba(255, 255, 255, 0.18); }

body.light-mode .subject-card,
html.light-mode-pre body .subject-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.55));
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 0 18px rgba(255, 255, 255, 0.3);
}
body.light-mode .subject-card:hover,
html.light-mode-pre body .subject-card:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.65));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 0 24px rgba(255, 255, 255, 0.4);
}
body.light-mode .subject-card::after,
html.light-mode-pre body .subject-card::after { border-color: rgba(0, 0, 0, 0.1); }
body.light-mode .subject-card:hover::after,
html.light-mode-pre body .subject-card:hover::after { border-color: rgba(0, 0, 0, 0.2); }

/* ===== FILTER BOXES: same design as the Subject list in the quiz pages (no pin icons) =====
   Applies to the "Filter" box (.filter-dropdown) and the per-section filter box (.section-filter-box):
   iOS glass, floating header without a divider, 10px rounded rows, blue selected row. */
.filter-dropdown,
.section-filter-box {
  --fd-head: 44px;
  box-sizing: border-box;
  min-width: 200px;   /* <-- width of the Filter / Filter blocks boxes (was 260px) */
  overflow: hidden;
  background: linear-gradient(180deg, rgba(70, 70, 76, 0.42), rgba(34, 34, 38, 0.34));
  -webkit-backdrop-filter: blur(34px) saturate(190%) brightness(1.05);
  backdrop-filter: blur(34px) saturate(190%) brightness(1.05);
  border: 0.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: scale(0.45);
  transform-origin: calc(100% - 21px) 0;
  will-change: transform, opacity;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.9, 0.6), opacity 0.16s ease-in 0.02s;
}
.filter-dropdown.open,
.section-filter-box.open {
  opacity: 1;
  transform: scale(1);
  transition: transform 0.5s cubic-bezier(0.22, 1.32, 0.36, 1), opacity 0.18s ease-out;
}
body.light-mode .filter-dropdown,
html.light-mode-pre body .filter-dropdown,
body.light-mode .section-filter-box,
html.light-mode-pre body .section-filter-box {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(242, 243, 247, 0.34));
  -webkit-backdrop-filter: blur(34px) saturate(220%);
  backdrop-filter: blur(34px) saturate(220%);
  border: 0.5px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 22px 60px rgba(20, 24, 40, 0.28), 0 2px 10px rgba(20, 24, 40, 0.1);
}
/* contents fade in a touch after the box starts growing */
.filter-dropdown > *,
.section-filter-box > * { opacity: 0; transition: opacity 0.1s ease; }
.filter-dropdown.open > *,
.section-filter-box.open > * { opacity: 1; transition: opacity 0.28s ease 0.06s; }

/* header floats above the list: no divider line */
.filter-dropdown-header,
.section-filter-header,
body.light-mode .filter-dropdown-header,
html.light-mode-pre body .filter-dropdown-header,
body.light-mode .section-filter-header,
html.light-mode-pre body .section-filter-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  box-sizing: border-box; height: var(--fd-head); padding: 0 10px 0 16px;
  font-size: 0.70rem; color: #777;
  border-bottom: none !important;
  background: transparent;
}
body.light-mode .filter-dropdown-header,
html.light-mode-pre body .filter-dropdown-header,
body.light-mode .section-filter-header,
html.light-mode-pre body .section-filter-header { color: #999; }

.filter-options-list,
.section-filter-list { padding: calc(var(--fd-head) + 4px) 6px 6px; gap: 2px; }

/* rows */
.filter-option-pill,
.filter-mode-option {
  gap: 11px; padding: 13px 16px;
  font-size: 0.88rem; font-weight: 700;
  border-radius: 10px;
  color: #aaa;
}
body.light-mode .filter-option-pill,
html.light-mode-pre body .filter-option-pill,
body.light-mode .filter-mode-option,
html.light-mode-pre body .filter-mode-option { color: #666; }

.filter-option-pill:hover,
.filter-mode-option:hover { background: rgba(255, 255, 255, 0.06); color: #e2e8f0; }
body.light-mode .filter-option-pill:hover,
html.light-mode-pre body .filter-option-pill:hover,
body.light-mode .filter-mode-option:hover,
html.light-mode-pre body .filter-mode-option:hover { background: rgba(0, 0, 0, 0.04); color: #111; }

/* selected row = same colour as the block-name bar (.category-title): light grey in dark mode, soft black in light mode */
.filter-option-pill.selected,
.filter-option-pill.selected:hover,
.filter-mode-option.selected,
.filter-mode-option.selected:hover { background: #D5D5D5; color: #111; }
body.light-mode .filter-option-pill.selected,
html.light-mode-pre body .filter-option-pill.selected,
body.light-mode .filter-option-pill.selected:hover,
html.light-mode-pre body .filter-option-pill.selected:hover,
body.light-mode .filter-mode-option.selected,
html.light-mode-pre body .filter-mode-option.selected,
body.light-mode .filter-mode-option.selected:hover,
html.light-mode-pre body .filter-mode-option.selected:hover { background: rgba(26, 28, 30, 0.5); color: #fff; }

/* no tick boxes: the blue row alone shows what is selected */
.filter-pill-check,
.filter-mode-check { display: none !important; }

/* bottom parts line up with the new 6px list padding */
.filter-actions { padding: 6px 6px 6px; margin-top: 18px; gap: 8px; }   /* <-- margin-top = space between the block names and the Save / Cancel buttons; gap = space between the two buttons */
.filter-btn-cancel, .filter-btn-save { border-radius: 10px; }
/* Save = same colour as the selected rows / block-name bar, Cancel = transparent background */
.filter-btn-save { background: #D5D5D5; color: #111; }
.filter-btn-save:hover { background: #e6e6e6; color: #111; }
body.light-mode .filter-btn-save,
html.light-mode-pre body .filter-btn-save { background: rgba(26, 28, 30, 0.5); color: #fff; }
body.light-mode .filter-btn-save:hover,
html.light-mode-pre body .filter-btn-save:hover { background: rgba(26, 28, 30, 0.65); color: #fff; }
.filter-btn-cancel,
body.light-mode .filter-btn-cancel,
html.light-mode-pre body .filter-btn-cancel { background: transparent; }
.filter-btn-cancel:hover { background: rgba(255, 255, 255, 0.08); }
body.light-mode .filter-btn-cancel:hover,
html.light-mode-pre body .filter-btn-cancel:hover { background: rgba(0, 0, 0, 0.06); }
.section-filter-note { margin: 0 6px 6px; }

@media (prefers-reduced-motion: reduce) {
  .filter-dropdown, .section-filter-box,
  .filter-dropdown.open, .section-filter-box.open { transform: none; transition: opacity 0.15s ease; }
}

/* ===== SETTINGS BOX: same glass as the Filter boxes (keeps its own width) ===== */
.settings-dropdown {
  background: linear-gradient(180deg, rgba(70, 70, 76, 0.42), rgba(34, 34, 38, 0.34));
  -webkit-backdrop-filter: blur(34px) saturate(190%) brightness(1.05);
  backdrop-filter: blur(34px) saturate(190%) brightness(1.05);
  border: 0.5px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}
body.light-mode .settings-dropdown,
html.light-mode-pre body .settings-dropdown {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(242, 243, 247, 0.34));
  -webkit-backdrop-filter: blur(34px) saturate(220%);
  backdrop-filter: blur(34px) saturate(220%);
  border: 0.5px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 22px 60px rgba(20, 24, 40, 0.28), 0 2px 10px rgba(20, 24, 40, 0.1);
}

/* ===== LOADING SKELETON (shown inside #filter-view until the real cards are built) ===== */
.sk-section { width: 100%; margin-bottom: 60px; }
.sk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  width: 100%;
}
.sk-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
}
.sk {
  --sk-base: rgba(255, 255, 255, 0.06);
  --sk-shine: rgba(255, 255, 255, 0.13);
  background: linear-gradient(90deg, var(--sk-base) 25%, var(--sk-shine) 50%, var(--sk-base) 75%);
  background-size: 200% 100%;
  animation: skShimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
body.light-mode .sk,
html.light-mode-pre body .sk {
  --sk-base: rgba(0, 0, 0, 0.06);
  --sk-shine: rgba(0, 0, 0, 0.12);
}
.sk-category { height: 36px; margin: 12px 0 20px 0; border-radius: 6px; }
.sk-card-title { height: 22px; width: 55%; margin: 2px 0 18px 0; }
.sk-link { height: 16px; width: 100%; margin: 14px 0; }
.sk-link.short { width: 70%; }

@keyframes skShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sk { animation: none; }
}

/* ===== "FILTER BLOCKS" LIST: 3 names per row, right edge aligned with the filter button ===== */
#filter-dropdown {
  right: 0;                                  /* same alignment as the Filter box: its right edge sits under the button */
  width: max-content;
  min-width: 0;
  max-width: calc(100vw - 140px);            /* never runs off the left edge of the screen */
}
#filter-dropdown .filter-options-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* 3 block names per row */
  gap: 6px;
}
#filter-dropdown .filter-option-pill {
  white-space: nowrap;
  padding: 11px 16px;
}
#filter-dropdown .filter-actions { justify-content: flex-end; }
#filter-dropdown .filter-btn-cancel,
#filter-dropdown .filter-btn-save { flex: 0 0 auto; min-width: 90px; }

@media (max-width: 480px) {
  #filter-dropdown .filter-option-pill { padding: 11px 8px; gap: 4px; font-size: 0.8rem; justify-content: center; }
  #filter-dropdown .filter-btn-cancel,
  #filter-dropdown .filter-btn-save { min-width: 0; flex: 1; }
}

/* ===== soft rounded border around each block name in the Filter blocks list ===== */
#filter-dropdown .filter-option-pill {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
#filter-dropdown .filter-option-pill:hover { border-color: rgba(255, 255, 255, 0.28); }
#filter-dropdown .filter-option-pill.selected,
#filter-dropdown .filter-option-pill.selected:hover { border-color: transparent; }
body.light-mode #filter-dropdown .filter-option-pill,
html.light-mode-pre body #filter-dropdown .filter-option-pill { border-color: rgba(0, 0, 0, 0.14); }
body.light-mode #filter-dropdown .filter-option-pill:hover,
html.light-mode-pre body #filter-dropdown .filter-option-pill:hover { border-color: rgba(0, 0, 0, 0.26); }
body.light-mode #filter-dropdown .filter-option-pill.selected,
html.light-mode-pre body #filter-dropdown .filter-option-pill.selected { border-color: transparent; }

/* ===== cards: no inner light / glow (flat glass, same hairline border) ===== */
.subject-card,
.subject-card:hover,
body.light-mode .subject-card,
html.light-mode-pre body .subject-card,
body.light-mode .subject-card:hover,
html.light-mode-pre body .subject-card:hover {
  box-shadow: none;
}
.subject-card { background: rgba(255, 255, 255, 0.035); }
.subject-card:hover { background: rgba(255, 255, 255, 0.055); }
body.light-mode .subject-card,
html.light-mode-pre body .subject-card { background: rgba(255, 255, 255, 0.65); }
body.light-mode .subject-card:hover,
html.light-mode-pre body .subject-card:hover { background: rgba(255, 255, 255, 0.78); }

/* ===== box titles (FILTER / FILTER BLOCKS / SETTINGS): same clear colour in all three boxes ===== */
.settings-dropdown-header,
.filter-dropdown-header { color: #b4b4bb; }
body.light-mode .settings-dropdown-header,
html.light-mode-pre body .settings-dropdown-header,
body.light-mode .filter-dropdown-header,
html.light-mode-pre body .filter-dropdown-header { color: #5f6368; }

/* close (X) icons in the same boxes */
.settings-dropdown .settings-close-btn svg,
.filter-dropdown .settings-close-btn svg { stroke: #b4b4bb; }
body.light-mode .settings-dropdown .settings-close-btn svg,
html.light-mode-pre body .settings-dropdown .settings-close-btn svg,
body.light-mode .filter-dropdown .settings-close-btn svg,
html.light-mode-pre body .filter-dropdown .settings-close-btn svg { stroke: #5f6368; }
.settings-dropdown .settings-close-btn:hover svg,
.filter-dropdown .settings-close-btn:hover svg { stroke: #fff; }
body.light-mode .settings-dropdown .settings-close-btn:hover svg,
html.light-mode-pre body .settings-dropdown .settings-close-btn:hover svg,
body.light-mode .filter-dropdown .settings-close-btn:hover svg,
html.light-mode-pre body .filter-dropdown .settings-close-btn:hover svg { stroke: #111; }