:root {
  --ink: #17221d;
  --ink-soft: #53605a;
  --paper: #f5f1e8;
  --paper-deep: #ebe3d3;
  --surface: rgba(255, 253, 247, 0.82);
  --line: rgba(23, 34, 29, 0.14);
  --accent: #d97724;
  --accent-dark: #9f4d15;
  --green: #2f6f5e;
  --danger: #a7442f;
  --shadow: 0 22px 60px rgba(45, 37, 25, 0.12);
  color-scheme: light;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 12%, rgba(217, 119, 36, 0.16), transparent 28%),
    radial-gradient(circle at 12% 76%, rgba(47, 111, 94, 0.12), transparent 30%),
    var(--paper);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

.grain {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: 0.27;
  background-image:
    linear-gradient(rgba(23, 34, 29, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 34, 29, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  min-height: 88px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(250, 247, 239, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px 4px 13px 4px;
  color: #fff9ee;
  background: var(--ink);
  font-family: "Songti SC", "STSong", serif;
  font-size: 22px;
  font-weight: 700;
  transform: rotate(-2deg);
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 21px;
  letter-spacing: 0.04em;
}

.brand-copy small {
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.column-nav,
.project-tabs {
  display: flex;
  align-items: stretch;
}

.column-nav {
  min-width: 0;
  margin-left: clamp(24px, 5vw, 72px);
  overflow-x: auto;
  scrollbar-width: none;
}

.column-nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  position: relative;
  flex: 0 0 auto;
  min-width: 100px;
  padding: 0 20px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.nav-item > span {
  vertical-align: middle;
}

.nav-runtime {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-radius: 50%;
  background: #b59669;
  vertical-align: middle;
}

.nav-runtime.is-running {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 111, 94, 0.12);
}

.nav-runtime.is-starting,
.nav-runtime.is-restarting {
  background: #d6a33c;
}

.nav-runtime.is-failed,
.nav-runtime.is-stopped,
.nav-runtime.is-exited {
  background: var(--danger);
}

.nav-item::after {
  position: absolute;
  right: 20px;
  bottom: 10px;
  left: 20px;
  height: 3px;
  border-radius: 99px;
  background: var(--tab-accent, var(--accent));
  content: "";
  opacity: 0;
  transform: scaleX(0.35);
  transition: 180ms ease;
}

.nav-item:hover,
.nav-item.is-active {
  color: var(--ink);
}

.nav-item.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.connection-status {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 24px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d6a33c;
  box-shadow: 0 0 0 4px rgba(214, 163, 60, 0.12);
}

.connection-status.is-live .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 111, 94, 0.12);
}

.connection-status.is-offline .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(167, 68, 47, 0.12);
}

.app-shell {
  min-height: calc(100vh - 88px);
}

.overview-view,
.guide-view {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(56px, 8vw, 112px) 0 80px;
  animation: reveal 440ms ease both;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: clamp(48px, 7vw, 104px);
  align-items: end;
  padding-bottom: clamp(64px, 9vw, 120px);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hero h1,
.page-heading h1 {
  max-width: 820px;
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(52px, 7.2vw, 106px);
  font-weight: 700;
  letter-spacing: -0.065em;
  line-height: 0.96;
}

.hero h1::first-line {
  color: var(--ink);
}

.hero-description {
  max-width: 600px;
  margin: 30px 0 0;
  color: var(--ink-soft);
  font-size: clamp(16px, 1.6vw, 20px);
  line-height: 1.85;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-top: 32px;
  padding: 14px 18px 14px 20px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--ink);
  color: #fffaf0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  transition: 180ms ease;
}

.primary-action span {
  font-size: 20px;
  transition: transform 180ms ease;
}

.primary-action:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.primary-action:hover span {
  transform: translateX(4px);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  display: grid;
  min-height: 160px;
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 12px 34px rgba(45, 37, 25, 0.06);
}

.metric-card:first-child {
  grid-row: span 2;
  min-height: 334px;
}

.metric-card > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  align-self: center;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(34px, 5vw, 76px);
  line-height: 1;
}

.metric-card small {
  align-self: end;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.metric-primary {
  color: #fff9ee;
  background: var(--ink);
}

.metric-primary > span {
  color: rgba(255, 249, 238, 0.62);
}

.project-section {
  padding-top: 38px;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
}

.section-heading .eyebrow {
  margin-bottom: 8px;
}

.section-heading h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 36px;
}

.section-heading > p {
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-size: 13px;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  position: relative;
  display: grid;
  min-height: 210px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.68);
  cursor: pointer;
  text-align: left;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.project-card::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 46px;
  height: 6px;
  background: var(--card-accent, var(--accent));
  content: "";
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.project-index {
  color: var(--card-accent, var(--accent));
  font-family: "Songti SC", "STSong", serif;
  font-size: 14px;
  font-weight: 700;
}

