:root {
  --brand-50: #f0f5ff;
  --brand-100: #e0ebff;
  --brand-200: #bae0ff;
  --brand-300: #7cc2ff;
  --brand-400: #369eff;
  --brand-500: #0052ff;
  --brand-600: #003ecc;
  --brand-900: #001a80;
  --surface-page: #ffffff;
  --surface-card: #f7f9fc;
  --surface-step: #f2f6ff;
  --surface-dark: #050b13;
  --ink: #07111f;
  --text-strong: #0f172a;
  --text-body: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: linear(0, .098 2.1%, .262 4.3%, .415 6.4%, .542 8.5%, .642 10.7%, .721 12.8%, .783 14.9%, .831 17%, .897 21.3%, .938 25.6%, .962 29.8%, .977 34.1%, .992 42.6%, .997 51.1%, .999 59.6%, 1);
  --duration-spring: 1.174s;
}

.rf,
.rf * {
  font-weight: 300 !important;
}

.rf {
  position: relative;
  height: 100svh;
  min-height: 36rem;
  padding: clamp(.5rem, 1.4vw, 1.25rem);
  color: var(--text-body);
  background:
    linear-gradient(rgba(0, 82, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 82, 255, .045) 1px, transparent 1px),
    radial-gradient(circle at 8% 8%, rgba(54, 158, 255, .14), transparent 28%),
    var(--surface-page);
  background-size: 42px 42px, 42px 42px, auto, auto;
  overflow: clip;
}

.rf::before,
.rf::after {
  content: "";
  position: fixed;
  z-index: 0;
  width: 22rem;
  height: 22rem;
  border: 1px solid rgba(0, 82, 255, .08);
  border-radius: 50%;
  pointer-events: none;
}

.rf::before {
  display: none;
}

.rf::after {
  bottom: -16rem;
  left: -10rem;
}

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100%, 60rem);
  height: 100%;
  min-height: 0;
  margin-inline: auto;
  padding-top: 0;
}

.robot {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: min(100%, 22rem);
  min-height: 12.75rem;
  margin-bottom: -.4rem;
  padding: 4rem 1rem .5rem;
  perspective: 900px;
  color: #f3f6ff;
  border-radius: 3rem;
  cursor: pointer;
  isolation: isolate;
  transition: translate .62s var(--ease-out-expo);
}

.robot:hover,
.robot:focus-visible {
  translate: 0 -.3rem;
}

.robot:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: .4rem;
}

.robot::before,
.robot::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 58%;
  left: 50%;
  border: 1px solid rgba(124, 194, 255, .18);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: orbit-ring 18s linear infinite;
}

.robot::before {
  width: min(62%, 13rem);
  aspect-ratio: 1;
  border: 0;
  background:
    radial-gradient(circle at 78% 88%, rgba(0, 82, 255, .36), transparent 46%),
    radial-gradient(circle at 5% 5%, rgba(54, 158, 255, .22), transparent 40%),
    var(--surface-dark);
  outline: 1px solid rgba(124, 194, 255, .2);
  box-shadow: 0 32px 90px -42px rgba(0, 43, 136, .8), 0 0 90px 20px rgba(0, 82, 255, .12);
  animation: none;
}

.robot::after {
  width: min(52%, 11rem);
  aspect-ratio: 1;
  border-style: dashed;
  animation-direction: reverse;
  animation-duration: 12s;
}

@keyframes orbit-ring {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.head3d {
  width: 8.5rem;
  height: 7.4rem;
  perspective: 700px;
  transform-style: preserve-3d;
  transform: translateY(var(--hy, 0)) scale(var(--hsc, 1)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .35s var(--ease-out-expo);
  will-change: transform;
}

.head {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform var(--duration-spring) var(--ease-spring);
}

.is-turned .head { transform: rotateY(180deg); }
.is-hyped .head3d { --hy: -.35rem; --hsc: 1.035; }
.is-pressed .head3d { --hy: .25rem; --hsc: .95; }
.is-spinning .head { animation: robot-victory .9s var(--ease-out-expo); }
.is-waving .ear--r { animation: ear-wave .65s var(--ease-out-expo) 2; }

@keyframes robot-victory {
  to { transform: rotateY(360deg); }
}

@keyframes ear-wave {
  50% { transform: translate(.35rem, -.35rem) rotate(18deg); }
}

.face {
  position: absolute;
  inset: 0;
  border-radius: 2.25rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .045));
  outline: 1px solid rgba(255, 255, 255, .15);
  box-shadow: 0 28px 70px -32px rgba(0, 0, 0, .65), inset 0 1px rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  backdrop-filter: blur(18px) saturate(130%);
  backface-visibility: hidden;
}

