:root {
  --bg: #05060b;
  --panel: #14161f;
  --panel-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #f5f7ff;
  --muted: rgba(255, 255, 255, 0.72);
  --topbar-h: 88px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --max: 1240px;
  --page-dark-bottom: #04050a;
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: Inter, system-ui, Arial, sans-serif;
  margin: 0;
  background: var(--page-dark-bottom);
  color: var(--text);
  min-height: 100vh;
}

body.page-home,
body.page-subjects,
body.page-papers,
body.page-about,
body.page-contact,
body.page-exam,
body.page-results {
  background: var(--page-dark-bottom);
}

img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
input,
button,
select {
  font: inherit;
}
.hidden {
  display: none !important;
}

/* =========================
   TOPBAR
========================= */
.topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: var(--topbar-h);
  padding: 0 28px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1100;
  background: transparent;
  border-bottom: none;
}
.topbar::before {
  display: none;
}
.topbar .brand,
.topbar .topbar-right {
  position: relative;
  z-index: 2;
}
.brand {
  display: flex;
  align-items: center;
}
.brand-link {
  display: inline-flex;
  align-items: center;
}
.logo {
  height: 54px;
  width: auto;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(38, 38, 41, 0.78);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  z-index: 1101;
}
.hamburger span {
  position: absolute;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #eaeaea;
  transition:
    transform 0.22s ease,
    opacity 0.18s ease,
    top 0.22s ease;
}
.hamburger span:nth-child(1) {
  top: 16px;
}
.hamburger span:nth-child(2) {
  top: 22px;
}
.hamburger span:nth-child(3) {
  top: 28px;
}
body.menu-open .hamburger span:nth-child(1) {
  top: 22px;
  transform: rotate(45deg);
}
body.menu-open .hamburger span:nth-child(2) {
  opacity: 0;
}
body.menu-open .hamburger span:nth-child(3) {
  top: 22px;
  transform: rotate(-45deg);
}

/* =========================
   MENU - YELLOW TICTAIL STYLE
========================= */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 1090;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
body.menu-open .menu-overlay {
  opacity: 1;
  pointer-events: auto;
}
.menu {
  position: fixed;
  inset: 0;
  z-index: 1095;
  background: #ffc400;
  color: #050505;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 90px clamp(28px, 12vw, 170px);
  gap: 0;
  transform: translateY(-100%);
  opacity: 1;
  pointer-events: none;
  transition: transform 0.32s ease;
}
body.menu-open .menu {
  transform: translateY(0);
  pointer-events: auto;
}
body.menu-open .brand {
  opacity: 0;
  pointer-events: none;
}
body.menu-open .hamburger {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 10px;
  background: #bf3a3a;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: none;
}
body.menu-open .hamburger span {
  width: 18px;
  height: 2px;
  left: 15px;
  background: #ffffff;
}
body.menu-open .hamburger span:nth-child(1),
body.menu-open .hamburger span:nth-child(3) {
  top: 24px;
}
.menu::before {
  content: "Learn more";
  display: block;
  margin-bottom: 10px;
  color: #000;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 100;
}
.menu-link {
  color: #050505;
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.07em;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
}
.menu-link:hover {
  transform: translateX(10px);
  opacity: 0.72;
  color: #050505;
}
.menu-social-block {
  margin-top: 34px;
}
.menu-social-label {
  margin: 0 0 14px;
  color: #000;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 100;
  line-height: 1;
}
.menu-socials {
  display: flex;
  align-items: center;
  gap: 18px;
}
.menu-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.menu-socials img {
  width: 76px;
  height: 76px;
  object-fit: contain;
}

/* =========================
   LAYOUT / BACKDROPS
========================= */
.container {
  padding: 28px 20px 40px;
  max-width: 1000px;
  margin: 0 auto;
}
.main-home,
.main-subjects {
  max-width: none;
  padding: 0;
}

