:root {
  --indigo: #21165e;
  --indigo-deep: #160e42;
  --indigo-soft: #3c2f86;
  --gold: #d7a441;
  --gold-bright: #e6c06a;
  --ink: #241c33;
  --muted: #4e4860;
  --line: #e6e1d6;
  --paper: #f5f3ee;
  --card: #fffcf7;
  --white: #ffffff;
  --header-h: 76px;
  --shadow: 0 18px 40px rgba(33, 22, 94, 0.1);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  background:
    radial-gradient(1000px 420px at 110% -10%, rgba(33, 22, 94, 0.05), transparent 55%),
    radial-gradient(800px 360px at -10% 8%, rgba(215, 164, 65, 0.12), transparent 50%),
    var(--paper);
}
img { max-width: 100%; display: block; }
a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select { font-family: inherit; font-size: 16px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; letter-spacing: 0.02em; margin: 0; }
p { margin: 0; }

.skip {
  position: absolute;
  left: 16px;
  top: -40px;
  background: var(--gold);
  color: var(--indigo);
  padding: 8px 12px;
  z-index: 100;
}
.skip:focus { top: 12px; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.container { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.section { padding: 88px 0; }
.section.tight { padding-top: 36px; }
.section-head { max-width: 640px; margin-bottom: 36px; }
.kicker {
  margin: 0 0 10px;
  color: var(--gold-bright);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.section .kicker { color: #9a7430; }
.lead { color: var(--muted); font-size: 17px; }
h2 { font-size: clamp(28px, 3vw, 40px); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: var(--indigo);
  color: white;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}
.site-header.is-stuck { box-shadow: 0 10px 30px rgba(22, 14, 66, 0.28); }
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 40px; width: auto; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  padding: 8px 12px;
  font-size: 15px;
  border-radius: 999px;
  position: relative;
}
.nav a:hover { color: white; background: rgba(255, 255, 255, 0.08); }
.nav a[aria-current="page"] { color: white; }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}
.icon-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.nav-toggle { display: none; }
.nav-toggle .i-close { display: none; }
.nav-toggle[aria-expanded="true"] .i-open { display: none; }
.nav-toggle[aria-expanded="true"] .i-close { display: block; }
#modules, #about, #courses { scroll-margin-top: 20px; }
#modules { padding-top: 72px; }
#modules .section-head {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.8fr);
  gap: 12px 48px;
  align-items: end;
}
#modules .section-head .lead { margin: 0; }
#courses .course-grid { align-items: start; }
#courses .card:last-child { margin-top: 28px; }
.header-tools { display: flex; align-items: center; gap: 8px; }

/* Logto 登录入口 */
.auth-slot { display: flex; align-items: center; }
.auth-loading {
  color: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  padding: 0 8px;
}
.auth-login {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.auth-login:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.55);
}
.auth-login.is-busy,
.auth-login:disabled {
  opacity: 0.72;
  cursor: wait;
}
.auth-user { position: relative; }
.auth-user-btn {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px 0 6px;
  border-radius: 999px;
  cursor: pointer;
  max-width: min(220px, 42vw);
}
.auth-user-btn:hover { background: rgba(255, 255, 255, 0.16); }
.auth-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--indigo);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
.auth-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}
.auth-caret { opacity: 0.75; flex: none; }
.auth-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 168px;
  padding: 8px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  border: 1px solid rgba(33, 22, 94, 0.08);
  z-index: 50;
}
.auth-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.auth-menu-item:hover { background: #efeaf8; color: var(--indigo); }
.auth-menu-danger { color: #8a2f3a; }
.auth-menu-danger:hover { background: #f8e9eb; color: #8a2f3a; }

.auth-toast {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(22, 14, 66, 0.42);
  padding: 24px;
}
.auth-toast[hidden] { display: none !important; }
.auth-toast-card {
  width: min(400px, 100%);
  background: var(--card);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-toast-title {
  font-family: var(--serif);
  font-size: 24px;
  margin: 0 0 8px;
}
.auth-toast-text { color: var(--muted); margin: 0 0 22px; }
.auth-toast-actions { display: flex; gap: 10px; justify-content: flex-end; }
.auth-toast-actions .btn-line {
  color: var(--indigo);
  border-color: rgba(33, 22, 94, 0.28);
}
.auth-toast-actions .btn-line:hover { background: #efeaf8; }
.auth-toast-actions .btn { min-height: 40px; padding: 0 16px; }

.callback-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--indigo);
  color: #fff;
}
.callback-status { font-size: 18px; letter-spacing: 0.04em; }

.admin-section { padding-top: 48px; }
.admin-gate { max-width: 560px; }
.admin-gate-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.admin-stat {
  background: var(--card);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 1px 0 rgba(33, 22, 94, 0.04);
  border: 1px solid rgba(33, 22, 94, 0.08);
}
.admin-stat-num {
  font-family: var(--serif);
  font-size: 40px;
  line-height: 1.1;
  margin: 8px 0 4px;
  color: var(--indigo);
}
.admin-stat-name {
  font-family: var(--serif);
  font-size: 28px;
  margin: 10px 0 4px;
  color: var(--indigo);
}
.admin-stat-desc { color: var(--muted); font-size: 14px; }
.admin-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}
.admin-panel-wide { grid-column: 1 / -1; }
.admin-panel h2 { font-size: 24px; margin-bottom: 8px; }
.admin-panel .lead { margin-bottom: 16px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
.admin-table code {
  font-size: 12px;
  word-break: break-all;
}
.admin-bars { display: grid; gap: 14px; }
.admin-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 14px;
}
.admin-bar-track {
  height: 10px;
  border-radius: 999px;
  background: #efeaf8;
  overflow: hidden;
}
.admin-bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--indigo), var(--indigo-soft));
}
.admin-empty { color: var(--muted); margin: 0; }

