/* Learn: classes 1-12 and UPSC. Loaded after app.css and reuses its tokens. */

:root {
  --serif: "New York", "Iowan Old Style", Charter, "Source Serif Pro", Georgia, "Noto Serif", "Noto Serif Devanagari", serif;
  --guru-w: 400px;
  --tap: 44px;
  --paper: #fbf7ef;
  --paper-ink: #3b2f20;
  --kid-1: #ff6b6b;
  --kid-2: #ffb020;
  --kid-3: #2ec27e;
  --kid-4: #3b82f6;
  --kid-5: #a855f7;
  --ok-soft: color-mix(in srgb, var(--ok) 14%, transparent);
  --bad-soft: color-mix(in srgb, var(--bad) 12%, transparent);
  --card-ring: 0 0 0 0.5px var(--line-strong);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #2a2620; --paper-ink: #efe6d6; }
}
:root[data-theme="dark"] { --paper: #2a2620; --paper-ink: #efe6d6; }

/* Accessibility toggles (classes on <html>) */

.a11y-big body { font-size: 17px; }
.a11y-big .learn-view { --scale: 1.12; }
.a11y-dyslexia body, .a11y-dyslexia .learn button, .a11y-dyslexia .learn input, .a11y-dyslexia .learn textarea, .a11y-dyslexia .learn select {
  font-family: "OpenDyslexic", "Atkinson Hyperlegible", Verdana, Tahoma, "Noto Sans", sans-serif;
  letter-spacing: 0.035em; word-spacing: 0.14em;
}
.a11y-dyslexia .learn-view { line-height: 1.8; }
.a11y-dyslexia .learn-view :is(h1, h2, h3, .serif, .answer-text, .pq-question, .digest-headline) {
  font-family: "OpenDyslexic", "Atkinson Hyperlegible", Verdana, Tahoma, sans-serif; font-style: normal; letter-spacing: 0.02em;
}
.a11y-dyslexia .answer-text { text-align: left; }
.a11y-contrast {
  --text: #000; --text-2: #1d1d1f; --text-3: #3a3a3c;
  --line: rgba(0, 0, 0, 0.35); --line-strong: rgba(0, 0, 0, 0.6);
  --accent: #0040b0; --accent-press: #002f85; --raised: #ececec; --sidebar: #f2f2f2;
}
@media (prefers-color-scheme: dark) {
  .a11y-contrast:not([data-theme="light"]) {
    --text: #fff; --text-2: #f2f2f2; --text-3: #d0d0d0;
    --line: rgba(255, 255, 255, 0.45); --line-strong: rgba(255, 255, 255, 0.7);
    --accent: #6cb6ff; --accent-press: #9ccdff; --bg: #000; --surface: #111; --raised: #1c1c1c; --sidebar: #0a0a0a;
  }
}
.a11y-contrast :focus-visible { outline: 3px solid var(--text); }
.a11y-motion *, .a11y-motion *::before, .a11y-motion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

/* Layout */

.learn-app { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100%; transition: grid-template-columns 0.35s var(--ease); }
.learn-subnav { max-width: 1136px; flex-wrap: wrap; }
.learn-subnav .subnav-tools { flex-wrap: wrap; }
.learn-subnav .nav-badge { min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.learn-subnav .learn-search { position: relative; width: 220px; height: 36px; margin: 0; border-radius: 999px; box-shadow: none; }
.learn-subnav .search-pop { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(360px, 86vw); }
.learn-reading { position: relative; }
.learn-reading > summary { list-style: none; }
.learn-reading > summary::-webkit-details-marker { display: none; }
.learn-reading-pop {
  position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; display: flex; flex-direction: column; gap: 8px; width: 290px; padding: 8px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md);
}
.learn-main { padding-bottom: 120px; }
.learn-view { max-width: 1080px; margin: 0 auto; padding: 8px 28px 40px; }
.learn-view:focus { outline: none; }
a.nav-item { color: inherit; text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--press); font-weight: 600; }
.nav-item[aria-current="page"] .nav-icon { color: var(--text); }

.learn-search {
  display: flex; align-items: center; gap: 8px; margin: 2px 0 0; padding: 0 10px; height: 38px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm);
  color: var(--text-3);
}
.learn-search svg { width: 17px; height: 17px; }
.learn-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); }
.search-pop {
  margin-top: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  box-shadow: var(--shadow-md); max-height: 320px; overflow-y: auto;
}
.search-pop a, .search-pop p { display: block; padding: 8px 10px; border-radius: 9px; color: var(--text); text-decoration: none; font-size: 14px; margin: 0; }
.search-pop a:hover, .search-pop a:focus-visible { background: var(--hover); }
.search-pop small { display: block; color: var(--text-2); font-size: 12px; }
.search-pop p { color: var(--text-2); }

.learn-a11y { gap: 2px; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; padding: 2px 10px; font-size: 14px; color: var(--text-2); }
.switch.small { width: 40px; height: 24px; }
.switch.small .track::after { width: 20px; height: 20px; }
.switch.small input:checked + .visually-hidden + .track::after { transform: translateX(16px); }
.switch.small input:focus-visible + .visually-hidden + .track { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

.device-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px; border-radius: 12px; background: var(--raised); color: var(--text-2); font-size: 12px; line-height: 1.4; }
.device-note svg { width: 16px; height: 16px; margin-top: 1px; }

