/* 系统公共头尾与英语奇妙岛原有视觉的兼容层 */
body {
  min-width: 0;
}

/* 吸顶头部高度由 integration.js 实时写入，锚点跳转不被遮挡 */
[data-xy-main],
#grades {
  scroll-margin-top: calc(var(--xy-site-header-h, 160px) + 14px);
}

.xy-header.site-header {
  z-index: 120;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 253, 247, .96);
  border-bottom-color: var(--line, rgba(34, 48, 74, .13));
  backdrop-filter: saturate(150%) blur(16px);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
}

.xy-header .u-container,
.xy-footer .u-container {
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

.xy-header__inner .u-brand img {
  width: 131px;
  height: 33px;
  object-fit: contain;
}

.xy-coursebox-wrap {
  padding: 8px 0 12px;
}

.xy-coursebox {
  position: relative;
  border: 1px solid rgba(34, 48, 74, .13);
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 10px 28px rgba(34, 48, 74, .07), inset 0 1px 0 rgba(255, 255, 255, .9);
}

.xy-coursebox::before {
  display: block;
  height: 3px;
  border-radius: 15px 15px 0 0;
  background: linear-gradient(90deg, #0c7a52, #2fb37c 46%, #f0b64b);
  content: "";
}

.xy-coursebar {
  border-top: 0;
  border-radius: 0 0 15px 15px;
  background: linear-gradient(180deg, rgba(255, 248, 236, .55), rgba(255, 253, 247, .92));
}

.xy-coursebar__inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 50px;
  padding: 0 16px;
}

.xy-coursebrand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  color: var(--ink, #22304a);
}

.xy-coursebrand > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--ink, #22304a);
  border-radius: 10px;
  background: var(--accent, #ff6b6b);
  box-shadow: 0 3px 0 rgba(34, 48, 74, .16);
  font: 900 16px/1 var(--font-en, sans-serif);
}

.xy-coursebrand strong {
  font-size: 14px;
  letter-spacing: .02em;
}

.xy-coursebrand small {
  color: var(--muted, #6f7b90);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .14em;
}

.xy-coursebar .main-nav {
  margin-left: 8px;
}

.xy-coursebar .header-actions {
  margin-left: auto;
}

.xy-coursebar .grade-pill {
  display: inline-flex;
  min-height: 38px;
}

.xy-coursebar .sound-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}

.xy-coursebar .sound-btn[hidden] {
  display: none;
}

.xy-coursebar .menu-btn {
  display: none !important;
}

.xy-skip {
  z-index: 200;
}

.xy-drawer-course a,
.xy-drawer-books a {
  min-height: 40px;
}

.xy-footer.site-footer {
  margin-top: 0;
  padding-top: 48px;
  background: #0c1712;
  border-top: 0;
}

.xy-footer .u-footer__list--two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.xy-footer .u-footer__list--two li {
  margin-top: 0;
}

.xy-booknav {
  position: relative;
  z-index: 3;
  background: linear-gradient(90deg, #f3faf5 0%, #fffdf7 58%, #fff8ec 100%);
  border-bottom: 1px solid rgba(34, 48, 74, .08);
}

.xy-booknav__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 0 16px;
}

.xy-booknav__meta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-width: 0;
  color: var(--ink, #22304a);
  text-decoration: none;
}

.xy-booknav__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  background: #0c7a52;
  color: #fff;
  box-shadow: 0 4px 12px rgba(12, 122, 82, .16);
}

.xy-booknav__icon svg {
  width: 18px;
  height: 18px;
}

.xy-booknav__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.xy-booknav__copy strong {
  font-size: 13px;
  white-space: nowrap;
}

.xy-booknav__copy small {
  margin-top: 2px;
  color: var(--muted, #6f7b90);
  font-size: 11px;
  white-space: nowrap;
}

.xy-booknav__series {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.xy-booknav__series::-webkit-scrollbar {
  display: none;
}

.xy-booknav__series.is-scrollable {
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 24px), transparent 100%);
}

.xy-booknav__series.is-scrollable.is-end {
  -webkit-mask-image: none;
  mask-image: none;
}

