/* ==========================================================
   teachMe Online - Orion-aligned homepage redesign
   Warm paper, quiet clarity, free topical past paper SEO
   ========================================================== */

:root {
  --paper: #FAF7F0;
  --paper-warm: #FFF8EC;
  --paper-soft: #F7F4EC;
  --card: rgba(255, 255, 255, .78);
  --card-solid: #FFFFFF;
  --ink: #242421;
  --ink-soft: #67645E;
  --ink-faint: #8F8A80;
  --green: #0F6E56;
  --green-deep: #075744;
  --green-soft: #E4F3EB;
  --green-line: #BBDCCF;
  --amber: #F4C46C;
  --amber-soft: #FFF0D4;
  --coral: #C16038;
  --coral-soft: #FAE8DC;
  --purple: #7B67C7;
  --purple-soft: #EEEAFB;
  --sage: #A7B58A;
  --line: #E6DED0;
  --line-strong: #D8CCBA;
  --shadow: 0 18px 44px rgba(57, 43, 22, .08);
  --shadow-soft: 0 10px 28px rgba(57, 43, 22, .055);
  --radius: 16px;
  --radius-sm: 12px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-hand: 'Caveat', cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 4%, rgba(255,255,255,.9), transparent 28rem),
    linear-gradient(180deg, #FFFDF8 0%, var(--paper) 48%, #FBF5EA 100%);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button, input { font: inherit; }

.container {
  width: min(100% - 48px, 1120px);
  margin: 0 auto;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border: 0;
  border-radius: 999px;
  padding: .82rem 1.35rem;
  font-size: .9rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform .14s ease, background .14s ease, border-color .14s ease;
}
.btn:active { transform: scale(.975); }
.btn--green { background: var(--green); color: #fff; box-shadow: 0 10px 20px rgba(15,110,86,.16); }
.btn--green:hover { background: var(--green-deep); }
.btn--purple { background: var(--purple); color: #fff; box-shadow: 0 10px 20px rgba(123,103,199,.16); }
.btn--small { padding: .68rem 1rem; font-size: .82rem; }
.btn--tiny { padding: .48rem .8rem; font-size: .76rem; }
.btn--wide { width: 100%; }
.btn--cream { background: #FFF8EC; color: var(--green-deep); }
.btn--outline-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.55); }
.btn--dark { background: var(--ink); color: var(--paper); }
.btn--line { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }

.quiet-link {
  color: var(--green-deep);
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
}
.quiet-link:hover { text-decoration: underline; }

.site-header {
  position: sticky;
  top: .9rem;
  z-index: 20;
  width: min(1120px, calc(100% - 48px));
  margin: .9rem auto 0;
  border: 1px solid rgba(235, 224, 209, .78);
  border-radius: 12px;
  background: rgba(255,252,246,.9);
  box-shadow: 0 18px 40px rgba(40, 25, 12, .12);
  backdrop-filter: blur(18px);
}
.site-header .container {
  width: 100%;
}
.nav {
  position: relative;
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 1.25rem;
  padding: .5rem 1rem .5rem 1.35rem;
}
.nav__logo {
  color: var(--ink);
  font-size: 1.32rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}
.nav__logo span { color: var(--green); }
.nav__logo em {
  color: var(--coral);
  font-family: var(--font-hand);
  font-size: 1rem;
  font-style: normal;
  margin-left: .18rem;
}
.nav__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.8rem, 2vw, 1.8rem);
  min-width: 0;
}
.nav__links a {
  position: relative;
  color: var(--ink);
  font-size: .86rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.nav__links a:hover,
.nav__tools a:hover,
.nav__tools button:hover {
  color: var(--green-deep);
}
.nav__links .is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.55rem;
  height: 2px;
  border-radius: 999px;
  background: var(--green);
}
.nav__tools {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: .65rem;
}
.nav__tools > a:not(.nav__space),
.nav__tools > button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid rgba(216, 204, 186, .7);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}
.nav__space {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid rgba(216, 204, 186, .84);
  border-radius: 999px;
  background: rgba(255, 255, 255, .42);
  color: var(--ink);
  font-size: .86rem;
  font-weight: 650;
  padding: .45rem .9rem;
  text-decoration: none;
}
.nav__cta {
  display: inline-flex;
  align-items: center;
  background: var(--green);
  color: #fff;
  padding: .82rem 1.35rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(15,110,86,.16);
}
.nav__cta:hover { background: var(--green-deep); }
.nav__toggle {
  display: none;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 1.35rem;
  cursor: pointer;
}

.section-soft {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 72% 20%, rgba(244,196,108,.12), transparent 24rem),
    radial-gradient(circle at 18% 46%, rgba(228,243,235,.55), transparent 22rem);
}
.hero__inner {
  min-height: 540px;
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(350px, .97fr);
  align-items: center;
  gap: 4.5rem;
  padding: 4.25rem 0 3.1rem;
}
.hand-note {
  font-family: var(--font-hand);
  color: var(--green-deep);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  transform: rotate(-1.2deg);
  margin-bottom: 1.2rem;
}
.hand-note--small {
  font-size: 1.25rem;
  margin-bottom: .55rem;
}
.hand-note--coral { color: var(--coral); }
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(3.25rem, 7vw, 5.6rem);
  font-weight: 600;
  line-height: .96;
  margin-bottom: 1.45rem;
}
.text-mark {
  position: relative;
  color: var(--green);
  font-style: italic;
  white-space: nowrap;
}
.text-mark::after {
  content: '';
  position: absolute;
  left: .04em;
  right: -.04em;
  bottom: -.08em;
  height: .12em;
  border-radius: 999px;
  background: var(--amber);
  transform: rotate(-2deg);
}
.hero__sub {
  max-width: 34rem;
  color: var(--ink-soft);
  font-size: 1.07rem;
  line-height: 1.75;
  margin-bottom: .92rem;
}
.coverage-pills {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .2rem;
  margin-bottom: 1.22rem;
  padding: .36rem .6rem;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  background: rgba(255,255,255,.58);
  color: var(--green-deep);
  font-size: .86rem;
  font-weight: 650;
}
.coverage-pills span:not(:last-child)::after {
  content: '\2022';
  display: inline-block;
  margin: 0 .7rem;
  color: var(--green);
}
.hero-search {
  width: min(100%, 575px);
  min-height: 64px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: .75rem;
  padding: .5rem .55rem .5rem 1.1rem;
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  box-shadow: var(--shadow-soft);
}
.hero-search__icon { color: var(--ink); opacity: .8; }
.hero-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: .96rem;
}
.hero-search input::placeholder { color: #7A766E; }
.quick-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1.35rem;
  font-size: .84rem;
  color: var(--ink-soft);
}
.quick-row a {
  padding: .32rem .72rem;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  background: rgba(228,243,235,.72);
  color: var(--green-deep);
  font-weight: 600;
  text-decoration: none;
}
.quick-row a:hover { background: var(--green-soft); }

.hero__side {
  position: relative;
  min-height: 450px;
  display: grid;
  grid-template-columns: minmax(290px, 1fr) 190px;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 1rem 1.1rem;
}
.hero-sprig {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  opacity: .95;
  z-index: 0;
}
.study-card {
  position: relative;
  z-index: 1;
  width: min(100%, 290px);
  background: rgba(255,252,246,.86);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem .9rem;
}
.coming-soon-stamp {
  position: absolute;
  top: -14px;
  right: -14px;
  transform: rotate(7deg);
  z-index: 2;
  border: 2px solid var(--coral);
  border-radius: 999px;
  background: rgba(255,253,248,.96);
  color: var(--coral);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  padding: .38rem .62rem;
  text-transform: uppercase;
  box-shadow: 0 10px 20px rgba(44,44,42,.12);
}
.study-card--hero {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}
.card-kicker {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
}
.leaf-icon {
  color: var(--green);
  font-family: var(--font-hand);
  font-size: 1.6rem;
}
.study-card > p {
  color: var(--ink-soft);
  font-size: .86rem;
  margin: .2rem 0 .85rem;
}
.timer-display {
  font-family: var(--font-display);
  font-size: 3.85rem;
  line-height: 1;
  margin-bottom: .85rem;
}
.study-controls {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--ink-soft);
  font-size: .78rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--line);
}
.btn--disabled,
.return-card__cta--disabled {
  cursor: not-allowed;
  opacity: .64;
  text-decoration: none;
}
.toggle {
  width: 39px;
  height: 23px;
  border-radius: 999px;
  background: #D8D1C6;
  position: relative;
}
.toggle::before {
  content: '';
  position: absolute;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  right: 3px;
  top: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.study-meta {
  display: grid;
  gap: .55rem;
  padding: .72rem 0;
  border-bottom: 1px solid var(--line);
}
.study-meta dt,
.mini-label {
  color: var(--ink-faint);
  font-size: .72rem;
  font-weight: 600;
  margin-bottom: .05rem;
}
.study-meta dd {
  color: var(--ink);
  font-size: .84rem;
  font-weight: 500;
}
.study-meta div:first-child dd { font-weight: 700; }
.presence {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--ink-soft);
  font-size: .78rem;
  padding-top: .65rem;
}
.presence__people {
  color: var(--amber);
  letter-spacing: -.25em;
  font-size: 1.2rem;
}
.reassurance-card {
  grid-column: 1 / -1;
  grid-row: 2;
  justify-self: end;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(318px, 100%);
  background: rgba(255,248,236,.86);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  box-shadow: var(--shadow-soft);
  padding: 1rem 1.2rem;
}
.heart-icon {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amber-soft);
  border: 1px solid #F2D6A4;
  color: #513D1C;
}
.heart-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.reassurance-card p {
  color: var(--green-deep);
  font-size: .92rem;
  line-height: 1.55;
}
.reassurance-card strong { color: var(--ink); }

.return-section {
  padding: 2.75rem 0 2.25rem;
  border-bottom: 1px solid var(--line);
}
.return-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.4rem;
}
.return-head h2,
.section-intro h2,
.seo-hub h2 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3vw, 2.5rem);
  font-weight: 600;
  line-height: 1.08;
}
.return-head p,
.section-intro p,
.seo-hub p {
  color: var(--ink-soft);
  font-size: .95rem;
}
.return-head p { margin-top: .35rem; }
.return-head__link {
  color: var(--green);
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.return-head__link:hover { text-decoration: underline; }

.return-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.return-card,
.subject-card,
.help-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}
.return-card {
  --accent: var(--green);
  position: relative;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.2rem 1.15rem;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.78));
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.return-card:hover {
  transform: translateY(-3px);
  border-color: rgba(44,44,42,.34);
  box-shadow: 0 16px 36px rgba(44,44,42,.08);
}
.return-card__topline {
  position: absolute;
  top: 0;
  left: 1.1rem;
  right: 1.1rem;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: var(--accent);
  opacity: .75;
}
.return-card__header {
  margin-top: .4rem;
  margin-bottom: 1.25rem;
}
.return-card__header h3 {
  font-family: var(--font-display);
  font-size: 1.22rem;
  line-height: 1.2;
  font-weight: 600;
  margin-bottom: 4px;
}
.return-card__header span {
  display: inline-block;
  color: var(--ink-soft);
  font-size: .78rem;
}
.return-card__focus {
  margin-bottom: 1.1rem;
}
.return-card__focus span {
  display: block;
  color: var(--ink-faint);
  font-size: .72rem;
  margin-bottom: 2px;
}
.return-card__focus strong {
  display: block;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 700;
}
.return-progress {
  margin-top: auto;
  padding-top: .8rem;
}
.return-progress__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 8px;
}
.return-progress__meta span {
  color: var(--ink-soft);
  font-size: .75rem;
}
.return-progress__meta strong {
  color: var(--ink);
  font-size: .75rem;
  font-weight: 700;
}
.return-progress__bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(44,44,42,.11);
}
.return-progress__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.return-card__cta {
  display: inline-flex;
  align-items: center;
  margin-top: 1rem;
  color: var(--green);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
}
.return-card__cta:hover { text-decoration: underline; }
.return-card__body {
  color: var(--ink-soft);
  font-size: .82rem;
  line-height: 1.6;
  margin-top: .15rem;
  margin-bottom: auto;
}
.return-card--business { --accent: #5A9B80; }
.return-card--economics { --accent: #DF815B; }
.return-card--accounting { --accent: #8372D5; }
.return-card--new { --accent: #76A88D; }

.coverage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 14px;
  padding: 1rem 1.15rem;
  background: linear-gradient(90deg, rgba(228,243,235,.58), rgba(255,253,248,.82));
  border: 1px solid rgba(44,44,42,.14);
  border-radius: var(--radius-sm);
}
.coverage-bar p {
  color: var(--green);
  font-size: .86rem;
  font-weight: 700;
}
.coverage-bar a {
  color: var(--green);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.coverage-bar a:hover { text-decoration: underline; }

.section-warm {
  background:
    radial-gradient(circle at 20% 20%, rgba(244,196,108,.13), transparent 25rem),
    linear-gradient(180deg, rgba(255,248,236,.72), rgba(250,247,240,.92));
  border-bottom: 1px solid var(--line);
}
.explore-section { padding: 2.35rem 0; }
.explore-layout {
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr);
  gap: 2.25rem;
  align-items: center;
}
.section-intro p { margin: .75rem 0 1.25rem; }
.subject-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
}
.subject-card {
  min-height: 300px;
  padding: 1.2rem 1rem;
  text-align: center;
  display: grid;
  grid-template-rows: 118px 3.35rem 5.3rem 1.4rem;
  row-gap: .75rem;
  align-items: center;
  overflow: hidden;
}
.subject-card h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 550;
  margin-bottom: 0;
  width: 100%;
  align-self: center;
}
.subject-card p {
  color: var(--ink-soft);
  font-size: .84rem;
  line-height: 1.55;
  margin-bottom: 0;
  width: 100%;
  align-self: start;
}
.subject-card a {
  color: var(--green);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  min-height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: end;
}
.subject-card a:hover { text-decoration: underline; }
.subject-card .link-coral { color: var(--coral); }
.subject-card .link-purple { color: var(--purple); }
.subject-illustration {
  position: relative;
  width: 118px;
  height: 118px;
  max-width: 118px;
  min-width: 118px;
  max-height: 118px;
  min-height: 118px;
  margin: 0 auto .9rem;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,.45);
  box-shadow: inset 0 0 0 1px rgba(216,204,186,.55);
}
.subject-illustration img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.seo-hub {
  padding: 2.2rem 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.34);
}
.seo-hub__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  align-items: center;
  gap: 2rem;
}
.seo-hub p { margin-top: .7rem; max-width: 620px; }
.seo-link-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.seo-link-grid a {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: .75rem .9rem;
  border: 1px solid var(--green-line);
  border-radius: var(--radius-sm);
  background: rgba(228,243,235,.55);
  color: var(--green-deep);
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
}
.seo-link-grid a:hover { background: var(--green-soft); }