.lang-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px 0 12px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text-2);
}
.lang-pill svg { width: 16px; height: 16px; }
.lang-pill select { height: 34px; max-width: 130px; border: 0; outline: none; background: transparent; color: var(--text); font-size: 14px; font-weight: 500; cursor: pointer; }

/* Shared pieces */

.serif { font-family: var(--serif); }
.eyebrow { margin: 0 0 6px; color: var(--text-2); font: 600 12px/1.3 var(--font); letter-spacing: 0.06em; text-transform: uppercase; }
.l-section { margin-top: 36px; }
.l-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.l-section-head h2 { margin: 0; font: 700 22px/1.2 var(--font-display); letter-spacing: -0.025em; }
.l-section-head p { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.link-button { border: 0; background: none; padding: 6px 2px; color: var(--accent); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; }
.link-button:hover { text-decoration: underline; }

.l-card {
  position: relative; display: block; padding: 18px; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); text-decoration: none;
  box-shadow: var(--card-ring), var(--shadow-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
a.l-card:hover, button.l-card:hover { transform: translateY(-2px); box-shadow: var(--card-ring), var(--shadow-md); }
button.l-card { width: 100%; border: 0; text-align: left; font: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap); padding: 0 18px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background 0.15s, transform 0.12s, border-color 0.15s;
}
.btn:hover { background: var(--raised); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-press); }
.btn.dark { border-color: transparent; background: var(--text); color: var(--bg); font-weight: 600; }
.btn.small { min-height: 34px; padding: 0 13px; font-size: 13px; }
.btn.is-on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip-sm {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  background: var(--raised); color: var(--text-2); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
a.chip-sm:hover { color: var(--text); background: var(--press); }

.l-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--text-2);
}
.l-empty .l-empty-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--raised); color: var(--text-2); }
.l-empty .l-empty-icon svg { width: 24px; height: 24px; }
.l-empty h3 { margin: 4px 0 0; color: var(--text); font: 600 17px/1.3 var(--font-display); }
.l-empty p { margin: 0; max-width: 46ch; font-size: 14px; }
.l-empty.compact { padding: 20px; }

.sk { border-radius: 10px; background: var(--raised); animation: shimmer 1.4s infinite; }
.sk-line { height: 12px; margin: 8px 0; }
.sk-block { height: 120px; border-radius: var(--radius-lg); }

/* Home */

.l-hero { display: flex; flex-direction: column; align-items: center; padding: 6vh 0 8px; text-align: center; }
.l-hero h1 { margin: 0; font: 600 clamp(30px, 4.4vw, 40px)/1.12 var(--font-display); letter-spacing: -0.032em; }
.l-hero .l-hero-sub { margin: 10px 0 0; max-width: 52ch; color: var(--text-2); font-size: 16px; }
.seg-lg { width: min(420px, 100%); margin-top: 26px; grid-template-columns: repeat(2, 1fr); padding: 4px; border-radius: 14px; }
.seg-lg span { padding: 10px 12px; border-radius: 10px; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.seg-lg span small { color: var(--text-3); font-weight: 500; font-size: 12px; }

.track-panel { margin-top: 26px; }
.class-picker { display: flex; flex-direction: column; gap: 14px; }
.class-row-label { margin: 0; color: var(--text-2); font-size: 13px; font-weight: 600; }
.class-grid { display: grid; gap: 10px; }
.class-grid.young { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.class-grid.senior { grid-template-columns: repeat(7, minmax(0, 1fr)); }

.class-chip {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 64px; padding: 10px 6px; border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.15s, border-color 0.15s, box-shadow 0.2s;
}
.class-chip:hover { background: var(--raised); }
.class-chip .n { font: 600 22px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.class-chip .w { color: var(--text-2); font-size: 12px; }
.class-chip.is-on { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.class-chip.upsc .n { font-size: 17px; }

.class-chip.kid {
  --kc: var(--kid-4);
  min-height: 112px; border: 0; border-radius: 24px;
  background: color-mix(in srgb, var(--kc) 14%, var(--surface));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--kc) 30%, transparent);
}
.class-chip.kid:hover { transform: translateY(-3px) rotate(-1deg); background: color-mix(in srgb, var(--kc) 20%, var(--surface)); }
.class-chip.kid .kid-icon {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border-radius: 50%;
  background: var(--kc); color: #fff; box-shadow: 0 6px 14px color-mix(in srgb, var(--kc) 35%, transparent);
}
.class-chip.kid .kid-icon svg { width: 24px; height: 24px; stroke-width: 2; }
.class-chip.kid .n { font: 800 26px/1 var(--font-display); color: color-mix(in srgb, var(--kc) 70%, var(--text)); }
.class-chip.kid .w { font-size: 13px; font-weight: 600; color: var(--text-2); }
.class-chip.kid.is-on { box-shadow: inset 0 0 0 3px var(--kc), 0 8px 22px color-mix(in srgb, var(--kc) 28%, transparent); }
.class-chip.kid:nth-child(1) { --kc: var(--kid-1); }
.class-chip.kid:nth-child(2) { --kc: var(--kid-2); }
.class-chip.kid:nth-child(3) { --kc: var(--kid-3); }
.class-chip.kid:nth-child(4) { --kc: var(--kid-4); }
.class-chip.kid:nth-child(5) { --kc: var(--kid-5); }

.board-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; }
.board-line select { height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; margin-top: 36px; }
.home-grid > .l-section { margin-top: 0; }

.continue-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 260px); gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity; }
.continue-card { display: flex; flex-direction: column; gap: 8px; min-height: 132px; scroll-snap-align: start; }
.continue-card .cc-top { display: flex; align-items: center; gap: 10px; }
.continue-card .cc-title { margin: 0; font: 600 16px/1.3 var(--font-display); letter-spacing: -0.015em; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.continue-card .cc-meta { margin: auto 0 0; color: var(--text-2); font-size: 12px; }
.mini-bar { height: 4px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--ok); border-radius: inherit; }

