/* Nunito (brand canon, parity with the mobile app): self-hosted variable font, all weights
   200-1000 in two small woff2 files. font-display: swap keeps first paint on the system
   fallback; no third-party font host. */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/nunito-vf-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/nunito-vf-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light; /* deliberately light-only, matching the mobile app */
  --font-brand: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ink: #11143f;
  --ink-strong: #090b2c;
  --muted: #565d80;
  --soft: #f8f7ff;
  --paper: #ffffff;
  --line: #dcd8f2;
  --line-strong: #c8c1ed;
  --purple: #6e3df4;      /* brand canon #6E3DF4 (parity with mobile tokens) */
  --purple-press: #5a2bd9; /* pressed/hover step, same hue deepened */
  --purple-deep: #4a20b8;
  --green: #54c88e;
  --blue: #5da2f2;
  --gold: #ffc857;
  --coral: #ff8d6a;
  --rose: #fff1f6;
  --lavender: #f0ecff;
  --mint: #e8f8ef;
  --sky: #eaf4ff;
  --cream: #fff6dc;
  --shadow: 0 10px 26px -10px rgba(37, 26, 95, 0.18);
  /* Module tone canon — single source with study-api.js MODULE_ROUTES and the static
     module grids. Same-hue deepenings of the old tones; every value clears WCAG 3:1 as an
     icon stroke on its tint and >=4.1:1 as text on white (deepen, never grey). */
  /* --- Fluid foundations (2026-07-10): one ramp per concern; components must draw
     from these. Type scales with viewport (clamp), spacing is a 4pt scale, elevation
     and motion are 3-step ramps. --- */
  --text-xs: 12px;
  --text-sm: 13.5px;
  --text-base: clamp(16px, 0.35vw + 14.5px, 17px);
  --text-lg: clamp(16.5px, 0.5vw + 15px, 18px);
  --text-xl: clamp(20px, 0.8vw + 17px, 24px);
  --text-2xl: clamp(25px, 1.4vw + 20px, 32px);
  --text-hero: clamp(30px, 2.4vw + 22px, 48px);
  --w-body: 550;
  --w-label: 700;
  --w-title: 800;
  --w-display: 900;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;
  --space-32: 128px;
  /* Layout system (2026-07-11 desktop overhaul): one content well + one reading measure.
     Components must draw container widths from these, never re-type a px well. */
  --content-max: 1200px;   /* standard centered content well */
  --content-wide: 1440px;  /* media-heavy / app shells (replaces an oversized ad-hoc well) */
  --reading-max: 680px;    /* prose + chat answer measure — never exceed ~70ch */
  --gutter: 40px;
  --rail-w: 248px;         /* desktop study-nav left rail (>=1200px) */
  --section-y: clamp(48px, 6vw, 96px);   /* desktop section rhythm */
  --stack-section: clamp(28px, 3vw, 52px); /* in-app (study) section rhythm */
  --tracking-tight: -0.03em;             /* negative tracking for 32px+ headings */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  /* Grounded elevation ramp (Polaris-style, negative spread — tight, not soft halos). */
  --shadow-1: 0 1px 2px rgba(37, 26, 95, 0.08), 0 1px 1px rgba(37, 26, 95, 0.05);
  --shadow-2: 0 4px 10px -3px rgba(37, 26, 95, 0.14), 0 2px 4px -2px rgba(37, 26, 95, 0.08);
  --shadow-3: 0 14px 28px -8px rgba(37, 26, 95, 0.18), 0 5px 10px -6px rgba(37, 26, 95, 0.12);
  --ease-out: cubic-bezier(0.22, 0.7, 0.3, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --tone-purple: #6e3df4;
  --tone-violet: #7c48ff;
  --tone-red: #e63b43;
  --tone-amber: #b26e00;
  --tone-blue: #2372cf;
  --tone-green: #188f59;
  --tone-pink: #d61d6f;
  --tone-spruce: #0f8560;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #fbfbff;
  color: var(--ink);
  font-family: var(--font-brand);
  line-height: 1.55;
  font-size: var(--text-base);
}

.skip-link {
  position: fixed;
  inset-block-start: var(--space-3);
  inset-inline-start: var(--space-3);
  z-index: 100;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink-strong);
  border-radius: var(--radius-sm);
  padding: 0 var(--space-4);
  background: var(--paper);
  color: var(--ink-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(calc(-100% - var(--space-6)));
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

#main-content {
  scroll-margin-block-start: 96px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(241, 237, 255, 0.94), rgba(255, 255, 255, 0.94) 42%, rgba(245, 250, 255, 0.92)),
    repeating-linear-gradient(90deg, rgba(110, 61, 244, 0.05) 0 1px, transparent 1px 88px);
}

a {
  color: var(--purple-deep);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* Global reduced-motion catch-all: neutralise animation/transition for users who
   ask for it, so any new component is covered by default (not per-component). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

.site {
  width: min(var(--content-max), calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0;
}

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(251, 251, 255, 0.9);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  min-width: max-content;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 26%;
  /* Optical compact master: the same Spark Path topology without sub-pixel gloss details. */
  background: url("/assets/duggu-logo-compact.svg?v=5") center / 100% 100% no-repeat;
  display: grid;
  place-items: center;
  font-size: 0;
}

.brand {
  color: var(--ink-strong);
  font-size: var(--text-xl);
  font-weight: 900;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.nav-links a,
.nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: #41466d;
  border-radius: 999px;
  padding: 10px 13px;
  font-size: var(--text-sm);
  font-weight: 700;
}

.nav-links a:hover,
.nav a:hover {
  background: var(--lavender);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 12px 18px;
  font-size: var(--text-base);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
}

.btn.primary {
  background: var(--purple);
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(110, 61, 244, 0.22);
}

.btn.secondary {
  background: #ffffff;
  color: var(--purple-deep);
  border-color: var(--line);
}

.btn.subtle {
  background: var(--lavender);
  color: var(--purple-deep);
}

.hero {
  width: min(var(--content-max), calc(100% - 40px));
  margin: 18px auto 0;
  padding: 42px 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 36px;
  align-items: center;
}

.eyebrow {
  color: var(--purple-deep);
  font-weight: var(--w-title);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: var(--text-xs);
  margin: 0 0 14px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  color: var(--ink-strong);
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1;
  letter-spacing: var(--tracking-tight);
  margin-bottom: 22px;
}

h2 {
  color: var(--ink-strong);
  font-size: clamp(29px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: var(--tracking-tight);
  margin-bottom: 14px;
}

h3 {
  color: var(--ink-strong);
  font-size: var(--text-xl);
  line-height: 1.18;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.lede {
  color: var(--muted);
  font-size: clamp(18px, 2vw, 21px);
  max-width: 680px;
}

.hero-copy .lede {
  margin-bottom: 24px;
}

.hero-actions,
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}

.trust-strip,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trust-strip {
  margin-top: 30px;
}

.pill,
.trust-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 8px 13px;
  color: #39416d;
  font-size: var(--text-sm);
  font-weight: 800;
}

.hero-visual {
  position: relative;
}

.browser-shell {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.browser-bar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  background: var(--lavender);
  color: #5a6086;
  font-size: var(--text-sm);
  font-weight: 700;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--coral);
}

.dot:nth-child(2) {
  background: var(--gold);
}

.dot:nth-child(3) {
  background: var(--green);
}

.preview-grid {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  padding: 22px;
}

.age-tabs {
  display: grid;
  gap: 10px;
}

.age-tab {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  border-radius: 8px;
  padding: 13px 14px;
  cursor: pointer;
  font-weight: 800;
}

.age-tab span {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  margin-top: 2px;
}

.age-tab[aria-selected="true"] {
  color: #ffffff;
  border-color: var(--purple);
  background: var(--purple);
}

.age-tab[aria-selected="true"] span {
  color: rgba(255, 255, 255, 0.78);
}

.phone {
  width: min(100%, 260px);
  min-height: 522px;
  justify-self: center;
  border: 10px solid #070816;
  border-radius: 36px;
  background: #ffffff;
  padding: 20px 16px;
  box-shadow: var(--shadow-3);
  overflow: hidden;
}

.phone.dark {
  background: #11142b;
  color: #ffffff;
}

.phone-status {
  display: flex;
  justify-content: space-between;
  color: inherit;
  opacity: 0.78;
  font-size: var(--text-xs);
  font-weight: 800;
  margin-bottom: 24px;
}

.phone h3 {
  color: inherit;
  font-size: var(--text-xl);
  margin-bottom: 5px;
}

.phone .small {
  color: inherit;
  opacity: 0.72;
  font-size: var(--text-xs);
  margin-bottom: 12px;
}

.ask-card {
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: 8px;
  padding: 15px;
  min-height: 112px;
  margin: 16px 0 22px;
}

.phone.dark .ask-card {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.44);
}