.guided-section { padding: 2.4rem 0; }
.guided-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 2.1rem;
  align-items: start;
}
.section-intro--guided { padding-top: .45rem; }
.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.55fr;
  gap: .95rem;
}
.help-card {
  padding: 1.15rem;
  min-height: 214px;
}
.help-card h3 {
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 600;
  margin: .95rem 0 .55rem;
}
.help-card p {
  color: var(--ink-soft);
  font-size: .82rem;
  line-height: 1.62;
  margin-bottom: 1rem;
}
.guidance-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin-bottom: 1.1rem;
}
.guidance-mark svg {
  width: 30px;
  height: 30px;
}
.guidance-mark--green {
  background: var(--green-soft);
  color: var(--green);
}
.guidance-mark--purple {
  background: var(--purple-soft);
  color: #6F63C7;
}
.help-card--study { padding: 1rem; }
.study-mini__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}
.study-mini__head h3 { margin: 0; }
.study-mini__head span {
  color: var(--green);
  font-size: .76rem;
  font-weight: 700;
}
.study-mini {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: .85rem;
  padding-bottom: .85rem;
}
.study-mini strong {
  display: block;
  font-size: .88rem;
  margin-bottom: .6rem;
}
.study-mini span {
  display: block;
  color: var(--ink-soft);
  font-size: .76rem;
  line-height: 1.45;
}
.mini-timer {
  min-width: 100px;
  text-align: center;
  border-left: 1px solid var(--line);
  padding-left: .9rem;
}
.mini-timer strong {
  font-family: var(--font-display);
  font-size: 2.4rem;
  line-height: 1;
}

.principles-section {
  padding: 2.75rem 0 3rem;
}
.principles-panel {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 15%, rgba(244,196,108,.16), transparent 34%),
    radial-gradient(circle at 86% 10%, rgba(228,243,235,.45), transparent 30%),
    linear-gradient(180deg, #FFFDF8 0%, #FBF4E8 100%);
  border: 1px solid rgba(36,36,33,.10);
  border-radius: 18px;
  padding: 3rem 2.6rem 2.7rem;
  box-shadow:
    0 20px 45px rgba(44,44,42,.06),
    0 1px 0 rgba(255,255,255,.75) inset;
}
.principles-panel::after {
  content: '';
  position: absolute;
  left: 2rem;
  right: 2rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(44,44,42,.12), transparent);
}
.principles-head {
  margin-bottom: 2.2rem;
}
.principles-kicker {
  display: inline-block;
  position: relative;
  font-family: var(--font-hand);
  font-size: 1.55rem;
  line-height: 1;
  color: var(--coral);
  transform: rotate(-.7deg);
  margin-bottom: 14px;
}
.principles-kicker::after {
  content: '';
  position: absolute;
  left: 68%;
  right: -18px;
  bottom: -5px;
  height: 3px;
  background: var(--coral);
  opacity: .75;
  border-radius: 999px;
  transform: rotate(-1.5deg);
}
.principles-head h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  font-weight: 600;
  max-width: 760px;
}
.principles-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.principle {
  --accent: var(--green);
  padding: .55rem 1.7rem .25rem;
  border-right: 1px solid rgba(44,44,42,.14);
}
.principle:first-child {
  padding-left: 0;
}
.principle:last-child {
  border-right: 0;
  padding-right: 0;
}
.principle h3 {
  position: relative;
  max-width: 220px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.18;
  font-weight: 600;
  margin-bottom: 1.55rem;
}
.principle h3::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -12px;
  width: 72px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  opacity: .78;
  transform: rotate(-1.4deg);
}
.principle p {
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.65;
  max-width: 230px;
}
.principle--green { --accent: var(--green); }
.principle--coral { --accent: var(--coral); }
.principle--amber { --accent: #D99A28; }
.principle--purple { --accent: var(--purple); }
.principle--sage { --accent: #6F8F73; }

.teacher-section { padding: 1.55rem 0; }
.teacher-banner {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(250px, 1fr) auto;
  align-items: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, #0D5D4A, #0B7658);
  color: #fff;
  border-radius: 16px;
  padding: 1.2rem 1.35rem;
  box-shadow: 0 16px 35px rgba(15,110,86,.18);
}
.teacher-plant {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.12);
  color: var(--amber);
  font-family: var(--font-hand);
  font-size: 3.2rem;
}
.teacher-banner h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 550;
  line-height: 1;
}
.hand-accent {
  font-family: var(--font-hand);
  font-size: 1.32rem;
  color: #FFF0D4;
  margin-top: .25rem;
}
.teacher-list {
  list-style: none;
  display: grid;
  gap: .35rem;
  color: rgba(255,255,255,.92);
  font-size: .84rem;
}
.teacher-list li::before {
  content: '\2713';
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.55);
  margin-right: .5rem;
  font-size: .7rem;
}
.teacher-actions {
  display: grid;
  gap: .75rem;
  min-width: 195px;
}

.stats-strip {
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.42);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.stats-grid article {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: .9rem;
  align-items: center;
  padding: 1.25rem 1.45rem;
  border-right: 1px dashed var(--line-strong);
}
.stats-grid article:last-child { border-right: 0; }
.stats-grid span {
  grid-row: span 2;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--green);
  background: rgba(255,248,236,.85);
}
.stats-grid strong {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1;
}
.stats-grid p { color: var(--ink-soft); font-size: .82rem; }

.ad-slot {
  margin: 2rem 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.45);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}
.ad-slot__label {
  font-size: .68rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.page-head { padding: 3rem 0 1rem; }
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  line-height: 1.08;
  margin-bottom: 12px;
}
.page-head p {
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 620px;
  margin-bottom: 1.25rem;
}
.page-head--split {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}
.zlabel {
  font-family: var(--font-hand);
  font-size: 1.45rem;
  color: var(--green);
  transform: rotate(-1deg);
  display: inline-block;
  margin-bottom: 1.25rem;
}
.finder {
  margin: 2.5rem 0;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.finder h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.finder > p { font-size: .9rem; color: var(--ink-soft); margin-bottom: 1.25rem; }
.finder__row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}
.finder select,
.finder input[type="search"],
.field input,
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: .9rem;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.75);
  color: var(--ink);
}
.finder select:focus,
.finder input:focus,
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--green);
}
.finder__search { display: flex; gap: 10px; margin-bottom: 1rem; }
.finder__search input { flex: 1; }
.quick-tags { display: flex; gap: 7px; flex-wrap: wrap; }
.quick-tags a {
  font-size: .8rem;
  color: var(--ink-soft);
  border: 1px solid var(--line-strong);
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
}
.quick-tags a:hover { border-color: var(--green); color: var(--green); }
.result-grid,
.feat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 3rem;
}
.result-card,
.empty-state,
.tool-panel,
.fcard {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}
.result-card,
.fcard,
.tool-panel,
.empty-state { padding: 1.35rem; }
.result-card h3,
.fcard h3,
.tool-panel h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: .55rem;
}
.result-card p,
.fcard p,
.tool-panel p,
.empty-state p {
  color: var(--ink-soft);
  font-size: .88rem;
}
.result-card__meta {
  font-size: .78rem;
  color: var(--ink-faint);
  margin: 14px 0 8px;
}
.ai-card__cta {
  display: inline-flex;
  margin-top: .8rem;
  color: var(--green);
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
}
.ai-card__cta:hover { text-decoration: underline; }
.ai-badge {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: .25rem .7rem;
  border-radius: 999px;
  margin-bottom: .8rem;
}
.ai-badge--green { background: var(--green-soft); color: var(--green-deep); }
.ai-badge--purple { background: var(--purple-soft); color: var(--purple); }

/* ---------- Virtual Library ---------- */

.library-hero {
  padding: 3.3rem 0 2rem;
  background:
    linear-gradient(180deg, rgba(255,253,248,.94), rgba(247,244,236,.88));
  border-bottom: 1px solid var(--line);
}
.library-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 2rem;
  align-items: center;
}
.library-hero h1 {
  max-width: 680px;
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 5.8rem);
  font-weight: 600;
  line-height: .95;
  margin-bottom: 1rem;
}
.library-hero p:not(.hand-note) {
  max-width: 650px;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.75;
}
.library-window {
  position: relative;
  min-height: 260px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255,255,255,.82), rgba(255,252,246,.92));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.library-window::before {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 34px;
  height: 16px;
  border-radius: 999px;
  background: rgba(44,44,42,.12);
}
.library-window span {
  position: absolute;
  bottom: 50px;
  width: 54px;
  border: 1px solid rgba(44,44,42,.14);
  border-radius: 7px 7px 3px 3px;
  box-shadow: 0 16px 24px rgba(44,44,42,.1);
}
.library-window span:nth-child(1) {
  left: 22%;
  height: 150px;
  background: linear-gradient(180deg, var(--green-soft), #fff);
}
.library-window span:nth-child(2) {
  left: 43%;
  height: 190px;
  background: linear-gradient(180deg, var(--amber-soft), #fff);
}
.library-window span:nth-child(3) {
  left: 64%;
  height: 132px;
  background: linear-gradient(180deg, var(--purple-soft), #fff);
}
.library-section {
  padding: 2.4rem 0 .5rem;
}
.library-path-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 2.6rem;
}
.library-path {
  min-height: 245px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 1.35rem;
}
.library-path--muted {
  background: rgba(255,255,255,.58);
}
.library-path__tag,
.library-path__soon {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: .75rem;
  font-weight: 800;
  padding: .28rem .68rem;
  margin-bottom: 1rem;
}
.library-path__soon {
  margin-top: auto;
  background: var(--amber-soft);
  color: var(--coral);
}
.library-path h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: .65rem;
}
.library-path p {
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.65;
}
.library-path__link {
  margin-top: auto;
  color: var(--green);
  font-size: .9rem;
  font-weight: 800;
  text-decoration: none;
}
.library-path__room {
  display: inline-flex;
  width: fit-content;
  margin: .85rem 0 1rem;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  padding: .58rem .85rem;
  text-decoration: none;
}
.library-path__room:hover {
  background: var(--green-deep);
}
.library-book-list {
  display: grid;
  gap: 8px;
  margin-top: auto;
}
.library-book {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border-left: 8px solid var(--green);
  border-radius: 7px;
  background: rgba(255,253,248,.85);
  color: var(--ink);
  font-size: .9rem;
  font-weight: 800;
  padding: .55rem .7rem;
  text-decoration: none;
}
.library-book:nth-child(2n) { border-left-color: var(--coral); }
.library-book:nth-child(3n) { border-left-color: var(--purple); }
.library-book--soon {
  opacity: .7;
}
.library-book small {
  color: var(--ink-faint);
  font-size: .7rem;
}
.book-shelf {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 260px;
  padding: 1.2rem 1.2rem 2rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255,255,255,.75), rgba(255,252,246,.9));
  box-shadow: var(--shadow-soft);
}
.topic-book {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(44,44,42,.12);
  border-radius: 8px 8px 4px 4px;
  color: var(--ink);
  padding: .9rem .75rem;
  box-shadow: 0 16px 24px rgba(44,44,42,.1);
}
.topic-book span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}
.topic-book small {
  color: var(--ink-faint);
  font-weight: 800;
}
.topic-book--1 { background: var(--green-soft); }
.topic-book--2 { background: var(--amber-soft); }
.topic-book--3 { background: var(--purple-soft); }
.topic-book--4 { background: var(--coral-soft); }

