:root {
    color-scheme: light;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #1d1d1f;
    --secondary: #6e6e73;
    --tertiary: #86868b;
    --blue: #0071e3;
    --blue-hover: #0077ed;
    --separator: rgba(0, 0, 0, .08);
    --shadow: 0 2px 8px rgba(0, 0, 0, .04), 0 12px 30px rgba(0, 0, 0, .045);
    --header-bg: rgba(245, 245, 247, .78);
    --control-bg: rgba(0, 0, 0, .055);
    --hover-bg: #fbfbfd;
    --logo-bg: #f5f5f7;
    --ease: cubic-bezier(.25, .1, .25, 1);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --secondary: #a1a1a6;
    --tertiary: #8e8e93;
    --blue: #0a84ff;
    --blue-hover: #409cff;
    --separator: rgba(255, 255, 255, .11);
    --shadow: 0 2px 8px rgba(0, 0, 0, .22), 0 14px 34px rgba(0, 0, 0, .28);
    --header-bg: rgba(0, 0, 0, .72);
    --control-bg: rgba(255, 255, 255, .11);
    --hover-bg: #242426;
    --logo-bg: #ffffff;
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: var(--bg); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, a { font: inherit; -webkit-tap-highlight-color: transparent; }
a:focus-visible { outline: 3px solid rgba(0, 113, 227, .28); outline-offset: 3px; }

.site-header { position: sticky; z-index: 20; top: 0; background: var(--header-bg); backdrop-filter: saturate(180%) blur(20px); }
.header-inner, .page-shell, .footer-inner { width: min(920px, calc(100% - 40px)); margin-inline: auto; }
.header-inner { display: flex; min-height: 54px; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); text-decoration: none; font-size: 15px; font-weight: 650; letter-spacing: -.015em; }
.brand { min-height: 44px; }
.brand-logo { display: block; width: auto; height: 34px; transition: filter 180ms ease, background-color 180ms ease; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.environment { display: inline-flex; align-items: center; gap: 7px; color: var(--secondary); font-size: 12px; }
.environment i { width: 7px; height: 7px; border-radius: 50%; background: #ff9f0a; }
.environment.is-ready i { background: #30d158; }

.page-shell { padding-block: 46px 68px; }
.intro { position: relative; margin-bottom: 30px; }
.intro h1 { margin: 0; font-size: clamp(34px, 5vw, 44px); font-weight: 700; line-height: 1.08; letter-spacing: -.04em; }
.tool-section { margin-top: 38px; }
.section-header { margin-bottom: 14px; }
.section-header h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.025em; }

.tool-grid { overflow: hidden; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.tool-card { display: grid; min-height: 88px; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px 20px; background: var(--surface); }
.tool-card + .tool-card { border-top: 1px solid var(--separator); }
.module-logo-wrap { display: grid; width: 52px; height: 52px; place-items: center; }
.module-logo, .motor-logo { box-sizing: border-box; border-radius: 12px; background: var(--logo-bg); object-fit: contain; transition: filter 180ms ease, background-color 180ms ease; }
.module-logo { display: block; width: 52px; height: 52px; padding: 7px 4px; }
.tool-copy { min-width: 0; }
.tool-copy h3, .motor-copy h3 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.018em; }
.tool-actions { display: flex; align-items: center; gap: 7px; }
.tool-actions a { display: inline-flex; min-height: 34px; align-items: center; justify-content: center; padding: 0 15px; color: white; border-radius: 999px; background: var(--blue); text-decoration: none; font-size: 12px; font-weight: 600; transition: background-color 150ms ease, transform 100ms ease-out; }
.tool-actions a:active { transform: scale(.96); }

.motor-list { overflow: hidden; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.motor-row { display: grid; min-height: 80px; grid-template-columns: minmax(200px, 1fr) auto auto; align-items: center; gap: 16px; padding: 14px 20px; }
.motor-row + .motor-row { border-top: 1px solid var(--separator); }
.motor-brand { display: flex; min-width: 0; align-items: center; gap: 14px; }
.motor-logo { display: block; width: 52px; height: 52px; padding: 3px; flex: 0 0 52px; }
.motor-copy h3 { font-size: 16px; letter-spacing: -.015em; }
.model-count { color: var(--tertiary); font-size: 12px; }

.theme-toggle { display: grid; width: 36px; height: 36px; padding: 0; place-items: center; color: var(--text); border: 0; border-radius: 50%; background: var(--control-bg); cursor: pointer; transition: background-color 150ms ease, transform 100ms ease-out; }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle:focus-visible { outline: 3px solid rgba(0, 113, 227, .28); outline-offset: 2px; }

:root[data-theme="dark"] .brand-logo,
:root[data-theme="dark"] .module-logo,
:root[data-theme="dark"] .motor-logo { filter: invert(1) hue-rotate(180deg); }
:root[data-theme="dark"] .error-icon { color: #409cff; background: rgba(10, 132, 255, .16); }


.site-footer { color: var(--tertiary); border-top: 1px solid var(--separator); font-size: 11px; }
.footer-inner { display: flex; min-height: 68px; align-items: center; justify-content: space-between; }

@media (hover: hover) and (pointer: fine) {
    .tool-card:hover, .motor-row:hover { background: var(--hover-bg); }
    .tool-actions a:hover { background: var(--blue-hover); }
    .theme-toggle:hover { background: color-mix(in srgb, var(--text) 14%, transparent); }
}

@media (max-width: 700px), (max-height: 500px) and (max-width: 900px) {
    .header-inner, .page-shell, .footer-inner { width: calc(100% - 28px); }
    .header-actions { gap: 7px; }
    .environment span { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .theme-toggle { width: 44px; height: 44px; }
    .page-shell { padding-block: 34px 54px; }
    .intro { margin-bottom: 28px; }
    .intro h1 { font-size: 34px; }
    .tool-section { margin-top: 28px; }
    .section-header { margin-bottom: 11px; }
    .section-header h2 { font-size: 20px; }
    .tool-card { min-height: 82px; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; padding: 13px 15px; }
    .module-logo-wrap, .module-logo { width: 52px; height: 52px; }
    .tool-card .tool-actions { grid-column: auto; }
    .tool-actions a { min-height: 44px; }
    .tool-copy p { max-width: 280px; }
    .motor-row { min-height: 82px; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 13px 15px; }
    .motor-brand { gap: 11px; }
    .motor-logo { width: 52px; height: 52px; }
    .model-count { display: none; }
    .motor-row .tool-actions { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; }
}

.is-theme-switching body,
.is-theme-switching .site-header,
.is-theme-switching .tool-card,
.is-theme-switching .motor-row,
.is-theme-switching .tool-grid,
.is-theme-switching .motor-list,
.is-theme-switching .site-footer { transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }

@media (prefers-reduced-transparency: reduce) {
    .site-header { background: var(--bg); backdrop-filter: none; }
}

@media (prefers-contrast: more) {
    .tool-card, .motor-list { border: 1px solid #777; box-shadow: none; }
}
