:root {
  color-scheme: light;
  --page: #fff9f0;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-soft: #edf8fc;
  --ink: #202124;
  --muted: #687278;
  --line: rgba(37, 134, 173, 0.2);
  --brand: #2586ad;
  --brand-bright: #48aed0;
  --action: #155f7b;
  --action-edge: #0d485e;
  --action-ink: #f8fdff;
  --level: #167b68;
  --near: #9a641b;
  --adjust: #a44e3f;
  --shadow: 0 20px 52px rgba(31, 104, 133, 0.11);
  --radius-card: 22px;
  --radius-control: 14px;
  --font: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 84% 3%, rgba(72, 174, 208, 0.14), transparent 28rem),
    radial-gradient(circle at 8% 82%, rgba(255, 220, 176, 0.16), transparent 24rem),
    var(--page);
  color: var(--ink);
  font-family: var(--font);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(72, 174, 208, 0.42);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.level-app {
  width: min(100%, 520px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  min-height: 44px;
}

.back-link,
.topbar-action {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--brand);
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(37, 134, 173, 0.07);
}

.back-link {
  font-size: 32px;
  line-height: 1;
}

.topbar-action {
  justify-self: end;
  padding: 0;
  font-size: 16px;
  font-weight: 850;
}

.brand-logo {
  width: 104px;
  height: auto;
  justify-self: center;
  mix-blend-mode: multiply;
}

.flow-view {
  min-height: calc(100dvh - 150px);
  padding: 20px 0 8px;
}

.entry-view {
  padding-top: 42px;
}

.intro {
  padding: 0 4px 24px;
}

.tool-label {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
}

.intro h1,
.process-copy h1,
.calibration-prep-copy h1,
.placement-copy h1,
.result-card h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(36px, 10vw, 48px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.intro > p:last-child,
.process-copy > p:last-child,
.result-card > p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.entry-status,
.voice-stage,
.process-error,
.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.entry-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding: 19px 20px;
  box-shadow: none;
}

.entry-status span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.entry-status strong {
  color: var(--brand);
  font-size: 18px;
  font-weight: 900;
}

.action-stack {
  display: grid;
  gap: 11px;
}

.entry-actions,
.result-actions {
  margin-top: 20px;
}

.result-actions .primary-button {
  order: 0;
}

.result-actions .secondary-button {
  order: 1;
}

.result-actions .text-button {
  order: 2;
}

.primary-button,
.secondary-button,
.dialog-primary,
.text-button {
  position: relative;
  width: 100%;
  min-height: 56px;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-weight: 900;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transform: translateY(0);
  transition:
    transform 110ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.primary-button,
.dialog-primary {
  border: 0;
  background: var(--action);
  color: var(--action-ink);
  box-shadow:
    0 5px 0 var(--action-edge),
    0 14px 26px rgba(21, 95, 123, 0.2);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--action);
  box-shadow:
    0 3px 0 rgba(37, 134, 173, 0.2),
    0 9px 20px rgba(31, 104, 133, 0.08);
}

.primary-button::after,
.secondary-button::after,
.dialog-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 52%);
  opacity: 0.72;
  pointer-events: none;
  transition: opacity 110ms ease;
}

.primary-button:active,
.primary-button.is-pressed,
.dialog-primary:active,
.dialog-primary.is-pressed {
  box-shadow:
    0 1px 0 var(--action-edge),
    0 5px 11px rgba(21, 95, 123, 0.17);
  transform: translateY(4px);
}

.secondary-button:active,
.secondary-button.is-pressed {
  background: #f6fbfd;
  box-shadow:
    0 1px 0 rgba(37, 134, 173, 0.2),
    0 4px 10px rgba(31, 104, 133, 0.06);
  transform: translateY(2px);
}

.primary-button:active::after,
.primary-button.is-pressed::after,
.secondary-button:active::after,
.secondary-button.is-pressed::after,
.dialog-primary:active::after,
.dialog-primary.is-pressed::after {
  opacity: 0.28;
}

.text-button:active,
.text-button.is-pressed {
  color: var(--ink);
  transform: translateY(1px) scale(0.99);
}

.back-link:active,
.back-link.is-pressed,
.topbar-action:active,
.topbar-action.is-pressed {
  box-shadow: 0 3px 8px rgba(37, 134, 173, 0.08);
  transform: translateY(2px) scale(0.96);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  box-shadow: none;
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .primary-button:hover:not(:active):not(.is-pressed),
  .dialog-primary:hover:not(:active):not(.is-pressed) {
    box-shadow:
      0 6px 0 var(--action-edge),
      0 17px 30px rgba(21, 95, 123, 0.23);
    transform: translateY(-1px);
  }

  .secondary-button:hover:not(:active):not(.is-pressed) {
    border-color: rgba(37, 134, 173, 0.34);
    background: #f8fcfe;
    transform: translateY(-1px);
  }
}