.ask-card strong {
  display: block;
  color: inherit;
  margin-bottom: 6px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.module-tile {
  min-height: 94px;
  border: 1px solid rgba(200, 193, 237, 0.8);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--lavender);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.module-dot {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: var(--purple);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.module-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

.module-label {
  min-width: 0;
  line-height: 1.15;
}

.module-tile:nth-child(2n) {
  background: var(--sky);
}

.module-tile:nth-child(2n) .module-dot {
  background: #4f8ee8;
}

.module-tile:nth-child(3n) {
  background: var(--mint);
}

.module-tile:nth-child(3n) .module-dot {
  background: #26a979;
}

.module-tile:nth-child(4n) {
  background: var(--cream);
}

.module-tile:nth-child(4n) .module-dot {
  background: #df9a1c;
}

.phone.dark .module-tile {
  color: #14183d;
}

.section {
  width: min(var(--content-max), calc(100% - 40px));
  margin: 0 auto;
  padding: var(--section-y) 0;
  scroll-margin-top: 96px;
}

.section.alt {
  width: 100%;
  background: rgba(240, 236, 255, 0.52);
}

.section.alt > .section-inner {
  width: min(var(--content-max), calc(100% - 40px));
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.section-header .lede {
  max-width: 620px;
  margin-bottom: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card,
.mode-card,
.step-card,
.stat-card,
.price-card,
.faq-card,
.portal-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.mode-card {
  min-height: 222px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: space-between;
}

.mode-card[data-tone="young"] {
  background: var(--cream);
}

.mode-card[data-tone="challenge"] {
  background: var(--mint);
}

.mode-card[data-tone="focused"] {
  background: var(--sky);
}

.mode-card[data-tone="teen"] {
  background: var(--lavender);
}

.mode-card button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--purple);
  color: #ffffff;
  font-weight: var(--w-title);
  cursor: pointer;
}

.label {
  color: var(--purple-deep);
  font-size: var(--text-xs);
  font-weight: var(--w-title);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.muted,
.updated,
.note {
  color: var(--muted);
}

.step-line {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.step-number {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--purple);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: var(--w-title);
  margin-bottom: 18px;
}

.answer-layout,
.portal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 20px;
}

.answer-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.answer-question {
  background: var(--lavender);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
}

.feedback-list {
  display: grid;
  gap: 10px;
}

.feedback-list button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  padding: 0 18px;
}

.feedback-list button:nth-child(1) {
  background: var(--mint);
}

.feedback-list button:nth-child(2) {
  background: var(--cream);
}

.feedback-list button:nth-child(3) {
  background: #ffe8dc;
}

.feedback-list button:nth-child(4) {
  background: var(--rose);
}

.followup-grid,
.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.portal-grid {
  margin-top: 18px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card strong {
  display: block;
  color: var(--ink-strong);
  font-size: var(--text-2xl);
  line-height: 1;
  margin-top: 6px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.pipeline .step-card:nth-child(1),
.portal-card:nth-child(4n+1) {
  background: var(--lavender);
}

.pipeline .step-card:nth-child(2),
.portal-card:nth-child(4n+2) {
  background: var(--sky);
}

.pipeline .step-card:nth-child(3),
.portal-card:nth-child(4n+3) {
  background: var(--mint);
}

.pipeline .step-card:nth-child(4),
.portal-card:nth-child(4n+4) {
  background: var(--cream);
}

.pipeline .step-card:nth-child(5) {
  background: #ffe8dc;
}

.pipeline .step-card:nth-child(6) {
  background: var(--rose);
}

.price-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.price {
  color: var(--ink-strong);
  font-size: var(--text-hero);
  line-height: 1;
  font-weight: 900;
}

.price small {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.check-list {
  padding-left: 18px;
  margin: 10px 0 0;
}

.check-list li {
  margin: 7px 0;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-card h3 {
  font-size: var(--text-lg);
}

.wrap {
  width: min(820px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 80px;
}

.wrap h1 {
  font-size: clamp(36px, 5vw, 56px);
}

/* Reading measure: keep legal/utility prose within ~68ch even though .wrap is 820px wide.
   Headings, cards, and grids stay full width; only running text/lists are capped. */
.wrap p,
.wrap li {
  max-width: 68ch;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
}

.contact {
  background: var(--mint);
}

.contact code,
code {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
}

label {
  display: block;
  font-weight: 800;
  margin: 14px 0 5px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #ffffff;
  color: var(--ink);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(110, 61, 244, 0.55);
  outline-offset: 1px;
  border-color: var(--purple);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"],
input:user-invalid {
  border-color: var(--tone-red);
}

footer {
  width: min(var(--content-max), calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 50px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 22px;
}

.footer-grid a {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
  padding-block: 8px;
}

.footer-trust-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-left: 18px;
}

.footer-trust-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

.mobile-only {
  display: none;
}

@media (max-width: 980px) {
  header.site {
    align-items: flex-start;
    position: relative;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero,
  .two-col,
  .answer-layout,
  .portal-layout {
    grid-template-columns: 1fr;
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }

  .card-grid,
  .three-col {
    grid-template-columns: 1fr 1fr;
  }

  .step-line,
  .pipeline {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .site,
  .hero,
  .section,
  .section.alt > .section-inner,
  .wrap,
  footer {
    width: min(100% - 28px, var(--content-max));
  }

  header.site {
    display: grid;
  }

  .nav-actions {
    width: 100%;
  }

  .nav-actions .btn {
    flex: 1;
  }

  .hero {
    padding-top: 28px;
  }

  .card-grid,
  .three-col,
  .step-line,
  .pipeline,
  .stat-row,
  .followup-grid,
  .portal-grid,
  .module-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    display: block;
  }

  .browser-shell {
    border-radius: var(--radius-md);
  }

  .browser-bar {
    height: 42px;
  }

  .phone {
    width: 100%;
    min-height: 0;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: block;
  }
}

.marketing-home {
  background: #fbfbff;
}

.marketing-home::before {
  position: absolute;
  min-height: 980px;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 200, 87, 0.28), transparent 20%),
    radial-gradient(circle at 82% 60%, rgba(22, 184, 170, 0.14), transparent 24%),
    linear-gradient(180deg, #fbf9ff 0%, #ffffff 48%, #f8fbff 100%);
}

.marketing-header {
  min-height: 72px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(220, 216, 242, 0.72);
}

.marketing-header .nav-links {
  flex-wrap: nowrap;
  gap: 2px;
  border: 1px solid rgba(220, 216, 242, 0.9);
  border-radius: 999px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow:
    var(--shadow-2),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.marketing-header .nav-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 14px;
  color: #2f355f;
  font-size: var(--text-sm);
  font-weight: 800;
  white-space: nowrap;
  transition: 160ms ease;
}

.marketing-header .nav-links a:hover,
.marketing-header .nav-links a:focus-visible {
  color: var(--purple-deep);
  border-color: rgba(197, 187, 239, 0.9);
  background: #ffffff;
  box-shadow: var(--shadow-1);
  text-decoration: none;
  transform: translateY(-1px);
}

.marketing-header .nav-links a.is-active {
  color: var(--purple-press);
  border-color: rgba(110, 61, 244, 0.22);
  background: #f2edff;
  box-shadow:
    0 8px 18px rgba(81, 40, 221, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.marketing-header .nav-links a.is-active::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--purple);
  box-shadow: 0 0 0 3px rgba(110, 61, 244, 0.12);
}

.mobile-menu {
  display: none;
  position: relative;
}

.mobile-menu summary {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid #ded7fb;
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  list-style: none;
}

.mobile-menu summary::-webkit-details-marker {
  display: none;
}

.mobile-menu summary span {
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
}

.mobile-menu nav {
  position: absolute;
  right: 0;
  top: 50px;
  z-index: 40;
  min-width: 220px;
  display: grid;
  gap: 4px;
  border: 1px solid #ded7fb;
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-3);
}

.mobile-menu nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 800;
}

.mobile-menu nav a:hover,
.mobile-menu nav a:focus-visible,
.mobile-menu nav a.is-active {
  color: var(--purple-press);
  border-color: rgba(110, 61, 244, 0.18);
  background: #f4efff;
  text-decoration: none;
}

.brand-lockup {
  gap: 10px;
}

.brand-lockup:hover {
  text-decoration: none;
}

/* Brand mark consolidated onto the compact SVG — see the .logo
   rule near the top of the file. The old gradient tile + text-"D" glyph + sparkle
   ::after used to override the SVG here on marketing/legal/login pages; removed so
   every surface renders the single canonical brand mark (parity with the app's
   .logo-mark). The inner <span>D</span> stays as an accessible fallback, hidden via
   the SVG rule's font-size:0. */

.brand {
  color: #101345;
  font-size: var(--text-xl);
  font-weight: 900;
}

.brand span {
  color: var(--purple-press);
}

.hero-premium {
  min-height: 0;
  margin-top: 0;
  padding: clamp(34px, 4vw, 60px) 0 42px;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
  gap: clamp(28px, 5vw, 70px);
}

.hero-premium h1 {
  max-width: 760px;
  font-size: clamp(44px, 5.35vw, 72px);
  line-height: 1.03;
  margin-bottom: 20px;
}

.hero-premium .lede {
  max-width: 650px;
  color: #566084;
  font-size: clamp(18px, 1.7vw, 22px);
  line-height: 1.55;
}

.hero-proof-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-proof-row span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  color: #363d66;
  background: rgba(255, 255, 255, 0.82);
  font-size: var(--text-sm);
  font-weight: 800;
}

.hero-stage {
  position: relative;
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  align-items: start;
}

.mascot-card {
  grid-row: 1 / 4;
  align-self: end;
  justify-self: start;
  width: min(40vw, 260px);
  min-width: 180px;
  display: grid;
  place-items: end center;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 78%, rgba(110, 61, 244, 0.16), transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(246, 242, 255, 0.62));
}

.mascot-card img {
  display: block;
  width: min(100%, 220px);
  height: auto;
  filter: drop-shadow(0 22px 28px rgba(74, 32, 184, 0.2));
}

.hero-answer-card,
.hero-parent-card,
.product-phone,
.product-card,
.parent-dashboard-card,
.plan-card,
.proof-band article,
.safety-grid article {
  border: 1px solid #e1dcf4;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-3);
}

.hero-answer-card,
.hero-parent-card {
  padding: 18px;
}

.hero-answer-card {
  grid-column: 2;
  background: #fff8df;
}

.hero-parent-card {
  grid-column: 2;
  background: #f2fff8;
}

.hero-answer-card span,
.hero-parent-card span,
.product-kicker,
.label {
  display: block;
  color: #5c6388;
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-answer-card strong,
.hero-parent-card strong {
  display: block;
  margin: 6px 0;
  color: #101345;
  font-size: var(--text-xl);
  line-height: 1.2;
}

.hero-answer-card p,
.hero-parent-card p {
  margin: 0;
  color: #4f567b;
  font-size: var(--text-sm);
}

.product-phone {
  grid-column: 1 / 3;
  justify-self: end;
  width: min(100%, 430px);
  min-height: 234px;
  padding: 18px;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 20%, rgba(110, 61, 244, 0.12), transparent 24%),
    #ffffff;
}

.product-phone .phone-status {
  margin-bottom: 14px;
}

.product-phone h3 {
  font-size: var(--text-xl);
}

.product-phone .ask-card {
  min-height: 70px;
  margin: 14px 0;
}

.product-phone .module-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.product-phone .module-tile {
  min-height: 54px;
  padding: 9px 10px;
  font-size: var(--text-xs);
}

.product-phone .module-dot {
  width: 18px;
  height: 18px;
  border-radius: 7px;
}

.product-phone .module-dot::before {
  width: 6px;
  height: 6px;
}

.product-phone.dark {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at 92% 20%, rgba(255, 200, 87, 0.12), transparent 24%),
    #11142b;
}

.product-phone.dark .ask-card {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.product-phone.dark .module-tile {
  color: #14183d;
}

.proof-band {
  width: min(var(--content-max), calc(100% - 40px));
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.proof-band article {
  padding: 22px;
}

.proof-band h2 {
  margin: 10px 0 8px;
  font-size: var(--text-xl);
  line-height: 1.22;
}

.proof-band p,
.product-card p,
.safety-grid span,
.plan-card p,
.parent-dashboard-card span {
  margin: 0;
  color: #5f668a;
}

.proof-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--purple);
  font-size: var(--text-sm);
  font-weight: var(--w-title);
}

.compact-section {
  padding-top: 54px;
  padding-bottom: 58px;
}

.age-mode-grid,
.product-grid,
.safety-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

/* Five age experiences are a single comparison set on wide screens. Keeping them in one
   equal-width row avoids visually demoting the teen experience and uses the available canvas. */
.age-mode-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.age-mode-grid .mode-card {
  min-height: 218px;
  padding: 20px;
}

.age-mode-grid .mode-card button {
  width: 100%;
  min-height: 44px;
  border: 1px solid #ded7fb;
  border-radius: var(--radius-sm);
  color: var(--purple-press);
  background: #ffffff;
  font-weight: var(--w-title);
  cursor: pointer;
}

.product-section,
.parent-section {
  padding-top: 66px;
  padding-bottom: 66px;
}

.product-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-card {
  min-height: 220px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 249, 255, 0.9));
}

.product-card h3 {
  margin-top: 10px;
  font-size: var(--text-2xl);
}

.safety-section {
  padding-top: 64px;
  padding-bottom: 64px;
}

.safety-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.safety-grid article {
  min-height: 142px;
  padding: 18px;
}

.safety-grid strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.parent-panel-refresh {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 420px);
  gap: 32px;
  align-items: center;
}

.parent-dashboard-card {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.parent-dashboard-card div {
  min-height: 62px;
  border: 1px solid #ebe7f7;
  border-radius: 8px;
  padding: 12px;
  background: #fbfaff;
}

.parent-dashboard-card strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
}