/* ---------- Syllabus Library Room ---------- */

.library-room {
  min-height: calc(100vh - 74px);
  background:
    linear-gradient(90deg, rgba(35, 22, 11, .08), rgba(255, 250, 240, .0) 34%, rgba(35, 22, 11, .08)),
    url('/assets/img/library-background.png') center top / cover no-repeat fixed;
}

.library-room__shade {
  min-height: inherit;
  padding: 1rem 0 1.25rem;
  background: linear-gradient(180deg, rgba(255, 248, 236, .0), rgba(48, 31, 15, .06));
}

.library-room__layout.container {
  width: min(100% - 42px, 1480px);
}

.library-room__layout {
  display: grid;
  grid-template-columns: minmax(190px, 225px) minmax(760px, 1fr) minmax(235px, 280px);
  gap: 14px;
  align-items: start;
}

.library-room__sidebar,
.opened-book {
  display: grid;
  gap: 12px;
}

.room-side-card,
.opened-book,
.library-room__panel {
  border: 1px solid rgba(235, 224, 209, .62);
  border-radius: 13px;
  background: rgba(255, 252, 246, .68);
  box-shadow: 0 14px 32px rgba(32, 21, 12, .12);
  backdrop-filter: blur(7px);
}

.room-side-card {
  padding: .85rem;
}

.room-side-card__label,
.opened-book__eyebrow {
  display: block;
  color: var(--green-deep);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
  margin-bottom: .45rem;
  text-transform: uppercase;
}

.room-side-card h2 {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: .45rem;
}

.room-side-card p,
.opened-book p,
.library-room__head p {
  color: var(--ink-soft);
  font-size: .84rem;
  line-height: 1.58;
}

.room-side-card--links {
  display: grid;
  gap: 8px;
}

.room-side-card--links a,
.room-side-card--links span {
  display: flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid rgba(216, 204, 186, .82);
  border-radius: 8px;
  background: rgba(255,255,255,.56);
  color: var(--ink);
  font-size: .79rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 7px;
  padding: .52rem .62rem;
  text-decoration: none;
}

.room-side-card--links a:hover {
  border-color: var(--green-line);
  color: var(--green-deep);
}

.room-side-card--links span {
  color: var(--ink-faint);
}

.library-room__panel {
  overflow: hidden;
  min-height: calc(100vh - 106px);
  background: rgba(255, 252, 246, .58);
}

.library-room__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .95rem 1.15rem .68rem;
}

.library-room__head h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 3.2vw, 3.15rem);
  font-weight: 600;
  line-height: .98;
  margin-bottom: .2rem;
}

.library-room__room-name {
  display: inline-flex;
  width: fit-content;
  border-bottom: 2px solid rgba(15, 110, 86, .42);
  color: var(--green-deep);
  font-size: .84rem;
  font-weight: 800;
  margin-bottom: .55rem;
  padding-bottom: .12rem;
}

.library-room__toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  padding: 0 1.15rem .68rem;
}

.library-room__toolbar > span {
  color: var(--ink-soft);
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}

.library-room__search input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255,255,255,.72);
  color: var(--ink);
  min-height: 42px;
  padding: .62rem .78rem;
}

.library-room__search input:focus {
  border-color: var(--green);
  outline: 0;
}

.library-shelves {
  display: grid;
  gap: .72rem;
  padding: 0 .95rem 1rem;
}

.library-shelf-row {
  position: relative;
}

.library-shelf-row::after {
  content: '';
  display: block;
  height: 11px;
  border-radius: 2px 2px 8px 8px;
  background: linear-gradient(180deg, #A9773F, #6D431E);
  box-shadow: 0 8px 16px rgba(47, 29, 13, .2);
}

.library-shelf-row__title {
  display: flex;
  align-items: center;
  gap: .8rem;
  margin: 0 0 .38rem .35rem;
}

.library-shelf-row__title h2 {
  font-family: var(--font-display);
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.15;
}

.library-shelf-row__title span {
  color: var(--ink-soft);
  font-size: .78rem;
  font-weight: 800;
}

.library-book-spines {
  display: flex;
  align-items: end;
  gap: 3px;
  min-width: 0;
  overflow-x: auto;
  padding: 0 .2rem;
  scrollbar-color: rgba(15,110,86,.36) transparent;
}

.syllabus-book {
  position: relative;
  flex: 0 0 36px;
  width: 36px;
  height: 132px;
  border: 1px solid rgba(55, 37, 18, .18);
  border-radius: 6px 6px 3px 3px;
  color: rgba(35, 28, 20, .88);
  cursor: pointer;
  padding: .36rem .18rem;
  box-shadow:
    inset 5px 0 8px rgba(255,255,255,.18),
    inset -6px 0 8px rgba(54, 31, 15, .1),
    0 10px 15px rgba(32, 21, 12, .14);
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}

.syllabus-book:hover,
.syllabus-book.is-active {
  filter: saturate(1.08);
  transform: translateY(-6px);
  box-shadow:
    inset 6px 0 10px rgba(255,255,255,.18),
    inset -7px 0 10px rgba(54, 31, 15, .12),
    0 20px 26px rgba(32, 21, 12, .2);
}

.syllabus-book.is-active::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.76);
}

.syllabus-book span,
.syllabus-book strong {
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}

.syllabus-book span {
  position: absolute;
  left: 50%;
  bottom: 11px;
  transform: translateX(-50%) rotate(180deg);
  color: rgba(255,255,255,.9);
  font-size: .76rem;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,.28);
}

.syllabus-book strong {
  max-height: 92px;
  overflow: hidden;
  text-overflow: clip;
  color: rgba(36, 28, 20, .88);
  font-family: var(--font-display);
  font-size: .64rem;
  font-weight: 600;
  line-height: 1;
  margin: 0 auto;
}

.syllabus-book--1 { background: linear-gradient(90deg, #B88454, #D3A06D 54%, #A97449); }
.syllabus-book--2 { background: linear-gradient(90deg, #A9774D, #D49A66 54%, #95633F); }
.syllabus-book--3 { background: linear-gradient(90deg, #7F9166, #A8B786 54%, #6D8058); }
.syllabus-book--4 { background: linear-gradient(90deg, #8E7058, #B99776 54%, #785B47); }
.syllabus-book--5 { background: linear-gradient(90deg, #C4866E, #DFA893 54%, #AD715D); }

.opened-book {
  position: sticky;
  top: 92px;
  padding: .95rem;
}

.opened-book h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: .7rem;
}

.opened-book__actions {
  display: grid;
  gap: 8px;
  margin-top: 1rem;
}

.opened-book__chip {
  display: flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255,255,255,.62);
  color: var(--ink-soft);
  font-size: .8rem;
  font-weight: 800;
  padding: .55rem .8rem;
  text-decoration: none;
}

.opened-book__chip--link {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  justify-content: center;
}

.opened-book__chip--link:hover {
  background: var(--green-deep);
}

.library-empty {
  padding: 1.55rem;
}

.library-empty h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: .5rem;
}

.library-empty p {
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.tool-shell {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 1rem;
  padding-bottom: 3rem;
}
.field {
  display: block;
  margin-bottom: 1rem;
}
.field span {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.field textarea { resize: vertical; }
.tool-panel--response {
  background: var(--green-soft);
  border-color: var(--green-line);
}
.topic-stat {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  min-width: 190px;
  padding: 1.25rem;
  text-align: center;
}
.topic-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 3rem;
  line-height: 1;
  color: var(--green);
}
.topic-stat span {
  display: block;
  margin-top: 8px;
  font-size: .8rem;
  color: var(--ink-faint);
}

/* ---------- Study Room ---------- */

.study-room-page {
  background:
    linear-gradient(180deg, rgba(255,253,248,.7) 0%, rgba(250,247,240,.92) 100%);
}

.study-room-hero {
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,253,248,.92), rgba(247,244,236,.88));
}

.study-room-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, .98fr);
  gap: 2.2rem;
  align-items: center;
  padding: 3.3rem 0 2.7rem;
}

.study-room-hero__grid > *,
.study-desk > *,
.study-picker > * {
  min-width: 0;
}

.study-room-hero__copy h1 {
  max-width: 680px;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 5.4vw, 5.2rem);
  line-height: .98;
  font-weight: 600;
  margin-bottom: 1rem;
}

.study-room-hero__copy > p:not(.hand-note) {
  max-width: 650px;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.75;
  margin-bottom: 1.35rem;
}

.study-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 760px;
  min-width: 0;
  margin-bottom: 1rem;
}

.study-picker label,
.leave-note label,
.sound-volume {
  display: grid;
  gap: 6px;
}

.study-picker span,
.leave-note label span,
.sound-volume span,
.intention-card label {
  font-size: .74rem;
  color: var(--ink-faint);
  font-weight: 700;
}

.study-picker select,
.leave-note select,
.questions-tried input,
.intention-card textarea,
.practice-card textarea {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255,255,255,.8);
  color: var(--ink);
  padding: .72rem .78rem;
}

.study-picker select:focus,
.leave-note select:focus,
.questions-tried input:focus,
.intention-card textarea:focus,
.practice-card textarea:focus {
  outline: none;
  border-color: var(--green);
}

.study-picker__topic {
  grid-column: span 2;
}

.study-room-hero__actions {
  display: flex;
  gap: .7rem;
  flex-wrap: wrap;
}

.room-card,
.desk-panel,
.desk-main {
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.room-card {
  padding: 1.1rem;
}

.room-card__head,
.desk-panel__head,
.note-stream__head,
.desk-topic-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.room-card__head {
  margin-bottom: .9rem;
}

.room-card .zlabel,
.desk-panel .zlabel {
  margin-bottom: .15rem;
  font-size: 1.12rem;
}

.room-card h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.1;
}

.sound-toggle,
.note-stream__head button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  color: var(--green-deep);
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
  padding: .48rem .72rem;
}

.sound-toggle[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.room-view {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 10;
  min-height: 280px;
  overflow: hidden;
  border: 1px solid rgba(44,44,42,.12);
  border-radius: 10px;
  background: #EAF2E3;
}

.room-view__sky,
.room-view__mountain,
.room-view__water,
.room-view__fall,
.room-view__desk {
  position: absolute;
}

.room-view__sky {
  inset: 0 0 32%;
  background:
    linear-gradient(180deg, rgba(255,253,248,.95), rgba(222,239,232,.7));
  z-index: 1;
}

.room-view__mountain {
  left: 0;
  right: 0;
  bottom: 28%;
  height: 46%;
  z-index: 2;
  clip-path: polygon(0 100%, 16% 48%, 31% 72%, 48% 28%, 68% 78%, 83% 45%, 100% 100%);
  background: rgba(119,139,112,.72);
}

.room-view__mountain--back {
  bottom: 35%;
  height: 40%;
  opacity: .35;
  transform: translateX(-5%);
}

.room-view__mountain--front {
  background: rgba(78,108,96,.62);
}

.room-view__water {
  left: 0;
  right: 0;
  bottom: 0;
  height: 36%;
  z-index: 3;
  background:
    repeating-linear-gradient(168deg, rgba(255,255,255,.28) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, rgba(138,190,183,.78), rgba(74,137,145,.9));
  background-size: 120px 100%, 100% 100%;
}

.room-view__fall {
  display: none;
  top: 20%;
  left: 49%;
  width: 54px;
  height: 57%;
  z-index: 4;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.76) 0 4px, rgba(179,221,219,.62) 4px 10px);
  opacity: .86;
}

.room-view__desk {
  left: 50%;
  bottom: 24px;
  width: min(82%, 390px);
  transform: translateX(-50%);
  z-index: 5;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: .75rem;
  padding: .82rem .92rem;
  border: 1px solid rgba(44,44,42,.18);
  border-radius: 8px;
  background: rgba(255,253,248,.9);
  box-shadow: 0 18px 35px rgba(44,44,42,.12);
}

.room-view__desk span {
  width: 42px;
  height: 30px;
  border: 2px solid var(--green);
  border-radius: 5px 5px 12px 12px;
  border-top: 0;
  position: relative;
}

.room-view__desk span::before {
  content: '';
  position: absolute;
  right: -12px;
  top: 6px;
  width: 14px;
  height: 12px;
  border: 2px solid var(--green);
  border-left: 0;
  border-radius: 0 10px 10px 0;
}

.room-view__desk strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.15;
}

.room-view[data-room="garden"] {
  background: #E9F2E4;
}