.upsc-today {
  display: flex; flex-direction: column; gap: 10px; min-height: 100%; padding: 22px;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, #e9a23b 22%, transparent), transparent 60%),
    var(--paper);
  color: var(--paper-ink);
}
.upsc-today .eyebrow { color: color-mix(in srgb, var(--paper-ink) 60%, transparent); }
.upsc-today h3 { margin: 0; font: 600 24px/1.2 var(--serif); letter-spacing: -0.01em; }
.upsc-today ol { margin: 0; padding-left: 18px; font: 15px/1.45 var(--serif); }
.upsc-today li + li { margin-top: 6px; }
.upsc-today .go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.upsc-today .go svg { width: 16px; height: 16px; }

/* Subject tiles */

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.subject-tile {
  --sh: 210;
  display: flex; flex-direction: column; gap: 14px; min-height: 128px; padding: 16px;
  border: 0; border-radius: 20px; text-align: left; cursor: pointer; text-decoration: none; color: var(--text);
  background: linear-gradient(160deg, hsl(var(--sh) 40% 97%), hsl(var(--sh) 30% 92%));
  box-shadow: var(--card-ring);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .subject-tile { background: linear-gradient(160deg, hsl(var(--sh) 14% 22%), hsl(var(--sh) 12% 17%)); }
}
:root[data-theme="dark"] .subject-tile { background: linear-gradient(160deg, hsl(var(--sh) 14% 22%), hsl(var(--sh) 12% 17%)); }
.subject-tile:hover { transform: translateY(-2px); box-shadow: var(--card-ring), var(--shadow-md); }
.subject-tile.is-on { box-shadow: 0 0 0 2px hsl(var(--sh) 60% 50%), var(--shadow-sm); }
.subject-tile .st-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); color: hsl(var(--sh) 55% 42%); box-shadow: var(--shadow-sm); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .subject-tile .st-icon { color: hsl(var(--sh) 70% 70%); background: rgba(255, 255, 255, 0.06); } }
:root[data-theme="dark"] .subject-tile .st-icon { color: hsl(var(--sh) 70% 70%); background: rgba(255, 255, 255, 0.06); }
.subject-tile .st-icon svg { width: 22px; height: 22px; stroke-width: 1.6; }
.subject-tile .st-name { margin: auto 0 0; font: 600 17px/1.2 var(--font-display); letter-spacing: -0.02em; }
.subject-tile .st-native { display: block; color: var(--text-2); font-size: 13px; font-weight: 500; }
.subject-tile .st-meta { color: var(--text-2); font-size: 12px; }

/* Level page */

.level-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 18px 0 4px; flex-wrap: wrap; }
.level-head h1 { margin: 0; font: 700 clamp(28px, 3.6vw, 36px)/1.1 var(--font-display); letter-spacing: -0.03em; }
.level-head p { margin: 6px 0 0; color: var(--text-2); }
.class-strip { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 2px; }
.class-strip a {
  display: grid; place-items: center; min-width: var(--tap); height: var(--tap); padding: 0 10px; border-radius: 12px;
  border: 1px solid var(--line); color: var(--text-2); text-decoration: none; font-weight: 600; font-variant-numeric: tabular-nums;
}
.class-strip a:hover { background: var(--hover); color: var(--text); }
.class-strip a[aria-current="page"] { background: var(--text); color: var(--bg); border-color: transparent; }

.chapter-list { margin-top: 16px; border-radius: 18px; background: var(--surface); box-shadow: var(--card-ring), var(--shadow-sm); overflow: hidden; }
.chapter { border-top: 1px solid var(--line); }
.chapter:first-child { border-top: 0; }
.chapter > summary {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 16px; cursor: pointer; list-style: none;
  transition: background 0.12s;
}
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary:hover { background: var(--hover); }
.chapter .ch-n { color: var(--text-3); font: 600 13px/1 var(--font); font-variant-numeric: tabular-nums; min-width: 22px; }
.chapter .ch-copy { flex: 1; min-width: 0; }
.chapter .ch-title { margin: 0; font-weight: 600; }
.chapter .ch-native { margin: 1px 0 0; color: var(--text-2); font-size: 13px; }
.chapter .ch-chev { color: var(--text-3); transition: transform 0.25s var(--ease); }
.chapter[open] .ch-chev { transform: rotate(90deg); }
.chapter-body { display: flex; flex-direction: column; gap: 12px; padding: 2px 16px 16px 72px; }
.topic-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text); text-decoration: none; font-size: 14px;
  transition: background 0.12s, border-color 0.12s;
}
.topic-pill:hover { background: var(--hover); }
.topic-pill.done { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: var(--ok-soft); }
.topic-pill.done::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }

