:root {
  color-scheme: dark;
  --bg: #171719;
  --ink: #f6f3eb;
  --muted: #bbb8b2;
  --yellow: #ffdb37;
  --green: var(--yellow);
  --lime: #ffe884;
  --line: #414043;
  --panel: #242426;
}

body { background: radial-gradient(ellipse at 12% 20%, #28241a, transparent 43%), var(--bg); }
.hivad-header { max-width: 1320px; height: 78px; justify-content: space-between; gap: 16px; }
.hivad-header .brand { color: var(--ink); font-weight: 800; font-size: 24px; gap: 10px; line-height: 1.1; }
.brand img { object-fit: contain; flex: none; }
.brand-number { color: var(--yellow); }
.brand small { display: block; color: var(--muted); font-size: 10px; font-weight: 400; margin-top: 6px; }
.hivad-header .ghost { margin: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; }
.hivad-header .ghost span { margin: 0; border: 1px solid #786724; color: var(--yellow); border-radius: 50%; width: 24px; height: 24px; display: grid; place-items: center; }
main { padding-top: clamp(22px, 4vw, 52px); }

.hivad-dashboard { display: grid; grid-template-columns: 1.12fr 1fr; gap: 18px; }
.hivad-hero, .quick-start { border: 1px solid var(--line); border-radius: 24px; }
.hivad-hero { position: relative; overflow: hidden; display: grid; align-items: center; min-height: 510px; isolation: isolate; background: linear-gradient(135deg,#222225,#18181a); }
.hivad-curves { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--yellow); z-index: -2; opacity: .57; }
.hivad-hero::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(270deg,#1d1d20 8%,#1d1d20ad 42%,transparent 100%); }
.hivad-hero-content { padding: clamp(24px, 5vw, 62px); }
.hivad-hero img { object-fit: contain; display: block; margin-bottom: 20px; }
.hivad-kicker { color: var(--yellow); font-size: 12px; font-weight: 700; }
.hivad-hero h1 { margin: 12px 0; font-size: clamp(38px, 5.1vw, 70px); line-height: 1.15; }
.hivad-hero h1 em { font-style: normal; color: var(--yellow); }
.hivad-hero-content > p:last-child { max-width: 290px; color: #dedad0; }

.quick-start { background: var(--panel); margin: 0; max-width: none; padding: clamp(16px, 3vw, 34px); text-align: start; }
.quick-start h2 { margin: 2px 0 18px; }
.beginner-steps, .capture-mode { max-width: none; }
.beginner-steps li { border-color: var(--line); background: #2d2c2e; }
.beginner-steps li > b { color: var(--yellow); border: 1px solid #796a2b; background: #3b3524; }
.beginner-steps small, .quick-capture-count { color: var(--muted); }
.quick-start .primary { width: 100%; margin: 16px 0 0; }
.quick-capture-count { text-align: center; }
.quick-project-actions { justify-content: start; }
.capture-mode select, #saveName, #fov { border: 1px solid #5c5854; background: #19191b; color: var(--ink); border-radius: 10px; min-height: 44px; padding: 8px 12px; }

.primary, .secondary, .text-btn { min-height: 44px; font-weight: 700; }
.primary { color: #1b1910; background: var(--yellow); border: 1px solid var(--yellow); border-radius: 12px; }
.primary:hover:not(:disabled) { background: #ffe87a; }
.secondary { background: #2e2d30; border: 1px solid #575459; color: var(--ink); border-radius: 10px; }
.secondary:hover:not(:disabled) { border-color: var(--yellow); color: var(--yellow); }
.text-btn { color: var(--yellow); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
.workspace { background: var(--panel); }
.sphere-panel { background: #222225; }
.sphere-wrap { background: radial-gradient(ellipse at center,#ffdb3712,transparent 70%); }
.badge, .coordinates span { color: #e8d985; border-color: #625733; }
.dot.done { background: var(--yellow); }
.dot.active { background: #ffe884; }
.track { background: #444247; }
.track i { background: var(--yellow); }
.eyebrow, .step-label, .tiny-icon, .axis, .flow b { color: var(--yellow); }
.sphere-label, .tip, .topnote, .legend, footer { color: var(--muted); }
.intro { margin-top: 30px; }
.intro h2 { margin: 8px 0; }
.session, .tip, footer { border-color: var(--line); }

dialog { color: var(--ink); background: var(--panel); border: 1px solid #514b3a; }
dialog::backdrop { background: #09090bd9; }
.close, .close-inline { color: var(--ink); }
#camError { color: #ffcf70; }
#camera.guided .shot-feedback:not(:empty) { color: #86e9aa; }
#camera.guided #captureProgress, .coverage-toggle input, #buildProgress { accent-color: var(--yellow); }
#toast { color: var(--ink); background: #302b1f; border: 1px solid #8a7332; }

@media (max-width: 760px) {
  .hivad-dashboard { grid-template-columns: 1fr; gap: 12px; }
  .hivad-hero { min-height: 190px; }
  .hivad-hero-content { padding: 22px; }
  .hivad-hero img { float: left; width: 54px; height: 62px; margin: 0 12px 8px 0; }
  .hivad-hero h1 { font-size: 38px; margin: 4px 0 8px; }
  .hivad-hero h1 br { display: none; }
  .hivad-hero-content > p:last-child { margin-bottom: 0; }
  .hivad-header { height: 66px; }
  .hivad-header .brand { font-size: 20px; }
}

@font-face {
  font-family: 'Hivad Kalameh';
  src: local('Kalameh Variable'), local('Kalameh'),
       url('kalameh-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Hivad Vazirmatn';
  src: url('vazirmatn.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
body {
  font-family: 'Hivad Kalameh', 'Hivad Vazirmatn', Tahoma, sans-serif;
}
button, input, select, textarea { font-family: inherit; }

#quickScan { width: 100%; justify-content: center; margin-top: 9px; }
#quickScan[hidden], #scanSphere[hidden] { display: none; }
.scan-description { display: block; margin-top: 5px; text-align: center; color: var(--muted); }
#scanSphere {
  position: absolute; z-index: 4; inset-block-start: 8px; inset-inline-start: 8px;
  width: min(27%, 124px); height: auto; pointer-events: none;
}
#camera.guided.scanning .coverage-toggle { display: none; }

#liveDialog { width: min(1200px, 100vw); max-width: none; max-height: 100dvh; padding: 0; background: #171719; color: #fff; }
#liveDialog h2 { margin: 0; }
#quickLive { margin-top: 9px; }
.live-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr); gap: 10px; align-items: center; }
.live-viewfinder { position: relative; background: #111; border-radius: 12px; overflow: hidden; height: min(84dvh, 800px); }
.live-viewfinder video { display: block; width: 100%; height: 100%; object-fit: contain; }
#liveArrow { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); font-size: 36px; color: var(--yellow); text-shadow: 0 1px 4px #000; }
#liveMosaic { display: block; width: 100%; height: auto; background: repeating-linear-gradient(135deg,#26262a 0 7px,#303035 7px 14px); border: 1px solid var(--line); border-radius: 8px; }
#liveProgress { width: 100%; margin-top: 8px; accent-color: var(--yellow); }

#liveDialog .camera-head, #liveDialog .camera-actions, #liveHint {
  position: absolute; z-index: 1; margin: 0;
}
#liveDialog .camera-head { inset: 8px 10px auto; pointer-events: none; }
#liveDialog .camera-head h2 { font-size: .95rem; text-shadow: 0 1px 5px #000; }
#liveDialog .camera-head button { pointer-events: auto; }
#liveDialog .camera-actions { inset: auto 8px 8px; display: flex; justify-content: center; gap: 6px; }
#liveDialog .camera-actions button, #liveClose {
  min-height: 44px; padding: 4px 9px; border-radius: 12px;
  background: #161618a8; border: 1px solid #ffffff66; color: #fff;
  backdrop-filter: blur(6px); font-size: .78rem;
}
#liveDialog .camera-actions button:disabled { opacity: .55; }
#liveDialog #livePause, #liveDialog #liveClose { min-width: 44px; }
#livePause svg { width: 23px; height: 23px; vertical-align: middle; fill: currentColor; }
#livePause .play-icon, #livePause[data-paused="true"] .pause-icon { display: none; }
#livePause[data-paused="true"] .play-icon { display: inline-block; }
#liveHint {
  inset: auto 10px 60px; width: fit-content; max-width: calc(100% - 20px);
  margin-inline: auto; padding: 3px 8px; border-radius: 8px;
  background: #151515bc; text-align: center; font-size: .78rem;
}
.live-map { padding: 0 8px; min-width: 0; }
#liveCoverage { margin: 0 0 6px; font-size: .8rem; }
@media (max-width: 720px) and (orientation: portrait) {
  #liveDialog { width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .live-layout { grid-template-columns: 1fr; grid-template-rows: minmax(0,1fr) auto; gap: 6px; height: 100%; }
  .live-viewfinder { height: 100%; border-radius: 0; }
  .live-viewfinder video { object-fit: cover; }
  #liveMosaic { width: 100%; height: clamp(84px, 17dvh, 180px); object-fit: contain; }
  #liveProgress { margin-top: 2px; }
}


#liveLevel {
  position: absolute; inset: 0; pointer-events: none; container-type: size;
}
#liveLevelTarget, #liveLevelCurrent {
  position: absolute; inset: 36% 12%;
  border-radius: 6px; box-shadow: 0 0 0 1px #111a;
}
#liveLevelTarget { border: 2px solid #fff; color: #fff; }
#liveLevelCurrent {
  inset: calc(36% + 3px) calc(12% + 3px);
  border: 2px dashed #ffdb37; color: #ffdb37;
}
#liveLevel.is-level #liveLevelCurrent { border-color: #53e2a0; color: #53e2a0; }
#liveLevelTarget b, #liveLevelCurrent b, #liveLevelStatus {
  position: absolute; padding: 2px 6px; border-radius: 5px;
  background: #151515e8; white-space: nowrap; font-size: .72rem;
}
#liveLevelTarget b { inset: auto 0 calc(100% + 3px) auto; }
#liveLevelCurrent b { inset: calc(100% + 3px) auto auto 0; }
#liveLevelStatus {
  inset: auto 50% 112px auto; transform: translateX(50%);
  color: #fff; text-align: center;
}

#liveLevel.is-far #liveLevelCurrent { border-color: #ff7770; color: #ff7770; }
#liveLevelTarget[data-label] b { display: none; }
#liveLevelTarget[data-label]::before {
  content: attr(data-label); position: absolute; inset: auto 0 calc(100% + 3px) auto;
  padding: 2px 6px; border-radius: 5px; background: #151515e8;
  white-space: nowrap; font-size: .72rem;
}
#liveSpeed {
  position: absolute; inset: 57px 50% auto auto; transform: translateX(50%);
  padding: 2px 7px; border-radius: 5px; background: #151515e8;
  color: #66e9a8; white-space: nowrap; font-size: .72rem;
}
#liveSpeed[data-state="slow"] { color: #ffdb37; }
#liveSpeed[data-state="fast"], #liveLevel.is-far #liveLevelStatus { color: #ff958c; }

#liveLevelStatus { width: max-content; max-width: 94%; white-space: normal; }
