body.study-layout {
  --study-rail-width: 232px;
  --study-surface: #f6f8f0;
  --study-text: #163e34;
  --study-line: #dce9df;
  padding-inline-start: var(--study-rail-width);
  background: var(--study-surface);
}

.study-layout > header { display: none; }
.study-layout > main {
  width: 100%;
  max-width: 1240px;
  min-height: 86vh;
  padding-inline: clamp(20px, 4.1vw, 63px);
  margin-inline: auto;
}

.study-layout > footer,
.study-layout .site-footer {
  display: none;
}

.study-layout .page > .phead {
  padding-top: clamp(24px, 3.8vw, 50px);
  text-align: start;
}

.study-layout .page > .course-subnav,
.study-layout > main > .route-seo {
  display: none;
}

.study-layout .page > .phead h2 {
  color: var(--study-text);
}

.study-mobile-bar,
.study-close,
.study-shade {
  display: none;
}

.study-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  width: var(--study-rail-width);
  padding: 18px 13px 14px;
  border-inline-end: 1px solid #d3e4d9;
  background: #edf4e9;
  color: var(--study-text);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.study-rail[hidden],
.study-mobile-bar[hidden] {
  display: none;
}

.study-brand-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 4px 14px;
}

.study-brand {
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 600;
  letter-spacing: -.015em;
  color: #153d32;
  text-decoration: none;
}

.study-brand img { object-fit: contain; }

.study-nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}

.study-nav hr {
  width: 100%;
  margin: 9px 0;
  border: 0;
  border-top: 1px solid #d2e1d5;
}

.study-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #34584d;
  background: transparent;
  font-size: .86rem;
  line-height: 1.25;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.study-link svg { width: 18px; height: 18px; flex: 0 0 auto; }
.study-link:hover { border-color: #d0e1d0; background: #f8fbf4; text-decoration: none; }
.study-link[aria-current="page"] {
  background: #1c5846;
  border-color: #1c5846;
  color: #fff;
}

.study-versions {
  display: flex;
  gap: 3px;
  margin: 9px 0 2px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid #d1dfd3;
  background: #e1eedf;
}

.study-versions button {
  flex: 1;
  min-height: 33px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #3b5d50;
  font-size: .76rem;
  cursor: pointer;
}

.study-versions button[aria-pressed="true"] {
  border-color: #d1dfd3;
  background: #fff;
  color: #174635;
}

.study-signout { flex-shrink: 0; margin-top: auto; padding-top: 12px; }
.study-signout[hidden] { display: none; }
.study-rail :focus-visible,
.study-mobile-bar :focus-visible { outline: 3px solid #c17b35; outline-offset: 2px; }

.study-story-lead {
  padding: clamp(21px, 4vw, 40px);
  border: 1px solid #dae7d1;
  border-radius: 23px;
  background: #e6f0dd;
}
.study-story-lead p {
  max-width: 58ch;
  margin-top: 10px;
  color: #3c6053;
}

.study-story-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0 10px;
}

.study-story-tools input, .study-story-tools select {
  min-height: 44px;
  border: 1px solid #c6d9cd;
  border-radius: 10px;
  padding: 8px 11px;
  color: #20473a;
  background: #fff;
  font: inherit;
  font-size: .88rem;
}

.study-story-tools input { flex: 1 1 220px; min-width: 0; }
.study-story-tools select { flex: 0 1 auto; max-width: 100%; }
.study-story-count { margin-bottom: 10px; color: #476459; font-size: .85rem; }
.study-story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 13px;
  padding-bottom: 40px;
}

.study-story-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  min-width: 0;
  background: #fff;
  border: 1px solid #d9e6dc;
  border-radius: 15px;
  color: #153f33;
  text-decoration: none;
}