.ring { width: 36px; height: 36px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.5; }
.ring .bg { stroke: var(--raised); }
.ring .fg { stroke: var(--ok); stroke-linecap: round; transition: stroke-dashoffset 0.6s var(--ease); }
.ring-wrap { position: relative; display: grid; place-items: center; flex: none; }
.ring-wrap b { position: absolute; font-size: 10px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Crumbs */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 14px 0 0; padding: 0; list-style: none; color: var(--text-2); font-size: 13px; }
.crumbs a { color: var(--text-2); text-decoration: none; padding: 2px 4px; border-radius: 6px; }
.crumbs a:hover { color: var(--text); background: var(--hover); }
.crumbs li + li::before { content: "›"; margin-right: 4px; color: var(--text-3); }
.crumbs [aria-current] { color: var(--text); font-weight: 500; }

/* Topic page */

.topic-head { padding: 18px 0 6px; }
.topic-head h1 { margin: 0; font: 700 clamp(30px, 4vw, 42px)/1.1 var(--serif); letter-spacing: -0.02em; }
.topic-head .native { margin: 6px 0 0; color: var(--text-2); font: 500 clamp(18px, 2.2vw, 22px)/1.3 var(--serif); }
.topic-head .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.tool-row { position: sticky; top: calc(var(--topnav-h) + 4px); z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px -4px 0; padding: 8px 4px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); }
.tool-row .spacer { flex: 1; }
.translate-menu { position: relative; }
.menu-pop {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 200px; max-height: 300px; overflow-y: auto; padding: 6px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--glass); box-shadow: var(--shadow-lg);
  backdrop-filter: saturate(180%) blur(30px); -webkit-backdrop-filter: saturate(180%) blur(30px);
}
.menu-pop button { display: block; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; font-size: 14px; }
.menu-pop button:hover, .menu-pop button:focus-visible { background: var(--hover); }
.menu-pop button[aria-checked="true"] { color: var(--accent); font-weight: 600; }

