/* =========================================================
   Sub / CPA 互转 — Control-Deck 主题
   暗色精密仪表风 + 酸性青柠强调色
   ========================================================= */

:root {
  --bg: #080b0a;
  --bg-2: #0c100e;
  --panel: rgba(18, 24, 21, 0.82);
  --panel-solid: #111714;
  --panel-line: rgba(198, 242, 78, 0.16);
  --line: rgba(233, 244, 235, 0.09);
  --line-strong: rgba(233, 244, 235, 0.16);

  --ink: #e9f4eb;
  --muted: #8aa39a;
  --faint: #5f756c;

  --accent: #c6f24e;
  --accent-2: #8ef0a8;
  --accent-ink: #0a0d0c;

  --ok: #5fe39a;
  --warn: #f3c969;
  --err: #ff7a7a;

  --font-display: 'Syne', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- 背景氛围 ---------- */
.bg-field { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(rgba(198, 242, 78, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(198, 242, 78, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 35%, transparent 100%);
}
.bg-glow {
  position: absolute; top: -18%; left: 50%; transform: translateX(-50%);
  width: 1100px; height: 620px;
  background: radial-gradient(closest-side, rgba(142, 240, 168, 0.16), transparent 70%);
  filter: blur(20px);
}
.bg-noise {
  position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- 外壳 ---------- */
.app-shell {
  position: relative; z-index: 1;
  max-width: 1320px; margin: 0 auto;
  padding: clamp(18px, 3vw, 40px);
  display: flex; flex-direction: column; gap: 22px;
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 28px; flex-wrap: wrap;
  animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.brand { max-width: 560px; }
.brand__tag {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 12px/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-2);
  padding: 6px 12px; border: 1px solid var(--panel-line); border-radius: 999px;
  background: rgba(198, 242, 78, 0.06);
}
.brand__tag .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(198, 242, 78, 0.6); animation: pulse 2.4s infinite;
}
.brand__title {
  margin: 14px 0 8px; font-family: var(--font-display); font-weight: 800;
  font-size: clamp(34px, 5vw, 56px); line-height: 0.96; letter-spacing: -0.02em;
}
.brand__title-em {
  display: inline-block; margin-left: 6px; color: var(--accent);
  -webkit-text-stroke: 1px var(--accent); -webkit-text-fill-color: transparent;
}
.brand__desc { margin: 0; color: var(--muted); max-width: 46ch; font-size: 14px; line-height: 1.6; }

.topbar__right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.topbar__row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.gpt-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.gpt-links button,
.gpt-links a {
  font: 600 12.5px/1 var(--font-mono); letter-spacing: 0.02em; white-space: nowrap;
  color: var(--muted); text-decoration: none;
  padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255, 255, 255, 0.02); cursor: pointer; transition: 0.18s;
}
.gpt-links button:hover,
.gpt-links a:hover { color: var(--ink); border-color: var(--line-strong); transform: translateY(-1px); }

/* 语言切换：与登录入口同为 30.5px 高的胶囊，保证同一行视觉统一 */
.lang-switch {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(8, 12, 10, 0.6);
}
.lang-switch__item {
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  font: 600 12.5px/1 var(--font-mono); letter-spacing: 0.02em;
  color: var(--muted); padding: 6px 12px; border-radius: 999px; transition: 0.2s;
}
.lang-switch__item:hover { color: var(--ink); }
.lang-switch__item.is-active {
  color: var(--accent-ink);
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px -8px rgba(198, 242, 78, 0.7);
}

/* 分段切换 */
.segmented {
  position: relative; display: inline-flex; padding: 5px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(8, 12, 10, 0.6);
  backdrop-filter: blur(6px);
}
.segmented__rail {
  position: absolute; inset: 5px; border-radius: 999px; pointer-events: none;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px -8px rgba(198, 242, 78, 0.7);
  transform: translateX(calc(var(--active, 2) * (100% + 5px)));
  width: calc((100% - 10px) / 5 - 0px);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  opacity: 0;
}
.segmented__item {
  position: relative; z-index: 1; border: 0; background: transparent; cursor: pointer;
  font: 700 13px/1 var(--font-mono); letter-spacing: 0.02em; color: var(--muted); white-space: nowrap;
  padding: 11px 16px; border-radius: 999px; transition: color 0.25s;
}
.segmented__item:hover { color: var(--ink); }
.segmented__item.is-active { color: var(--accent-ink); }

/* JS 不控制 rail 位移，这里用纯 CSS 高亮活动项 */
.segmented__item.is-active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px -8px rgba(198, 242, 78, 0.7);
}
.segmented__rail { display: none; }

/* ---------- 状态条 ---------- */
.status-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  animation: fadeUp 0.6s 0.06s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.stat {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); position: relative; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--accent), var(--accent-2)); opacity: 0.85;
}
.stat__label { font: 600 11px/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.stat__value { font: 700 22px/1 var(--font-display); color: var(--ink); }
.stat--status .stat__value { font-size: 16px; color: var(--accent-2); }

/* ---------- 工作台 ---------- */
.workspace {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: stretch;
  animation: fadeUp 0.6s 0.12s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.panel {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(10px);
  overflow: hidden;
}
.panel::after {
  content: ''; position: absolute; inset: 0; border-radius: var(--radius); pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.panel--output { background: linear-gradient(180deg, rgba(20, 28, 24, 0.9), rgba(14, 19, 16, 0.82)); }

.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kicker {
  font: 600 11px/1 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent);
}
.panel__title { margin: 8px 0 0; font: 700 20px/1 var(--font-display); letter-spacing: -0.01em; }

/* 传输箭头 */
.transfer-glyph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 0 4px; }
.transfer-glyph__line { width: 2px; height: 40px; background: linear-gradient(var(--accent), transparent); }
.transfer-glyph__line:last-child { background: linear-gradient(transparent, var(--accent)); }
.transfer-glyph__arrow {
  font: 800 26px/1 var(--font-display); color: var(--accent);
  filter: drop-shadow(0 0 10px rgba(198, 242, 78, 0.5));
  animation: nudge 1.8s ease-in-out infinite;
}

/* 文件按钮 */
.file-button {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font: 600 12.5px/1 var(--font-mono); color: var(--ink);
  padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 999px;
  background: rgba(255, 255, 255, 0.03); transition: 0.18s;
}
.file-button:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.file-button input { display: none; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 拖拽区 */
.drop-zone {
  display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: rgba(198, 242, 78, 0.03); transition: 0.2s;
}
.drop-zone:hover { border-color: var(--accent); background: rgba(198, 242, 78, 0.07); }
.drop-zone__title { font: 700 14px/1.2 var(--font-body); }
.drop-zone__hint { font: 500 12px/1.5 var(--font-body); color: var(--muted); }
.drop-zone.is-dragging { border-color: var(--accent); background: rgba(198, 242, 78, 0.12); box-shadow: inset 0 0 0 1px var(--accent); }

/* 代理转换勾选项 */
.option-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.02); font: 600 13px/1 var(--font-mono); color: var(--muted); transition: 0.18s; }
.option-toggle:hover { border-color: var(--accent); color: var(--ink); }
.option-toggle input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; flex: none; border: 1.5px solid var(--line-strong); border-radius: 6px; background: transparent; cursor: pointer; position: relative; transition: 0.18s; }
.option-toggle input:checked { background: linear-gradient(120deg, var(--accent), var(--accent-2)); border-color: transparent; }
.option-toggle input:checked::after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.option-toggle input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 二验修正 */
.repair-upload { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--panel-line); border-radius: var(--radius-sm); background: rgba(142, 240, 168, 0.05); }
.repair-upload__head { display: flex; flex-direction: column; gap: 4px; }
.repair-upload__head strong { font: 700 13.5px/1.2 var(--font-body); }
.repair-upload__head span { font: 500 12px/1.5 var(--font-body); color: var(--muted); }
.status-line { font: 500 12.5px/1.5 var(--font-mono); color: var(--muted); padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); }
.status-line.is-ok { color: var(--ok); background: rgba(95, 227, 154, 0.1); }
.status-line.is-error { color: var(--err); background: rgba(255, 122, 122, 0.1); }