.room-view[data-room="garden"] .room-view__water {
  height: 38%;
  background:
    repeating-linear-gradient(168deg, rgba(255,255,255,.18) 0 1px, transparent 1px 20px),
    linear-gradient(180deg, #CADAB5, #9DB887);
}

.room-view[data-room="ocean"] .room-view__mountain {
  display: none;
}

.room-view[data-room="ocean"] .room-view__sky {
  background: linear-gradient(180deg, #FDF7EC, #D9EEF0 74%, #A8CED1);
}

.room-view[data-room="ocean"] .room-view__water {
  height: 58%;
  background:
    repeating-linear-gradient(175deg, rgba(255,255,255,.35) 0 2px, transparent 2px 28px),
    linear-gradient(180deg, #8FC4C8, #3F8894);
}

.room-view[data-room="mountain"] .room-view__water {
  height: 28%;
  background: linear-gradient(180deg, #B8C9A7, #899C72);
}

.room-view[data-room="mountain"] .room-view__mountain--front {
  background: rgba(82,102,91,.82);
}

.room-view[data-room="waterfall"] .room-view__fall {
  display: block;
}

.room-view[data-room="waterfall"] .room-view__water {
  background:
    repeating-linear-gradient(168deg, rgba(255,255,255,.35) 0 2px, transparent 2px 19px),
    linear-gradient(180deg, #A4CFCA, #5C9B99);
}

.room-theme-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: .9rem 0 .8rem;
}

.room-theme,
.timer-lengths button,
.clarity-buttons button,
.desk-tabs button,
.mcq-options button,
.shelf-options button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 700;
  min-height: 38px;
  padding: .55rem .75rem;
}

.room-theme.is-active,
.timer-lengths button.is-active,
.clarity-buttons button.is-active,
.desk-tabs button.is-active,
.shelf-options button.is-active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.sound-volume input {
  width: 100%;
  accent-color: var(--green);
}

.study-desk {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(280px, 330px);
  gap: 14px;
  align-items: start;
  padding: 1.6rem 0 3.2rem;
}

.desk-panel,
.desk-main {
  padding: 1.2rem;
}

.desk-panel__head {
  margin-bottom: 1rem;
}

.desk-panel__head > span {
  color: var(--ink-faint);
  font-size: .76rem;
  font-weight: 700;
}

.study-timer {
  font-family: var(--font-display);
  font-size: clamp(3.8rem, 7vw, 5.8rem);
  line-height: .9;
  letter-spacing: 0;
  margin-bottom: 1rem;
}

.timer-controls,
.resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.timer-lengths {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 1rem 0;
}

.break-mode {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--ink-soft);
  font-size: .84rem;
  margin-bottom: 1rem;
}

.break-mode input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.intention-card {
  display: grid;
  gap: .45rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.intention-card textarea,
.practice-card textarea {
  resize: vertical;
  min-height: 96px;
}

.desk-main {
  min-height: 610px;
}

.desk-topic-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.desk-topic-head .zlabel {
  margin-bottom: .25rem;
  font-size: 1.1rem;
}

.desk-topic-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 3.1vw, 2.65rem);
  line-height: 1.05;
  font-weight: 600;
  margin-bottom: .45rem;
}

.desk-topic-head p {
  color: var(--ink-soft);
  max-width: 620px;
}

.question-count {
  flex: 0 0 auto;
  border: 1px solid var(--green-line);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: .78rem;
  font-weight: 700;
  padding: .45rem .75rem;
  white-space: nowrap;
}

.clarity-path {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.clarity-path h3,
.note-stream h3,
.leave-note h3 {
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.2;
  font-weight: 600;
}

.clarity-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: .8rem 0;
}

#clarityPrompt {
  color: var(--ink-soft);
  font-size: .9rem;
}

.desk-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 1rem;
}

.desk-resource-panel {
  min-height: 310px;
}

.resource-kicker {
  display: inline-flex;
  color: var(--coral);
  font-size: .75rem;
  font-weight: 800;
  margin-bottom: .45rem;
}

.resource-notes h3,
.practice-card h3,
.check-card h3,
.return-shelf-card h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: .65rem;
}

.resource-lead,
.practice-card p,
.mcq-feedback,
.save-feedback {
  color: var(--ink-soft);
}

.formula-box {
  border-left: 4px solid var(--amber);
  background: rgba(255,240,212,.65);
  border-radius: 6px;
  font-weight: 700;
  margin: 1rem 0;
  padding: .78rem .9rem;
}

.resource-notes ol {
  display: grid;
  gap: .55rem;
  color: var(--ink-soft);
  margin: 0 0 1.15rem 1.2rem;
}

.exam-checklist {
  display: grid;
  gap: .55rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 1rem 0;
  padding: 1rem 0;
}

.exam-checklist label {
  color: var(--ink-soft);
  font-size: .9rem;
}

.exam-checklist input {
  accent-color: var(--green);
  margin-right: .35rem;
}

.mcq-options,
.shelf-options {
  display: grid;
  gap: 8px;
  margin: 1rem 0;
}

.mcq-options {
  grid-template-columns: repeat(2, 1fr);
}

.mcq-options button {
  border-radius: 8px;
  text-align: left;
  min-height: 48px;
}

.mcq-options button.is-correct {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-deep);
}

.mcq-options button.is-wrong {
  background: var(--coral-soft);
  border-color: var(--coral);
  color: var(--coral);
}

.questions-tried {
  display: grid;
  gap: .45rem;
  color: var(--ink-soft);
  font-size: .86rem;
  margin-bottom: 1rem;
  max-width: 210px;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.progress-stats article {
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: .7rem;
  text-align: center;
}

.progress-stats strong {
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1;
  color: var(--green);
}

.progress-stats span {
  color: var(--ink-faint);
  font-size: .7rem;
  font-weight: 700;
}

.note-stream {
  border-bottom: 1px solid var(--line);
  padding: 1rem 0;
}

.student-note {
  border-left: 4px solid var(--green-line);
  margin-top: .85rem;
  padding-left: .85rem;
}

.student-note span {
  color: var(--green-deep);
  font-size: .75rem;
  font-weight: 800;
}

.student-note p {
  color: var(--ink);
  font-size: .9rem;
  line-height: 1.55;
  margin: .35rem 0;
}

.student-note small {
  color: var(--ink-faint);
  font-size: .75rem;
}

.leave-note {
  display: grid;
  gap: .72rem;
  padding-top: 1rem;
}

.note-preview {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: .83rem;
  line-height: 1.55;
  padding: .8rem;
}

@media (prefers-reduced-motion: no-preference) {
  .room-view__water {
    animation: room-water 18s linear infinite;
  }
  .room-view__fall {
    animation: room-fall 1.6s linear infinite;
  }
}

@keyframes room-water {
  from { background-position: 0 0, 0 0; }
  to { background-position: 120px 0, 0 0; }
}

@keyframes room-fall {
  from { background-position: 0 0; }
  to { background-position: 42px 0; }
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.75rem 0;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.site-footer span { font-size: .8rem; color: var(--ink-faint); }

@media (max-width: 1080px) {
  .return-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teacher-banner { grid-template-columns: auto 1fr; }
  .teacher-list, .teacher-actions { grid-column: 2; }
  .library-room__layout {
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  }
  .opened-book {
    grid-column: 2;
    position: static;
  }
  .study-desk {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .desk-main {
    grid-column: 1 / -1;
    order: -1;
  }
}

@media (max-width: 980px) {
  .principles-panel {
    padding: 2.5rem 2rem;
  }
  .principles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem 0;
  }
  .principle {
    padding: 0 1.4rem;
  }
  .principle:nth-child(2n) {
    border-right: 0;
  }
  .principle:nth-child(2n + 1) {
    padding-left: 0;
  }
  .principle:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid rgba(44,44,42,.12);
    padding-top: 1.7rem;
  }
}

@media (max-width: 920px) {
  .container { width: min(100% - 36px, 1120px); }
  .nav__links { display: none; }
  .nav__toggle { display: block; }
  .nav__links.is-open {
    position: absolute;
    top: calc(100% + .55rem);
    left: -1.35rem;
    right: -1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    border: 1px solid rgba(235, 224, 209, .84);
    border-radius: 12px;
    background: rgba(255,253,248,.98);
    box-shadow: 0 16px 34px rgba(40, 25, 12, .12);
    padding: 1rem 1.35rem;
  }
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 2.25rem;
    min-height: 0;
    padding: 3rem 0 2.7rem;
  }
  .hero__side { min-height: 390px; justify-content: flex-start; }
  .study-card--hero { margin-right: 0; margin-left: 2rem; }
  .hero-sprig { right: .5rem; }
  .reassurance-card { right: 1rem; }
  .explore-layout,
  .guided-layout,
  .seo-hub__inner { grid-template-columns: 1fr; }
  .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-grid { grid-template-columns: 1fr; }
  .section-intro { max-width: 560px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .result-grid,
  .feat-grid { grid-template-columns: repeat(2, 1fr); }
  .library-hero__inner,
  .tool-shell,
  .page-head--split { grid-template-columns: 1fr; }
  .library-room {
    background-attachment: scroll;
  }
  .library-room__layout {
    grid-template-columns: 1fr;
  }
  .library-room__sidebar,
  .opened-book {
    grid-column: auto;
  }
  .library-room__sidebar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .library-room__head {
    display: block;
  }
  .library-room__head .quiet-link {
    margin-top: .8rem;
  }
  .library-path-grid {
    grid-template-columns: 1fr;
  }
  .book-shelf {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .study-room-hero__grid {
    grid-template-columns: 1fr;
    gap: 1.35rem;
    padding: 2.6rem 0 2.2rem;
  }
  .study-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .study-desk {
    grid-template-columns: 1fr;
  }
  .desk-main {
    grid-column: auto;
    order: 0;
  }
}

@media (max-width: 640px) {
  .container { width: min(100% - 28px, 1120px); }
  .site-header {
    top: .65rem;
    width: min(100% - 28px, 1120px);
    margin-top: .65rem;
  }
  .nav { min-height: 66px; }
  .nav__tools > a:not(.nav__space),
  .nav__tools > button {
    display: none;
  }
  .nav__cta { display: none; }
  .hero h1 { font-size: 3.3rem; }
  .hero-search {
    grid-template-columns: auto 1fr;
    padding: .85rem .9rem;
  }
  .hero-search .btn { grid-column: 1 / -1; width: 100%; }
  .coverage-pills { border-radius: 16px; }
  .coverage-pills span:not(:last-child)::after { margin: 0 .45rem; }
  .hero__side { min-height: auto; display: block; }
  .study-card, .study-card--hero { width: 100%; margin: 0; }
  .hero-sprig { display: none; }
  .reassurance-card { position: static; width: 100%; margin-top: 1rem; }
  .section-head { display: block; }
  .quiet-link { display: inline-block; margin-top: .65rem; }
  .return-grid,
  .subject-grid,
  .stats-grid,
  .result-grid,
  .feat-grid,
  .book-shelf,
  .seo-link-grid { grid-template-columns: 1fr; }
  .library-hero h1 { font-size: 3.15rem; }
  .library-window { min-height: 210px; }
  .library-room__shade {
    padding: 1rem 0 1.4rem;
  }
  .library-room__sidebar {
    grid-template-columns: 1fr;
  }
  .library-room__head,
  .library-room__toolbar,
  .library-shelves {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .library-room__toolbar {
    grid-template-columns: 1fr;
  }
  .library-room__head h1 {
    font-size: 2.7rem;
  }
  .library-shelf-row__title {
    display: block;
  }
  .syllabus-book {
    flex-basis: 44px;
    width: 44px;
    height: 164px;
  }
  .syllabus-book strong {
    max-height: 118px;
    font-size: .74rem;
  }
  .topic-book {
    min-height: 82px;
  }
  .topic-book span {
    writing-mode: horizontal-tb;
    transform: none;
  }
  .return-section { padding-top: 2.1rem; }
  .return-head { display: block; }
  .return-head__link {
    display: inline-flex;
    margin-top: .8rem;
  }
  .return-card { min-height: auto; }
  .coverage-bar { display: block; }
  .coverage-bar a {
    display: inline-flex;
    margin-top: .75rem;
  }
  .principles-section { padding: 2rem 0; }
  .principles-panel {
    padding: 2rem 1.35rem;
    border-radius: 16px;
  }
  .principles-head { margin-bottom: 1.8rem; }
  .principles-kicker { font-size: 1.4rem; }
  .principles-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .principle,
  .principle:first-child,
  .principle:last-child {
    border-right: 0;
    border-top: 1px solid rgba(44,44,42,.12);
    padding: 1.45rem 0;
  }
  .principle:first-child {
    border-top: 0;
    padding-top: 0;
  }
  .principle h3 {
    font-size: 1.2rem;
    margin-bottom: 1.35rem;
  }
  .principle p {
    max-width: none;
  }
  .teacher-banner { grid-template-columns: 1fr; text-align: left; }
  .teacher-list, .teacher-actions { grid-column: auto; }
  .teacher-plant { display: none; }
  .stats-grid article { border-right: 0; border-bottom: 1px dashed var(--line-strong); }
  .stats-grid article:last-child { border-bottom: 0; }
  .finder__row { grid-template-columns: 1fr; }
  .finder__search { flex-direction: column; }
  .study-room-hero__copy h1 { font-size: 3.15rem; }
  .study-picker,
  .room-theme-row,
  .clarity-buttons,
  .desk-tabs,
  .mcq-options {
    grid-template-columns: 1fr;
  }
  .study-picker__topic {
    grid-column: auto;
  }
  .study-room-hero__actions,
  .timer-controls,
  .resource-actions {
    flex-direction: column;
  }
  .study-room-hero__actions .btn,
  .timer-controls .btn,
  .resource-actions .btn {
    width: 100%;
  }
  .room-card__head,
  .desk-topic-head,
  .desk-panel__head,
  .note-stream__head {
    display: block;
  }
  .sound-toggle,
  .note-stream__head button,
  .question-count {
    display: inline-flex;
    margin-top: .7rem;
  }
  .room-view {
    aspect-ratio: 4 / 3;
    min-height: 0;
  }
  .progress-stats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Library Room v2: tabletop shelf ---------- */

.library-room {
  min-height: calc(100vh - 74px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(26, 18, 9, .08), transparent 28%, transparent 72%, rgba(26, 18, 9, .08)),
    url('/assets/img/library-background.png') center top / cover no-repeat fixed;
}

.library-room__shade {
  position: relative;
  min-height: calc(100vh - 74px);
  padding: 0;
  background: linear-gradient(180deg, rgba(255, 250, 240, .02), rgba(38, 25, 13, .04));
}

.library-room__layout,
.library-room__layout.container {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 74px);
  margin: 0;
  display: block;
}

.library-topic-header {
  position: absolute;
  z-index: 4;
  top: clamp(1rem, 2.4vh, 1.55rem);
  left: clamp(1rem, 5vw, 4.6rem);
  width: min(620px, 43vw);
  border: 1px solid rgba(232, 221, 207, .64);
  border-radius: 14px;
  background: rgba(255, 252, 246, .74);
  box-shadow: 0 16px 34px rgba(37, 23, 12, .12);
  backdrop-filter: blur(8px);
  padding: .9rem 1rem .95rem;
}

.library-topic-header .hand-note {
  margin-bottom: .35rem;
  font-size: 1.1rem;
}

.library-topic-header__title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .6rem;
}

.library-topic-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 2.8vw, 2.55rem);
  font-weight: 600;
  line-height: .98;
}