.explain { margin-top: 12px; padding: 22px 24px; }
.explain .answer-text { font-size: 17px; line-height: 1.7; }
.explain .answer-text h3, .explain .answer-text h4 { margin: 18px 0 6px; font: 600 18px/1.3 var(--font-display); }
.explain-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.explain-foot .fine { margin-left: auto; }
.explain.is-reader { padding: 34px clamp(20px, 6vw, 64px); background: var(--paper); color: var(--paper-ink); }
.explain.is-reader .answer-text { max-width: 64ch; margin: 0 auto; font: 20px/1.75 var(--serif); }
.explain.is-reader .explain-foot { max-width: 64ch; margin-left: auto; margin-right: auto; }
::highlight(readalong) { background-color: color-mix(in srgb, #ffcc00 45%, transparent); color: inherit; }
.ra-fallback { background: color-mix(in srgb, #ffcc00 45%, transparent); border-radius: 4px; }

.math-block { display: block; margin: 10px 0; overflow-x: auto; text-align: center; }
.math-raw { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.92em; color: var(--text-2); }
.answer-text code { padding: 1px 5px; border-radius: 6px; background: var(--raised); font: 0.9em ui-monospace, "SF Mono", Menlo, monospace; }
.answer-text blockquote { margin: 0 0 10px; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong); color: var(--text-2); }
.answer-text a { color: var(--accent); }

.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.action-tile { display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 14px 16px; }
.action-tile .at-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; color: #fff; }
.action-tile .at-icon svg { width: 21px; height: 21px; stroke-width: 1.8; }
.action-tile .at-title { margin: 0; font-weight: 600; }
.action-tile .at-sub { margin: 1px 0 0; color: var(--text-2); font-size: 13px; }

.source-list { display: flex; flex-direction: column; gap: 10px; }
.source-card { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }
.source-top { display: flex; align-items: flex-start; gap: 10px; }
.source-n { display: grid; place-items: center; flex: none; min-width: 24px; height: 24px; border-radius: 999px; background: var(--raised); color: var(--text-2); font: 700 12px/1 var(--font); }
.source-title { margin: 0; flex: 1; font-weight: 600; }
.source-title a { color: inherit; text-decoration: none; }
.source-title a:hover { text-decoration: underline; }
.source-snippet { margin: 0; color: var(--text-2); font: 15px/1.55 var(--serif); }
.source-snippet.quote { padding-left: 12px; border-left: 3px solid var(--line-strong); }
.source-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lic { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font: 700 11px/1.5 var(--font); letter-spacing: 0.02em; white-space: nowrap; }
.lic svg { width: 12px; height: 12px; stroke-width: 2.2; }
.lic.open { background: var(--ok-soft); color: color-mix(in srgb, var(--ok) 70%, var(--text)); }
.lic.restricted { background: color-mix(in srgb, var(--busy) 16%, transparent); color: color-mix(in srgb, var(--busy) 65%, var(--text)); }
.lic.unknown { background: var(--raised); color: var(--text-2); }

.news-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.news-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.news-card .nc-top { display: flex; align-items: center; gap: 8px; color: var(--text-2); font: 700 11px/1.3 var(--font); letter-spacing: 0.05em; text-transform: uppercase; }
.news-card .nc-title { margin: 0; font: 600 16px/1.3 var(--serif); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.news-card .nc-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.round-play { display: grid; place-items: center; width: var(--tap); height: var(--tap); flex: none; border: 0; border-radius: 50%; background: var(--text); color: var(--bg); cursor: pointer; transition: transform 0.15s; }
.round-play svg { width: 16px; height: 16px; fill: currentColor; stroke: none; margin-left: 2px; }
.round-play:active { transform: scale(0.92); }
.round-play.small { width: 34px; height: 34px; }
.round-play.small svg { width: 13px; height: 13px; }

.figure-row { display: flex; flex-wrap: wrap; gap: 10px; }
.figure-chip { display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 16px 6px 6px; border-radius: 999px; }
.figure-chip .fa { --hue: 30; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font: 700 15px/1 var(--serif); background: linear-gradient(140deg, hsl(var(--hue) 55% 55%), hsl(calc(var(--hue) + 30) 50% 38%)); }
.figure-chip span:last-child { font-weight: 600; }
.figure-chip small { display: block; color: var(--text-2); font-size: 12px; font-weight: 400; }

.pyq-list { display: flex; flex-direction: column; gap: 10px; }
.pyq { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; }
.pyq-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pyq-q { margin: 0; font: 16px/1.55 var(--serif); }
.pyq-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.done-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 40px; }

/* Guru panel */

.guru {
  position: sticky; top: var(--topnav-h); height: calc(100vh - var(--topnav-h)); display: flex; flex-direction: column;
  border-left: 1px solid var(--line); background: var(--sidebar); min-width: 0;
}
.learn-app.has-guru { grid-template-columns: minmax(0, 1fr) var(--guru-w); }
.guru-grip { display: none; }
.guru-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 8px 16px; }
.guru-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(140deg, #ffb020, #ff6b6b 60%, #a855f7); color: #fff; }
.guru-mark svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.guru-title { flex: 1; min-width: 0; }
.guru-name { margin: 0; font: 600 16px/1.2 var(--font-display); }
.guru-sub { margin: 0; color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guru-modes { display: flex; gap: 6px; padding: 4px 14px 10px; overflow-x: auto; scrollbar-width: none; }
.mode-chip {
  flex: none; min-height: 36px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; transition: background 0.12s, color 0.12s;
}
.mode-chip:hover { background: var(--hover); color: var(--text); }
.mode-chip.is-on { background: var(--text); color: var(--bg); border-color: transparent; }
.guru-thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 8px 16px 16px; }
.guru-thread .bubble { max-width: 88%; font-size: 14.5px; }
.guru-thread .turn.assistant { gap: 10px; }
.guru-thread .answer-mark { width: 26px; height: 26px; }
.guru-thread .answer-text { font-size: 14.5px; }
.guru-thread .sources { grid-auto-columns: minmax(180px, 220px); }
.guru-src { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 13px; scroll-snap-align: start; }
.guru-src b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-weight: 600; }
.guru-src small { color: var(--text-2); }
.guru-src:hover { background: var(--raised); }
.guru-tool { color: var(--text-3); font-size: 12px; }
.guru-welcome { display: flex; flex-direction: column; gap: 10px; padding: 10px 2px; color: var(--text-2); font-size: 14px; }
.guru-welcome h3 { margin: 0; color: var(--text); font: 600 18px/1.3 var(--font-display); }
.guru-welcome .starters { display: flex; flex-direction: column; gap: 6px; }
.guru-welcome .starters button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; font-size: 14px; color: var(--text); }
.guru-welcome .starters button:hover { background: var(--raised); }
.guru-composer { margin: 0 12px 12px; width: auto; padding: 8px 8px 6px 14px; border-radius: 22px; }
.guru-composer textarea { font-size: 15px; }
.guru-composer .composer-bar { margin-left: -6px; }
.guru-scrim { display: none; }

/* Practice */

.practice-wrap { max-width: 720px; margin: 0 auto; }
.practice-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 18px 0 12px; }
.practice-head h1 { margin: 0; font: 700 clamp(26px, 3.4vw, 34px)/1.1 var(--font-display); letter-spacing: -0.03em; }
.practice-head p { margin: 6px 0 0; color: var(--text-2); }
.setup-card { display: flex; flex-direction: column; gap: 16px; padding: 22px; }
.setup-card .segmented { grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
.setup-card .segmented span { padding: 9px 8px; }
.setup-card textarea, .aw-question textarea, .aw-answer textarea, .l-input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); outline: none; resize: vertical; line-height: 1.5;
}
.l-input { min-height: var(--tap); padding: 0 12px; }
.setup-card textarea:focus, .aw-answer textarea:focus, .l-input:focus, .aw-question textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.due-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.due-card .due-n { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font: 700 20px/1 var(--font-display); flex: none; }
.due-card .due-copy { flex: 1; min-width: 0; }
.due-card p { margin: 0; }
.due-card .due-sub { color: var(--text-2); font-size: 13px; }