html[data-auth="out"] a.tool {
  cursor: pointer;
}

@media (max-width: 900px) {
  .admin-summary,
  .admin-grid { grid-template-columns: 1fr; }
  .auth-name { max-width: 72px; }
}

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 36px;
  min-height: min(860px, calc(100vh - var(--header-h)));
  padding: 52px 0 40px;
  color: white;
  background: #16325c;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 52%;
}
.hero-shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(100deg, rgba(14, 22, 48, 0.48) 0%, rgba(14, 22, 48, 0.18) 32%, rgba(14, 22, 48, 0.02) 58%, transparent 78%);
  pointer-events: none;
}
.hero-top {
  position: relative;
  z-index: 1;
}
.hero-dock {
  position: relative;
  z-index: 1;
  margin-top: auto;
}
.hero-copy { padding-top: 6px; max-width: 640px; }
.hero h1 { font-size: clamp(32px, 4.3vw, 56px); color: white; text-shadow: 0 2px 18px rgba(8, 12, 28, 0.28); }
.hero h1 span { display: block; }
@media (min-width: 760px) {
  .hero h1 span { white-space: nowrap; }
}
.hero .rule {
  width: 56px;
  height: 3px;
  background: var(--gold);
  margin: 18px 0;
  border: 0;
}
.hero .lead { color: rgba(255, 255, 255, 0.92); max-width: 34em; text-shadow: 0 1px 10px rgba(8, 12, 28, 0.25); }
.hero-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: var(--indigo);
  box-shadow: 0 8px 20px rgba(215, 164, 65, 0.28);
}
.btn-gold:hover { box-shadow: 0 12px 24px rgba(215, 164, 65, 0.38); }
.btn-line {
  background: transparent;
  color: white;
  border-color: rgba(255, 255, 255, 0.55);
}
.btn-line:hover { background: rgba(255, 255, 255, 0.1); }
.btn-indigo { background: var(--indigo); color: white; }
.btn-indigo:hover { background: var(--indigo-soft); }
.btn-ghost {
  background: transparent;
  color: var(--indigo);
  border-color: rgba(33, 22, 94, 0.25);
}
.btn-ghost:hover { background: white; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 999px; }
.page-hint { margin-top: 12px; font-size: 14px; color: rgba(255, 255, 255, 0.82); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: stretch;
  padding: 0;
  margin: 0;
  background: transparent;
  box-shadow: none;
}
.stats li {
  list-style: none;
  margin: 0;
  padding: 22px 22px 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  background: rgba(16, 18, 42, 0.28);
  box-shadow: 0 12px 28px rgba(10, 16, 36, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.stats strong {
  display: block;
  font-family: var(--serif);
  font-size: 36px;
  color: #fff;
  letter-spacing: 0.02em;
  font-weight: 600;
}
.stats span { color: rgba(255, 255, 255, 0.86); font-size: 14px; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .stats li { background: rgba(16, 18, 42, 0.55); }
}

.gate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.gate {
  position: relative;
  overflow: hidden;
  min-height: 248px;
  padding: 28px 28px 24px;
  background: var(--card);
  border: 1px solid rgba(33, 22, 94, 0.06);
  border-radius: 4px 18px 18px 4px;
  box-shadow: 0 1px 0 rgba(33, 22, 94, 0.04);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease), border-color 0.28s;
}
.gate::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gold);
  transform: scaleY(0.28);
  transform-origin: top;
  transition: transform 0.35s var(--ease);
}
.gate-mark {
  position: absolute;
  right: -8px;
  bottom: -22px;
  font-family: var(--serif);
  font-size: 168px;
  line-height: 1;
  color: rgba(33, 22, 94, 0.08);
  pointer-events: none;
  user-select: none;
  z-index: 0;
  transform: rotate(0deg) scale(1);
  transform-origin: 92% 88%;
  transition: transform 0.4s var(--ease), color 0.35s var(--ease);
}
.gate-meta, .gate h3, .gate p, .gate-go { position: relative; z-index: 1; }
.gate-meta {
  color: #9a7430;
  font-size: 13px;
  letter-spacing: 0.16em;
}
.gate h3 { font-size: 30px; margin: 12px 0 10px; }
.gate p { color: var(--muted); flex: 1; max-width: 34em; }
.gate-go {
  margin-top: 22px;
  font-size: 14px;
  font-weight: 600;
  color: var(--indigo);
}
.gate-go::after { content: " →"; }
.gate:hover, .gate:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(33, 22, 94, 0.16);
  box-shadow: var(--shadow);
}
.gate:hover::before, .gate:focus-visible::before { transform: scaleY(1); }
.gate:hover .gate-mark, .gate:focus-visible .gate-mark {
  color: rgba(215, 164, 65, 0.28);
  transform: rotate(-14deg) scale(1.18);
}
.gate-grid-sub { margin-top: 16px; }
.gate-grid-sub .gate { min-height: 220px; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}
.about-copy .lead { margin-top: 16px; }
.about-copy h2 { font-size: clamp(26px, 2.6vw, 36px); line-height: 1.3; }
.about-copy p {
  color: var(--muted);
  line-height: 1.85;
  margin: 0 0 16px;
}
.about-copy p:last-child { margin-bottom: 0; }
#about .split { grid-template-columns: 1.08fr 0.92fr; align-items: start; }
#about .about-visual { position: sticky; top: calc(var(--header-h) + 28px); }
.about-visual {
  position: relative;
  min-height: 420px;
  padding-bottom: 36px;
}
.frame-main { margin: 0; }
.frame-main img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  object-position: center 45%;
  border-radius: 18px;
}
.frame-sub {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 46%;
  margin: 0;
}
.frame-sub img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  object-position: center top;
  border-radius: 14px;
  border: 6px solid var(--paper);
  box-shadow: var(--shadow);
}
.caption { margin-top: 8px; font-size: 13px; color: var(--muted); }