.hero-home {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: var(--page-dark-bottom);
}
.hero-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  min-height: 720px;
  background:
    linear-gradient(
      180deg,
      rgba(5, 7, 14, 0.08) 0%,
      rgba(5, 7, 14, 0.32) 62%,
      var(--page-dark-bottom) 100%
    ),
    url("/images/hero-galaxy-bg.webp") center top / cover no-repeat;
}
.hero-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 18% 24%,
      rgba(94, 124, 255, 0.3),
      transparent 22%
    ),
    radial-gradient(
      circle at 72% 22%,
      rgba(255, 84, 177, 0.26),
      transparent 18%
    ),
    radial-gradient(
      circle at 74% 68%,
      rgba(166, 92, 255, 0.18),
      transparent 22%
    );
}
.hero-backdrop::after,
.subjects-backdrop::after,
.exam-backdrop::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 260px;
  background: linear-gradient(
    180deg,
    rgba(4, 5, 10, 0) 0%,
    var(--page-dark-bottom) 82%
  );
  pointer-events: none;
}
.hero-content-wrap {
  position: relative;
  z-index: 2;
  width: min(calc(100% - 32px), 1100px);
  min-height: 100vh;
  margin: 0 auto;
  text-align: center;
  padding: 120px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-copy {
  width: min(100%, 900px);
  margin: 0 auto;
  transform: translateY(34px);
}
.hero-title {
  margin: 0 0 20px;
  font-size: clamp(3rem, 8vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-weight: 800;
  text-shadow: 0 16px 38px rgba(0, 0, 0, 0.35);
}
.hero-subtitle {
  width: min(100%, 760px);
  margin: 0 auto 28px;
  font-size: clamp(1.03rem, 2vw, 1.65rem);
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

.hero-subtitle span {
  font-size: 1.8rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.86);
}

.subjects-page,
.info-page,
.papers-page,
.exam-page,
.results-page {
  position: relative;
  min-height: 100vh;
  padding: 120px 0 72px;
  overflow: visible;
  background: var(--page-dark-bottom);
}
.subjects-backdrop,
.exam-backdrop {
  position: absolute;
  inset: 0;
  bottom: auto;
  height: 100vh;
  min-height: 720px;
  background:
    linear-gradient(
      180deg,
      rgba(4, 6, 12, 0.24) 0%,
      rgba(4, 6, 12, 0.56) 64%,
      var(--page-dark-bottom) 100%
    ),
    url("/images/hero-galaxy-bg.webp") center top / cover no-repeat;
  opacity: 0.95;
}

/* =========================
   HOME SEARCH
========================= */
body.page-home .hero-search-shell {
  width: min(100%, 1120px);
  margin: 0 auto 20px;
  padding: 3px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(80, 110, 255, 0.82),
    rgba(182, 73, 191, 0.82),
    rgba(255, 110, 116, 0.78)
  );
  box-shadow: 0 0 28px rgba(119, 86, 255, 0.34);
}
body.page-home .hero-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(210px, auto) minmax(
      110px,
      auto
    );
  grid-template-areas: "icon input subject ask";
  align-items: center;
  gap: 18px;
  height: 64px;
  min-height: 64px;
  padding: 6px 16px 6px 20px;
  border-radius: 999px;
  background: #070707;
  border: 0;
}
.hero-search-icon {
  grid-area: icon;
  position: relative;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 4px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  opacity: 1;
  pointer-events: none;
}
.hero-search-icon::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 5px;
  right: -11px;
  bottom: -6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  transform: rotate(45deg);
}
body.page-home .hero-search input {
  grid-area: input;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: clamp(0.95rem, 1.55vw, 1.1rem);
  font-weight: 500;
  text-align: left;
  outline: none;
}
body.page-home .hero-search input::placeholder {
  color: rgba(255, 255, 255, 0.72);
}
.hero-subject-select {
  grid-area: subject;
  width: 100%;
  min-width: 210px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: linear-gradient(
    180deg,
    rgba(179, 70, 179, 0.94),
    rgba(127, 53, 152, 0.92)
  );
  color: #fff;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 0.94rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 8px 18px rgba(71, 16, 79, 0.34);
  outline: none;
  cursor: pointer;
  appearance: none;
  text-align: center;
  text-align-last: center;
}
.hero-subject-select option {
  background: #24173d;
  color: #fff;
}
.hero-search-submit {
  grid-area: ask;
  width: 100%;
  min-width: 110px;
  height: 50px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 0.94rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(90deg, #4c66ff, #7a36d7);
}

.hero-actions {
  width: min(100%, 760px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}
.hero-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px;
  color: #fff;
  font-size: clamp(0.9rem, 1.8vw, 1.3rem);
  font-weight: 700;
  text-align: center;
}
.action-papers {
  background: linear-gradient(90deg, #4c66ff, #5b5ee4);
}
.action-flashcards {
  background: linear-gradient(90deg, #7a36d7, #d94979);
}
.action-quiz {
  background: linear-gradient(90deg, #f45f60, #ff7a34);
}
.hero-action-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex: 0 0 auto;
}

.home-version-tag {
  position: absolute;
  left: 32px;
  bottom: 26px;
  z-index: 6;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}
.home-devmunky-logo {
  position: absolute;
  right: 32px;
  bottom: 22px;
  z-index: 6;
  width: 140px;
  max-width: 28vw;
  height: auto;
  opacity: 0.88;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
}

/* =========================
   STUDY OUTPUT
========================= */
.study-output {
  width: min(100%, 920px);
  margin: 26px auto 80px;
  position: relative;
  z-index: 3;
}
.study-output.hidden {
  display: none;
}
.study-output-card {
  position: relative;
  text-align: left;
  padding: 26px;
  border-radius: 24px;
  background: rgba(22, 18, 40, 0.72);
  border: 1px solid rgba(184, 144, 255, 0.16);
  box-shadow: 0 18px 40px rgba(8, 4, 24, 0.32);
}
.study-output-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.study-output-top h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.1;
  color: #fff;
}
.study-output-body {
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.75;
}
.study-output-body p {
  margin: 0 0 14px;
}
.study-output-body h3 {
  margin: 24px 0 10px;
  font-size: 1.1rem;
  line-height: 1.35;
  color: #fff;
}
.study-output-body ul,
.study-output-body ol {
  margin: 0 0 16px 20px;
  padding: 0;
}
.study-output-body li {
  margin: 0 0 8px;
}
.study-output-body strong {
  color: #fff;
}

/* =========================
   SUBJECTS / INFO / PAPERS
========================= */
.subjects-header,
.tiles {
  position: relative;
  z-index: 2;
  width: min(calc(100% - 32px), 850px);
  margin: 0 auto;
}
.subjects-header {
  margin-bottom: 18px;
}
.subjects-header h1,
.info-shell h1,
.papers-top h1,
.exam-top h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}
.tile {
  display: block;
  color: #eee;
  background: #171717;
  overflow: hidden;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
  position: relative;
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.26);
  z-index: 2;
}
.tile-media {
  height: 160px;
  display: grid;
  place-items: center;
  background: #111;
}
.tile-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile-title {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}
.tile-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(20, 14, 25, 0.82);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.tile-disabled {
  cursor: default;
}
.tile-disabled:hover {
  transform: none;
  box-shadow: none;
}