.pq-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pq-progress { flex: 1; height: 6px; border-radius: 6px; background: var(--raised); overflow: hidden; }
.pq-progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.4s var(--ease); }
.pq-stat { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pq-stat svg { width: 17px; height: 17px; }
.pq-stat.streak { color: #f97316; }
.pq-stat.streak svg { fill: currentColor; stroke: none; }

.pq-card { padding: 26px; animation: rise 0.35s var(--ease); }
.pq-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--text-2); font-size: 13px; }
.pq-question { margin: 0 0 20px; font: 500 clamp(19px, 2.4vw, 23px)/1.45 var(--serif); letter-spacing: -0.005em; white-space: pre-wrap; }
.pq-options { display: flex; flex-direction: column; gap: 10px; }
.pq-opt {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 12px 16px;
  border: 1.5px solid var(--line-strong); border-radius: 16px; background: var(--surface); text-align: left; font-size: 16px; line-height: 1.4;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.pq-opt:hover:not(:disabled) { background: var(--raised); }
.pq-opt:active:not(:disabled) { transform: scale(0.99); }
.pq-opt:disabled { cursor: default; }
.pq-opt .key { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--raised); color: var(--text-2); font: 700 14px/1 var(--font); }
.pq-opt.is-picked { border-color: var(--accent); }
.pq-opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.pq-opt.is-correct .key { background: var(--ok); color: #fff; }
.pq-opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.pq-opt.is-wrong .key { background: var(--bad); color: #fff; }
.pq-opt.is-dim { opacity: 0.55; }
.pq-text { display: flex; flex-direction: column; gap: 10px; }
.pq-text textarea, .pq-text input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--surface); outline: none; font-size: 16px; line-height: 1.5; }
.pq-text input { min-height: 52px; }
.pq-text textarea:focus, .pq-text input:focus { border-color: var(--accent); }
.pq-feedback { margin-top: 18px; padding: 16px 18px; border-radius: 16px; animation: rise 0.3s var(--ease); }
.pq-feedback.ok { background: var(--ok-soft); }
.pq-feedback.bad { background: var(--bad-soft); }
.pq-feedback.partial { background: color-mix(in srgb, var(--busy) 14%, transparent); }
.pq-verdict { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 700 17px/1.2 var(--font-display); }
.pq-verdict svg { width: 22px; height: 22px; stroke-width: 2.4; }
.pq-feedback.ok .pq-verdict { color: color-mix(in srgb, var(--ok) 75%, var(--text)); }
.pq-feedback.bad .pq-verdict { color: var(--bad); }
.pq-cites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pq-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.pq-actions .spacer { flex: 1; }
.pq-done { text-align: center; padding: 34px 26px; }
.pq-done h2 { margin: 12px 0 4px; font: 700 28px/1.15 var(--font-display); letter-spacing: -0.03em; }
.pq-done p { margin: 0; color: var(--text-2); }
.pq-done .btn-row { justify-content: center; margin-top: 20px; }
.big-ring { width: 120px; height: 120px; margin: 0 auto; }
.big-ring .ring { width: 120px; height: 120px; }
.big-ring .ring circle { stroke-width: 7; }
.big-ring b { font: 700 26px/1 var(--font-display); color: var(--text); }

/* UPSC */

.upsc-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 18px 0 6px; }
.upsc-head h1 { margin: 0; font: 700 clamp(28px, 3.8vw, 38px)/1.08 var(--serif); letter-spacing: -0.02em; }
.upsc-head p { margin: 6px 0 0; color: var(--text-2); }
.upsc-tabs { display: flex; gap: 2px; margin: 16px 0 8px; padding: 3px; border-radius: 12px; background: var(--raised); overflow-x: auto; scrollbar-width: none; }
.upsc-tabs a {
  flex: 1 0 auto; display: grid; place-items: center; min-height: 38px; padding: 0 14px; border-radius: 9px;
  color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: background 0.2s var(--ease), color 0.2s;
}
.upsc-tabs a:hover { color: var(--text); }
.upsc-tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12), 0 0 0 0.5px var(--line); }