.library-topic-header__title span {
  display: block;
  color: var(--ink-soft);
  font-size: .76rem;
  font-weight: 700;
  margin-top: .18rem;
}

.library-topic-header__current {
  display: grid;
  gap: .22rem;
  border-top: 1px solid rgba(216, 204, 186, .72);
  padding-top: .58rem;
  margin-bottom: .7rem;
}

.library-topic-header__current > span {
  color: var(--green-deep);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.library-topic-header__current strong {
  color: var(--ink);
  font-size: clamp(1rem, 1.45vw, 1.22rem);
  font-weight: 800;
  line-height: 1.25;
}

.library-topic-header__tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
  align-items: center;
}

.library-room__search input {
  min-height: 38px;
  border: 1px solid rgba(205, 190, 171, .88);
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  padding: .55rem .8rem;
  font-size: .84rem;
}

.library-topic-header__paper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: .78rem;
  font-weight: 800;
  padding: .55rem .85rem;
  text-decoration: none;
  white-space: nowrap;
}

.library-topic-header__paper:hover {
  background: var(--green-deep);
}

.library-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .7rem;
}

.library-quick-row a,
.library-quick-row span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(205, 190, 171, .74);
  border-radius: 999px;
  background: rgba(255,255,255,.48);
  color: var(--ink-soft);
  font-size: .72rem;
  font-weight: 750;
  padding: .33rem .62rem;
  text-decoration: none;
}

.library-quick-row a {
  color: var(--green-deep);
}

.library-table-stage {
  position: absolute;
  z-index: 3;
  left: clamp(11rem, 20vw, 21rem);
  bottom: clamp(4.2rem, 10vh, 7rem);
  width: min(880px, 58vw);
  padding: 0 .75rem .8rem;
}

.library-table-stage__shadow {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: .2rem;
  height: 26px;
  border-radius: 50%;
  background: rgba(50, 31, 14, .22);
  filter: blur(15px);
}

.library-shelves {
  position: relative;
  z-index: 1;
  display: grid;
  gap: .58rem;
  padding: .4rem .35rem .2rem;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.08), transparent 18%, transparent 82%, rgba(73,43,20,.08));
  box-shadow: none;
  backdrop-filter: none;
}

.library-shelves::before,
.library-shelves::after {
  display: none;
}

.library-shelf-row {
  position: relative;
  padding-bottom: .28rem;
}

.library-shelf-row::after {
  height: 12px;
  margin-top: -2px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #C79668 0%, #A97246 55%, #8D5E39 100%);
  box-shadow:
    0 4px 10px rgba(70, 42, 20, .18),
    inset 0 1px 0 rgba(255,255,255,.28);
}

.library-shelf-row__title {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 .24rem .25rem;
}

.library-shelf-row__title h2 {
  max-width: 70%;
  color: rgba(39, 28, 19, .82);
  font-family: var(--font-display);
  font-size: .88rem;
  font-weight: 650;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-shelf-row__title span {
  color: rgba(88, 74, 55, .75);
  font-size: .68rem;
  font-weight: 800;
  white-space: nowrap;
}

.library-book-spines {
  min-height: 122px;
  display: flex;
  align-items: end;
  gap: 2px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0 .18rem;
  scrollbar-width: thin;
}

.syllabus-book {
  --lean: 0deg;
  flex: 0 0 var(--book-w, 34px);
  width: var(--book-w, 34px);
  height: var(--book-h, 96px);
  position: relative;
  border: 1px solid rgba(48, 31, 16, .2);
  border-radius: 4px 5px 2px 2px;
  color: rgba(32, 25, 18, .86);
  cursor: pointer;
  padding: .34rem .14rem .3rem;
  overflow: hidden;
  box-shadow:
    0 3px 6px rgba(0,0,0,.1),
    inset 1px 0 0 rgba(255,255,255,.18),
    inset -1px 0 0 rgba(0,0,0,.06);
  transform: rotate(var(--lean));
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.syllabus-book:nth-child(odd) { --lean: -.4deg; }
.syllabus-book:nth-child(even) { --lean: .35deg; }
.syllabus-book:nth-child(3n) { --lean: -.65deg; }
.syllabus-book:nth-child(5n) { --lean: .55deg; }

.syllabus-book:hover,
.syllabus-book.is-active {
  filter: saturate(1.06) brightness(1.03);
  transform: translateY(-6px) rotate(var(--lean));
  box-shadow:
    0 8px 18px rgba(0,0,0,.14),
    inset 1px 0 0 rgba(255,255,255,.18),
    inset -1px 0 0 rgba(0,0,0,.06);
  z-index: 2;
}

.syllabus-book.is-active {
  outline: 2px solid rgba(255, 248, 220, .68);
  outline-offset: -3px;
}

.syllabus-book::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.12), rgba(255,255,255,0) 24%, rgba(0,0,0,.04) 92%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0, rgba(255,255,255,.03) 1px, transparent 1px, transparent 6px);
  pointer-events: none;
}

.syllabus-book::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  height: 1px;
  background: rgba(74, 58, 43, .22);
  pointer-events: none;
}