.info-shell,
.papers-shell,
.exam-shell {
  position: relative;
  z-index: 2;
  width: min(calc(100% - 32px), 980px);
  margin: 0 auto;
}
.info-card,
.papers-card,
.exam-card {
  background: rgba(18, 20, 32, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}
.info-card p {
  margin: 0 0 16px;
  font-size: 1.06rem;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.86);
}
.info-card p:last-child {
  margin-bottom: 0;
}
.info-card h2 {
  margin: 28px 0 12px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.1;
  color: #fff;
}
.info-card h2:first-of-type {
  margin-top: 0;
}
.info-divider {
  margin: 30px 0;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.contact-grid {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}
.contact-item {
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.contact-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
}
.contact-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.papers-top,
.exam-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.papers-heading,
.exam-heading {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.eyebrow {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.68);
}
.papers-list {
  display: grid;
  gap: 16px;
}
.papers-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border-radius: 22px;
}
.papers-card-left h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  line-height: 1.2;
  color: #fff;
}
.papers-card-left p {
  margin: 0;
}
.empty-state {
  justify-content: center;
  min-height: 140px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #141823;
  color: #eee;
  cursor: pointer;
}
.btn.primary {
  background: linear-gradient(90deg, #6f3dff, #9a4eff);
  border-color: transparent;
}
.btn.danger {
  background: #b91c1c;
  border-color: #b91c1c;
}
.glass-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.start-btn {
  min-width: 120px;
  min-height: 48px;
  border-radius: 14px;
  font-weight: 700;
}
.papers-actions,
.custom-practice-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

/* =========================
   EXAM
========================= */
.exam-top-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  flex: 0 0 auto;
}
.exam-top-actions .btn,
.exam-top-actions a,
.exam-top-actions button {
  white-space: nowrap;
  flex-shrink: 0;
  min-width: max-content;
}
.inline-form {
  margin: 0;
}
.exam-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  padding: 24px;
  background: linear-gradient(
    180deg,
    rgba(34, 24, 58, 0.78),
    rgba(20, 16, 40, 0.72)
  );
  border: 1px solid rgba(184, 144, 255, 0.16);
  box-shadow: 0 18px 40px rgba(8, 4, 24, 0.32);
}
.exam-progress {
  margin-bottom: 14px;
  font-size: 0.98rem;
}
.exam-live-timer {
  min-width: 140px;
  text-align: center;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(140, 82, 255, 0.28),
    rgba(255, 255, 255, 0.1)
  );
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(153, 102, 255, 0.18);
}
.exam-question-image {
  margin: 14px 0 16px;
  text-align: center;
}
.exam-question-image img {
  max-width: 100%;
  border-radius: 14px;
  display: inline-block;
}
.exam-instruction,
.exam-stimulus {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.55;
}
.exam-section-title,
.exam-stimulus-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: #fff;
}
.exam-section-instruction {
  margin-bottom: 18px;
}
.exam-stimulus {
  margin: 0 0 24px;
}
.exam-stimulus-text {
  line-height: 1.7;
  white-space: normal;
}
.exam-qtext {
  width: 100%;
  margin-bottom: 18px;
  font-size: 1.15rem;
  line-height: 1.65;
  color: #fff;
  overflow-wrap: anywhere;
}
.exam-choices,
.choices.exam-choices {
  display: grid;
  width: 100%;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 0;
}
.exam-choice,
.choice.exam-choice {
  width: 100%;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(191, 168, 255, 0.14);
  border-radius: 16px;
  background: rgba(12, 10, 24, 0.62);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}
.exam-choice:hover {
  transform: translateY(-2px);
  border-color: rgba(210, 186, 255, 0.24);
  background: rgba(255, 255, 255, 0.06);
}
.exam-choice.correct,
.choice.correct {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}
.exam-choice.wrong,
.choice.wrong {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}
.submit-btn,
.next-btn {
  width: 100%;
  min-height: 50px;
  border-radius: 14px;
  font-weight: 700;
  margin-top: 8px;
}
.exam-feedback {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.exam-explanation {
  margin-top: 10px;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.88);
}
.next-form {
  margin-top: 14px;
}

