:root {
  --oi-navy: #142238;
  --oi-navy-2: #1d2d47;
  --oi-ink: #10213a;
  --oi-paper: #f4f2ed;
  --oi-warm: #fffdfa;
  --oi-line: #dce2e9;
  --oi-muted: #66758a;
  --oi-coral: #ff6b4a;
  --oi-blue: #2457d6;
  --oi-teal: #168579;
  --oi-gold: #c88a22;
  --oi-shadow: 0 18px 55px rgba(20, 34, 56, 0.09);
}

* { box-sizing: border-box; }

body.module-home:not(.theme-bw):not(.theme-by) {
  --bg: var(--oi-paper);
  --panel: var(--oi-warm);
  --panel-2: #f6f7f7;
  --soft: #f6f7f7;
  --soft-blue: #edf2ff;
  --line: var(--oi-line);
  --border: var(--oi-line);
  --text: var(--oi-ink);
  --muted: var(--oi-muted);
  --primary: var(--module-accent, var(--oi-blue));
  --primary-dark: #173f9f;
  --primary-soft: color-mix(in srgb, var(--module-accent, var(--oi-blue)) 9%, white);
  --primary-border: color-mix(in srgb, var(--module-accent, var(--oi-blue)) 25%, white);
  --accent: var(--module-accent, var(--oi-blue));
  --shadow: var(--oi-shadow);
  min-height: 100vh;
  color: var(--oi-ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at 8% 5%, rgba(36, 87, 214, 0.10), transparent 26rem),
    radial-gradient(circle at 92% 8%, rgba(255, 107, 74, 0.09), transparent 24rem),
    var(--oi-paper);
}

body.module-reading { --module-accent: var(--oi-blue); }
body.module-listening { --module-accent: var(--oi-teal); }
body.module-speaking { --module-accent: #91a916; }
body.module-writing { --module-accent: var(--oi-coral); }
body.module-mock { --module-accent: var(--oi-gold); }

body.module-home h1,
body.module-home h2,
body.module-home .fm-home-title,
body.module-home .brand strong,
body.module-home .brand-copy strong,
body.module-home .brand-text strong {
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  letter-spacing: -0.025em;
}

.oi-global-header {
  position: relative;
  z-index: 80;
  width: 100%;
  border-bottom: 1px solid rgba(20, 34, 56, 0.09);
  background: rgba(255, 253, 250, 0.92);
  backdrop-filter: blur(18px);
}

.oi-global-header-inner {
  width: min(1420px, calc(100% - 40px));
  min-height: 82px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 28px;
}

.oi-global-brand,
.oi-dashboard-link,
.oi-global-nav a {
  color: inherit;
  text-decoration: none;
}

.oi-global-brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  width: fit-content;
}

.oi-global-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--oi-navy);
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.oi-global-brand strong,
.oi-global-brand small { display: block; }
.oi-global-brand strong { font-family: Georgia, "Songti SC", serif; font-size: 22px; line-height: 1; }
.oi-global-brand small { margin-top: 5px; color: var(--oi-muted); font-size: 11px; letter-spacing: 0.08em; }

.oi-global-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(20, 34, 56, 0.09);
  border-radius: 999px;
  background: #f5f4f0;
}

.oi-global-nav a {
  min-width: 66px;
  padding: 10px 15px;
  border-radius: 999px;
  color: #66758a;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

.oi-global-nav a:hover { color: var(--oi-ink); transform: translateY(-1px); }
.oi-global-nav a.is-active { color: white; background: var(--oi-navy); box-shadow: 0 8px 18px rgba(20, 34, 56, .16); }

.oi-dashboard-link {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid rgba(20, 34, 56, .12);
  border-radius: 12px;
  background: white;
  font-size: 14px;
  font-weight: 850;
  box-shadow: 0 8px 24px rgba(20, 34, 56, .06);
}

.oi-dashboard-link span { color: var(--oi-coral); font-size: 18px; }

body.embedded-home > .oi-global-header,
body.embedded-exam > .oi-global-header,
body.fm-embedded > .oi-global-header { display: none; }

body.module-reading .container,
body.module-writing .container { width: min(1400px, calc(100% - 40px)); padding-top: 24px; }
body.module-listening .app-shell { width: min(1400px, calc(100% - 40px)); padding-top: 24px; }

body.module-reading .container > .topbar,
body.module-writing .container > .topbar { display: none; }

body.module-listening .main-panel > .topbar {
  min-height: 88px;
  margin: 0;
  padding: 4px 6px 20px;
}
body.module-listening .main-panel > .topbar .nav { display: none; }
body.module-listening .main-panel > .topbar h1 { font-size: clamp(32px, 4vw, 48px); }
body.module-listening .main-panel > .topbar .eyebrow {
  color: var(--module-accent);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 11px;
}

body.module-reading .reading-shell,
body.module-listening .app-shell { gap: 22px; }

body.module-reading .side-nav,
body.module-listening .side-nav {
  top: 20px;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  color: white;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--module-accent) 35%, transparent), transparent 12rem),
    var(--oi-navy);
  box-shadow: 0 22px 46px rgba(20, 34, 56, .18);
  padding: 18px;
}

