/* Maths Maker — design system & layout */

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e6eaf0;
  --border-strong: #d4dce7;
  --blue: #111111;
  --correct: #16a34a;
  --incorrect: #dc2626;
  --green: #1d4ed8;
  --text: #09090b;
  --text-2: #3f3f46;
  --text-3: #71717a;
  --radius: 14px;
  --radius-sm: 9px;
  --easy: #16a34a;
  --medium: #d97706;
  --hard: #dc2626;
  --premium-bg: #eff6ff;
  --premium-border: #bfdbfe;
  --header-h: 56px;
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  /* Upper bound; actual width also shrinks with the viewport (see --layout-max). */
  --layout-width-cap: 1200px;
  --layout-max: min(var(--layout-width-cap), calc(100vw - 2rem));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 120%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(22, 163, 74, 0.12);
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.01) 1px, transparent 1px),
    linear-gradient(rgba(15, 23, 42, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.016) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
  background-position: -1px -1px;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  min-height: var(--header-h);
}

.header-left {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  color: var(--text);
}

.brand-logo {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: contain;
  background: transparent;
}

.brand-logo--sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.brand-logo-full {
  display: inline-block;
  width: clamp(120px, 16vw, 170px);
  height: auto;
  object-fit: contain;
}

.vocabbuilder-header-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 0;
  border-radius: 8px;
  transition: opacity 0.15s ease;
}

.vocabbuilder-header-link:hover {
  opacity: 0.88;
}

.vocabbuilder-header-link:focus-visible {
  outline: 2px solid rgba(29, 78, 216, 0.35);
  outline-offset: 2px;
}

.vocabbuilder-header-logo {
  display: block;
  width: clamp(96px, 13vw, 142px);
  height: auto;
  max-height: 42px;
  object-fit: contain;
  object-position: left center;
}

.brand-name {
  letter-spacing: -0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: relative;
}

.streak-widget {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.streak-widget--button {
  font-family: inherit;
  cursor: pointer;
}
.streak-widget--button:hover {
  border-color: var(--premium-border);
}
.streak-widget--button:focus-visible {
  outline: 2px solid rgba(29, 78, 216, 0.35);
  outline-offset: 1px;
}

.streak-flame {
  font-size: 1rem;
  line-height: 1;
}

.streak-text {
  color: var(--text-2);
}

.streak-popover {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  width: min(320px, calc(100vw - 1.25rem));
  border: 1px solid var(--premium-border);
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  padding: 0.72rem 0.8rem;
}

.streak-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.streak-popover-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.streak-popover-close {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  border-radius: 8px;
  width: 26px;
  height: 26px;
  line-height: 1;
  cursor: pointer;
  font-size: 0.95rem;
}

.streak-popover-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-2);
}

.pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
}

.pill-ai {
  display: none;
}

@media (min-width: 400px) {
  .pill-ai {
    display: inline-block;
  }
}

.pill-trial {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.btn {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 0.48rem 0.88rem;
  min-height: 40px;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s, box-shadow 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible,
.year-select:focus-visible,
.answer-input:focus-visible,
.input:focus-visible {
  outline: 2px solid rgba(29, 78, 216, 0.35);
  outline-offset: 1px;
}

.btn-header {
  background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
  color: #fff;
  border-color: #111827;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.18);
}

.btn-header:hover {
  background: linear-gradient(180deg, #111827 0%, #030712 100%);
}

.auth-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 190px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 70;
}

.auth-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  padding: 0.58rem 0.75rem;
  cursor: pointer;
}

.auth-menu-item:last-child {
  border-bottom: 0;
}

.auth-menu-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.btn-header-left {
  background: rgba(29, 78, 216, 0.08);
  border-color: rgba(29, 78, 216, 0.28);
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
}

.btn-header-left:hover {
  background: rgba(29, 78, 216, 0.14);
  border-color: rgba(29, 78, 216, 0.42);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04);
}

.btn-top-nav {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.14);
  color: var(--text);
  font-weight: 600;
}

.btn-top-nav:hover {
  background: rgba(15, 23, 42, 0.09);
  border-color: rgba(15, 23, 42, 0.22);
}