.project-runtime {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 5px 8px;
  border-radius: 999px;
  color: #6d5839;
  background: rgba(181, 150, 105, 0.14);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.project-card > .project-runtime {
  position: absolute;
  top: 20px;
  right: 18px;
}

.project-runtime.is-running,
.project-runtime.is-static {
  color: var(--green);
  background: rgba(47, 111, 94, 0.12);
}

.project-runtime.is-starting,
.project-runtime.is-restarting {
  color: #8f6409;
  background: rgba(214, 163, 60, 0.16);
}

.project-runtime.is-failed,
.project-runtime.is-stopped,
.project-runtime.is-exited {
  color: var(--danger);
  background: rgba(167, 68, 47, 0.12);
}

.project-card strong {
  align-self: end;
  font-family: "Songti SC", "STSong", serif;
  font-size: 28px;
}

.project-card p {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.empty-projects {
  grid-column: 1 / -1;
  display: flex;
  gap: 24px;
  align-items: center;
  min-height: 180px;
  padding: 28px;
  border: 1px dashed rgba(23, 34, 29, 0.25);
  background: rgba(255, 255, 255, 0.28);
}

.empty-projects > span {
  color: rgba(23, 34, 29, 0.16);
  font-family: "Songti SC", "STSong", serif;
  font-size: 74px;
}

.empty-projects strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 24px;
}

.empty-projects p {
  margin: 8px 0 0;
  color: var(--ink-soft);
}

.guide-view {
  max-width: 1120px;
}

.page-heading h1 {
  font-size: clamp(50px, 7vw, 88px);
}

.page-heading > p:last-child {
  max-width: 620px;
  margin: 26px 0 0;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.8;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 64px 0 32px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.steps article {
  min-height: 210px;
  padding: 24px;
  border-right: 1px solid var(--line);
}

.steps article:last-child {
  border-right: 0;
}

.steps span {
  color: var(--accent);
  font-family: "Songti SC", "STSong", serif;
  font-size: 13px;
  font-weight: 700;
}

.steps h2 {
  margin: 44px 0 10px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 25px;
}

.steps p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.code-panel {
  overflow: hidden;
  border: 1px solid rgba(23, 34, 29, 0.22);
  border-radius: 3px;
  background: #17221d;
  box-shadow: var(--shadow);
}

.code-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff9ee;
}

.code-heading > div {
  display: grid;
  gap: 4px;
}

.code-kicker {
  color: #d9a477;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.code-heading button {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 2px;
  background: transparent;
  color: #fff9ee;
  cursor: pointer;
  font-size: 12px;
}

.code-panel pre {
  margin: 0;
  padding: 24px;
  overflow-x: auto;
  color: #f3d6b8;
  font-size: 13px;
  line-height: 1.75;
}

.guide-note {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  margin-top: 24px;
  padding: 24px;
  border-left: 4px solid var(--accent);
  background: rgba(255, 253, 247, 0.62);
}

.guide-note strong {
  font-family: "Songti SC", "STSong", serif;
  font-size: 20px;
}

.guide-note p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.8;
}

.project-view {
  display: grid;
  grid-template-rows: auto minmax(600px, calc(100vh - 142px));
  min-height: calc(100vh - 88px);
  animation: reveal 260ms ease both;
}

.project-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 13px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.72);
}

.project-toolbar > div {
  min-width: 0;
}

.project-toolbar strong {
  display: block;
  font-family: "Songti SC", "STSong", serif;
  font-size: 17px;
}

.project-toolbar p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-toolbar a {
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.project-toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 16px;
}

.project-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.project-missing {
  display: grid;
  min-height: calc(100vh - 88px);
  place-items: center;
  padding: 32px;
  text-align: center;
}

.project-missing strong {
  display: block;
  font-family: "Songti SC", "STSong", serif;
  font-size: 32px;
}

.project-missing p {
  color: var(--ink-soft);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .connection-status {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 30;
    margin: 0;
    background: rgba(250, 247, 239, 0.94);
    box-shadow: 0 10px 30px rgba(23, 34, 29, 0.14);
  }

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

  .hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-card,
  .metric-card:first-child {
    grid-row: auto;
    min-height: 150px;
  }

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

@media (max-width: 680px) {
  .topbar {
    min-height: auto;
    padding: 13px 16px 0;
  }

  .brand {
    align-self: start;
    padding-bottom: 13px;
  }

  .brand-copy {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .column-nav {
    height: 51px;
    margin-left: 8px;
  }

  .nav-item {
    min-width: auto;
    padding: 0 14px;
    font-size: 14px;
  }

  .nav-item::after {
    right: 14px;
    bottom: 6px;
    left: 14px;
  }

  .overview-view,
  .guide-view {
    width: min(100% - 32px, 1320px);
    padding-top: 48px;
  }

  .hero {
    gap: 44px;
    padding-bottom: 64px;
  }

  .hero h1 {
    font-size: clamp(46px, 14vw, 68px);
  }

  .hero-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .metric-card:first-child {
    grid-column: 1 / -1;
  }

  .section-heading {
    display: block;
  }

  .section-heading > p {
    margin-top: 12px;
  }

  .project-grid,
  .steps {
    grid-template-columns: 1fr;
  }

  .steps article {
    min-height: 150px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .steps article:last-child {
    border-bottom: 0;
  }

  .steps h2 {
    margin-top: 24px;
  }

  .guide-note {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .project-view {
    grid-template-rows: auto minmax(560px, calc(100vh - 142px));
  }
}

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