/* Pedemy design system — Direction B "Growth Chart".
   Loaded after style.css: it restyles the shared pieces (type, colour, buttons,
   cards, forms, header, footer) for every page, and adds the new homepage.
   Source of truth for values: brand/tokens.css. */

:root {
  --pd-ink: #1A2A40; --pd-cobalt: #34509F; --pd-cobalt-strong: #263C7A; --pd-on-accent: #FFFFFF; --pd-band: #1A2A40; --pd-band-card: #22344E;
  --pd-gold: #E9A23B; --pd-gold-text: #7A4F0C; --pd-alert: #B23A30; --pd-ok: #1F7A4F;
  --pd-bg: #F7F8FA; --pd-surface: #FFFFFF; --pd-surface-2: #EDF0F5; --pd-line: #DCE1E9;
  --pd-text: #1A2A40; --pd-chip: #F8EEDC; --pd-chart-grid: #EDF0F5; --pd-chart-dot: #1A2A40; --pd-text-2: #3B4A60; --pd-muted: #5E6B80;
  --pd-font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --pd-font-text: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --pd-font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --pd-radius: 6px; --pd-radius-btn: 4px;
  --pd-shadow: 0 1px 2px rgba(20,35,58,.06), 0 8px 24px -16px rgba(20,35,58,.3);

  /* Map the old variables so every existing page picks up the brand. */
  --bg: var(--pd-bg); --surface: var(--pd-surface); --text: var(--pd-text); --muted: var(--pd-muted);
  --border: var(--pd-line); --accent: var(--pd-cobalt); --accent-text: var(--pd-on-accent); --flash: var(--pd-surface-2);
  --bad: var(--pd-alert); --ok: var(--pd-ok); --mint: var(--pd-surface-2); --coral: var(--pd-gold);
}

/* ---------- base ---------- */
body { background: var(--pd-bg); color: var(--pd-text); font-family: var(--pd-font-text); font-size: 16px; line-height: 1.6; }
h1, h2, h3 { font-family: var(--pd-font-display); font-weight: 600; letter-spacing: -0.015em; color: var(--pd-ink); text-wrap: balance; }
a { color: var(--pd-cobalt); }
a:hover { color: var(--pd-cobalt-strong); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--pd-gold); outline-offset: 3px; }
.wrap { max-width: 1200px; padding-left: 24px; padding-right: 24px; }
.muted { color: var(--pd-muted); }
.eyebrow { font-family: var(--pd-font-text); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--pd-cobalt); }
.text-link { color: var(--pd-ink); font-weight: 600; }
.text-link:hover { color: var(--pd-cobalt); }
code, .mono { font-family: var(--pd-font-mono); }

/* ---------- buttons ---------- */
.btn { background: var(--pd-cobalt); color: var(--pd-on-accent); border: 1.5px solid var(--pd-cobalt); border-radius: var(--pd-radius-btn);
  padding: 12px 20px; font-family: var(--pd-font-text); font-weight: 600; font-size: 15px; line-height: 1.2; filter: none; }
.btn:hover { background: var(--pd-cobalt-strong); border-color: var(--pd-cobalt-strong); color: var(--pd-on-accent); text-decoration: none; filter: none; }
.btn-ghost, .btn.btn-ghost { background: transparent; color: var(--pd-ink); border: 1.5px solid var(--pd-ink); }
.btn-ghost:hover { background: var(--pd-ink); color: var(--pd-bg); }
.btn-small { padding: 8px 14px; font-size: 14px; }
.btn-danger { background: var(--pd-alert); border-color: var(--pd-alert); }