.plans-section {
  padding-top: 58px;
}

.plan-card {
  min-height: 150px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 18px;
  align-items: center;
  padding: 26px;
  background:
    radial-gradient(circle at 93% 18%, rgba(255, 200, 87, 0.16), transparent 20%),
    #ffffff;
}

.plan-card h3 {
  margin-top: 6px;
  font-size: var(--text-2xl);
}

@media (max-width: 1120px) {
  .age-mode-grid,
  .safety-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width:900px) {
  .hero-premium{grid-template-columns:1fr}
  .hero-stage{max-width:760px}
}

@media (max-width:900px),(max-height:850px) and (min-width:901px) {
  .hero-stage{min-height:0}
  .hero-stage .product-phone{display:none}
}

@media (max-width: 860px) {
  .marketing-header {
    width: min(100% - 28px, var(--content-max));
    min-height: 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content max-content;
    align-items: center;
    gap: 10px;
  }

  .marketing-header.has-mobile-menu .nav-links,
  .marketing-header.has-mobile-menu .nav-actions .secondary {
    display: none;
  }

  .marketing-header .nav-actions {
    width: auto;
  }

  .marketing-header .nav-actions .btn {
    min-height: 40px;
    padding: 9px 12px;
    font-size: var(--text-sm);
  }

  .marketing-header.has-mobile-menu .mobile-menu {
    display: block;
  }
}

@media (max-width: 760px) {
  .hero-premium {
    padding-top: 20px;
    gap: 18px;
  }

  .hero-premium h1 {
    font-size: clamp(32px, 9.3vw, 38px);
    line-height: 1.06;
    margin-bottom: 14px;
  }

  .hero-premium .lede {
    font-size: var(--text-base);
    line-height: 1.45;
  }

  .hero-stage {
    min-height: 0;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 12px;
  }

  .product-phone {
    grid-column: 1 / 3;
  }

  .mascot-card {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: stretch;
    justify-self: center;
    width: 100%;
    min-width: 0;
    min-height: 174px;
  }

  .mascot-card img {
    width: 118px;
  }

  .hero-answer-card,
  .hero-parent-card {
    grid-column: 2;
    padding: 13px;
  }

  .hero-answer-card strong,
  .hero-parent-card strong {
    font-size: var(--text-base);
  }

  .hero-answer-card p,
  .hero-parent-card p {
    font-size: var(--text-sm);
    line-height: 1.4;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0;
  }

  .hero-actions .btn {
    min-height: 44px;
    padding-inline: 12px;
    font-size: var(--text-sm);
  }

  .hero-proof-row {
    gap: 8px;
    margin-top: 14px;
  }

  .hero-proof-row span {
    min-height: 30px;
    padding-inline: 10px;
    font-size: var(--text-xs);
  }

  .product-phone {
    width: 100%;
    padding: 14px;
  }

  .proof-band article,
  .product-card,
  .safety-grid article,
  .age-mode-grid .mode-card {
    padding: 18px;
  }

  .product-card {
    min-height: 0;
  }

  .proof-band,
  .age-mode-grid,
  .product-grid,
  .safety-grid,
  .parent-panel-refresh,
  .plan-card {
    grid-template-columns: 1fr;
  }

  .proof-band {
    width: min(100% - 28px, var(--content-max));
  }

  .section,
  .section.alt > .section-inner,
  footer {
    width: min(100% - 28px, var(--content-max));
  }

  .section {
    padding-top: 46px;
    padding-bottom: 46px;
  }

  .plan-card {
    align-items: start;
  }
}

.study-app-body {
  min-width: 0;
  background: #fbfbff;
  color: var(--ink);
  overflow-x: hidden;
}

.study-app-body::before {
  display: none;
}

.study-app {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0, #fbfbff 360px, #ffffff 100%);
  overflow-x: clip;
}

.study-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  box-sizing: border-box;
  height: 76px;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: clamp(12px, 1.35vw, 24px);
  padding: 0 clamp(16px, 1.8vw, 32px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(218, 211, 243, 0.86);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(18px);
}

.study-topbar > * {
  min-width: 0;
}

.study-logo {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--purple-deep);
  font-size: var(--text-xl);
  font-weight: 900;
  letter-spacing: 0;
}

.study-logo:hover,
.study-nav a:hover,
.profile-menu:hover {
  text-decoration: none;
}

/* Brand mark: the compact Spark Path master used in browser chrome. */
.logo-mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 26%;
  background: url("/assets/duggu-logo-compact.svg?v=5") center / 100% 100% no-repeat;
  font-size: 0;
}

.logo-mark::before,
.logo-mark::after {
  content: none;
}

.study-logo > span:not(.logo-mark) {
  transform: translateY(-1px);
}

.study-nav {
  display: flex;
  align-items: center;
  /* `safe center` centers when the items fit but aligns to the start when they OVERFLOW, so the
     first/last item (e.g. "Parent Zone" with the teen 9-item nav) stays reachable — plain `center`
     + overflow makes the ends unreachable and silently clipped. */
  justify-content: safe center;
  gap: clamp(8px, 1vw, 18px);
  height: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-padding-inline: 10px;
  /* Edge fade = the scroll affordance (the scrollbar is hidden): a clipped item fades out instead of
     hard-cutting, signalling "more this way". Invisible when items fit (fades empty gutter). Reset
     to none in the ≥1200 vertical rail below, where the nav is a column. */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}

.study-nav::-webkit-scrollbar {
  display: none;
}

.study-nav a {
  position: relative;
  flex: 0 0 auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: #161748;
  font-size: var(--text-xs);
  font-weight: 800;
  white-space: nowrap;
}

.study-nav a.active {
  color: var(--purple-press);
  background: #f2efff;
}

.study-nav a.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -14px;
  height: 3px;
  border-radius: 999px;
  background: var(--purple);
}

.nav-glyph,
.soft-glyph {
  position: relative;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: grid;
  place-items: center;
  border: 1px solid #ded7fb;
  border-radius: 7px;
  background: #fbf9ff;
  color: var(--purple);
  font-size: 9px;
  line-height: 1;
  font-weight: 900;
}

.nav-glyph::after,
.soft-glyph::after {
  display: none;
}

.nav-glyph[data-icon-done="1"]::before,
.nav-glyph[data-icon-done="1"]::after,
.top-mini[data-icon-done="1"]::before,
.top-mini[data-icon-done="1"]::after,
.send-circle[data-icon-done="1"]::before,
.send-circle[data-icon-done="1"]::after,
.study-app .module-icon[data-icon-done="1"]::before,
.study-app .module-icon[data-icon-done="1"]::after {
  content: "";
  display: none;
}

.nav-glyph svg,
.top-mini svg,
.send-circle svg,
.study-app .module-icon svg {
  display: block;
  width: 1em;
  height: 1em;
  stroke-width: 2;
}

.study-nav a[href="/learn/home"] .nav-glyph::before {
  content: "H";
}

.study-nav a[href="/study-hub.html"] .nav-glyph::before {
  content: "S";
}

.study-nav a[href="/ask-duggu.html"] .nav-glyph::before {
  content: "?";
}

.study-nav a[href="/exam-prep.html"] .nav-glyph::before {
  content: "EX";
}

.study-nav a[href="/writing-coach.html"] .nav-glyph::before {
  content: "W";
}

.study-nav a[href="/coding-ai.html"] .nav-glyph::before {
  content: "</>";
  font-size: 7px;
}

.study-nav a[href="/current-affairs.html"] .nav-glyph::before {
  content: "CA";
  font-size: 7px;
}

.study-nav a[href="/parent-zone.html"] .nav-glyph::before {
  content: "P";
}

.soft-glyph::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 2px solid currentColor;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: clamp(8px, 0.8vw, 12px);
  min-width: max-content;
}

.top-mini {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid #e1ddef;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #33345f;
  background: #ffffff;
  font-size: 0;
  appearance: none;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.top-mini svg {
  width: 15px;
  height: 15px;
}

.top-mini:hover {
  border-color: #cfc5ff;
  box-shadow: var(--shadow-1);
  transform: translateY(-1px);
}

.top-status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border: 1px solid #e1ddef;
  border-radius: 999px;
  background: #ffffff;
}

.top-status-chip {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  color: #4d5281;
  background: #f8f6ff;
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.top-status-chip.safety-chip {
  color: #126b58;
  background: #edf9f2;
}

.top-mini::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 1.8px solid currentColor;
  border-radius: 999px;
}

.top-mini[aria-label="Search"]::before {
  position: relative;
}

.top-mini[aria-label="Search"]::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(6px, 6px) rotate(45deg);
}

.top-mini[aria-label="Notifications"]::before {
  width: 12px;
  height: 13px;
  border-radius: 8px 8px 5px 5px;
  border-bottom-width: 3px;
}

.profile-menu {
  min-width: 142px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.profile-face {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--purple), var(--gold));
  border: 3px solid #f0ebff;
  font-size: 15px;
  font-weight: 900;
  box-shadow: inset 0 -8px 18px rgba(83, 41, 204, 0.16);
}

.profile-menu strong {
  display: block;
  line-height: 1.1;
  font-size: var(--text-sm);
}

/* :not(.profile-face) — this block rule used to override the avatar's centering grid,
   leaving the initial stuck at the circle's top edge. */
.profile-menu span:not(.profile-face) {
  display: block;
  color: #6b6f9b;
  font-size: 11px;
  font-weight: 700;
}

.study-container {
  width: min(calc(100% - clamp(24px, 3vw, 56px)), var(--content-wide));
  min-width: 0;
  box-sizing: border-box;
  margin: 0 auto;
  padding: clamp(16px, 1.6vw, 28px) 0 34px;
}

/* Consistent section rhythm so stacked sections never sit "attached" to the one above.
   One rule for every .study-container page (home, module pages, parent zone). */
.study-container > section + section {
  margin-top: var(--stack-section);
}

.study-panel,
.study-card,
.history-panel,
.answer-panel,
.question-panel,
.session-panel,
.editor-panel,
.feedback-panel,
.parent-panel {
  border: 1px solid #e3def5;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-2);
}

.study-card,
.history-panel,
.answer-panel,
.question-panel,
.session-panel,
.editor-panel,
.feedback-panel,
.parent-panel {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

a.study-card:hover,
.module-card:hover,
.project-card:hover,
.brief-card:hover,
.career-card:hover {
  border-color: #cfc5ff;
  box-shadow: var(--shadow-3);
  text-decoration: none;
  transform: translateY(-2px);
}

.study-hero {
  min-height: 276px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 350px);
  align-items: center;
  gap: clamp(18px, 2vw, 38px);
  padding: clamp(28px, 3vw, 52px) clamp(24px, 5vw, 86px);
  background:
    radial-gradient(circle at 82% 26%, rgba(255, 200, 87, 0.18), transparent 17%),
    radial-gradient(circle at 91% 74%, rgba(22, 184, 170, 0.13), transparent 20%),
    linear-gradient(135deg, #fbf9ff 0%, #f0ebff 58%, #f8fbff 100%);
  position: relative;
  overflow: hidden;
}

.study-hero > * {
  min-width: 0;
}

.study-hero::before,
.study-hero::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #c4afff;
  transform: rotate(45deg);
}

/* Decorative diamonds live in the mascot's corner, never over the headline column
   (they were pixel-anchored at left:58px/top:40px and sat on the "Welcome" text). */