.course-grid, .tool-grid, .duo { display: grid; gap: 18px; }
.course-grid, .duo { grid-template-columns: 1fr 1fr; }
.card, .lesson {
  background: var(--card);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid transparent;
  box-shadow: 0 1px 0 rgba(33, 22, 94, 0.04);
}
.tool { padding: 24px; }
.card h3, .panel h2 { font-size: 26px; }
.card p, .panel p { color: var(--muted); margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chips span, .tag-quiet {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #efeaf8;
  color: var(--indigo);
}
.card .btn, .panel .btn { margin-top: 18px; }

.page-hero {
  position: relative;
  min-height: 320px;
  display: flex;
  align-items: flex-end;
  color: white;
  overflow: hidden;
  background: #1a1238;
}
.page-hero .bg {
  position: absolute;
  inset: -20% 0;
  background: var(--hero) var(--hero-pos, center) / cover no-repeat;
}
.page-hero-clip-x .bg {
  inset: 0;
  background-size: auto 100%;
  background-position: center center;
  background-repeat: no-repeat;
}
.page-hero-clip-y .bg {
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--hero) var(--hero-pos, center 72%) / 100% auto no-repeat;
}
.page-hero-banner {
  min-height: 0;
  aspect-ratio: 2268 / 413;
}
.page-hero-banner .bg {
  inset: 0;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  transform: none !important;
}
.page-hero-banner.page-hero-clip-x .bg {
  background-size: auto 100%;
  background-position: center center;
}
.page-hero-banner.page-hero-clip-y .bg {
  background-size: 100% auto;
  background-position: var(--hero-pos, center 72%);
}
.page-hero-banner.page-hero-confucius .bg {
  background-size: cover;
  background-position: top center;
}
.page-hero-confucius .bg {
  inset: 0;
  background-size: cover;
  background-position: top center;
  transform: none !important;
}
.page-hero-banner .container {
  padding: 28px 0 22px;
}
.page-hero-banner h1 {
  font-size: clamp(30px, 3.8vw, 44px);
}
.page-hero-banner .hero-quiet {
  bottom: 22px;
}
.page-hero .bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(18, 10, 52, 0.62), rgba(18, 10, 52, 0.24) 72%, rgba(18, 10, 52, 0.12));
}
.page-hero .container { position: relative; z-index: 1; padding: 54px 0 36px; }
.hero-quiet {
  position: absolute;
  right: 0;
  bottom: 36px;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.hero-quiet:hover {
  color: white;
  border-color: white;
  background: rgba(255, 255, 255, 0.08);
}
.page-hero h1 { font-size: clamp(36px, 5vw, 56px); color: white; margin: 8px 0; }
.page-hero .lead { color: rgba(255, 255, 255, 0.9); max-width: 40em; }
.crumb { font-size: 13px; color: rgba(255, 255, 255, 0.8); }
.crumb a { color: white; }
.page-hero .btn { margin-top: 18px; }
.plain-hero { padding: 42px 0 8px; }
.plain-hero h1 { font-size: clamp(36px, 5vw, 52px); color: var(--indigo); }

.tool-grid { grid-template-columns: repeat(3, 1fr); }
.tool-grid-2 { grid-template-columns: 1fr 1fr; }
@keyframes tool-flow-spin {
  to { transform: rotate(360deg); }
}
.tool {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  min-height: 236px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 0 0 1px rgba(33, 22, 94, 0.14);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.tool .tool-no,
.tool h2,
.tool p,
.tool .kicker { position: relative; z-index: 1; }
.tool-no { font-family: var(--serif); color: #9a7430; letter-spacing: 0.12em; font-size: 13px; }
.tool h2 { font-size: 22px; margin-top: 8px; }
.tool p {
  flex: 1;
  padding-right: 28px;
  margin-top: 8px;
  color: #8d879c;
  font-size: 14px;
  line-height: 1.65;
}
.tool .kicker {
  margin: 0;
  color: #9a7430;
  font-size: 13px;
  letter-spacing: 0.16em;
}
.tool-flow {
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
}
.tool-flow-spin {
  position: absolute;
  inset: -55%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 12deg,
    rgba(33, 22, 94, 0) 18deg,
    rgba(33, 22, 94, 0.35) 30deg,
    #21165e 40deg,
    #21165e 78deg,
    rgba(33, 22, 94, 0.35) 88deg,
    rgba(33, 22, 94, 0) 100deg,
    transparent 108deg,
    transparent 192deg,
    rgba(33, 22, 94, 0) 198deg,
    rgba(33, 22, 94, 0.35) 210deg,
    #21165e 220deg,
    #21165e 258deg,
    rgba(33, 22, 94, 0.35) 268deg,
    rgba(33, 22, 94, 0) 280deg,
    transparent 288deg,
    transparent 360deg
  );
}
.tool-mark {
  position: absolute;
  z-index: 0;
  right: -18px;
  bottom: -34px;
  width: 168px;
  height: 168px;
  color: rgba(33, 22, 94, 0.1);
  pointer-events: none;
  user-select: none;
  transform: rotate(0deg) scale(1);
  transform-origin: 88% 88%;
  transition: transform 0.4s var(--ease), color 0.35s var(--ease);
}
.tool .tool-go,
.tool > .btn {
  position: absolute;
  z-index: 3;
  top: 22px;
  right: 22px;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 1.5px solid var(--indigo);
  border-radius: 999px;
  background: #fff;
  color: var(--indigo);
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  box-shadow: none;
  transform: translateY(0);
  transition:
    background 0.2s var(--ease),
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.25s var(--ease),
    transform 0.25s var(--ease);
}
.tool:hover,
.tool:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 22px 48px rgba(33, 22, 94, 0.16);
}
.tool:hover .tool-flow,
.tool:focus-visible .tool-flow { opacity: 1; }
.tool:hover .tool-flow-spin,
.tool:focus-visible .tool-flow-spin {
  animation: tool-flow-spin 2.4s linear infinite;
}
.tool:hover .tool-mark,
.tool:focus-visible .tool-mark {
  color: rgba(33, 22, 94, 0.16);
  transform: rotate(-14deg) scale(1.08);
}
.tool:hover .tool-go,
.tool:focus-visible .tool-go,
.tool:hover > .btn,
.tool:focus-visible > .btn {
  background: var(--indigo);
  color: #fff;
  border-color: var(--indigo);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(33, 22, 94, 0.28);
}
.tool .chips {
  position: relative;
  z-index: 1;
  margin-top: 12px;
}

.panel {
  background: var(--card);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 18px; }
.kg-section { padding-top: 72px; }
.kg {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 36px 72px;
  align-items: center;
}
.kg-copy h2 { font-size: clamp(32px, 3.2vw, 46px); }
.kg-copy > p { margin-top: 14px; color: var(--muted); max-width: 22em; }
.kg-legend {
  list-style: none;
  margin: 28px 0 0;
  padding: 4px 0 4px 2px;
}
.kg-legend li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 36px;
  color: var(--indigo);
  font-size: 15px;
  letter-spacing: 0.12em;
}
.kg-legend li::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--indigo);
  box-shadow: 0 0 0 4px rgba(33, 22, 94, 0.08);
  flex: none;
}
.kg-legend li:nth-child(2)::before,
.kg-legend li:nth-child(4)::before { background: var(--gold); }
.kg-legend li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 24px;
  width: 1px;
  height: 14px;
  background: rgba(215, 164, 65, 0.7);
}
.kg-copy .btn { margin-top: 28px; }
.kg-stage {
  margin: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.kg-stage img {
  width: 100%;
  height: auto;
  border-radius: 22px;
  box-shadow: 0 28px 60px rgba(33, 22, 94, 0.14);
}
.kg-stage figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.16em;
}
.tabs { margin-top: 8px; }
.tablist { display: flex; gap: 8px; margin: 8px 0 18px; }
.tablist button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}
.tablist button[aria-selected="true"] {
  background: var(--indigo);
  color: white;
  border-color: var(--indigo);
}
.lesson {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s var(--ease), border-color 0.2s;
}
.lesson:hover { transform: translateX(4px); border-color: rgba(33, 22, 94, 0.16); }
.lesson span { color: var(--indigo); font-weight: 600; white-space: nowrap; }