.button-link {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.entry-actions > p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.process-view {
  display: flex;
  flex-direction: column;
}

.process-copy {
  padding: 6px 4px 16px;
}

.process-copy h1 {
  font-size: clamp(34px, 9vw, 44px);
}

.voice-stage {
  --dial-x: 0px;
  --dial-y: 0px;
  --sample-progress: 0deg;
  display: grid;
  min-height: 316px;
  place-items: center;
  align-content: center;
  padding: 18px 20px 22px;
  text-align: center;
}

.process-visual {
  position: relative;
  display: grid;
  width: 184px;
  height: 184px;
  margin-bottom: 12px;
  place-items: center;
}

.voice-rings {
  position: relative;
  width: 154px;
  height: 154px;
  transition: opacity 240ms ease, transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.countdown-motion {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.94);
  transition:
    opacity 180ms ease,
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 320ms;
}

.voice-stage[data-caption="motion"] .countdown-motion {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition-delay: 0s;
}

.voice-stage[data-caption="motion"] .voice-rings {
  opacity: 0;
  transform: scale(0.9);
}

.voice-rings span {
  position: absolute;
  inset: 50%;
  border: 1px solid rgba(37, 134, 173, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.voice-rings span:nth-child(1) {
  width: 70px;
  height: 70px;
  border-width: 2px;
  background: var(--brand);
}

.voice-rings span:nth-child(2) {
  width: 116px;
  height: 116px;
}

.voice-rings span:nth-child(3) {
  width: 150px;
  height: 150px;
}

.voice-stage[data-state="voice"] .voice-rings span:nth-child(2),
.voice-stage[data-state="voice"] .voice-rings span:nth-child(3) {
  animation: voice-pulse 1.8s ease-out infinite;
}

.voice-stage[data-state="voice"] .voice-rings span:nth-child(3) {
  animation-delay: 0.55s;
}

.voice-stage[data-state="sampling"] .voice-rings span:nth-child(1) {
  background: var(--level);
}

.precision-dial {
  position: absolute;
  inset: 2px;
  overflow: hidden;
  border: 1px solid rgba(118, 211, 233, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 35%, rgba(61, 168, 198, 0.18), transparent 31%),
    radial-gradient(circle at 50% 52%, #102a35 0%, #0a1d26 62%, #07151c 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    inset 0 -24px 36px rgba(0, 0, 0, 0.24),
    0 22px 46px rgba(10, 44, 57, 0.22);
  opacity: 0;
  transform: scale(0.88);
  transition:
    opacity 260ms ease,
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 240ms ease,
    box-shadow 240ms ease;
}

.dial-ticks,
.dial-progress,
.dial-scan,
.dial-crosshair,
.dial-center,
.dial-bubble,
.dial-value {
  position: absolute;
}

.dial-ticks {
  inset: 11px;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from -1deg,
    rgba(185, 234, 245, 0.36) 0deg 1deg,
    transparent 1deg 9deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
}

.dial-progress {
  inset: 3px;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    #75d5e9 0deg var(--sample-progress),
    rgba(117, 213, 233, 0.09) var(--sample-progress) 360deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  transition: background 140ms linear;
}

.dial-crosshair {
  inset: 36px;
  border: 1px solid rgba(160, 225, 239, 0.11);
  border-radius: 50%;
}

.dial-crosshair::before,
.dial-crosshair::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(160, 225, 239, 0.12);
  transform: translate(-50%, -50%);
}

.dial-crosshair::before {
  width: 116px;
  height: 1px;
}

.dial-crosshair::after {
  width: 1px;
  height: 116px;
}

.dial-scan {
  inset: 18px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg 322deg, rgba(93, 205, 230, 0.12) 350deg, transparent 360deg);
  animation: dial-scan 3.2s linear infinite;
}

.dial-center {
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(226, 247, 251, 0.46);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.dial-bubble {
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  border: 4px solid rgba(233, 250, 253, 0.92);
  border-radius: 50%;
  background: #4ab6d2;
  box-shadow:
    0 0 0 5px rgba(74, 182, 210, 0.12),
    0 7px 18px rgba(0, 0, 0, 0.34),
    inset 0 1px 2px rgba(255, 255, 255, 0.75);
  transform: translate(calc(-50% + var(--dial-x)), calc(-50% + var(--dial-y)));
  transition: transform 110ms linear, background 220ms ease, box-shadow 220ms ease;
}

.dial-value {
  right: 0;
  bottom: 24px;
  left: 0;
  color: rgba(232, 248, 251, 0.8);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.sampling-meta {
  display: flex;
  width: 178px;
  justify-content: space-between;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.sampling-meta strong {
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.voice-stage[data-state="sampling"] .voice-rings,
.voice-stage[data-state="complete"] .voice-rings {
  opacity: 0;
  transform: scale(1.08);
}

.voice-stage[data-state="sampling"] .precision-dial,
.voice-stage[data-state="complete"] .precision-dial {
  opacity: 1;
  transform: scale(1);
}

.voice-stage[data-state="sampling"] .sampling-meta,
.voice-stage[data-state="complete"] .sampling-meta {
  opacity: 1;
  transform: translateY(0);
}

.voice-stage[data-visual="motion"] .precision-dial {
  opacity: 0;
  transform: scale(0.88);
}

.voice-stage[data-visual="motion"] .sampling-meta {
  display: none;
}

.voice-stage[data-state="complete"] .precision-dial {
  border-color: rgba(81, 201, 168, 0.48);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 0 0 8px rgba(22, 123, 104, 0.07),
    0 24px 48px rgba(10, 44, 57, 0.24);
}

.voice-stage[data-state="complete"] .dial-bubble {
  background: #39b491;
  box-shadow: 0 0 0 8px rgba(57, 180, 145, 0.14), 0 7px 18px rgba(0, 0, 0, 0.28);
}

.voice-stage[data-state="complete"] .dial-scan {
  animation-play-state: paused;
  opacity: 0;
}

.voice-stage > .voice-caption {
  width: min(100%, 320px);
  min-height: 64px;
  color: var(--ink);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1.42;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.voice-stage[data-caption="countdown"] > .voice-caption {
  min-height: 52px;
  font-size: 48px;
  line-height: 1;
}

.voice-stage[data-caption="motion"] > .voice-caption {
  min-height: 52px;
  font-size: 22px;
}

.voice-stage[data-caption="sampling"] > .voice-caption,
.voice-stage[data-caption="preparing"] > .voice-caption {
  font-size: 28px;
}

.voice-stage > p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.55;
}

.process-error {
  margin-top: 14px;
  padding: 18px;
  border-color: rgba(164, 78, 63, 0.34);
}

.process-error strong {
  display: block;
  color: var(--adjust);
  font-size: 16px;
}

.process-error p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.process-view > .text-button {
  margin-top: auto;
}

.calibration-prep-view,
.placement-view {
  padding-top: 14px;
}

.calibration-prep-copy,
.placement-copy {
  padding: 0 4px;
}

.calibration-prep-copy > p:not(.tool-label),
.placement-copy > p:not(.tool-label) {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.calibration-prep-copy h1,
.placement-copy h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 8.5vw, 40px);
}

.calibration-steps {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.calibration-steps li {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.48;
  text-wrap: pretty;
}

.calibration-steps li::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--brand-bright);
  box-shadow: 0 0 0 3px rgba(72, 174, 208, 0.12);
}

.calibration-table-card {
  margin-top: 12px;
  padding: 10px 10px 8px;
  border: 1px solid rgba(155, 117, 78, 0.14);
  border-radius: var(--radius-card);
  background: rgba(255, 252, 247, 0.9);
  box-shadow: 0 18px 40px rgba(94, 68, 44, 0.08);
}

.calibration-table-scene {
  position: relative;
  height: min(66vw, 272px);
  min-height: 246px;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(123, 88, 56, 0.035) 1px, transparent 1px) 0 0 / 46px 100%,
    linear-gradient(180deg, #fffaf4 0%, #f3e8d9 100%);
}

.calibration-table-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.72), transparent 58%);
}

.calibration-table-shadow {
  position: absolute;
  top: 34px;
  left: 50%;
  z-index: 1;
  width: 120px;
  height: 200px;
  border-radius: 40%;
  background: rgba(83, 60, 42, 0.11);
  filter: blur(14px);
  transform: translateX(-50%) scale(0.88);
}

.calibration-phone {
  position: absolute;
  top: 22px;
  left: 50%;
  z-index: 2;
  width: 94px;
  height: 198px;
  object-fit: contain;
  filter: drop-shadow(0 15px 13px rgba(66, 48, 34, 0.18));
  transform: translateX(-50%);
}

.calibration-screen-label,
.calibration-surface-label {
  position: absolute;
  left: 50%;
  z-index: 4;
  white-space: nowrap;
  transform: translateX(-50%);
}

.calibration-screen-label {
  top: 105px;
  padding: 6px 9px;
  border: 1px solid rgba(21, 95, 123, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--action);
  font-size: 11px;
  font-weight: 900;
}

.calibration-surface-label {
  bottom: 12px;
  color: #7d674f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.calibration-table-card > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.calibration-prep-actions {
  margin-top: 12px;
}

.inline-button-demo {
  display: inline-block;
  padding: 2px 7px 3px;
  border-radius: 6px;
  background: var(--action);
  color: var(--action-ink);
  font-size: 12px;
  font-weight: 900;
  vertical-align: 1px;
}

.placement-card {
  margin-top: 12px;
  padding: 12px 12px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-soft);
}

