:root {
  color-scheme: light;
  --ink: #151a1e;
  --muted: #59656f;
  --paper: #f6f3ec;
  --panel: #fffdf8;
  --line: #d8d1c3;
  --steel: #23465b;
  --brick: #9b3d2e;
  --gold: #c39b4b;
  --blue: #245da6;
  --shadow: 0 24px 70px rgba(21, 26, 30, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", Georgia, serif;
}

body {
  margin: 0;
  min-width: 320px;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  align-items: center;
  background: rgba(246, 243, 236, 0.9);
  border-bottom: 1px solid rgba(21, 26, 30, 0.1);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  left: 0;
  padding: 16px clamp(18px, 4vw, 56px);
  position: sticky;
  right: 0;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
}

.brand {
  align-items: center;
  display: inline-flex;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  gap: 10px;
  white-space: nowrap;
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  color: var(--paper);
  display: inline-flex;
  font-size: 0.76rem;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.site-nav a {
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.9rem;
  padding: 8px 11px;
}

.site-nav a:hover {
  border-color: rgba(21, 26, 30, 0.16);
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  border-color: rgba(155, 61, 46, 0.26);
  color: var(--brick);
}

.hero {
  align-items: center;
  display: grid;
  min-height: min(720px, 82svh);
  overflow: hidden;
  padding: clamp(76px, 10vw, 132px) clamp(20px, 6.4vw, 84px);
  position: relative;
}

.hero-image,
.hero-overlay {
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
}

.hero-image {
  object-fit: cover;
}

.hero-overlay {
  background:
    linear-gradient(90deg, rgba(21, 26, 30, 0.86), rgba(21, 26, 30, 0.58) 43%, rgba(21, 26, 30, 0.18)),
    linear-gradient(0deg, rgba(21, 26, 30, 0.22), transparent 40%);
}

.hero-content {
  color: #fffdf8;
  max-width: 720px;
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker {
  color: var(--gold);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  margin: 0 0 16px;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(4rem, 10.6vw, 8.2rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.96;
  margin: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  font-family: "Segoe UI", sans-serif;
  font-weight: 800;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
}

.button.primary {
  background: var(--gold);
  color: var(--ink);
}

.button.secondary {
  background: rgba(36, 93, 166, 0.1);
  color: var(--blue);
}

.button:disabled {
  cursor: progress;
  opacity: 0.62;
}

.button.ghost {
  border: 1px solid rgba(255, 253, 248, 0.56);
  color: #fffdf8;
}

.section {
  margin: 0 auto;
  max-width: 1160px;
  padding: clamp(44px, 8vw, 86px) clamp(20px, 5vw, 44px);
}

.intro-grid {
  align-items: end;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
}

h2 {
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1.05;
  margin: 0;
}

.intro-grid p:last-child {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.85;
  margin: 0;
}

.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-top: 8px;
}

.home-entry-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.direction-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 250px;
  padding: 24px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.direction-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.direction-card span {
  color: var(--brick);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
}

.direction-card h3 {
  font-size: 1.45rem;
  margin: 32px 0 14px;
}

.direction-card p {
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-family: "Segoe UI", sans-serif;
  gap: 12px 24px;
  justify-content: space-between;
  padding: 26px clamp(18px, 4vw, 56px);
}

.site-footer p {
  margin: 0;
}

.subpage-main {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.52), rgba(246, 243, 236, 0) 420px),
    var(--paper);
}

.subpage-hero {
  border-bottom: 1px solid var(--line);
  min-height: 430px;
  padding: clamp(86px, 13vw, 150px) clamp(20px, 6.4vw, 84px) clamp(58px, 8vw, 92px);
  position: relative;
}

.subpage-hero::before {
  background:
    linear-gradient(90deg, rgba(21, 26, 30, 0.07), rgba(21, 26, 30, 0)),
    repeating-linear-gradient(90deg, rgba(21, 26, 30, 0.08) 0 1px, transparent 1px 96px);
  content: "";
  inset: 0;
  opacity: 0.36;
  pointer-events: none;
  position: absolute;
}

.subpage-hero h1,
.subpage-hero p {
  max-width: 860px;
  position: relative;
}

.subpage-hero h1 {
  font-size: clamp(3.4rem, 9vw, 7.2rem);
  line-height: 0.96;
  margin: 0 0 22px;
}

.subpage-hero p:last-child {
  color: var(--muted);
  font-size: clamp(1.08rem, 2.2vw, 1.45rem);
  line-height: 1.75;
  margin: 0;
}

.learning-hero {
  background: linear-gradient(120deg, #fffdf8, #f4ead8);
}

.ai-hero {
  background: linear-gradient(120deg, #fffdf8, #e8f0ee);
}

.engineering-hero {
  background: linear-gradient(120deg, #fffdf8, #e9eef1);
}

.split-section {
  align-items: start;
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(0, 0.94fr) minmax(300px, 1.06fr);
}

.plain-copy p {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.85;
  margin: 0;
}

.plain-copy p + p {
  margin-top: 18px;
}

.compact-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding-top: 0;
}

.info-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 220px;
  padding: 24px;
}

.info-card span,
.route-list span {
  color: var(--brick);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
}

.info-card h3,
.route-list h3 {
  font-size: 1.32rem;
  margin: 28px 0 12px;
}

.info-card p,
.route-list p,
.action-strip > p {
  color: var(--muted);
  line-height: 1.76;
  margin: 0;
}

.featured-card {
  border-color: rgba(155, 61, 46, 0.34);
  box-shadow: 0 18px 48px rgba(155, 61, 46, 0.09);
}

.route-list {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-top: 0;
}

.route-list article {
  border-top: 2px solid var(--line);
  padding-top: 18px;
}

.action-strip {
  align-items: center;
  border-block: 1px solid var(--line);
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 0.9fr) minmax(300px, 1.1fr);
  margin-bottom: clamp(44px, 8vw, 86px);
  max-width: none;
  padding-inline: clamp(20px, 7vw, 92px);
}

.baidu-scan-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(21, 26, 30, 0.06);
}

