.math-demos-page,
.math-demos-page .main {
  background: linear-gradient(135deg, #eef7ff 0%, #e9f2fb 48%, #e4effa 100%);
  color: #10213f;
}

.math-demos-main {
  width: min(1350px, calc(100vw - 340px));
  min-height: 100vh;
  margin-left: max(300px, calc(260px + (100vw - 260px - 1350px) / 2));
  padding: 44px 24px 72px;
}

.math-demos-hero { position: relative; min-height: 300px; padding: 16px 8px 24px; }
.math-demos-hero__copy { --math-demos-copy-offset: clamp(2.4rem, 3.6vw, 3.4rem); position: relative; min-width: 0; padding-top: 52px; transform: translateY(-42px); }
.math-demos-hero h1 { position: relative; z-index: 1; display: inline-flex; align-items: baseline; gap: .08em; margin: 0; color: #10213f; font-size: clamp(2.55rem, 3.7vw, 3.45rem); font-weight: 800; line-height: 1.1; letter-spacing: -.025em; transform: translateX(var(--math-demos-copy-offset)); }
.math-demos-title-pi { display: inline-block; margin-right: 0; color: #f59e0b; font: inherit; font-size: 1.13em; line-height: 1; }
.math-demos-title-words { color: #10213f; font-size: .93em; line-height: 1; }
.math-demos-hero__copy > p { position: relative; z-index: 1; margin: 12px 0 0 calc(var(--math-demos-copy-offset) + 28px); color: #64748b; font-size: .92rem; line-height: 1.65; }
.math-demos-hero__ornament { position: absolute; z-index: 0; top: -48px; left: 2px; display: block; width: min(560px, calc(100% + 46px)); height: auto; margin: 0; pointer-events: none; }

.math-demos-search { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; width: min(520px, 100%); min-height: 48px; margin-top: 18px; padding: 0 15px; background: rgba(255, 255, 255, .94); border: 1px solid rgba(148, 163, 184, .18); border-radius: 999px; box-shadow: 0 4px 14px rgba(25, 45, 78, .05); }
.math-demos-search i { display: inline-grid; flex: 0 0 24px; place-items: center; width: 24px; height: 28px; color: #347cf4; font-size: 1.1rem; }
.math-demos-search input { min-width: 0; flex: 1; height: 46px; padding: 0; border: 0; outline: 0; background: transparent; color: #10213f; font: inherit; font-size: .9rem; }
.math-demos-search input::placeholder { color: #91a0b8; }
.math-demos-search button { flex: 0 0 auto; height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: #347cf4; color: #fff; cursor: pointer; font: inherit; font-size: .78rem; line-height: 1; }
.math-demos-search button:hover { background: #1d68e3; }

.math-demos-content { position: relative; z-index: 2; margin-top: -84px; }
.math-demos-toolbar { display: flex; align-items: center; justify-content: flex-start; margin-bottom: 16px; }
.math-demos-categories { display: flex; flex-wrap: wrap; gap: 8px; }
.math-demos-category { border: 1px solid #d6e5fb; border-radius: 999px; background: rgba(255, 255, 255, .55); color: #5b7090; padding: 6px 12px; font-size: .83rem; cursor: pointer; }
.math-demos-category.is-active { border-color: #317cf3; background: #317cf3; color: #fff; }

.math-demos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.math-demo-card { position: relative; display: flex; flex-direction: column; min-height: 280px; overflow: hidden; border: 1px solid rgba(105, 151, 215, .2); border-radius: 16px; background: linear-gradient(180deg, #fff 0%, #f4f8fe 100%); box-shadow: 0 10px 24px rgba(41, 81, 134, .07); cursor: pointer; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.math-demo-card:hover { transform: translateY(-4px); border-color: rgba(50, 124, 243, .34); box-shadow: 0 18px 32px rgba(41, 81, 134, .13); }
.math-demo-card-cover { position: relative; display: flex; flex: 0 0 auto; align-items: center; justify-content: center; height: 184px; overflow: hidden; background: linear-gradient(135deg, #d9edff, #eef7ff); }
.math-demo-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.math-demo-card-cover i { color: #4f8df4; font-size: 2.4rem; }
.math-demo-card-cover-meta, .math-demo-card-cover-status { position: absolute; z-index: 1; top: 12px; border-radius: 999px; background: rgba(255, 255, 255, .9); box-shadow: 0 4px 10px rgba(42, 76, 124, .08); color: #70809a; font-size: .7rem; line-height: 1; }
.math-demo-card-cover-meta { left: 12px; display: inline-flex; align-items: center; gap: 4px; max-width: calc(100% - 100px); padding: 6px 9px; }
.math-demo-card-cover-category { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.math-demo-card-cover-status { right: 12px; padding: 6px 9px; border: 1px solid #ffd18d; color: #e87816; }
.math-demo-card-cover-status.is-default { border-color: #93e3b2; color: #1e9e57; }
.math-demo-card-body { display: flex; flex: 1; align-items: center; gap: 10px; padding: 10px 18px 12px; }
.math-demo-card-icon { display: inline-flex; flex: 0 0 34px; align-items: center; justify-content: center; width: 34px; height: 34px; }
.math-demo-card-icon i { color: var(--math-demo-icon-color); font-size: 1.8rem; }
.math-demo-card-copy { min-width: 0; }
.math-demo-card-title { margin: 0; overflow: hidden; color: #132947; font-size: 1.04rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.math-demo-card-description { display: -webkit-box; margin: 2px 0 0; overflow: hidden; color: #667993; font-size: .81rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.math-demos-state { margin: 44px 0; color: #71819a; text-align: center; }
.math-demos-state.is-error { color: #c34b56; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

[data-theme="dark"] .math-demos-page,
[data-theme="dark"] .math-demos-page .main { background: #0b1120; color: #e5eefc; }
[data-theme="dark"] .math-demos-hero__copy > p, [data-theme="dark"] .math-demo-card-description, [data-theme="dark"] .math-demos-state { color: #a5b5cc; }
[data-theme="dark"] .math-demos-search, [data-theme="dark"] .math-demo-card { border-color: rgba(148, 163, 184, .2); background: rgba(15, 23, 42, .9); }
[data-theme="dark"] .math-demo-card-cover { background: linear-gradient(135deg, #172a48, #0f1d35); }
[data-theme="dark"] .math-demo-card-title { color: #e5eefc; }
[data-theme="dark"] .math-demos-category { border-color: rgba(148, 163, 184, .2); background: rgba(15, 23, 42, .5); color: #bdcbe0; }

@media (max-width: 1200px) and (min-width: 1001px) { .math-demos-main { width: calc(100vw - 300px); margin-left: 276px; } }
@media (max-width: 900px) {
  .math-demos-main { width: 100%; margin: 0; padding: 28px 24px 56px; }
  .math-demos-hero { min-height: 0; padding-top: 20px; }
  .math-demos-hero__copy { transform: translateY(-18px); }
  .math-demos-content { margin-top: -46px; }
  .math-demos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .math-demos-hero { display: flex; flex-direction: column; align-items: stretch; gap: 18px; padding: 10px 20px 14px; overflow: visible; }
  .math-demos-hero__copy { --math-demos-copy-offset: 0px; z-index: 1; padding-top: 22px; transform: none; }
  .math-demos-hero h1 { display: flex; justify-content: center; text-align: center; transform: none; }
  .math-demos-hero__copy > p { margin: 9px 0 0 24px; font-size: .84rem; }
  .math-demos-hero__ornament { top: -48px; left: 50%; width: min(480px, calc(100% + 32px)); transform: translateX(-50%); }
  .math-demos-search { width: 100%; margin-top: 18px; }
}
@media (max-width: 620px) {
  .math-demos-main { padding: 18px 14px 42px; }
  .math-demos-hero { gap: 10px; padding: 8px 4px 20px; text-align: center; }
  .math-demos-hero__copy { transform: none; }
  .math-demos-hero h1 { font-size: 36px; }
  .math-demos-hero__copy > p { margin: 9px 0 0 24px; font-size: .84rem; }
  .math-demos-search { min-height: 48px; margin-top: 18px; padding: 0 15px; border-radius: 999px; text-align: left; }
  .math-demos-search button { min-width: 0; height: 30px; padding: 0 12px; border-radius: 999px; font-size: .78rem; }
  .math-demos-content { margin-top: 0; }
  .math-demos-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; }
  .math-demos-categories { width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .math-demos-category { flex: none; }
  .math-demos-grid { gap: 12px; }
  .math-demo-card { min-height: 232px; border-radius: 14px; }
  .math-demo-card-cover { height: 136px; }
  .math-demo-card-body { gap: 8px; padding: 9px 12px 10px; }
  .math-demo-card-icon { flex-basis: 28px; width: 28px; height: 28px; }
  .math-demo-card-icon i { font-size: 1.4rem; }
  .math-demo-card-title { font-size: .93rem; }
  .math-demo-card-description { margin-top: 2px; font-size: .75rem; }
  .math-demo-card-cover-meta, .math-demo-card-cover-status { top: 8px; font-size: .62rem; }
  .math-demo-card-cover-meta { left: 8px; padding: 5px 7px; }
  .math-demo-card-cover-status { right: 8px; padding: 5px 7px; }
}
