/* ==========================================================================
   Π Desktop 宣传页
   配色取自 app/globals.css 的深色 token，保持与产品一致。
   ========================================================================== */

:root {
  --bg:        #121212;
  --surface:   #1a1a1a;
  --surface-2: #242424;
  --surface-3: #2e2e2e;
  --border:    #2e2e2e;
  --border-2:  #3a3a3a;
  --text:      #e8e8e8;
  --muted:     #9ca3af;
  --dim:       #7f8794;
  --accent:    #60a5fa;
  --accent-ink:#0b1220;
  --live:      #4ade80;
  --danger:    #f87171;

  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 6px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --maxw: 1080px;
}

* { box-sizing: border-box; letter-spacing: 0; }

html { -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

#demo,
#download { scroll-margin-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3,
.hero-sub,
.why-head p,
.why-item p,
.stage-head p { text-wrap: pretty; }

h1,
.why-head h2,
.stage-head h2,
.download h2 { text-wrap: balance; }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------------------------------------------------------------- 导航 --- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 160ms ease;
}

.nav.is-stuck { border-bottom-color: var(--border); }

.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
  color: var(--muted);
}

.nav-links a:hover { color: var(--text); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transition: background 150ms ease, transform 120ms ease;
}

.nav-cta:hover { background: #93c5fd; color: var(--accent-ink); }
.nav-cta:active { transform: translateY(1px); }

/* ----------------------------------------------------------------- Hero --- */

.hero { padding: 72px 0 96px; }

.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 64px;
  align-items: center;
}

.hero-copy { max-width: 540px; }

.hero-eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: 44px;
  line-height: 1.15;
  font-weight: 650;
  color: #fff;
}

.hero-sub {
  margin: 18px 0 0;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 42ch;
}

.hero-cta {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------- 按钮 --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 120ms ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn-primary:hover { background: #93c5fd; }

.btn-lg {
  min-height: 48px;
  padding: 0 26px;
  font-size: 15px;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-2);
  color: var(--text);
}

.btn-ghost:hover { background: var(--surface-2); }

/* ------------------------------------------------ 窗口外框（共用） --- */

.lights { display: inline-flex; gap: 7px; }

.lights i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #4a4a4a;
  display: block;
}

.lights i:nth-child(1) { background: #545454; }
.lights i:nth-child(2) { background: #4a4a4a; }
.lights i:nth-child(3) { background: #414141; }

/* 截图里已有真实标题栏，外层只给边框和阴影，不再重复画一遍窗口 chrome */
.frame {
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 60%);
}

.frame-shot { width: 100%; height: auto; }

/* ------------------------------------------------------------ 能力说明 --- */

.why { padding: 0 0 104px; }

.why-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: 32px 64px;
  align-items: start;
}

.why-head {
  position: sticky;
  top: 96px;
  max-width: 34ch;
}

.why-head h2,
.stage-head h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 620;
  color: #fff;
}

.why-head p,
.stage-head p {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 54ch;
}

.why-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.why-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 20px;
  padding: 22px 0 24px;
  border-top: 1px solid var(--border);
}

.why-item:first-child { padding-top: 0; border-top: none; }
.why-item:last-child { padding-bottom: 0; }

.why-label {
  padding-top: 3px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

.why-item h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}

.why-item p {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 46ch;
}

/* -------------------------------------------------------------- Demo --- */

.stage { padding: 0 0 120px; }

.stage-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.stage-head { margin-bottom: 28px; }

.stage-note {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.app {
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 32px 80px -28px rgb(0 0 0 / 70%);
}

.app-bar {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.app-bar-title {
  font-size: 12px;
  color: var(--muted);
}

.app-bar-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  color: var(--dim);
  font-size: 11px;
}

.app-body {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  height: 580px;
}

.app-side {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #171717;
  padding: 10px 8px;
  overflow: auto;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* 会话头部：标题 + 分享，与真实应用一致 */
.app-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}

.app-head-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 550;
  color: var(--text);
}