.study-hero::before {
  right: 96px;
  top: 30px;
}

.study-hero::after {
  right: 210px;
  bottom: 54px;
}

@media (max-width: 900px) {
  .study-hero::before,
  .study-hero::after {
    display: none;
  }
}

.study-hero h1 {
  max-width: 760px;
  margin: 0 0 14px;
  color: #101345;
  font-size: clamp(24px, 2vw, 34px);
  line-height: 1.28;
}

.study-hero h1 span,
.section-title h2,
.blue-link {
  color: var(--purple);
}

.runtime-badge {
  width: fit-content;
  max-width: 100%;
  margin: 0 0 18px;
  border: 1px solid #ded7fb;
  border-radius: 999px;
  padding: 7px 12px;
  color: #4d5281;
  background: rgba(255, 255, 255, 0.72);
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: 1.2;
}

.study-searchbar {
  min-height: 58px;
  width: min(100%, var(--reading-max));
  display: grid;
  grid-template-columns: 40px 1fr 44px;
  align-items: center;
  gap: 14px;
  padding: 0 12px 0 22px;
  border: 1px solid #ded8ef;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: var(--shadow-2);
  color: #626b8f;
  font-size: var(--text-sm);
  font-weight: 700;
}

.study-searchbar:focus-within {
  border-color: var(--purple);
  /* Halo ring (focus canon) so keyboard focus on the composite search is clearly visible,
     plus the existing soft lift. */
  box-shadow: 0 0 0 3px rgba(110, 61, 244, 0.18), 0 16px 34px rgba(91, 44, 240, 0.14);
}

.study-searchbar input {
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
  font-weight: 800;
}

.study-searchbar input::placeholder {
  color: #6b6f9b;
}

.study-searchbar span:not(.search-lens),
.study-searchbar input {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-lens {
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 999px;
  position: relative;
  box-sizing: border-box;
}

.search-lens::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -3px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
}

.send-circle {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #7b49ff, #5623df);
  box-shadow: 0 10px 22px rgba(91, 44, 240, 0.25);
  font-size: 0;
}

.send-circle::before {
  content: "";
  width: 13px;
  height: 13px;
  border-top: 3px solid currentColor;
  border-right: 3px solid currentColor;
  transform: rotate(45deg);
}

.send-circle svg {
  width: 18px;
  height: 18px;
}

.prompt-pills {
  max-width: 690px;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.study-app .prompt-pills button,
.study-app .pill {
  /* 44px tap floor for a kids' touch app (was a 30px height that failed the floor);
     inline-flex keeps the label centered while the pill grows to the tappable size. */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid #dad1ff;
  border-radius: 999px;
  padding: 0 16px;
  background: #fbf9ff;
  color: var(--purple-press);
  font-size: var(--text-xs);
  font-weight: 800;
  white-space: nowrap;
}

.study-app .prompt-pills button:hover,
.study-app .prompt-pills button:focus-visible {
  border-color: #bcaeff;
  background: #f3efff;
}

/* Mascot stage: a warm spotlight so the golden fur reads lit (not dull on the
   lavender wash), a grounded contact-shadow ellipse so Duggu stands rather than
   floats, and a gentle idle float. The golden-dog master is 439x640; the display
   size stays within it so it never upscales. */
.duggu-orb {
  position: relative;
  justify-self: center;
  width: clamp(190px, 17vw, 260px);
  height: clamp(184px, 16vw, 252px);
  border-radius: 32px;
  display: block;
  color: transparent;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 214, 138, 0.42), rgba(255, 224, 170, 0.18) 42%, transparent 66%),
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.3) 46%, transparent 68%);
  font-size: 0;
}

.duggu-orb::before {
  content: "";
  position: absolute;
  inset: -24px -8px -6px;
  background:
    radial-gradient(ellipse 46% 7% at 50% 99%, rgba(74, 32, 184, 0.2), transparent 72%),
    url("/assets/duggu-mascot.png") center bottom / contain no-repeat;
  filter: drop-shadow(0 14px 20px rgba(74, 32, 184, 0.18)) saturate(1.08) contrast(1.03);
  animation: duggu-idle 4.2s ease-in-out infinite;
  transform-origin: 50% 100%;
}

@keyframes duggu-idle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-0.6deg); }
}

@media (prefers-reduced-motion: reduce) {
  .duggu-orb::before { animation: none; }
}

.duggu-orb::after {
  content: "I'm Duggu";
  position: absolute;
  right: -10px;
  top: 20px;
  border: 1px solid #e4def8;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-2);
  font-size: 12px;
  font-weight: 900;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 12px;
}

.section-title h2 {
  margin: 0;
  font-size: var(--text-lg);
}

.study-app .module-grid {
  /* Width-derived: ~5-up on wide desktop, 3-up tablet, 1-2-up phone — no fixed
     per-breakpoint column counts to fall out of sync. */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.study-app .module-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.study-app .module-card > span:last-child {
  padding-right: 44px;
}

/* "Go" affordance: a clean tone chip, VERTICALLY CENTERED on the right (was bottom-anchored,
   so it floated at a different height on every card and read as an afterthought). Consistent
   across all module cards regardless of text length. */
.study-app .module-card::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tone, var(--purple)) 12%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--tone, var(--purple)) 30%, #ffffff);
  transition: background-color 160ms ease, transform 160ms ease;
}

.study-app .module-card::before {
  content: "";
  position: absolute;
  right: 26px;
  top: 50%;
  z-index: 1;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--tone, var(--purple));
  border-right: 2px solid var(--tone, var(--purple));
  transform: translateY(-50%) rotate(45deg);
  transition: transform 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .study-app .module-card:hover::after,
  .study-app .module-card:focus-visible::after {
    background: color-mix(in srgb, var(--tone, var(--purple)) 20%, #ffffff);
  }
  .study-app .module-card:hover::before,
  .study-app .module-card:focus-visible::before {
    transform: translateY(-50%) translateX(2px) rotate(45deg);
  }
}

.study-app .module-card h3,
.study-card h3,
.parent-panel h3,
.answer-panel h2,
.question-panel h2,
.editor-panel h2,
.feedback-panel h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: var(--text-lg);
  font-weight: var(--w-title);
  line-height: 1.25;
}

.study-app .module-card p,
.study-card p,
.parent-panel p,
.answer-panel p,
.question-panel p,
.editor-panel p,
.feedback-panel p,
.study-app .muted {
  margin: 0;
  color: #666b92;
  font-size: var(--text-sm);
  font-weight: var(--w-body);
  line-height: 1.55;
}

.study-app .module-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--tone, var(--purple));
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.94), transparent 34%),
    color-mix(in srgb, var(--tone, var(--purple)) 13%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--tone, var(--purple)) 28%, #ffffff);
  box-shadow: inset 0 -10px 20px rgba(110, 61, 244, 0.08);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.study-app .module-icon svg {
  width: 20px;
  height: 20px;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.snapshot-card {
  min-height: 122px;
  padding: 22px;
}

.snapshot-card p:first-child {
  color: #6c7198;
  font-weight: 800;
}

.metric-value {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-size: var(--text-xl);
  line-height: 1;
  font-weight: var(--w-display);
}

.mini-progress {
  height: 6px;
  margin-top: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: #ebe8f7;
}

.mini-progress span {
  display: block;
  width: var(--w, 60%);
  height: 100%;
  border-radius: inherit;
  background: var(--purple);
}

.tip-strip {
  min-height: 70px;
  display: grid;
  grid-template-columns: 64px 1fr 110px;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 10px 20px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(246, 242, 255, 0.94));
}

.tip-strip img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  object-position: top center;
}

.primary-action,
.ghost-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid #ded8ef;
  padding: 0 18px;
  font-size: var(--text-xs);
  font-weight: var(--w-title);
  line-height: 1;
  cursor: pointer;
}

.primary-action {
  color: #ffffff;
  background: linear-gradient(135deg, #7443f4, #5624df);
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(91, 44, 240, 0.2);
}

.ghost-action {
  color: var(--purple);
  background: #ffffff;
}

.primary-action:hover,
.ghost-action:hover,
.send-circle:hover,
.icon-action:hover,
.composer-tool:hover,
.mini-feedback:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.primary-action:focus-visible,
.ghost-action:focus-visible,
.send-circle:focus-visible,
.top-mini:focus-visible,
.icon-action:focus-visible,
.answer-choice:focus-visible,
.mini-feedback:focus-visible,
.composer-tool:focus-visible,
.subtabs button:focus-visible,
.tool-icons button:focus-visible,
.report-link:focus-visible,
.text-action:focus-visible {
  outline: 3px solid rgba(110, 61, 244, 0.6);
  outline-offset: 2px;
}

.floating-duggu {
  position: fixed;
  right: 22px;
  top: 94px;
  z-index: 30;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  /* Transparent Spark Path symbol over the purple support disc. */
  background:
    url("/assets/duggu-symbol.svg?v=5") center / 90% no-repeat,
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.28), transparent 32%),
    linear-gradient(135deg, #7f4dff, #5624df);
  border: 4px solid #efe8ff;
  box-shadow: 0 14px 26px rgba(74, 32, 184, 0.2);
  font-size: 0;
}

.floating-duggu::before,
.floating-duggu::after {
  content: none;
}

.page-title {
  margin: 18px 0 18px;
}

.page-title-top {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.app-back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #ded8ef;
  border-radius: 999px;
  padding: 0 14px 0 12px;
  color: var(--purple);
  background: #ffffff;
  box-shadow: var(--shadow-2);
  font-size: var(--text-xs);
  font-weight: var(--w-title);
  line-height: 1;
  white-space: nowrap;
}

.app-back:hover {
  color: var(--purple-deep);
  background: #f6f2ff;
  text-decoration: none;
}

.app-back span {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1.6px solid currentColor;
  border-radius: 999px;
}

.app-back span::before {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  left: 6px;
  top: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.page-title h1 {
  margin: 0 0 12px;
  font-size: var(--text-2xl);
  line-height: 1.2;
}

.page-title .ux-inline-note {
  max-width: 760px;
  margin-top: 12px;
}

.subtabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid #e9e5f4;
}

.subtabs a,
.subtabs button {
  position: relative;
  padding: 0 0 12px;
  border: 0;
  background: transparent;
  color: #51577f;
  font-size: var(--text-xs);
  font-weight: 800;
  cursor: pointer;
}

.subtabs a.active,
.subtabs button.active {
  color: var(--purple);
}

.subtabs a.active::after,
.subtabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 999px;
  background: var(--purple);
}

.ask-layout {
  display: grid;
  grid-template-columns: 230px minmax(720px, 1fr);
  gap: 24px;
}

.history-panel {
  padding: 18px;
}

.history-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-lg);
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.history-item {
  min-height: 44px;
  width: 100%;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #343760;
  font-size: var(--text-xs);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.history-item.active,
.history-item:hover {
  background: #f1edff;
  color: #4e23d4;
  text-decoration: none;
}

.study-app .is-selected,
.study-app .is-open {
  border-color: #bcaeff;
  background: #f7f3ff;
}

.answer-panel {
  padding: 32px;
}

.answer-panel h1 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 1.08;
}

.answer-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.answer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
  gap: 28px;
  align-items: stretch;
  margin-top: 20px;
}

.breakdown-list {
  display: grid;
  gap: 18px;
}