.scan-heading {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.scan-heading h2 {
  margin: 0;
}

.scan-folder,
.status-pill {
  background: rgba(36, 93, 166, 0.1);
  border-radius: 999px;
  color: var(--blue);
  display: inline-flex;
  font-weight: 800;
  padding: 8px 12px;
}

.scan-controls {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(120px, 0.32fr) minmax(220px, 1fr) auto;
  margin-top: 28px;
}

.scan-controls label {
  align-self: center;
  color: var(--ink);
  font-weight: 800;
}

.scan-controls input {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 48px;
  padding: 0 16px;
}

.scan-controls .button {
  min-height: 48px;
}

.scan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.local-scan-layout {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 28px;
  padding: 20px;
}

.local-scan-copy h3 {
  font-size: 1.16rem;
  margin: 0 0 8px;
}

.local-scan-copy p,
.official-api-content > p {
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}

.device-entry-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.directory-zone-heading {
  align-items: end;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1.2fr);
  margin-top: 28px;
  padding-bottom: 16px;
}

.directory-zone-step {
  color: var(--brick);
  display: block;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.directory-zone-heading h3,
.obsidian-target-copy h3 {
  font-size: 1.18rem;
  margin: 7px 0 0;
}

.directory-zone-heading p,
.obsidian-target-copy p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.device-entry-card {
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  min-height: 290px;
  padding: 22px;
}

.device-entry-card.is-ready {
  border-color: rgba(36, 93, 166, 0.34);
  box-shadow: 0 16px 42px rgba(36, 93, 166, 0.08);
}

.entry-tag {
  color: var(--brick);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.device-entry-card h3 {
  font-size: 1.46rem;
  margin: 18px 0 12px;
}

.device-entry-card p {
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}

.entry-path-hint {
  background: rgba(36, 93, 166, 0.08);
  border-radius: 8px;
  color: var(--steel) !important;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.92rem;
  margin-top: 14px !important;
  overflow-wrap: anywhere;
  padding: 10px 12px;
}

.entry-state {
  align-self: end;
  display: grid;
  gap: 14px;
}

.entry-folder {
  color: var(--steel);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.official-api-panel {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
}

.official-api-panel summary {
  color: var(--steel);
  cursor: pointer;
  font-family: "Segoe UI", sans-serif;
  font-weight: 800;
}

.official-api-content {
  display: grid;
  gap: 16px;
  padding-top: 16px;
}

.scan-actions .button {
  white-space: nowrap;
}

.scan-message {
  color: var(--muted);
  line-height: 1.7;
  margin: 18px 0 0;
}

.scan-message.is-error {
  color: var(--brick);
  font-weight: 800;
}

.materials-intake-summary {
  align-items: center;
  background: rgba(36, 93, 166, 0.07);
  border: 1px solid rgba(36, 93, 166, 0.13);
  border-radius: 8px;
  color: var(--steel);
  display: flex;
  flex-wrap: wrap;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  gap: 10px 18px;
  line-height: 1.6;
  margin-top: 16px;
  padding: 14px 16px;
}

.materials-selection-toolbar {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin-top: 16px;
  padding: 14px;
}

.obsidian-target-panel {
  align-items: center;
  background: rgba(36, 93, 166, 0.06);
  border-bottom: 1px solid rgba(36, 93, 166, 0.16);
  border-top: 1px solid rgba(36, 93, 166, 0.16);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 18px;
  padding: 18px 0;
}

.obsidian-target-copy {
  padding-left: 16px;
}

.obsidian-target-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  padding-right: 16px;
}

.obsidian-folder-badge {
  max-width: 320px;
  overflow-wrap: anywhere;
}

.materials-history-tabs {
  align-items: stretch;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.materials-history-tab {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--steel);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-family: "Segoe UI", sans-serif;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  min-height: 46px;
  padding: 10px 16px;
}

.materials-history-tab span {
  background: rgba(36, 93, 166, 0.1);
  border-radius: 999px;
  min-width: 28px;
  padding: 3px 8px;
  text-align: center;
}

.materials-history-tab:hover,
.materials-history-tab:focus-visible,
.materials-history-tab.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  outline: none;
}

.materials-history-tab.is-active span {
  background: rgba(255, 255, 255, 0.2);
}

.info-card-action {
  background: transparent;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-family: "Segoe UI", sans-serif;
  font-weight: 800;
  margin-top: 18px;
  padding: 0;
}

.info-card-action:hover,
.info-card-action:focus-visible {
  text-decoration: underline;
}

.materials-selection-toolbar .button {
  min-height: 44px;
}

.materials-action-status {
  color: var(--muted);
  flex: 1 1 100%;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 2px 0 0;
  min-height: 1.55em;
}

.materials-action-status.is-busy {
  color: var(--blue);
  font-weight: 800;
}

.materials-action-status.is-success {
  color: #287556;
  font-weight: 800;
}

.materials-action-status.is-error {
  color: var(--brick);
  font-weight: 800;
}

.material-select {
  accent-color: var(--blue);
  height: 18px;
  width: 18px;
}

.materials-table td .material-rescan-note {
  color: var(--brick);
  font-size: 0.78rem;
  font-weight: 800;
  margin-top: 0;
  white-space: nowrap;
}

.config-guide {
  background: rgba(143, 47, 38, 0.06);
  border: 1px solid rgba(143, 47, 38, 0.18);
  border-radius: 8px;
  margin-top: 16px;
  padding: 18px;
}

.config-guide h3 {
  font-size: 1rem;
  margin: 0 0 12px;
}

.config-guide ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.config-guide li {
  color: var(--muted);
  line-height: 1.65;
}

.config-guide strong,
.config-guide span {
  display: block;
}

.config-guide strong {
  color: var(--ink);
}

.materials-table-wrap {
  margin-top: 20px;
  overflow-x: auto;
}

.materials-table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.materials-table th,
.materials-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
}

