:root {
  --ip-ink: #17243a;
  --ip-muted: #617086;
  --ip-blue: #2389c9;
  --ip-blue-deep: #11679f;
  --ip-sky: #dff3ff;
  --ip-paper: #ffffff;
  --ip-line: #c8dce8;
  --ip-coral: #f27968;
  --ip-yellow: #f3c94f;
  --ip-green: #4c9a79;
  --ip-shadow: 0 18px 45px rgba(31, 74, 105, .12);
}

* { box-sizing: border-box; letter-spacing: 0; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ip-ink);
  background: #f7fbfd;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid rgba(35, 137, 201, .28);
  outline-offset: 3px;
}

.sky-shell {
  min-height: 100vh;
  background: #f7fbfd;
  overflow: clip;
}
.cloud, .sea { display: none !important; }
.topbar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ip-ink);
  text-decoration: none;
}
.brand img { width: 42px; height: 42px; object-fit: contain; }
.brand strong { font-size: 20px; font-weight: 900; }
.brand span { color: var(--ip-coral); }
.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(121, 160, 182, .32);
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 8px 24px rgba(42, 84, 109, .08);
  backdrop-filter: blur(16px);
}
.main-nav > a, .main-nav .nav-menu > a {
  min-height: 38px;
  padding: 9px 16px;
  border-radius: 2px;
  color: #526477;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.main-nav > a:hover, .main-nav > a.active {
  color: #fff;
  background: var(--ip-blue-deep);
}
.nav-menu, .nav-dropdown { display: contents; }

