:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #edf3ef;
  --text: #111c19;
  --muted: #62716b;
  --line: #d8e2dc;
  --line-strong: #c5d2cb;
  --green: #1f6f61;
  --green-strong: #164f47;
  --blue: #326f9f;
  --amber: #b58125;
  --coral: #c85d45;
  --ink: #101816;
  --shadow-sm: 0 12px 30px rgba(17, 28, 25, 0.08);
  --shadow-md: 0 24px 66px rgba(17, 28, 25, 0.13);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1412;
  --surface: #171f1c;
  --surface-soft: #202b27;
  --text: #eff6f2;
  --muted: #a8b8b1;
  --line: #2c3c36;
  --line-strong: #425951;
  --green: #63c5b3;
  --green-strong: #91dccf;
  --blue: #88bde5;
  --amber: #e0b75e;
  --coral: #e58d76;
  --ink: #f6fbf8;
  --shadow-sm: 0 12px 30px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 24px 66px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 111, 97, 0.08), transparent 32%),
    linear-gradient(225deg, rgba(50, 111, 159, 0.08), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  line-height: 1.55;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(17, 28, 25, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 28, 25, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

:root[data-theme="dark"] body::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--green) 42%, transparent);
  outline-offset: 3px;
}

.layout {
  position: relative;
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, var(--surface-soft));
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 4;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  font-weight: 900;
  box-shadow: var(--shadow-sm);
}

.brand strong,
.brand small {
  display: block;
  overflow-wrap: anywhere;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list a {
  min-height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--muted);
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-list a:hover,
.nav-list a.active {
  color: var(--text);
  background: var(--surface-soft);
  transform: translateX(2px);
}

.nav-list a.active {
  box-shadow: inset 3px 0 0 var(--green);
}

.rail-card {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.small-action,
.primary-action,
.secondary-action,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.small-action {
  width: 100%;
  justify-content: space-between;
  margin-top: 8px;
}

.primary-action {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 14px 28px color-mix(in srgb, var(--green) 24%, transparent);
}

.secondary-action:hover,
.small-action:hover,
.icon-button:hover,
.primary-action:hover {
  transform: translateY(-1px);
  border-color: var(--green);
  box-shadow: var(--shadow-sm);
}

.icon-button {
  width: 42px;
  padding: 0;
}

.content {
  position: relative;
  width: min(100%, 1420px);
  margin: 0 auto;
  padding: 30px;
}

.topbar,
.top-actions,
.section-heading,
.hero-tags,
.segments {
  display: flex;
  align-items: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  justify-content: space-between;
  gap: 20px;
  margin: -30px -30px 24px;
  padding: 22px 30px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px);
}

.top-actions {
  gap: 10px;
}

.topbar h1,
.hero h2,
.section-heading h2,
.note-panel h2 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 30px;
}

.eyebrow {
  display: block;
  margin: 0 0 6px;
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 26px;
  align-items: stretch;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--green) 9%, transparent), transparent 44%),
    var(--surface);
  box-shadow: var(--shadow-md);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.hero h2 {
  max-width: 820px;
  font-size: 50px;
}

.hero p {
  max-width: 740px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.hero-tags {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.hero-tags span {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.hero-tags svg {
  color: var(--green);
}

.hero-image {
  width: 100%;
  height: 100%;
  min-height: 290px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.summary-grid,
.link-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.summary-grid {
  margin-top: 16px;
}

.summary-card,
.link-card,
.command-card,
.note-panel,
.timeline article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.summary-card {
  min-height: 142px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.summary-card svg {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  padding: 10px;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 12%, transparent);
}

.summary-card span,
.summary-card small {
  color: var(--muted);
}

.summary-card strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
}

.section-block {
  margin-top: 34px;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2,
.note-panel h2 {
  font-size: 24px;
}

.search-box {
  width: min(420px, 100%);
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  box-shadow: var(--shadow-sm);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.link-card {
  --tone: var(--green);
  min-height: 188px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 3px solid var(--tone);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.link-card:hover,
.command-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tone-green {
  --tone: var(--green);
}

.tone-blue {
  --tone: var(--blue);
}

.tone-amber {
  --tone: var(--amber);
}

.tone-coral {
  --tone: var(--coral);
}

.link-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.link-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--tone);
  background: color-mix(in srgb, var(--tone) 13%, transparent);
}

.link-card h3,
.command-card h3,
.timeline h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.link-card p,
.timeline p {
  margin: 0;
  color: var(--muted);
}

.status-pill {
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--green);
  background: color-mix(in srgb, var(--green) 13%, transparent);
  font-size: 12px;
  font-weight: 900;
}

.link-bottom {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.link-domain {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.segments {
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.segment {
  height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
}

.segment.active {
  color: #ffffff;
  background: var(--ink);
}

.command-list {
  display: grid;
  gap: 12px;
}

.command-card {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.command-meta span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.command-code {
  margin: 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: var(--surface-soft);
  overflow-x: auto;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline article {
  position: relative;
  padding: 18px 18px 18px 28px;
}

.timeline article::before {
  position: absolute;
  left: 12px;
  top: 22px;
  width: 4px;
  height: calc(100% - 44px);
  border-radius: 999px;
  background: var(--green);
  content: "";
}

.timeline time {
  color: var(--green-strong);
  font-size: 13px;
  font-weight: 900;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.note-panel {
  padding: 18px;
}

.note-panel ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.note-panel li + li {
  margin-top: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  min-width: 180px;
  max-width: min(420px, calc(100vw - 32px));
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 16px;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

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

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 16px;
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }

  .rail-card {
    min-width: 190px;
    margin: 0 0 0 auto;
    border-top: 0;
    padding-top: 0;
  }

  .hero,
  .command-card {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .content {
    padding: 18px 14px;
  }

  .topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
    margin: 0 0 20px;
    padding: 0;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .top-actions,
  .section-heading,
  .segments {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .hero {
    padding: 18px;
  }

  .hero h2 {
    font-size: 32px;
  }

  .hero-image {
    min-height: 220px;
  }

  .summary-grid,
  .link-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .command-card {
    padding: 14px;
  }

  .link-bottom {
    align-items: stretch;
    flex-direction: column;
  }

  .rail {
    gap: 14px;
  }

  .nav-list {
    width: 100%;
    grid-auto-flow: initial;
    grid-auto-columns: initial;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow-x: visible;
  }

  .nav-list a {
    justify-content: center;
    gap: 6px;
    padding: 0 4px;
    font-size: 14px;
  }

  .nav-list a span {
    white-space: nowrap;
  }

  .rail-card {
    width: 100%;
    margin-left: 0;
  }
}