.syllabus-book span,
.syllabus-book strong {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.syllabus-book span {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  color: rgba(47, 39, 31, .8);
  font-size: .62rem;
  font-weight: 850;
}

.syllabus-book strong {
  max-height: calc(var(--book-h, 96px) - 42px);
  color: rgba(32, 24, 17, .86);
  font-family: var(--font-display);
  font-size: .56rem;
  font-weight: 600;
  line-height: 1;
  margin: 1rem auto 0;
  overflow: hidden;
}

.syllabus-book small {
  position: absolute;
  bottom: 5px;
  left: 50%;
  z-index: 1;
  color: rgba(47, 39, 31, .55);
  font-size: .68rem;
  line-height: 1;
  transform: translateX(-50%);
}

.syllabus-book.tone-1 { background: #C98B5A; }
.syllabus-book.tone-2 { background: #D89D70; }
.syllabus-book.tone-3 { background: #B97849; }
.syllabus-book.tone-4 { background: #E2B087; }
.syllabus-book.tone-5 { background: #C37B4F; }

.opened-book,
.library-room__sidebar,
.library-room__main,
.library-room__panel,
.library-room__toolbar,
.library-room__head {
  display: contents;
}

.library-empty {
  position: absolute;
  top: 2rem;
  left: 2rem;
  width: min(460px, calc(100% - 4rem));
  border-radius: 12px;
  background: rgba(255,252,246,.78);
}

@media (max-width: 1180px) {
  .library-topic-header {
    width: min(620px, calc(100% - 2rem));
    left: 1rem;
  }

  .library-table-stage {
    left: 1rem;
    width: min(860px, calc(100% - 2rem));
  }
}

@media (max-width: 760px) {
  .library-room {
    overflow: visible;
    background-attachment: scroll;
  }

  .library-room__shade,
  .library-room__layout {
    min-height: 820px;
  }

  .library-topic-header {
    position: relative;
    top: auto;
    left: auto;
    width: calc(100% - 1.5rem);
    margin: .75rem auto 0;
  }

  .library-topic-header__title,
  .library-topic-header__tools {
    grid-template-columns: 1fr;
    display: grid;
  }

  .library-topic-header__paper {
    width: 100%;
  }

  .library-table-stage {
    left: .75rem;
    right: .75rem;
    width: auto;
    bottom: 4.6rem;
  }

  .library-shelves {
    gap: .7rem;
    padding: .78rem;
  }

  .library-shelf-row__title h2 {
    max-width: 100%;
    white-space: normal;
  }
}

/* ---------- Library Room v3: no cards, table-only books ---------- */

.library-room {
  min-height: calc(100vh - 74px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(26, 18, 9, .05), transparent 30%, transparent 78%, rgba(26, 18, 9, .04)),
    url('/assets/img/library-background.png') center bottom / cover no-repeat fixed;
}

.library-room__shade,
.library-room__layout {
  min-height: calc(100vh - 74px);
  background: transparent;
}

.library-topic-header,
.library-quick-row,
.library-room__search,
.library-topic-header__paper,
.opened-book {
  display: none !important;
}

.library-table-stage {
  position: absolute;
  z-index: 3;
  left: clamp(13rem, 24vw, 26rem);
  bottom: clamp(1.45rem, 3.8vh, 2.8rem);
  width: min(940px, 55vw);
  padding: 0;
}

.library-table-stage__shadow {
  left: 3%;
  right: 3%;
  bottom: -8px;
  height: 34px;
  background: rgba(44, 27, 12, .24);
  filter: blur(16px);
}

.library-shelves--tabletop {
  position: relative;
  z-index: 1;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.library-shelves--tabletop::before,
.library-shelves--tabletop::after {
  display: none;
}

.library-shelf-row--tabletop {
  position: relative;
  padding: 0;
}

.library-shelf-row--tabletop::after {
  content: '';
  display: block;
  height: 16px;
  margin-top: -2px;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #C79668 0%, #A97246 55%, #8D5E39 100%);
  box-shadow:
    0 4px 10px rgba(70, 42, 20, .18),
    inset 0 1px 0 rgba(255, 255, 255, .28);
}

.library-shelf-row--tabletop .library-book-spines {
  min-height: 222px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 78, 43, .35) transparent;
}

.library-shelf-row--tabletop .library-book-spines::-webkit-scrollbar {
  height: 7px;
}

.library-shelf-row--tabletop .library-book-spines::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(120, 78, 43, .35);
}

.syllabus-book {
  --lean: 0deg;
  flex: 0 0 var(--book-w, 34px);
  width: var(--book-w, 34px);
  height: var(--book-h, 168px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(58, 43, 28, .16);
  border-radius: 4px 4px 2px 2px;
  color: #2f271f;
  cursor: pointer;
  padding: 0;
  box-shadow:
    0 3px 6px rgba(0, 0, 0, .1),
    inset 1px 0 0 rgba(255, 255, 255, .18),
    inset -1px 0 0 rgba(0, 0, 0, .06);
  transform: rotate(var(--lean));
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.syllabus-book:nth-child(odd) { --lean: -.4deg; }
.syllabus-book:nth-child(even) { --lean: .35deg; }
.syllabus-book:nth-child(3n) { --lean: -.65deg; }
.syllabus-book:nth-child(5n) { --lean: .55deg; }

.syllabus-book:hover,
.syllabus-book.is-active {
  z-index: 2;
  filter: saturate(1.05) brightness(1.03);
  transform: translateY(-6px) rotate(var(--lean));
  box-shadow:
    0 8px 18px rgba(0, 0, 0, .14),
    inset 1px 0 0 rgba(255, 255, 255, .18),
    inset -1px 0 0 rgba(0, 0, 0, .06);
}

.syllabus-book.is-active {
  outline: 2px solid rgba(255, 247, 220, .78);
  outline-offset: -4px;
}

.syllabus-book::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.1), rgba(255,255,255,0) 22%, rgba(0,0,0,.03) 92%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0, rgba(255,255,255,.025) 1px, transparent 1px, transparent 6px);
  pointer-events: none;
}

.syllabus-book::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  height: 1px;
  background: rgba(74, 58, 43, .22);
  pointer-events: none;
}

.syllabus-book span,
.syllabus-book strong {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-orientation: mixed;
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.syllabus-book span {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  color: rgba(47, 39, 31, .82);
  font-size: .66rem;
  font-weight: 850;
}

.syllabus-book strong {
  max-height: calc(var(--book-h, 168px) - 48px);
  color: rgba(47, 39, 31, .92);
  font-family: var(--font-display);
  font-size: .72rem;
  font-weight: 560;
  line-height: 1;
  letter-spacing: .01em;
  text-align: center;
  overflow: hidden;
  padding-top: 14px;
  padding-bottom: 28px;
}

.syllabus-book small {
  position: absolute;
  bottom: 6px;
  left: 50%;
  z-index: 1;
  color: rgba(47, 39, 31, .55);
  font-size: .72rem;
  line-height: 1;
  transform: translateX(-50%);
}

.syllabus-book.tone-1 { background: #C98B5A; }
.syllabus-book.tone-2 { background: #D89D70; }
.syllabus-book.tone-3 { background: #B97849; }
.syllabus-book.tone-4 { background: #E2B087; }
.syllabus-book.tone-5 { background: #C37B4F; }

.library-room + .site-footer {
  display: none;
}

@media (max-width: 1180px) {
  .library-table-stage {
    left: clamp(1rem, 8vw, 6rem);
    width: min(920px, calc(100% - 2rem));
  }
}

@media (max-width: 760px) {
  .library-room {
    min-height: 760px;
    overflow: visible;
    background-attachment: scroll;
    background-position: center bottom;
  }

  .library-room__shade,
  .library-room__layout {
    min-height: 760px;
  }

  .library-table-stage {
    left: .75rem;
    right: .75rem;
    width: auto;
    bottom: 2.2rem;
  }

  .library-shelf-row--tabletop .library-book-spines {
    min-height: 188px;
  }

  .syllabus-book {
    transform: scale(.86) rotate(var(--lean));
    transform-origin: bottom center;
  }

  .syllabus-book:hover,
  .syllabus-book.is-active {
    transform: translateY(-5px) scale(.86) rotate(var(--lean));
  }
}

/* ---------- Library Stage 1: empty room ---------- */

.library-stage {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(30, 20, 10, .05), transparent 24%, transparent 76%, rgba(30, 20, 10, .06)),
    url('/assets/img/library-background.png') center bottom / cover no-repeat;
}

.library-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(48, 31, 15, .08), transparent 18%, transparent 78%, rgba(48, 31, 15, .08));
}

.library-floating-nav {
  position: absolute;
  z-index: 2;
  top: clamp(18px, 3vh, 32px);
  left: clamp(18px, 4vw, 70px);
  right: clamp(18px, 4vw, 70px);
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.25rem;
  border: 1px solid rgba(235, 224, 209, .74);
  border-radius: 12px;
  background: rgba(255, 252, 246, .9);
  box-shadow: 0 18px 40px rgba(40, 25, 12, .14);
  backdrop-filter: blur(10px);
  padding: .5rem 1rem .5rem 1.35rem;
}

.library-floating-nav__logo {
  color: var(--ink);
  font-size: 1.32rem;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.library-floating-nav__logo span {
  color: var(--green);
}

.library-floating-nav__logo em {
  color: var(--coral);
  font-family: var(--font-hand);
  font-size: 1rem;
  font-style: normal;
  margin-left: .18rem;
}

.library-floating-nav__links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(.8rem, 2vw, 1.8rem);
  min-width: 0;
}

.library-floating-nav__links a,
.library-floating-nav__links span,
.library-floating-nav__tools span {
  color: var(--ink);
  font-size: .86rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.library-floating-nav__links a {
  position: relative;
}

.library-floating-nav__links a:hover {
  color: var(--green-deep);
}

.library-floating-nav__links .is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.55rem;
  height: 2px;
  border-radius: 999px;
  background: var(--green);
}

.library-floating-nav__tools {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: .65rem;
}

.library-floating-nav__tools > span:not(.library-floating-nav__space) {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-left: 1px solid rgba(216, 204, 186, .7);
  color: var(--ink);
  font-size: 1rem;
}

.library-floating-nav__space {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid rgba(216, 204, 186, .84);
  border-radius: 999px;
  background: rgba(255,255,255,.42);
  color: var(--ink);
  font-size: .86rem;
  font-weight: 650;
  padding: .45rem .9rem;
  text-decoration: none;
  white-space: nowrap;
}

.library-floating-nav__space:hover,
.library-floating-nav__space:focus-visible {
  color: var(--green-deep);
  background: rgba(255,255,255,.58);
}

@media (max-width: 1040px) {
  .library-floating-nav {
    grid-template-columns: auto 1fr;
  }

  .library-floating-nav__links {
    justify-content: flex-end;
    overflow-x: auto;
    padding-bottom: .2rem;
  }

  .library-floating-nav__tools {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .library-stage {
    min-height: 100svh;
    background-position: center bottom;
  }

  .library-floating-nav {
    left: 14px;
    right: 14px;
    top: 14px;
    grid-template-columns: 1fr;
    gap: .7rem;
    padding: .85rem;
  }

  .library-floating-nav__links {
    justify-content: flex-start;
  }

  .library-floating-nav__tools {
    display: none;
  }
}

/* ---------- Library Stage 2: empty wall shelf ---------- */

.library-wall-shelf {
  position: absolute;
  z-index: 1;
  top: clamp(116px, 13vh, 142px);
  left: clamp(300px, 26vw, 500px);
  width: min(880px, 47vw);
  height: clamp(318px, 47vh, 452px);
  pointer-events: none;
  filter: drop-shadow(0 18px 18px rgba(48, 29, 12, .16));
}

.library-wall-shelf::before {
  content: '';
  position: absolute;
  inset: 1rem 2rem;
  border-radius: 22px;
  background: radial-gradient(ellipse at center, rgba(76, 46, 22, .08), transparent 68%);
  opacity: .62;
}

.library-wall-shelf__plank,
.library-wall-shelf__side,
.library-wall-shelf__brace {
  position: absolute;
  display: block;
}

.library-wall-shelf__plank {
  left: 0;
  right: 0;
  height: 16px;
  border-radius: 4px 4px 9px 9px;
  background:
    repeating-linear-gradient(92deg, rgba(255,255,255,.07) 0 2px, rgba(70,39,17,.07) 2px 9px),
    linear-gradient(180deg, #C89563 0%, #B77D49 42%, #89542B 100%);
  box-shadow:
    0 8px 13px rgba(66, 39, 17, .22),
    inset 0 1px 0 rgba(255,255,255,.32),
    inset 0 -2px 0 rgba(70, 40, 18, .18);
}

.library-wall-shelf__plank::after {
  content: '';
  position: absolute;
  left: 1.4%;
  right: 1.4%;
  bottom: 2px;
  height: 1px;
  background: rgba(82, 47, 21, .28);
}

.library-wall-shelf__plank--top {
  top: 0;
  opacity: .9;
}

.library-wall-shelf__plank--middle {
  top: calc(50% - 8px);
}

.library-wall-shelf__plank--bottom {
  bottom: 0;
}

.library-wall-shelf__side {
  top: 8px;
  bottom: 7px;
  width: 9px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.06) 0 2px, rgba(74,42,19,.08) 2px 8px),
    linear-gradient(90deg, #8E592F, #C08B58 45%, #7B4A24);
  box-shadow:
    6px 0 12px rgba(60, 36, 16, .12),
    inset 1px 0 0 rgba(255,255,255,.24);
  opacity: .74;
}

.library-wall-shelf__side--left {
  left: -3px;
}

.library-wall-shelf__side--right {
  right: -3px;
}

.library-wall-shelf__brace {
  width: 58px;
  height: 12px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 2px, rgba(72,42,20,.06) 2px 8px),
    linear-gradient(180deg, #BA8452, #7A4823);
  box-shadow:
    0 5px 9px rgba(50, 30, 14, .14),
    inset 0 1px 0 rgba(255,255,255,.26);
  opacity: .56;
}

.library-wall-shelf__brace--left {
  left: 11%;
  top: calc(50% + 18px);
  transform: rotate(-38deg);
  transform-origin: left center;
}

.library-wall-shelf__brace--right {
  right: 11%;
  top: calc(50% + 18px);
  transform: rotate(38deg);
  transform-origin: right center;
}

@media (max-width: 1180px) {
  .library-wall-shelf {
    left: clamp(220px, 22vw, 300px);
    width: min(780px, 62vw);
  }
}

@media (max-width: 720px) {
  .library-wall-shelf {
    top: 160px;
    left: 8vw;
    width: 84vw;
    height: 34vh;
  }
}

/* ---------- Library Stage 3: interactive topic books ---------- */

.library-stage--books {
  min-height: 100vh;
  overflow-y: auto;
}

.library-stage--books .library-floating-nav {
  z-index: 5;
}

.library-stage__workspace {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 980px);
  gap: clamp(1.15rem, 2.4vw, 2rem);
  align-items: start;
  padding: clamp(112px, 12vh, 132px) clamp(18px, 4vw, 70px) clamp(2rem, 5vh, 4rem);
}

.library-study-panel,
.library-bookcase-panel {
  border: 1px solid rgba(226, 212, 193, .82);
  border-radius: 14px;
  background: rgba(255, 252, 246, .9);
  box-shadow: 0 24px 54px rgba(52, 32, 15, .16);
  backdrop-filter: blur(12px);
}

.library-study-panel {
  display: grid;
  gap: .95rem;
  padding: 1.25rem;
}

.library-study-panel h2,
.library-study-panel h3,
.library-quick-links h3,
.library-progress-card strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 650;
}

.library-study-panel h2 {
  border-bottom: 1px solid rgba(213, 197, 174, .76);
  font-size: 1.18rem;
  padding-bottom: .85rem;
}

.library-study-panel h3,
.library-quick-links h3 {
  font-size: .86rem;
  margin-bottom: .6rem;
}

.library-env-option {
  width: 100%;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: .7rem;
  align-items: center;
  border: 1px solid rgba(221, 210, 194, .84);
  border-radius: 10px;
  background: rgba(255, 255, 255, .52);
  color: var(--ink);
  margin-top: .5rem;
  min-height: 62px;
  padding: .55rem;
  text-align: left;
}

.library-env-option.is-active {
  border-color: rgba(15, 110, 86, .36);
  background: rgba(238, 246, 238, .74);
}

.library-env-option > span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: rgba(15, 110, 86, .11);
  color: var(--green-deep);
  font-size: .68rem;
  font-weight: 800;
}

.library-env-option strong {
  align-self: end;
  font-size: .86rem;
}

.library-env-option small {
  align-self: start;
  color: var(--ink-soft);
  font-size: .72rem;
}

.library-study-quote {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(241, 233, 218, .72), rgba(255, 255, 255, .48));
  color: rgba(61, 46, 30, .82);
  font-family: var(--font-hand);
  font-size: 1.18rem;
  line-height: 1.2;
  margin: 0;
  padding: 1.2rem 1rem;
}

.library-progress-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .65rem;
  align-items: center;
  border: 1px solid rgba(226, 212, 193, .74);
  border-radius: 12px;
  background: rgba(255, 255, 255, .48);
  padding: .9rem;
}

.library-progress-card span {
  display: block;
  color: var(--ink-soft);
  font-size: .72rem;
  margin-top: .28rem;
}

.library-progress-card b {
  color: var(--green-deep);
  font-size: .82rem;
}

.library-progress-card i {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--green) var(--progress), rgba(220, 208, 190, .82) 0);
}

.library-quick-links {
  display: grid;
  gap: .45rem;
}

.library-quick-links a {
  color: var(--ink-soft);
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
}

.library-quick-links a:hover {
  color: var(--green-deep);
}

.library-bookcase-panel {
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: clamp(1rem, 2vw, 1.45rem);
  scrollbar-color: rgba(145, 94, 49, .35) transparent;
}

.library-bookcase-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}

.library-bookcase-panel__head span {
  display: inline-block;
  width: fit-content;
  border-bottom: 4px solid rgba(15, 110, 86, .36);
  color: var(--green-deep);
  font-size: .82rem;
  font-weight: 850;
  margin-bottom: .35rem;
  padding-bottom: .08rem;
}

.library-bookcase-panel__head h2 {
  color: rgba(42, 37, 31, .82);
  font-family: var(--font-display);
  font-size: clamp(1.95rem, 2.65vw, 2.5rem);
  font-weight: 600;
  line-height: 1;
}

.library-bookcase-panel__head p {
  color: rgba(72, 66, 58, .68);
  font-size: .82rem;
  margin-top: .45rem;
}

.library-bookcase-note {
  align-self: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .18rem .55rem;
  width: min(260px, 34%);
  min-width: 210px;
  border: 1px solid rgba(222, 207, 186, .64);
  border-radius: 14px;
  background: rgba(255, 250, 242, .5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.34);
  padding: .78rem .9rem;
}

.library-bookcase-note::before {
  content: '*';
  grid-row: span 2;
  color: #BA7517;
  font-size: .95rem;
  line-height: 1.2;
}

.library-bookcase-note strong {
  color: var(--green-deep);
  font-size: .78rem;
  line-height: 1;
  white-space: nowrap;
}