body.module-reading .side-brand,
body.module-listening .side-brand { border-color: rgba(255,255,255,.14); }
body.module-reading .side-brand strong,
body.module-listening .side-brand strong { color: white; }
body.module-reading .side-brand span,
body.module-listening .side-brand span,
body.module-reading .nav-title,
body.module-listening .nav-title { color: rgba(255,255,255,.58); }

body.module-reading .side-nav .logo,
body.module-listening .side-nav .logo {
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.10);
  box-shadow: none;
}

body.module-reading .side-link,
body.module-listening .nav-section a { color: rgba(255,255,255,.76); }
body.module-reading .side-link:hover,
body.module-reading .side-link.is-active,
body.module-listening .nav-section a:hover,
body.module-listening .nav-section a.active {
  color: white;
  border-color: rgba(255,255,255,.10);
  background: rgba(255,255,255,.12);
}

body.module-reading .mini-progress {
  border-color: rgba(255,255,255,.12);
  color: white;
  background: rgba(255,255,255,.08);
}
body.module-reading .mini-progress span { color: rgba(255,255,255,.66); }
body.module-reading .mini-illustration { color: white; background: rgba(255,255,255,.10); }

body.module-home .card,
body.module-home .dashboard-grid,
body.module-home .section-block {
  border-color: rgba(20,34,56,.10);
  background: rgba(255,253,250,.96);
}

body.module-home .card,
body.module-home .dashboard-grid { box-shadow: 0 16px 45px rgba(20,34,56,.07); }
body.module-home .dashboard-grid,
body.module-reading .hero { border-radius: 26px 26px 0 0; }
body.module-home .section-block,
body.module-reading .progress-section { border-radius: 0 0 26px 26px; }

body.module-reading .hero,
body.module-listening .dashboard-grid { position: relative; overflow: hidden; }
body.module-reading .hero::before,
body.module-listening .dashboard-grid::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--module-accent), color-mix(in srgb, var(--module-accent) 20%, var(--oi-coral)));
}

body.module-home .quick-start-card,
body.module-reading .quick-section { background: rgba(255,253,250,.96); }
body.module-home .quick-link { background: transparent; }
body.module-home .quick-link:hover { background: color-mix(in srgb, var(--module-accent) 7%, white); }
body.module-home .quick-icon {
  color: var(--module-accent);
  background: color-mix(in srgb, var(--module-accent) 10%, white);
}

body.module-home .btn.primary,
body.module-home .fm-home-btn:not(.secondary):not(.ghost) {
  border-color: var(--oi-coral);
  color: white;
  background: var(--oi-coral);
  box-shadow: 0 10px 20px rgba(255,107,74,.20);
}

