/* 验机助手 · 深色工具风
   色彩：近黑底 + 单一荧光绿点缀
   圆角规则：容器 16px，内部小块 8px，按钮与胶囊 pill */

:root {
  --bg: #0c0c0e;
  --surface: #16171b;
  --surface-2: #1e2025;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #ededf1;
  --text-dim: #a4a5ad;
  --text-faint: #77787f;
  --accent: #c9f542;
  --accent-ink: #141603;
  --radius: 16px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

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

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

/* ---------- 首页 ---------- */

.hero {
  padding: calc(env(safe-area-inset-top, 0px) + 28px) 20px 0;
  max-width: 760px;
  margin: 0 auto;
}

.frame {
  position: relative;
  padding: 26px 20px;
}

.frame .c {
  position: absolute;
  width: 18px;
  height: 18px;
}

.frame .c-tl { top: 0; left: 0; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.frame .c-tr { top: 0; right: 0; border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.frame .c-bl { bottom: 0; left: 0; border-bottom: 2px solid var(--accent); border-left: 2px solid var(--accent); }
.frame .c-br { bottom: 0; right: 0; border-bottom: 2px solid var(--accent); border-right: 2px solid var(--accent); }

.frame h1 {
  font-size: clamp(26px, 7vw, 36px);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.frame p {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 14px;
}

.tips {
  max-width: 760px;
  margin: 18px auto 0;
  padding: 0 20px;
}

.tips p {
  font-size: 12.5px;
  color: var(--text-faint);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

.cards {
  max-width: 760px;
  margin: 18px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:active { transform: scale(0.97); }

@media (hover: hover) {
  .card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
}

.pv {
  display: block;
  height: 74px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  position: relative;
}

.card-body { display: block; padding: 10px 4px 4px; }

.card-body strong { display: block; font-size: 15px; font-weight: 600; }

.card-body small { display: block; margin-top: 2px; font-size: 12px; color: var(--text-dim); }

/* 卡片预览（均为功能性示意） */

.pv-solid, .pv-cycle { display: flex; flex-wrap: wrap; gap: 6px; align-content: center; justify-content: center; padding: 10px; }

.pv-solid i, .pv-cycle i {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--c);
  border: 1px solid var(--line);
}

.pv-cycle i { position: relative; }

.pv-cycle i:nth-child(1) { z-index: 3; }
.pv-cycle i:nth-child(2) { z-index: 2; margin-left: -8px; }
.pv-cycle i:nth-child(3) { z-index: 1; margin-left: -8px; }

.pv-gray { display: flex; }

.pv-gray .grad {
  flex: 1;
  margin: 14px;
  border-radius: 5px;
  background: linear-gradient(90deg, #ffffff, #000000);
}

.pv-touch { display: flex; align-items: center; justify-content: center; gap: 14px; }

.pv-touch i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.9;
}

.pv-touch i:nth-child(2) { opacity: 0.55; }
.pv-touch i:nth-child(3) { opacity: 0.3; }

.pv-grid {
  background:
    repeating-linear-gradient(0deg, transparent 0 13px, rgba(255, 255, 255, 0.22) 13px 14px),
    repeating-linear-gradient(90deg, transparent 0 13px, rgba(255, 255, 255, 0.22) 13px 14px);
}

.pv-audio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-dim);
}

.pv-audio .vu { display: flex; align-items: flex-end; gap: 3px; height: 30px; }

.pv-audio .vu i {
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}

.pv-audio .vu i:nth-child(1) { height: 10px; }
.pv-audio .vu i:nth-child(2) { height: 18px; }
.pv-audio .vu i:nth-child(3) { height: 28px; }
.pv-audio .vu i:nth-child(4) { height: 18px; }
.pv-audio .vu i:nth-child(5) { height: 10px; }

.pv-vibrate { display: flex; justify-content: center; align-items: flex-end; gap: 4px; padding-bottom: 20px; }

.pv-vibrate i { width: 6px; border-radius: 3px; background: var(--accent); }

.pv-vibrate i:nth-child(1) { height: 14px; }
.pv-vibrate i:nth-child(2) { height: 26px; }
.pv-vibrate i:nth-child(3) { height: 20px; }
.pv-vibrate i:nth-child(4) { height: 10px; }

.pv-check { display: flex; flex-direction: column; justify-content: center; gap: 9px; padding: 0 18px; }

.pv-check i {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  position: relative;
}

.pv-check i::after {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: var(--accent);
}

.foot {
  max-width: 760px;
  margin: 0 auto;
  padding: 26px 20px calc(env(safe-area-inset-bottom, 0px) + 34px);
}

.foot p { font-size: 12px; color: var(--text-faint); }

/* ---------- 沉浸式测试 ---------- */

.test {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  background: #000;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.t-exit {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: calc(env(safe-area-inset-left, 0px) + 12px);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  z-index: 3;
  transition: opacity 0.4s ease;
}

.t-hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  color: #fff;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 2;
  padding: 0 24px;
}

.t-hint.show { opacity: 1; }

.t-counter {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  font-family: var(--mono);
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 6px 12px;
  z-index: 3;
}

.t-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: flex;
  justify-content: center;
  gap: 12px;
  z-index: 3;
}

/* 开场说明浮层 */

.t-intro {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 8, 10, 0.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

@media (prefers-reduced-transparency: reduce) {
  .t-intro { background: rgba(8, 8, 10, 0.97); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

.sheet {
  width: min(430px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
}

.sheet h2 { font-size: 20px; font-weight: 700; }

.sheet-list { list-style: none; margin: 14px 0 4px; }

.sheet-list li {
  position: relative;
  padding-left: 16px;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.sheet-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
}

.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }

/* 按钮体系：主按钮荧光绿、幽灵按钮描边、玻璃按钮用于测试画面之上 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.12s ease;
}

.btn:active { transform: scale(0.96); }

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

.btn.ghost { border: 1px solid var(--line-strong); color: var(--text); }

.btn.glass {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 10px 22px;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 16px;
}

.seg-btn {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-dim);
}

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

/* 灰阶模式 */

.gmode { position: absolute; inset: 0; }

#gray-fade { background: linear-gradient(#ffffff 0%, #000000 100%); }

#gray-steps { display: flex; flex-direction: column; }

#gray-steps i { flex: 1; }

.gcolor { display: flex; flex-direction: column; }

.gcolor i { flex: 1; }

.gcolor i:nth-child(1) { background: linear-gradient(90deg, #ff0000, #000000); }
.gcolor i:nth-child(2) { background: linear-gradient(90deg, #00ff00, #000000); }
.gcolor i:nth-child(3) { background: linear-gradient(90deg, #0000ff, #000000); }

/* 网格 */

.grid-stage {
  --gl: rgba(255, 255, 255, 0.22);
  --gm: rgba(255, 255, 255, 0.5);
  position: absolute;
  inset: 0;
  background-color: #000;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 127px, var(--gm) 127px 128px),
    repeating-linear-gradient(90deg, transparent 0 127px, var(--gm) 127px 128px),
    repeating-linear-gradient(0deg, transparent 0 31px, var(--gl) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, var(--gl) 31px 32px);
  transition: background-color 0.25s ease;
}

.grid-stage.invert {
  --gl: rgba(0, 0, 0, 0.24);
  --gm: rgba(0, 0, 0, 0.55);
  background-color: #fff;
}

.grid-stage .gx,
.grid-stage .gy {
  position: absolute;
  background: var(--gm);
}

.grid-stage .gx { left: 0; right: 0; top: 50%; height: 1px; }

.grid-stage .gy { top: 0; bottom: 0; left: 50%; width: 1px; }

.grid-stage .gr {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72px;
  height: 72px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--gm);
  border-radius: 50%;
}

/* 触摸测试画布 */

#touch-trail,
#touch-live {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#touch-live { z-index: 1; }

/* ---------- 工具页 ---------- */

.page {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  z-index: 10;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.page-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
  background: rgba(12, 12, 14, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.page-head h1 { font-size: 17px; font-weight: 700; flex: 1; }

.back {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  font-size: 22px;
  line-height: 1;
  color: var(--text);
  padding-bottom: 2px;
}

.linklike { font-size: 13px; color: var(--text-dim); padding: 8px; }

.linklike.arm { color: var(--accent); font-weight: 600; }

.page-body {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 20px calc(env(safe-area-inset-bottom, 0px) + 40px);
}

.note {
  font-size: 13px;
  color: var(--text-dim);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  margin-bottom: 18px;
}

.pad-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 18px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform 0.12s ease, background 0.2s ease;
}

.pad:active { transform: scale(0.96); }

.pad span { font-size: 15px; font-weight: 600; }

.pad small { font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }

.pad.active { background: var(--accent); border-color: var(--accent); }

.pad.active span, .pad.active small { color: var(--accent-ink); }

.status {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 16px;
}

/* 验机清单 */

.ck-progress { margin-bottom: 16px; }

.ck-bar {
  height: 3px;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 8px;
}

.ck-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.ck-group { margin-bottom: 16px; }

.ck-group h3 {
  font-size: 12.5px;
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0.08em;
  margin: 0 4px 8px;
}

.ck-items {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.ck-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
}

.ck-item + .ck-item { border-top: 1px solid var(--line); }

.ck-item input { position: absolute; opacity: 0; pointer-events: none; }

.ck-box {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: transparent;
  transition: background 0.15s ease;
}

.ck-item input:checked ~ .ck-box {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.ck-item input:checked ~ .ck-label { color: var(--text-faint); }

.ck-label { font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .card, .btn, .pad, .t-hint, .ck-bar i, .grid-stage, .t-exit { transition: none; }
}
