/* modules.css — 站点 A 专有模块样式（键盘 / 屏幕 / 摄像头 / 触控板） */

/* ---------- 键盘测试 ---------- */
.kb { display: flex; flex-direction: column; gap: 6px; margin: var(--space-4) 0; overflow-x: auto; padding: 2px 2px 10px; }
.kb-row { display: flex; gap: 6px; }
.key {
  min-width: 36px; height: 38px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--text-xs); color: var(--text-muted);
  transition: background .12s ease, color .12s ease, transform .08s ease;
  user-select: none;
}
.key:hover { background: var(--surface-3); }
.key.is-tested { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.key.is-pressed { background: var(--accent); color: var(--accent-text); transform: translateY(1px); border-bottom-width: 1px; }
.kb-progress-wrap { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.kb-progress { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.kb-history { min-height: 24px; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-faint); }

/* ---------- 屏幕测试覆盖层 ---------- */
.screen-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center;
}
.screen-hint {
  margin: 14px auto; display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; justify-content: center;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px;
  opacity: .22; transition: opacity .2s ease;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.screen-hint:hover { opacity: 1; }
.screen-hint-actions { display: flex; gap: 6px; }
.screen-hint .btn { height: 26px; padding: 0 10px; font-size: 12px; background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .28); border-radius: 999px; }
.screen-overlay[data-pattern="black"] .screen-hint,
.screen-overlay[data-pattern="gray25"] .screen-hint { background: rgba(255, 255, 255, .2); color: #111; }
.screen-overlay[data-pattern="black"] .screen-hint .btn,
.screen-overlay[data-pattern="gray25"] .screen-hint .btn { background: rgba(0, 0, 0, .18); color: inherit; border-color: rgba(0, 0, 0, .3); }
.screen-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, rgba(255, 0, 0, .5) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 0, 0, .5) 1px, transparent 1px);
  background-size: 40px 40px;
}
.screen-text { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; color: #fff; text-shadow: 0 0 2px #000; }
.screen-motion { position: absolute; inset: 0; pointer-events: none; display: flex; align-items: center; }
.motion-box { width: 100px; height: 100px; background: #fff; border: 4px solid #000; }

/* ---------- 摄像头 ---------- */
.cam-stage {
  position: relative;
  background: #05060a; border-radius: var(--r-lg); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 320px; margin-bottom: var(--space-3);
  border: 1px solid var(--border);
}
.cam-stage video { width: 100%; max-height: 520px; display: block; object-fit: contain; }
.cam-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  border-radius: inherit;
}

/* ---------- 触控板 ---------- */
.tp-area {
  margin-top: var(--space-4); padding: var(--space-7); text-align: center;
  border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface-inset); color: var(--text-muted);
  transition: border-color .15s ease, background .15s ease;
}
.tp-area:hover { border-color: var(--accent); }
.tp-area:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tp-result { font-family: var(--font-mono); font-size: var(--text-sm); }
.tp-result.ok { color: var(--success); }
.tp-result.warn { color: var(--warning); }
.tp-result.err { color: var(--danger); }

/* 声道测试 */
.sp-channels { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin: var(--space-4) 0; }
.sp-channel {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: var(--space-5) var(--space-3);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface-2); cursor: pointer; color: var(--text);
  transition: all .15s ease;
}
.sp-channel:hover { border-color: var(--accent); background: var(--accent-soft); }
.sp-channel[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.sp-channel[aria-pressed="true"] .sp-ch-name { color: var(--accent-text); }
.sp-ch-icon { font-size: 26px; line-height: 1; opacity: .9; }
.sp-ch-name { font-size: var(--text-sm); font-weight: 600; }
.sp-ch-desc { font-size: var(--text-xs); color: var(--text-muted); text-align: center; }
.sp-channel[aria-pressed="true"] .sp-ch-desc { color: rgba(255, 255, 255, .8); }
@media (max-width: 720px) { .sp-channels { grid-template-columns: 1fr; } }

/* 输出电平表：把「有没有声音」变成看得见的横向条 */
.level-meter {
  position: relative; height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--track); margin-top: 10px;
}
.level-meter-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 62%, var(--warning) 84%, var(--danger) 100%);
  transition: width .06s linear;
}
.level-meter.is-clip .level-meter-fill { background: var(--danger); }
.level-meter-legend {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: var(--text-xs); color: var(--text-faint);
}
