/* 能力总线 —— 红底控制台
   tokens: 一个强调色（琥珀），红色只做场，不用渐变霓虹。
   圆角分级：勾选框 6 / 行 12 / 状态条 14 / 面板 20。 */

:root {
  --red-2: #c1121f;
  --red-1: #8e0e1a;
  --red-0: #4e0710;

  --ink: #160a0d;
  --ink-2: #1d0e12;

  --text: #f7eeea;
  --muted: rgba(247, 238, 234, 0.66);
  --muted-2: rgba(247, 238, 234, 0.4);

  --line: rgba(255, 236, 232, 0.13);
  --line-strong: rgba(255, 236, 232, 0.28);

  --amber: #ffb020;
  --amber-hi: #ffd07a;
  --amber-ink: #2a1206;

  --r-box: 6px;
  --r-row: 12px;
  --r-status: 14px;
  --r-deck: 20px;
  --r-btn: 10px;

  --font-sans: "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;

  --shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.75), 0 2px 0 rgba(255, 255, 255, 0.04) inset;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(115% 85% at 10% -12%, #d4162a 0%, #a80f1e 34%, #7a0b16 64%, var(--red-0) 100%)
    fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 织纹 + 底部压暗，让红色不是一块平涂 */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px),
    radial-gradient(90% 55% at 50% 118%, rgba(0, 0, 0, 0.5), transparent 72%);
}

.shell {
  position: relative;
  max-width: 1120px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 68px) clamp(18px, 4vw, 44px) clamp(40px, 7vw, 80px);
  display: grid;
  align-content: center;
  gap: clamp(26px, 4vw, 52px);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 960px) {
  .shell {
    grid-template-columns: minmax(0, 1fr) minmax(0, 528px);
    align-items: center;
  }
  .console {
    grid-column: 2;
    grid-row: 1;
  }
}

/* ----------  masthead  ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 clamp(14px, 2.4vw, 22px);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 236, 228, 0.72);
}

.pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(255, 176, 32, 0.8);
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.14;
  letter-spacing: -0.01em;
  font-weight: 700;
  text-wrap: balance;
}

.lede {
  margin: 0;
  max-width: 34ch;
  font-size: clamp(14.5px, 1.5vw, 16px);
  line-height: 1.8;
  color: var(--muted);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 4vw, 40px);
  margin: clamp(26px, 4vw, 40px) 0 0;
  padding: 0;
}

.facts div {
  margin: 0;
}

.facts dt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.facts dd {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: #ffeadf;
}

/* ----------  控制台  ---------- */

.console {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--r-deck);
  background: linear-gradient(180deg, rgba(26, 12, 16, 0.97), rgba(16, 7, 10, 0.99));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 0 12px;
  background: rgba(0, 0, 0, 0.3);
  border-right: 1px solid var(--line);
}

.rail-seg {
  flex: 1 1 0;
  min-height: 20px;
  margin: 0 11px;
  border-radius: 2px;
  background: rgba(255, 236, 232, 0.055);
  transition: background 0.28s ease, box-shadow 0.28s ease;
}

.rail-seg.on {
  background: linear-gradient(180deg, var(--amber-hi), var(--amber));
  box-shadow: 0 0 16px rgba(255, 176, 32, 0.5);
}

.rail-label {
  flex: 0 0 auto;
  writing-mode: vertical-rl;
  padding-top: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.34em;
  color: var(--muted-2);
  text-align: center;
}

@media (max-width: 719px) {
  .console {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    display: none;
  }
}

.deck {
  padding: clamp(16px, 2.6vw, 24px);
}

.deck-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.deck-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #ffefe9;
}

.counter {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.features {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 7px;
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-row);
  background: rgba(255, 255, 255, 0.022);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.row:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
}

.row.is-on {
  border-color: rgba(255, 176, 32, 0.45);
  background: rgba(255, 176, 32, 0.075);
}

.row:has(.cb:focus-visible) {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.row.is-locked {
  cursor: default;
  opacity: 0.62;
}

/* 原生 checkbox 保留在无障碍树里，视觉用 .box 承担 */
.cb {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.cb:disabled {
  cursor: default;
}

.box {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(247, 238, 234, 0.4);
  border-radius: var(--r-box);
  background: rgba(0, 0, 0, 0.28);
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tick {
  width: 15px;
  height: 15px;
  color: var(--amber-ink);
  stroke-width: 3;
  opacity: 0;
  transform: scale(0.65);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.is-on .box {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 18px rgba(255, 176, 32, 0.32);
}

.is-on .tick {
  opacity: 1;
  transform: none;
}

.glyph {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: rgba(255, 236, 228, 0.55);
}

.glyph svg {
  width: 20px;
  height: 20px;
}

.is-on .glyph {
  color: var(--amber-hi);
}

.meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff2ec;
}

.desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.idx {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

/* 320~360 的窄屏：让位给中文说明，序号退场 */
@media (max-width: 364px) {
  .idx {
    display: none;
  }
  .row {
    padding: 11px 11px;
    gap: 10px;
  }
}

/* ----------  操作区  ---------- */

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.btn {
  min-height: 48px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.14s ease, box-shadow 0.18s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--amber);
  color: var(--amber-ink);
  box-shadow: 0 10px 26px -12px rgba(255, 176, 32, 0.9);
}

.btn-primary:hover:not(:disabled) {
  background: #ffc451;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: rgba(247, 238, 234, 0.15);
  color: rgba(247, 238, 234, 0.42);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  border-color: rgba(247, 238, 234, 0.3);
  color: #f7eeea;
}

.btn-ghost:hover {
  background: rgba(247, 238, 234, 0.09);
}

.hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

/* ----------  运行状态  ---------- */

.status {
  margin-top: 16px;
  padding: 14px 15px 13px;
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 176, 32, 0.42);
  border-radius: var(--r-status);
  background: linear-gradient(180deg, rgba(255, 176, 32, 0.13), rgba(255, 176, 32, 0.045));
  animation: rise 0.28s ease both;
}

.status[hidden] {
  display: none;
}

.status[data-state="stopped"] {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

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

.status-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff4e6;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 1.9s ease-out infinite;
}

.status[data-state="stopped"] .dot {
  background: rgba(247, 238, 234, 0.45);
  animation: none;
}

.timer {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: #ffd9a6;
}

.status[data-state="stopped"] .timer {
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 5px 10px;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid rgba(255, 176, 32, 0.36);
  border-radius: 999px;
  color: #ffe3b8;
  background: rgba(0, 0, 0, 0.22);
}

.status[data-state="stopped"] .chip {
  border-color: var(--line);
  color: var(--muted);
}

.status-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(255, 231, 209, 0.72);
}

.status[data-state="stopped"] .status-sub {
  color: var(--muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.55);
  }
  70% {
    box-shadow: 0 0 0 11px rgba(255, 176, 32, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 176, 32, 0);
  }
}

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