/* 输入输出文本框 */
.io-field {
  width: 100%; min-height: 360px; resize: vertical;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(6, 9, 8, 0.7); color: var(--ink);
  font: 500 13px/1.65 var(--font-mono); letter-spacing: 0.01em;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.io-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(198, 242, 78, 0.12); }
.io-field::placeholder { color: var(--faint); }
/* 面板内的输入/输出框自动撑满剩余高度，使左右两侧底边与父面板对齐；
   由于高度已自适应，手动拖拽缩放不再生效，故关闭 resize 手柄。 */
.panel .io-field { flex: 1 1 auto; resize: none; }

/* ---------- 测活结果 ---------- */
.health-result { display: flex; flex-direction: column; gap: 14px; }
.health-progress { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--panel-line); border-radius: var(--radius-sm); background: rgba(198, 242, 78, 0.05); }
.health-progress__header { display: flex; justify-content: space-between; font: 600 12px/1 var(--font-mono); color: var(--accent-2); }
.health-progress__bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.health-progress__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width 0.4s ease; }

.health-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 10px; }
.health-summary__card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.02); }
.health-summary__card span { font: 600 11px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.health-summary__card strong { font: 700 20px/1 var(--font-display); color: var(--ink); }

.health-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.health-table { width: 100%; border-collapse: collapse; font: 500 12.5px/1.5 var(--font-mono); }
.health-table th, .health-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.health-table th { position: sticky; top: 0; background: var(--panel-solid); color: var(--accent); font-weight: 700; letter-spacing: 0.04em; }
.health-table tbody tr:hover { background: rgba(198, 242, 78, 0.04); }
.health-table tbody td:nth-child(6), .health-table tbody td:nth-child(7) { white-space: normal; }

.health-badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font: 700 11.5px/1 var(--font-mono); letter-spacing: 0.04em; }
.health-badge.is-ok { color: var(--ok); background: rgba(95, 227, 154, 0.14); border: 1px solid rgba(95, 227, 154, 0.4); }
.health-badge.is-error { color: var(--err); background: rgba(255, 122, 122, 0.14); border: 1px solid rgba(255, 122, 122, 0.4); }
.health-badge.is-warning { color: var(--warn); background: rgba(243, 201, 105, 0.14); border: 1px solid rgba(243, 201, 105, 0.4); }