body.module-home .btn.primary:hover,
body.module-home .fm-home-btn:not(.secondary):not(.ghost):hover { transform: translateY(-1px); background: #ef5b3d; }

body.module-home .field,
body.module-home .input,
body.module-home .select {
  border-color: rgba(20,34,56,.13);
  background: white;
}

/* Listening catalogue: keep the dense bank useful, but bring it into the new portal language. */
body.module-listening.listening-sequence-page .main-panel > .topbar {
  min-height: 112px;
  align-items: end;
  padding: 18px 8px 22px;
}
body.module-listening.listening-sequence-page .main-panel > .topbar h1 {
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(38px, 5vw, 62px);
  letter-spacing: -.04em;
}
body.module-listening.listening-sequence-page .main-panel > .card:first-of-type {
  position: relative;
  overflow: hidden;
  border-radius: 26px 26px 0 0;
  box-shadow: none;
}
body.module-listening.listening-sequence-page .main-panel > .card:first-of-type::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--module-accent), var(--oi-coral));
}
body.module-listening.listening-sequence-page .slim-hero {
  margin: 0;
}
body.module-listening.listening-sequence-page .slim-hero .card {
  border-top: 0;
  border-radius: 0 0 26px 26px;
}
body.module-listening.listening-sequence-page .test-block {
  border-radius: 24px;
  padding: 26px;
}
body.module-listening.listening-sequence-page .part-card {
  border-color: rgba(20,34,56,.09);
  border-radius: 17px;
  background: #f8f7f3;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
body.module-listening.listening-sequence-page .part-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--module-accent) 32%, white);
  box-shadow: 0 14px 34px rgba(20,34,56,.08);
}
body.module-listening.listening-sequence-page .item-title {
  font-family: Georgia, "Noto Serif SC", "Songti SC", serif;
  color: var(--oi-navy);
}
body.module-listening.listening-sequence-page .scene-tabs {
  scrollbar-color: color-mix(in srgb, var(--module-accent) 40%, white) transparent;
}

/* Writing home: same system, intentionally more editorial because the task is long-form output. */
body.module-writing .container { max-width: 1280px; padding-top: 34px; }
body.module-writing .hero { gap: 0; margin: 0; }
body.module-writing .hero > .card { min-height: 390px; border-radius: 0; padding: clamp(30px, 5vw, 64px); }
body.module-writing .hero > .card:first-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 0;
  border-radius: 30px 0 0 30px;
  color: white;
  background:
    radial-gradient(circle at 100% 0, rgba(255,107,74,.28), transparent 22rem),
    var(--oi-navy);
}
body.module-writing .hero > .card:first-child .muted { color: rgba(255,255,255,.70); font-size: 16px; line-height: 1.75; }
body.module-writing .hero > .card:first-child .eyebrow { color: #ff9a82; letter-spacing: .14em; text-transform: uppercase; }
body.module-writing .hero > .card:first-child h1 { max-width: 650px; font-size: clamp(42px, 7vw, 78px); }
body.module-writing .hero > .card:first-child .btn:not(.primary) { color: white; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.08); }
body.module-writing .hero > .card:last-child { display: grid; align-content: center; border-radius: 0 30px 30px 0; background: var(--oi-warm); }
body.module-writing .hero .stats { gap: 0; }
body.module-writing .hero .stat { min-height: 130px; border-radius: 0; border-width: 0 0 1px 0; background: transparent; }
body.module-writing .hero .stat:nth-child(odd) { border-right: 1px solid var(--oi-line); }
body.module-writing .grid-2 { margin-top: 22px; }
body.module-writing .grid-2 > * { border-radius: 22px; }
body.module-writing .quick-link { border: 1px solid rgba(20,34,56,.10); background: var(--oi-warm); box-shadow: var(--oi-shadow); }