.materials-table th {
  color: var(--muted);
  font-size: 0.82rem;
}

.materials-table td span {
  color: var(--muted);
  display: block;
  font-size: 0.88rem;
  margin-top: 6px;
}

.materials-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .intro-grid {
    grid-template-columns: 1fr;
  }

  .split-section,
  .action-strip {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scan-controls {
    grid-template-columns: 1fr;
  }

  .scan-actions {
    justify-content: stretch;
  }

  .local-scan-layout {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .device-entry-grid {
    grid-template-columns: 1fr;
  }

  .directory-zone-heading,
  .obsidian-target-panel {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .obsidian-target-actions {
    justify-content: flex-start;
    padding-left: 16px;
  }

  .scan-actions .button {
    flex: 1 1 180px;
  }

  .scan-heading {
    display: grid;
  }

  .materials-selection-toolbar .button,
  .materials-selection-toolbar .scan-folder {
    flex: 1 1 180px;
    justify-content: center;
  }
}

@media (max-width: 620px) {
  .hero {
    min-height: 76svh;
    padding-top: 84px;
  }

  .hero-overlay {
    background: linear-gradient(90deg, rgba(21, 26, 30, 0.88), rgba(21, 26, 30, 0.56));
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .direction-card {
    min-height: auto;
  }

  .subpage-hero {
    min-height: auto;
  }

  .compact-grid,
  .route-list {
    grid-template-columns: 1fr;
  }

  .site-nav a {
    padding-inline: 9px;
  }

  .scan-actions,
  .obsidian-target-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .scan-actions .button,
  .obsidian-target-actions .button,
  .obsidian-target-actions .scan-folder {
    justify-content: center;
    max-width: none;
    white-space: normal;
    width: 100%;
  }

  .obsidian-target-actions {
    padding: 0 16px;
  }

  .materials-selection-toolbar .button,
  .materials-selection-toolbar .scan-folder {
    flex-basis: 100%;
    justify-content: center;
  }

  .hero h1 {
    font-size: clamp(3.7rem, 23vw, 5.4rem);
  }

}