/* ---------- 命令栏 ---------- */
.commandbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.commandbar__brand { font: 600 12px/1 var(--font-mono); color: var(--faint); letter-spacing: 0.04em; }
.commandbar__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }

.button { font: 700 13.5px/1 var(--font-mono); letter-spacing: 0.02em; cursor: pointer; padding: 12px 20px; border-radius: 999px; border: 1px solid transparent; transition: 0.18s; }
.button--solid { color: var(--accent-ink); background: linear-gradient(120deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 10px 26px -12px rgba(198, 242, 78, 0.7); }
.button--solid:hover { transform: translateY(-2px); box-shadow: 0 16px 32px -12px rgba(198, 242, 78, 0.85); }
.button--quiet { color: var(--muted); background: rgba(255, 255, 255, 0.03); border-color: var(--line-strong); }
.button--quiet:hover { color: var(--ink); border-color: var(--accent); transform: translateY(-1px); }

/* ---------- 拖拽遮罩 ---------- */
.drop-overlay { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgba(6, 9, 8, 0.86); backdrop-filter: blur(6px); }
.drop-overlay.is-visible { display: flex; animation: fadeIn 0.2s ease both; }
.drop-overlay__card { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; padding: 48px 64px; border: 2px dashed var(--accent); border-radius: 24px; background: rgba(198, 242, 78, 0.06); }
.drop-overlay__card strong { font: 800 26px/1.1 var(--font-display); color: var(--accent); }
.drop-overlay__card span { font: 500 14px/1.5 var(--font-body); color: var(--muted); }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(6, 9, 8, 0.78); backdrop-filter: blur(8px); }
.modal.is-visible { display: flex; animation: fadeIn 0.22s ease both; }
.modal__panel { width: min(520px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 26px; border: 1px solid var(--panel-line); border-radius: 20px; background: var(--panel-solid); box-shadow: var(--shadow); animation: pop 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
.modal__panel--wide { width: min(640px, 100%); }
.modal__title { margin: 8px 0 0; font: 700 22px/1.1 var(--font-display); }
.modal__desc { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.modal__field { display: flex; flex-direction: column; gap: 8px; }
.modal__field span { font: 600 12px/1 var(--font-mono); letter-spacing: 0.06em; color: var(--muted); }
.modal__field input, .modal__textarea { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(6, 9, 8, 0.7); color: var(--ink); font: 500 13px/1.5 var(--font-mono); outline: none; }
.modal__field input:focus, .modal__textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(198, 242, 78, 0.12); }
.modal__textarea { min-height: 120px; resize: vertical; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); z-index: 60; opacity: 0; pointer-events: none; padding: 12px 20px; border: 1px solid var(--panel-line); border-radius: 999px; background: var(--panel-solid); color: var(--ink); font: 600 13px/1 var(--font-mono); box-shadow: var(--shadow); transition: 0.28s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 页脚介绍（同时充当前端可索引正文） ---------- */
.seo-about {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 4px; padding-top: 20px;
  border-top: 1px solid var(--line); color: var(--faint);
}
.seo-about__title { margin: 0; font: 700 14px/1.3 var(--font-display); color: var(--muted); }
.seo-about__text { margin: 0; max-width: 92ch; font-size: 13px; line-height: 1.75; }
.seo-about__list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; line-height: 1.6; }
.seo-about__list li::marker { color: var(--accent); }

.noscript-note {
  margin: 0; padding: 12px 16px; border-radius: var(--radius-sm);
  border: 1px solid rgba(243, 201, 105, 0.4); background: rgba(243, 201, 105, 0.08);
  color: var(--warn); font-size: 13.5px; line-height: 1.6;
}

/* ---------- 动画 ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(198, 242, 78, 0.6); } 70% { box-shadow: 0 0 0 8px rgba(198, 242, 78, 0); } 100% { box-shadow: 0 0 0 0 rgba(198, 242, 78, 0); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- 响应式 ---------- */
/* 宽屏：工作区撑满视口剩余高度，输入/输出框随之与窗口高度对齐 */
@media (min-width: 981px) {
  .workspace { flex: 1 1 auto; }
}

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .transfer-glyph { flex-direction: row; padding: 4px 0; }
  .transfer-glyph__line { width: 40px; height: 2px; }
  .transfer-glyph__line:first-child { background: linear-gradient(90deg, transparent, var(--accent)); }
  .transfer-glyph__line:last-child { background: linear-gradient(90deg, var(--accent), transparent); }
  .transfer-glyph__arrow { transform: rotate(90deg); }
  .status-strip { grid-template-columns: repeat(2, 1fr); }
  .topbar { align-items: flex-start; }
  .topbar__right { align-items: flex-start; }
  .topbar__row, .gpt-links, .segmented, .lang-switch { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .status-strip { grid-template-columns: 1fr; }
  .io-field { min-height: 280px; }
}