/* ---------- cards, forms, notices ---------- */
.card { background: var(--pd-surface); border: 1px solid var(--pd-line); border-radius: var(--pd-radius); box-shadow: none; }
input, textarea, select { font-family: var(--pd-font-text); background: var(--pd-surface); border: 1px solid #C9D1DE; border-radius: var(--pd-radius-btn); color: var(--pd-text); }
input:focus, textarea:focus, select:focus { border-color: var(--pd-cobalt); }
.flash, .notice { background: var(--pd-surface-2); border-radius: var(--pd-radius); }
.notice { border-left: 4px solid var(--pd-cobalt); }
.planned-chip, .nav-soon { background: var(--pd-chip); color: var(--pd-gold-text); border-radius: 3px; font-weight: 700; }
.badge, .price.free { background: #E3F2EA; color: var(--pd-ok); }

/* ---------- header ---------- */
.topbar { background: var(--pd-surface); border-bottom: 1px solid var(--pd-line); position: relative; z-index: 5; }
.topbar-inner { height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; line-height: 1; color: var(--pd-ink); text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--pd-ink); }
.topbar .brand img.brand-mark { width: 40px; height: 40px; flex: none; object-fit: contain; }
.brand-name { font-family: var(--pd-font-display); font-weight: 600; font-size: 30px; letter-spacing: -0.025em; line-height: 1; }
nav { gap: 26px; font-size: 15px; font-weight: 600; }
nav a { color: var(--pd-ink); }
nav a:hover { color: var(--pd-cobalt); text-decoration: none; }
nav .btn, nav .btn:hover { color: var(--pd-on-accent); }
@media (max-width: 720px) {
  .topbar-inner { height: auto; min-height: 0; flex-wrap: wrap; justify-content: space-between; padding-top: 12px; padding-bottom: 12px; row-gap: 10px; }
  .topbar nav { width: 100%; justify-content: flex-start; gap: 18px; font-size: 14px; }
  .brand-name { font-size: 26px; }
  .topbar .brand img.brand-mark { width: 34px; height: 34px; }
}

/* ---------- footer ---------- */
.pd-footer { background: var(--pd-band); color: #B7C2D6; margin-top: 72px; }
.pd-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px 48px; padding-top: 48px; padding-bottom: 40px; }
.pd-footer-logo img { width: 300px; max-width: 100%; height: auto; display: block; }
.pd-footer p { margin: 14px 0 0; max-width: 46ch; font-size: 14px; line-height: 1.6; }
.pd-footer nav { flex-direction: column; align-items: flex-start; gap: 10px; font-size: 15px; }
.pd-footer nav a { color: #FFFFFF; }
.pd-footer nav a:hover { color: var(--pd-gold); }
.pd-footer-cols { display: flex; gap: 56px; flex-wrap: wrap; }
.pd-footer-cols h2 { font-family: var(--pd-font-text); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--pd-gold); margin: 0 0 12px; }
.pd-footer-bottom { border-top: 1px solid #2A3B55; padding-top: 18px; padding-bottom: 28px; font-size: 13px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.pd-footer-bottom a { color: #FFFFFF; }

/* ---------- homepage ---------- */
.pd-home section { scroll-margin-top: 24px; }
.pd-hero { display: flex; flex-wrap: wrap; gap: 56px; align-items: center; padding: 72px 0 64px; }
.pd-hero-copy { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.pd-hero h1 { margin: 0; font-size: clamp(60px, 10vw, 128px); font-weight: 500; line-height: .92; letter-spacing: -0.03em; }
.pd-hero-tag { margin: -4px 0 0; font-family: var(--pd-font-display); font-size: clamp(22px, 2.6vw, 30px); color: var(--pd-text-2); }
.pd-hero h1 i { color: var(--pd-cobalt); font-weight: 500; }
.pd-hero-intro { margin: 0; font-size: 20px; line-height: 1.6; color: var(--pd-text-2); max-width: 36em; }
.pd-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.pd-actions .btn { font-size: 17px; padding: 15px 24px; }
.pd-name-note { margin: 0; font-family: var(--pd-font-display); font-style: italic; font-size: 18px; color: var(--pd-muted); }
.pd-name-note b { font-style: normal; color: var(--pd-cobalt); }
.pd-chart { flex: 1 1 380px; min-width: 0; max-width: 560px; margin: 0; background: var(--pd-surface); border: 1px solid var(--pd-line); border-radius: var(--pd-radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.pd-chart-head { display: flex; justify-content: space-between; font-family: var(--pd-font-mono); font-size: 12px; color: var(--pd-muted); }
.pd-chart svg { width: 100%; height: auto; display: block; }
.pd-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--pd-muted); }
.pd-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

.pd-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 3px solid var(--pd-ink); border-bottom: 1px solid var(--pd-line); }
.pd-stat { padding: 22px 20px; display: flex; flex-direction: column; gap: 2px; }
.pd-stat + .pd-stat { border-left: 1px solid var(--pd-line); }
.pd-stat strong { font-family: var(--pd-font-display); font-size: 44px; font-weight: 500; line-height: 1.05; color: var(--pd-ink); font-variant-numeric: tabular-nums; }
.pd-stat span { font-size: 14px; color: var(--pd-muted); font-weight: 600; }
.pd-stats-note { font-size: 12px; color: var(--pd-muted); margin: 10px 0 0; max-width: 70ch; }

.pd-pillars { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--pd-line); margin-top: 56px; background: var(--pd-surface); border-top: 1px solid var(--pd-line); }
.pd-pillar { flex: 1 1 300px; padding: 36px 28px; display: flex; flex-direction: column; gap: 10px; }
.pd-pillar + .pd-pillar { border-left: 1px solid var(--pd-line); }
.pd-num { font-family: var(--pd-font-mono); font-size: 14px; color: var(--pd-cobalt); }
.pd-num.soon { color: var(--pd-gold-text); }
.pd-pillar h2 { margin: 0; font-size: 32px; }
.pd-pillar p { margin: 0; color: var(--pd-text-2); }
.pd-pillar a { font-weight: 600; margin-top: auto; }

.pd-section { padding: 72px 0 0; }
.pd-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; margin-bottom: 24px; }
.pd-section-head h2 { margin: 6px 0 0; font-size: clamp(32px, 4vw, 46px); font-weight: 500; }
.pd-section-head p { margin: 8px 0 0; color: var(--pd-muted); max-width: 52ch; }
.pd-search { display: flex; gap: 8px; max-width: 520px; margin: 0 0 20px; }
.pd-search input { flex: 1; min-width: 0; padding: 12px 14px; font-size: 16px; }
.pd-index { display: flex; flex-wrap: wrap; column-gap: 56px; border-top: 3px solid var(--pd-ink); }
.pd-row { flex: 1 1 460px; min-width: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; padding: 16px 0;
  border-bottom: 1px solid var(--pd-line); }
.pd-row-main { color: var(--pd-ink); text-decoration: none; font-size: 19px; font-weight: 500; }
.pd-row-main:hover { color: var(--pd-cobalt); text-decoration: none; }
.pd-row-main:hover .pd-arrow { transform: translateX(3px); }
.pd-row-meta { display: flex; align-items: baseline; gap: 14px; }
.pd-study { font-size: 14px; font-weight: 600; }
.pd-index .pd-count { font-family: var(--pd-font-mono); font-size: 14px; color: var(--pd-muted); white-space: nowrap; }
.pd-arrow { display: inline-block; transition: transform .15s; color: var(--pd-cobalt); margin-left: 8px; }
.pd-empty { padding: 32px 0; color: var(--pd-muted); }

.pd-steps { display: flex; flex-wrap: wrap; gap: 0; border-top: 3px solid var(--pd-ink); }
.pd-steps li { flex: 1 1 280px; list-style: none; padding: 24px 24px 24px 0; display: flex; flex-direction: column; gap: 8px; }
.pd-steps { padding: 0; margin: 0; }
.pd-steps h3 { margin: 0; font-size: 24px; }
.pd-steps p { margin: 0; color: var(--pd-text-2); }