.library-bookcase-note p {
  color: var(--ink-soft);
  font-size: .76rem;
  line-height: 1.3;
  margin: 0;
}

.library-book-searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .8rem;
  margin-bottom: 1rem;
}

.library-book-searchbar input,
.library-book-searchbar button {
  min-height: 48px;
  border: 1px solid rgba(221, 207, 188, .9);
  border-radius: 10px;
  background: rgba(255, 250, 243, .72);
  color: var(--ink);
  font: inherit;
}

.library-book-searchbar input {
  width: 100%;
  padding: 0 .95rem;
}

.library-book-searchbar input:focus {
  border-color: rgba(15, 110, 86, .58);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(15, 110, 86, .1);
}

.library-book-searchbar button {
  cursor: pointer;
  font-weight: 800;
  padding: 0 1.15rem;
}

.library-stage--books .library-shelves {
  display: grid;
  gap: 1.05rem;
  padding: .15rem 0 .4rem;
}

.library-stage--books .library-shelf-row {
  position: relative;
  padding-bottom: .24rem;
}

.library-stage--books .library-shelf-row::after {
  content: '';
  display: block;
  height: 15px;
  margin-top: -2px;
  border-radius: 0 0 8px 8px;
  background:
    repeating-linear-gradient(92deg, rgba(255,255,255,.07) 0 3px, rgba(70,39,17,.08) 3px 10px),
    linear-gradient(180deg, #C79668 0%, #A97246 55%, #8D5E39 100%);
  box-shadow:
    0 6px 12px rgba(70, 42, 20, .2),
    inset 0 1px 0 rgba(255,255,255,.28);
}

.library-stage--books .library-shelf-row__title {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 .34rem .18rem;
}

.library-stage--books .library-shelf-row__title h2 {
  color: rgba(39, 28, 19, .88);
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 650;
  line-height: 1.1;
}

.library-stage--books .library-shelf-row__title span {
  color: var(--ink-soft);
  font-size: .76rem;
  font-weight: 800;
  white-space: nowrap;
}

.library-stage--books .library-book-spines {
  min-height: 184px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(145, 94, 49, .38) transparent;
}

.library-stage--books .library-book-spines::-webkit-scrollbar {
  height: 7px;
}

.library-stage--books .library-book-spines::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(145, 94, 49, .38);
}

.library-stage--books .syllabus-book {
  --lean: 0deg;
  flex: 0 0 var(--book-w, 36px);
  width: var(--book-w, 36px);
  height: var(--book-h, 168px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(63, 43, 25, .18);
  border-radius: 5px 5px 2px 2px;
  color: rgba(45, 33, 23, .92);
  cursor: pointer;
  padding: 0;
  box-shadow:
    0 5px 9px rgba(50, 31, 14, .14),
    inset 4px 0 7px rgba(255,255,255,.12),
    inset -5px 0 8px rgba(54, 31, 15, .08);
  transform: rotate(var(--lean));
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.library-stage--books .syllabus-book:nth-child(odd) { --lean: -.45deg; }
.library-stage--books .syllabus-book:nth-child(even) { --lean: .34deg; }
.library-stage--books .syllabus-book:nth-child(3n) { --lean: -.7deg; }
.library-stage--books .syllabus-book:nth-child(5n) { --lean: .58deg; }

.library-stage--books .syllabus-book:hover,
.library-stage--books .syllabus-book:focus-visible,
.library-stage--books .syllabus-book.is-active {
  z-index: 2;
  filter: saturate(1.08) brightness(1.04);
  transform: translateY(-7px) rotate(var(--lean));
  box-shadow:
    0 13px 22px rgba(50, 31, 14, .2),
    inset 5px 0 8px rgba(255,255,255,.14),
    inset -6px 0 9px rgba(54, 31, 15, .1);
}

.library-stage--books .syllabus-book:focus-visible {
  outline: 3px solid rgba(15, 110, 86, .36);
  outline-offset: 2px;
}

.library-stage--books .syllabus-book.is-active {
  outline: 2px solid rgba(255, 247, 220, .86);
  outline-offset: -4px;
}

.library-stage--books .syllabus-book::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.14), rgba(255,255,255,0) 24%, rgba(0,0,0,.04) 92%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0, rgba(255,255,255,.035) 1px, transparent 1px, transparent 7px);
  pointer-events: none;
}

.library-stage--books .syllabus-book::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  height: 1px;
  background: rgba(74, 58, 43, .22);
  pointer-events: none;
}

.library-stage--books .syllabus-book span,
.library-stage--books .syllabus-book strong {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-orientation: mixed;
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.library-stage--books .syllabus-book span {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  color: rgba(47, 39, 31, .78);
  font-size: .66rem;
  font-weight: 850;
}

.library-stage--books .syllabus-book strong {
  max-height: calc(var(--book-h, 168px) - 52px);
  color: rgba(47, 39, 31, .92);
  font-family: var(--font-display);
  font-size: .69rem;
  font-weight: 580;
  line-height: 1;
  overflow: hidden;
  padding-bottom: 26px;
  padding-top: 16px;
  text-align: center;
}

.library-stage--books .syllabus-book small {
  position: absolute;
  bottom: 7px;
  left: 50%;
  z-index: 1;
  color: rgba(47, 39, 31, .55);
  font-size: .7rem;
  line-height: 1;
  transform: translateX(-50%);
}

.library-stage--books .syllabus-book.tone-1 { background: #C88457; }
.library-stage--books .syllabus-book.tone-2 { background: #D9A06F; }
.library-stage--books .syllabus-book.tone-3 { background: #B87549; }
.library-stage--books .syllabus-book.tone-4 { background: #E2B488; }
.library-stage--books .syllabus-book.tone-5 { background: #A7A978; }

.opened-book[hidden] {
  display: none;
}

.opened-book {
  position: fixed;
  z-index: 6;
  top: auto;
  left: auto;
  right: clamp(18px, 4vw, 64px);
  bottom: clamp(18px, 5vh, 64px);
  width: min(620px, calc(100vw - 32px));
  padding: 0;
  filter: drop-shadow(0 28px 36px rgba(43, 27, 14, .28));
}

.opened-book.is-open {
  display: block !important;
}

.opened-book__close {
  position: absolute;
  z-index: 2;
  top: -14px;
  right: -10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(100, 66, 34, .2);
  border-radius: 999px;
  background: rgba(255, 252, 246, .96);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.opened-book__spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid rgba(156, 118, 76, .32);
  border-radius: 18px 12px 12px 18px;
  background:
    linear-gradient(90deg, rgba(112, 78, 41, .18) 49.3%, rgba(74, 48, 23, .3) 50%, rgba(112, 78, 41, .14) 50.7%),
    #FFF8EA;
}

.opened-book__page {
  min-height: 270px;
  padding: 1.35rem;
}

.opened-book__page--left {
  background:
    linear-gradient(90deg, rgba(255,255,255,.5), transparent 24%),
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(121, 91, 58, .07) 30px 31px);
}

.opened-book__page--right {
  display: grid;
  align-content: center;
  gap: .8rem;
  background:
    linear-gradient(270deg, rgba(255,255,255,.46), transparent 26%),
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(121, 91, 58, .07) 30px 31px);
}

.opened-book__page span {
  display: block;
  color: var(--green-deep);
  font-size: .78rem;
  font-weight: 850;
  margin-bottom: .7rem;
}

.opened-book__page strong {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(200, 132, 87, .18);
  color: #8C4D2B;
  font-size: .92rem;
  margin-bottom: .8rem;
}

.opened-book__page h2 {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 650;
  line-height: 1.08;
}

.opened-book__page p {
  color: rgba(65, 51, 35, .74);
  font-size: .88rem;
  line-height: 1.5;
  margin-top: .85rem;
}

.opened-book__page--right p {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 650;
}

.opened-book__page a {
  display: flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid rgba(15, 110, 86, .2);
  border-radius: 999px;
  background: rgba(255,255,255,.48);
  color: var(--green-deep);
  font-size: .86rem;
  font-weight: 850;
  padding: .7rem 1rem;
  text-decoration: none;
}

.opened-book__page a:hover {
  border-color: rgba(15, 110, 86, .42);
  background: rgba(238, 246, 238, .68);
}

@media (max-width: 1120px) {
  .library-stage__workspace {
    grid-template-columns: 1fr;
  }

  .library-study-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-study-panel h2,
  .library-study-panel__section,
  .library-study-quote,
  .library-progress-card,
  .library-quick-links {
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .library-stage--books {
    min-height: 100svh;
  }

  .library-stage__workspace {
    display: block;
    padding: 226px .85rem 2rem;
  }

  .library-study-panel {
    display: none;
  }

  .library-bookcase-panel {
    max-height: none;
    padding: .95rem;
  }

  .library-bookcase-panel__head,
  .library-book-searchbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .library-book-searchbar button {
    width: 100%;
  }

  .library-stage--books .library-shelf-row__title {
    align-items: flex-start;
    flex-direction: column;
    gap: .2rem;
  }

  .library-stage--books .library-book-spines {
    min-height: 166px;
  }

  .library-stage--books .syllabus-book {
    transform: scale(.9) rotate(var(--lean));
    transform-origin: bottom center;
  }

  .library-stage--books .syllabus-book:hover,
  .library-stage--books .syllabus-book:focus-visible,
  .library-stage--books .syllabus-book.is-active {
    transform: translateY(-6px) scale(.9) rotate(var(--lean));
  }

  .opened-book {
    left: .8rem;
    right: .8rem;
    bottom: .85rem;
    width: auto;
  }

  .opened-book__spread {
    grid-template-columns: 1fr;
  }

  .opened-book__page {
    min-height: auto;
    padding: 1.05rem;
  }
}

/* ---------- Library Stage 4: IGCSE Economics cover books ---------- */

.library-stage--books {
  background:
    linear-gradient(90deg, rgba(46, 31, 15, .18), rgba(255, 250, 240, .08) 24%, rgba(255, 250, 240, .08) 74%, rgba(46, 31, 15, .2)),
    linear-gradient(180deg, rgba(255, 249, 236, .12), rgba(65, 42, 21, .16)),
    url('/assets/img/Garden5.png?v=20260704-garden5') center bottom / cover no-repeat;
  background-color: #8b915f;
}

.library-stage--books::before,
.library-stage--books::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none;
}

.library-stage--books::before {
  display: none;
}

.library-stage--books::after {
  z-index: 1;
  inset: 0;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 250, 234, .16), transparent 34%),
    linear-gradient(180deg, rgba(42, 27, 12, .06), transparent 20%, transparent 73%, rgba(45, 27, 12, .08));
}

.library-stage--books .library-floating-nav {
  background: rgba(255, 252, 246, .84);
  backdrop-filter: blur(16px) saturate(1.06);
}

.library-stage--books .library-stage__workspace {
  grid-template-columns: minmax(210px, 244px) minmax(0, 760px);
  align-items: start;
  justify-content: center;
  gap: clamp(1rem, 2vw, 1.45rem);
  max-width: 1156px;
  margin-inline: auto;
  padding-inline: clamp(18px, 5vw, 64px);
  padding-top: 0;
  padding-bottom: clamp(7rem, 18vh, 12rem);
}

.library-stage--books .library-study-panel,
.library-stage--books .library-bookcase-panel {
  border: 1px solid rgba(44, 44, 42, .12);
  background:
    radial-gradient(circle at 12% 0%, rgba(255,255,255,.5), transparent 36%),
    linear-gradient(180deg, rgba(255,252,246,.62), rgba(249,241,229,.48));
  box-shadow:
    0 20px 58px rgba(42, 30, 18, .1),
    inset 0 1px 0 rgba(255,255,255,.54);
  backdrop-filter: blur(8px) saturate(1.08);
  -webkit-backdrop-filter: blur(8px) saturate(1.08);
}

.library-stage--books .library-study-panel {
  align-self: start;
  gap: .82rem;
  overflow: hidden;
}

.library-stage--books .library-study-quote,
.library-stage--books .library-progress-card,
.library-stage--books .library-quick-links,
.library-stage--books .library-book-searchbar input,
.library-stage--books .library-book-searchbar button {
  background: rgba(255, 250, 242, .4);
  backdrop-filter: blur(8px);
}

.library-stage--books .library-study-quote,
.library-stage--books .library-progress-card,
.library-stage--books .library-quick-links {
  border: 1px solid rgba(222, 207, 186, .62);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.34);
}

.library-stage--books .library-progress-card {
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-areas: "ring copy";
  gap: .78rem;
  padding: .78rem;
}

.library-stage--books .library-progress-card > div {
  grid-area: copy;
  min-width: 0;
}

.library-stage--books .library-progress-card b {
  grid-area: ring;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 253, 248, .9) 0 54%, transparent 55%),
    conic-gradient(var(--green) var(--progress), rgba(220, 208, 190, .68) 0);
  box-shadow:
    inset 0 0 0 1px rgba(112, 94, 66, .12),
    0 6px 12px rgba(54, 38, 21, .08);
  color: var(--green-deep);
  font-size: .78rem;
  font-weight: 850;
}