.app-head-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.app-head-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-head-act {
  margin-left: auto;
  flex: none;
  appearance: none;
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.app-head-act:hover { color: var(--text); border-color: #4b5563; }
.app-head-act:disabled { opacity: .55; cursor: default; }

.app-pane {
  flex: 1;
  overflow: auto;
  padding: 18px;
  min-height: 0;
}

.app-pane:focus-visible { outline-offset: -2px; }

/* 输入区：真实应用在对话视图底部常驻，演示里只看位置与形态 */
.app-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
}

.app-composer[hidden] { display: none; }

.composer-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.composer-input::placeholder { color: var(--dim); }
.composer-input:disabled { opacity: .7; cursor: default; }

.composer-send {
  flex: none;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.composer-send:disabled {
  background: var(--surface-3);
  border-color: var(--border-2);
  color: var(--dim);
  cursor: default;
}

/* ------------------------------------------------ 侧边栏：会话树 / 文件 --- */

.side-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.side-brand-mark {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  flex: none;
}

.side-foot { margin-top: auto; padding-top: 8px; }

/* 视图入口：真实应用放在左侧栏，而不是顶部标签栏 */
.side-views {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

.side-item.is-muted:disabled {
  background: none;
  color: var(--dim);
  cursor: default;
}

.side-group { margin-bottom: 14px; }

.side-label {
  padding: 4px 8px;
  font-size: 11px;
  color: var(--dim);
}

.side-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.side-item:hover { background: var(--surface-2); color: var(--text); }

.side-item.is-active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}

.side-item.is-nested { margin-left: 14px; width: calc(100% - 14px); }

.side-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.side-item.is-branch .side-dot { background: var(--live); }

.side-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ 会话 --- */

.chat { max-width: 660px; margin: 0 auto; }

.msg { margin-bottom: 22px; }

.msg-role {
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 6px;
}

.msg-user .msg-body {
  display: inline-block;
  padding: 9px 13px;
  border-radius: var(--r-md);
  background: #1e293b;
  color: #e5edf8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-ai .msg-body { color: var(--text); }

.msg-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 130ms ease;
}

.msg-actions.is-open { opacity: 1; }

/* 触屏没有 hover，操作按钮直接常显 */
@media (hover: none) {
  .msg-actions { opacity: 1; }
}

.act {
  appearance: none;
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}

.act:hover { color: var(--text); border-color: #4b5563; }

.act:disabled { opacity: .45; cursor: default; }

.thinking {
  border-left: 2px solid var(--border-2);
  padding: 2px 0 2px 12px;
  color: var(--dim);
  font-size: 13px;
  margin-bottom: 10px;
}

.tool {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #1f2937;
  margin-bottom: 8px;
  overflow: hidden;
}

.tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 11px;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-family: var(--mono);
  cursor: pointer;
  text-align: left;
}

.tool-name { color: var(--accent); flex: none; }
.tool-hint { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-caret { margin-left: auto; color: var(--dim); flex: none; }

.tool-body {
  border-top: 1px solid var(--border);
  padding: 10px 11px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 220px;
  overflow: auto;
}

.branch-note {
  margin: 26px 0 0;
  padding: 12px 14px;
  border: 1px dashed var(--border-2);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 13px;
}

.branch-note strong { color: var(--accent); font-weight: 600; }

.cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink { to { visibility: hidden; } }

/* ------------------------------------------------------------ 文件 --- */

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

.tree-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 5px 8px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-family: var(--mono);
  cursor: pointer;
  text-align: left;
}

.tree-item:hover { background: var(--surface-2); color: var(--text); }
.tree-item.is-active { background: var(--surface-3); color: var(--text); }
.tree-item.is-dir { color: var(--dim); cursor: default; }
.tree-item.is-dir:hover { background: none; color: var(--dim); }
.tree-item.is-nested { padding-left: 22px; }

.code {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #141414;
  overflow: hidden;
}

.code-head {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.code pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #d4d4d4;
}

.tok-key { color: #c084fc; }
.tok-str { color: #86efac; }
.tok-com { color: #6b7280; }
.tok-num { color: #fbbf24; }
.tok-fn  { color: #60a5fa; }

/* ------------------------------------------------------------- Git --- */

.git-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}

.git-branch { font-family: var(--mono); color: var(--text); }

.git-section { margin-bottom: 20px; }

.git-title {
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 6px;
}

.git-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 5px;
  background: var(--surface-2);
}

.git-code {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  width: 14px;
  flex: none;
}

.git-code.is-mod { color: #fbbf24; }
.git-code.is-new { color: var(--live); }

.git-path {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-weight: inherit;
}

.git-path:hover { color: var(--accent); text-decoration: underline; }

.git-actions { display: flex; gap: 6px; flex: none; }

.git-diff {
  margin: -3px 0 8px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  background: #141414;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  overflow: auto;
  white-space: pre;
}

.diff-add { color: #86efac; }
.diff-del { color: #fca5a5; }
.diff-ctx { color: var(--dim); }

.git-empty { color: var(--dim); font-size: 12.5px; padding: 4px 0; }

/* ---------------------------------------------------------------- 下载 --- */

.download { padding: 24px 0 120px; }

.download-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.download h2 {
  margin: 0;
  font-size: 34px;
  font-weight: 620;
  color: #fff;
}

.download-sub {
  margin: 12px 0 32px;
  color: var(--muted);
  max-width: 56ch;
}

.platforms {
  list-style: none;
  margin: 0;
  padding: 0;
}

.platform {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 4px;
  border-top: 1px solid var(--border);
}

.platform-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.platform-os { font-size: 15px; font-weight: 550; }

.platform-arch { color: var(--dim); font-size: 13px; }

.dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease, transform 120ms ease;
}

.dl-btn:hover { background: var(--surface-3); border-color: #4b5563; }
.dl-btn:active { transform: translateY(1px); }

.dl-btn.is-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
}

.dl-btn.is-primary:hover { background: #93c5fd; }

.download-alt {
  margin-top: 26px;
  color: var(--muted);
  font-size: 14px;
}

.download-alt code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 8px;
}

/* --------------------------------------------------------------- 页脚 --- */

.foot {
  border-top: 1px solid var(--border);
  padding: 26px 0;
}

.foot-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--dim);
  font-size: 13px;
}

.foot-inner a:hover { color: var(--text); }

/* -------------------------------------------------------------- 响应式 --- */

@media (max-width: 900px) {
  .hero { padding: 48px 0 64px; }

  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .hero-copy { max-width: none; }

  h1 { font-size: 36px; }

  .why { padding-bottom: 72px; }

  .why-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }

  .why-head { position: static; max-width: 620px; }

  .app-body { grid-template-columns: 176px minmax(0, 1fr); height: 540px; }

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

@media (max-width: 620px) {
  .nav-links { gap: 18px; font-size: 13px; }

  .nav-links a:first-child { display: none; }

  .nav-inner,
  .hero-inner,
  .stage-inner,
  .download-inner,
  .foot-inner { padding-left: 18px; padding-right: 18px; }

  .hero { padding: 36px 0 52px; }

  h1 { font-size: 30px; }

  .hero-sub { font-size: 15.5px; }

  .hero-cta .btn { flex: 1; }

  .why-head h2,
  .stage-head h2 { font-size: 24px; }

  .why-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 20px 0 22px;
  }

  .why-label { padding-top: 0; }

  .stage { padding-bottom: 76px; }

  /* 手机上侧边栏折到窗口内部上方，避免两栏挤成窄条 */
  .app-body { grid-template-columns: minmax(0, 1fr); height: 680px; }

  .app-side {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 300px;
  }

  .app-pane { padding: 14px; }

  .platform {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
  }

  .dl-btn { min-width: 92px; padding: 0 14px; }

  .download h2 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .cursor { animation: none; }
}