.home-shell #homeView { width: 100%; }
.hero-cinematic {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, .72fr);
  align-items: stretch;
  width: min(1280px, calc(100% - 40px));
  min-height: min(690px, calc(100vh - 92px));
  margin: 0 auto 32px;
  overflow: hidden;
  border: 1px solid #bad5e4;
  border-radius: 6px;
  background: #dff3ff url("/preview/ip-v1/assets/ip-home.png") center / cover no-repeat;
  box-shadow: var(--ip-shadow);
}
.hero-cinematic::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 42% 0 0;
  background: rgba(239, 249, 254, .93);
  border-right: 1px solid rgba(116, 154, 177, .22);
}
.editorial-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: none;
}
.hero-copy {
  align-self: center;
  width: min(620px, 100%);
  padding: 72px clamp(32px, 6vw, 84px);
}
.eyebrow, .section-kicker {
  margin: 0 0 16px;
  color: var(--ip-blue-deep);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0 !important;
  text-transform: uppercase;
}
.hero-copy h1 {
  margin: 0;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(48px, 6vw, 82px);
  line-height: 1.08;
  font-weight: 800;
}
.hero-copy > p:not(.eyebrow) {
  max-width: 470px;
  margin: 24px 0;
  color: #4f6071;
  font-size: 17px;
  line-height: 1.9;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.hero-primary, .hero-secondary, .outline-command, .known, .secondary-button {
  min-height: 46px;
  border: 1px solid var(--ip-blue-deep);
  border-radius: 3px;
  padding: 11px 20px;
  font-weight: 800;
  cursor: pointer;
}
.hero-primary, .known {
  color: #fff;
  background: var(--ip-blue-deep);
}
.hero-primary:hover, .known:hover { background: #0b547f; }
.hero-secondary, .secondary-button, .outline-command {
  color: var(--ip-blue-deep);
  background: rgba(255, 255, 255, .76);
}
#heroHint { display: block; margin-top: 18px; color: var(--ip-muted); }
.hero-desk { position: relative; min-height: 100%; pointer-events: none; }
.desk-label {
  position: absolute;
  top: 26px;
  left: 0;
  right: 26px;
  display: flex;
  justify-content: space-between;
  color: #466176;
  font-size: 11px;
  font-weight: 900;
}
.desk-card {
  position: absolute;
  right: 32px;
  bottom: 32px;
  width: min(260px, 64%);
  padding: 18px;
  border: 1px solid rgba(36, 77, 101, .28);
  border-radius: 4px;
  background: rgba(255, 255, 255, .91);
  box-shadow: 0 12px 28px rgba(32, 72, 94, .13);
}
.desk-card b { display: block; margin-bottom: 7px; font: 700 20px Georgia, serif; }
.desk-card small { color: var(--ip-muted); line-height: 1.65; }

.editorial-progress {
  display: grid;
  grid-template-columns: minmax(420px, 1.7fr) repeat(3, minmax(160px, .7fr));
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto 72px;
  border-top: 1px solid var(--ip-line);
  border-bottom: 1px solid var(--ip-line);
}
.editorial-progress > article {
  position: relative;
  min-height: 170px;
  padding: 24px;
  border-left: 1px solid var(--ip-line);
  background: #fff;
}
.editorial-progress > article:first-child { border-left: 0; }
.editorial-progress article > span { color: var(--ip-muted); font-size: 13px; }
.editorial-progress article > strong { display: block; margin: 12px 0 4px; font: 800 42px Georgia, serif; }
.editorial-progress article > small { color: var(--ip-muted); line-height: 1.55; }
.exam-progress { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.progress-copy h2 { margin: 0 0 7px; font-size: 25px; }
.progress-copy > p:not(.section-kicker) { margin: 0 0 14px; color: var(--ip-muted); }
.progress-copy button, #randomStudy {
  border: 0;
  padding: 0;
  color: var(--ip-blue-deep);
  background: none;
  font-weight: 800;
  cursor: pointer;
}
.overall-ring {
  --p: 0%;
  position: relative;
  display: grid;
  flex: 0 0 112px;
  width: 112px;
  height: 112px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--ip-coral) var(--p), #d8e8f0 0);
}
.overall-ring::before { content: ""; grid-area: 1 / 1; width: 88px; height: 88px; border-radius: 50%; background: #fff; }
.overall-ring > span { z-index: 1; grid-area: 1 / 1; text-align: center; font: 800 24px Georgia, serif; }
.overall-ring small { display: block; margin-top: 4px; color: var(--ip-muted); font: 600 10px system-ui, sans-serif; }
.ring-breakdown {
  position: absolute;
  z-index: 8;
  top: calc(50% + 66px);
  right: 18px;
  display: grid;
  width: 190px;
  padding: 14px;
  border: 1px solid #b9d0dc;
  border-radius: 4px;
  color: var(--ip-ink);
  background: #fff;
  box-shadow: 0 14px 34px rgba(25, 62, 84, .18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.ring-breakdown::before { content: ""; position: absolute; top: -7px; right: 43px; width: 12px; height: 12px; border: 1px solid #b9d0dc; border-right: 0; border-bottom: 0; background: #fff; transform: rotate(45deg); }
.ring-breakdown b { margin-bottom: 7px; font-size: 12px; }
.ring-breakdown span { display: flex; justify-content: space-between; padding: 4px 0; color: var(--ip-muted); }
.ring-breakdown em { color: var(--ip-ink); font-style: normal; font-weight: 900; }
.overall-ring:hover .ring-breakdown, .overall-ring:focus-within .ring-breakdown { opacity: 1; visibility: visible; transform: translateY(0); }

.editorial-intro, .editorial-path, .future-strip {
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto 90px;
}
.editorial-intro { max-width: 760px; text-align: center; }
.editorial-intro h2, .path-copy h2 { margin: 0 0 18px; font: 800 42px/1.22 Georgia, "Noto Serif SC", serif; }
.editorial-intro > p:not(.section-kicker), .path-copy > p { color: var(--ip-muted); font-size: 16px; line-height: 1.9; }
.text-link { display: inline-block; margin-top: 12px; color: var(--ip-blue-deep); font-weight: 900; }
.editorial-path { display: grid; grid-template-columns: 110px 1fr 1fr; align-items: center; min-height: 360px; border-top: 1px solid var(--ip-line); border-bottom: 1px solid var(--ip-line); }
.path-stamp { align-self: stretch; padding-top: 28px; border-right: 1px solid var(--ip-line); color: var(--ip-coral); font-weight: 900; }
.path-copy { padding: 42px; }
.path-visual { align-self: stretch; min-height: 360px; background: #e6f4fa; overflow: hidden; }
.path-visual img { width: 100%; height: 100%; object-fit: contain; }
.future-strip { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ip-line); }
.future-strip article { min-height: 190px; padding: 30px; border-right: 1px solid var(--ip-line); }
.future-strip article:last-child { border: 0; }
.future-strip h2 { margin: 30px 0 5px; }
.future-strip p, .future-strip em { color: var(--ip-muted); font-style: normal; }
.site-footer { display: flex; gap: 28px; align-items: center; padding: 32px max(20px, calc((100vw - 1180px)/2)); border-top: 1px solid var(--ip-line); background: #fff; }
.site-footer a { color: var(--ip-muted); text-decoration: none; }

/* Shared subpages */
.ip-page .page { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 18px 0 90px; }
.ip-subhero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-height: 270px;
  margin: 0 0 28px;
  padding: 42px;
  overflow: hidden;
  border: 1px solid #bed6e4;
  border-radius: 5px;
  background-color: #e3f4fb;
  background-position: center;
  background-size: cover;
  box-shadow: var(--ip-shadow);
}
.ip-subhero::before {
  content: "";
  position: absolute;
  inset: 0 46% 0 0;
  background: rgba(248, 252, 254, .9);
  border-right: 1px solid rgba(112, 151, 174, .16);
}
.ip-subhero > * { position: relative; z-index: 1; }
.ip-subhero h1 { margin: 0 0 8px; font: 800 42px/1.15 Georgia, "Noto Serif SC", serif; }
.ip-subhero p:not(.section-kicker) { margin: 0; color: var(--ip-muted); }
.ip-words .ip-subhero { background-image: url("/preview/ip-v1/assets/ip-home.png"); }
.ip-library .ip-subhero { background-image: url("/preview/ip-v1/assets/ip-library.png"); }
.ip-profile .ip-subhero { background-image: url("/preview/ip-v1/assets/ip-profile.png"); }
.heading-actions { display: flex; gap: 8px; }

.word-workspace, .filter-panel, .account-panel, .profile-stage {
  border: 1px solid var(--ip-line);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(34, 74, 99, .08);
}
.status-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--ip-line); }
.status-tabs button {
  min-height: 58px;
  border: 0;
  border-right: 1px solid var(--ip-line);
  border-radius: 0;
  color: var(--ip-muted);
  background: #f8fbfc;
  font-weight: 800;
  cursor: pointer;
}
.status-tabs button:last-child { border-right: 0; }
.status-tabs button.active { color: var(--ip-blue-deep); background: #fff; box-shadow: inset 0 -3px var(--ip-coral); }
.saved-list { padding: 0 26px; }
.saved-word { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 86px; border-bottom: 1px solid #e1ebf0; }
.saved-word:last-child { border-bottom: 0; }
.saved-word > div:first-child { min-width: 0; }
.saved-word strong { display: block; overflow-wrap: anywhere; font: 800 21px Georgia, serif; }
.saved-word span { display: block; margin-top: 6px; color: var(--ip-muted); line-height: 1.5; }
.saved-meta { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.delete-button { border: 0; color: #a34d43; background: none; cursor: pointer; }
.empty-state { padding: 72px 24px; text-align: center; }
.fox-purchase-button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #eea44a;
  border-radius: 999px;
  color: #8b470e;
  background: #fff8e8;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .16s ease, color .16s ease, background .16s ease, border-color .16s ease;
}
.fox-purchase-button:hover { transform: translateY(-1px); background: #fff0ca; }
.fox-purchase-button.is-selected { border-color: #ef714f; color: #fff; background: #ef714f; }
.library-term .fox-purchase-button { margin-top: 12px; }
.card-tools .fox-purchase-button { min-height: 32px; }
.fox-cart-mode #wordCardCartButton { display: none !important; }

.filter-panel { overflow: hidden; }
.filter-row { display: grid; grid-template-columns: 110px 1fr; gap: 20px; align-items: start; padding: 17px 22px; border-bottom: 1px solid #e0ebf0; }
.filter-row > strong { padding-top: 8px; font-size: 14px; }
.choice-group, .alphabet { display: flex; flex-wrap: wrap; gap: 7px; }
.choice-group label, .alphabet button {
  min-height: 34px;
  border: 1px solid #cbdce5;
  border-radius: 3px;
  padding: 7px 11px;
  color: #4f6173;
  background: #fff;
  cursor: pointer;
}
.choice-group label:has(input:checked), .alphabet button.active { color: #fff; border-color: var(--ip-blue-deep); background: var(--ip-blue-deep); }
.choice-group input { position: absolute; opacity: 0; pointer-events: none; }
.search-box { width: min(350px, 42%); }
.search-box span { color: var(--ip-muted); font-size: 12px; font-weight: 800; }
.search-box input, .root-control input, .dialog input[type=email], .dialog input[type=password], .dialog input[type=text], .dialog input[type=number] {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border: 1px solid #bad1de;
  border-radius: 3px;
  padding: 9px 12px;
  color: var(--ip-ink);
  background: #fff;
}
.filter-footer { padding: 14px 22px; }
.library-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.library-word { min-width: 0; border: 1px solid var(--ip-line); border-radius: 4px; background: #fff; box-shadow: 0 8px 20px rgba(34, 74, 99, .06); }
.library-term, .library-definitions, .library-tags { min-width: 0; }
.library-term strong { overflow-wrap: anywhere; font-family: Georgia, serif; }
.library-definition-row { display: grid; grid-template-columns: minmax(48px, auto) minmax(0, 1fr); align-items: start; gap: 12px; }
.library-definition-row.without-pos { grid-template-columns: 1fr; }
.library-definition-row b { white-space: nowrap; }
.library-definition-row span { min-width: 0; overflow-wrap: anywhere; line-height: 1.55; }
.pagination button { border-radius: 3px; }

.profile-hero { width: 100%; }
.account-panel { margin-bottom: 16px; }
.profile-stage { display: grid; grid-template-columns: .8fr 1.2fr 1.8fr; overflow: hidden; }
.profile-total, .book-stats, .cet6-summary { padding: 28px; border-right: 1px solid var(--ip-line); }
.cet6-summary { border-right: 0; }
.profile-total strong { color: var(--ip-coral); font: 800 54px Georgia, serif; }
.book-stats.two-columns { display: grid; grid-template-columns: 1fr 1fr; }
.book-stats strong, .result-grid strong { font-family: Georgia, serif; }
.profile-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 20px 28px; border-top: 1px solid var(--ip-line); }
.account-signed, .account-guest { padding: 24px; }

/* Study state stays inside the homepage */
.study-page {
  width: min(1020px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 80px;
}
.study-heading { display: flex; align-items: center; gap: 16px; margin: 12px 0 20px; }
.study-heading h1 { margin: 2px 0 0; font: 800 34px Georgia, "Noto Serif SC", serif; }
.study-heading p { margin: 0; color: var(--ip-muted); }
.back-home, .favorite-button, .audio-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ip-line);
  border-radius: 50%;
  color: var(--ip-blue-deep);
  background: #fff;
  cursor: pointer;
}
.session-progress { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; margin-bottom: 18px; }
.track { height: 7px; overflow: hidden; border-radius: 4px; background: #dce9ef; }
.track i { display: block; height: 100%; background: var(--ip-coral); }
.stage {
  position: relative;
  min-height: 610px;
  border: 1px solid #bdd4e1;
  border-radius: 5px;
  padding: clamp(30px, 5vw, 62px);
  background: #fff;
  box-shadow: var(--ip-shadow);
}
.card-topline { display: flex; align-items: center; justify-content: space-between; }
.card-tools { display: flex; gap: 8px; }
.level { color: var(--ip-blue-deep); font-size: 12px; font-weight: 900; }
.word {
  width: 100%;
  margin: clamp(44px, 7vh, 78px) auto 10px;
  overflow: hidden;
  color: var(--ip-ink);
  font-family: Georgia, serif;
  font-size: clamp(40px, 7vw, 76px);
  line-height: 1.08;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.word-pronunciation { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; color: var(--ip-muted); }
.quiz-panel, #answerPanel { width: min(720px, 100%); margin: 34px auto 0; }
.definition-list { display: grid; gap: 9px; }
.definition-row {
  display: grid;
  grid-template-columns: minmax(56px, auto) minmax(0, 1fr);
  gap: 15px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid #dce8ee;
  font-size: 17px;
  line-height: 1.65;
}
.definition-row.without-pos { grid-template-columns: 1fr; }
.definition-row b { color: var(--ip-coral); white-space: nowrap; }
.definition-row span { min-width: 0; overflow-wrap: anywhere; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(720px, 100%); margin: 42px auto 0; }
.actions > button { min-height: 52px; border-radius: 3px; }
.again { border: 1px solid var(--ip-coral); color: #9b4036; background: #fff; font-weight: 800; }
.reveal-actions { grid-template-columns: 1fr auto; align-items: center; }
.classification { min-width: 0; color: var(--ip-muted); }
.inline-action { border: 0; color: var(--ip-blue-deep); background: none; font-weight: 800; cursor: pointer; }
.quiz-options { display: grid; gap: 9px; }
.quiz-option { display: grid; grid-template-columns: 32px 1fr; align-items: center; min-height: 52px; border: 1px solid var(--ip-line); border-radius: 3px; color: var(--ip-ink); background: #fff; text-align: left; }
.done { text-align: center; }

.dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  border: 1px solid #aac9d9;
  border-radius: 5px;
  padding: 0;
  color: var(--ip-ink);
  background: #fff;
  box-shadow: 0 28px 90px rgba(23, 55, 76, .25);
}
.dialog::backdrop { background: rgba(21, 44, 61, .42); backdrop-filter: blur(4px); }
.dialog form, .exam-guide { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--ip-line); padding-bottom: 14px; }
.dialog-head h2 { margin: 0; font: 800 25px Georgia, "Noto Serif SC", serif; }
.close-button { width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--ip-muted); background: #edf4f7; cursor: pointer; }
.dialog fieldset { margin: 18px 0; border: 1px solid var(--ip-line); border-radius: 3px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.exam-guide-options { display: grid; gap: 9px; }
.exam-guide-options button { display: flex; justify-content: space-between; padding: 17px; border: 1px solid var(--ip-line); border-radius: 3px; color: var(--ip-ink); background: #fff; cursor: pointer; }
.exam-guide-options button:hover { border-color: var(--ip-blue); background: #f2faff; }

@media (max-width: 920px) {
  .hero-cinematic { grid-template-columns: 1fr; min-height: 650px; background-position: 62% center; }
  .hero-cinematic::before { inset: 0 28% 0 0; }
  .hero-copy { align-self: end; padding: 44px; }
  .hero-desk { position: absolute; inset: 0; z-index: -1; }
  .editorial-progress { grid-template-columns: 1fr 1fr; }
  .editorial-progress > article:nth-child(3) { border-left: 0; border-top: 1px solid var(--ip-line); }
  .editorial-progress > article:nth-child(4) { border-top: 1px solid var(--ip-line); }
  .editorial-path { grid-template-columns: 70px 1fr; }
  .path-visual { display: none; }
  .library-list { grid-template-columns: 1fr; }
  .profile-stage { grid-template-columns: 1fr 1fr; }
  .cet6-summary { grid-column: 1 / -1; border-top: 1px solid var(--ip-line); }
}

@media (max-width: 680px) {
  .topbar { width: 100%; min-height: auto; padding: 12px 14px 0; flex-wrap: wrap; gap: 10px; }
  .brand img { width: 34px; height: 34px; }
  .main-nav { order: 2; width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
  .main-nav > a { display: grid; place-items: center; min-width: 0; padding: 8px 3px; font-size: 12px; text-align: center; }
  .hero-cinematic { width: calc(100% - 24px); min-height: 610px; margin-top: 14px; background-position: 66% center; }
  .hero-cinematic::before { inset: 0 8% 0 0; background: rgba(239, 249, 254, .84); }
  .hero-copy { align-self: end; padding: 32px 24px 76px; }
  .hero-copy h1 { font-size: 47px; }
  .hero-copy > p:not(.eyebrow) { font-size: 15px; }
  .desk-label { left: 18px; right: 18px; }
  .desk-card { display: none; }
  .editorial-progress { width: calc(100% - 24px); grid-template-columns: 1fr; }
  .editorial-progress > article { border-left: 0; border-top: 1px solid var(--ip-line); }
  .editorial-progress > article:first-child { border-top: 0; }
  .exam-progress { min-height: 200px; }
  .editorial-intro, .editorial-path, .future-strip { width: calc(100% - 32px); margin-bottom: 64px; }
  .editorial-intro h2, .path-copy h2 { font-size: 34px; }
  .editorial-path { grid-template-columns: 1fr; }
  .path-stamp { min-height: auto; padding: 18px 0; border-right: 0; border-bottom: 1px solid var(--ip-line); }
  .path-copy { padding: 32px 0; }
  .future-strip { grid-template-columns: 1fr; }
  .future-strip article { border-right: 0; border-bottom: 1px solid var(--ip-line); }
  .site-footer { flex-wrap: wrap; }
  .ip-page .page, .study-page { width: calc(100% - 24px); padding-top: 14px; }
  .ip-subhero { min-height: 340px; padding: 26px 22px; background-position: 63% center; align-items: flex-end; }
  .ip-subhero::before { inset: 45% 0 0; border-right: 0; border-top: 1px solid rgba(112, 151, 174, .18); background: rgba(248, 252, 254, .9); }
  .ip-subhero h1 { font-size: 34px; }
  .ip-subhero .heading-actions { width: 100%; }
  .ip-subhero .heading-actions button { flex: 1; padding-inline: 10px; }
  .status-tabs { grid-template-columns: 1fr 1fr; }
  .status-tabs button:nth-child(2) { border-right: 0; }
  .status-tabs button:nth-child(-n+2) { border-bottom: 1px solid var(--ip-line); }
  .saved-list { padding: 0 15px; }
  .saved-word { align-items: flex-start; padding: 18px 0; }
  .filter-row { grid-template-columns: 1fr; gap: 8px; }
  .search-box { width: 100%; margin-top: 18px; }
  .profile-stage { grid-template-columns: 1fr; }
  .profile-total, .book-stats, .cet6-summary { border-right: 0; border-bottom: 1px solid var(--ip-line); }
  .cet6-summary { grid-column: auto; }
  .profile-actions { grid-column: auto; gap: 12px; align-items: stretch; flex-direction: column; }
  .stage { min-height: 560px; padding: 24px 18px; }
  .word { margin-top: 52px; font-size: clamp(34px, 12vw, 54px); }
  .definition-row { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; font-size: 15px; }
  .actions, .reveal-actions { grid-template-columns: 1fr; }
  .classification { text-align: center; }
}

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

/* IP companion system and library layout repair (preview v2) */
.ip-page .topbar {
  min-height: 76px;
  border-bottom: 1px solid rgba(151, 183, 200, .34);
}
.ip-page .main-nav {
  gap: 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.ip-page .main-nav > a {
  min-width: 72px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  text-align: center;
}
.ip-page .main-nav > a:hover {
  color: var(--ip-blue-deep);
  background: #eaf7fd;
}
.ip-page .main-nav > a.active {
  color: var(--ip-blue-deep);
  border-bottom-color: var(--ip-coral);
  background: transparent;
}

.ip-library .filter-panel {
  overflow: visible;
}
.ip-library .filter-row {
  grid-template-columns: 96px minmax(0, 1fr);
}
.ip-library .alphabet {
  display: grid;
  grid-template-columns: repeat(14, minmax(32px, 1fr));
  gap: 7px;
  width: 100%;
}
.ip-library .alphabet button {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 6px 2px;
  line-height: 1;
  white-space: nowrap;
}
.ip-library .library-list {
  align-items: start;
}
.ip-library .library-word {
  position: relative;
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(0, 1.35fr);
  gap: 18px 22px;
  min-height: 174px;
  padding: 20px;
}
.ip-library .library-term,
.ip-library .library-definitions,
.ip-library .library-tags {
  width: auto;
  min-width: 0;
}
.ip-library .library-term strong {
  display: block;
  font-size: 22px;
  line-height: 1.15;
}
.ip-library .library-definitions {
  display: grid;
  align-content: start;
  gap: 8px;
}
.ip-library .library-definition-row {
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
}
.ip-library .library-definition-row span {
  word-break: normal;
  overflow-wrap: anywhere;
}
.ip-library .library-tags {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding-top: 12px;
  border-top: 1px solid #e5eef2;
}
.ip-library .library-tag-set {
  justify-content: flex-start;
}
.ip-library .pagination {
  flex-wrap: wrap;
}

.fox-pet {
  position: fixed;
  z-index: 90;
  left: calc(100vw - 164px);
  top: calc(100vh - 164px);
  width: 144px;
  height: 148px;
  --pet-facing: 1;
  --move-duration: 0ms;
  transition:
    left var(--move-duration) linear,
    top var(--move-duration) linear;
  touch-action: none;
  user-select: none;
  will-change: left, top;
}
.fox-pet.facing-left { --pet-facing: -1; }
.fox-pet.is-positioning { transition: none !important; }
.fox-pet.is-dragging { z-index: 120; transition: none !important; }
.fox-pet-trigger {
  position: absolute;
  inset: 0;
  width: 144px;
  height: 144px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  box-shadow: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: filter .2s ease;
}
.fox-pet.is-dragging .fox-pet-trigger { cursor: grabbing; }
.fox-pet-trigger:hover {
  filter: brightness(1.04);
}
.fox-pet-sprite {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(var(--pet-facing));
  transform-origin: center bottom;
  pointer-events: none;
}
.fox-pet-cart-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 3px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #ef6149;
  box-shadow: 0 4px 12px rgba(121, 43, 29, .25);
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
}
.fox-pet-cart-badge[hidden] { display: none; }
.fox-pet.is-reacting .fox-pet-sprite {
  animation: foxPetCheer .2s ease-in-out 4 alternate;
}
.fox-pet-bubble {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 142px;
  width: max-content;
  max-width: 168px;
  padding: 8px 11px;
  border: 1px solid #bad4e2;
  border-radius: 6px;
  color: var(--ip-ink);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 10px 26px rgba(37, 76, 98, .14);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}
.fox-pet.near-left .fox-pet-bubble { right: auto; left: 0; }
.fox-pet-bubble[hidden] { display: none; }

@keyframes foxPetCheer {
  from { transform: scaleX(var(--pet-facing)) translateY(0) rotate(-2deg); }
  to { transform: scaleX(var(--pet-facing)) translateY(-10px) rotate(2deg); }
}
.fox-pet-panel {
  position: absolute;
  right: calc(100% + 8px);
  top: 8px;
  bottom: auto;
  display: grid;
  gap: 0;
  width: 196px;
  padding: 10px;
  border: 1px solid #bed7e4;
  border-radius: 6px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 18px 42px rgba(37, 76, 98, .19);
  transform-origin: right bottom;
}
.fox-pet.near-bottom .fox-pet-panel {
  top: auto;
  bottom: 8px;
}
.fox-pet.near-left .fox-pet-panel {
  right: auto;
  left: calc(100% + 8px);
  transform-origin: left bottom;
}
.fox-pet-panel[hidden] { display: none; }
.fox-pet-panel::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 33px;
  width: 12px;
  height: 12px;
  border-right: 1px solid #bed7e4;
  border-bottom: 1px solid #bed7e4;
  background: #fff;
  transform: rotate(-45deg);
}
.fox-pet.near-left .fox-pet-panel::after {
  right: auto;
  left: -7px;
  transform: rotate(135deg);
}
.fox-pet:not(.near-bottom) .fox-pet-panel::after {
  top: 33px;
  bottom: auto;
}
.fox-pet-panel strong {
  padding: 8px 10px 10px;
  color: var(--ip-muted);
  font-size: 12px;
}
.fox-pet-panel a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 4px;
  color: var(--ip-ink);
  font-weight: 750;
  text-decoration: none;
}
.fox-pet-panel a:hover,
.fox-pet-panel a[aria-current="page"] {
  color: var(--ip-blue-deep);
  background: #eaf7fd;
}
.fox-pet-panel a span { color: var(--ip-coral); }

@media (max-width: 1120px) {
  .ip-library .alphabet { grid-template-columns: repeat(9, minmax(32px, 1fr)); }
}

@media (max-width: 800px) {
  .ip-library .library-word {
    grid-template-columns: minmax(140px, .65fr) minmax(0, 1.35fr);
  }
}

@media (max-width: 680px) {
  .ip-page .topbar { height: auto !important; min-height: 0; padding-top: 10px; border-bottom: 0; }
  .ip-page .brand strong { display: block !important; font-size: 18px; }
  .ip-page .main-nav { height: 46px; min-height: 46px; border-top: 1px solid rgba(151, 183, 200, .34); }
  .ip-page .main-nav > a { height: 44px; min-width: 0; min-height: 44px; padding-block: 7px; }
  .ip-page .ip-subhero {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 184px auto auto;
    min-height: 0;
    padding: 0;
    align-items: stretch;
    background-color: #fff;
    background-position: 74% top;
    background-size: cover;
    background-repeat: no-repeat;
  }
  .ip-page .ip-subhero::before {
    inset: 184px 0 0;
    border: 0;
    border-top: 1px solid rgba(112, 151, 174, .18);
    background: rgba(248, 252, 254, .96);
  }
  .ip-page .ip-subhero > div:first-child {
    grid-row: 2;
    align-self: stretch;
    padding: 22px 22px 8px;
  }
  .ip-page .ip-subhero h1 { font-size: 31px; }
  .ip-page .ip-subhero .section-kicker { margin-bottom: 8px; }
  .ip-page .ip-subhero > .search-box,
  .ip-page .ip-subhero > .heading-actions {
    grid-row: 3;
    width: 100%;
    margin: 0;
    padding: 0 22px 22px;
  }
  .ip-library .filter-row { grid-template-columns: 1fr; }
  .ip-library .alphabet { grid-template-columns: repeat(7, minmax(30px, 1fr)); }
  .ip-library .library-word {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 17px;
  }
  .ip-library .library-tags { grid-column: auto; }
  .fox-pet { width: 96px; height: 100px; }
  .fox-pet-trigger { width: 96px; height: 96px; }
  .fox-pet-bubble,
  .fox-pet.near-left .fox-pet-bubble { right: 0; bottom: 98px; left: auto; }
  .fox-pet-panel,
  .fox-pet.near-left .fox-pet-panel { top: auto; right: 0; bottom: 104px; left: auto; width: 184px; transform-origin: right bottom; }
  .fox-pet-panel::after,
  .fox-pet.near-left .fox-pet-panel::after { right: 22px; bottom: -7px; left: auto; transform: rotate(45deg); }
}

@media (prefers-reduced-motion: reduce) {
  .fox-pet,
  .fox-pet-sprite { transition: none !important; animation: none !important; }
}