.library-stage--books .library-progress-card i {
  display: none;
}

.library-stage--books .library-study-quote {
  min-height: 94px;
}

.library-stage--books .library-quick-links {
  border-radius: 12px;
  padding: .82rem;
}

.library-room-ad {
  position: relative;
  z-index: 2;
  min-width: 0;
  max-width: 100%;
}

.library-room-ad .ad-slot {
  width: 100%;
  min-height: 92px;
  margin: 0;
  border-color: rgba(216, 204, 186, .72);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, .68), rgba(249, 241, 229, .54));
  box-shadow: 0 12px 28px rgba(42, 30, 18, .08);
  backdrop-filter: blur(12px) saturate(1.04);
  overflow: hidden;
  contain: layout paint;
}

.library-room-ad .ad-slot > .adsbygoogle {
  display: block !important;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.library-room-ad--top,
.library-room-ad--bottom {
  width: min(900px, calc(100% - clamp(36px, 8vw, 140px)));
  margin-inline: auto;
}

.library-room-ad--top {
  margin-top: clamp(104px, 12vh, 132px);
  margin-bottom: 1rem;
}

.library-room-ad--bottom {
  margin-top: 1rem;
  margin-bottom: clamp(1.6rem, 4vh, 3rem);
}

.library-room-ad--side {
  align-self: end;
  width: 100%;
  margin-top: .05rem;
  overflow: hidden;
  border-radius: 12px;
}

.library-room-ad--side .ad-slot {
  min-height: clamp(168px, 21vh, 220px);
  max-height: 220px;
}

.library-room-ad--side .ad-slot > .adsbygoogle {
  height: 100% !important;
  max-height: 220px;
}

.library-room-ad--shelf {
  margin: .2rem 0 .05rem;
}

.library-room-ad--shelf .ad-slot {
  min-height: 104px;
}

.library-stage--books .library-bookcase-panel {
  width: min(760px, 100%);
  height: var(--library-bookcase-panel-height, calc(100svh - 36px));
  max-height: none;
  min-height: min(900px, calc(100svh - 36px));
  background:
    radial-gradient(circle at 12% 0%, rgba(255,255,255,.5), transparent 36%),
    linear-gradient(180deg, rgba(255,252,246,.62), rgba(249,241,229,.48));
  border-radius: 18px;
}

.library-stage--books .library-study-panel h2 {
  color: rgba(42, 37, 31, .84);
  font-size: 1.08rem;
  font-weight: 600;
}

.library-stage--books .library-bookcase-note {
  align-self: center;
  display: block;
  width: auto;
  min-width: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.library-stage--books .library-bookcase-note::before,
.library-stage--books .library-bookcase-note p {
  display: none;
}

.library-stage--books .library-bookcase-note strong {
  color: rgba(45, 40, 34, .72);
  font-family: var(--font-body);
  font-size: .9rem;
  font-weight: 750;
}

.library-stage--books .library-shelves {
  gap: 1.26rem;
  min-width: 0;
}

.library-stage--books .library-shelf-row {
  min-width: 0;
  width: min(710px, 100%);
  max-width: 100%;
  margin-inline: auto;
  padding-bottom: .16rem;
  background: transparent;
  box-shadow: none;
}

.library-stage--books .library-shelf-row::after {
  display: none;
}

.library-stage--books .library-shelf-row__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 .62rem;
}

.library-stage--books .library-shelf-row__title > div {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  min-width: 0;
}

.library-stage--books .library-shelf-row__title h2 {
  color: rgba(48, 42, 35, .82);
  font-size: clamp(1.05rem, 1.36vw, 1.24rem);
  font-weight: 600;
  max-width: none;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.library-stage--books .library-shelf-row__scroll {
  border: 0;
  background: transparent;
  color: var(--green-deep);
  cursor: pointer;
  font: inherit;
  font-size: .78rem;
  font-weight: 850;
  white-space: nowrap;
}

.book-tray-wrap {
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: .36rem 0 0;
}

.book-tray-wrap::before,
.book-tray-wrap::after {
  display: none;
}

.book-tray-wrap::before {
  left: 0;
}

.book-tray-wrap::after {
  right: 0;
  transform: scaleX(-1);
}

.book-tray {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 1.35vw, 16px);
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 202px;
  overflow-x: auto;
  overflow-y: visible;
  padding: .15rem .15rem .45rem;
  background: transparent;
  box-shadow: none;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: rgba(145, 94, 49, .35) transparent;
}

.book-tray::-webkit-scrollbar {
  height: 8px;
}

.book-tray::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(145, 94, 49, .35);
}

.wood-plank {
  display: none;
}

.topic-cover {
  --book-tilt: 0deg;
  position: relative;
  flex: 0 0 142px;
  width: 142px;
  height: 198px;
  border: 0;
  background: transparent;
  color: #FFF8EA;
  cursor: pointer;
  overflow: visible;
  padding: 0;
  margin-bottom: 0;
  text-align: left;
  scroll-snap-align: start;
  transform: rotate(var(--book-tilt));
  transform-origin: bottom center;
  transition: transform .18s ease, filter .18s ease;
}

.topic-cover.cover-4 {
  flex-basis: 152px;
  width: 152px;
  height: 194px;
}

.topic-cover.cover-5 {
  flex-basis: 132px;
  width: 132px;
  height: 202px;
}

.topic-cover:nth-child(odd) { --book-tilt: -.35deg; }
.topic-cover:nth-child(even) { --book-tilt: .28deg; }
.topic-cover:nth-child(3n) { --book-tilt: -.52deg; }
.topic-cover:nth-child(5n) { --book-tilt: .44deg; }

.topic-cover:hover,
.topic-cover:focus-visible,
.topic-cover.is-active {
  z-index: 3;
  filter: brightness(1.04) saturate(1.03);
  transform: translateY(-3px) rotate(var(--book-tilt));
}

.topic-cover:focus-visible {
  outline: 3px solid rgba(15, 110, 86, .4);
  outline-offset: 5px;
  border-radius: 14px;
}

.book-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  filter: none;
}

.book-sheen {
  position: absolute;
  z-index: 1;
  top: 11%;
  right: 9%;
  bottom: 11%;
  left: 25%;
  border-radius: 8px;
  background:
    linear-gradient(100deg, rgba(255,255,255,.16), transparent 34%, rgba(0,0,0,.1)),
    url('/assets/img/textures/cloth_linen_texture_overlay.png') center / 220px 220px;
  mix-blend-mode: overlay;
  opacity: .28;
  pointer-events: none;
}

.book-cover-mark {
  position: absolute;
  z-index: 3;
  right: 15%;
  bottom: 15%;
  color: rgba(255, 248, 225, .48);
  font-family: var(--font-display);
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: 0;
  pointer-events: none;
}

.book-cover-content {
  position: absolute;
  z-index: 2;
  top: 13%;
  right: 12%;
  bottom: 11%;
  left: 27%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  pointer-events: none;
}

.topic-cover.is-title-long .book-cover-content,
.topic-cover.is-title-longer .book-cover-content {
  left: 22%;
  right: 8%;
}

.book-num {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 999px;
  background: rgba(52, 31, 15, .32);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  color: rgba(255, 248, 225, .94);
  font-size: .72rem;
  font-weight: 900;
  margin-bottom: .58rem;
}

.topic-cover strong {
  display: -webkit-box;
  color: #FFF8EA;
  font-family: var(--font-display);
  font-size: .84rem;
  font-weight: 650;
  line-height: 1.08;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 3px rgba(34, 18, 8, .42);
  hyphens: auto;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.topic-cover.is-title-long strong {
  font-size: .75rem;
  line-height: 1.05;
  -webkit-line-clamp: 5;
}

.topic-cover.is-title-longer strong {
  font-size: .68rem;
  line-height: 1.03;
  -webkit-line-clamp: 6;
}

.topic-cover em {
  display: -webkit-box;
  color: rgba(255, 248, 225, .78);
  font-size: .59rem;
  font-style: normal;
  line-height: 1.28;
  margin-top: .55rem;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px rgba(34, 18, 8, .3);
  hyphens: auto;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.topic-cover.is-title-longer em {
  font-size: .6rem;
  -webkit-line-clamp: 1;
}

.topic-cover small {
  color: rgba(255, 248, 225, .78);
  font-size: .56rem;
  font-weight: 750;
  line-height: 1.2;
  margin-top: auto;
  text-shadow: 0 1px 2px rgba(34, 18, 8, .3);
}

.topic-cover[hidden] {
  display: none;
}

.opened-book__page #openedBookSubtitle,
.opened-book__page p#openedBookSubtitle {
  color: var(--green-deep);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
  margin-top: .7rem;
}

@media (max-width: 1120px) {
  .library-stage--books .library-stage__workspace {
    grid-template-columns: 1fr;
    max-width: 920px;
  }

  .library-stage--books .library-bookcase-panel {
    height: auto;
    max-height: none;
  }

  .library-bookcase-note {
    width: min(260px, 38%);
  }

  .book-tray {
    min-height: 198px;
  }

  .topic-cover {
    flex-basis: 136px;
    width: 136px;
    height: 190px;
  }

  .topic-cover.cover-4 {
    flex-basis: 146px;
    width: 146px;
    height: 186px;
  }

  .topic-cover.cover-5 {
    flex-basis: 126px;
    width: 126px;
    height: 194px;
  }

  .topic-cover strong {
    font-size: .78rem;
  }
}

@media (max-width: 760px) {
  .library-stage--books .library-stage__workspace {
    padding-top: 0;
    padding-bottom: 5.2rem;
  }

  .library-stage--books::before {
    height: clamp(70px, 12vh, 112px);
    opacity: .56;
  }

  .library-stage--books::after {
    background:
      linear-gradient(180deg, rgba(42, 27, 12, .08), transparent 24%, rgba(45, 27, 12, .1));
  }

  .library-room-ad--top {
    width: calc(100% - 1.7rem);
    margin-top: 174px;
  }

  .library-room-ad--bottom {
    width: calc(100% - 1.7rem);
  }

  .library-room-ad--shelf .ad-slot {
    min-height: 118px;
  }

  .library-stage--books .library-bookcase-panel {
    max-height: none;
  }

  .library-bookcase-note {
    width: 100%;
    min-width: 0;
  }

  .library-stage--books .library-shelf-row__title {
    align-items: flex-start;
    display: flex;
  }

  .library-stage--books .library-shelf-row__title > div {
    display: block;
  }

  .library-stage--books .library-shelf-row__scroll {
    padding-top: .2rem;
  }

  .book-tray-wrap {
    padding: 10px 10px 0;
  }

  .book-tray {
    gap: 10px;
    min-height: 190px;
  }

  .topic-cover {
    flex-basis: 130px;
    width: 130px;
    height: 182px;
  }

  .topic-cover.cover-4 {
    flex-basis: 140px;
    width: 140px;
    height: 178px;
  }

  .topic-cover.cover-5 {
    flex-basis: 122px;
    width: 122px;
    height: 186px;
  }

  .book-cover-content {
    left: 28%;
    right: 12%;
  }

  .topic-cover.is-title-long .book-cover-content,
  .topic-cover.is-title-longer .book-cover-content {
    left: 25%;
    right: 10%;
  }

  .book-num {
    width: 25px;
    height: 25px;
    font-size: .7rem;
    margin-bottom: .56rem;
  }

  .topic-cover strong {
    font-size: .76rem;
  }

  .topic-cover.is-title-long strong {
    font-size: .7rem;
  }

  .topic-cover.is-title-longer strong {
    font-size: .64rem;
  }

  .topic-cover em {
    font-size: .57rem;
  }

  .topic-cover small {
    font-size: .54rem;
  }
}

/* Site update notice */
.site-update-modal[hidden] {
  display: none;
}

.site-update-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.site-update-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 37, 32, .48);
  backdrop-filter: blur(4px);
}

.site-update-modal__panel {
  position: relative;
  width: min(100%, 520px);
  border: 1px solid rgba(125, 139, 98, .28);
  border-radius: 8px;
  background: #fffaf0;
  box-shadow: 0 24px 70px rgba(30, 36, 29, .24);
  color: #2f3329;
  padding: clamp(1.35rem, 4vw, 2.2rem);
  outline: none;
}

.site-update-modal__close {
  position: absolute;
  top: .8rem;
  right: .8rem;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid rgba(47, 51, 41, .16);
  border-radius: 999px;
  background: #ffffff;
  color: #4c513f;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.site-update-modal__close:hover,
.site-update-modal__close:focus-visible {
  border-color: rgba(29, 158, 117, .6);
  color: #1d7f61;
}

.site-update-modal__eyebrow {
  margin: 0 0 .35rem;
  color: #7d8b62;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.site-update-modal h2 {
  max-width: 12em;
  margin: 0 2rem .7rem 0;
  color: #253126;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.55rem, 5vw, 2.3rem);
  line-height: 1.06;
}

.site-update-modal p {
  margin: 0;
}

.site-update-modal__panel > p:last-of-type {
  color: #555b4d;
  font-size: 1rem;
  line-height: 1.65;
}

.site-update-modal__action {
  margin-top: 1.25rem;
}
