:root {
  --bg-0: #06070a;
  --bg-1: #0b1220;
  --bg-2: #17394a;
  --glass: rgba(10, 14, 20, 0.46);
  --glass-strong: rgba(8, 12, 18, 0.82);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.3);
  --text: #f8fbff;
  --muted: rgba(248, 251, 255, 0.72);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(60, 138, 173, 0.32), transparent 36%),
    radial-gradient(circle at bottom, rgba(250, 184, 83, 0.1), transparent 32%),
    linear-gradient(180deg, #07090d 0%, #0c1620 38%, #0a1119 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  touch-action: manipulation;
  overscroll-behavior: none;
}

.app-shell {
  width: 100%;
  height: 100%;
}

.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
}

.hidden {
  display: none;
}

.phone-shell {
  position: relative;
  width: min(100%, 440px);
  height: min(100%, 920px);
  border-radius: 34px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(72, 159, 195, 0.22), transparent 40%),
    linear-gradient(180deg, #071118 0%, #0a1b24 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  isolation: isolate;
}

.camera-screen.is-live .phone-shell {
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

.camera-screen video,
.viewer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera-screen video {
  object-fit: cover;
  background:
    radial-gradient(circle at center, rgba(42, 100, 120, 0.38), transparent 38%),
    linear-gradient(180deg, #0a1720 0%, #081217 100%);
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.22;
  transition: opacity 180ms ease;
}

.camera-screen.is-live .ambient-grid {
  opacity: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.06) 32%, rgba(0, 0, 0, 0.56) 100%);
}

.top-stack {
  display: grid;
  gap: 10px;
}

.brand-row,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-mark,
.chip,
.status-pill,
.ghost-btn,
.dock-btn {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 16, 0.52);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
}

.status-pill {
  max-width: calc(100% - 122px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ghost-btn {
  min-height: 38px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 16, 0.42);
  color: var(--muted);
  border-radius: 999px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 0.78rem;
}

.guide-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.hex-guide {
  position: relative;
  width: min(72vw, 290px);
  aspect-ratio: 1;
}

.hex-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.hex-svg polygon {
  fill: rgba(255, 255, 255, 0.02);
  stroke: rgba(255, 255, 255, 0.62);
  stroke-width: 1.2;
  filter: drop-shadow(0 0 20px rgba(95, 193, 255, 0.12));
}

.hex-node,
.top-node {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(9, 14, 22, 0.64);
  color: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.hex-node {
  width: 16px;
  height: 16px;
}

.top-node {
  top: 11%;
  left: 50%;
  min-width: 42px;
  height: 26px;
  padding: 0 10px;
  transform: translate(-50%, -50%);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.node-0 {
  top: 4%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.node-1 {
  top: 25%;
  left: 86%;
  transform: translate(-50%, -50%);
}

.node-2 {
  top: 75%;
  left: 86%;
  transform: translate(-50%, -50%);
}

.node-3 {
  top: 96%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.node-4 {
  top: 75%;
  left: 14%;
  transform: translate(-50%, -50%);
}

.node-5 {
  top: 25%;
  left: 14%;
  transform: translate(-50%, -50%);
}

.hex-node.is-done,
.top-node.is-done {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.95);
  color: #081118;
}

.hex-node.is-current,
.top-node.is-current {
  background: linear-gradient(180deg, #ffbf8d 0%, #ff8e54 100%);
  border-color: rgba(255, 245, 235, 0.98);
  color: #201108;
  transform: translate(-50%, -50%) scale(1.18);
}

.top-node.is-current {
  transform: translate(-50%, -50%) scale(1.06);
}

.crosshair,
.crosshair::before {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.45);
}

.crosshair {
  width: 1px;
  height: 100%;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.crosshair::before {
  width: 100vw;
  max-width: 100%;
  height: 1px;
  left: -50vw;
  top: 50%;
  transform: translateY(-50%);
}

.aim-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #ffffff 0%, #ffd8ba 48%, #ff9c64 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  animation: pulse-dot 1.9s ease-in-out infinite;
}

.hint-block {
  display: flex;
  justify-content: center;
  padding-inline: 10px;
}

.hint {
  margin: auto 0 92px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 9, 14, 0.42);
  color: var(--text);
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.35;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.control-dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.dock-btn {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.dock-btn:active:not(:disabled),
.ghost-btn:active:not(:disabled),
.shutter:active:not(:disabled) {
  transform: scale(0.98);
}

.dock-btn:disabled,
.ghost-btn:disabled,
.shutter:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dock-btn.secondary {
  justify-self: start;
  color: var(--text);
  background: rgba(8, 12, 18, 0.54);
}

.dock-btn.primary {
  justify-self: end;
  color: #0a1015;
  background: rgba(255, 255, 255, 0.96);
  border-color: transparent;
}

.shutter {
  justify-self: center;
  width: 96px;
  height: 96px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.shutter::before {
  content: "";
  display: block;
  width: 70px;
  height: 70px;
  margin: 11px auto;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff 0%, #eff3f8 100%);
}

.result-screen .phone-shell {
  background: #030508;
}

.result-head {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 14px;
  z-index: 2;
}

.viewer {
  background:
    radial-gradient(circle at center, rgba(62, 112, 140, 0.22), transparent 42%),
    linear-gradient(180deg, #020407 0%, #0a1119 100%);
}

.viewer canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.result-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 12px 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
  background: linear-gradient(180deg, rgba(4, 6, 10, 0) 0%, rgba(4, 6, 10, 0.92) 54%);
}

@keyframes pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 165, 121, 0.18);
  }

  50% {
    box-shadow: 0 0 0 12px rgba(255, 165, 121, 0);
  }
}

@media (max-width: 768px) {
  .screen {
    padding: 0;
  }

  .phone-shell {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: 0;
  }

  .status-pill {
    max-width: calc(100% - 112px);
  }

  .hint {
    margin-bottom: 82px;
  }

  .hex-guide {
    width: min(74vw, 296px);
  }

  .control-dock {
    gap: 10px;
  }

  .dock-btn {
    font-size: 0.86rem;
    padding-inline: 12px;
  }
}
