:root {
  color-scheme: dark;
  --bg: #070a10;
  --bg-soft: #0c111a;
  --surface: rgba(17, 24, 37, 0.72);
  --surface-strong: rgba(20, 29, 44, 0.92);
  --surface-hover: rgba(29, 41, 62, 0.88);
  --line: rgba(204, 220, 246, 0.115);
  --line-strong: rgba(204, 220, 246, 0.22);
  --text: #f0f4fb;
  --muted: #9aa8bc;
  --subtle: #65738a;
  --accent: #8caeff;
  --accent-soft: #cbd7ff;
  --mint: #8be6c0;
  --shadow: 0 26px 90px rgba(0, 0, 0, 0.42);
  --radius-lg: 28px;
  --radius-md: 19px;
}

body.light-mode {
  color-scheme: light;
  --bg: #eef2f7;
  --bg-soft: #f8faff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --surface-hover: rgba(255, 255, 255, 0.98);
  --line: rgba(56, 77, 107, 0.13);
  --line-strong: rgba(56, 77, 107, 0.22);
  --text: #142138;
  --muted: #66758d;
  --subtle: #8794a8;
  --accent: #5f82e8;
  --accent-soft: #4268d2;
  --mint: #2aaf7c;
  --shadow: 0 26px 90px rgba(63, 84, 122, 0.18);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  position: relative;
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 13% -8%, rgba(76, 103, 207, 0.18), transparent 31rem),
    radial-gradient(circle at 91% 51%, rgba(31, 112, 129, 0.08), transparent 28rem),
    linear-gradient(180deg, var(--bg) 0%, #0a0e16 54%, var(--bg) 100%);
  color: var(--text);
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  transition: background 300ms ease, color 300ms ease;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image:
    linear-gradient(rgba(164, 188, 232, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(164, 188, 232, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  content: '';
  mask-image: linear-gradient(to bottom, black, transparent 78%);
  pointer-events: none;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(0, 0, 0, 0.22) 100%);
  content: '';
  pointer-events: none;
}

body.light-mode { background: var(--bg); }
body.light-mode::before { opacity: 0.45; }
body.light-mode::after { background: radial-gradient(ellipse at center, transparent 52%, rgba(63, 84, 122, 0.08) 100%); }

button, a { font: inherit; }
a { color: inherit; text-decoration: none; }

.ambient {
  position: fixed;
  z-index: -2;
  width: min(48vw, 720px);
  height: min(48vw, 720px);
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.23;
  pointer-events: none;
}

.ambient-one { top: -22vw; left: -15vw; background: #3b5fd1; }
.ambient-two { top: 42vh; right: -27vw; background: #277c86; opacity: 0.12; }
.light-mode .ambient-one { background: #9bb4f4; opacity: 0.25; }
.light-mode .ambient-two { background: #96d9c8; opacity: 0.24; }

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.032;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.page-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 92px;
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  content: '';
}

.brand { display: inline-flex; align-items: center; gap: 12px; letter-spacing: 0.1em; }
.brand-name { font-size: 15px; font-weight: 800; }
.brand-name span { color: var(--accent); }
.brand-mark { display: flex; align-items: end; gap: 3px; width: 23px; height: 20px; }
.brand-mark span { display: block; width: 5px; border-radius: 5px; background: var(--accent); box-shadow: 0 0 16px rgba(140, 174, 255, 0.18); }
.brand-mark span:nth-child(1) { height: 11px; opacity: 0.55; }
.brand-mark span:nth-child(2) { height: 17px; opacity: 0.8; }
.brand-mark span:nth-child(3) { height: 14px; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.time-block { display: flex; align-items: baseline; gap: 10px; color: var(--muted); font: 400 10px/1 Consolas, 'Courier New', monospace; letter-spacing: 0.08em; text-transform: uppercase; }
.time-block span:first-child { color: var(--text); font-size: 12px; }
.icon-button { display: grid; width: 38px; height: 38px; padding: 0; place-items: center; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; box-shadow: inset 0 1px rgba(255,255,255,0.06); transition: color 180ms ease, background 180ms ease, transform 220ms ease, border-color 180ms ease; }
.icon-button:hover { color: var(--text); background: var(--surface-hover); border-color: var(--line-strong); transform: rotate(12deg) scale(1.04); }
.icon { display: inline-grid; width: 18px; height: 18px; place-items: center; }
.icon svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.settings-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; padding: 24px; place-items: start end; background: rgba(2, 5, 10, 0.58); backdrop-filter: blur(10px); }
.settings-dialog { width: min(610px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 28px; color: var(--text); background: var(--surface-strong); border: 1px solid var(--line-strong); border-radius: 22px; box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,0.07); }
.settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.settings-heading .section-kicker { margin: 0 0 10px; }
.settings-heading h2 { margin: 0 0 8px; }
.settings-heading p:last-child { max-width: 420px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.settings-close { width: 30px; height: 30px; padding: 0; color: var(--muted); background: rgba(140,174,255,0.07); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 21px; line-height: 1; }
.settings-close:hover { color: var(--text); border-color: var(--line-strong); }
.settings-list { display: grid; gap: 8px; padding: 18px 0; }
.settings-row { display: grid; grid-template-columns: minmax(0, 1fr) 230px; align-items: center; gap: 18px; padding: 12px 13px; background: rgba(140,174,255,0.045); border: 1px solid rgba(140,174,255,0.09); border-radius: 12px; }
.settings-row:hover { background: rgba(140,174,255,0.08); border-color: var(--line-strong); }
.settings-row strong, .settings-row small { display: block; }
.settings-row strong { margin-bottom: 3px; font-size: 12px; font-weight: 600; }
.settings-row small { overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.settings-controls { display: grid; grid-template-columns: 148px auto; align-items: center; gap: 8px; }
.settings-row select { width: 100%; padding: 9px 10px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; cursor: pointer; font-size: 10px; }
.settings-order { display: inline-flex; gap: 4px; }
.settings-order button { display: grid; width: 28px; height: 28px; padding: 0; place-items: center; color: var(--muted); background: rgba(140,174,255,0.07); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 14px; line-height: 1; }
.settings-order button:hover { color: var(--text); border-color: var(--line-strong); }
.settings-order button:disabled { cursor: not-allowed; opacity: 0.3; }
.settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 16px; color: var(--subtle); border-top: 1px solid var(--line); font: 500 9px/1.2 Consolas, 'Courier New', monospace; letter-spacing: 0.1em; }
.settings-reset { padding: 8px 10px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font: inherit; letter-spacing: normal; }
.settings-reset:hover { color: var(--text); border-color: var(--line-strong); }

.hero { position: relative; display: flex; min-height: 410px; padding: 98px 0 76px; align-items: end; justify-content: space-between; gap: 48px; }
.hero::after { position: absolute; right: 21%; bottom: 0; width: 1px; height: 88px; background: linear-gradient(to bottom, transparent, var(--line)); content: ''; opacity: 0.7; }
.hero-copy { max-width: 780px; }
.eyebrow, .section-kicker, .section-count, .footer-content { color: var(--subtle); font: 500 10px/1.2 Consolas, 'Courier New', monospace; letter-spacing: 0.14em; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 27px; color: var(--accent); }
.pulse-dot { display: inline-block; width: 6px; height: 6px; background: var(--mint); border-radius: 50%; box-shadow: 0 0 0 4px rgba(139, 230, 192, 0.1), 0 0 14px rgba(139, 230, 192, 0.6); }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 760px; margin-bottom: 23px; font-size: clamp(44px, 7.1vw, 82px); font-weight: 700; letter-spacing: -0.078em; line-height: 0.97; }
h1 em { color: var(--accent-soft); font-style: normal; text-shadow: 0 0 34px rgba(140, 174, 255, 0.12); }
.hero-text { max-width: 450px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.9; }
.glass-chip { display: flex; align-items: center; gap: 14px; min-width: 230px; padding: 16px 18px; background: linear-gradient(145deg, rgba(32, 45, 69, 0.68), rgba(13, 19, 30, 0.52)); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,0.07); backdrop-filter: blur(20px); }
.hero-note { margin-bottom: 10px; }
.hero-note strong, .hero-note small { display: block; }
.hero-note strong { margin-bottom: 4px; font-size: 12px; font-weight: 600; }
.hero-note small { color: var(--muted); font-size: 10px; }
.chip-orbit { position: relative; display: block; width: 30px; height: 30px; border: 1px solid var(--accent); border-radius: 50%; opacity: 0.8; }
.chip-orbit::before, .chip-orbit::after { position: absolute; content: ''; border-radius: 50%; }
.chip-orbit::before { inset: 6px; border: 1px solid var(--accent); opacity: 0.65; }
.chip-orbit::after { top: 3px; right: 1px; width: 5px; height: 5px; background: var(--accent-soft); box-shadow: 0 0 10px var(--accent); }

.section-block { padding: 58px 0 37px; }
.featured-section { padding-top: 42px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.heading-stack { min-width: 0; display: grid; align-content: start; justify-items: start; }
.section-kicker { margin-bottom: 10px; color: var(--accent); line-height: 1.2; }
h2, .tool-category-title { margin-bottom: 0; color: var(--text); font-size: 26px; font-weight: 600; letter-spacing: -0.05em; line-height: 1.15; }
.section-count { align-self: end; padding-bottom: 5px; }

.featured-grid { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(0, 0.82fr); gap: 16px; }
.services-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tools-grid { display: grid; gap: 46px; }
.tool-category { display: grid; gap: 18px; }
.tool-category-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.tool-category-kicker { margin: 0 0 10px; color: var(--accent); font: 500 9px/1.2 Consolas, 'Courier New', monospace; letter-spacing: 0.15em; }
.tool-category-title { margin: 0 0 5px; }
.tool-category-description { max-width: 460px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.tool-category-count { align-self: end; padding-bottom: 4px; color: var(--subtle); font: 500 9px/1.2 Consolas, 'Courier New', monospace; letter-spacing: 0.12em; }
.tool-category-toggle { display: inline-flex; align-items: center; align-self: end; gap: 9px; padding: 0 0 4px; color: var(--subtle); background: none; border: 0; cursor: pointer; font: inherit; }
.tool-category-toggle:hover { color: var(--accent-soft); }
.tool-category-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.tool-category-toggle-icon { width: 13px; height: 13px; transition: transform 180ms ease, color 180ms ease; }
.tool-category-toggle-icon svg { width: 13px; height: 13px; }
.tool-category.is-collapsed .tool-category-grid { display: none; }
.tool-category.is-expanded .tool-category-toggle-icon { transform: rotate(90deg); }
.tool-category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 14px; }

.service-card { position: relative; display: flex; min-width: 0; min-height: 181px; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 24px; background: linear-gradient(145deg, rgba(22, 31, 47, 0.76), rgba(12, 17, 27, 0.63)); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 15px 45px rgba(0, 0, 0, 0.16), inset 0 1px rgba(255,255,255,0.045); isolation: isolate; transition: background 220ms ease, border-color 220ms ease, transform 220ms ease, box-shadow 220ms ease; }
.service-card::before { position: absolute; z-index: -1; top: -50px; right: -34px; width: 150px; height: 150px; border-radius: 50%; background: var(--card-glow, rgba(140, 174, 255, 0.12)); filter: blur(18px); content: ''; opacity: 0.76; transition: transform 320ms ease, opacity 220ms ease; }
.service-card::after { position: absolute; top: 0; right: 25px; left: 25px; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.11), transparent); content: ''; opacity: 0.7; }
.service-card:hover { background: var(--surface-hover); border-color: var(--line-strong); box-shadow: 0 24px 62px rgba(0, 0, 0, 0.25), inset 0 1px rgba(255,255,255,0.07); transform: translateY(-4px); }
.service-card:hover::before { opacity: 1; transform: scale(1.32); }
.service-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.service-card.large { min-height: 286px; padding: 31px; border-radius: var(--radius-lg); }
.service-card.large .card-title { font-size: 26px; }
.service-card.large .card-description { max-width: 310px; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.card-bottom { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 18px; }
.card-bottom > div { display: flex; min-width: 0; min-height: 58px; flex-direction: column; justify-content: flex-start; }
.card-icon { display: grid; width: 43px; height: 43px; flex: 0 0 43px; place-items: center; color: var(--accent-soft); background: rgba(140, 174, 255, 0.09); border: 1px solid rgba(140, 174, 255, 0.15); border-radius: 14px; box-shadow: inset 0 1px rgba(255,255,255,0.06); }
.card-icon .icon { width: 20px; height: 20px; }
.card-arrow { color: var(--subtle); transition: color 180ms ease, transform 180ms ease; }
.card-arrow svg { width: 17px; height: 17px; }
.service-card:hover .card-arrow { color: var(--accent-soft); transform: translate(3px, -3px); }
.card-title { min-height: 22px; margin: 0 0 7px; color: var(--text); font-size: 16px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.35; }
.card-description { min-height: 36px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.65; }
.card-meta { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; color: var(--subtle); font: 400 9px/1.3 Consolas, 'Courier New', monospace; letter-spacing: 0.06em; text-align: right; text-transform: uppercase; white-space: nowrap; }
.status-dot { width: 5px; height: 5px; flex: 0 0 5px; background: var(--mint); border-radius: 50%; box-shadow: 0 0 9px var(--mint); }
.status-dot.pending { background: var(--subtle); box-shadow: none; }
.service-card.featured-secondary { min-height: 286px; }
.service-card.featured-secondary .card-icon { color: #f2c99c; background: rgba(242, 201, 156, 0.1); border-color: rgba(242, 201, 156, 0.18); }
.service-card[data-state="pending"] .card-title { color: var(--muted); }
.service-card.multi-link { cursor: pointer; }
.service-card.multi-link.is-expanded { border-color: var(--line-strong); box-shadow: 0 24px 62px rgba(0, 0, 0, 0.25), inset 0 1px rgba(255,255,255,0.07); }
.multi-link-panel { display: none; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.service-card.multi-link.is-expanded .multi-link-panel { display: block; }
.multi-link-label { margin: 0 0 9px; color: var(--subtle); font: 500 9px/1.2 Consolas, 'Courier New', monospace; letter-spacing: 0.13em; }
.multi-link-list { display: grid; gap: 7px; }
.multi-link-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; color: var(--muted); background: rgba(140,174,255,0.055); border: 1px solid rgba(140,174,255,0.1); border-radius: 10px; font-size: 10px; transition: color 180ms ease, background 180ms ease, border-color 180ms ease; }
.multi-link-item:hover { color: var(--text); background: rgba(140,174,255,0.11); border-color: rgba(140,174,255,0.22); }
.multi-link-item .icon { width: 14px; height: 14px; color: var(--accent-soft); }

.footer { padding: 65px 0 38px; }
.footer-line { height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.footer-content { display: flex; justify-content: space-between; padding-top: 18px; font-size: 9px; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 10; max-width: calc(100% - 40px); padding: 12px 16px; color: var(--text); background: var(--surface-strong); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transform: translate(-50%, 15px); transition: opacity 180ms ease, transform 180ms ease; backdrop-filter: blur(18px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .services-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { gap: 28px; }
  .hero::after { right: 17%; }
}

@media (max-width: 700px) {
  .page-shell { width: min(100% - 32px, 560px); }
  .topbar { height: 78px; }
  .time-block span:last-child { display: none; }
  .hero { display: block; min-height: unset; padding: 78px 0 52px; }
  .hero::after { right: 11%; height: 60px; }
  .hero-note { display: inline-flex; margin-top: 32px; }
  .featured-grid { grid-template-columns: 1fr; }
  .tool-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-card.large, .service-card.featured-secondary { min-height: 240px; }
  .section-block { padding: 38px 0 28px; }
  .featured-section { padding-top: 28px; }
  .footer-content { gap: 12px; line-height: 1.6; }
}

@media (max-width: 460px) {
  .page-shell { width: calc(100% - 28px); }
  .settings-backdrop { padding: 14px; place-items: center; }
  .settings-dialog { max-height: calc(100vh - 28px); padding: 21px; }
  .settings-row { grid-template-columns: 1fr; gap: 9px; }
  .settings-controls { grid-template-columns: minmax(0, 1fr) auto; }
  .settings-row select { width: 100%; }
  .settings-footer { align-items: flex-start; flex-direction: column; gap: 12px; }
  .topbar-right { gap: 12px; }
  .services-grid { grid-template-columns: 1fr; }
  .tool-category-grid { grid-template-columns: 1fr; }
  .service-card { min-height: 166px; padding: 22px; }
  .service-card.large, .service-card.featured-secondary { min-height: 224px; padding: 25px; }
  .card-bottom { display: flex; align-items: flex-start; flex-wrap: wrap; }
  .card-bottom > div { min-height: 0; }
  .card-title, .card-description { min-height: 0; }
  .card-meta { margin-top: 9px; text-align: left; }
  h1 { font-size: clamp(40px, 12vw, 58px); }
  .section-heading { align-items: flex-start; }
  .section-count { padding-top: 2px; font-size: 9px; text-align: right; }
  .footer-content { align-items: flex-start; flex-direction: column; }
}

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