.heading-group { display:grid; gap:4px; margin-bottom:4px; }
.heading-group .meta { max-width:580px; }
.heading-group h1 { overflow-wrap:anywhere; }
.section:first-child { margin-top:0; }
.student-page .overview-title { margin-bottom:8px; }
.learning-trail { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.trail-tile, .sample-card {
  min-width:0;
  display:flex;
  gap:12px;
  align-items:center;
  padding:12px;
  border:1px solid var(--line);
  border-radius:18px;
  background:var(--surface);
  box-shadow:var(--shadow);
  text-decoration:none;
  transition:transform .16s ease,border-color .16s ease;
}
.trail-tile:hover, .sample-card:hover { transform:translateY(-2px); border-color:#ddcfae; }
.trail-text { min-width:0; flex:1; display:grid; gap:3px; }
.trail-text b { font-size:15px; line-height:1.4; overflow-wrap:anywhere; }
.trail-text small { font-size:12px; color:var(--muted); line-height:1.45; }
.trail-next { color:var(--muted); }
.seal {
  --seal-size:68px;
  display:block;
  flex:none;
  width:var(--seal-size);
  height:var(--seal-size);
  background:url("/assets/camp-badges.png") 0 center / 300% 100% no-repeat;
}
.seal.dialogues { background-position:50% center; }
.seal.readings { background-position:100% center; }
.seal.large { --seal-size:102px; }
.seal.small { --seal-size:48px; }
.seal.locked { filter:saturate(.5); opacity:.66; }
.study-layout { display:grid; grid-template-columns:minmax(200px,.68fr) minmax(0,1.32fr); gap:16px; align-items:start; }
.study-layout > * { min-width:0; }
.study-aside { display:grid; gap:10px; }
.study-read { min-width:0; padding:clamp(14px,2.6cqi,26px); }
.word-stage {
  display:grid;
  grid-template-columns:minmax(0,1.23fr) minmax(150px,.77fr);
  grid-template-areas:"copy art" "controls art";
  gap:10px 18px;
  align-items:start;
  border:1px solid #eee1c8;
  border-radius:20px;
  background:linear-gradient(155deg,#faf3e2,#f8f1e1 68%,#f4ebd9);
  padding:clamp(15px,2.8cqi,25px);
}
.word-main { grid-area:copy; min-width:0; display:grid; gap:5px; align-self:end; }
.word-main h2, .english-title { font:700 clamp(27px,4.3cqi,43px)/1.12 Georgia,serif; overflow-wrap:anywhere; }
.word-controls { grid-area:controls; min-width:0; }
.word-caption { font-size:16px; line-height:1.46; color:var(--secondary-ink); overflow-wrap:anywhere; }
.word-figure { grid-area:art; align-self:stretch; display:grid; place-items:center; min-height:132px; min-width:0; }
.word-img { display:block; width:100%; max-height:min(278px,33cqi); object-fit:contain; border-radius:14px; }
.audio-button { gap:6px; }
.audio-button[aria-pressed=true] { border-color:#b5965e; background:#f8f2e4; color:#5c471d; }
.audio-button[data-playing] { box-shadow:inset 0 0 0 1px #b5965e; }
.topic-inbox { white-space:nowrap; padding-inline:10px; }
.reading-tools { align-items:end; }
.reading-tools .field { width:82px; }
.reading-tools select { min-height:39px; padding-block:5px; }
.topic-word-token { appearance:none; border:0; background:none; color:inherit; font:inherit; padding:0 1px; border-radius:4px; cursor:pointer; }
.topic-word-token:hover,.topic-word-token:focus-visible,.topic-word-token.word-active { background:#efdfb8; color:#3d2e13; }
[data-word-gloss]:empty,[data-topic-result]:empty { display:none; }
.example-frame { padding:13px 14px; border-radius:15px; background:#f7f5ef; display:grid; gap:5px; border:1px solid var(--line); }
.example-frame .example-en, .reading-body .example-en { font-size:17px; line-height:1.62; }
.example-frame .audio-button { justify-self:start; }
.feature-label { font-weight:650; color:var(--secondary-ink); }
.sample-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
.sample-card .seal { --seal-size:60px; }
.scene-media { display:block; width:100%; max-height:min(365px,39cqi); border-radius:17px; object-fit:contain; background:#f4f0e7; }
.scene-words { display:grid; gap:6px; min-width:0; background:var(--blue-wash); padding:clamp(12px,2.3cqi,19px); border:1px solid #e1ebee; border-radius:20px 20px 20px 6px; }
.scene-words :is(h1,h2,h3,p) { overflow-wrap:anywhere; }
.reading-body { min-width:0; display:grid; gap:9px; padding:clamp(12px,2.3cqi,20px); background:#f2f5ed; border:1px solid #e8ede0; border-radius:17px; }
.reading-body p { overflow-wrap:anywhere; }
.route-pills { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.route-pills .secondary, .route-pills .ghost { min-height:38px; }
.route-pills [aria-current=page] { background:var(--amber-wash); color:var(--amber-ink); border-color:#e9dac1; font-weight:700; }
.lesson-footer { display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px 9px; align-items:center; }
.badge-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.badge-grid .card { justify-items:center; text-align:center; gap:7px; padding-inline:8px; }
.badge-grid .progress { width:100%; }
.profile-lead { display:flex; align-items:center; gap:12px; }
.profile-lead .avatar { width:52px; height:52px; font-size:19px; }
.profile-lead h2 { overflow-wrap:anywhere; }
.avatar .seal { --seal-size:90%; }
.goal-top > .text-button { flex:none; white-space:nowrap; margin-inline-start:auto; }
.featured-words { display:flex; flex-wrap:wrap; gap:5px; margin:4px 0; }
.featured-words .pill { flex:none; }
.progress-strip { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.progress-strip .card { gap:3px; min-width:0; padding:10px; }
.progress-strip b { font-size:20px; line-height:1.3; }
.topic-growth-compact { gap:8px; margin-block:12px; }
.teacher-alert { background:#f7f3e9; border-color:#e9ddc8; }
.notice-unread { background:#f7f3e9; }
.notice-unread .details strong { color:#604716; }
.note-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.settings-order { display:grid; gap:5px; }
.settings-order .row-card { min-height:48px; padding-block:4px; }
.settings-order button { min-height:34px; padding:3px 9px; }
.published-preview { display:grid; gap:7px; border-radius:16px; border:1px solid var(--line); background:#f8f6f1; padding:12px; }
.published-preview img { width:100%; max-height:150px; object-fit:contain; }
.mini-media { display:block; width:100%; max-height:130px; object-fit:contain; border-radius:12px; background:var(--paper); }
.toast[data-type=reward] { background:#f5e6be; color:#513d16; box-shadow:0 6px 27px #6e532544; animation:reward-arrival .34s ease-out; }
.toast[data-motion=off] { animation:none; }
@keyframes reward-arrival { from { opacity:.44; scale:.93; } to { opacity:1; scale:1; } }
@container (max-width:950px) {
  .learning-trail { gap:7px; }
  .trail-tile { gap:7px; }
  .trail-tile .seal { --seal-size:56px; }
}
@container (max-width:700px) {
  .study-layout { grid-template-columns:minmax(0,1fr); gap:9px; }
}
@container (max-width:520px) {
  .learning-trail { grid-template-columns:minmax(0,1fr); }
  .trail-tile { min-height:65px; padding:6px 9px; }
  .trail-tile .seal { --seal-size:51px; }
  .sample-grid { grid-template-columns:minmax(0,1fr); gap:7px; }
  .sample-card { padding:7px 9px; gap:8px; }
  .sample-card .seal { --seal-size:46px; }
  .word-stage { padding:12px; gap:8px; grid-template-columns:minmax(0,1fr) minmax(68px,.5fr); grid-template-areas:"copy art" "controls controls"; }
  .word-figure { min-height:90px; }
  .word-img { max-height:104px; }
  .word-stage .seal.large { --seal-size:77px; }
  .study-read { padding:11px; }
  .badge-grid .seal { --seal-size:58px; }
  .badge-grid .meta, .progress-strip .meta { font-size:11px; }
  .progress-strip .card { padding:7px 6px; }
  .progress-strip b { font-size:17px; }
  .section-title > .pill { flex:none; }
  .head-user .ghost { min-height:34px; padding-inline:8px; font-size:12px; }
}
@media (prefers-reduced-motion:reduce) {
  .trail-tile,.sample-card { transition:none; }
  .toast[data-type=reward] { animation:none; }
}

.trail-tile:has(.trail-cover) {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:8px;
  padding:8px 9px 11px;
  align-content:start;
}
.trail-cover {
  grid-column:1 / -1;
  display:block;
  min-width:0;
  width:100%;
  aspect-ratio:2.3;
  object-fit:cover;
  border-radius:13px;
  background:#f3eee3;
}
.trail-tile:has(.trail-cover) .trail-text { padding-inline-start:3px; }

.study-layout.topic-detail {
  grid-template-columns:minmax(0,1fr);
  gap:13px;
  width:min(100%,1040px);
  margin-inline:auto;
}
.study-header {
  grid-template-columns:minmax(0,1fr) minmax(140px,215px);
  gap:8px 18px;
  align-items:end;
  padding-block:3px 0;
}
.study-title { min-width:0; }
.study-title h1 { font-size:clamp(24px,3.25cqi,34px); line-height:1.28; overflow-wrap:anywhere; }
.study-title .page-intro { margin-bottom:0; }
.study-progress { align-self:end; min-width:0; padding-bottom:3px; }
.study-progress > :is(p,span,small) { overflow-wrap:anywhere; }
.study-feature {
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(168px,.85fr);
  grid-template-areas:"copy media";
  gap:clamp(10px,2cqi,19px);
  align-items:center;
  min-width:0;
}
.study-primary { grid-area:copy; min-width:0; display:grid; gap:8px; align-content:center; }
.study-primary > :is(.pill,.audio-button,.text-button) { justify-self:start; }
.study-primary :is(h1,h2,h3,p) { overflow-wrap:anywhere; }
.study-media {
  grid-area:media;
  width:100%;
  min-width:0;
  display:grid;
  place-items:center;
  border-radius:17px;
  background:#f4f0e7;
}
.study-feature .study-media:empty { display:none; }
.study-feature:not(:has(.study-media > *)) {
  grid-template-columns:minmax(0,1fr);
  grid-template-areas:"copy";
}

.group-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:11px; }
.topic-group {
  min-width:0;
  display:grid;
  grid-template-rows:auto 1fr;
  padding:8px;
  gap:7px;
  border:1px solid var(--line);
  border-radius:17px;
  background:var(--surface);
  color:var(--ink);
  box-shadow:0 2px 8px #4d3a1a08;
  text-decoration:none;
  overflow-wrap:anywhere;
}
.topic-group:hover { border-color:#d9cda9; background:#fffdf3; }
.topic-group-image, .sample-media {
  min-width:0;
  display:block;
  object-fit:cover;
  border-radius:12px;
  background:#f3eee3;
}
.topic-group-image { width:100%; aspect-ratio:1.9; }
.topic-group-info { min-width:0; display:grid; align-content:start; gap:2px; padding:1px 4px 5px; }
.topic-group-info :is(strong,b) { font-size:15px; line-height:1.3; }
.topic-group-info small { color:var(--muted); font-size:12px; line-height:1.4; }
.sample-media { flex:0 0 clamp(65px,12cqi,108px); width:clamp(65px,12cqi,108px); aspect-ratio:1; }

@container (max-width:950px) {
  .study-header { grid-template-columns:minmax(0,1fr) minmax(135px,175px); }
  .study-feature { grid-template-columns:minmax(0,1.22fr) minmax(140px,.78fr); }
}
@container (max-width:700px) {
  .group-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@container (max-width:520px) {
  .trail-tile:has(.trail-cover) {
    grid-template-columns:78px minmax(0,1fr) auto;
    min-height:76px;
    align-items:center;
    padding:6px 8px;
  }
  .trail-cover { grid-column:auto; aspect-ratio:1.42; }
  .trail-tile:has(.trail-cover) .trail-text { padding-inline:0; }
  .study-layout.topic-detail { gap:10px; }
  .study-header { grid-template-columns:minmax(0,1fr); gap:7px; }
  .study-progress { width:100%; padding-bottom:0; }
  .study-feature { grid-template-columns:minmax(0,1fr); grid-template-areas:"media" "copy"; gap:9px; }
  .study-primary { gap:6px; }
  .study-primary > .audio-button, .example-frame .audio-button { justify-self:stretch; }
  .study-media .scene-media, .scene-media { max-height:68cqi; border-radius:13px; }
  .group-grid { gap:7px; }
  .topic-group { padding:6px; gap:5px; border-radius:14px; }
  .topic-group-image { aspect-ratio:1.6; border-radius:10px; }
  .topic-group-info { padding-inline:3px; }
  .topic-group-info :is(strong,b) { font-size:13px; }
  .topic-group-info small { font-size:11px; }
  .sample-media { flex-basis:63px; width:63px; border-radius:10px; }
}
