:root {
  --bg: #0b1418;
  --bg-card: #122025;
  --bg-soft: #1a2b31;
  --line: #2a424a;
  --text: #e7f2f4;
  --muted: #8aa3ab;
  --accent: #3ee0c0;
  --warn: #f0c14b;
  --bad: #ef6b6b;
  --good: #3ee0c0;
  --live: #ff4d4d;
  --radius: 14px;
  --pad: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro TW", "PingFang TC", "Noto Sans TC", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { padding: calc(12px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
h1 { font-size: 1.25rem; margin: 0 0 4px; letter-spacing: 0.02em; }
h2 { font-size: 1.02rem; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 0.88rem; margin: 0 0 16px; line-height: 1.45; }
.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad); margin-bottom: 14px; }
label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }
input[type="text"] {
  width: 100%; padding: 12px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); font-size: 1rem;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button {
  appearance: none; border: 0; border-radius: 12px; padding: 12px 16px;
  font-size: 1rem; font-weight: 600; background: var(--accent); color: #06221c;
  cursor: pointer; min-height: 44px;
}
button.secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--line); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.stop { background: var(--bad); color: #fff; }
.live-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: #3a1212; color: #ffd0d0; border-radius: 999px;
  padding: 4px 10px; font-weight: 700; font-size: 0.8rem;
  letter-spacing: 0.08em; visibility: hidden;
}
.live-badge.on { visibility: visible; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--live);
  box-shadow: 0 0 0 0 rgba(255,77,77,0.7);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,77,77,0.6); }
  70% { box-shadow: 0 0 0 8px rgba(255,77,77,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,77,77,0); }
}
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--bg-soft); border-radius: 12px; padding: 10px 12px;
  min-height: 64px;
}
.stat .k { color: var(--muted); font-size: 0.75rem; }
.stat .v { font-size: 1.15rem; font-weight: 700; margin-top: 4px; word-break: break-all; }
.stat.wide { grid-column: 1 / -1; }
.caps { font-size: 0.86rem; line-height: 1.55; color: var(--text); }
.caps div { display: flex; gap: 8px; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.caps span.k { color: var(--muted); flex: 0 0 42%; }
.caps span.v { text-align: right; flex: 1; word-break: break-word; }
details summary { cursor: pointer; font-weight: 600; }
.note { color: var(--muted); font-size: 0.82rem; line-height: 1.5; margin: 8px 0 0; }
.warn { color: var(--warn); }
.ok { color: var(--good); }
.bad { color: var(--bad); }
.log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem; background: #071014; border-radius: 10px;
  padding: 10px; max-height: 180px; overflow: auto; white-space: pre-wrap;
  color: #b7d0d6;
}
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
a { color: var(--accent); }
.ios-hint { background: #1c2a1a; border: 1px solid #2f4a2c; color: #d5e8c8; }
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
progress { width: 100%; height: 8px; }
@media (min-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .stat.wide { grid-column: auto; }
}

/* 長時間測試（第 8 版） */
input[type="number"] {
  width: 100%; padding: 12px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); font-size: 1rem;
}
.lt-check {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 8px 0; font-size: 0.92rem; color: var(--text); cursor: pointer;
}
.lt-check input { margin-top: 3px; flex: 0 0 auto; }
.lt-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.lt-hero-item {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px 12px 10px;
  min-height: 76px;
}
.lt-hero-item .k { color: var(--muted); font-size: 0.75rem; }
.lt-hero-item .v {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: 0.02em;
  word-break: break-all;
}
.lt-resume {
  background: #3a2a10;
  border: 1px solid #6a5020;
  color: #f3e2b8;
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
}
.lt-bat-panel {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0 4px;
}
.lt-dim-overlay {
  position: fixed;
  left: 0; right: 0; top: 0; bottom: 0;
  background: #000;
  color: #4a4a4a;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.lt-dim-overlay[hidden] { display: none; }
.lt-dim-inner { max-width: 360px; transition: none; animation: none; }
.lt-dim-state { font-size: 0.95rem; color: #555; letter-spacing: 0.08em; }
.lt-dim-meta { margin-top: 6px; font-size: 0.85rem; color: #4a4a4a; }
.lt-dim-small { margin-top: 14px; font-size: 0.7rem; color: #444; line-height: 1.5; }
.lt-dim-exit {
  background: #000; color: #444; border: 1px solid #222; border-radius: 6px;
  font-size: 0.7rem; padding: 2px 8px; margin-left: 6px; min-height: 0; width: auto;
}
.lt-power-note { color: var(--muted); font-size: 0.78rem; }
body.lt-dim-on { background: #000; }
body.lt-dim-on .live-dot, body.lt-dim-on * { animation: none !important; transition: none !important; }
@media (min-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr 1fr; }
  .stat.wide { grid-column: auto; }
}

/* 長時間測試（第 8 版） */
input[type="number"] {
  width: 100%; padding: 12px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-soft); color: var(--text); font-size: 1rem;
}
.lt-check {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 8px 0; font-size: 0.92rem; color: var(--text); cursor: pointer;
}
.lt-check input { margin-top: 3px; flex: 0 0 auto; }
.lt-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.lt-hero-item {
  background: var(--bg-soft);
  border-radius: 12px;
  padding: 12px 12px 10px;
  min-height: 76px;
}
.lt-hero-item .k { color: var(--muted); font-size: 0.75rem; }
.lt-hero-item .v {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: 0.02em;
  word-break: break-all;
}
.lt-resume {
  background: #3a2a10;
  border: 1px solid #6a5020;
  color: #f3e2b8;
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
}
.lt-bat-panel {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0 4px;
}
.lt-dim-overlay {
  position: fixed;
  left: 0; right: 0; top: 0; bottom: 0;
  background: #000;
  color: #4a4a4a;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.lt-dim-overlay[hidden] { display: none; }
.lt-dim-inner { max-width: 420px; }
.lt-dim-k { font-size: 0.8rem; letter-spacing: 0.12em; margin-bottom: 8px; color: #3a3a3a; }
.lt-dim-runtime { font-size: 2.4rem; font-weight: 700; color: #5a5a5a; letter-spacing: 0.06em; }
.lt-dim-meta { margin-top: 10px; font-size: 0.95rem; color: #454545; }
.lt-dim-hint { margin-top: 28px; font-size: 0.8rem; color: #333; line-height: 1.5; }
body.lt-dim-on { background: #000; }
@media (min-width: 560px) {
  .lt-hero { grid-template-columns: 1fr 1fr 1fr; }
}