.study-story-card:hover { border-color: #6b9b7c; text-decoration: none; }
.study-story-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 114px;
  gap: 6px;
  padding: 10px;
  border-radius: 9px;
  text-align: center;
  background: #eaf3e2;
  color: #244e40;
  overflow-wrap: anywhere;
}
.study-story-cover[data-level="2"], .study-story-cover[data-level="5"] { background: #f6efdc; color: #5c4931; }
.study-story-cover[data-level="3"] { background: #e6eef4; color: #2d4e65; }
.study-story-cover[data-level="4"] { background: #eee9f4; color: #4c4264; }
.study-story-cover[data-level="6"] { background: #e2efea; color: #225448; }
.study-story-cover[data-level="7-9"] { background: #f2e8e2; color: #623f36; }
.study-story-cover [lang="zh-CN"] {
  font-family: var(--font-hanzi, sans-serif);
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.32;
}

.study-story-cover small { font-size: .74rem; }
.study-story-title { margin-inline: 4px; font-size: .95rem; font-weight: 600; }
.study-story-meta { margin: auto 4px 2px; color: #4c655c; font-size: .76rem; }
.study-story-back {
  display: inline-flex;
  padding: 9px 11px;
  border: 1px solid #c6d9cd;
  border-radius: 9px;
  color: #215240;
  background: #fff;
  margin: 0 0 12px;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}

@media (max-width: 900px) {
  body.study-layout { padding-inline-start: 0; }
  .study-layout > main { padding-inline: clamp(14px, 4vw, 32px); }
  .study-layout .study-mobile-bar {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 52;
    gap: 11px;
    align-items: center;
    min-height: 55px;
    padding: 5px 14px;
    background: #f5f9ef;
    border-bottom: 1px solid #d6e4d8;
    color: #1e4a3d;
    font-weight: 600;
  }
  .study-rail {
    visibility: hidden;
    width: min(278px, calc(100% - 32px));
    transform: translateX(-100%);
    transition: transform .18s ease, visibility .18s;
  }
  .study-drawer-open .study-rail { visibility: visible; transform: none; }
  .study-drawer-open .study-shade {
    display: block;
    position: fixed;
    z-index: 75;
    inset: 0;
    background: #193c3190;
    border: 0;
    cursor: pointer;
  }
  .study-shade svg { display: none; }
  .study-toggle, .study-close {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: 1px solid #cdded0;
    border-radius: 9px;
    color: #1a4637;
    background: #fff;
    cursor: pointer;
  }
  .study-toggle svg, .study-close svg { width: 21px; height: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  .study-rail { transition: none; }
}

/* Keep the existing navigation for guests, and group the signed-in home links. */
.study-home-nav { display: none; }
.study-home-account #menu > :not(.study-home-nav) { display: none; }
.study-home-account #menu > .study-home-nav {
  display: flex;
  align-items: center;
  gap: clamp(3px, 1vw, 12px);
}
.study-home-nav .study-home-group { position: relative; }
.study-home-nav .study-home-item,
.study-home-nav .study-home-group summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  min-height: 43px;
  border-radius: 9px;
  color: #34594d;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.study-home-nav .study-home-group summary { list-style: none; }
.study-home-group summary::-webkit-details-marker { display: none; }
.study-home-nav .study-home-group summary::after,
.study-rail-group > summary::after {
  content: '';
  display: inline-block;
  inline-size: 7px;
  block-size: 7px;
  border-inline-end: 1.5px solid;
  border-block-end: 1.5px solid;
  transform: translateY(-2px) rotate(45deg);
}
.study-home-nav .study-home-group[open] summary::after,
.study-rail-group[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.study-home-nav .study-home-item[aria-current="page"],
.study-home-nav .study-home-item:hover,
.study-home-nav .study-home-group summary:hover,
.study-home-nav .study-home-group[open] summary { color: #174534; background: #e5f0dc; }
.study-home-group-content {
  position: absolute;
  z-index: 8;
  top: calc(100% + 8px);
  right: 0;
  min-width: 184px;
  padding: 7px;
  border: 1px solid #d7e5d8;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 14px 27px #203e311a;
}
.study-home-group[open] .study-home-programs {
  display: grid;
  grid-template-columns: repeat(2, minmax(139px, auto));
  gap: 9px;
}
.study-home-programs strong {
  display: block;
  margin: 4px 8px;
  color: #496556;
  font-size: .75rem;
}
.study-home-nav .study-home-option {
  display: block;
  width: 100%;
  min-height: 38px;
  border: 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: transparent;
  text-align: start;
  color: #234d3f;
  text-decoration: none;
  font-size: .84rem;
  white-space: nowrap;
}
.study-home-nav .study-home-option:hover { background: #edf4e8; }
.study-home-user {
  max-width: 240px;
  padding: 8px 10px;
  color: #4a6557;
  border-bottom: 1px solid #e4ece1;
  font-size: .77rem;
  overflow-wrap: anywhere;
}
.study-home-user:empty { display: none; }
.study-rail-group > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 11px;
  list-style: none;
  cursor: pointer;
  color: #34584d;
  font-size: .86rem;
  font-weight: 600;
  border-radius: 9px;
}
.study-rail-group > summary::-webkit-details-marker { display: none; }
.study-rail-group > summary:hover,
.study-rail-group[open] > summary { background: #e2eee0; }
.study-rail-group-content { margin: 3px 0 4px 11px; }
.study-nav .study-link[aria-current="location"] { background: #1c5846; color: #fff; }

.story-index { padding-block: clamp(24px, 4.8vw, 58px); }
.story-index h1 {
  margin: 0;
  color: #184839;
  font-size: clamp(1.65rem, 4.3vw, 3rem);
  line-height: 1.2;
  letter-spacing: -.025em;
}
.story-index .story-heading {
  margin-top: 26px;
  color: #184839;
  font-size: clamp(1.2rem, 2.7vw, 1.6rem);
}
.story-index .study-story-card[hidden] { display: none; }
.story-index .study-story-grid { padding-bottom: 9px; }
.story-index .story-guide {
  margin-top: 28px;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid #dce9df;
  border-radius: 15px;
  background: #fff;
}
.story-guide h2 { margin-bottom: 10px; color: #184839; font-size: 1.25rem; }
.story-guide ol { margin: 10px 0 0 1.3em; }
.story-guide li + li { margin-top: 6px; }
.story-guide a, .story-faq a { color: #215f48; text-decoration: underline; }
.story-guide p { margin-top: 13px; }
.story-faq { margin: 26px 0 6px; }
.story-faq details { border-bottom: 1px solid #dce9df; padding: 0 5px; }
.story-faq summary { min-height: 44px; padding: 12px 0; color: #204e3d; cursor: pointer; font-weight: 600; }
.story-faq details p { margin: 0 0 14px; color: #416154; }
.story-index :focus-visible { outline: 3px solid #387848; outline-offset: 2px; }

@media (max-width: 820px) {
  .study-home-account #menu > .study-home-nav {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .study-home-nav .study-home-item,
  .study-home-nav .study-home-group summary { white-space: normal; }
  .study-home-group-content {
    position: static;
    min-width: 0;
    margin: 3px 0 7px;
    box-shadow: none;
  }
  .study-home-group[open] .study-home-programs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .study-home-nav .study-home-option { white-space: normal; }
}
