:root {
  --primary: #2c7be5;
  --primary-tint: #dbecff;
  --error: #c62828;
  --surface: #ffffff;
  --surface-alt: #f3f3f3;
  --text: #1f1f1f;
  --text-secondary: #555555;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  background: var(--surface-alt);
  color: var(--text);
  font-family: var(--font);
}

body {
  min-height: 100dvh;
}

.start-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface-alt);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: #ffffff;
  border-bottom: 1px solid #d8d8d8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}

.brand-sub {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #800000;
  border-left: 1px solid #d8d8d8;
  padding-left: 10px;
  line-height: 1.1;
}

.start-main {
  flex: 1;
  max-width: 28rem;
  margin: 0 auto;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
}

h1 {
  margin: 0 0 12px;
  font-size: 1.6rem;
  line-height: 1.2;
}

.lead {
  margin: 0 0 22px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.hint {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.version {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.error {
  margin: 14px 0 0;
  color: var(--error);
  font-size: 14px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  min-height: 46px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  background: #e9ecef;
  color: #7a7a7a;
  cursor: default;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
}

.btn.small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
}

.measure-view {
  position: fixed;
  inset: 0;
  background: #000;
  overflow: hidden;
}

.viewfinder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #111;
}

.crosshair {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 2;
}

.crosshair-horizon {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 0 2px #000;
}

.crosshair-svg {
  width: min(42vw, 42vh, 220px);
  height: auto;
  overflow: visible;
}

.crosshair-svg circle,
.crosshair-svg line {
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  filter: drop-shadow(0 0 2px #000);
}

.crosshair-svg circle:last-child {
  fill: #fff;
  stroke: none;
}

.hud-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
  color: #fff;
}

.hud-brand {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px #000;
}

.hud-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.hud-readout {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  text-align: center;
  color: #fff;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), transparent);
  pointer-events: none;
}

.hold-badge {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffe082;
}

.angle-value {
  margin: 0;
  font-size: clamp(3.4rem, 16vw, 5.4rem);
  font-weight: 700;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 10px #000;
}

.angle-unit {
  margin: 6px 0 0;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e8e8e8;
}

.sensor-status {
  margin: 8px 0 0;
  font-size: 13px;
  color: #ffe082;
}
