:root {
  --bg: #07080a;
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.48);
  --line: rgba(255, 255, 255, 0.14);
  --fill: rgba(255, 255, 255, 0.07);
  --fill-2: rgba(255, 255, 255, 0.11);
  --blue: #0a84ff;
  --radius: 22px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
}

.orb {
  position: fixed;
  z-index: 0;
  width: 48vw;
  height: 48vw;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: 0.28;
}

.orb-a {
  top: -18vw;
  left: -10vw;
  background: #1b3a6b;
}

.orb-b {
  right: -12vw;
  bottom: -20vw;
  background: #3a2158;
}

.stage,
.app {
  position: relative;
  z-index: 1;
}

[hidden] {
  display: none !important;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.glass {
  background: var(--fill);
  border: 1px solid var(--line);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
}

.card-narrow,
.panel {
  width: min(100%, 400px);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-weight: 590;
  letter-spacing: -0.03em;
  font-size: 1.7rem;
}

.lede {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  padding: 11px 12px;
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(10, 132, 255, 0.7);
}

.btn {
  border: 0;
  cursor: pointer;
  border-radius: 980px;
  padding: 11px 16px;
  font: inherit;
  color: var(--text);
  background: var(--fill-2);
}

.btn.primary {
  background: var(--blue);
  color: #fff;
  width: 100%;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.form-error {
  margin: 0 0 10px;
  color: #ff8a80;
  font-size: 0.86rem;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 10px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 18px;
  padding: 10px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 590;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.who {
  color: var(--muted);
  font-size: 0.85rem;
}

.topbar .btn.ghost {
  width: auto;
}

.workspace {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 4px 0 8px;
}

.cab-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cab-actions .btn.primary,
.cab-actions .btn.ghost {
  width: 100%;
}

.sheet {
  width: min(100% - 24px, 420px);
  max-height: min(88dvh, 720px);
  margin: auto;
  padding: 20px 20px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 16, 20, 0.92);
  color: var(--text);
  overflow: auto;
}

.sheet::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.sheet-head h1 {
  font-size: 1.35rem;
}

.sheet .btn.ghost {
  width: auto;
  flex-shrink: 0;
}

.ref-link {
  margin: 0 0 10px;
  word-break: break-all;
}

.row-actions {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
}

.ref-feed {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.ref-feed li {
  padding: 7px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

.facts {
  margin: 0 0 14px;
}

.facts > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  text-align: right;
  word-break: break-all;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
}

.linkish {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: #7ac8ff;
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  text-align: center;
}

.linkish.mute {
  color: var(--muted);
}

.linkish:disabled {
  color: var(--muted);
  opacity: 0.7;
  cursor: not-allowed;
}

.otp-orbit {
  --otp-ice: rgb(122 200 255 / 0.55);
  --otp-slot: rgb(122 200 255 / 0.42);
  --otp-glow: transparent;
  position: relative;
  width: 200px;
  height: 200px;
  margin: 8px auto 4px;
  cursor: text;
}

.otp-orbit.otp-ok {
  --otp-ice: #9fd4bc;
  --otp-slot: rgb(159 212 188 / 0.7);
  --otp-glow: rgb(159 212 188 / 0.28);
}

.otp-orbit.otp-bad {
  --otp-ice: #f0a8b4;
  --otp-slot: rgb(240 168 180 / 0.72);
  --otp-glow: rgb(240 168 180 / 0.3);
}

.otp-input {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  cursor: text;
}

.otp-nudge,
.otp-spin {
  position: absolute;
  inset: 0;
}

.otp-spin {
  animation: otp-rotate 22s linear infinite;
  animation-delay: 800ms;
}

.otp-orbit.otp-ok .otp-spin,
.otp-orbit.otp-ok .otp-slot,
.otp-orbit.otp-bad .otp-spin,
.otp-orbit.otp-bad .otp-slot {
  animation-play-state: paused;
}

.otp-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--otp-ice);
  filter: drop-shadow(0 0 10px var(--otp-glow));
  transition: color 280ms ease, filter 280ms ease;
}

.otp-arm {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: rotate(var(--arm)) translateY(-78px);
  animation: otp-arrive 800ms cubic-bezier(0.45, 0.05, 0.2, 1) both;
  animation-delay: var(--slot-delay);
}

.otp-slot {
  position: absolute;
  left: -18px;
  top: -18px;
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--otp-slot);
  background: rgb(12 13 16 / 0.94);
  box-shadow: 0 0 14px var(--otp-glow);
  transform: rotate(calc(-1 * var(--arm)));
  animation: otp-unspin 22s linear infinite;
  animation-delay: 800ms;
  transition:
    border-color 280ms ease,
    box-shadow 280ms ease;
}

.otp-face {
  font-size: 15px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.otp-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 6px;
  border: 1px solid rgb(122 200 255 / 0.38);
  background: rgb(18 20 24 / 0.96);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12);
  pointer-events: none;
}

.otp-orbit.otp-ok .otp-hub {
  border-color: rgb(159 212 188 / 0.55);
}

.otp-orbit.otp-bad .otp-hub {
  border-color: rgb(240 168 180 / 0.55);
}

.otp-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 4px;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--muted);
  cursor: pointer;
}

.otp-check input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: none;
  accent-color: #7ac8ff;
}

@keyframes otp-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes otp-unspin {
  from {
    transform: rotate(calc(-1 * var(--arm)));
  }
  to {
    transform: rotate(calc(-1 * var(--arm) - 360deg));
  }
}

@keyframes otp-arrive {
  from {
    opacity: 0.15;
    transform: rotate(var(--arm)) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: rotate(var(--arm)) translateY(-78px);
  }
}

@media (max-width: 560px) {
  .stage {
    padding: 16px 12px;
  }

  .app {
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .who {
    display: none;
  }

  .panel,
  .card-narrow {
    padding: 18px 16px 16px;
  }

  h1 {
    font-size: 1.4rem;
  }

  .sheet {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    max-height: min(90dvh, 100%);
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .otp-spin,
  .otp-slot,
  .otp-arm {
    animation: none;
  }

  .otp-arm {
    transform: rotate(var(--arm)) translateY(-78px);
    opacity: 1;
  }

  .otp-slot {
    transform: rotate(calc(-1 * var(--arm)));
  }
}