.face--back {
  display: grid;
  place-items: center;
  transform: rotateY(180deg);
}

.visor {
  position: absolute;
  inset: .95rem .82rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  border-radius: 1.35rem;
  background:
    linear-gradient(rgba(124, 194, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 194, 255, .05) 1px, transparent 1px),
    #07111f;
  background-size: 15px 15px;
  outline: 1px solid rgba(124, 194, 255, .2);
  overflow: hidden;
}

.visor::after {
  content: "";
  position: absolute;
  inset-inline: 8%;
  top: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand-400), transparent);
  box-shadow: 0 0 12px 3px rgba(54, 158, 255, .7);
  animation: scan 3.8s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { translate: 0 0; opacity: .35; }
  50% { translate: 0 6.8rem; opacity: .9; }
}

.eyes {
  display: flex;
  gap: 2rem;
  transform: translate(var(--lx, 0), var(--ly, 0));
  transition: transform .18s ease-out;
}

.eyes.blink .eye { height: .12rem; translate: 0 .55rem; }

.eye {
  width: 1.15rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #e7efff;
  box-shadow: 0 0 18px rgba(124, 194, 255, .8);
  transition: all .25s var(--ease-out-expo);
}

[data-mood="watching"] .eye { height: .75rem; border-radius: 999px; }
[data-mood="excited"] .eye { scale: 1.18; background: var(--brand-300); }
[data-mood="success"] .eye {
  width: 1.45rem;
  height: .72rem;
  border: 3px solid #a7f3d0;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  background: transparent;
  box-shadow: 0 0 18px rgba(52, 211, 153, .48);
}

.mouth {
  width: .9rem;
  height: .22rem;
  border-radius: 999px;
  background: var(--brand-300);
  box-shadow: 0 0 12px rgba(124, 194, 255, .5);
  transition: all .25s var(--ease-out-expo);
}

[data-mood="watching"] .mouth { width: .55rem; height: .55rem; }
[data-mood="excited"] .mouth,
[data-mood="success"] .mouth { width: 1.8rem; height: .58rem; border-radius: 0 0 999px 999px; }

.cheek {
  position: absolute;
  top: 61%;
  width: .8rem;
  height: .35rem;
  border-radius: 999px;
  background: var(--brand-400);
  opacity: 0;
  transition: opacity .3s;
}

.cheek--l { left: 1rem; }
.cheek--r { right: 1rem; }
[data-mood="excited"] .cheek,
[data-mood="success"] .cheek { opacity: .8; }

.ear {
  position: absolute;
  top: 2.55rem;
  width: .62rem;
  height: 1.9rem;
  border-radius: .35rem;
  background: var(--brand-500);
  box-shadow: 0 0 18px rgba(0, 82, 255, .5);
}

.ear--l { left: -.42rem; }
.ear--r { right: -.42rem; }

.antenna {
  position: absolute;
  top: 2.8rem;
  left: 50%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateX(-50%);
}

