:root {
  --bg: #0a0e1a;
  --surface: #111827;
  --surface2: #1e293b;
  --border: #2d3748;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --accent: #6366f1;
  --blue: #3b82f6;
  --teal: #14b8a6;
  --pink: #ec4899;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.logo { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.logo span { color: var(--accent); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #9a9aa3;
}
.brand:hover { color: #f2f2f5; }
.brand-logo { height: 18px; width: auto; filter: brightness(1.5) saturate(1.1); }
.brand-name { font-weight: 900; color: #f2f2f5; }
.brand-name .brand-os { color: #ff2dcb; }
.app-name { font-size: 14px; color: var(--text-muted); margin-left: 6px; padding-left: 10px; border-left: 1px solid var(--border); }

main {
  padding: 24px 20px 60px;
  max-width: 480px;
  margin: 0 auto;
}

.mode-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

.mode-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 20px;
  text-decoration: none;
  color: var(--text);
}

.mode-card h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.mode-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.mode-card.player h2 { color: var(--amber); }
.mode-card.measure h2 { color: var(--accent); }
.mode-card.spl h2 { color: var(--green); }
.mode-card.imp h2 { color: var(--blue); }
.mode-card.cv h2 { color: var(--teal); }
.mode-card.led h2 { color: var(--pink); }

.note {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--surface2);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-stop {
  background: var(--red);
  border-color: var(--red);
  color: white;
}

.btn-block {
  display: flex;
  width: 100%;
  margin-top: 8px;
}

.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
}

/* ── Player mode ── */
.player-screen {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.02s linear;
}

.player-screen.flash {
  background: #fff;
}

.player-hud {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.player-screen.flash .player-hud {
  color: rgba(0,0,0,0.4);
}

.player-controls {
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 3;
}

.interval-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.interval-row input {
  width: 60px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: center;
}

/* ── Measure mode ── */
.camera-wrap {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reading {
  margin-top: 20px;
  text-align: center;
}

.reading .value {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.reading .direction {
  font-size: 16px;
  color: var(--text-muted);
  margin-top: 4px;
}

.reading .meta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.controls-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.controls-row .btn { flex: 1; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}

.status-dot.live { background: var(--green); }

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted);
  justify-content: center;
}
