:root {
    --bg: #16181d;
    --panel: #1e2128;
    --panel-2: #242936;
    --line: #2e3340;
    --text: #e6e9ef;
    --dim: #9aa3b2;
    --accent: #3f9e63;
    --accent-dim: #27543a;
    --danger: #c25450;
    --danger-dim: #572a28;
    --warn: #d29a3a;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.55 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
    display: flex;
    flex-direction: column;
  }
  header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }
  header h1 { font-size: 15px; font-weight: 600; }
  .badge {
    font-size: 12px; padding: 2px 9px; border-radius: 4px;
    background: var(--panel-2); border: 1px solid var(--line); color: var(--dim);
    white-space: nowrap;
  }
  .badge.ok { color: #9fd8b4; border-color: #35544a; }
  .badge.bad { color: #e8b0ae; border-color: #5c3a38; }
  main {
    flex: 1; min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 16px;
    padding: 16px 20px;
    align-items: start;
  }
  @media (max-width: 920px) { main { grid-template-columns: 1fr; } }
  #previewWrap {
    position: relative;
    background: #0b0c0f;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 400px;
    max-height: calc(100vh - 120px);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
  }
  #preview { max-width: 100%; max-height: calc(100vh - 152px); display: block; }
  #previewPlaceholder {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: var(--dim); font-size: 13px; padding: 20px; text-align: center;
  }
  #recDot {
    position: absolute; top: 10px; left: 10px;
    display: none; align-items: center; gap: 7px;
    background: rgba(0,0,0,.6); padding: 3px 10px; border-radius: 4px;
    font-size: 12px; letter-spacing: 1px;
  }
  #recDot .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
  #recDot.live .dot { animation: blink 1.2s infinite; }
  #recDot.paused .dot { background: var(--warn); animation: none; }
  @keyframes blink { 50% { opacity: .2; } }
  #timer {
    position: absolute; bottom: 10px; right: 10px;
    font: 600 15px/1.4 Consolas, "Cascadia Mono", monospace;
    background: rgba(0,0,0,.6); padding: 4px 10px; border-radius: 4px;
    display: none;
  }
  aside { display: flex; flex-direction: column; gap: 14px; }
  .card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
  }
  .card h2 {
    font-size: 11px; color: var(--dim); font-weight: 600;
    text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 12px;
  }
  .row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 10px;
  }
  .row:last-child { margin-bottom: 0; }
  .row > label { color: var(--dim); font-size: 13px; }
  select {
    background: var(--panel-2); color: var(--text);
    border: 1px solid var(--line); border-radius: 6px;
    padding: 5px 8px; font-size: 13px; min-width: 150px;
  }
  input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
  .hint { color: var(--dim); font-size: 12px; margin-top: 10px; }
  .btn {
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--panel-2); color: var(--text);
    padding: 9px 14px; font-size: 13px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  }
  .btn:hover:not(:disabled) { border-color: #414a5e; }
  .btn:disabled { opacity: .38; cursor: not-allowed; }
  .btn-primary { background: var(--accent-dim); border-color: var(--accent); color: #eafff2; }
  .btn-primary:hover:not(:disabled) { border-color: #57c281; }
  .btn-danger { background: var(--danger-dim); border-color: var(--danger); color: #ffe9e8; }
  .btn-danger:hover:not(:disabled) { border-color: #d97b77; }
  .btn-row { display: flex; gap: 8px; }
  .btn-row .btn { flex: 1; }
  .btn-row + .btn-row { margin-top: 8px; }
  .status { margin-top: 12px; font-size: 13px; color: var(--dim); min-height: 20px; }
  .status.err { color: #e8b0ae; }
  #recList { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
  .rec-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--panel-2); border: 1px solid var(--line);
    border-radius: 6px; padding: 8px 10px;
  }
  .rec-meta { min-width: 0; }
  .rec-name { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rec-size { font-size: 12px; color: var(--dim); }
  .btn-dl { flex: none; padding: 5px 12px; font-size: 12px; }
.selftest-video { width: 100%; border-radius: 6px; background: #000; display: block; }
.selftest-meta { margin-top: 8px; font-size: 12px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.selftest-verdict { margin-top: 8px; font-size: 13px; font-weight: 600; }
.selftest-verdict.pass { color: #9fd8b4; }
.selftest-verdict.fail { color: #e8b0ae; }