.site-footer {
  margin-top: 20px;
  background: var(--card);
  border-top: 3px solid var(--indigo);
  padding: 48px 0 20px;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.footer-brand img { width: 54px; height: 54px; }
.footer-brand strong { font-family: var(--serif); font-size: 18px; color: var(--indigo); }
.site-footer h2 { font-size: 16px; font-family: var(--sans); letter-spacing: 0.08em; margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.footer-grid > div:nth-child(2) ul {
  display: grid;
  grid-template-columns: max-content max-content;
  grid-template-rows: repeat(4, auto);
  grid-auto-flow: column;
  justify-content: start;
  column-gap: 36px;
}
.site-footer li { margin: 6px 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--indigo); }
.legal {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.totop {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--indigo);
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 30;
}
.totop[hidden] { display: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.js .hero-copy > * { animation: rise 0.8s var(--ease) both; }
.js .hero-copy > *:nth-child(1) { animation-delay: 0.05s; }
.js .hero-copy > *:nth-child(2) { animation-delay: 0.12s; }
.js .hero-copy > *:nth-child(3) { animation-delay: 0.18s; }
.js .hero-copy > *:nth-child(4) { animation-delay: 0.26s; }
.js .hero-copy > *:nth-child(5) { animation-delay: 0.34s; }
.js .stats li { animation: rise 0.85s var(--ease) both; }
.js .stats li:nth-child(1) { animation-delay: 0.18s; }
.js .stats li:nth-child(2) { animation-delay: 0.26s; }
.js .stats li:nth-child(3) { animation-delay: 0.34s; }
.js .stats li:nth-child(4) { animation-delay: 0.42s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal-group .reveal:nth-child(2) { transition-delay: 0.06s; }
.js .reveal-group .reveal:nth-child(3) { transition-delay: 0.12s; }
.js .reveal-group .reveal:nth-child(4) { transition-delay: 0.18s; }
.js .reveal-group .reveal:nth-child(5) { transition-delay: 0.24s; }
.js .reveal-group .reveal:nth-child(6) { transition-delay: 0.3s; }
.js .reveal-group .reveal:nth-child(7) { transition-delay: 0.36s; }
.js .meter-fill { transform: scaleX(0); }
.js .meters.in .meter-fill { transform: scaleX(1); transition: transform 1.05s var(--ease); }
.js .meters.in .meter:nth-child(2) .meter-fill { transition-delay: 0.08s; }
.js .meters.in .meter:nth-child(3) .meter-fill { transition-delay: 0.16s; }
.js .meters.in .meter:nth-child(4) .meter-fill { transition-delay: 0.24s; }
.js .meters.in .meter:nth-child(5) .meter-fill { transition-delay: 0.32s; }
.js .meters.in .meter:nth-child(6) .meter-fill { transition-delay: 0.4s; }

@media (max-width: 980px) {
  .nav-toggle { display: grid; }
  .nav {
    position: fixed;
    z-index: 45;
    inset: var(--header-h) 0 0 0;
    background: var(--card);
    flex-direction: column;
    align-items: stretch;
    padding: 12px 20px 28px;
    gap: 0;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
  }
  .nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav a {
    color: var(--indigo);
    font-size: 18px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }
  .nav a[aria-current="page"]::after { display: none; }
  .nav a[aria-current="page"] { color: #9a7430; }
  .gate-grid, .split, .course-grid, .duo, .tool-grid, .footer-grid { grid-template-columns: 1fr 1fr; }
  #about .split { grid-template-columns: 1fr; }
  .kg { grid-template-columns: 1fr; gap: 28px; }
  .kg-legend { display: flex; flex-wrap: wrap; gap: 4px 22px; padding-left: 0; }
  .kg-legend li:not(:last-child)::after { display: none; }
  #modules .section-head { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats li, .stats li:nth-child(2), .stats li:nth-child(3), .stats li:nth-child(4) { margin-top: 0; }
  .about-visual { min-height: 0; padding-bottom: 24px; }
  .frame-main img { height: 320px; }
  .frame-sub { width: 42%; }
  .frame-sub img { height: 160px; }
}
@media (max-width: 900px) {
  .page-hero:has(.hero-quiet) .lead { padding-bottom: 48px; }
  .hero-quiet { bottom: 16px; }
}
@media (max-width: 720px) {
  .container { width: min(1180px, calc(100% - 32px)); }
  .section { padding: 64px 0; }
  .hero { min-height: 0; padding: 28px 0 22px; gap: 28px; }
  .page-hero-banner { min-height: 220px; aspect-ratio: auto; }
  .page-hero-banner .bg { background-size: cover; }
  .hero h1 { font-size: 34px; }
  .gate-grid, .split, .course-grid, .duo, .tool-grid, .footer-grid { grid-template-columns: 1fr; }
  .meter { grid-template-columns: 1fr auto; }
  .meter-track { grid-column: 1 / -1; }
  .stats { grid-template-columns: 1fr 1fr; }
  .frame-sub { width: 56%; }
  .lesson { flex-direction: column; align-items: flex-start; }
  .header-inner { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .reveal, .js .meter-fill { opacity: 1; transform: none; }
}
