:root {
  --bg: #070d18;
  --panel: #101a2c;
  --panel2: #16243c;
  --line: #22344f;
  --fg: #eaf2ff;
  --dim: #93a8c4;
  --accent: #5cd6ff;
  --warn: #ffb45a;
  --bad: #ff7a7a;
  --good: #6ee7a8;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  padding: calc(env(safe-area-inset-top) + 52px) 0 calc(env(safe-area-inset-bottom) + 68px);
  min-height: 100vh;
}

.appbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: rgba(7, 13, 24, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 10px;
  z-index: 30;
}
.appbar h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .5px; }
.badge { font-size: 11px; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }

main { padding: 12px 14px; max-width: 720px; margin: 0 auto; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 10px; letter-spacing: .3px; }

.hint { color: var(--dim); font-size: 12.5px; margin: 8px 0 0; }
.foot { color: var(--dim); font-size: 12px; text-align: center; margin: 14px 6px 4px; }

.filebtn {
  display: block;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  color: var(--accent);
  font-size: 15px;
  background: var(--panel2);
}
.filebtn input { display: none; }
.filebtn:active { background: #1c2c47; }

.videobox { margin-top: 10px; position: relative; }
video { width: 100%; border-radius: 10px; background: #000; display: block; }
.videometa { font-size: 12px; color: var(--dim); margin-top: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--fg);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: #06202e; border-color: var(--accent); font-weight: 600; }

.adv { margin-top: 10px; }
.adv summary { font-size: 13px; color: var(--dim); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; }
select { background: var(--panel2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 14px; }

button.primary, button.ghost, button.mini {
  font: inherit;
  border-radius: 12px;
  cursor: pointer;
}
button.primary {
  width: 100%;
  background: var(--accent);
  color: #06202e;
  border: none;
  font-weight: 600;
  font-size: 16px;
  padding: 14px;
}
button.primary:disabled { background: #24344b; color: #6d829c; }
button.ghost {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 12px;
  font-size: 15px;
}
button.mini {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 9px 12px;
  font-size: 14px;
}

.bar { height: 8px; background: #0a1526; border-radius: 999px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.log { margin: 8px 0 0; padding-left: 18px; color: var(--dim); font-size: 12.5px; }

.stage { position: relative; line-height: 0; }
.stage video { width: 100%; display: block; border-radius: 10px; }
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  pointer-events: none;
}

.controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.controls input[type=range] { flex: 1; accent-color: var(--accent); }
.tcode { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--dim); min-width: 44px; text-align: right; }

.readout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.readout div { background: var(--panel2); border-radius: 10px; padding: 8px 4px; text-align: center; }
.readout b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.readout span { font-size: 11px; color: var(--dim); }

.conclusion { margin: 0 0 10px; font-size: 15px; line-height: 1.7; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { border-top: 1px solid var(--line); padding: 10px 0; display: flex; gap: 10px; align-items: flex-start; }
.checks .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; }
.dot.good { background: var(--good); }
.dot.ok { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.skip { background: #4a5c76; }
.checks .body { flex: 1; }
.checks .name { font-size: 14px; }
.checks .val { font-variant-numeric: tabular-nums; color: var(--dim); font-size: 13px; }
.checks .tip { font-size: 13px; color: var(--dim); margin-top: 3px; }
.checks .tip.bad { color: #ffc7c7; }

.tablewrap { overflow: auto; -webkit-overflow-scrolling: touch; max-height: 260px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel2); color: var(--dim); font-weight: 500; }
th:first-child, td:first-child { text-align: left; }

.btnrow { display: flex; gap: 8px; margin-bottom: 12px; }
.btnrow button { flex: 1; }
.stripbox { margin-top: 10px; }
.stripbox img { width: 100%; border-radius: 10px; display: block; }

.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.hist img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; background: #000; flex: none; }
.hist .meta { flex: 1; font-size: 13.5px; }
.hist .meta small { color: var(--dim); display: block; font-size: 12px; }
.hist .del { background: none; border: none; color: var(--bad); font-size: 18px; padding: 4px 8px; }

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 8px 14px calc(env(safe-area-inset-bottom) + 8px);
  background: rgba(7, 13, 24, 0.94);
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  z-index: 30;
}
.tab {
  flex: 1;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--dim);
  border-radius: 12px;
  padding: 10px;
  font-size: 14px;
}
.tab[aria-pressed="true"] { color: #06202e; background: var(--accent); border-color: var(--accent); font-weight: 600; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 78px);
  background: rgba(20, 32, 52, 0.96);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 50;
  max-width: 88vw;
}
