.k-course-page {
  max-width: 980px;
  margin: 0 auto;
}

.k-section + .k-section {
  margin-top: 22px;
}

.k-section h1,
.k-section h2 {
  margin: 0 0 12px;
  line-height: 1.25;
}

.k-card {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
}

.k-card > :first-child {
  margin-top: 0;
}

.k-card > :last-child {
  margin-bottom: 0;
}

.k-meta-list,
.k-module-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.k-meta-list li + li,
.k-module-list li + li {
  margin-top: 8px;
}

.k-module-list a {
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.28);
}

.k-module-list a:hover {
  border-bottom-color: rgba(255, 255, 255, 0.55);
}

.k-aside-panel .aside-list a {
  font-size: 14px;
}

.k-aside-toggle {
  margin: 0;
  position: relative;
}

.k-aside-summary {
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  padding: 4px 0 4px 16px;
  position: relative;
  margin: 0;
}

.k-aside-summary::-webkit-details-marker {
  display: none;
}

.k-aside-summary::before {
  content: "+";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
}

.k-aside-toggle[open] > .k-aside-summary::before {
  content: "-";
}

.k-aside-link-wrap {
  margin: 2px 0 6px 16px;
}

.k-aside-chapter > a,
.k-aside-sections > li > a {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  padding: 4px 0 4px 16px;
}

.k-aside-tree,
.k-aside-sections {
  list-style: none;
  margin: 0;
  padding: 0;
}

.k-aside-tree {
  padding-left: 6px;
}

.k-aside-chapter + .k-aside-chapter {
  margin-top: 8px;
}

.k-aside-sections {
  margin-top: 6px;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.k-aside-sections li + li {
  margin-top: 4px;
}

.site-float-aside-right {
  display: none;
}

.k-entry-body .admonition .admonition-icon {
  display: none;
}

.k-entry-body .admonition-title {
  font-weight: 700;
}

.k-entry-body .admonition {
  border-left: 3px solid transparent;
  background: rgba(255, 255, 255, 0.02);
}


.k-entry-body .admonition-definition .admonition-title {
  color: #8ec5ff;
}
.k-entry-body .admonition-definition {
  border-left-color: #8ec5ff;
  background: rgba(142, 197, 255, 0.10);
}

.k-entry-body .admonition-note .admonition-title {
  color: #9dc1ff;
}
.k-entry-body .admonition-note {
  border-left-color: #9dc1ff;
  background: rgba(157, 193, 255, 0.08);
}

.k-entry-body .admonition-tip .admonition-title {
  color: #7de3b1;
}
.k-entry-body .admonition-tip {
  border-left-color: #7de3b1;
  background: rgba(125, 227, 177, 0.08);
}

.k-entry-body .admonition-abstract .admonition-title {
  color: #f4d68c;
}
.k-entry-body .admonition-abstract {
  border-left-color: #f4d68c;
  background: rgba(244, 214, 140, 0.1);
}

.k-entry-body .admonition-example .admonition-title {
  color: #f3a0c0;
}
.k-entry-body .admonition-example {
  border-left-color: #f3a0c0;
  background: rgba(243, 160, 192, 0.08);
}

.k-entry-body .admonition-question .admonition-title {
  color: #ffd27f;
}
.k-entry-body .admonition-question {
  border-left-color: #ffd27f;
  background: rgba(255, 210, 127, 0.1);
}

.k-entry-body .admonition-info .admonition-title {
  color: #8ed8f8;
}
.k-entry-body .admonition-info {
  border-left-color: #8ed8f8;
  background: rgba(142, 216, 248, 0.08);
}

/* ===== Math Root / Index Redesign ===== */
.math-root-page,
.k-index-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 4px 8px;
}

.math-root-hero,
.k-index-hero {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 22px 24px;
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(79, 133, 255, 0.18), transparent 56%),
    radial-gradient(100% 120% at 100% 100%, rgba(37, 214, 166, 0.14), transparent 60%),
    linear-gradient(165deg, rgba(12, 18, 34, 0.92), rgba(20, 26, 44, 0.82));
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.math-root-kicker,
.k-index-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(223, 236, 255, 0.82);
}