.breakdown-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 12px;
  align-items: start;
}

.breakdown-number {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--purple);
  background: var(--lavender);
  font-size: var(--text-xs);
  font-weight: var(--w-title);
}

.sky-card {
  min-height: 270px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, #ffe37a 0 9%, transparent 10%),
    linear-gradient(180deg, #7dc6ff 0%, #dff5ff 58%, #82c36d 59%, #3e9e58 100%);
}

.sky-card::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  left: 150px;
  top: 80px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
}

.sky-card::after {
  content: "Rayleigh scattering";
  position: absolute;
  right: 18px;
  top: 112px;
  color: #15528f;
  font-size: var(--text-xs);
  font-weight: var(--w-title);
}

.source-related {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.source-list,
.related-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.source-list a,
.source-list button,
.related-list a,
.related-list button,
.activity-list div {
  min-height: 36px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  background: transparent;
  color: #25275c;
  border-bottom: 1px solid #f0edf8;
  font-size: var(--text-xs);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.source-list button:hover,
.related-list button:hover,
.source-list a:hover,
.related-list a:hover {
  color: var(--purple-press);
  text-decoration: none;
}

.text-action {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: var(--text-xs);
  font-weight: var(--w-title);
  cursor: pointer;
}

.chat-workspace {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(520px, 1fr) minmax(270px, 340px);
  gap: 18px;
  align-items: stretch;
}

.chat-page-container {
  padding-top: 18px;
}

.chat-page-container .chat-workspace {
  min-height: 0;
}

.chat-page-container .chat-history,
.chat-page-container .chat-context,
.chat-page-container .chat-shell {
  min-height: 0;
}

.chat-history,
.chat-context,
.chat-shell {
  min-height: min(820px, calc(100vh - 118px));
}

.chat-history,
.chat-context {
  align-self: start;
  position: sticky;
  /* Below the fixed pill in the ≥1200 rail layout. In the 1121–1199 band the sticky TWO-BAND top
     header (~111px, sticky top:0) is present instead — the override below clears it so the panel
     tops don't slide under the header on scroll. */
  top: 92px;
  max-height: calc(100vh - 118px);
  overflow: auto;
}

.chat-panel-head,
.chat-header,
.chat-header-actions,
.chat-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-panel-head h2,
.chat-header h1,
.context-card h2 {
  margin: 0;
  color: var(--ink);
}

.chat-panel-head h2 {
  font-size: var(--text-xl);
}

.chat-header h1 {
  font-size: var(--text-xl);
}

.icon-action,
.composer-tool,
.mini-feedback {
  border: 1px solid #ded8ef;
  background: #ffffff;
  color: var(--purple);
  font-weight: var(--w-title);
}

.icon-action {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
}

.history-item small {
  display: block;
  margin-top: 2px;
  color: #626b8f;
  font-size: 10px;
  line-height: 1.25;
}

.safety-note {
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #fbfff7, #f5fff9);
}

.chat-shell {
  border: 1px solid #e3def5;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #fbfaff);
  box-shadow: var(--shadow-3);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.chat-header {
  min-height: 78px;
  padding: 18px 22px;
  border-bottom: 1px solid #ebe7f6;
  background: rgba(255, 255, 255, 0.92);
}

.chat-header-actions {
  flex-wrap: wrap;
  justify-content: end;
}

.chat-thread {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 18px;
  overflow: auto;
  padding: 22px;
}

.chat-turn {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.user-turn {
  grid-template-columns: minmax(0, 1fr) 38px;
}

.user-turn .chat-avatar {
  grid-column: 2;
}

.user-turn .chat-bubble {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--purple), var(--gold));
  font-weight: 900;
  box-shadow: var(--shadow-2);
}

.duggu-avatar {
  position: relative;
  overflow: hidden;
  /* Transparent Spark Path symbol over the purple support disc. */
  background:
    url("/assets/duggu-symbol.svg?v=5") center / 92% no-repeat,
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.3), transparent 32%),
    linear-gradient(135deg, #7b48ff, #5124d6);
  font-size: 0;
}

.duggu-avatar::before,
.duggu-avatar::after {
  content: none;
}

.chat-bubble {
  max-width: var(--reading-max);
  border: 1px solid #e7e2f4;
  border-radius: var(--radius-md);
  padding: 18px;
  background: #ffffff;
  box-shadow: var(--shadow-2);
}

.user-bubble {
  max-width: min(560px, 78%);
  border-color: var(--purple);
  color: #ffffff;
  background: linear-gradient(135deg, #7443f4, #5422d9);
}

.user-bubble p,
.assistant-bubble p,
.nudge-bubble p {
  margin: 0;
}

.assistant-bubble {
  border-radius: 8px 16px 16px;
}

.assistant-bubble .answer-head {
  margin-bottom: 12px;
}

.assistant-bubble .answer-head h2 {
  font-size: clamp(20px, 2vw, 28px);
}

.chat-answer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 310px);
  gap: 18px;
  margin-top: 18px;
}

.breakdown-list.compact {
  gap: 12px;
}

.mini-sky {
  min-height: 230px;
}

.chat-actions-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 18px;
}

.mini-feedback { min-height: 40px; border-radius: 999px; padding: 0 14px; font-size: var(--text-xs); }

.mini-feedback.is-selected { color: var(--purple-press); border-color: #bcaeff; background: #f1edff; }

.report-link{min-height:40px;margin-left:0;border:1px solid rgba(155,63,45,.26);border-radius:999px;padding:0 12px;color:#8a5b51;background:#fff7f4;font-weight: 800;}

.report-link.is-selected,
.report-link:hover,
.report-link:focus-visible { color: #ffffff; border-color: #9b3f2d; background: #9b3f2d; }

.nudge-bubble {
  max-width: 720px;
  background: #f8f6ff;
}

/* Flex, not grid: the mic button is optional (only shown when the browser has
   SpeechRecognition), so a fixed column count either left a phantom mic slot
   (no-speech browsers) or overflowed 3 items into 2 tracks (Chrome/Android → the
   Send button wrapped to a 2nd row and the textarea collapsed). Flex sizes to
   whatever children are present and never wraps. */
.chat-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid #ebe7f6;
  background: rgba(255, 255, 255, 0.96);
}

/* Mic + Send keep their fixed 44px footprint; the textarea takes the rest. */
.chat-composer > .composer-tool,
.chat-composer > .send-circle {
  flex: none;
}

.chat-composer textarea {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  max-height: 200px;
  resize: none;
  overflow-y: hidden; /* resizeInput grows the box; JS flips to auto only at max-height */
  border-radius: 999px;
  padding: 13px 18px;
  line-height: 1.35;
  background: #ffffff;
}

.composer-tool {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.mic-tool {
  position: relative;
  color: var(--purple);
}

/* The mic glyph is now an inline SVG in the button; neutralize the old CSS-drawn pseudos. */
.mic-tool::before,
.mic-tool::after {
  content: none;
}

.mic-tool svg {
  display: block;
}

.context-card {
  padding: 18px;
  margin-bottom: 14px;
}

.context-card h2 {
  font-size: var(--text-base);
  margin-bottom: 10px;
}

.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;
}

.feedback-row{width:fit-content;max-width:100%;display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:16px;padding:6px 10px;border:1px solid #ece8f6;border-radius:18px;font-size: var(--text-xs);}

.feedback-row[hidden]{display:none!important;}

.exam-stats,
.parent-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.exam-layout {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr) minmax(240px, 280px);
  gap: 18px;
  align-items: start;
}

.topic-panel,
.question-panel,
.session-panel {
  padding: 22px;
}

.topic-panel h2,
.session-panel h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: var(--text-lg);
  line-height: 1.2;
}

.topic-row {
  margin-top: 16px;
}

.topic-row label {
  display: flex;
  justify-content: space-between;
  margin: 0 0 8px;
  color: #31345f;
  font-size: var(--text-xs);
}

.question-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  color: #6b6f9b;
  font-size: var(--text-xs);
  font-weight: 800;
}

.answers {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.answer-choice {
  min-height: 56px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 2px solid #e2def0;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #24265c;
  font-weight: 800;
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.answer-choice.selected {
  border-color: var(--purple);
  background: #f7f3ff;
}

.answer-choice.is-correct {
  border-color: var(--tone-green);
  background: #f1fff7;
}

.session-dots {
  display: grid;
  grid-template-columns: repeat(5, 28px);
  gap: 8px;
  margin-top: 14px;
}

.session-dots span {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid #dad5ee;
  color: var(--purple);
  font-size: var(--text-xs);
  font-weight: var(--w-title);
}

.session-dots .done {
  color: #ffffff;
  background: var(--tone-green);
  border-color: var(--tone-green);
}

.concept-booster {
  min-height: 72px;
  margin-top: 22px;
  padding: 18px 24px;
  display: grid;
  grid-template-columns: 38px 1fr 120px;
  gap: 14px;
  align-items: center;
  background: #f8f6ff;
}

.workspace-status {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e5dff7;
  border-radius: 8px;
  padding: 10px 12px;
  color: #3c4169;
  background: #fbf9ff;
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: 1.35;
}

.workspace-status::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 999px;
  background: var(--tone-green);
  box-shadow: 0 0 0 4px rgba(57, 184, 107, 0.13);
}

.writing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: 18px;
  align-items: start;
}

.editor-panel,
.feedback-panel {
  padding: 22px;
}

.essay-box {
  min-height: 360px;
  border: 1px solid #e4e0f0;
  border-radius: 8px;
  padding: 20px;
  background: #fffefe;
  outline: 0;
  overflow: auto;
}

.essay-box:focus {
  border-color: #bcaeff;
  box-shadow: 0 0 0 4px rgba(110, 61, 244, 0.1);
}

.highlight-green {
  background: #e0f7df;
  color: #166c2e;
  border-radius: 5px;
  padding: 0 3px;
}

.highlight-orange {
  background: #fff1d8;
  color: #a35c00;
  border-radius: 5px;
  padding: 0 3px;
}

.editor-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.tool-icons {
  display: flex;
  gap: 8px;
}

.tool-icons button {
  /* 44px tap floor (was 36px) — Writing Coach formatting controls on a kids' app. */
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: #555b81;
  background: #f8f6ff;
  font-size: var(--text-xs);
  font-weight: var(--w-title);
  cursor: pointer;
}

.tool-icons button:hover,
.tool-icons button.active {
  color: var(--purple);
  background: var(--lavender);
}

.score-card {
  min-height: 82px;
  padding: 18px;
  background: #fbfaff;
}

.score-value {
  color: #24a05a;
  font-size: var(--text-2xl);
  font-weight: 900;
}

.suggestion-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.suggestion {
  padding: 14px;
  border: 1px solid #ece8f6;
  border-radius: 8px;
}

.suggestion h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: var(--text-base);
}

.parent-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 370px);
  gap: 18px;
  align-items: start;
}

.parent-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.parent-panel {
  padding: 22px;
}

.bar-chart {
  height: 150px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  align-items: end;
  border-bottom: 1px solid #ece8f6;
  padding: 0 8px 12px;
}

.bar-group {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5px;
  height: 100%;
}

.bar-group span {
  width: 10px;
  min-height: 18px;
  border-radius: 999px 999px 0 0;
  background: #7442f3;
  height: var(--h, 50%);
}

.bar-group span:last-child {
  background: #ded8f5;
  height: var(--h2, 45%);
}