/* =========================
   GENERIC / PAPER 2
========================= */
.page-head h1,
h1 {
  margin: 0 0 18px 0;
}
.card {
  background: #161922;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 18px;
  margin: 14px 0;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.row.wrap {
  flex-wrap: wrap;
}
.form {
  display: grid;
  gap: 10px;
}
input {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #0f0f0f;
  color: #eee;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  border-bottom: 1px solid #2a2a2a;
  padding: 10px;
  text-align: left;
}
.pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.pill.good {
  background: #064e3b;
}
.pill.bad {
  background: #7f1d1d;
}
.error {
  color: #fca5a5;
}
.muted {
  color: #bdbdbd;
}
.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}
.qtext {
  font-size: 18px;
  line-height: 1.4;
  margin-top: 20px;
}
.choices {
  display: grid;
  gap: 10px;
}
.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid #333;
  border-radius: 12px;
  background: #111;
}
.choice .key {
  display: inline-block;
  min-width: 22px;
  font-weight: 700;
}
.feedback .good {
  color: #86efac;
}
.feedback .bad {
  color: #fca5a5;
}
.checks {
  display: grid;
  gap: 8px;
}
.check {
  display: flex;
  gap: 10px;
  align-items: center;
}
.option-image {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
}
.choice-content {
  display: block;
  flex: 1;
}
.q-underline {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.paper2-card .exam-question-image img {
  background: #fff;
}
.paper2-response-area {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.paper2-line {
  width: 100%;
  border-bottom: 3px dotted rgba(255, 255, 255, 0.55);
  min-height: 18px;
}
.paper2-answer-wrap {
  margin-top: 22px;
}
.paper2-reveal-btn {
  width: auto;
}
.paper2-answer {
  margin-top: 18px;
  padding: 20px;
  border-radius: 18px;
  background: rgba(7, 7, 12, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.paper2-answer-title {
  font-weight: 800;
  margin-bottom: 12px;
  font-size: 1.1rem;
}
.paper2-answer-body {
  line-height: 1.65;
}
.paper2-answer-body p {
  margin: 0 0 12px;
}
.paper2-answer-body ul,
.paper2-answer-body ol {
  margin: 0 0 12px 22px;
}
.paper2-answer-body pre {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 0;
}

/* =========================
   FLASHCARDS
========================= */
.flashcards-shell {
  position: relative;
  z-index: 2;
  width: min(calc(100% - 32px), 980px);
  margin: 0 auto;
  padding-bottom: 56px;
}
.flashcards-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  margin-bottom: 22px;
}
.flashcards-page-header {
  text-align: center;
  max-width: 880px;
  margin: 0 auto 34px;
}
.flashcards-overline {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  font-weight: 800;
}
.flashcards-page-header h1 {
  margin: 0;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  color: #fff;
  text-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}
.flashcards-stage {
  display: flex;
  justify-content: center;
  margin-bottom: 5rem;
}
.flashcard-big {
  position: relative;
  width: min(100%, 760px);
  min-height: 410px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  perspective: 1200px;
}
.flashcard-stack {
  position: absolute;
  inset: auto 0 0 0;
  margin: auto;
  width: 88%;
  height: 86%;
  border-radius: 38px;
  pointer-events: none;
}
.flashcard-stack-back {
  background: rgba(255, 255, 255, 0.92);
  transform: rotate(-4deg) translateY(12px);
  box-shadow: 0 24px 45px rgba(0, 0, 0, 0.18);
}
.flashcard-stack-mid {
  background: rgba(255, 255, 255, 0.65);
  transform: rotate(3deg) translateY(4px);
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.12);
}
.flashcard-face {
  position: absolute;
  inset: 0;
  border-radius: 36px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  padding: 34px 34px 30px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.28);
  transition: transform 0.55s ease;
}
.flashcard-face-front {
  background: linear-gradient(180deg, #d7b7ff 0%, #ba8dff 100%);
  color: #301456;
  transform: rotateY(0deg);
}
.flashcard-face-back {
  background: linear-gradient(180deg, #ffd7bf 0%, #f5a772 100%);
  color: #4b2210;
  transform: rotateY(180deg);
}
.flashcard-big.is-flipped .flashcard-face-front {
  transform: rotateY(180deg);
}
.flashcard-big.is-flipped .flashcard-face-back {
  transform: rotateY(360deg);
}
.flashcard-label {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 800;
  opacity: 0.7;
}
.flashcard-text {
  display: block;
  width: 100%;
  font-size: clamp(1.7rem, 3.4vw, 2.45rem);
  line-height: 1.08;
  font-weight: 800;
  margin: 20px 0;
}
.flashcard-hint {
  font-size: 0.98rem;
  font-weight: 700;
  opacity: 0.7;
}
.flashcards-toolbar {
  width: min(100%, 760px);
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  gap: 12px;
  align-items: center;
}
.flashcard-control,
.flashcard-secondary,
.deck-chip {
  border: none;
  border-radius: 18px;
  font-weight: 800;
  cursor: pointer;
}
.flashcard-control {
  min-height: 54px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.18);
}
.flashcards-progress-wrap p {
  margin: 10px 0 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 700;
}
.flashcards-progress-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.flashcards-progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #7d77ff, #f06cff);
}
.flashcards-actions-row {
  width: min(100%, 760px);
  margin: 0 auto 34px;
  display: flex;
  justify-content: center;
  gap: 12px;
}
.flashcard-secondary {
  min-height: 50px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.flashcards-decks-panel {
  width: min(100%, 900px);
  margin: 0 auto;
}
.flashcards-decks-label {
  margin: 0 0 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.flashcards-decks-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.deck-chip {
  min-height: 88px;
  padding: 16px 18px;
  font-size: 1rem;
  color: #24113a;
  background: linear-gradient(180deg, #e7d9ff 0%, #d3b3ff 100%);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.18);
}
.deck-chip.active {
  outline: 3px solid rgba(255, 255, 255, 0.74);
  transform: translateY(-2px);
}
.deck-lilac {
  background: linear-gradient(180deg, #ead6ff 0%, #caa0ff 100%);
  color: #2f1655;
}
.deck-peach {
  background: linear-gradient(180deg, #ffd9cb 0%, #ffb184 100%);
  color: #54250a;
}
.deck-cyan {
  background: linear-gradient(180deg, #d6fbff 0%, #90ebf7 100%);
  color: #083d49;
}
.deck-rose {
  background: linear-gradient(180deg, #ffd4e7 0%, #ff9fc8 100%);
  color: #5a1736;
}
.deck-gold {
  background: linear-gradient(180deg, #ffe7b8 0%, #ffc56b 100%);
  color: #5a3302;
}
.deck-violet {
  background: linear-gradient(180deg, #d8d2ff 0%, #a98cff 100%);
  color: #22134d;
}

/* =========================
   RESULTS / WEAK TOPICS
========================= */
.results-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.results-pdf-btn {
  border: 0;
  color: #fff;
  background: linear-gradient(90deg, #7c3cff, #b14cff);
  box-shadow:
    0 10px 24px rgba(124, 60, 255, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.weak-results-card {
  overflow: hidden;
}
.score-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.score-hero > div {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}
.score-hero strong {
  display: inline-block;
  margin-top: 6px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}
.score-hero span:not(.score-label) {
  margin-left: 6px;
  opacity: 0.72;
  font-weight: 700;
}
.score-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.weak-topic-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.weak-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.weak-section-heading h2 {
  margin: 4px 0 0;
  font-size: clamp(22px, 3vw, 30px);
}
.weak-section-heading > p {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}
.topic-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.topic-results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}
.topic-results-table th,
.topic-results-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
.topic-results-table th {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}
.topic-results-table tr:last-child td {
  border-bottom: 0;
}
.topic-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}
.topic-pill.weak {
  color: #ffd9d9;
  background: rgba(255, 76, 76, 0.16);
  border: 1px solid rgba(255, 76, 76, 0.34);
}
.topic-pill.needs-practice {
  color: #fff0c2;
  background: rgba(255, 188, 66, 0.16);
  border: 1px solid rgba(255, 188, 66, 0.32);
}
.topic-pill.strong {
  color: #d8ffe6;
  background: rgba(50, 210, 120, 0.16);
  border: 1px solid rgba(50, 210, 120, 0.32);
}
.weak-topic-list {
  display: grid;
  gap: 12px;
}
.weak-topic-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.weak-topic-number {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.1);
}
.weak-topic-card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.weak-topic-card p {
  margin: 0;
  color: var(--muted);
}
.success-card {
  border-color: rgba(50, 210, 120, 0.28);
}
.progress-notice {
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  color: var(--muted);
}
.progress-notice strong {
  color: inherit;
}
body.page-results .results-shell {
  width: min(calc(100% - 32px), 1060px);
}
body.page-results .results-card,
body.page-results .weak-results-card {
  display: block;
  width: 100%;
  align-items: initial;
  justify-content: initial;
  padding: clamp(22px, 4vw, 42px);
}
body.page-results .results-card > * {
  max-width: 100%;
}

/* =========================
   CUSTOM PRACTICE
========================= */
.custom-practice-shell {
  width: min(1040px, calc(100% - 40px));
}
.custom-practice-top {
  align-items: flex-end;
  gap: 28px;
  margin-bottom: 26px;
}
.custom-practice-heading h1 {
  max-width: 820px;
  line-height: 0.94;
}
.custom-practice-heading h1 span {
  color: rgba(255, 255, 255, 0.92);
}
.custom-practice-heading .muted {
  max-width: 760px;
  margin-top: 22px;
  font-size: 1.04rem;
  line-height: 1.55;
}
.custom-back-btn {
  min-width: 96px;
}
.custom-practice-form {
  display: grid;
  gap: 18px;
}
.custom-notice {
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.custom-notice-error {
  border-color: rgba(255, 91, 91, 0.45);
  background: rgba(255, 91, 91, 0.12);
  color: #ffd7d7;
}
.custom-all-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    135deg,
    rgba(19, 14, 45, 0.92),
    rgba(47, 20, 73, 0.72)
  );
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}
.custom-all-card input,
.custom-topic-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.custom-check {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.08);
  position: relative;
}
.custom-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #1b1430;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.16s ease;
}
.custom-check-large {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
}
.custom-all-card input:checked + .custom-check,
.custom-topic-card input:checked + .custom-check {
  border-color: #f7c948;
  background: #f7c948;
}
.custom-all-card input:checked + .custom-check::after,
.custom-topic-card input:checked + .custom-check::after {
  transform: rotate(45deg) scale(1);
}
.custom-all-copy strong,
.custom-topic-name {
  display: block;
  color: var(--text);
  font-weight: 900;
  letter-spacing: -0.02em;
}
.custom-all-copy strong {
  font-size: 1.08rem;
}
.custom-all-copy small,
.custom-topic-count {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.94rem;
  line-height: 1.35;
}
.custom-all-count,
.custom-pill {
  white-space: nowrap;
  border-radius: 999px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.84rem;
  font-weight: 800;
}
.custom-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.9);
}
.custom-toolbar strong,
.custom-toolbar span {
  display: block;
}
.custom-toolbar strong {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
}
.custom-toolbar > div > span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.95rem;
}
.custom-topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}
.custom-topic-card {
  min-height: 104px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(18, 20, 32, 0.82);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}
.custom-topic-card:hover {
  transform: translateY(-2px);
  background: rgba(23, 24, 38, 0.9);
  border-color: rgba(247, 201, 72, 0.42);
}
.custom-topic-card:has(input:checked) {
  border-color: rgba(247, 201, 72, 0.64);
  background: linear-gradient(
    135deg,
    rgba(18, 20, 32, 0.92),
    rgba(56, 30, 94, 0.82)
  );
}
.custom-topic-copy {
  min-width: 0;
}
.custom-topic-name {
  font-size: 1.02rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.custom-topic-count {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}
.custom-practice-actions {
  position: sticky;
  bottom: 16px;
  z-index: 4;
  margin-top: 4px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(13, 9, 31, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {
  .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .exam-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .exam-top > div:first-child {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .exam-top-actions {
    width: 100%;
    align-items: center;
  }
  .exam-top-actions .btn {
    width: auto;
    min-width: 0;
  }
  .exam-live-timer {
    width: auto;
    min-width: 170px;
  }
  .exam-shell {
    width: min(calc(100% - 24px), 980px);
  }
  .exam-card {
    padding: 20px 16px;
    border-radius: 22px;
  }
  .exam-qtext {
    font-size: 1rem;
    line-height: 1.5;
  }
  .flashcards-page-header h1 {
    font-size: clamp(2.1rem, 10vw, 3.4rem);
  }
  .flashcard-big {
    min-height: 340px;
  }
  .flashcards-toolbar {
    grid-template-columns: 1fr;
  }
  .flashcards-decks-grid {
    grid-template-columns: 1fr 1fr;
  }
  .custom-practice-heading h1 {
    font-size: clamp(2.7rem, 10vw, 4.8rem);
  }
  .custom-all-card {
    grid-template-columns: auto 1fr;
  }
  .custom-all-count {
    grid-column: 2;
    width: max-content;
  }
}

@media (max-width: 780px) {
  :root {
    --topbar-h: 74px;
  }
  .topbar {
    padding: 0 14px;
    min-height: var(--topbar-h);
  }
  .logo {
    height: 48px;
    max-width: 180px;
  }
  .hamburger {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }
  body.menu-open .hamburger {
    width: 46px;
    height: 46px;
    min-width: 46px;
  }
  body.menu-open .hamburger span {
    left: 14px;
  }
  body.menu-open .hamburger span:nth-child(1),
  body.menu-open .hamburger span:nth-child(3) {
    top: 22px;
  }
  .menu {
    padding: 86px 26px;
    justify-content: center;
  }
  .menu-link {
    font-size: clamp(2.7rem, 14vw, 4.8rem);
  }

  .hero-content-wrap {
    padding-top: 105px;
    padding-bottom: 90px;
  }
  .hero-copy {
    transform: translateY(18px);
  }
  .hero-title,
  .subjects-header h1,
  .papers-top h1,
  .exam-top h1,
  .flashcards-page-header h1 {
    font-size: clamp(2rem, 9vw, 3.1rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
  }
  .hero-subtitle {
    width: min(100%, 92%);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 22px;
  }

  body.page-home .hero-search-shell {
    width: 100%;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  body.page-home .hero-search {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "input input" "subject ask";
    gap: 12px;
    height: auto;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    background: transparent;
  }
  body.page-home .hero-search-icon {
    grid-area: input;
    position: absolute;
    left: 22px;
    top: 18px;
    width: 24px;
    height: 24px;
    border-width: 3px;
    z-index: 2;
  }
  body.page-home .hero-search-icon::after {
    width: 10px;
    height: 4px;
    right: -8px;
    bottom: -5px;
  }
  body.page-home .hero-search input {
    grid-area: input;
    width: 100%;
    height: 60px;
    min-height: 60px;
    padding: 0 18px 0 66px;
    border-radius: 26px;
    background: #070707;
    border: 2px solid rgba(255, 255, 255, 0.16);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 0 0 2px rgba(122, 91, 255, 0.3),
      0 0 16px rgba(255, 111, 180, 0.14);
    font-size: 0.84rem;
    line-height: 1.1;
    font-weight: 500;
    text-align: left;
  }
  body.page-home .hero-subject-select,
  body.page-home .hero-search-submit {
    width: 100%;
    min-width: 0;
    height: 48px;
    min-height: 48px;
    border-radius: 999px;
    font-size: 0.86rem;
  }
  .hero-actions {
    grid-template-columns: repeat(3, 1fr);
  }
  .hero-action {
    padding: 16px 8px;
    font-size: 0.95rem;
    gap: 6px;
  }
  .hero-action-icon {
    width: 30px;
    height: 30px;
  }
  .home-version-tag {
    left: 18px;
    bottom: 16px;
    font-size: 0.66rem;
  }
  .home-devmunky-logo {
    right: 18px;
    bottom: 14px;
    width: 120px;
    max-width: 38vw;
  }

  .subjects-page,
  .info-page,
  .papers-page,
  .exam-page,
  .results-page {
    padding-top: 96px;
    padding-bottom: 48px;
  }
  .flashcards-shell,
  .papers-shell,
  .exam-shell,
  .subjects-header,
  .tiles,
  .info-shell {
    width: min(calc(100% - 24px), 100%);
  }
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
  }
  .tile-media {
    height: 124px;
  }
  .tile-title {
    left: 8px;
    bottom: 8px;
    font-size: 11px;
  }
  .tile-badge {
    top: 8px;
    right: 8px;
    padding: 8px 12px;
    font-size: 12px;
  }

  .papers-top,
  .exam-top,
  .custom-practice-top {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
  .papers-top > .btn.glass-btn,
  .papers-actions {
    align-self: flex-end;
    margin-left: auto;
  }
  .papers-actions {
    flex-direction: column;
    align-items: flex-end;
    width: auto;
  }
  .papers-actions .btn {
    width: auto;
    min-width: 180px;
  }
  .papers-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 18px;
  }
  .papers-card-left {
    flex: 1 1 auto;
    min-width: 0;
  }
  .papers-card form {
    flex: 0 0 auto;
    margin-left: auto;
  }
  .papers-card .start-btn {
    width: auto;
    min-width: 118px;
    margin-left: auto;
  }
  .inline-form,
  .inline-form button,
  .submit-btn,
  .next-btn {
    width: 100%;
  }
  .info-card,
  .exam-card,
  .study-output-card {
    padding: 18px;
    border-radius: 20px;
  }
  .list-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .custom-back-btn {
    align-self: flex-end;
    margin-left: auto;
    width: auto;
    min-width: 126px;
  }
  .custom-practice-shell {
    width: min(100% - 28px, 1040px);
  }
  .custom-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .custom-topic-grid {
    grid-template-columns: 1fr;
  }
  .custom-topic-card {
    min-height: auto;
  }
  .custom-practice-actions {
    justify-content: flex-end;
    align-items: flex-end;
  }
  .custom-practice-actions .btn {
    width: auto;
    min-width: 160px;
  }

  .score-hero {
    grid-template-columns: 1fr;
  }
  body.page-results {
    overflow-x: hidden;
  }
  body.page-results .results-shell {
    width: min(calc(100% - 24px), 100%);
    max-width: 100%;
  }
  body.page-results .results-card,
  body.page-results .weak-results-card {
    padding: 18px;
    border-radius: 24px;
    overflow: hidden;
  }
  body.page-results .results-card h2 {
    font-size: clamp(1.65rem, 8vw, 2.35rem);
    line-height: 1.05;
    margin-bottom: 18px;
  }
  body.page-results .weak-section-heading {
    display: block;
  }
  body.page-results .weak-section-heading h2 {
    font-size: clamp(1.45rem, 7vw, 2rem);
    line-height: 1.08;
  }
  body.page-results .weak-section-heading p {
    max-width: 100%;
    margin-top: 8px;
    font-size: 0.9rem;
    line-height: 1.45;
  }
  body.page-results .topic-results-table {
    min-width: 520px;
    width: 520px;
  }
  body.page-results .topic-results-table th,
  body.page-results .topic-results-table td {
    padding: 12px 14px;
    font-size: 0.85rem;
    white-space: nowrap;
  }
  body.page-results .results-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
  }
  body.page-results .results-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .flashcards-page-header {
    margin-bottom: 22px;
  }
  .flashcards-stage {
    margin-bottom: 2.25rem;
  }
  .flashcard-big {
    width: 100%;
    min-height: 280px;
  }
  .flashcard-face {
    border-radius: 24px;
    padding: 22px 18px 18px;
  }
  .flashcard-text {
    font-size: clamp(1.25rem, 6.4vw, 1.8rem);
    line-height: 1.08;
    margin: 14px 0;
  }
  .flashcards-toolbar {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .flashcards-decks-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .logo {
    height: 38px;
    max-width: 150px;
  }
  .topbar {
    padding: 0 12px;
  }
  .menu {
    padding: 78px 22px;
  }
  .menu-link {
    font-size: clamp(2.4rem, 15vw, 4rem);
  }
  .menu::before,
  .menu::after {
    font-size: 0.85rem;
  }
  .hero-content-wrap {
    padding-top: 96px;
    padding-bottom: 80px;
  }
  .hero-copy {
    transform: translateY(10px);
  }
  .hero-title,
  .subjects-header h1,
  .flashcards-page-header h1,
  .papers-top h1,
  .exam-top h1 {
    font-size: clamp(1.9rem, 10vw, 2.7rem);
  }
  body.page-home .hero-search {
    gap: 10px;
  }
  body.page-home .hero-search input {
    height: 56px;
    min-height: 56px;
    padding-left: 58px;
    border-radius: 24px;
    font-size: 0.78rem;
  }
  body.page-home .hero-search-icon {
    left: 20px;
    top: 17px;
    width: 22px;
    height: 22px;
  }
  body.page-home .hero-subject-select,
  body.page-home .hero-search-submit {
    min-height: 44px;
    height: 44px;
    font-size: 0.8rem;
  }
  .hero-actions {
    border-radius: 18px;
  }
  .hero-action {
    padding: 14px 6px;
    font-size: 0.82rem;
    line-height: 1.15;
    flex-direction: column;
    gap: 4px;
  }
  .hero-action-icon {
    width: 26px;
    height: 26px;
  }
  .home-version-tag {
    left: 14px;
    bottom: 12px;
    font-size: 0.58rem;
  }
  .home-devmunky-logo {
    right: 14px;
    bottom: 10px;
    width: 98px;
  }
  .tile-media {
    height: 112px;
  }
  body.page-results .results-shell {
    width: min(calc(100% - 20px), 100%);
  }
  body.page-results .results-card,
  body.page-results .weak-results-card {
    padding: 16px;
    border-radius: 22px;
  }
  body.page-results .topic-results-table {
    min-width: 480px;
    width: 480px;
  }
  body.page-results .topic-results-table th,
  body.page-results .topic-results-table td {
    padding: 10px 12px;
    font-size: 0.78rem;
  }
  .study-output-close {
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    font-size: 23px;
  }
}

/* =========================
   CLEAN RESULTS PDF PRINT
   Small, one-page-friendly fonts
========================= */
@media print {
  @page {
    size: letter;
    margin: 0.42in;
  }

  * {
    box-shadow: none !important;
    text-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html,
  body {
    background: #fff !important;
    color: #111 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 10.5pt !important;
    line-height: 1.28 !important;
  }

  .topbar,
  .menu,
  .menu-overlay,
  .subjects-backdrop,
  .exam-backdrop,
  .results-top,
  .results-actions,
  .home-version-tag,
  .home-devmunky-logo,
  .home-devmunky-link {
    display: none !important;
  }

  main,
  .container,
  .main-subjects,
  .subjects-page,
  .papers-page,
  .results-page,
  .papers-shell,
  .results-shell {
    width: 100% !important;
    max-width: 680px !important;
    min-height: auto !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: #fff !important;
    overflow: visible !important;
  }

  .results-card,
  .weak-results-card,
  .papers-card {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    color: #111 !important;
  }

  .results-card .muted:first-child {
    display: block !important;
    margin: 0 0 2px !important;
    color: #333 !important;
    font-size: 9.5pt !important;
  }

  .results-card h2 {
    margin: 0 0 10px !important;
    padding-bottom: 8px !important;
    border-bottom: 1.5px solid #111 !important;
    font-size: 18pt !important;
    line-height: 1.08 !important;
    color: #111 !important;
  }

  .score-hero {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin: 10px 0 8px !important;
    page-break-inside: avoid !important;
  }

  .score-hero > div {
    padding: 9px 10px !important;
    border: 1px solid #d8d8d8 !important;
    border-radius: 9px !important;
    background: #fff !important;
  }

  .score-label,
  .eyebrow {
    color: #444 !important;
    font-size: 7.5pt !important;
    letter-spacing: 0.11em !important;
    text-transform: uppercase !important;
  }

  .score-hero strong {
    display: inline-block !important;
    margin-top: 3px !important;
    font-size: 20pt !important;
    line-height: 1 !important;
    color: #111 !important;
  }

  .score-hero span:not(.score-label) {
    font-size: 9pt !important;
    color: #333 !important;
  }

  .muted {
    color: #333 !important;
    font-size: 9.5pt !important;
  }

  .weak-topic-section {
    margin-top: 11px !important;
    padding-top: 10px !important;
    border-top: 1px solid #d8d8d8 !important;
    page-break-inside: avoid !important;
  }

  .weak-section-heading {
    display: block !important;
    margin-bottom: 7px !important;
  }

  .weak-section-heading h2 {
    margin: 2px 0 4px !important;
    font-size: 15pt !important;
    line-height: 1.1 !important;
    color: #111 !important;
  }

  .weak-section-heading p {
    max-width: none !important;
    margin: 0 !important;
    color: #333 !important;
    font-size: 8.5pt !important;
  }

  .topic-table-wrap {
    border: 1px solid #d8d8d8 !important;
    border-radius: 0 !important;
    overflow: visible !important;
  }

  .topic-results-table {
    min-width: 0 !important;
    width: 100% !important;
    border-collapse: collapse !important;
    color: #111 !important;
  }

  .topic-results-table th,
  .topic-results-table td {
    padding: 5px 7px !important;
    border-bottom: 1px solid #d8d8d8 !important;
    color: #111 !important;
    font-size: 8pt !important;
    line-height: 1.25 !important;
  }

  .topic-results-table th {
    background: #f5f5f5 !important;
    font-weight: 900 !important;
    letter-spacing: 0.07em !important;
    text-transform: uppercase !important;
  }

  .topic-pill {
    padding: 3px 6px !important;
    font-size: 7.5pt !important;
    color: #111 !important;
    background: #fff !important;
    border: 1px solid #ccc !important;
  }

  .weak-topic-list {
    display: grid !important;
    gap: 6px !important;
  }

  .weak-topic-card {
    display: grid !important;
    grid-template-columns: 24px 1fr !important;
    gap: 8px !important;
    padding: 7px 9px !important;
    border: 1px solid #d8d8d8 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #111 !important;
    page-break-inside: avoid !important;
  }

  .weak-topic-number {
    width: 20px !important;
    height: 20px !important;
    background: #f1f1f1 !important;
    color: #111 !important;
    font-size: 9pt !important;
  }

  .weak-topic-card h3 {
    margin: 0 0 1px !important;
    color: #111 !important;
    font-size: 10pt !important;
    line-height: 1.15 !important;
  }

  .weak-topic-card p {
    margin: 0 !important;
    color: #222 !important;
    font-size: 8.5pt !important;
    line-height: 1.25 !important;
  }

  .progress-notice {
    margin-top: 8px !important;
    padding: 7px 9px !important;
    border: 1px dashed #999 !important;
    border-radius: 7px !important;
    background: #fff !important;
    color: #222 !important;
    font-size: 8.5pt !important;
    line-height: 1.25 !important;
    page-break-inside: avoid !important;
  }
}
/* =====================================================
   SUBJECT TILES FIX
   Restores smaller square/tile layout
===================================================== */

body.page-subjects .subjects-header,
body.page-subjects .tiles {
  width: min(calc(100% - 32px), 850px) !important;
}

body.page-subjects .tiles {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 3px !important;
  padding: 3px !important;
  margin: 0 auto !important;
  background: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24) !important;
}

body.page-subjects .tile {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  background: #111 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.page-subjects .tile-media {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  display: block !important;
  overflow: hidden !important;
  background: #111 !important;
}

body.page-subjects .tile-media img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  display: block !important;
}

body.page-subjects .tile-title {
  position: absolute !important;
  left: 10px !important;
  right: 10px !important;
  bottom: 10px !important;
  z-index: 3 !important;
  color: #fff !important;
  font-size: 12px !important;
  line-height: 1.05 !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  text-shadow:
    0 2px 7px rgba(0, 0, 0, 0.8),
    0 0 14px rgba(0, 0, 0, 0.45) !important;
}

/* Tablet */
@media (max-width: 900px) {
  body.page-subjects .tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* Mobile */
@media (max-width: 780px) {
  body.page-subjects .subjects-header {
    width: min(calc(100% - 28px), 850px) !important;
  }

  body.page-subjects .tiles {
    width: min(400px, calc(100% - 28px)) !important;
  }

  body.page-subjects .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-subjects .tile-title {
    left: 7px !important;
    right: 7px !important;
    bottom: 7px !important;
    font-size: 1.1rem !important;
  }
}

/* Small phones */
@media (max-width: 480px) {
  body.page-subjects .subjects-header,
  body.page-subjects .tiles {
    width: min(calc(100% - 20px), 850px) !important;
  }

  body.page-subjects .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.page-subjects .tile-title {
    font-size: 0.66rem !important;
  }
}

/* =====================================================
   FINAL LEGAL / MOBILE CLEANUP PATCH
===================================================== */
.menu-legal-links {
  display: flex;
  gap: 16px;
  margin-top: 18px;
}

.menu-legal-links a {
  color: #050505;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  opacity: 0.78;
}

.menu-legal-links a:hover {
  opacity: 1;
  text-decoration: underline;
}

@media (max-width: 780px) {
  body.page-subjects .tiles {
    width: min(450px, calc(100% - 28px)) !important;
  }
}

@media print {
  .results-card h2 {
    font-size: 16px !important;
    line-height: 1.15 !important;
  }

  .weak-section-heading h2 {
    font-size: 16px !important;
    line-height: 1.2 !important;
  }

  .score-hero strong {
    font-size: 24px !important;
  }
}
/* =====================================================
   TRUE MOBILE PAPERS / EXAM BUTTON FIX
   Back + Custom are both inside .papers-actions
===================================================== */

@media (max-width: 780px) {
  /* PAPER LIST PAGE */
  body.page-papers .papers-top {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 22px !important;
    margin-bottom: 26px !important;
    text-align: left !important;
  }

  body.page-papers .papers-heading,
  body.page-papers .papers-top > div:first-child {
    width: 100% !important;
    margin: 0 !important;
  }

  body.page-papers .papers-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  /* First button = Back, force left */
  body.page-papers .papers-actions .btn:first-child,
  body.page-papers .papers-actions a:first-child {
    justify-self: start !important;
    width: auto !important;
    min-width: 125px !important;
    min-height: 54px !important;
    margin: 0 !important;
    border-radius: 18px !important;
    background: rgba(6, 7, 12, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3) !important;
  }

  /* Second button = Custom Practice, force right */
  body.page-papers .papers-actions .btn:nth-child(2),
  body.page-papers .papers-actions a:nth-child(2) {
    justify-self: end !important;
    width: auto !important;
    min-width: 170px !important;
    min-height: 54px !important;
    margin: 0 !important;
    border-radius: 18px !important;
  }

  body.page-papers .papers-card {
    background: rgba(6, 7, 12, 0.72) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 22px !important;
  }

  /* EXAM PAGE */
  body.page-exam .exam-top {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 20px !important;
    margin-bottom: 26px !important;
    text-align: left !important;
  }

  body.page-exam .exam-heading,
  body.page-exam .exam-top > div:first-child {
    width: 100% !important;
    align-items: flex-start !important;
    text-align: left !important;
    margin: 0 !important;
  }

  body.page-exam .exam-top-actions {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    align-items: center !important;
    margin: 0 !important;
  }

  body.page-exam .exam-top-actions .btn,
  body.page-exam .exam-top-actions a {
    justify-self: start !important;
    width: auto !important;
    min-width: 145px !important;
    min-height: 54px !important;
    margin: 0 !important;
    border-radius: 18px !important;
    background: rgba(6, 7, 12, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3) !important;
  }

  body.page-exam .exam-live-timer {
    justify-self: end !important;
    width: auto !important;
    min-width: 145px !important;
    min-height: 54px !important;
    margin: 0 !important;
    padding: 13px 16px !important;
    border-radius: 18px !important;
    background: rgba(6, 7, 12, 0.88) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
    font-size: 0.95rem !important;
    letter-spacing: 0.12em !important;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3) !important;
  }
}

@media (max-width: 480px) {
  body.page-papers .papers-actions {
    grid-template-columns: 0.82fr 1.18fr !important;
    gap: 10px !important;
  }

  body.page-papers .papers-actions .btn:first-child,
  body.page-papers .papers-actions a:first-child {
    min-width: 118px !important;
    min-height: 50px !important;
    font-size: 0.92rem !important;
  }

  body.page-papers .papers-actions .btn:nth-child(2),
  body.page-papers .papers-actions a:nth-child(2) {
    min-width: 155px !important;
    min-height: 50px !important;
    font-size: 0.92rem !important;
  }

  body.page-exam .exam-top-actions .btn,
  body.page-exam .exam-top-actions a,
  body.page-exam .exam-live-timer {
    min-width: 132px !important;
    min-height: 50px !important;
    font-size: 0.9rem !important;
  }
}
/* =====================================================
   MOBILE SAFARI MENU YELLOW BLEED FIX
   Prevents hidden yellow menu from showing at top/bottom
===================================================== */

html,
body {
  background: var(--page-dark-bottom) !important;
  overscroll-behavior: none;
}

/* Closed menu must not paint yellow off-screen */
.menu {
  visibility: hidden;
  background: transparent !important;
  transform: translate3d(0, -110%, 0) !important;
}

/* Only show yellow while menu is actually open */
body.menu-open .menu {
  visibility: visible;
  background: #ffc400 !important;
  transform: translate3d(0, 0, 0) !important;
}

/* Stop the page from scrolling behind the open menu */
body.menu-open {
  overflow: hidden !important;
  background: #ffc400 !important;
}

/* When menu closes, page returns to dark */
body:not(.menu-open) {
  background: var(--page-dark-bottom) !important;
}

/* iPhone safe-area protection */
body:not(.menu-open)::before,
body:not(.menu-open)::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top);
  background: var(--page-dark-bottom);
  pointer-events: none;
  z-index: 9999;
}

body:not(.menu-open)::before {
  top: 0;
}

body:not(.menu-open)::after {
  bottom: 0;
  height: env(safe-area-inset-bottom);
}