.math-root-hero h1,
.k-index-hero h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #eaf3ff;
}

.math-root-desc,
.k-index-desc,
.math-root-intro p,
.k-index-intro p {
  margin: 12px 0 0;
  max-width: 840px;
  color: rgba(220, 233, 255, 0.9);
  line-height: 1.7;
  font-size: 15px;
}

.math-root-grid,
.k-index-grid {
  margin-top: 18px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.math-root-card,
.k-index-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(6px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.math-root-card:hover,
.k-index-card:hover {
  transform: translateY(-3px);
  border-color: rgba(166, 203, 255, 0.48);
  box-shadow: 0 14px 30px rgba(5, 10, 24, 0.36);
}

.math-root-card.is-course { border-top: 3px solid rgba(142, 197, 255, 0.85); }
.math-root-card.is-competition { border-top: 3px solid rgba(129, 231, 181, 0.84); }
.math-root-card.is-tools { border-top: 3px solid rgba(255, 205, 128, 0.88); }

.math-root-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.math-root-card h2,
.k-index-card h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.math-root-card h2 a,
.k-index-card h2 a {
  text-decoration: none;
  color: #eff6ff;
}

.math-root-card h2 a:hover,
.k-index-card h2 a:hover { color: #9fd4ff; }

.math-root-count,
.k-index-meta {
  font-size: 12px;
  color: rgba(220, 232, 250, 0.78);
  white-space: nowrap;
}

.math-root-summary,
.k-index-summary {
  margin: 10px 0 0;
  line-height: 1.65;
  color: rgba(219, 230, 248, 0.88);
  font-size: 14px;
}

.math-root-links {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 6px;
}

.math-root-links a {
  text-decoration: none;
  color: #dceaff;
  font-size: 14px;
  border-bottom: 1px dashed rgba(200, 220, 255, 0.26);
}

.math-root-links a:hover { border-bottom-color: rgba(170, 210, 255, 0.75); }
.math-root-links .is-empty { color: rgba(212, 224, 245, 0.64); font-size: 13px; }

.math-root-cta,
.k-index-link {
  margin-top: auto;
  align-self: flex-start;
  text-decoration: none;
  color: #f2f7ff;
  border: 1px solid rgba(171, 204, 249, 0.45);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  background: rgba(154, 191, 255, 0.1);
}

.math-root-cta:hover,
.k-index-link:hover { background: rgba(154, 191, 255, 0.22); }

@media (max-width: 1180px) {
  .math-root-grid,
  .k-index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .math-root-page,
  .k-index-shell { padding-left: 0; padding-right: 0; }

  .math-root-hero,
  .k-index-hero { border-radius: 14px; padding: 18px 16px; }

  .math-root-grid,
  .k-index-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .math-root-card,
  .k-index-card { min-height: unset; }
}

/* ===== Light Theme: Darker Admonition Titles ===== */
:root[data-theme='light'] .k-entry-body .admonition-definition .admonition-title { color: #1f5f9f; }
:root[data-theme='light'] .k-entry-body .admonition-note .admonition-title { color: #2a56a8; }
:root[data-theme='light'] .k-entry-body .admonition-tip .admonition-title { color: #1f7a54; }
:root[data-theme='light'] .k-entry-body .admonition-abstract .admonition-title { color: #8a5f11; }
:root[data-theme='light'] .k-entry-body .admonition-example .admonition-title { color: #9a4264; }
:root[data-theme='light'] .k-entry-body .admonition-question .admonition-title { color: #8b5a08; }
:root[data-theme='light'] .k-entry-body .admonition-info .admonition-title { color: #1f6e8a; }

/* Fallback for light OS theme when no manual theme selected */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .k-entry-body .admonition-definition .admonition-title { color: #1f5f9f; }
  :root:not([data-theme='dark']) .k-entry-body .admonition-note .admonition-title { color: #2a56a8; }
  :root:not([data-theme='dark']) .k-entry-body .admonition-tip .admonition-title { color: #1f7a54; }
  :root:not([data-theme='dark']) .k-entry-body .admonition-abstract .admonition-title { color: #8a5f11; }
  :root:not([data-theme='dark']) .k-entry-body .admonition-example .admonition-title { color: #9a4264; }
  :root:not([data-theme='dark']) .k-entry-body .admonition-question .admonition-title { color: #8b5a08; }
  :root:not([data-theme='dark']) .k-entry-body .admonition-info .admonition-title { color: #1f6e8a; }
}


:root[data-theme='light'] .k-aside-summary::before {
  color: rgba(30, 41, 59, 0.78);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .k-aside-summary::before {
    color: rgba(30, 41, 59, 0.78);
  }
}


/* ===== Index Pagination ===== */
.k-pagination {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.k-page-btn,
.k-page-num {
  text-decoration: none;
  border: 1px solid rgba(176, 205, 246, 0.38);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 13px;
  color: #e7f2ff;
  background: rgba(155, 190, 241, 0.10);
}

.k-page-num {
  min-width: 34px;
  text-align: center;
}

.k-page-num.is-active {
  background: rgba(152, 200, 255, 0.28);
  border-color: rgba(152, 200, 255, 0.75);
  font-weight: 700;
}

.k-page-btn.is-disabled {
  opacity: 0.45;
}

/* ===== Light Theme: Root/Index Cards ===== */
:root[data-theme='light'] .math-root-hero,
:root[data-theme='light'] .k-index-hero {
  border-color: rgba(56, 80, 122, 0.24);
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(74, 142, 255, 0.20), transparent 58%),
    radial-gradient(100% 120% at 100% 100%, rgba(30, 168, 146, 0.16), transparent 64%),
    linear-gradient(165deg, rgba(231, 240, 253, 0.96), rgba(214, 229, 247, 0.92));
  box-shadow: 0 10px 26px rgba(69, 92, 127, 0.14);
}

:root[data-theme='light'] .math-root-kicker,
:root[data-theme='light'] .k-index-kicker { color: rgba(32, 60, 95, 0.85); }

:root[data-theme='light'] .math-root-hero h1,
:root[data-theme='light'] .k-index-hero h1 { color: #123055; }

:root[data-theme='light'] .math-root-desc,
:root[data-theme='light'] .k-index-desc,
:root[data-theme='light'] .math-root-intro p,
:root[data-theme='light'] .k-index-intro p { color: rgba(26, 46, 78, 0.90); }

:root[data-theme='light'] .math-root-card,
:root[data-theme='light'] .k-index-card {
  border-color: rgba(64, 90, 134, 0.20);
  background: linear-gradient(170deg, rgba(249, 252, 255, 0.95), rgba(235, 243, 252, 0.93));
  box-shadow: 0 8px 20px rgba(84, 107, 142, 0.10);
}

:root[data-theme='light'] .math-root-card.is-course {
  border-top-color: rgba(60, 137, 255, 0.88);
  background: linear-gradient(170deg, rgba(239, 247, 255, 0.96), rgba(225, 239, 255, 0.94));
}

:root[data-theme='light'] .math-root-card.is-competition {
  border-top-color: rgba(46, 191, 128, 0.86);
  background: linear-gradient(170deg, rgba(237, 252, 244, 0.96), rgba(220, 246, 233, 0.94));
}

:root[data-theme='light'] .math-root-card.is-tools {
  border-top-color: rgba(231, 155, 39, 0.88);
  background: linear-gradient(170deg, rgba(255, 248, 235, 0.97), rgba(255, 239, 214, 0.95));
}

:root[data-theme='light'] .math-root-card h2 a,
:root[data-theme='light'] .k-index-card h2 a { color: #17365e; }

:root[data-theme='light'] .math-root-summary,
:root[data-theme='light'] .k-index-summary { color: rgba(35, 58, 89, 0.84); }

:root[data-theme='light'] .math-root-count,
:root[data-theme='light'] .k-index-meta { color: rgba(44, 67, 98, 0.74); }

:root[data-theme='light'] .math-root-links a {
  color: #2e557f;
  border-bottom-color: rgba(87, 119, 169, 0.35);
}

:root[data-theme='light'] .math-root-cta,
:root[data-theme='light'] .k-index-link,
:root[data-theme='light'] .k-page-btn,
:root[data-theme='light'] .k-page-num {
  color: #214c79;
  border-color: rgba(83, 124, 179, 0.42);
  background: rgba(88, 140, 206, 0.12);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) .math-root-card,
  :root:not([data-theme='dark']) .k-index-card {
    border-color: rgba(64, 90, 134, 0.20);
    background: linear-gradient(170deg, rgba(249, 252, 255, 0.95), rgba(235, 243, 252, 0.93));
  }
}

/* ===== 2026-02-11: Root/Index Card Palette Tuning ===== */
.math-root-card.is-course {
  border-top-color: rgba(123, 190, 255, 0.92);
  background:
    linear-gradient(165deg, rgba(36, 55, 96, 0.58), rgba(25, 39, 72, 0.48)),
    radial-gradient(120% 120% at 0% 0%, rgba(77, 156, 255, 0.18), transparent 62%);
}

.math-root-card.is-competition {
  border-top-color: rgba(118, 228, 180, 0.92);
  background:
    linear-gradient(165deg, rgba(31, 78, 70, 0.54), rgba(23, 55, 50, 0.44)),
    radial-gradient(120% 120% at 0% 0%, rgba(74, 210, 158, 0.15), transparent 62%);
}

.math-root-card.is-tools {
  border-top-color: rgba(255, 200, 114, 0.94);
  background:
    linear-gradient(165deg, rgba(95, 63, 26, 0.52), rgba(72, 45, 20, 0.42)),
    radial-gradient(120% 120% at 0% 0%, rgba(255, 184, 90, 0.14), transparent 64%);
}

:root[data-theme= light] .math-root-card,
:root[data-theme=light] .k-index-card {
  border-color: rgba(54, 86, 132, 0.22);
  box-shadow: 0 10px 24px rgba(66, 88, 122, 0.12);
}

:root[data-theme=light] .math-root-card.is-course {
  border-top-color: rgba(50, 125, 232, 0.95);
  background:
    linear-gradient(165deg, rgba(228, 240, 255, 0.98), rgba(210, 229, 252, 0.96)),
    radial-gradient(120% 120% at 0% 0%, rgba(106, 166, 255, 0.20), transparent 62%);
}

:root[data-theme=light] .math-root-card.is-competition {
  border-top-color: rgba(34, 160, 106, 0.94);
  background:
    linear-gradient(165deg, rgba(227, 248, 239, 0.98), rgba(209, 239, 224, 0.96)),
    radial-gradient(120% 120% at 0% 0%, rgba(92, 204, 146, 0.17), transparent 62%);
}

:root[data-theme=light] .math-root-card.is-tools {
  border-top-color: rgba(216, 136, 20, 0.95);
  background:
    linear-gradient(165deg, rgba(255, 244, 224, 0.98), rgba(252, 232, 197, 0.96)),
    radial-gradient(120% 120% at 0% 0%, rgba(250, 185, 79, 0.19), transparent 62%);
}

:root[data-theme=light] .math-root-card h2 a,
:root[data-theme=light] .k-index-card h2 a {
  color: #15355d;
}

:root[data-theme=light] .math-root-summary,
:root[data-theme=light] .k-index-summary {
  color: rgba(23, 46, 80, 0.92);
}

:root[data-theme=light] .math-root-links a {
  color: #234f83;
  border-bottom-color: rgba(63, 101, 156, 0.42);
}

:root[data-theme=light] .math-root-links a:hover {
  border-bottom-color: rgba(36, 86, 153, 0.72);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme=dark]) .math-root-card.is-course {
    border-top-color: rgba(50, 125, 232, 0.95);
    background:
      linear-gradient(165deg, rgba(228, 240, 255, 0.98), rgba(210, 229, 252, 0.96)),
      radial-gradient(120% 120% at 0% 0%, rgba(106, 166, 255, 0.20), transparent 62%);
  }

  :root:not([data-theme=dark]) .math-root-card.is-competition {
    border-top-color: rgba(34, 160, 106, 0.94);
    background:
      linear-gradient(165deg, rgba(227, 248, 239, 0.98), rgba(209, 239, 224, 0.96)),
      radial-gradient(120% 120% at 0% 0%, rgba(92, 204, 146, 0.17), transparent 62%);
  }

  :root:not([data-theme=dark]) .math-root-card.is-tools {
    border-top-color: rgba(216, 136, 20, 0.95);
    background:
      linear-gradient(165deg, rgba(255, 244, 224, 0.98), rgba(252, 232, 197, 0.96)),
      radial-gradient(120% 120% at 0% 0%, rgba(250, 185, 79, 0.19), transparent 62%);
  }
}

/* ===== 2026-02-11: Math Root Visual Harmonization (Dark) ===== */
:root[data-theme='dark'] .math-root-page {
  position: relative;
}

:root[data-theme='dark'] .math-root-page::before {
  content: "";
  position: absolute;
  inset: -6px -8px -8px -8px;
  z-index: -1;
  pointer-events: none;
  border-radius: 20px;
  background:
    radial-gradient(120% 120% at 12% 0%, rgba(78, 155, 255, 0.10), transparent 56%),
    radial-gradient(120% 120% at 88% 100%, rgba(62, 195, 161, 0.08), transparent 58%);
}

:root[data-theme='dark'] .math-root-hero {
  border-color: rgba(106, 154, 214, 0.30);
  background:
    radial-gradient(110% 125% at 0% 0%, rgba(86, 150, 255, 0.20), transparent 56%),
    radial-gradient(110% 120% at 100% 100%, rgba(57, 188, 160, 0.14), transparent 62%),
    linear-gradient(166deg, rgba(12, 21, 40, 0.90), rgba(18, 29, 52, 0.82));
  box-shadow: 0 18px 38px rgba(3, 10, 24, 0.34);
}

:root[data-theme='dark'] .math-root-kicker {
  color: rgba(199, 222, 252, 0.90);
}

:root[data-theme='dark'] .math-root-desc,
:root[data-theme='dark'] .math-root-intro p {
  color: rgba(216, 231, 251, 0.90);
}

:root[data-theme='dark'] .math-root-grid {
  gap: 16px;
}

:root[data-theme='dark'] .math-root-card {
  border: 1px solid rgba(109, 146, 195, 0.28);
  background:
    linear-gradient(165deg, rgba(20, 32, 56, 0.66), rgba(17, 27, 47, 0.56));
  box-shadow: 0 10px 24px rgba(2, 9, 23, 0.26);
}

:root[data-theme='dark'] .math-root-card:hover {
  transform: translateY(-3px);
  border-color: rgba(140, 181, 233, 0.50);
  box-shadow: 0 16px 32px rgba(2, 9, 24, 0.34);
}

:root[data-theme='dark'] .math-root-card.is-course {
  border-top-color: rgba(120, 188, 255, 0.90);
  background:
    linear-gradient(165deg, rgba(26, 43, 74, 0.70), rgba(22, 35, 62, 0.60)),
    radial-gradient(115% 115% at 0% 0%, rgba(84, 155, 255, 0.16), transparent 64%);
}

:root[data-theme='dark'] .math-root-card.is-competition {
  border-top-color: rgba(118, 223, 188, 0.90);
  background:
    linear-gradient(165deg, rgba(22, 57, 59, 0.68), rgba(18, 46, 47, 0.58)),
    radial-gradient(115% 115% at 0% 0%, rgba(77, 203, 166, 0.14), transparent 64%);
}

:root[data-theme='dark'] .math-root-card.is-tools {
  border-top-color: rgba(241, 188, 108, 0.92);
  background:
    linear-gradient(165deg, rgba(70, 54, 32, 0.66), rgba(56, 42, 27, 0.56)),
    radial-gradient(120% 120% at 0% 0%, rgba(239, 176, 85, 0.13), transparent 64%);
}

:root[data-theme='dark'] .math-root-card h2 a {
  color: #edf6ff;
}

:root[data-theme='dark'] .math-root-summary {
  color: rgba(209, 224, 244, 0.88);
}

:root[data-theme='dark'] .math-root-count {
  color: rgba(190, 210, 235, 0.78);
}

:root[data-theme='dark'] .math-root-links a {
  color: #d8e9ff;
  border-bottom-color: rgba(168, 198, 237, 0.36);
}

:root[data-theme='dark'] .math-root-links a:hover {
  border-bottom-color: rgba(186, 218, 255, 0.68);
}

:root[data-theme='dark'] .math-root-cta {
  color: #e9f4ff;
  border-color: rgba(161, 196, 241, 0.52);
  background: rgba(126, 167, 227, 0.16);
}

:root[data-theme='dark'] .math-root-cta:hover {
  background: rgba(137, 177, 238, 0.24);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .math-root-hero {
    border-color: rgba(106, 154, 214, 0.30);
    background:
      radial-gradient(110% 125% at 0% 0%, rgba(86, 150, 255, 0.20), transparent 56%),
      radial-gradient(110% 120% at 100% 100%, rgba(57, 188, 160, 0.14), transparent 62%),
      linear-gradient(166deg, rgba(12, 21, 40, 0.90), rgba(18, 29, 52, 0.82));
  }
}

/* ===== 2026-02-11: Subdomain Signature Palettes ===== */
body.theme-math .math-root-kicker,
body.theme-math .k-index-kicker {
  color: rgba(188, 228, 240, 0.88);
}

body.theme-math .math-root-card h2 a,
body.theme-math .k-index-card h2 a {
  color: #edf8ff;
}

/* algo: contest / speed / contrast */
body.theme-algo .math-root-hero,
body.theme-algo .k-index-hero {
  border-color: rgba(148, 163, 255, 0.32);
  background:
    radial-gradient(112% 128% at 0% 0%, rgba(117, 132, 255, 0.21), transparent 56%),
    radial-gradient(110% 122% at 100% 100%, rgba(243, 166, 84, 0.12), transparent 60%),
    linear-gradient(164deg, rgba(18, 21, 49, 0.92), rgba(29, 22, 58, 0.83));
}

body.theme-algo .math-root-kicker,
body.theme-algo .k-index-kicker {
  color: rgba(207, 216, 255, 0.88);
}

body.theme-algo .math-root-hero h1,
body.theme-algo .k-index-hero h1 {
  color: #f0f3ff;
}

body.theme-algo .math-root-card,
body.theme-algo .k-index-card {
  border-color: rgba(136, 152, 236, 0.30);
  background: linear-gradient(164deg, rgba(29, 35, 72, 0.66), rgba(24, 30, 60, 0.56));
  box-shadow: 0 10px 22px rgba(8, 10, 28, 0.30);
}

body.theme-algo .math-root-card:nth-child(3n+1),
body.theme-algo .k-index-card:nth-child(3n+1) {
  border-top: 3px solid rgba(151, 171, 255, 0.88);
}

body.theme-algo .math-root-card:nth-child(3n+2),
body.theme-algo .k-index-card:nth-child(3n+2) {
  border-top: 3px solid rgba(124, 216, 255, 0.84);
}

body.theme-algo .math-root-card:nth-child(3n),
body.theme-algo .k-index-card:nth-child(3n) {
  border-top: 3px solid rgba(245, 180, 108, 0.86);
}

body.theme-algo .math-root-card h2 a,
body.theme-algo .k-index-card h2 a {
  color: #eef2ff;
}

body.theme-algo .math-root-summary,
body.theme-algo .k-index-summary {
  color: rgba(214, 221, 246, 0.88);
}

body.theme-algo .math-root-links a {
  color: #dbe6ff;
  border-bottom-color: rgba(169, 187, 248, 0.35);
}

body.theme-algo .math-root-cta,
body.theme-algo .k-index-link,
body.theme-algo .k-page-btn,
body.theme-algo .k-page-num {
  color: #ecf1ff;
  border-color: rgba(157, 175, 249, 0.54);
  background: rgba(126, 143, 234, 0.16);
}

/* ai: research / futuristic / clear */
body.theme-ai .math-root-hero,
body.theme-ai .k-index-hero {
  border-color: rgba(124, 176, 255, 0.34);
  background:
    radial-gradient(112% 128% at 0% 0%, rgba(83, 161, 255, 0.23), transparent 56%),
    radial-gradient(110% 122% at 100% 100%, rgba(120, 114, 255, 0.12), transparent 60%),
    linear-gradient(164deg, rgba(14, 24, 52, 0.92), rgba(25, 21, 58, 0.83));
}

body.theme-ai .math-root-kicker,
body.theme-ai .k-index-kicker {
  color: rgba(205, 229, 255, 0.88);
}

body.theme-ai .math-root-hero h1,
body.theme-ai .k-index-hero h1 {
  color: #eff6ff;
}

body.theme-ai .math-root-card,
body.theme-ai .k-index-card {
  border-color: rgba(124, 170, 244, 0.30);
  background: linear-gradient(164deg, rgba(29, 45, 82, 0.66), rgba(24, 34, 66, 0.56));
  box-shadow: 0 10px 24px rgba(5, 13, 33, 0.30);
}

body.theme-ai .math-root-card:nth-child(3n+1),
body.theme-ai .k-index-card:nth-child(3n+1) {
  border-top: 3px solid rgba(123, 196, 255, 0.88);
}

body.theme-ai .math-root-card:nth-child(3n+2),
body.theme-ai .k-index-card:nth-child(3n+2) {
  border-top: 3px solid rgba(135, 183, 255, 0.86);
}

body.theme-ai .math-root-card:nth-child(3n),
body.theme-ai .k-index-card:nth-child(3n) {
  border-top: 3px solid rgba(157, 146, 255, 0.84);
}

body.theme-ai .math-root-card h2 a,
body.theme-ai .k-index-card h2 a {
  color: #edf5ff;
}

body.theme-ai .math-root-summary,
body.theme-ai .k-index-summary {
  color: rgba(212, 226, 245, 0.88);
}

body.theme-ai .math-root-links a {
  color: #d8e9ff;
  border-bottom-color: rgba(160, 192, 242, 0.35);
}

body.theme-ai .math-root-cta,
body.theme-ai .k-index-link,
body.theme-ai .k-page-btn,
body.theme-ai .k-page-num {
  color: #e9f4ff;
  border-color: rgba(144, 186, 248, 0.54);
  background: rgba(104, 151, 232, 0.17);
}

/* light-mode refinements */
:root[data-theme='light'] body.theme-algo .math-root-hero,
:root[data-theme='light'] body.theme-algo .k-index-hero {
  border-color: rgba(92, 108, 188, 0.26);
  background:
    radial-gradient(112% 128% at 0% 0%, rgba(104, 122, 238, 0.20), transparent 56%),
    radial-gradient(110% 122% at 100% 100%, rgba(236, 170, 98, 0.12), transparent 60%),
    linear-gradient(164deg, rgba(236, 239, 254, 0.96), rgba(226, 232, 252, 0.92));
}

:root[data-theme='light'] body.theme-ai .math-root-hero,
:root[data-theme='light'] body.theme-ai .k-index-hero {
  border-color: rgba(77, 130, 214, 0.26);
  background:
    radial-gradient(112% 128% at 0% 0%, rgba(92, 154, 241, 0.20), transparent 56%),
    radial-gradient(110% 122% at 100% 100%, rgba(148, 142, 247, 0.10), transparent 60%),
    linear-gradient(164deg, rgba(235, 245, 255, 0.96), rgba(224, 236, 252, 0.92));
}

:root[data-theme='light'] body.theme-algo .math-root-card,
:root[data-theme='light'] body.theme-algo .k-index-card,
:root[data-theme='light'] body.theme-ai .math-root-card,
:root[data-theme='light'] body.theme-ai .k-index-card {
  box-shadow: 0 9px 20px rgba(73, 90, 130, 0.10);
}

/* ===== 2026-02-11: Subdomain Motion + Icon Language ===== */
.math-root-card h2 a,
.k-index-card h2 a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.math-root-card h2 a::before,
.k-index-card h2 a::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 1px solid currentColor;
  opacity: 0.85;
  flex: 0 0 auto;
}

/* math: stable and rigorous */
body.theme-math .math-root-card,
body.theme-math .k-index-card {
  animation: card-fade-up-math .30s ease-out both;
}

body.theme-math .math-root-card:hover,
body.theme-math .k-index-card:hover {
  transform: translateY(-2px);
}

body.theme-math .math-root-card h2 a::before,
body.theme-math .k-index-card h2 a::before {
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(133, 201, 239, 0.24);
}

/* algo: energetic and competitive */
body.theme-algo .math-root-card,
body.theme-algo .k-index-card {
  animation: card-fade-up-algo .34s cubic-bezier(.22,.65,.2,1) both;
}

body.theme-algo .math-root-card:hover,
body.theme-algo .k-index-card:hover {
  transform: translateY(-4px) rotate(-0.15deg);
}

body.theme-algo .math-root-card h2 a::before,
body.theme-algo .k-index-card h2 a::before {
  border-radius: 2px;
  transform: rotate(45deg);
  width: 11px;
  height: 11px;
  box-shadow: 0 0 0 2px rgba(158, 173, 255, 0.18);
}

/* ai: lightweight and futuristic */
body.theme-ai .math-root-card,
body.theme-ai .k-index-card {
  animation: card-fade-up-ai .36s ease-out both;
}

body.theme-ai .math-root-card:hover,
body.theme-ai .k-index-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(46, 120, 206, 0.22);
}

body.theme-ai .math-root-card h2 a::before,
body.theme-ai .k-index-card h2 a::before {
  border-radius: 999px;
  border-color: rgba(156, 209, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(112, 172, 246, 0.18);
}

/* stagger */
.math-root-grid > .math-root-card:nth-child(1),
.k-index-grid > .k-index-card:nth-child(1) { animation-delay: .02s; }
.math-root-grid > .math-root-card:nth-child(2),
.k-index-grid > .k-index-card:nth-child(2) { animation-delay: .06s; }
.math-root-grid > .math-root-card:nth-child(3),
.k-index-grid > .k-index-card:nth-child(3) { animation-delay: .10s; }
.math-root-grid > .math-root-card:nth-child(4),
.k-index-grid > .k-index-card:nth-child(4) { animation-delay: .14s; }
.math-root-grid > .math-root-card:nth-child(5),
.k-index-grid > .k-index-card:nth-child(5) { animation-delay: .18s; }
.math-root-grid > .math-root-card:nth-child(6),
.k-index-grid > .k-index-card:nth-child(6) { animation-delay: .22s; }

@keyframes card-fade-up-math {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-fade-up-algo {
  from { opacity: 0; transform: translateY(9px) scale(0.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes card-fade-up-ai {
  from { opacity: 0; transform: translateY(8px); filter: saturate(0.9); }
  to { opacity: 1; transform: translateY(0); filter: saturate(1); }
}

@media (prefers-reduced-motion: reduce) {
  body.theme-math .math-root-card,
  body.theme-math .k-index-card,
  body.theme-algo .math-root-card,
  body.theme-algo .k-index-card,
  body.theme-ai .math-root-card,
  body.theme-ai .k-index-card {
    animation: none !important;
  }

  body.theme-math .math-root-card:hover,
  body.theme-math .k-index-card:hover,
  body.theme-algo .math-root-card:hover,
  body.theme-algo .k-index-card:hover,
  body.theme-ai .math-root-card:hover,
  body.theme-ai .k-index-card:hover {
    transform: none !important;
  }
}