.btn-join-nav {
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  background: linear-gradient(180deg, #8fcb55 0%, #6cb33f 100%);
  border: 2px solid #0f1f08;
  color: #0f1f08;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 0.55rem 1.1rem;
  min-height: 42px;
  box-shadow: 0 4px 10px rgba(108, 179, 63, 0.4);
}

.btn-join-nav:hover {
  background: linear-gradient(180deg, #6cb33f 0%, #5c9e2d 100%);
  color: #0f1f08;
  box-shadow: 0 6px 14px rgba(92, 158, 45, 0.45);
}

.btn-join-nav:focus-visible {
  outline: 2px solid rgba(108, 179, 63, 0.6);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.btn-primary:hover:not(:disabled) {
  background: #000;
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-block {
  width: 100%;
  padding: 0.65rem 1rem;
}

.btn-submit {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 600;
}

.btn-submit:hover:not(:disabled) {
  background: #000;
}

.btn-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-skip,
.btn-back {
  font-size: 0.8125rem;
  padding: 0.3rem 0.55rem;
}

.qnav {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
  justify-self: end;
  white-space: nowrap;
}

.qnav .btn {
  flex: 0 0 auto;
}

.btn-hint-toggle {
  margin-top: 0.75rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  color: var(--text-2);
  font-size: 0.8125rem;
}

.btn-hint-toggle:hover {
  border-style: solid;
  background: var(--bg);
}

.btn-ai {
  background: #e4e4e7;
  color: var(--text-3);
  border-color: var(--border);
  cursor: not-allowed;
}

.btn-premium-cta {
  width: 100%;
  margin-top: 0.75rem;
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  font-weight: 600;
}

.btn-premium-cta:hover {
  filter: brightness(1.05);
}

/* ——— Main ——— */
.main {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 1.35rem 1rem 3.3rem;
}

.steps-bar {
  display: none;
}

.page-intro {
  text-align: center;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}

.page-title {
  margin: 0 0 0.45rem;
  font-size: clamp(1.2rem, 2.6vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.25;
}

.page-quote {
  margin: 0 auto;
  max-width: 40rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-2);
  font-style: italic;
}

.info-strip {
  margin-bottom: 1.1rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.info-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(29, 78, 216, 0.045), rgba(29, 78, 216, 0));
  pointer-events: none;
}

.info-strip p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.daily-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.daily-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 0.75rem;
  color: var(--text-2);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.year-picker-row {
  margin-top: 0.65rem;
}

.streak-challenge {
  margin-top: 0.55rem !important;
  font-size: 0.78rem !important;
  color: var(--green) !important;
  font-weight: 600;
}

.year-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--text-3);
}

.year-select {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0.42rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  min-height: 40px;
  min-width: 126px;
  touch-action: manipulation;
}

.year-select option[disabled],
.year-select option:disabled {
  color: #8f99ab;
  background: #f2f4f8;
}

.class-status {
  display: none;
}

/* ——— Math graph paper ——— */
.problem-card,
.upload-card .answer-input,
.upload-card .upload-zone {
  background-color: var(--surface);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.07) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
  background-position: -1px -1px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.problem-card {
  padding-bottom: 1.1rem;
}

.card-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.meta-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  min-width: 0;
}

.meta-left {
  font-weight: 600;
  color: var(--text);
}

.topic-badge {
  padding: 0.15rem 0.45rem;
  background: var(--bg);
  border-radius: 6px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
}

.timer {
  font-variant-numeric: tabular-nums;
  min-width: 2.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: #fafafa;
  border: 1px solid var(--border);
  font-size: 0.75rem;
}

.timer.running {
  border-color: var(--green);
  color: var(--green);
}

.timer.fast {
  color: var(--correct);
}

.timer.slow {
  color: var(--hard);
}

.question-block {
  margin-bottom: 0.5rem;
}

.question-prefix {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
}

.question-body {
  font-size: 1.02rem;
  line-height: 1.65;
  margin: 0;
  letter-spacing: 0.005em;
}

.question-body p,
.answer-steps p {
  margin: 0 0 0.65rem;
}

.question-body p:last-child,
.answer-steps p:last-child {
  margin-bottom: 0;
}

.question-body ul,
.question-body ol,
.answer-steps ul,
.answer-steps ol {
  margin: 0.25rem 0 0.75rem 1.25rem;
  padding-left: 0.75rem;
}

.question-body li,
.answer-steps li {
  margin-bottom: 0.35rem;
  line-height: 1.55;
}

.question-body .centered,
.answer-steps .centered {
  text-align: center;
  margin: 0.5rem 0;
}

.problem-table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.75rem 0;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.problem-table th,
.problem-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.problem-table thead th {
  background: rgba(0, 0, 0, 0.04);
  font-weight: 700;
  color: var(--text-2);
}

.problem-table tbody tr:last-child th,
.problem-table tbody tr:last-child td {
  border-bottom: none;
}