.date-rail { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px 12px; scroll-snap-type: x proximity; }
.date-rail a {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  width: 56px; height: 64px; border-radius: 14px; color: var(--text-2); text-decoration: none; scroll-snap-align: end;
  border: 1px solid var(--line); transition: background 0.12s;
}
.date-rail a:hover { background: var(--hover); }
.date-rail .dw { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.date-rail .dd { font: 600 20px/1 var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }
.date-rail a[aria-current="page"] { background: var(--text); border-color: transparent; color: var(--bg); }
.date-rail a[aria-current="page"] .dd { color: var(--bg); }
.date-rail input[type="date"] { flex: none; align-self: center; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }

.digest-masthead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 0 10px; border-bottom: 2px solid var(--text); flex-wrap: wrap; }
.digest-masthead h2 { margin: 0; font: 700 26px/1.1 var(--serif); letter-spacing: -0.015em; }
.digest-masthead span { color: var(--text-2); font-size: 13px; }
.digest { display: flex; flex-direction: column; }
.digest-entry { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 16px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.digest-entry .de-n { font: 700 34px/1 var(--serif); color: var(--text-3); font-variant-numeric: tabular-nums; }
.digest-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.paper { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font: 700 11px/1.4 var(--font); letter-spacing: 0.03em; }
.paper.gs1 { background: color-mix(in srgb, #d97706 16%, transparent); color: color-mix(in srgb, #d97706 80%, var(--text)); }
.paper.gs2 { background: color-mix(in srgb, #2563eb 14%, transparent); color: color-mix(in srgb, #2563eb 80%, var(--text)); }
.paper.gs3 { background: color-mix(in srgb, #16a34a 15%, transparent); color: color-mix(in srgb, #16a34a 80%, var(--text)); }
.paper.gs4 { background: color-mix(in srgb, #9333ea 14%, transparent); color: color-mix(in srgb, #9333ea 80%, var(--text)); }
.paper.prelims { background: color-mix(in srgb, #0891b2 15%, transparent); color: color-mix(in srgb, #0891b2 80%, var(--text)); }
.paper.essay { background: color-mix(in srgb, #db2777 14%, transparent); color: color-mix(in srgb, #db2777 80%, var(--text)); }
.syl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); font-size: 12px; font-weight: 500; text-decoration: none; }
.syl-chip:hover { color: var(--text); background: var(--hover); }
.digest-headline { margin: 0; font: 700 clamp(21px, 2.6vw, 26px)/1.22 var(--serif); letter-spacing: -0.012em; }
.digest-lede { margin: 8px 0 0; color: var(--text-2); font: 16px/1.55 var(--serif); }
.digest-folds { display: flex; flex-direction: column; margin-top: 12px; border-top: 1px solid var(--line); }
.fold { border-bottom: 1px solid var(--line); }
.fold > summary { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; list-style: none; font-weight: 600; font-size: 14px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg) translateY(-3px); transition: transform 0.25s var(--ease); }
.fold[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.fold > summary .fold-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fc, var(--text-3)); flex: none; }
.fold-body { padding: 0 0 14px 18px; font: 15.5px/1.6 var(--serif); }
.fold-body p { margin: 0 0 8px; }
.fold-body ul { margin: 0; padding-left: 18px; }
.fold-body li { margin: 0 0 6px; }
.fold-body li::marker { color: var(--text-3); }
.digest-sources { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ds { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 40px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 13px; }
.ds.link { padding-left: 12px; }
.ds span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.ds small { color: var(--text-2); }
.ds:hover { background: var(--raised); }

.upsc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.upsc-side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 12px; }
.side-card { padding: 16px; }
.side-card h3 { margin: 0 0 6px; font: 600 16px/1.3 var(--font-display); }
.side-card p { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 16px; }
.filter-bar select, .filter-bar input { min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.filter-bar input[type="search"] { flex: 1; min-width: 180px; }

/* Answer writing */

.aw { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.aw-main { display: flex; flex-direction: column; gap: 14px; }
.aw-question { padding: 20px; }
.aw-question .pyq-q { font-size: 18px; }
.aw-question textarea { font: 17px/1.5 var(--serif); }
.aw-specs { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.aw-specs label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
.aw-specs select { min-height: 36px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.aw-answer { padding: 0; overflow: hidden; }
.aw-answer textarea { display: block; min-height: 340px; border: 0; border-radius: 0; background: transparent; padding: 20px 22px; font: 17px/1.7 var(--serif); }
.aw-answer textarea:focus { box-shadow: none; }
.aw-answer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--raised); }
.aw-answer-bar .composer-hint { flex: 1; }
.aw-answer-bar.is-recording .mic { background: var(--bad); color: #fff; }
.aw-answer-bar.is-recording .mic .i-mic { display: none; }
.aw-answer-bar.is-recording .mic .i-stop { display: block; }
.aw-answer-bar.is-transcribing .mic svg { display: none; }
.aw-answer-bar.is-transcribing .mic .spinner { display: block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--text); animation: spin 0.8s linear infinite; }
.aw-side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 12px; }
.timer-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px; }
.timer-face { font: 600 44px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.timer-face.over { color: var(--bad); }
.timer-sub { color: var(--text-2); font-size: 13px; }
.wc { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.wc-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.wc-row b { color: var(--text); }
.wc-bar { height: 6px; border-radius: 6px; background: var(--raised); overflow: hidden; }
.wc-bar i { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width 0.3s var(--ease), background 0.3s; }
.wc-bar i.over { background: var(--bad); }

.rubric { display: flex; flex-direction: column; gap: 16px; padding: 22px; animation: rise 0.35s var(--ease); }
.rubric-top { display: flex; align-items: center; gap: 18px; }
.rubric-total { font: 700 40px/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.rubric-total small { color: var(--text-2); font-size: 18px; font-weight: 600; }
.score-list { display: flex; flex-direction: column; gap: 10px; }
.score-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 48px; align-items: center; gap: 12px; font-size: 14px; }
.score-row span:first-child { color: var(--text-2); text-transform: capitalize; }
.score-row b { text-align: right; font-variant-numeric: tabular-nums; }
.score-track { height: 10px; border-radius: 10px; background: var(--raised); overflow: hidden; }
.score-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--ok))); transform-origin: left; animation: grow 0.8s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.rubric-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rubric-col { padding: 14px 16px; border-radius: 14px; background: var(--raised); }
.rubric-col h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 14px; }
.rubric-col h4 svg { width: 16px; height: 16px; stroke-width: 2.4; }
.rubric-col.good h4 { color: color-mix(in srgb, var(--ok) 75%, var(--text)); }
.rubric-col.fix h4 { color: color-mix(in srgb, var(--busy) 75%, var(--text)); }
.rubric-col ul { margin: 0; padding-left: 18px; font-size: 14px; }
.rubric-col li + li { margin-top: 6px; }
.outline { padding: 14px 18px; border-radius: 14px; border: 1px dashed var(--line-strong); font: 15px/1.6 var(--serif); }
.outline h4 { margin: 0 0 6px; font: 600 14px/1.3 var(--font); }
.outline ol, .outline ul { margin: 0; padding-left: 20px; }

.monthly-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; padding: 22px; }
.monthly-cover { width: 92px; aspect-ratio: 3 / 4; border-radius: 8px; padding: 10px 8px; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(160deg, #1f2937, #111827); color: #fff; box-shadow: var(--shadow-md); font: 700 11px/1.2 var(--serif); }
.monthly-cover b { font-size: 16px; }
.monthly-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.monthly-form input, .monthly-form select { min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }

/* Kids (classes 1-5) */

body.kid .learn-view { font-size: 17px; }
body.kid .l-section-head h2 { font-size: 24px; }
body.kid .subject-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
body.kid .subject-tile { min-height: 150px; border-radius: 28px; padding: 18px; background: color-mix(in srgb, hsl(var(--sh) 85% 60%) 16%, var(--surface)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, hsl(var(--sh) 85% 55%) 28%, transparent); }
body.kid .subject-tile:hover { transform: translateY(-3px) rotate(-0.6deg); }
body.kid .subject-tile .st-icon { width: 56px; height: 56px; border-radius: 50%; background: hsl(var(--sh) 80% 55%); color: #fff; box-shadow: 0 8px 18px hsl(var(--sh) 80% 55% / 0.35); }
body.kid .subject-tile .st-icon svg { width: 28px; height: 28px; stroke-width: 2; }
body.kid .subject-tile .st-name { font-size: 20px; font-weight: 700; }
body.kid .chapter-list { border-radius: 24px; }
body.kid .chapter > summary { min-height: 76px; }
body.kid .chapter .ch-title { font-size: 18px; }
body.kid .topic-pill { min-height: 46px; font-size: 16px; padding: 0 18px; }
body.kid .topic-head h1 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; }
body.kid .explain .answer-text { font-size: 19px; line-height: 1.75; }
body.kid .pq-question { font: 700 clamp(22px, 3vw, 26px)/1.4 var(--font-display); }
body.kid .pq-opt { min-height: 72px; font-size: 19px; border-radius: 22px; }
body.kid .pq-opt .key { width: 40px; height: 40px; border-radius: 50%; font-size: 17px; }
body.kid .pq-opt:nth-child(1) .key { background: color-mix(in srgb, var(--kid-1) 22%, transparent); color: var(--kid-1); }
body.kid .pq-opt:nth-child(2) .key { background: color-mix(in srgb, var(--kid-4) 22%, transparent); color: var(--kid-4); }
body.kid .pq-opt:nth-child(3) .key { background: color-mix(in srgb, var(--kid-3) 22%, transparent); color: var(--kid-3); }
body.kid .pq-opt:nth-child(4) .key { background: color-mix(in srgb, var(--kid-5) 22%, transparent); color: var(--kid-5); }
body.kid .btn { min-height: 50px; font-size: 16px; }
.kid-cheer { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: color-mix(in srgb, var(--kid-2) 18%, transparent); color: color-mix(in srgb, var(--kid-2) 60%, var(--text)); font-weight: 700; font-size: 14px; }
.kid-cheer svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }

/* Mini player */

.learn-player { left: 24px; bottom: calc(16px + var(--site-tabbar, 0px)); }

.learn-player .mp-art.art { width: 48px; height: 48px; color: var(--text-2); background: var(--raised); text-shadow: none; }
.learn-player .mp-art svg { width: 22px; height: 22px; }
.learn-player .mp-row { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.learn-app.has-guru ~ .learn-player { right: calc(var(--guru-w) + 24px); }

/* Responsive */

@media (max-width: 1180px) {
  :root { --guru-w: 360px; }
  .upsc-grid { grid-template-columns: 1fr; }
  .upsc-side { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 1100px) {
  .learn-app.has-guru { grid-template-columns: minmax(0, 1fr); }
  .guru {
    position: fixed; z-index: 28; left: 0; right: 0; bottom: 0; top: auto; height: min(84vh, 760px);
    border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
    transform: translateY(105%); transition: transform 0.4s var(--ease);
  }
  .guru.is-open { transform: none; }
  .guru-grip { display: flex; justify-content: center; padding: 8px 0 0; cursor: grab; touch-action: none; }
  .guru-grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }
  .guru-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 27; background: rgba(0, 0, 0, 0.3); }
  .learn-app.has-guru ~ .learn-player { right: 24px; }
  .aw { grid-template-columns: 1fr; }
  .aw-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .aw-side > * { flex: 1 1 240px; }
}
@media (min-width: 1101px) {
  .guru-fab { display: none; }
}
@media (max-width: 860px) {
  .learn-view { padding: 4px 16px 40px; }
  .home-grid { grid-template-columns: 1fr; }
  .class-grid.young { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .class-grid.senior { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .class-chip.kid { min-height: 96px; border-radius: 20px; }
  .class-chip.kid .kid-icon { width: 36px; height: 36px; }
  .class-chip.kid .w { display: none; }
  .chapter-body { padding-left: 16px; }
  .digest-entry { grid-template-columns: 1fr; }
  .digest-entry .de-n { font-size: 22px; }
  .rubric-cols { grid-template-columns: 1fr; }
  .score-row { grid-template-columns: 110px minmax(0, 1fr) 40px; }
  .lang-pill select { max-width: 92px; }
  .learn-subnav .subnav-tools { width: 100%; margin-left: 0; }
  .learn-subnav .learn-search { flex: 1 1 160px; width: auto; }
  .learn-app.has-guru ~ .learn-player { right: 10px; }
  .monthly-card { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .class-grid.young { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pq-card { padding: 20px 16px; }
}

.guru-fab {
  position: fixed; z-index: 9; right: 18px; bottom: calc(18px + var(--site-tabbar, 0px)); display: inline-flex; align-items: center; gap: 8px;
  min-height: 52px; padding: 0 20px 0 16px; border: 0; border-radius: 999px; background: var(--text); color: var(--bg);
  font-weight: 600; box-shadow: var(--shadow-lg);
}
.guru-fab svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
body:has(#player:not([hidden])) .guru-fab { bottom: 110px; }

@media (prefers-reduced-motion: reduce) {
  .class-chip.kid:hover, .subject-tile:hover, body.kid .subject-tile:hover { transform: none; }
}