.placement-scene {
  --cup-size: min(54vw, 210px);
  position: relative;
  height: min(84vw, 336px);
  min-height: 310px;
}

.placement-cup,
.placement-phone,
.result-cup,
.result-phone {
  position: absolute;
  left: 50%;
  object-fit: contain;
  transform: translateX(-50%);
}

.placement-cup {
  z-index: 1;
  top: 72px;
  width: var(--cup-size);
  height: var(--cup-size);
  filter: drop-shadow(0 8px 11px rgba(28, 74, 92, 0.16));
}

.placement-phone {
  z-index: 2;
  top: calc(72px - var(--cup-size) * 0.05);
  width: calc(var(--cup-size) * 0.533);
  height: calc(var(--cup-size) * 1.1);
  opacity: 0.9;
  filter: drop-shadow(0 12px 13px rgba(28, 74, 92, 0.18));
}

.far-side-label {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--brand);
  font-size: 12px;
  transform: translateX(-50%);
}

.far-side-label span {
  width: 0;
  height: 0;
  border-right: 6px solid transparent;
  border-bottom: 10px solid var(--brand);
  border-left: 6px solid transparent;
}

.placement-phone-top,
.placement-screen-label {
  position: absolute;
  left: 50%;
  z-index: 4;
  white-space: nowrap;
  transform: translateX(-50%);
}