.recommend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.recommend-card {
  min-height: 112px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  background: var(--tone-bg, #eef7ff);
}

.teen-workflow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.workflow-stack {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.teen-workflow-grid > *,
.workflow-stack > *,
.project-grid > *,
.brief-grid > *,
.career-grid > *,
.research-plan > * {
  min-width: 0;
}

.workflow-hero-card {
  min-height: 190px;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 24px;
  align-items: center;
  background:
    radial-gradient(circle at 86% 34%, rgba(110, 61, 244, 0.14), transparent 26%),
    radial-gradient(circle at 96% 90%, rgba(22, 184, 170, 0.08), transparent 24%),
    linear-gradient(135deg, #ffffff, #f7f4ff);
}

.workflow-hero-card h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 2vw, 34px);
}

.workflow-hero-card .primary-action {
  width: fit-content;
  margin-top: 16px;
}

.workflow-orb {
  width: 118px;
  height: 118px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  justify-self: end;
  color: #ffffff;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.34), transparent 32%),
    linear-gradient(135deg, #7343f4, var(--purple-deep));
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 20px 38px rgba(74, 32, 184, 0.22);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0;
}

.workflow-orb svg {
  width: 46px;
  height: 46px;
  stroke-width: 1.65;
}

.workflow-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.workflow-card {
  padding: 20px;
}

.workflow-card h2,
.project-card h3,
.brief-card h3,
.career-card h3,
.research-step h3,
.path-item h3 {
  margin: 0;
  color: var(--ink);
  line-height: 1.18;
}

.workflow-card h2 {
  margin-bottom: 14px;
  font-size: clamp(20px, 1.35vw, 26px);
}

.project-card h3,
.brief-card h3,
.career-card h3,
.research-step h3,
.path-item h3 {
  font-size: var(--text-base);
}

.workflow-card p,
.project-card p,
.brief-card p,
.career-card p,
.research-step p,
.path-item p {
  margin: 7px 0 0;
  color: #5f6385;
  line-height: 1.45;
}

.project-grid,
.brief-grid,
.career-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.project-card,
.brief-card,
.career-card {
  min-height: 150px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 249, 255, 0.94));
}

.project-card .ghost-action,
.brief-card .ghost-action,
.career-card .ghost-action {
  width: 100%;
}

.code-window {
  border: 1px solid #ded8ef;
  border-radius: 8px;
  overflow: hidden;
  background: var(--ink);
  color: #f7f5ff;
}

.code-window-header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  background: #1c1b52;
}

.code-window-header span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #8b7dff;
}

.code-window pre {
  margin: 0;
  padding: 18px;
  overflow: auto;
  font-size: var(--text-sm);
  line-height: 1.65;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.code-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.code-output {
  margin-top: 12px;
  border: 1px solid #e7e2f4;
  border-radius: 8px;
  padding: 12px;
  color: #3b4167;
  background: #ffffff;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.lesson-path {
  display: grid;
  gap: 12px;
}

.path-item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #ebe7f6;
  border-radius: 8px;
  background: #ffffff;
}

.path-step {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--purple);
  font-size: var(--text-xs);
  font-weight: var(--w-title);
}

.path-status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ded7fb;
  border-radius: 999px;
  padding: 5px 10px;
  color: #514f74;
  background: #fbf9ff;
  font-size: var(--text-xs);
  font-weight: var(--w-title);
  line-height: 1;
  white-space: nowrap;
}

.path-status.is-complete {
  color: #24784f;
  border-color: rgba(84, 200, 142, 0.35);
  background: #effbf5;
}

.path-status.is-current {
  color: var(--purple-press);
  border-color: rgba(110, 61, 244, 0.28);
  background: #f2edff;
}

.path-status.is-locked {
  color: #626b8f;
  background: #f6f5fb;
}

.civics-meter {
  display: grid;
  gap: 12px;
}

.meter-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  color: #454a75;
  font-size: var(--text-xs);
  font-weight: 800;
}

.research-plan {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.research-step {
  padding: 18px;
  min-height: 140px;
}

.research-step .ghost-action,
.career-card .ghost-action {
  width: 100%;
  margin-top: 16px;
}

.career-match {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.skill-tags span {
  border: 1px solid #dcd4ff;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--purple-press);
  background: #fbf9ff;
  font-size: var(--text-xs);
  font-weight: 800;
}

.ux-toast {
  position: fixed;
  left: clamp(14px, 2vw, 28px);
  bottom: clamp(18px, 2vw, 30px);
  z-index: 60;
  max-width: min(440px, calc(100vw - 28px));
  border: 1px solid #d8d0ff;
  border-radius: 8px;
  padding: 12px 14px;
  color: #171548;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-3);
  font-size: var(--text-sm);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.ux-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.ux-inline-note {
  margin-top: 12px;
  border: 1px solid #e4def8;
  border-radius: 8px;
  padding: 12px;
  color: #444970;
  background: #fbf9ff;
  font-size: var(--text-xs);
  line-height: 1.45;
}

@media (max-width: 1500px) {
  .study-topbar {
    height: auto;
    grid-template-columns: max-content 1fr;
    grid-template-areas:
      "brand actions"
      "nav nav";
    row-gap: 6px;
    padding-block: 10px;
  }

  .study-logo {
    grid-area: brand;
  }

  .study-nav {
    grid-area: nav;
    justify-content: flex-start;
    height: 44px;
    padding-bottom: 2px;
  }

  .top-actions {
    grid-area: actions;
  }

  .study-nav a.active::after {
    bottom: -5px;
  }

  .exam-layout {
    grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  }

  .teen-workflow-grid {
    grid-template-columns: 1fr;
  }

  .session-panel {
    grid-column: 1 / -1;
  }

  .chat-workspace {
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  }

  .chat-context {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
  }

.chat-context .context-card {
    margin-bottom: 0;
  }
}

@media (min-width: 1501px) {
  .chat-page-container .chat-workspace {
    height: calc(100vh - 112px);
    max-height: 860px;
  }

  .chat-page-container .chat-history,
  .chat-page-container .chat-context,
  .chat-page-container .chat-shell {
    height: 100%;
    max-height: 100%;
  }

  .chat-workspace {
    height: calc(100vh - 118px);
    min-height: 640px;
  }

  .chat-history,
  .chat-context,
  .chat-shell {
    height: 100%;
    min-height: 0;
    max-height: none;
  }
}

@media (min-width: 1121px) and (max-width: 1500px) {
  .chat-shell,
  .chat-history {
    height: calc(100vh - 160px);
    min-height: 620px;
  }
}

/* 1121–1199: below the ≥1200 rail breakpoint, the sticky two-band top header (~111px) is present,
   so the sticky chat side-panels must start below it — not at the 92px used under the ≥1200 pill. */
@media (min-width: 1121px) and (max-width: 1199px) {
  .chat-history,
  .chat-context {
    top: 120px;
    max-height: calc(100vh - 132px);
  }
}

/* 1121–1500 (desktop, below the 3-column threshold): the right context rail can't fit, and letting
   it collapse to a full-width band below the chat looked orphaned AND duplicated the "Safe mode on"
   card already shown in the Starters panel. The context rail is a ≥1501 wide-screen enhancement;
   hide it here (Starters carries the safety context). Mobile ≤1120 still stacks it in flow. */
@media (min-width: 1121px) and (max-width: 1500px) {
  .chat-context {
    display: none;
  }
}

@media (max-width: 1120px) {
  .study-topbar {
    column-gap: 10px;
  }

  .study-logo {
    font-size: var(--text-xl);
  }

  .study-nav {
    gap: 6px;
    padding-inline: 2px;
  }

  .study-nav a {
    gap: 6px;
    padding-inline: 8px;
    font-size: var(--text-xs);
  }

  .nav-glyph {
    width: 19px;
    height: 19px;
    flex-basis: 19px;
  }

  .top-actions {
    gap: 8px;
  }

  .top-status {
    max-width: 240px;
  }

  .top-status-chip {
    padding-inline: 8px;
  }

  .profile-menu {
    min-width: 44px;
    grid-template-columns: 36px;
    padding: 3px;
  }

  .profile-menu > span:not(.profile-face) {
    display: none;
  }

  .floating-duggu {
    display: none;
  }

  .study-hero,
  .ask-layout,
  .chat-workspace,
  .answer-grid,
  .writing-layout,
  .parent-grid {
    grid-template-columns: 1fr;
  }

  .chat-history,
  .chat-context {
    position: static;
    max-height: none;
  }

  .chat-history {
    min-height: 0;
    order: 2;
  }

  .chat-shell {
    order: 1;
  }

  .chat-context {
    order: 3;
  }

  .chat-history .history-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 761-899px stacked hero: mascot centers under the chips; the "I'm Duggu" bubble
     landed on the mascot's face at these widths, so it rests until the side-by-side
     hero returns at >=900px. */
  .duggu-orb {
    justify-self: center;
  }

  .duggu-orb::after {
    display: none;
  }

  .snapshot-grid,
  .exam-stats,
  .parent-stats,
  .parent-main-grid,
  .recommend-grid,
  .source-related,
  .chat-context,
  .project-grid,
  .brief-grid,
  .career-grid,
  .research-plan {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) and (max-width: 1120px) {
  .study-hero {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
    padding: 30px 48px;
    min-height: 320px;
  }

  .duggu-orb {
    justify-self: center;
  }

  .duggu-orb::after {
    right: -6px;
    left: auto;
    top: 18px;
  }
}

@media (min-width: 761px) and (max-width: 1120px) {
  .chat-shell {
    height: calc(100vh - 156px);
    min-height: 620px;
  }
}

@media (max-width: 760px) {
  .study-app-body {
    font-size: var(--text-base);
  }

  /* Keep the two-band header (brand+actions / nav) from the <=1500px rules and compact it.
     The old rules here stacked brand, actions and nav into three full-width sticky rows
     (~200px of chrome on a 360x740 phone). Two independent bands, no band's height depends
     on a sibling: sticky chrome is now ~104px. */
  .study-topbar {
    width: 100%;
    padding-inline: 14px;
    row-gap: 2px;
  }

  .study-container {
    width: calc(100% - 24px);
    padding-top: 14px;
  }

  .study-nav {
    width: 100%;
    min-width: 0;
  }

  .top-actions {
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
  }

  /* The age/guardrail status chips duplicate facts already in the page content (snapshot
     cards, profile). They scroll with the page on phones instead of stealing sticky space. */
  .top-actions .top-status {
    display: none;
  }

  .profile-menu {
    min-width: 0;
    padding: 4px;
  }

  /* Avatar-only profile pill: the two-line text label doesn't fit the compact band. */
  .profile-menu > span:not(.profile-face) {
    display: none;
  }

  .study-hero {
    padding: 24px;
  }

  .study-searchbar {
    width: 100%;
    grid-template-columns: 20px 1fr 40px;
  }

  .study-app .prompt-pills {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .snapshot-grid,
  .exam-stats,
  .parent-stats,
  .parent-main-grid,
  .recommend-grid,
  .source-related,
  .exam-layout,
  .concept-booster,
  .tip-strip,
  .project-grid,
  .brief-grid,
  .career-grid,
  .research-plan,
  .workflow-stats,
  .workflow-hero-card {
    grid-template-columns: 1fr;
  }

  .workflow-orb {
    justify-self: start;
  }

  .duggu-orb::after {
    display: none;
  }

  .answer-panel,
  .chat-shell,
  .question-panel,
  .editor-panel,
  .feedback-panel,
  .parent-panel,
  .topic-panel,
  .session-panel {
    padding: 18px;
  }

  .chat-history .history-list,
  .chat-context,
  .chat-answer-grid {
    grid-template-columns: 1fr;
  }

  .chat-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-header-actions {
    justify-content: flex-start;
  }

  .chat-thread {
    padding: 16px;
  }

  .chat-turn,
  .user-turn {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .user-turn .chat-avatar {
    grid-column: 1;
  }

  .user-turn .chat-bubble {
    grid-column: 2;
    justify-self: start;
  }

  .chat-avatar {
    width: 32px;
    height: 32px;
  }

  .chat-bubble,
  .user-bubble {
    max-width: 100%;
  }

  .chat-composer {
    padding: 12px;
    gap: 8px;
  }
}

.chat-bubble.thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.thinking-label {
  color: var(--muted);
  font-weight: 700;
}
.thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.thinking-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple);
  opacity: 0.35;
  animation: duggu-think 1s ease-in-out infinite;
}
.thinking-dots i:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots i:nth-child(3) { animation-delay: 0.30s; }
@keyframes duggu-think {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.chat-composer[aria-busy="true"] {
  opacity: 0.72;
}
.chat-composer[aria-busy="true"] textarea {
  pointer-events: none;
}
/* #2 Cancel & move on: while an answer streams the send button becomes a red Stop button (a white
   square) — it stays clickable so the child can stop and immediately ask the next question. */
.send-circle.is-stop {
  background: linear-gradient(135deg, #ff6f61, #d8321f);
  box-shadow: 0 10px 22px rgba(216, 50, 31, 0.28);
}
.send-circle.is-stop::before {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 3px;
  transform: none;
  background: currentColor;
}

.chat-bubble.ux-error {
  border: 1px solid #f2c8bf;
  background: #fff6f3;
}
.ux-error-msg {
  margin: 0 0 10px;
  color: #a2371f;
  font-weight: 700;
}
.chat-bubble.ux-error .ux-retry {
  min-height: 40px;
  padding: 8px 16px;
}

.consent-intro {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin: 0 0 6px;
}
.consent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid rgba(110, 61, 244, 0.14);
  cursor: pointer;
}
.consent-required { cursor: default; }
.consent-copy strong {
  display: block;
  color: #17256b;
  font-size: var(--text-base);
}
.consent-copy span {
  display: block;
  color: #53649b;
  font-size: var(--text-xs);
  margin-top: 2px;
  line-height: 1.4;
}
.consent-badge {
  flex: 0 0 auto;
  background: var(--mint);
  color: #1c6b48;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: var(--text-xs);
  font-weight: 800;
}
.consent-agree {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 16px 0 0;
  color: #17256b;
  font-size: var(--text-sm);
  line-height: 1.42;
  cursor: pointer;
}
.consent-agree input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--purple);
}
.consent-legal {
  color: #53649b;
  font-size: var(--text-xs);
  margin: 12px 0 0;
  line-height: 1.5;
}

.switch {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 46px;
  height: 28px;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d6d2ee;
  transition: background 0.16s ease;
}
.switch-track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.16s ease;
}
.switch input:checked + .switch-track { background: var(--purple); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--purple-deep);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .thinking-dots i { animation: none; opacity: 0.6; }
  .switch-track,
  .switch-track::before { transition: none; }
}

/* ============================================================================
   WEB UX FOUNDATIONS (2026-07-10) — structural rules shared across the app.
   Root-cause fixes; no pixel-budget coupling between siblings.
   ============================================================================ */

/* Short viewports (landscape phones): chrome scrolls away instead of owning
   half the screen. Applies at any width. */
@media (max-height: 480px) {
  .study-topbar {
    position: static;
  }
}

/* --- Scroll rails (nav, prompt chips, subtabs) -------------------------------
   Horizontally scrollable rows never show a raw scrollbar and always signal
   overflow with an edge fade. .fade-start/.fade-end are toggled by
   initScrollRails() in study-app.js from real scroll metrics — the fade never
   hides a fully-scrolled edge. */
.scroll-rail {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.scroll-rail::-webkit-scrollbar {
  display: none;
}

.scroll-rail.fade-end {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}

.scroll-rail.fade-start {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px);
  mask-image: linear-gradient(90deg, transparent, #000 40px);
}

.scroll-rail.fade-start.fade-end {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
}

/* Prompt-chip rows scroll as rails on all widths (wrap is fine on desktop where
   they fit; nowrap only when the rail actually scrolls on compact screens). */
@media (max-width: 760px) {
  .study-app .prompt-pills.scroll-rail,
  .subtabs.scroll-rail {
    flex-wrap: nowrap;
  }
}

/* Subtabs: never wrap raggedly, never miss the 44px tap floor. */
.subtabs {
  min-height: 44px;
  align-items: stretch;
}

.subtabs a,
.subtabs button {
  display: inline-flex;
  align-items: end;
  white-space: nowrap;
  min-height: 44px;
}

/* --- Answer bubble: no sibling coupling --------------------------------------
   The title+note column must never be squeezed by the type pill (it collapsed
   to 84px — one word per line). The text column owns the width; the pill wraps
   under it when space runs out. */
.answer-head {
  flex-wrap: wrap;
  align-items: flex-start;
}

.answer-head > div {
  flex: 1 1 16ch;
  min-width: 0;
}

.answer-head > .pill {
  flex: 0 0 auto;
}

.feedback-row .mini-feedback,
.feedback-row .report-link {
  min-height: 40px;
}

/* --- Floating coach button ----------------------------------------------------
   Bottom-right (canonical FAB position) instead of overlapping the hero's top
   corner; hidden on phones (the nav rail already reaches Ask Duggu in one tap). */
.floating-duggu {
  top: auto;
  bottom: 22px;
  right: 22px;
}

/* Reserve the fixed FAB's bottom-right footprint (~54px + 22px offset) as page-end clearance so it
   never overlaps the last content — e.g. the home "See tips" button sat under it. Only where the FAB
   is actually shown (>760px; it's hidden on phones). */
@media (min-width: 761px) {
  .study-container {
    padding-bottom: 92px;
  }
}

@media (max-width: 760px) {
  .floating-duggu {
    display: none;
  }
}

/* Content-driven card heights on compact screens — fixed min-heights left the numbered
   step cards and hero tiles mostly empty at phone widths. */
@media (max-width: 760px) {
  .project-card,
  .brief-card,
  .career-card,
  .snapshot-card {
    min-height: 0;
  }

  .workflow-hero-card {
    min-height: 0;
  }

  .workflow-orb {
    width: 76px;
    height: 76px;
    border-radius: 20px;
  }

  .workflow-orb svg {
    width: 32px;
    height: 32px;
  }
}

/* ============================================================================
   MOTION CANON (2026-07-10) — one hover/press language for every interactive
   surface, driven by the motion tokens. Hover only on real pointers.
   ============================================================================ */
.study-card,
.study-app .module-card,
.primary-action,
.ghost-action,
.auth-btn,
.prompt-pills button,
.study-nav a,
.app-back {
  transition:
    transform var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    background-color var(--dur-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  a.study-card:hover,
  .study-app a.module-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
  }

  .primary-action:hover,
  .auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
  }

  .prompt-pills button:hover,
  .ghost-action:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-1);
  }
}