.pd-tools { background: var(--pd-band); color: #fff; margin-top: 80px; box-shadow: 0 0 0 100vmax var(--pd-band); clip-path: inset(0 -100vmax); }
.pd-tools .pd-section-head h2 { color: #fff; }
.pd-tools .pd-section-head p { color: #B7C2D6; }
.pd-tools .eyebrow { color: var(--pd-gold); }
.pd-tools-inner { padding-top: 64px; padding-bottom: 64px; }
.pd-tool-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.pd-tool { flex: 1 1 300px; background: var(--pd-band-card); border-radius: var(--pd-radius); padding: 22px; color: #fff; text-decoration: none; display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--pd-gold); }
.pd-tool:hover { background: #2A3E5C; color: #fff; text-decoration: none; }
.pd-tool b { font-family: var(--pd-font-display); font-size: 23px; font-weight: 600; }
.pd-tool span { color: #B7C2D6; font-size: 15px; }
.pd-tool small { font-family: var(--pd-font-mono); font-size: 12px; color: #8FA0BC; margin-top: auto; }
.pd-tools .text-link { color: var(--pd-gold); }

.pd-mobile { display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: center; justify-content: space-between; padding: 40px; margin-top: 72px;
  background: var(--pd-surface-2); border-radius: var(--pd-radius); }
.pd-mobile h2 { margin: 6px 0 8px; font-size: 32px; }
.pd-mobile p { margin: 0; color: var(--pd-text-2); }
.pd-mobile img { width: 88px; height: 88px; border-radius: 20px; }

@media (max-width: 720px) {
  .pd-hero { padding: 40px 0 40px; gap: 32px; }
  .pd-hero-intro { font-size: 18px; }
  .pd-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pd-stat:nth-child(odd) { border-left: 0; }
  .pd-stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .pd-stat:nth-child(n+3) { border-top: 1px solid var(--pd-line); }
  .pd-stat strong { font-size: 34px; }
  .pd-pillar + .pd-pillar { border-left: 0; border-top: 1px solid var(--pd-line); }
  .pd-pillar { padding: 28px 4px; }
  .pd-section { padding-top: 56px; }
  .pd-row-main { font-size: 17px; }
  .pd-mobile { padding: 28px 20px; }
}

/* ---------- theme switch + logo per theme ---------- */
.pd-theme { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--pd-line);
  background: var(--pd-surface); color: var(--pd-text); cursor: pointer; padding: 0; }
.pd-theme:hover { border-color: var(--pd-cobalt); color: var(--pd-cobalt); }
.pd-theme svg { width: 18px; height: 18px; }
.pd-theme .sun, .brand .mark-dark { display: none; }

/* ---------- night mode: soft navy, off-white text, muted accents ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pd-ink: #E4E8EF; --pd-cobalt: #9DB0EA; --pd-cobalt-strong: #BCCAF2; --pd-on-accent: #111A27;
    --pd-gold: #E0B068; --pd-gold-text: #E0B068; --pd-alert: #EE9387; --pd-ok: #7CC6A0;
    --pd-bg: #111A27; --pd-surface: #172234; --pd-surface-2: #1D2A3F; --pd-line: #2A3851;
    --pd-text: #E4E8EF; --pd-text-2: #BFC8D6; --pd-muted: #93A0B4; --pd-chip: #3A3020;
    --pd-band: #0C131E; --pd-band-card: #162133; --pd-chart-grid: #22304A; --pd-chart-dot: #E4E8EF;
    --pd-shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -16px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --pd-ink: #E4E8EF; --pd-cobalt: #9DB0EA; --pd-cobalt-strong: #BCCAF2; --pd-on-accent: #111A27;
  --pd-gold: #E0B068; --pd-gold-text: #E0B068; --pd-alert: #EE9387; --pd-ok: #7CC6A0;
  --pd-bg: #111A27; --pd-surface: #172234; --pd-surface-2: #1D2A3F; --pd-line: #2A3851;
  --pd-text: #E4E8EF; --pd-text-2: #BFC8D6; --pd-muted: #93A0B4; --pd-chip: #3A3020;
  --pd-band: #0C131E; --pd-band-card: #162133; --pd-chart-grid: #22304A; --pd-chart-dot: #E4E8EF;
  --pd-shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -16px rgba(0,0,0,.8);
  color-scheme: dark;
}
/* Swap the moon/sun icon and the header mark when night mode is on. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pd-theme .moon, :root:not([data-theme="light"]) .brand .mark-light { display: none; }
  :root:not([data-theme="light"]) .pd-theme .sun, :root:not([data-theme="light"]) .brand .mark-dark { display: block; }
}
:root[data-theme="dark"] .pd-theme .moon, :root[data-theme="dark"] .brand .mark-light { display: none; }
:root[data-theme="dark"] .pd-theme .sun, :root[data-theme="dark"] .brand .mark-dark { display: block; }

/* Older components that used fixed light colours: follow the theme. */
.study-stage, .account-prompt, .mobile-band { background: var(--pd-surface-2); }
.study-card, .topic-node, .subject-choice, .phone-card { background: var(--pd-surface); border-color: var(--pd-line); }
.reveal, .phone-answer, .phone-line { background: var(--pd-surface-2); border-color: var(--pd-line); color: var(--pd-cobalt); }
.topic-children { border-left-color: var(--pd-line); }
.preview-caption, .stage-note, .sample-counter, .sample-footer > span { color: var(--pd-muted); }
.urgent { border-left-color: var(--pd-alert); background: var(--pd-surface-2); color: var(--pd-text); }
:root[data-theme="dark"] .rating-1, :root[data-theme="dark"] .rating-2, :root[data-theme="dark"] .rating-3, :root[data-theme="dark"] .rating-4 { background: var(--pd-surface-2); }
:root[data-theme="dark"] .rating-1 { color: #EE9387; } :root[data-theme="dark"] .rating-2 { color: #E0B068; }
:root[data-theme="dark"] .rating-3 { color: #7CC6A0; } :root[data-theme="dark"] .rating-4 { color: #9DB0EA; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rating-1, :root:not([data-theme="light"]) .rating-2, :root:not([data-theme="light"]) .rating-3, :root:not([data-theme="light"]) .rating-4 { background: var(--pd-surface-2); }
  :root:not([data-theme="light"]) .rating-1 { color: #EE9387; } :root:not([data-theme="light"]) .rating-2 { color: #E0B068; }
  :root:not([data-theme="light"]) .rating-3 { color: #7CC6A0; } :root:not([data-theme="light"]) .rating-4 { color: #9DB0EA; }
}

/* ---------- section pages (flashcards, tools) ---------- */
.pd-page { padding-bottom: 24px; }
.pd-page-head { padding: 56px 0 32px; max-width: 760px; display: flex; flex-direction: column; gap: 14px; }
.pd-page-head h1 { margin: 0; font-size: clamp(44px, 6vw, 72px); font-weight: 500; line-height: 1; letter-spacing: -0.025em; }
.pd-page-head > p { margin: 0; font-size: 18px; color: var(--pd-text-2); line-height: 1.6; }
.pd-page-head .pd-search { margin: 6px 0 0; }

/* Subjects: tiles with a symbol */
.pd-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.pd-subject { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--pd-surface); border: 1px solid var(--pd-line);
  border-radius: 10px; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.pd-subject:hover { transform: translateY(-2px); box-shadow: var(--pd-shadow); border-color: var(--pd-cobalt); }
.pd-subject-icon { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; color: var(--pd-cobalt); background: var(--pd-surface-2); }
.pd-subject h2 { margin: 0; font-size: 21px; line-height: 1.2; }
.pd-subject h2 a { color: var(--pd-ink); text-decoration: none; }
.pd-subject h2 a::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }  /* whole tile is clickable */
.pd-subject .pd-count { margin: 4px 0 0; }
.pd-subject-actions { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; position: relative; z-index: 1; }
.pd-subject-explore { font-weight: 600; font-size: 14px; color: var(--pd-cobalt); }
.pd-count { font-family: var(--pd-font-mono); font-size: 13px; color: var(--pd-muted); }

/* Tools: large interactive cards with filters */
.pd-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pd-chip { font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--pd-line);
  background: var(--pd-surface); color: var(--pd-text); min-height: 40px; }
.pd-chip span { font-family: var(--pd-font-mono); font-size: 12px; color: var(--pd-muted); margin-left: 4px; }
.pd-chip:hover { border-color: var(--pd-cobalt); }
.pd-chip[aria-pressed="true"] { background: var(--pd-ink); border-color: var(--pd-ink); color: var(--pd-bg); }
.pd-chip[aria-pressed="true"] span { color: inherit; opacity: .75; }
.pd-toolgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.pd-toolcard { display: flex; flex-direction: column; gap: 12px; padding: 26px; min-height: 290px; background: var(--pd-surface); border: 1px solid var(--pd-line);
  border-radius: 12px; color: var(--pd-text); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.pd-toolcard:hover { transform: translateY(-3px); box-shadow: var(--pd-shadow); border-color: var(--pd-cobalt); text-decoration: none; color: var(--pd-text); }
.pd-toolcard[hidden] { display: none; }
.pd-toolcard-icon { width: 60px; height: 60px; border-radius: 14px; display: grid; place-items: center; background: var(--pd-band); color: var(--pd-gold); }
.pd-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pd-tags span { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pd-cobalt); background: var(--pd-surface-2); padding: 3px 8px; border-radius: 3px; }
.pd-toolcard h2 { margin: 0; font-size: 26px; line-height: 1.15; }
.pd-toolcard p { margin: 0; color: var(--pd-text-2); font-size: 15.5px; }
.pd-source { font-family: var(--pd-font-mono); font-size: 12px; color: var(--pd-muted); }
.pd-open { margin-top: auto; font-weight: 700; color: var(--pd-cobalt); display: inline-flex; gap: 6px; }
.pd-toolcard:hover .pd-open span { transform: translateX(3px); }
.pd-open span { transition: transform .15s; }
@media (max-width: 720px) {
  .pd-page-head { padding: 36px 0 24px; }
  .pd-toolgrid { grid-template-columns: 1fr; }
  .pd-toolcard { min-height: 0; padding: 22px; }
  .pd-subjects { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .pd-subject { padding: 16px; gap: 10px; }
  .pd-subject-icon { width: 44px; height: 44px; }
  .pd-subject h2 { font-size: 18px; }
  .pd-subject-actions { flex-direction: column; align-items: flex-start; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { .pd-subject, .pd-toolcard, .pd-open span { transition: none; } .pd-subject:hover, .pd-toolcard:hover { transform: none; } }

/* Study page (2026-10-18): card right under the title; big subject/topic buttons beside it. */
.study-page { padding-top: 14px; }
.study-top { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; margin: 0 0 14px; }
.study-top h1 { margin: 0; font-size: 34px; }
.study-top #study-count { margin-left: auto; font-size: 13px; color: var(--pd-muted); }
.study-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.study-main { min-width: 0; }
.study-main #study-progress { margin-bottom: 12px; }
.study-nav { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; padding-right: 4px; }
.study-nav-select { display: none; }
.topic-btn { display: block; width: 100%; text-align: left; margin: 0 0 6px; padding: 10px 12px; border: 1px solid var(--pd-line);
  border-left: 4px solid var(--subject, var(--pd-cobalt)); border-radius: 8px; background: var(--pd-surface); color: var(--pd-text);
  font: 600 14px/1.3 var(--pd-font-text); cursor: pointer; }
.topic-btn:hover { background: var(--pd-surface-2); }
.topic-btn.active { background: var(--subject, var(--pd-cobalt)); border-color: var(--subject, var(--pd-cobalt)); color: #fff; }
.topic-btn:focus-visible { outline: 3px solid var(--pd-cobalt); outline-offset: 2px; }
.topic-sub { margin: 0 0 10px; }
.topic-child { margin-left: 14px; width: calc(100% - 14px); font-weight: 500; font-size: 13px; padding: 8px 10px; }
.study-main .account-prompt { margin: 18px 0 6px; padding: 12px 16px; font-size: 14px; }
@media (max-width: 900px) {
  .study-top h1 { font-size: 28px; }
  .study-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .study-nav, .study-nav-buttons { min-width: 0; max-width: 100%; }
  .study-nav { position: static; max-height: none; overflow: visible; padding: 0; }
  .study-nav-select { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 8px; }
  .study-nav-select select { flex: 1; min-width: 0; }
  .study-nav-buttons { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
  .study-nav-buttons > .topic-btn { display: none; }
  .topic-sub { display: contents; }
  .topic-btn.topic-child { display: block; flex: 0 0 auto; width: auto; margin: 0; white-space: nowrap; }
}
.topic-head { margin: 4px 0 6px; font: 600 11px/1.2 var(--pd-font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--pd-muted); }
.topic-sub + .topic-head { margin-top: 14px; }
@media (max-width: 900px) { .topic-head { display: none; } }
@media (max-width: 900px) {
  .study-nav-select { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .study-nav-select select, #study-subject { width: 100%; min-width: 0; max-width: 100%; }
}

/* Smooth card changes (2026-10-18): the next side loads in a hidden frame, then cross-fades in. */
.frame-stack { position: relative; }
.frame-stack iframe.frame-spare { position: absolute; top: 0; left: 0; width: 100%; visibility: hidden; pointer-events: none; }
.frame-stack iframe.frame-in { animation: pd-card-in .16s ease-out; }
@keyframes pd-card-in { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .frame-stack iframe.frame-in { animation: none; } }
.frame-stack iframe { display: block; width: 100%; border: 0; background: white; min-height: 380px; }
.topic-btn.topic-back { margin-top: 14px; border-left-color: var(--pd-line); font-weight: 500; color: var(--pd-muted); }
@media (max-width: 900px) { .study-nav-buttons > .topic-btn.topic-back { display: none; } }

/* Card blends into the page (2026-10-18): no outer box, small label above the card. */
.study-main .web-card-wrap { border: 0; border-radius: 0; background: transparent; overflow: visible; box-shadow: none; }
.study-main .web-card-heading { padding: 0 2px 10px; border: 0; background: none; font-size: 12px; letter-spacing: .02em; }
.study-main .web-card-heading #study-side { color: var(--pd-muted); font-weight: 600; }
.frame-stack iframe { background: transparent; }
/* Card counts and back button on the side buttons (2026-10-18). */
.topic-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topic-btn .topic-n { flex: 0 0 auto; min-width: 26px; padding: 1px 7px; border-radius: 999px; background: var(--pd-surface-2); color: var(--pd-muted);
  font: 600 11px/1.6 var(--pd-font-mono); text-align: center; }
.topic-btn.active .topic-n { background: rgba(255,255,255,.22); color: #fff; }
.topic-btn.topic-back { border-left: 1px solid var(--pd-line); color: var(--pd-cobalt); font-weight: 600; margin-bottom: 14px; }
@media (max-width: 900px) { .study-nav-buttons > .topic-btn.topic-back { display: flex; flex: 0 0 auto; white-space: nowrap; margin: 0; } }

/* ---------- study: optional practice question under the card ---------- */
.practice { max-width: 860px; margin: 8px auto 4px; padding: 18px 20px; background: var(--pd-surface); border: 1px solid var(--pd-line);
  border-radius: 12px; display: flex; flex-direction: column; gap: 12px; }
.practice-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.practice-head .eyebrow { margin: 0; }
.practice-tag { font: 500 12px var(--pd-font-mono); color: var(--pd-muted); }
.practice-stem { margin: 0; font-size: 17px; line-height: 1.55; color: var(--pd-text); }
.practice-options { display: flex; flex-direction: column; gap: 8px; }
.practice-option { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; font: 16px/1.45 var(--pd-font-text);
  color: var(--pd-text); background: var(--pd-bg); border: 1.5px solid var(--pd-line); border-radius: 10px; padding: 11px 14px; cursor: pointer; }
.practice-option:hover:not(:disabled) { border-color: var(--pd-cobalt); }
.practice-option:disabled { cursor: default; opacity: 1; }
.practice-letter { flex: 0 0 auto; font: 600 14px/1.5 var(--pd-font-mono); color: var(--pd-muted); min-width: 1.1em; }
.practice-text { min-width: 0; }
.practice-why { display: block; margin-top: 4px; font-size: 14px; color: var(--pd-muted); }
.practice-option.is-right { border-color: var(--pd-ok); background: color-mix(in srgb, var(--pd-ok) 12%, var(--pd-surface)); }
.practice-option.is-right .practice-letter { color: var(--pd-ok); }
.practice-option.is-wrong { border-color: var(--pd-alert); background: color-mix(in srgb, var(--pd-alert) 10%, var(--pd-surface)); }
.practice-option.is-wrong .practice-letter { color: var(--pd-alert); }
.practice-result { display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.practice-result p { margin: 0; color: var(--pd-text-2); }
.practice-result .good { color: var(--pd-ok); }
.practice-result .bad { color: var(--pd-alert); }
.practice-result .text-button { align-self: flex-start; }
.practice-source { margin: 0; }
@media (max-width: 600px) { .practice { padding: 14px; } .practice-stem { font-size: 16px; } .practice-option { font-size: 15px; padding: 10px 12px; } }

/* board exam share under each subject (2026-10-18) */
.pd-subject .pd-board { margin: 2px 0 0; font-size: 13px; font-weight: 600; color: var(--pd-cobalt); }
.pd-board-note { margin: 14px 2px 0; font-size: 12.5px; color: var(--pd-muted, #5B6670); }

/* Topic review page (2026-10-18): compact sections + tile grid instead of nested boxes. */
.tp .tp-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tp .tp-top .eyebrow { margin: 0; }
.tp-back { font-weight: 600; font-size: 14px; color: var(--pd-cobalt); white-space: nowrap; }
.tp h1 { margin: 8px 0 4px; }
.tp-sub { margin: 0 0 14px; color: var(--pd-muted); font-weight: 600; font-size: 14.5px; }
.tp-board { color: var(--pd-cobalt); }
.tp-cta { margin: 0 0 16px; }
.tp-account { margin: 0 0 22px; padding: 10px 14px; border-radius: 10px; background: var(--pd-surface-2); font-size: 14px; }
.tp-account a { font-weight: 650; }
.tp-section { margin: 26px 0 0; }
.tp-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 0 0 7px; margin: 0 0 12px; border-bottom: 2px solid var(--subject, var(--pd-cobalt)); }
.tp-head h2, .tp-head h3 { margin: 0; font-size: 20px; line-height: 1.25; }
.tp-head h3 { font-size: 16.5px; }
.tp-head h2 a, .tp-head h3 a { color: var(--pd-ink); text-decoration: none; }
.tp-head h2 a:hover, .tp-head h3 a:hover { color: var(--subject, var(--pd-cobalt)); }
.tp-l2 { margin-top: 18px; } .tp-l2 .tp-head { border-bottom-width: 1px; }
.tp-all { margin-left: auto; font-weight: 600; font-size: 14px; color: var(--pd-cobalt); white-space: nowrap; }
.tp-meta { font-size: 12.5px; color: var(--pd-muted); font-weight: 500; }
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tp-grid-top { margin-top: 6px; }
.tp-tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; min-height: 64px; border: 1px solid var(--pd-line); border-left: 4px solid var(--subject, var(--pd-cobalt));
  border-radius: 10px; background: var(--pd-surface); color: var(--pd-ink); text-decoration: none; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.tp-tile:hover { transform: translateY(-1px); box-shadow: var(--pd-shadow); border-color: var(--subject, var(--pd-cobalt)); }
.tp-tile:focus-visible { outline: 3px solid var(--pd-cobalt); outline-offset: 2px; }
.tp-name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.tp-tile progress { width: 100%; height: 5px; margin-top: 4px; accent-color: var(--subject, var(--pd-cobalt)); }
.tp-intro { margin-top: 34px; font-size: 13.5px; max-width: 75ch; }
@media (max-width: 600px) { .tp-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .tp-tile { padding: 10px 11px; } .tp-name { font-size: 14px; } .tp .tp-top .eyebrow { display: none; } }
/* Flashcards page: rotation decks shown apart from board subjects */
.pd-rot-head { margin: 34px 0 12px; font-size: 22px; } .pd-rot-head span { display: block; margin-top: 4px; font-family: "Public Sans", system-ui, sans-serif; font-weight: 500; font-size: 13.5px; line-height: 1.4; color: var(--pd-muted); }

/* Study page motion (2026-10-18): flip to the answer, slide to the next card, lively practice question. */
.frame-stack { perspective: 1600px; }
.frame-stack[data-motion="flip"] iframe.frame-in { animation: pd-flip .34s cubic-bezier(.2,.75,.25,1); transform-origin: 50% 50%; backface-visibility: hidden; }
.frame-stack[data-motion="slide"] iframe.frame-in { animation: pd-slide .3s cubic-bezier(.2,.75,.25,1); }
@keyframes pd-flip { from { transform: rotateY(-78deg) scale(.97); opacity: .25; } to { transform: none; opacity: 1; } }
@keyframes pd-slide { from { transform: translateX(34px); opacity: 0; } to { transform: none; opacity: 1; } }
#study-side { display: inline-block; transition: color .2s; }
.study-controls .btn, .rating-button, .practice-option { transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease, background-color .2s ease; }
.study-controls .btn:active:not(:disabled), .rating-button:active:not(:disabled) { transform: scale(.96); }
.rating-grid:not([hidden]) .rating-button { animation: pd-rise .3s cubic-bezier(.2,.75,.25,1) both; }
.rating-grid .rating-button:nth-child(2) { animation-delay: .04s; } .rating-grid .rating-button:nth-child(3) { animation-delay: .08s; } .rating-grid .rating-button:nth-child(4) { animation-delay: .12s; }
.rating-button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--pd-shadow); }
@keyframes pd-rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.study-session { margin-left: 10px; padding: 2px 10px; border-radius: 999px; background: var(--pd-surface-2); color: var(--pd-muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.study-session.bump { animation: pd-bump .35s ease; }
@keyframes pd-bump { 40% { transform: scale(1.08); color: var(--pd-cobalt); } }
.practice.enter { animation: pd-rise .35s cubic-bezier(.2,.75,.25,1); }
.practice-options .practice-option { animation: pd-rise .3s cubic-bezier(.2,.75,.25,1) both; animation-delay: calc(var(--i, 0) * 45ms + 60ms); position: relative; }
.practice-option:hover:not(:disabled) { transform: translateX(3px); box-shadow: var(--pd-shadow); }
.practice-option.is-other { opacity: .62; }
.practice-option.is-right { animation: pd-pop .38s ease both; }
.practice-option.is-wrong { animation: pd-shake .4s ease both; }
.practice-mark { position: absolute; right: 12px; top: 10px; font-weight: 800; font-size: 17px; animation: pd-mark .35s cubic-bezier(.3,1.6,.5,1) both; }
.is-right .practice-mark { color: var(--pd-ok); } .is-wrong .practice-mark { color: var(--pd-alert); }
.practice-option.is-right, .practice-option.is-wrong { padding-right: 38px; }
.practice-why { animation: pd-unfold .3s ease both; }
.practice-result.enter { animation: pd-rise .3s ease both; }
@keyframes pd-pop { 0% { transform: none; } 45% { transform: scale(1.025); } 100% { transform: none; } }
@keyframes pd-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes pd-mark { from { transform: scale(0); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pd-unfold { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .frame-stack iframe.frame-in, .rating-grid .rating-button, .study-session.bump, .practice.enter, .practice-options .practice-option, .practice-option.is-right,
  .practice-option.is-wrong, .practice-mark, .practice-why, .practice-result.enter { animation: none !important; }
  .rating-button:hover, .practice-option:hover, .study-controls .btn:active, .rating-button:active { transform: none !important; }
}

/* ---------- site-wide motion (2026-10-18): page transitions, active tab, tiles ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  html { scroll-behavior: smooth; }
  .topbar { view-transition-name: pd-topbar; }
  #main-content { view-transition-name: pd-main; }
  ::view-transition-old(pd-topbar), ::view-transition-new(pd-topbar) { animation: none; }
  ::view-transition-old(pd-main) { animation: pd-vt-out .16s ease-in both; }
  ::view-transition-new(pd-main) { animation: pd-vt-in .32s cubic-bezier(.2,.75,.25,1) both; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }
  html.pd-theme-swap::view-transition-old(root), html.pd-theme-swap::view-transition-new(root) { animation-duration: .4s; }
  html.pd-theme-swap::view-transition-old(pd-main), html.pd-theme-swap::view-transition-new(pd-main),
  html.pd-theme-swap::view-transition-old(pd-topbar), html.pd-theme-swap::view-transition-new(pd-topbar) { animation: pd-fade .4s ease both; }
  @keyframes pd-vt-out { to { opacity: 0; transform: translateY(-6px); } }
  @keyframes pd-vt-in { from { opacity: 0; transform: translateY(12px); } }
  @keyframes pd-fade { from { opacity: 0; } }
  html.pd-motion .pd-reveal { opacity: 0; transform: translateY(14px);
    transition: opacity .45s ease var(--pd-d, 0ms), transform .5s cubic-bezier(.2,.75,.25,1) var(--pd-d, 0ms); }
  html.pd-motion .pd-reveal.is-in { opacity: 1; transform: none; }
  .btn, .pd-study, .pd-subject-explore, .tp-all, .tp-back { transition: transform .12s ease, box-shadow .15s ease, background-color .2s ease, color .2s ease; }
  .btn:active, .pd-study:active { transform: scale(.97); }
  .pd-toolcard { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
  .pd-toolcard:hover { transform: translateY(-2px); box-shadow: var(--pd-shadow); }
  .tp-tile:active, .pd-subject:active, .pd-toolcard:active { transform: scale(.985); }
}
.topbar nav a:not(.btn) { position: relative; }
.topbar nav a:not(.btn)::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; border-radius: 2px;
  background: var(--pd-cobalt); transform: scaleX(0); transform-origin: left center; transition: transform .25s ease; }
.topbar nav a:not(.btn):hover::after { transform: scaleX(.55); }
.topbar nav a[aria-current="page"] { color: var(--pd-cobalt); }
.topbar nav a[aria-current="page"]::after { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) { .topbar nav a:not(.btn)::after { transition: none; } }

/* Phone layout (2026-10-18): two-row header, tool filters in one swipe row, study buttons in a bar at the bottom of the screen. */
@media (max-width: 600px) {
  .topbar-inner { flex-wrap: wrap; justify-content: flex-start; align-items: center; column-gap: 12px; row-gap: 2px; padding-top: 10px; padding-bottom: 4px; }
  .topbar-inner::after { content: ""; order: 1; flex-basis: 100%; height: 0; }
  .topbar nav { display: contents; font-size: 14px; }
  .topbar .brand { margin-right: auto; gap: 8px; }
  .topbar .brand img.brand-mark { width: 30px; height: 30px; }
  .brand-name { font-size: 23px; }
  .topbar nav .btn-small { padding: 7px 11px; font-size: 13px; }
  .topbar .pd-theme { width: 34px; height: 34px; }
  .topbar nav > a[href="/flashcards"], .topbar nav > a[href="/tools"], .topbar nav > a[href="/account/analytics"], .topbar nav > a[href="/logout"] { order: 2; padding: 6px 0 9px; margin-right: 10px; }
  .topbar nav > a[href="/logout"] { margin: 0 0 0 auto; color: var(--pd-muted); }
  .topbar nav a:not(.btn)::after { bottom: 3px; }

  .pd-filter { flex-wrap: nowrap; overflow-x: auto; margin: 6px -24px 0; padding: 2px 40px 10px 24px; scrollbar-width: none; scroll-padding-inline: 24px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 32px), transparent);
            mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 32px), transparent); }
  .pd-filter::-webkit-scrollbar { display: none; }
  .pd-chip { flex: none; }

  .study-top h1 { font-size: 24px; }
  .study-controls, #study-ratings:not([hidden]) { position: sticky; bottom: 0; z-index: 20; margin: 6px -24px 0; max-width: none;
    padding: 10px 24px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--pd-line);
    background: var(--pd-bg); background: color-mix(in srgb, var(--pd-bg) 90%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .study-controls { gap: 8px; }
  .study-controls #study-reveal { flex: 1; }
  .study-controls .btn { padding: 13px 12px; font-size: 14px; }
  .study-main:has(#study-ratings:not([hidden])) .study-controls { position: static; margin: 6px 0 0; padding: 0; border-top: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  #study-ratings:not([hidden]) { gap: 6px; }
  #study-ratings .rating-button { min-height: 54px; padding: 9px 4px; }
}
@media (max-width: 389px) { .topbar-inner { column-gap: 8px; } .brand-name { font-size: 21px; } .topbar nav .btn-small { padding: 7px 9px; } }
@media (max-width: 349px) { .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
@media (hover: none) and (pointer: coarse) { #study-shortcuts { display: none; } }

/* One shape for every tile and card (2026-10-18): cards and tiles 12px corners, buttons and inputs 8px, chips stay round. */
:root { --pd-radius: 12px; --pd-radius-btn: 8px; }
.pd-subject, .tp-tile, .pd-toolcard, .practice, .topic-node { border-radius: 12px; }
.pd-subject h2 a::after { border-radius: 12px; }
.topic-btn { border-radius: 10px; }

/* Soft placeholder card while the first flashcard loads. */
.frame-stack:not(:has(iframe[srcdoc]))::before { content: ""; position: absolute; z-index: 1; left: 0; right: 0; top: 0; height: 230px; pointer-events: none;
  border: 1px solid var(--pd-line); border-radius: 12px;
  background:
    linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--pd-surface) 75%, transparent) 50%, transparent 80%) -100% 0 / 60% 100% no-repeat,
    linear-gradient(var(--pd-surface-2) 0 0) 24px 34px / 72% 20px no-repeat,
    linear-gradient(var(--pd-surface-2) 0 0) 24px 70px / 58% 20px no-repeat,
    linear-gradient(var(--pd-surface-2) 0 0) 24px 106px / 38% 20px no-repeat,
    var(--pd-surface);
  animation: pd-skel 1.4s ease-in-out infinite; }
@keyframes pd-skel { to { background-position: 250% 0, 24px 34px, 24px 70px, 24px 106px, 0 0; } }
.study-main:has(#study-error:not([hidden])) .frame-stack::before { display: none; }
@media (prefers-reduced-motion: reduce) { .frame-stack::before { animation: none; } }

/* ---------- 2026-10-18 easier, more modern site ---------- */
/* Header search */
.pd-search-link { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 11px; border: 1px solid var(--pd-line); border-radius: 99px;
  color: var(--pd-muted) !important; font-weight: 500; font-size: 14px; background: var(--pd-surface); transition: border-color .15s, color .15s; }
.pd-search-link svg { width: 17px; height: 17px; flex: none; }
.pd-search-link:hover { border-color: var(--pd-cobalt); color: var(--pd-cobalt) !important; text-decoration: none; }
.pd-search-link::after { content: none !important; }
@media (max-width: 900px) { .pd-search-word { display: none; } .pd-search-link { padding: 0; width: 34px; height: 34px; justify-content: center; } }
@media (max-width: 600px) {
  .topbar nav > .pd-search-link { order: 2; margin: 0 0 0 auto; width: 32px; height: 32px; }
  .topbar nav > a[href="/logout"] { margin: 0 0 0 12px; }
}
/* Search page */
.pd-site-search { max-width: 640px; }
.pd-site-search input { font-size: 17px; padding: 14px 16px; }
.pd-search-tip { margin: 10px 0 0; font-size: 13px; color: var(--pd-muted); }
.pd-search-tip kbd, .pd-searchpage kbd { font: 600 12px var(--pd-font-mono); padding: 1px 6px; border: 1px solid var(--pd-line); border-bottom-width: 2px; border-radius: 5px; background: var(--pd-surface); }
@media (hover: none) { .pd-search-tip { display: none; } }
.pd-search-count { margin: 26px 0 10px; font-size: 13px; font-weight: 600; color: var(--pd-muted); }
.pd-results { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-width: 860px; }
.pd-results > li { min-width: 0; }
.pd-result { display: flex; align-items: center; gap: 14px; padding: 13px 16px; background: var(--pd-surface); border: 1px solid var(--pd-line);
  border-left: 4px solid var(--subject, var(--pd-cobalt)); border-radius: 12px; color: var(--pd-text); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .12s; }
.pd-result:hover { text-decoration: none; color: var(--pd-text); border-color: var(--subject, var(--pd-cobalt)); box-shadow: var(--pd-shadow); }
.pd-result:active { transform: scale(.99); }
.pd-result-kind { flex: none; width: 76px; font: 600 11px/1.2 var(--pd-font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--subject, var(--pd-muted)); }
.pd-result-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pd-result-label { font-weight: 650; font-size: 16px; }
.pd-result-label mark { background: color-mix(in srgb, var(--pd-gold, #E9A23B) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.pd-result-sub { font-size: 13px; color: var(--pd-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-result-n { flex: none; font: 600 12px var(--pd-font-mono); color: var(--pd-muted); }
@media (max-width: 600px) { .pd-result { flex-wrap: wrap; gap: 4px 10px; padding: 12px 14px; } .pd-result-kind { width: auto; } .pd-result-main { order: 3; flex-basis: 100%; } .pd-result-n { margin-left: auto; } }

/* Continue studying */
.pd-continue { --subject: var(--pd-cobalt); display: flex; align-items: center; gap: 18px; margin: 22px 0 6px; padding: 18px 22px; border-radius: 16px;
  background: linear-gradient(100deg, color-mix(in srgb, var(--subject) 12%, var(--pd-surface)), var(--pd-surface) 70%);
  border: 1px solid color-mix(in srgb, var(--subject) 28%, var(--pd-line)); }
.pd-continue-icon { flex: none; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: var(--subject);
  background: color-mix(in srgb, var(--subject) 14%, var(--pd-surface)); }
.pd-continue-icon svg { width: 26px; height: 26px; }
.pd-continue-text { flex: 1; min-width: 0; }
.pd-continue-eyebrow { margin: 0; font: 600 11px/1.3 var(--pd-font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--subject); }
.pd-continue h2 { margin: 2px 0 2px; font-size: 22px; line-height: 1.2; }
.pd-continue p { margin: 0; font-size: 14px; color: var(--pd-text-2); }
.pd-continue-actions { flex: none; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) { .pd-continue { flex-wrap: wrap; padding: 16px; gap: 12px 14px; } .pd-continue-icon { width: 44px; height: 44px; }
  .pd-continue-actions { flex-basis: 100%; } .pd-continue-actions .btn { flex: 1; text-align: center; } }
.pd-page .pd-continue { margin: 4px 0 26px; }

/* Home: numbers, two pillars, phone app line */
.pd-stats { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
@media (max-width: 720px) { .pd-stats { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); } .pd-stat { padding: 16px 12px; } .pd-stat strong { font-size: 28px; } .pd-stat span { font-size: 12.5px; } }
.pd-app-line { display: flex; align-items: center; gap: 10px; margin: 48px 0 0; font-size: 14px; color: var(--pd-muted); }
.pd-app-line img { border-radius: 7px; }

/* Flashcards: soft subject colours and a board-share bar */
.pd-subject { border-top: 3px solid color-mix(in srgb, var(--subject, var(--pd-cobalt)) 70%, transparent); }
.pd-subject-icon { color: var(--subject, var(--pd-cobalt)); background: color-mix(in srgb, var(--subject, var(--pd-cobalt)) 12%, var(--pd-surface)); }
.pd-subject:hover { border-color: color-mix(in srgb, var(--subject, var(--pd-cobalt)) 60%, var(--pd-line)); border-top-color: var(--subject, var(--pd-cobalt)); }
.pd-subject .pd-board { color: var(--pd-text-2); font-weight: 500; }
.pd-board-bar { display: block; height: 5px; margin-top: 7px; border-radius: 99px; background: var(--pd-surface-2); overflow: hidden; }
.pd-board-bar i { display: block; height: 100%; border-radius: inherit; background: var(--subject, var(--pd-cobalt)); opacity: .75; }
.pd-subject .pd-study { display: inline-block; padding: 6px 14px; border-radius: 99px; background: color-mix(in srgb, var(--subject, var(--pd-cobalt)) 11%, var(--pd-surface)); color: var(--subject, var(--pd-cobalt)); }
.pd-subject .pd-study:hover { background: var(--subject, var(--pd-cobalt)); color: #fff; text-decoration: none; }

/* Study page: extras tucked into "More options" */
.study-more { margin: 14px 0 4px; font-size: 13px; }
.study-more summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--pd-muted); font-weight: 600; padding: 6px 12px;
  border: 1px solid var(--pd-line); border-radius: 99px; background: var(--pd-surface); }
.study-more summary::-webkit-details-marker { display: none; }
.study-more summary::before { content: "⋯"; font-size: 16px; line-height: 1; }
.study-more summary:hover { color: var(--pd-cobalt); border-color: var(--pd-cobalt); }
.study-more[open] summary { color: var(--pd-ink); }
.study-more .study-support { margin-top: 10px; justify-content: flex-start; gap: 18px; flex-wrap: wrap; }
.study-main .account-prompt { margin: 12px 0 6px; padding: 10px 14px; font-size: 13.5px; line-height: 1.5; }

/* ---------- Moving between pages, 2026-10-18 (preview: html.pd-m2, set by pedemy-nav.js) ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Direction-aware slides. Old page leaves quickly, new page follows a beat later, so the two never sit on top of each other.
     Each selector is its own rule so a browser without view-transition types ignores only that rule. */
  html:active-view-transition-type(pd-forward)::view-transition-old(pd-main) { animation: pd-out-l .14s ease-in both; }
  html:active-view-transition-type(pd-forward)::view-transition-new(pd-main) { animation: pd-in-r .34s .13s cubic-bezier(.2,.75,.25,1) both; }
  html:active-view-transition-type(pd-back)::view-transition-old(pd-main) { animation: pd-out-r .14s ease-in both; }
  html:active-view-transition-type(pd-back)::view-transition-new(pd-main) { animation: pd-in-l .34s .13s cubic-bezier(.2,.75,.25,1) both; }
  html:active-view-transition-type(pd-right)::view-transition-old(pd-main) { animation: pd-out-l .13s ease-in both; }
  html:active-view-transition-type(pd-right)::view-transition-new(pd-main) { animation: pd-in-r .3s .12s cubic-bezier(.2,.75,.25,1) both; }
  html:active-view-transition-type(pd-left)::view-transition-old(pd-main) { animation: pd-out-r .13s ease-in both; }
  html:active-view-transition-type(pd-left)::view-transition-new(pd-main) { animation: pd-in-l .3s .12s cubic-bezier(.2,.75,.25,1) both; }
  @keyframes pd-out-l { to { opacity: 0; transform: translateX(-28px); } }
  @keyframes pd-out-r { to { opacity: 0; transform: translateX(28px); } }
  @keyframes pd-in-r { from { opacity: 0; transform: translateX(44px); } }
  @keyframes pd-in-l { from { opacity: 0; transform: translateX(-44px); } }
  /* The tapped title grows into the next page's heading (and back again). */
  ::view-transition-group(pd-title) { animation-duration: .42s; animation-timing-function: cubic-bezier(.2,.75,.25,1); z-index: 2; }
  ::view-transition-old(pd-title), ::view-transition-new(pd-title) { animation-duration: .32s; }

  /* Day/night switch: the new colours spread out in a circle from the moon/sun button. */
  html.pd-m2.pd-theme-swap .topbar, html.pd-m2.pd-theme-swap #main-content { view-transition-name: none; }
  html.pd-m2.pd-theme-swap::view-transition-old(root) { animation: none; }
  html.pd-m2.pd-theme-swap::view-transition-new(root) { animation: pd-circle .6s cubic-bezier(.4,0,.2,1) both; }
  @keyframes pd-circle { from { clip-path: circle(0 at var(--pd-tx, 90%) var(--pd-ty, 0)); } to { clip-path: circle(var(--pd-tr, 150%) at var(--pd-tx, 90%) var(--pd-ty, 0)); } }

  /* Thin loading line while the next page loads. */
  html.pd-m2.pd-loading::before { content: ""; position: fixed; z-index: 1000; top: 0; left: 0; width: 100%; height: 3px; pointer-events: none;
    background: linear-gradient(90deg, var(--pd-cobalt), #E9A23B); transform-origin: left center; animation: pd-load 8s cubic-bezier(.08,.7,.2,1) forwards;
    box-shadow: 0 0 8px color-mix(in srgb, var(--pd-cobalt) 50%, transparent); }
  @keyframes pd-load { from { transform: scaleX(0); } 12% { transform: scaleX(.35); } to { transform: scaleX(.92); } }

  /* Small touches */
  html.pd-m2 .pd-subject-icon, html.pd-m2 .pd-continue-icon { transition: transform .25s cubic-bezier(.2,.75,.25,1); }
  html.pd-m2 .pd-subject:hover .pd-subject-icon { transform: translateY(-3px) rotate(-6deg) scale(1.04); }
  html.pd-m2 .pd-reveal .pd-board-bar i { transform: scaleX(0); transform-origin: left center; }
  html.pd-m2 .pd-reveal.is-in .pd-board-bar i { transform: scaleX(1); transition: transform .42s cubic-bezier(.2,.75,.25,1) var(--pd-d, 0ms); }
  html.pd-m2 .pd-continue { animation: pd-rise .45s .08s cubic-bezier(.2,.75,.25,1) both; }
  html.pd-m2 .pd-continue:hover .pd-continue-icon { transform: rotate(-6deg) scale(1.06); }
  html.pd-m2 .pd-results li.pd-in { animation: pd-rise .28s cubic-bezier(.2,.75,.25,1) both; animation-delay: calc(var(--i, 0) * 28ms); }
  html.pd-m2 .pd-stat strong.pd-counting { font-variant-numeric: tabular-nums; }
}