.xy-booknav__series a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 11px;
  border: 1px solid rgba(34, 48, 74, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  color: #536359;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  scroll-snap-align: center;
  transition: color .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.xy-booknav__series a:hover {
  border-color: rgba(12, 122, 82, .34);
  background: #fff;
  color: #0c6f49;
  transform: translateY(-1px);
}

.xy-booknav__series a:focus-visible,
.xy-booknav__meta:focus-visible {
  outline: 3px solid rgba(12, 122, 82, .24);
  outline-offset: 2px;
}

.xy-booknav__series a[aria-current="page"] {
  padding-left: 24px;
  border-color: transparent;
  background: linear-gradient(135deg, #159864, #0c6f49);
  color: #fff;
  box-shadow: 0 5px 14px rgba(12, 122, 82, .2);
}

.xy-booknav__series a[aria-current="page"]::before {
  position: absolute;
  left: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d9fff0;
  content: "";
}


.xy-footer .u-footer__bottom {
  padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
}

.xy-footer .u-footer__bottom p {
  margin: 0;
}

.u-top {
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  right: calc(18px + env(safe-area-inset-right, 0px));
}

.u-top.is-show {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.xy-modal {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, .56);
  opacity: 0;
  transition: opacity .2s ease;
}

.xy-modal.is-open {
  opacity: 1;
}

.xy-modal__card {
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}

.xy-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.xy-modal__title {
  color: #17251e;
  font-size: 18px;
}

.xy-modal__close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f2;
  color: #34463c;
  font-size: 24px;
}

.xy-modal__body {
  color: #536359;
  font-size: 14px;
  line-height: 1.8;
}

.xy-modal__body img {
  width: 200px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 14px;
  border-radius: 12px;
}

.xy-modal__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.xy-modal__actions a {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 10px;
  border-radius: 12px;
  background: #eaf7f0;
  color: #12633f;
  font-weight: 700;
}

.xy-credits main {
  padding-top: 28px;
  padding-bottom: 56px;
}

.xy-credits .back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 12px;
}

@media (max-width: 960px) {
  .xy-coursebrand small {
    display: none;
  }

  .xy-coursebar .grade-pill {
    min-height: 44px;
  }
}

@media (max-width: 760px) {
  .xy-coursebox-wrap {
    padding: 6px 0 9px;
  }

  .xy-header .u-container,
  .xy-footer .u-container {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }

  .xy-header__inner {
    height: calc(var(--header-h, 64px) - 4px);
  }

  .xy-header__inner .u-brand img {
    width: 118px;
    height: auto;
  }

  .xy-header .u-burger,
  .xy-header .u-iconbtn,
  .xy-header .u-histbtn,
  .xy-header .u-btn--primary[data-modal="app"] {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .xy-header .u-header__actions .u-favbtn,
  .xy-header .u-header__actions .u-histbtn {
    display: none;
  }

  .xy-coursebar__inner {
    gap: 10px;
    min-height: 48px;
    padding: 0 12px;
  }

  .xy-coursebar .main-nav {
    position: static;
    display: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    opacity: 1;
    transform: none;
    pointer-events: none;
  }

  .xy-coursebrand {
    gap: 7px;
  }

  .xy-coursebrand > span {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 14px;
  }

  .xy-coursebrand strong {
    font-size: 13px;
  }

  .xy-coursebar .header-actions {
    gap: 6px;
  }

  .xy-coursebar .grade-pill {
    max-width: 132px;
    padding: 0 11px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .xy-booknav__inner {
    gap: 8px;
    min-height: 48px;
    padding: 0 12px;
  }

  .xy-booknav__icon {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .xy-booknav__copy strong span {
    display: none;
  }

  .xy-booknav__copy strong {
    font-size: 12px;
  }

  .xy-booknav__copy small {
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .xy-booknav__series a {
    min-height: 40px;
    padding: 0 10px;
    font-size: 11.5px;
  }

  .xy-footer .u-footer__list--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .xy-booknav__inner {
    gap: 6px;
  }

  .xy-booknav__meta {
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .xy-booknav__copy {
    display: none;
  }
}

@media (max-width: 360px) {
  .xy-coursebrand strong {
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .xy-coursebar .grade-pill {
    max-width: 112px;
  }

  .xy-modal__actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xy-modal,
  .xy-header,
  .xy-coursebar,
  .xy-booknav__series a {
    transition: none;
  }
}