a.study-card:active,
.study-app a.module-card:active,
.primary-action:active,
.ghost-action:active,
.auth-btn:active,
.prompt-pills button:active {
  transform: translateY(0) scale(0.99);
  transition-duration: var(--dur-fast);
}

@media (prefers-reduced-motion: reduce) {
  .study-card,
  .study-app .module-card,
  .primary-action,
  .ghost-action,
  .auth-btn,
  .prompt-pills button,
  .study-nav a,
  .app-back {
    transition: none;
  }
}

/* Mascot display stays within the 439x640 master (never upscales). The full stage
   treatment — warm spotlight, ground shadow, idle float — lives with .duggu-orb above. */
.duggu-orb {
  max-width: 300px;
  max-height: 288px;
}

/* Parent-zone: guardian-name greeting + backfill card (parity with mobile family hub). */
.page-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--w-label);
}

.parent-name-card {
  margin: 0 0 18px;
  display: grid;
  gap: 10px;
}

.parent-name-card h3 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--w-title);
  color: var(--ink);
}

.parent-name-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.parent-name-row input {
  flex: 1 1 220px;
  min-width: 0;
  font-size: 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid rgba(110, 61, 244, 0.18);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.parent-name-row input:focus {
  outline: 0;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(110, 61, 244, 0.18);
}

.parent-name-row .primary-action {
  flex: 0 0 auto;
}

.parent-name-error {
  margin: 0;
  color: #c0392b;
  font-size: var(--text-sm);
}

/* Screen-time honest empty state (no fabricated bars). */
.chart-empty {
  position: relative;
  height: 168px;
  margin-top: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(110, 61, 244, 0.04), rgba(110, 61, 244, 0.02));
  border: 1px solid var(--line);
}

.chart-empty-grid {
  position: absolute;
  inset: 16px 16px 26px;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
}

.chart-empty-grid span {
  border-bottom: 1px dashed rgba(110, 61, 244, 0.12);
}

.chart-empty-body {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 4px;
  padding: 0 20px;
}

.chart-empty-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.6), transparent 40%),
    color-mix(in srgb, var(--purple) 16%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--purple) 26%, #ffffff);
  position: relative;
}

.chart-empty-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 44%, color-mix(in srgb, var(--purple) 55%, #ffffff) 44% 56%, transparent 56%),
              linear-gradient(0deg, transparent 30%, color-mix(in srgb, var(--purple) 55%, #ffffff) 30% 34%, transparent 34%);
  opacity: 0.7;
}

.chart-empty-title {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--w-title);
}

.chart-empty-note {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: var(--w-body);
  max-width: 26ch;
}

/* Notifications popover (honest empty affordance; bell no longer navigates away). */
.notif-pop {
  position: fixed;
  top: 84px;
  right: clamp(12px, 3vw, 40px);
  z-index: 60;
  width: min(280px, calc(100vw - 24px));
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  text-align: center;
  display: grid;
  gap: 4px;
  justify-items: center;
}

.notif-pop[hidden] { display: none; }

.notif-pop .notif-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  color: var(--purple);
  background: color-mix(in srgb, var(--purple) 12%, #ffffff);
}

.notif-pop strong { color: var(--ink); font-size: var(--text-base); font-weight: var(--w-title); }
.notif-pop span { color: var(--muted); font-size: var(--text-sm); font-weight: var(--w-body); }

/* Per-module richness (#7, no raster art): each card carries a subtle wash + affordance in its
   own tone, so tools read as distinct and illustrated rather than uniform white boxes. --tone is
   set on the card; the icon inherits it. */
.study-app .module-card {
  background-image:
    radial-gradient(150px 130px at 6% 0%, color-mix(in srgb, var(--tone, var(--purple)) 9%, transparent), transparent 72%);
}

@media (hover: hover) and (pointer: fine) {
  .study-app a.module-card:hover {
    background-image:
      radial-gradient(170px 150px at 6% 0%, color-mix(in srgb, var(--tone, var(--purple)) 15%, transparent), transparent 74%);
  }
}

/* Bigger, tone-forward icon badge. */
.study-app .module-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
}