.math-content .katex {
  font-size: 1.05em;
}

.math-content .katex-display {
  margin: 0.5rem 0;
}

.hint-row {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}

.hint-label {
  margin: 0 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.hint-body {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-2);
}

/* ——— Answer card ——— */
.answer-card {
  border-left: 4px solid var(--green);
  animation: slideIn 0.35s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.answer-card-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--green);
}

.answer-steps {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.answer-steps li {
  margin-bottom: 0.5rem;
}

.answer-final {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(29, 78, 216, 0.06);
  border: 1px solid rgba(29, 78, 216, 0.2);
}

.answer-final-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green);
  margin-bottom: 0.35rem;
}

.answer-final-box {
  font-weight: 600;
}

/* ——— Solution / upload ——— */
.solution-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
}

.solution-inner {
  position: relative;
}

.answer-input {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  padding: 0.75rem;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
}

.answer-input:focus {
  outline: 2px solid rgba(17, 17, 17, 0.25);
  outline-offset: 1px;
}

.char-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.char-count {
  font-size: 0.75rem;
  color: var(--text-3);
}

.premium-upload-wrap {
  position: relative;
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.premium-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem 1rem;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--premium-border);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.premium-overlay-inner {
  text-align: center;
  max-width: 260px;
}

.premium-lock {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.35rem;
}

.premium-overlay-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--green);
}

.premium-overlay-text {
  margin: 0.3rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-2);
}

.upload-zone {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 1.25rem 1rem;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-3);
}

.upload-hint {
  margin: 0;
  font-size: 0.8125rem;
}

.upload-file {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--text-2);
  word-break: break-all;
}

.file-input {
  display: none;
}

.solution-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.solution-actions .btn {
  flex: 1 1 auto;
  min-width: 140px;
}

