:root {
  --bg: #0f1114;
  --card: #1a1e24;
  --ink: #f4f4f4;
  --muted: #9aa3ad;
  --accent: #e10600;
  --ok: #2ecc71;
  --warn: #f1c40f;
  --guide: #3ecbff;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.top {
  padding: 16px 18px 8px;
}
.brand { font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.wrap { padding: 8px 16px 32px; max-width: 520px; margin: 0 auto; }
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.06);
}
h1 { margin: 0 0 12px; font-size: 22px; }
.steps { margin: 0 0 16px; padding-left: 18px; color: var(--muted); line-height: 1.5; }
.steps strong { color: var(--ink); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.4; }
.err { color: #ff6b6b; font-size: 13px; margin-top: 10px; }
.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  padding: 14px 16px;
  cursor: pointer;
}
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.2); margin-top: 10px; }
.btn-link { text-align: center; text-decoration: none; margin-top: 12px; }

.foot-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}
.foot-btn {
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.foot-btn.is-on {
  background: #111;
  border-color: #111;
  color: #fff;
}

.view {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 3 / 4;
}
video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guide-prime {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* True A4 portrait: 210×297 → aspect-ratio width/height = 210/297 */
.a4-frame {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 56%;
  width: auto;
  aspect-ratio: 210 / 297;
  left: 10%;
}
.guide-prime.foot-left .a4-frame {
  left: auto;
  right: 10%;
}
.bracket {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--guide);
  border-style: solid;
  border-width: 0;
}
.bracket.tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; }
.bracket.tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; }
.bracket.bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; }
.bracket.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; }
.cross {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
}
.cross::before,
.cross::after {
  content: "";
  position: absolute;
  background: var(--guide);
  left: 50%;
  top: 50%;
}
.cross::before { width: 14px; height: 2px; margin: -1px 0 0 -7px; }
.cross::after { width: 2px; height: 14px; margin: -7px 0 0 -1px; }

/* Long edge facing the foot (inside the A4 frame) */
.side-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--guide);
  box-shadow: 0 0 8px rgba(62, 203, 255, 0.55);
  right: 0;
  left: auto;
}
.guide-prime.foot-left .side-line {
  left: 0;
  right: auto;
}

.meters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.meter {
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 12px;
}
.meter span { display: block; font-size: 11px; color: var(--muted); }
.meter b { font-size: 15px; }
.meter.is-ok b { color: var(--ok); }
.meter.is-bad b { color: var(--warn); }
.result-box {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  line-height: 1.45;
}
.result-box .eu {
  font-size: 40px;
  font-weight: 800;
  margin: 8px 0;
}
[hidden] { display: none !important; }