.study-app .module-icon svg {
  width: 24px;
  height: 24px;
}

/* The corner "go" affordance takes the module tone (was fixed purple). */
.study-app .module-card::before {
  border-top-color: var(--tone, var(--purple));
  border-right-color: var(--tone, var(--purple));
}

/* Long-name safety (negative case: 80-char / no-space guardian or child names must not spill).
   Greeting truncates with ellipsis; the profile name in the compact bar does too. */
.page-sub {
  max-width: 100%;
  overflow-wrap: anywhere;
}

[data-parent-greeting] {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.profile-menu strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22ch;
}

/* Module-page intro card (honest launcher pages: exam-prep etc.). */
.module-intro {
  margin-bottom: 18px;
  display: grid;
  gap: 4px;
}
.module-intro > p:first-child {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--w-label);
}
.module-intro > p:last-child {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-base);
  font-weight: var(--w-body);
  max-width: 68ch;
}

/* Launcher grid for honest module pages — same width-derived layout as .module-grid but a
   distinct class so study-api hydrateHome (which rewrites .module-grid) never overwrites it. */
.study-app .launch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* Empty-state placeholder for the Writing Coach contenteditable (child's own draft). */
.essay-box:empty::before,
.essay-box[data-empty="1"]::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-weight: var(--w-body);
  pointer-events: none;
}

/* CTA affordance for card-links that route to Ask Duggu (brief/project/career/research cards
   converted from placebo buttons to real hand-offs). */
.brief-cta {
  display: inline-block;
  margin-top: 4px;
  color: var(--purple-deep);
  font-size: var(--text-sm);
  font-weight: var(--w-title);
}
a.brief-card,
a.project-card,
a.career-card,
a.research-step {
  text-decoration: none;
  color: inherit;
}

/* Parent Zone PIN gate. Pre-paint adds .parent-locked to <html>, hiding the dashboard until the
   family PIN unlocks it (protects parent territory from the child on a shared device). */
:root.parent-locked .study-app {
  visibility: hidden;
}

.parent-pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(241, 237, 255, 0.96), rgba(255, 255, 255, 0.96) 42%, rgba(245, 250, 255, 0.94));
}

.parent-pin-overlay[hidden] { display: none; }

/* Fail-safe: .parent-locked is set by a PRE-PAINT inline script, so it's present even if the main
   study JS never boots (network/CSP/script error). Showing the overlay from that class alone means
   the page degrades to the unlock UI instead of a blank screen (the dashboard stays hidden =
   fail-closed). Wins over [hidden] by specificity; JS clears .parent-locked on a real unlock. */
:root.parent-locked .parent-pin-overlay[data-parent-pin] { display: grid; }

.parent-pin-card {
  width: 100%;
  max-width: 360px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  padding: 30px 26px;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.parent-pin-card .logo-mark { width: 44px; height: 44px; }
.parent-pin-card h1 { margin: 6px 0 0; font-size: var(--text-xl); color: var(--ink); }
.parent-pin-card > p.muted { margin: 0; font-size: var(--text-sm); }

.parent-pin-card input {
  width: 100%;
  margin-top: 6px;
  text-align: center;
  letter-spacing: 0.5em;
  font-size: 22px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid rgba(110, 61, 244, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.parent-pin-card input:focus {
  outline: 0;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(110, 61, 244, 0.18);
}

.parent-pin-card .primary-action { width: 100%; margin-top: 2px; }
.parent-pin-error { margin: 0; color: #c0392b; font-size: var(--text-sm); }
.parent-pin-card .auth-link {
  background: none; border: 0; color: var(--purple-deep);
  font-weight: var(--w-label); cursor: pointer; padding: 4px; font-size: var(--text-sm);
}

/* ============================================================================
   FOUNDATIONAL SPILL/DYNAMIC SAFEGUARDS (2026-07-11)
   Structural guarantees so the "text spills / element isn't dynamic" class can't
   recur: long words/names/URLs always wrap, and flex/grid children can always
   shrink below their content width (the #1 cause of overflow in flex/grid).
   ============================================================================ */

/* 1. Long unbreakable strings (names, emails, URLs, long labels) never spill. */
.study-app,
.study-app h1, .study-app h2, .study-app h3, .study-app h4,
.study-app p, .study-app li, .study-app label, .study-app strong,
.parent-pin-card, .auth-card {
  overflow-wrap: anywhere;
}

/* 2. Flex/grid children must be allowed to shrink. Without min-width:0 a child's
   intrinsic content width forces overflow — the classic flex spill. Applied to the
   structural containers (cards, panels, grid/flex items), not to leaf controls. */
.study-app .study-card,
.study-app .parent-panel,
.study-app .module-card > span:last-child,
.study-app .answer-head > div,
.study-app .snapshot-card,
.study-app .brief-card > div,
.study-app .project-card > div,
.study-app .career-card > div,
.study-app .parent-grid > *,
.study-app .parent-main-grid > *,
.study-app .exam-stats > *,
.study-app .parent-stats > *,
.study-app .workflow-stack > * {
  min-width: 0;
}

/* 3. Metric values / headings that could be a single long token stay contained. */
.study-app .metric-value {
  overflow-wrap: anywhere;
}

/* =========================================================================
   Desktop study shell (Phase 6, 2026-07-11): at >=1200px the sticky top bar
   becomes a persistent LEFT NAV RAIL (Duolingo/Khan pattern) + centered
   content. Placed at EOF so it wins source-order over the medium-desktop
   two-band top bar (max-width:1500 block). Pure CSS over existing markup —
   the age-adaptive hydrateNav still rewrites .study-nav; below 1200px the
   top bar is unchanged.
   ========================================================================= */
@media (min-width: 1200px) {
  .study-app {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    align-items: start;
  }

  .study-topbar {
    grid-column: 1;
    grid-row: 1;
    height: 100vh;
    width: var(--rail-w);
    grid-template-columns: none;
    grid-template-areas: none;
    grid-template-rows: auto minmax(0, 1fr);
    row-gap: 8px;
    align-items: stretch;
    padding: 18px 14px 16px;
    border-bottom: 0;
    border-right: 1px solid rgba(218, 211, 243, 0.86);
    box-shadow: var(--shadow-1);
    overflow: hidden;
    /* Drop the blur: backdrop-filter on an ancestor makes position:fixed resolve against
       THIS element (the 248px rail) instead of the viewport, which threw the top-right
       profile cluster to the top-left. The rail bg is near-opaque, so no blur is needed. */
    background: #ffffff;
    backdrop-filter: none;
  }

  .study-topbar > .study-logo {
    grid-area: auto;
    justify-content: flex-start;
    padding: 6px 10px 10px;
  }

  .study-topbar > .study-nav {
    grid-area: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 3px;
    height: auto;
    min-height: 0;
    padding-bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    /* Vertical rail: the horizontal edge-fade mask would clip nav-item text left/right — drop it. */
    -webkit-mask-image: none;
    mask-image: none;
  }

  .study-topbar > .study-nav a {
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
    min-height: 46px;
    padding: 0 12px;
    font-size: var(--text-sm);
  }

  .study-topbar > .study-nav a.active {
    background: var(--lavender);
    color: var(--purple-deep);
  }

  .study-topbar > .study-nav a.active::after {
    display: none;
  }

  /* Utility cluster (search / notifications / profile) floats to a fixed TOP-RIGHT pill —
     the conventional spot — instead of the bottom of the left rail. The rail keeps just
     logo + nav. */
  .study-topbar > .top-actions {
    position: fixed;
    top: 14px;
    right: clamp(16px, 2vw, 28px);
    z-index: 40;
    grid-area: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-top: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-2);
    backdrop-filter: blur(10px);
  }

  .study-topbar > .top-actions .profile-menu {
    width: auto;
  }

  .study-container {
    grid-column: 2;
    grid-row: 1;
    /* Reserve the fixed top-right pill's band (top:14 + ~52 tall + gap) as real top clearance so
       page content — and the chat panel header — never renders underneath the floating pill. */
    padding-top: 78px;
  }
}

/* Answer document styling (Phase 7, 2026-07-11): Duggu's answer renders as a readable
   document (headings, lists, code, links) via the safe renderMarkdown(), not one flat
   paragraph. Scoped to .answer-body so only screened answer text is affected. */
.answer-body {
  display: grid;
  gap: 12px;
  line-height: 1.6;
}
.answer-body > * { margin: 0; }
.answer-body h3 { font-size: var(--text-lg); font-weight: var(--w-title); letter-spacing: var(--tracking-tight); }
.answer-body h4 { font-size: var(--text-base); font-weight: var(--w-title); }
.answer-body p { line-height: 1.6; }
.answer-body ul,
.answer-body ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.answer-body li { line-height: 1.55; }
.answer-body strong { font-weight: var(--w-title); }
.answer-body a { color: var(--purple); font-weight: 700; text-decoration: underline; }
.answer-body code {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
}
.answer-body pre {
  overflow-x: auto;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #1c1830;
  color: #ece9ff;
}
.answer-body pre code {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font-size: 0.88em;
}

/* =========================================================================
   Phase 7 (2026-07-11): voice dictation state, message grouping, document
   answers, and the quiz ChoiceButton state machine.
   ========================================================================= */

/* Voice listening state — a calm pulsing ring on the mic while the browser is
   transcribing, so the child can see they're being heard. */
.chat-composer.is-listening .mic-tool {
  color: #fff;
  background: var(--purple);
  border-color: var(--purple);
  box-shadow: 0 0 0 0 rgba(110, 61, 244, 0.45);
  animation: mic-pulse 1.4s var(--ease-out) infinite;
}
@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(110, 61, 244, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(110, 61, 244, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 61, 244, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-composer.is-listening .mic-tool { animation: none; }
}

/* Message grouping — a continuation turn (same sender as the one above) hides its
   avatar and tightens the gap so a multi-part reply reads as one block. */
.chat-turn.continuation { margin-top: -8px; }
.chat-turn.continuation .chat-avatar { visibility: hidden; }

/* Document-style answers — a real answer (has .answer-body) reads as a full-width
   document, not a shadowed card with a repeated avatar. Nudge/error/thinking bubbles
   keep their card chrome. */
.assistant-turn:has(.answer-body) { grid-template-columns: minmax(0, 1fr); }
.assistant-turn:has(.answer-body) .chat-avatar { display: none; }
.assistant-bubble:has(.answer-body) {
  max-width: var(--reading-max);
  border: 0;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
  padding: 2px 0 4px;
}

/* "Simpler" refine chip — a distinct, friendly accent vs the rating chips. */
.mini-feedback.refine-chip {
  color: var(--purple-deep);
  border-color: #c7b8ff;
  background: #f3efff;
}
.mini-feedback.refine-chip:hover,
.mini-feedback.refine-chip:focus-visible {
  color: #fff;
  border-color: var(--purple);
  background: var(--purple);
}

/* Quiz ChoiceButton state machine — colour + icon swaps only, never a resize. */
.answer-choice:hover { border-color: var(--line-strong); }
.answer-choice.selected {
  border-color: var(--purple);
  background: var(--lavender);
  color: var(--purple-deep);
}
.answer-choice.correct { border-color: var(--tone-green); background: var(--mint); }
.answer-choice.incorrect { border-color: var(--tone-red); background: var(--rose); }