/* ——— Results ——— */
.results-top {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.score-circle {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
}

.score-circle[data-result="correct"] {
  background: rgba(22, 163, 74, 0.12);
  color: var(--correct);
  border: 2px solid var(--correct);
}

.score-circle[data-result="complete"] {
  background: rgba(29, 78, 216, 0.12);
  color: var(--green);
  border: 2px solid rgba(29, 78, 216, 0.5);
}

.score-circle[data-result="incorrect"] {
  background: rgba(220, 38, 38, 0.1);
  color: var(--incorrect);
  border: 2px solid var(--incorrect);
}

.results-text {
  flex: 1;
  min-width: 0;
}

.results-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.results-sub {
  margin: 0.15rem 0 0;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.results-time {
  margin: 0.35rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.feedback-box {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.feedback-label {
  margin: 0 0 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.feedback-text {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.streak-result {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.streak-result[data-gain="true"] {
  background: rgba(22, 163, 74, 0.1);
  color: var(--correct);
  border: 1px solid rgba(22, 163, 74, 0.3);
}

.streak-result[data-gain="false"] {
  background: var(--bg);
  color: var(--text-3);
  border: 1px solid var(--border);
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.results-actions .btn {
  flex: 1 1 auto;
  min-width: 120px;
}

/* ——— Past questions ——— */
.past-card {
  background: linear-gradient(180deg, var(--premium-bg) 0%, var(--surface) 48%);
  border-color: var(--premium-border);
}

.past-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.past-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.pill-premium {
  background: var(--premium-bg);
  border-color: var(--premium-border);
  color: var(--green);
}

.past-lead {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-2);
}

.past-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.past-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
}

.past-item:last-child {
  border-bottom: none;
}

.past-date {
  font-weight: 600;
  color: var(--text-2);
}

.past-lock {
  margin-left: auto;
  opacity: 0.6;
}

/* ——— Footer ——— */
.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  padding: 2rem 1rem 2.5rem;
  margin-top: auto;
  backdrop-filter: blur(2px);
}

.footer-inner {
  max-width: var(--layout-max);
  margin: 0 auto;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.footer-disclosures p {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.footer-copy {
  margin: 1.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.footer-link {
  color: var(--green);
  text-decoration: none;
}

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

/* ——— Modal ——— */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-3);
  border-radius: 8px;
}

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.login-form .field {
  margin-bottom: 0.85rem;
}

.login-form label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  font-size: 16px;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.input:focus {
  outline: 2px solid rgba(17, 17, 17, 0.2);
  outline-offset: 0;
}

.field-error {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--incorrect);
}

.password-wrap {
  position: relative;
}

.password-wrap .input {
  padding-right: 4rem;
}

.btn-show-pw {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
}

.forgot-row {
  margin: -0.25rem 0 0.85rem;
  font-size: 0.8125rem;
}

.link-muted {
  color: var(--text-3);
}

.signup-row {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-2);
}

.link {
  color: var(--green);
  font-weight: 600;
  text-decoration: none;
}

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

/* ——— Toast ——— */
.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: min(360px, calc(100vw - 2rem));
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.toast-emoji {
  font-size: 1.5rem;
  line-height: 1;
}

.toast-title {
  margin: 0;
  font-weight: 700;
  font-size: 0.9375rem;
}

.toast-sub {
  margin: 0.1rem 0 0;
  font-size: 0.8125rem;
  opacity: 0.9;
}

/* ——— About page ——— */
.about-main {
  padding-top: 0.5rem;
}

.about-hero {
  text-align: center;
  padding: 1.5rem 0 2rem;
}

.about-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.about-title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.about-lead {
  margin: 0.75rem auto 0;
  max-width: 42ch;
  font-size: 1rem;
  color: var(--text-2);
}

.about-cta-row {
  margin-top: 1.25rem;
}

.about-cta-btn {
  max-width: 240px;
  margin: 0 auto;
  display: block;
  text-align: center;
  text-decoration: none;
}

.about-inline-cta {
  text-decoration: none;
  display: inline-block;
}

.about-card {
  margin-bottom: 1rem;
}

.about-card h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.about-card p {
  margin: 0 0 0.65rem;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.about-card p:last-child {
  margin-bottom: 0;
}

.about-steps {
  margin: 0;
  padding: 0;
  list-style: none;
}

.about-step {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.about-step:last-child {
  margin-bottom: 0;
}

.about-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-step-body strong {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--text);
}

.about-step-body span {
  font-size: 0.875rem;
  color: var(--text-2);
}

.about-levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
}

.about-level {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
}

.about-level h3 {
  margin: 0 0 0.35rem;
  font-size: 0.875rem;
  font-weight: 700;
}

.about-level p {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.about-pricing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 520px) {
  .about-pricing {
    grid-template-columns: 1fr;
  }
}

.about-pricing-col {
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.about-pricing-premium {
  background: var(--premium-bg);
  border-color: var(--premium-border);
}

.about-pricing-col h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
}

.about-pricing-col ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.about-pricing-col li {
  margin-bottom: 0.35rem;
}

.about-disclaimer {
  font-size: 0.8125rem;
  color: var(--text-2);
}

.about-footer-cta {
  text-align: center;
  padding: 1.5rem 0 0;
}

/* ——— Join now (plans) ——— */
.join-lead {
  max-width: none;
}

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

@media (max-width: 720px) {
  .plan-grid {
    grid-template-columns: 1fr;
  }
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.35rem 1.5rem;
  border-radius: 18px;
  border: 1px solid #d4ead0;
  background: linear-gradient(180deg, #f3fbef 0%, #ffffff 60%);
  box-shadow: 0 12px 30px rgba(108, 179, 63, 0.12);
  overflow: hidden;
}

.plan-card--super {
  border-color: #b6db97;
  background: linear-gradient(180deg, #ecf7e1 0%, #ffffff 65%);
  box-shadow: 0 14px 32px rgba(108, 179, 63, 0.18);
}

.plan-ribbon {
  position: absolute;
  top: 18px;
  right: -42px;
  transform: rotate(45deg);
  width: 160px;
  text-align: center;
  padding: 0.32rem 0;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f1f08;
  background: linear-gradient(180deg, #a8d96a 0%, #6cb33f 100%);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.plan-ribbon--off {
  background: linear-gradient(180deg, #c6ee8a 0%, #6cb33f 100%);
}

.plan-ribbon--free {
  background: linear-gradient(180deg, #d6f0bb 0%, #93c66c 100%);
}

.plan-head {
  text-align: center;
  margin-bottom: 1rem;
}

.plan-name {
  margin: 0 0 0.55rem;
  font-size: clamp(1.15rem, 2.5vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.plan-name--starter {
  color: #2a87b5;
}

.plan-name--super {
  color: #5c9e2d;
}

.plan-price {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--text);
}

.plan-price-current {
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.plan-price-old {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.plan-price-unit {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-2);
}

.plan-price-alt {
  margin: 0.45rem 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-2);
}

.plan-price-alt strong {
  color: var(--text);
}

.plan-price-save {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #2f5d19;
  background: #d6f0bb;
  border: 1px solid #9cc86f;
  border-radius: 999px;
}

.plan-cta {
  display: block;
  width: 100%;
  padding: 0.95rem 1rem;
  text-align: center;
  text-decoration: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #0f172a;
  background: #f97316;
  border: 1px solid #ea580c;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(249, 115, 22, 0.28);
  transition: background 0.15s, transform 0.1s, box-shadow 0.2s;
}

.plan-cta:hover {
  background: #ea580c;
  box-shadow: 0 8px 18px rgba(234, 88, 12, 0.32);
}

.plan-cta:active {
  transform: scale(0.98);
}

.plan-cta:focus-visible {
  outline: 2px solid rgba(249, 115, 22, 0.55);
  outline-offset: 2px;
}

.plan-cta-note {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-3);
}

.plan-divider {
  margin: 1.1rem 0 1rem;
  border: 0;
  border-top: 1px solid var(--border);
}

.plan-tagline {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.plan-highlight {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.95rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: #f3fbef;
  border: 1px solid #c8e3b1;
}

.plan-highlight-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #6cb33f;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
}

.plan-highlight p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.4;
}

.plan-highlight strong {
  color: var(--text);
}

.plan-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.92rem;
  color: var(--text-2);
  line-height: 1.4;
}

.plan-features strong {
  color: var(--text);
}

.plan-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  fill: none;
  stroke: #6cb33f;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.join-fine-print {
  margin-top: 0.25rem;
}

/* ——— Responsive tweaks ——— */
@media (min-width: 521px) {
  .meta-info {
    flex-wrap: nowrap;
  }
}

@media (max-width: 760px) {
  /* Keep the same root scale as desktop so typography does not feel “shrunk then blown up”. */
  html {
    font-size: 120%;
  }

  body {
    font-size: 16px;
  }

  .header-inner {
    flex-direction: column;
    align-items: stretch;
    row-gap: 0.55rem;
    column-gap: 0;
  }

  .header-left {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
  }

  /* One horizontal strip: scroll instead of wrapping “JOIN NOW” onto two lines. */
  .header-right {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 0.2rem;
    margin-bottom: -0.05rem;
  }

  .header-right > * {
    flex: 0 0 auto;
  }

  .btn-join-nav {
    white-space: nowrap;
    font-size: 0.82rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    letter-spacing: 0.04em;
  }

  .pill-ai {
    display: none !important;
  }

  .streak-widget {
    padding: 0.26rem 0.5rem;
    font-size: 0.75rem;
  }

  .btn {
    font-size: 0.78rem;
    padding: 0.42rem 0.72rem;
  }

  .btn-top-nav,
  .btn-join-nav,
  .btn-header {
    padding-top: 0.42rem;
    padding-bottom: 0.42rem;
  }

  .daily-banner {
    gap: 0.4rem;
  }

  .daily-chip {
    font-size: 0.69rem;
    padding: 0.24rem 0.5rem;
  }

  .streak-challenge {
    font-size: 0.72rem !important;
  }

  .page-quote {
    font-size: 0.84rem;
    line-height: 1.5;
  }

  .year-picker {
    font-size: 0.7rem;
  }

  .year-select {
    min-width: 112px;
    font-size: 0.72rem;
  }

  .card {
    padding: 0.95rem 0.95rem;
    margin-bottom: 0.9rem;
  }

  .card-meta {
    gap: 0.32rem 0.46rem;
    font-size: 0.74rem;
  }

  .topic-badge {
    font-size: 0.68rem;
  }

  .timer {
    font-size: 0.68rem;
  }

  .question-body {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .solution-actions,
  .results-actions {
    flex-direction: column;
  }

  .solution-actions .btn,
  .results-actions .btn {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 375px) {
  html {
    font-size: 120%;
  }

  body {
    font-size: 16px;
  }

  .header-inner {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .brand-logo-full {
    width: clamp(100px, 34vw, 125px);
  }

  .vocabbuilder-header-logo {
    width: clamp(78px, 30vw, 112px);
    max-height: 36px;
  }

  .btn-join-nav {
    font-size: 0.78rem;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .btn-header-left {
    font-size: 0.68rem;
    padding: 0.34rem 0.5rem;
  }

  .streak-widget {
    font-size: 0.68rem;
    padding: 0.22rem 0.42rem;
  }

  .btn {
    font-size: 0.72rem;
    padding: 0.38rem 0.6rem;
  }

  .daily-chip {
    font-size: 0.64rem;
    padding: 0.22rem 0.42rem;
  }

  .year-select {
    min-width: 102px;
    font-size: 0.68rem;
  }

  .card {
    padding: 0.85rem;
  }

  .question-body {
    font-size: 0.9rem;
  }
}