.antenna-rod { width: 1px; height: 1.45rem; background: rgba(124, 194, 255, .6); }
.antenna-tip {
  order: -1;
  width: .7rem;
  height: .7rem;
  margin-bottom: -.05rem;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 14px #34d399;
  animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse { 50% { opacity: .35; } }

.bubble {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 5;
  width: min(82%, 18rem);
  padding: .62rem .9rem;
  color: var(--text-body);
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .68rem;
  line-height: 1.4;
  letter-spacing: -.01em;
  background: rgba(255, 255, 255, .92);
  border-radius: .8rem;
  outline: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 24px 60px -28px rgba(0, 82, 255, .45);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.bubble.pop { animation: bubble-in .55s var(--ease-out-expo); }
@keyframes bubble-in { from { opacity: 0; translate: 0 .6rem; } }

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
  width: 8.5rem;
  padding: 1rem;
  border-radius: 1.5rem;
  color: var(--text-body);
  background: #fff;
  box-shadow: 0 24px 60px -12px rgba(0, 82, 255, .35);
}

.panel-lights,
.meter { display: flex; gap: .4rem; }
.panel-lights i { width: .38rem; height: .38rem; border-radius: 50%; background: #ff6b6b; }
.panel-lights i:nth-child(2) { background: #ffb845; }
.panel-lights i:nth-child(3) { background: #37c991; }
.meter i { width: 1.2rem; height: .4rem; border-radius: .2rem; background: #e2e8f0; }
.meter i.on { background: linear-gradient(90deg, var(--brand-500), var(--brand-300)); }
.panel-label { margin: 0; color: var(--text-faint); font: 300 .52rem/1.3 ui-monospace, monospace; letter-spacing: .08em; }

.card {
  position: relative;
  z-index: 2;
  align-self: center;
  width: min(100% - 1rem, 56rem);
  margin: 0 auto;
  padding: clamp(1.5rem, 2.4vw, 2.1rem) clamp(1.5rem, 3vw, 2.7rem) clamp(1.2rem, 2.4vw, 1.8rem);
  border-radius: 2rem;
  background: #fff;
  outline: 1px solid rgba(15, 23, 42, .07);
  box-shadow: 0 35px 90px -55px rgba(0, 82, 255, .45);
}

.form-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2.4rem;
}

.title {
  max-width: 11ch;
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(2.2rem, 4vw, 3.55rem);
  line-height: .92;
  letter-spacing: -.055em;
  text-wrap: balance;
}

.subtitle {
  max-width: 20ch;
  margin: 0 0 .15rem;
  color: var(--text-muted);
  font-size: .875rem;
  line-height: 1.45;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .66rem .84rem;
  margin-top: 1.2rem;
}

.field {
  position: relative;
  display: grid;
  grid-template-columns: 1.15rem minmax(0, 1fr);
  align-items: start;
  gap: .8rem;
  min-height: 3.3rem;
  margin: 0;
  padding: .82rem .96rem;
  border-radius: 1rem;
  color: var(--text-body);
  background: var(--surface-card);
  outline: 1px solid rgba(15, 23, 42, .08);
  transition: background-color .3s, box-shadow .45s var(--ease-out-expo), translate .45s var(--ease-out-expo), outline-color .3s;
}

.field--wide { grid-column: 1 / -1; }

.field:hover { background: #f2f6ff; }
.field:focus-within {
  background: #fff;
  outline-color: rgba(0, 82, 255, .38);
  box-shadow: 0 18px 44px -30px rgba(0, 82, 255, .6);
  translate: 0 -.12rem;
}

.field.is-invalid {
  outline-color: rgba(255, 107, 107, .75);
  box-shadow: 0 18px 36px -30px rgba(255, 107, 107, .8);
}

.field-icon {
  width: 1rem;
  height: 1rem;
  margin-top: .16rem;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke .25s;
}

.field:focus-within .field-icon { stroke: var(--brand-500); }

.field input,
.field textarea,
.field select {
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  color: var(--text-strong);
  font-size: .875rem;
  line-height: 1.35;
  background: transparent;
  border: 0;
  outline: 0;
  resize: none;
}

.field input::placeholder,
.field textarea::placeholder,
.field select:invalid { color: var(--text-muted); opacity: 1; }
.field select { cursor: pointer; }

.btn {
  --btn-square: 2.6rem;
  display: grid;
  grid-template-columns: var(--btn-square) 1fr;
  align-items: center;
  gap: .75rem;
  width: 100%;
  margin-top: .9rem;
  padding: .3rem 1.1rem .3rem .3rem;
  color: #fff;
  font-size: .8rem;
  letter-spacing: -.005em;
  background: var(--brand-500);
  border: 0;
  border-radius: .85rem;
  cursor: pointer;
}

.btn:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 3px; }
.btn:disabled { cursor: wait; opacity: .78; }
.btn-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--btn-square);
  height: var(--btn-square);
  color: var(--brand-500);
  background: #fff;
  border-radius: calc(var(--btn-square) * .22);
  overflow: hidden;
}

.btn-icon svg {
  grid-area: 1 / 1;
  width: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--duration-spring) var(--ease-spring);
}

.btn-icon svg:nth-child(2) { transform: translateX(-230%); }
.text-roll {
  display: grid;
  justify-self: center;
  padding-bottom: .28em;
  margin-bottom: -.28em;
  line-height: 1.25;
  overflow: hidden;
}

.text-roll > span {
  grid-area: 1 / 1;
  transition: transform var(--duration-spring) var(--ease-spring);
}

.text-roll > span:nth-child(2) { transform: translateY(125%); }
.btn:hover .btn-icon svg:first-child,
.btn:focus-visible .btn-icon svg:first-child { transform: translateX(230%); }
.btn:hover .btn-icon svg:nth-child(2),
.btn:focus-visible .btn-icon svg:nth-child(2) { transform: translateX(0); }
.btn:hover .text-roll > span:first-child,
.btn:focus-visible .text-roll > span:first-child { transform: translateY(-125%); }
.btn:hover .text-roll > span:nth-child(2),
.btn:focus-visible .text-roll > span:nth-child(2) { transform: translateY(0); }
.btn.is-success { background: #10b981; }

.prototype-note {
  margin: .6rem 0 0;
  color: var(--text-faint);
  text-align: center;
  font: 300 .66rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .03em;
}

.hand,
.foot { display: none; }

.card.shake { animation: shake .42s ease; }
@keyframes shake {
  25% { translate: -.4rem 0; }
  50% { translate: .35rem 0; }
  75% { translate: -.2rem 0; }
}

.confetti {
  position: fixed;
  z-index: 20;
  width: .55rem;
  height: .55rem;
  border-radius: .15rem;
  pointer-events: none;
  animation: confetti 900ms var(--ease-out-expo) forwards;
}

@keyframes confetti {
  to { opacity: 0; transform: translate(var(--tx), var(--ty)) rotate(520deg); }
}

@media (max-width: 900px) {
  .rf { padding: .6rem; }
  .card { width: min(100% - .8rem, 52rem); }
}

@media (max-width: 680px) {
  .rf { padding: 0; }
  .rf { height: auto; min-height: 100svh; overflow: visible; }
  .stage { height: auto; min-height: 100svh; padding-block: .5rem 1rem; }
  .robot { min-height: 15rem; margin-bottom: .5rem; padding: 5rem 1rem .75rem; }
  .robot::before { width: 14.5rem; }
  .robot::after { width: 12.25rem; }
  .head3d { width: 9.5rem; height: 8.3rem; }
  .antenna { top: 3.6rem; }
  .bubble { top: .25rem; width: min(86%, 20rem); }
  .card { width: calc(100% - 1.5rem); margin: 0 auto; padding: 2.1rem 1.5rem; border-radius: 1.7rem; }
  .form-head { display: block; }
  .subtitle { max-width: none; margin: 1rem 0 1.5rem; }
  .fields-grid { grid-template-columns: 1fr; margin-top: 0; }
  .field--wide { grid-column: auto; }
  .title { font-size: 2.8rem; }
}

@media (min-width: 681px) and (max-height: 700px) {
  .robot { min-height: 10.5rem; padding-top: 3.25rem; }
  .robot::before { width: 10.5rem; }
  .robot::after { width: 8.75rem; }
  .head3d { width: 7rem; height: 6.1rem; }
  .antenna { top: 2.15rem; }
  .bubble { top: -.25rem; padding-block: .45rem; }
  .card { padding-block: 1rem .75rem; }
  .title { font-size: 2.45rem; }
  .fields-grid { gap: .48rem .72rem; margin-top: .84rem; }
  .field { min-height: 2.9rem; padding-block: .58rem; }
  .btn { margin-top: .66rem; }
  .prototype-note { margin-top: .42rem; }
}

@media (prefers-reduced-motion: reduce) {
  .robot::before,
  .robot::after,
  .antenna-tip,
  .visor::after,
  .is-spinning .head,
  .bubble.pop,
  .confetti { animation: none; }
  .head,
  .head3d,
  .eyes,
  .field,
  .btn-icon svg,
  .text-roll > span { transition: none; }
  .btn:hover,
  .btn:focus-visible { outline: 2px solid currentColor; }
}

@supports not (transition-timing-function: linear(0, 1)) {
  :root { --ease-spring: cubic-bezier(.16, 1, .3, 1); --duration-spring: .55s; }
}