.placement-phone-top {
  top: 52px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--action);
  color: var(--action-ink);
  font-size: 10px;
  font-weight: 900;
}

.placement-screen-label {
  top: calc(72px + var(--cup-size) * 0.45);
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--action);
  font-size: 11px;
  font-weight: 900;
}

.placement-side,
.result-side {
  position: absolute;
  z-index: 4;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.placement-side {
  top: calc(72px + var(--cup-size) * 0.5);
}

.placement-side-left,
.result-side-left {
  left: 2px;
}

.placement-side-right,
.result-side-right {
  right: 2px;
}

.placement-user,
.result-user {
  position: absolute;
  left: 50%;
  z-index: 4;
  display: grid;
  justify-items: center;
  color: var(--ink);
  font-size: 11px;
  transform: translateX(-50%);
}

.placement-user {
  bottom: 0;
}

.placement-user-head,
.result-user-head {
  width: 19px;
  height: 19px;
  border: 2px solid var(--action);
  border-radius: 50%;
  background: var(--surface-solid);
}

.placement-user-body,
.result-user-body {
  width: 48px;
  height: 22px;
  margin: 3px 0 3px;
  border: 2px solid var(--action);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: var(--surface-solid);
}

.placement-card > p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.placement-actions {
  margin-top: 12px;
}

.result-view {
  padding-top: 14px;
}

.result-card {
  padding: 18px 16px 14px;
  text-align: center;
}

.result-card h1 {
  font-size: clamp(34px, 9vw, 44px);
}

.result-angle {
  display: grid;
  gap: 3px;
  margin-top: 12px;
}

.result-angle span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.result-angle strong {
  color: var(--ink);
  font-size: 42px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  letter-spacing: -0.055em;
}

.result-angle small {
  margin-left: 3px;
  font-size: 20px;
}

.result-card {
  --result-accent: var(--level);
  --result-sector: rgba(22, 123, 104, 0.5);
}

.result-card[data-result="near"] {
  --result-accent: var(--near);
  --result-sector: rgba(196, 123, 40, 0.64);
}

.result-card[data-result="adjust"] {
  --result-accent: var(--adjust);
  --result-sector: rgba(164, 78, 63, 0.62);
}

.result-direction-scene {
  --cup-size: min(46vw, 182px);
  --tilt-angle: 0deg;
  position: relative;
  width: 100%;
  height: calc(var(--cup-size) + 70px);
  min-height: 248px;
  margin: 4px auto 0;
}

.result-cup {
  z-index: 1;
  top: 8px;
  width: var(--cup-size);
  height: var(--cup-size);
  filter: drop-shadow(0 8px 11px rgba(28, 74, 92, 0.14));
}

.result-phone {
  z-index: 2;
  top: calc(8px - var(--cup-size) * 0.05);
  width: calc(var(--cup-size) * 0.533);
  height: calc(var(--cup-size) * 1.1);
  opacity: 0.32;
}

.tilt-sector {
  position: absolute;
  top: calc(8px + var(--cup-size) * 0.1);
  left: 50%;
  z-index: 3;
  width: calc(var(--cup-size) * 0.8);
  height: calc(var(--cup-size) * 0.8);
  margin-left: calc(var(--cup-size) * -0.4);
  border-radius: 50%;
  background: conic-gradient(from 36deg, var(--result-sector) 0deg 108deg, transparent 108deg 360deg);
  transform: rotate(var(--tilt-angle));
  transform-origin: 50% 50%;
  transition: opacity 220ms ease, transform 260ms ease;
}

.result-side {
  top: calc(8px + var(--cup-size) * 0.5);
}

.low-side-indicator {
  position: absolute;
  top: calc(8px + var(--cup-size) * 0.5);
  left: 50%;
  z-index: 5;
  width: calc(var(--cup-size) * 0.3);
  height: 4px;
  border-radius: 4px;
  background: var(--result-accent);
  box-shadow: 0 2px 7px color-mix(in srgb, var(--result-accent) 30%, transparent);
  transform: rotate(var(--tilt-angle));
  transform-origin: 0 50%;
  transition: opacity 220ms ease, transform 260ms ease;
}

.low-side-indicator::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -5px;
  width: 10px;
  height: 10px;
  border: 3px solid var(--surface-solid);
  border-radius: 50%;
  background: var(--result-accent);
  transform: translateY(-50%);
}