/* Full mock home: the original data-driven rows become a calm exam-set catalogue. */
body.module-mock .fm-home { max-width: 1320px !important; padding: 34px 24px 56px !important; }
.fm-module-tabs { display: flex; align-items: center; gap: 8px; width: fit-content; margin: 0 0 18px; padding: 6px; border: 1px solid rgba(20,34,56,.10); border-radius: 14px; background: rgba(255,253,250,.88); }
.fm-module-tabs a { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 15px; border-radius: 10px; color: var(--oi-muted); text-decoration: none; font-size: 13px; font-weight: 850; }
.fm-module-tabs a:hover { color: var(--oi-ink); background: #f1f3f5; }
.fm-module-tabs a.is-active { color: white; background: var(--oi-navy); box-shadow: 0 8px 18px rgba(20,34,56,.14); }
body.module-mock .fm-home-head {
  min-height: 270px;
  align-items: end !important;
  margin-bottom: 22px;
  padding: clamp(30px, 5vw, 58px);
  overflow: hidden;
  border-radius: 30px;
  color: white;
  background:
    radial-gradient(circle at 88% 12%, rgba(200,138,34,.32), transparent 20rem),
    radial-gradient(circle at 60% 130%, rgba(36,87,214,.30), transparent 25rem),
    var(--oi-navy);
  box-shadow: 0 24px 60px rgba(20,34,56,.18);
}
body.module-mock .fm-home-title { margin-bottom: 12px !important; font-size: clamp(46px, 7vw, 82px) !important; line-height: .98; }
body.module-mock .fm-home-copy { max-width: 720px; margin: 0 !important; color: rgba(255,255,255,.70) !important; font-size: 16px; line-height: 1.75; }
body.module-mock .fm-home-kicker { margin-bottom: 16px; color: #efbd68; font-size: 11px; font-weight: 900; letter-spacing: .18em; }
body.module-mock .fm-home-facts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
body.module-mock .fm-home-facts span { padding: 7px 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; color: rgba(255,255,255,.78); background: rgba(255,255,255,.06); font-size: 12px; font-weight: 800; }
body.module-mock .fm-home-head .fm-home-btn.ghost { border-color: rgba(255,255,255,.20) !important; color: white !important; background: rgba(255,255,255,.08) !important; }
body.module-mock .fm-home-list { display: grid; gap: 12px; border: 0 !important; }
body.module-mock .fm-home-row {
  grid-template-columns: minmax(160px,.7fr) minmax(360px,1.7fr) minmax(150px,.65fr) minmax(180px,.8fr) !important;
  gap: 20px !important;
  margin: 0;
  padding: 20px 24px !important;
  border: 1px solid rgba(20,34,56,.10) !important;
  border-radius: 18px;
  background: rgba(255,253,250,.96);
  box-shadow: 0 12px 32px rgba(20,34,56,.05);
}
body.module-mock .fm-home-row.head {
  min-height: auto;
  padding: 10px 24px !important;
  border: 0 !important;
  color: var(--oi-muted);
  background: transparent !important;
  box-shadow: none;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .12em;
}
body.module-mock .fm-home-set strong { font-family: Georgia, "Songti SC", serif; font-size: 21px; }
body.module-mock .fm-home-meta,
body.module-mock .fm-home-score { color: var(--oi-muted) !important; }
body.module-mock .fm-home-btn { min-height: 42px !important; height: auto !important; padding: 9px 15px !important; border-radius: 10px !important; font-weight: 800; }
body.module-mock .fm-home-btn.secondary { color: var(--module-accent) !important; border-color: color-mix(in srgb, var(--module-accent) 30%, white) !important; background: color-mix(in srgb, var(--module-accent) 8%, white) !important; }
body.module-mock .fm-home-row .status { width: fit-content; padding: 6px 10px; border-radius: 999px; background: #f1f4f7; font-weight: 800; }

@media (prefers-reduced-motion: no-preference) {
  .oi-global-header,
  body.module-home .main-stage,
  body.module-home .main-panel,
  body.module-writing .container,
  body.module-mock .fm-home {
    animation: oi-rise .45s cubic-bezier(.22,.8,.25,1) both;
  }
  @keyframes oi-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}

@media (max-width: 980px) {
  .oi-global-header-inner { grid-template-columns: 1fr auto; gap: 14px; padding: 12px 0; }
  .oi-global-nav { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; overflow-x: auto; justify-content: flex-start; }
  .oi-dashboard-link { grid-column: 2; grid-row: 1; }
  body.module-reading .side-nav,
  body.module-listening .side-nav { border-radius: 20px; }
  body.module-writing .hero > .card:first-child { border-radius: 24px 24px 0 0; }
  body.module-writing .hero > .card:last-child { min-height: auto; border-radius: 0 0 24px 24px; }
  body.module-mock .fm-home-row { grid-template-columns: 1fr 1fr !important; }
  body.module-mock .fm-home-row.head { display: none !important; }
}

@media (max-width: 900px) {
  body.module-reading .side-nav,
  body.module-listening .side-nav {
    display: flex;
    align-items: stretch;
    gap: 10px;
    min-height: 92px;
    padding: 10px;
    overflow-x: auto;
    border-radius: 18px;
    scrollbar-width: none;
  }
  body.module-reading .side-nav::-webkit-scrollbar,
  body.module-listening .side-nav::-webkit-scrollbar { display: none; }
  body.module-reading .side-brand,
  body.module-listening .side-brand {
    min-width: 170px;
    margin: 0;
    padding: 8px 14px 8px 6px;
    border-right: 1px solid rgba(255,255,255,.14);
    border-bottom: 0;
  }
  body.module-reading .nav-group,
  body.module-listening .nav-section {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: max-content;
    margin: 0;
  }
  body.module-reading .nav-title,
  body.module-listening .nav-title { display: none; }
  body.module-reading .nav-list { display: flex; gap: 5px; }
  body.module-reading .side-link,
  body.module-listening .nav-section a {
    width: auto;
    min-height: 48px;
    flex: 0 0 auto;
    padding: 10px 13px;
  }
  body.module-reading .mini-progress { display: none; }
}

@media (max-width: 620px) {
  .oi-global-header-inner { width: min(100% - 24px, 100%); }
  .oi-global-brand strong { font-size: 19px; }
  .oi-global-brand small { display: none; }
  .oi-global-mark { width: 42px; height: 42px; }
  .oi-dashboard-link { min-height: 40px; padding: 0 12px; font-size: 13px; }
  .oi-global-nav a { min-width: 60px; padding: 9px 12px; }
  body.module-reading .container,
  body.module-writing .container,
  body.module-listening .app-shell { width: min(100% - 16px, 100%); }
  body.module-writing .hero > .card { min-height: auto; padding: 28px 22px; }
  body.module-writing .hero > .card:first-child h1 { font-size: 42px; }
  body.module-writing .hero .stat:nth-child(odd) { border-right: 0; }
  body.module-mock .fm-home { padding: 18px 12px 40px !important; }
  body.module-mock .fm-home-head { min-height: 290px; align-items: flex-end !important; padding: 28px 22px; border-radius: 24px; }
  body.module-mock .fm-home-head > div:last-child { width: 100%; }
  body.module-mock .fm-home-head .fm-home-btn { width: 100%; }
  body.module-mock .fm-home-row { grid-template-columns: 1fr !important; padding: 18px !important; }
  .fm-module-tabs { width: 100%; }
  .fm-module-tabs a { flex: 1; }
}

/* Match standalone modules to the dashboard's global navigation frame. */
.oi-global-header-inner{
  width:100%;
  min-height:82px;
  padding:14px 24px;
  grid-template-columns:auto minmax(0,1fr) auto;
  gap:18px;
}
.oi-global-mark{
  width:46px;
  height:46px;
  border-radius:14px;
  background:var(--oi-navy);
  font-size:18px;
}
.oi-global-brand{gap:13px}
.oi-global-brand strong{font-size:20px;letter-spacing:-.015em}
.oi-global-brand small{margin-top:5px;font-size:11px;letter-spacing:.06em}
.oi-global-nav{
  min-width:0;
  gap:6px;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  overflow-x:auto;
  scrollbar-width:none;
}
.oi-global-nav::-webkit-scrollbar{display:none}
.oi-global-nav a{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:0;
  min-height:40px;
  padding:0 14px;
  border-radius:999px;
  font-size:14px;
  font-weight:800;
}
.oi-global-nav a:hover{background:#f0f2f4}
.oi-global-nav a.is-active{
  background:var(--module-accent,var(--oi-navy));
  box-shadow:0 8px 18px color-mix(in srgb,var(--module-accent,var(--oi-navy)) 22%,transparent);
}
.oi-dashboard-link{
  min-height:40px;
  padding:0 14px;
  border-color:var(--oi-line);
  border-radius:12px;
  font-size:13px;
  box-shadow:none;
}

@media(max-width:1100px){
  .oi-global-header-inner{grid-template-columns:minmax(0,1fr) auto;gap:10px 16px}
  .oi-global-nav{grid-column:1 / -1;grid-row:2;justify-self:stretch;justify-content:flex-start}
  .oi-dashboard-link{grid-column:2;grid-row:1}
}

@media(max-width:620px){
  .oi-global-header-inner{width:100%;padding:11px 12px;gap:9px 12px}
  .oi-global-mark{width:40px;height:40px;border-radius:12px}
  .oi-global-brand strong{font-size:18px}
  .oi-global-nav a{min-height:34px;padding:0 11px;font-size:12px}
  .oi-dashboard-link{min-height:38px;padding:0 11px;font-size:12px}
}