.low-side-indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid var(--result-accent);
  transform: translateY(-50%);
}

.low-side-label {
  position: absolute;
  top: 50%;
  left: calc(100% + 14px);
  min-width: 74px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--result-accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 7px 15px color-mix(in srgb, var(--result-accent) 24%, transparent);
  transform: translateY(-50%) rotate(calc(-1 * var(--tilt-angle)));
  transform-origin: center;
}

.result-user {
  bottom: 0;
}

.result-direction-scene.is-level .tilt-sector,
.result-direction-scene.is-level .low-side-indicator {
  opacity: 0;
}

.page-footer {
  padding: 16px 4px 4px;
  text-align: center;
}

.page-footer p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.page-footer p {
  margin: 0;
}

.overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  align-items: end;
  padding: 18px;
  background: rgba(13, 27, 33, 0.58);
  backdrop-filter: blur(4px);
}

.dialog {
  position: relative;
  width: min(100%, 484px);
  max-height: min(82dvh, 640px);
  margin: 0 auto;
  overflow-y: auto;
  padding: 26px 20px max(20px, env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface-solid);
  box-shadow: 0 24px 70px rgba(8, 30, 39, 0.28);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--brand);
  font-size: 22px;
}

.dialog h2 {
  margin: 0;
  padding-right: 42px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 900;
}

.dialog-kicker {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
}

.dialog-explanation {
  margin: 18px 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
  text-align: justify;
  text-wrap: pretty;
}

.dialog-primary {
  min-height: 52px;
}

.operation-confirm-overlay {
  z-index: 25;
}

.operation-confirm-dialog {
  overflow: hidden;
}

.operation-confirm-dialog .dialog-explanation {
  margin: 18px 0 22px;
  text-align: left;
}

.operation-confirm-actions {
  display: grid;
  gap: 8px;
}

.operation-confirm-actions .text-button {
  width: 100%;
}

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(100% - 36px);
  padding: 11px 15px;
  border-radius: var(--radius-control);
  background: #17313c;
  color: #f4fbfe;
  font-size: 13px;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes voice-pulse {
  0% {
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.72);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes dial-scan {
  to {
    transform: rotate(1turn);
  }
}

@media (max-height: 720px) {
  .flow-view {
    padding-top: 16px;
  }

  .intro {
    padding-bottom: 14px;
  }

  .intro h1,
  .process-copy h1,
  .calibration-prep-copy h1,
  .placement-copy h1 {
    font-size: 34px;
  }

  .calibration-table-scene {
    min-height: 220px;
  }

  .placement-scene {
    min-height: 280px;
  }

  .voice-stage {
    min-height: 268px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
