
@property --edge-feather {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
:root {
  color-scheme: dark;
  --lab-purple: #654ea3;
  --content-bg: #0a1020; /* Digi Mainline dark --bg, ported/DmlApp.js */
  --lab-purple-light: color-mix(in srgb, var(--lab-purple) 55%, white);
  --lab-purple-text: color-mix(in srgb, var(--lab-purple) 12%, white);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.screen {
  min-height: 480px;
  display: grid;
  place-items: center;
  padding: 32px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--content-bg);
  color: #ece9f2;
}
.prompt { width: min(100%, 420px); }
form { margin: 0; }
.line {
  --button-inset: 10px;
  --cursor-x: 50%;
  --cursor-y: 50%;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 var(--button-inset) 0 16px;
}
/* The button light lives behind the controls, inside this clipped glass plane. */
.surface {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(115deg, #211c2b, #19171f 65%, #201b29);
  box-shadow: 0 6px 20px #00000020;
  pointer-events: none;
  /* Focus dissolves the glass boundary as well as illuminating it. */
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 var(--edge-feather), #000 calc(100% - var(--edge-feather)), transparent),
    linear-gradient(to bottom, transparent, #000 var(--edge-feather), #000 calc(100% - var(--edge-feather)), transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 var(--edge-feather), #000 calc(100% - var(--edge-feather)), transparent),
    linear-gradient(to bottom, transparent, #000 var(--edge-feather), #000 calc(100% - var(--edge-feather)), transparent);
  mask-composite: intersect;
  transition: --edge-feather 1.25s cubic-bezier(.22, 0, .2, 1);
}
.surface::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid #a99bc224;
  transition: opacity 1.1s cubic-bezier(.22, 0, .2, 1);
}
/* Reference-derived emission contours, tinted in the lab purple family. */
.button-orb {
  --orb-rgb: 149, 112, 192;
  position: absolute;
  right: calc(var(--button-inset) - 4px);
  bottom: 3px;
  width: 48px;
  height: 48px;
  pointer-events: none;
}
.orb-paint {
  position: absolute;
  width: 180px;
  height: 180px;
  transform: scale(.2666666667);
  transform-origin: 0 0;
}
.orb-paint { color: rgb(var(--orb-rgb)); }
/* Resting state is a plain disc, with no emission above its crown. */
.orb-paint::before {
  content: "";
  position: absolute;
  left: 32.5px;
  top: 36.1px;
  width: 115px;
  height: 115px;
  border-radius: 50%;
  background: currentColor;
  transition: opacity 1.1s cubic-bezier(.22, 0, .2, 1), transform .35s;
}
.orb-field {
  --orb-rest-blur: .9px;
  display: block;
  position: absolute;
  inset: 0;
  width: 180px;
  height: 180px;
  opacity: 0;
  overflow: visible;
  filter: blur(var(--orb-rest-blur));
  transition: opacity 1.1s cubic-bezier(.22, 0, .2, 1), filter 1.1s cubic-bezier(.22, 0, .2, 1);
  /* Purple needs a longer crown fade than cyan; keep the lower anchor intact. */
  mask-image: linear-gradient(to bottom,
    transparent 0%, #ffffff40 12%, #ffffff8c 25%, #ffffffd9 40%,
    #fffffff0 52%, white 60%, white 85.3%, transparent 87%);
}
.orb-bowl {
  --orb-spread-x: 1;
  --orb-spread-y: 1;
  transform-box: view-box;
  transform-origin: 50% 86%;
  transform: scale(var(--orb-spread-x), var(--orb-spread-y));
  transition: opacity .65s, transform 1.1s cubic-bezier(.22, 0, .2, 1);
}
.orb-core {
  transform-box: view-box;
  transform-origin: 50% 52%;
  transition: transform .35s;
}
/* Fluent reveal: an unblurred, one-pixel border mask. No cursor-lit surface. */
.cursor-edge {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 1px;
  background: radial-gradient(110px circle at var(--cursor-x) var(--cursor-y), #d1bddf66, #b29acb26 48%, transparent 90%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity .55s ease;
}
.line.is-hovered .cursor-edge { opacity: .7; }
/* Focus light is independent of the pointer. Blur the cut-out rim, not a fill. */
.focus-edge, .focus-haze {
  position: absolute;
  inset: -1px;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.35s cubic-bezier(.22, 0, .2, 1), filter 1.35s ease;
}
.focus-edge { filter: blur(3.5px); }
.focus-haze { filter: blur(9px); }
.focus-edge::before, .focus-haze::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 4px;
  background:
    radial-gradient(ellipse 170px 55px at 8% 100%, #c7a5f6ab, transparent 85%),
    radial-gradient(ellipse 150px 60px at 92% 0%, #c1a1ee8c, transparent 85%),
    linear-gradient(100deg, #8e6ac145, #9d7bd626 50%, #8e6ac145);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.focus-haze::before {
  padding: 7px;
  background:
    radial-gradient(ellipse 170px 45px at 12% 100%, #bd92f5a3, transparent 90%),
    radial-gradient(ellipse 160px 50px at 92% 15%, #b990ed85, transparent 90%),
    linear-gradient(110deg, #a27cd442, #8863bd18 45%, #ac83df38);
}
.line:focus-within .surface { --edge-feather: 4px; }
.line:focus-within .surface::after { opacity: .12; }
.line:focus-within .focus-edge { opacity: .82; }
.line:focus-within .focus-haze { opacity: .6; }
.line.is-typing .focus-edge, .line.is-pressed .focus-edge {
  opacity: 1;
  filter: blur(5px);
  transition-duration: .5s;
}
.line.is-typing .focus-haze, .line.is-pressed .focus-haze {
  opacity: .95;
  filter: blur(11px);
  transition-duration: .5s;
}
label { font-size: 14px; white-space: nowrap; color: var(--lab-purple-light); }
input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--lab-purple-text);
  font: inherit;
  font-size: 15px;
  letter-spacing: .18em;
  caret-color: var(--lab-purple-light);
  transition: color .5s ease, text-shadow .7s ease;
}
input::placeholder { color: color-mix(in srgb, var(--lab-purple) 70%, #aaa); letter-spacing: 0; }
button {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  margin-right: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--lab-purple-text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateX(-1px);
}
.line:has(button:hover) .orb-bowl, .line:has(button:focus-visible) .orb-bowl { opacity: .85; }
.line:focus-within .orb-paint::before, .line.is-activating .orb-paint::before { opacity: 0; }
.line:focus-within .orb-field, .line.is-activating .orb-field { opacity: 1; }
.line:focus-within .orb-field { --orb-rest-blur: 5px; }
.line:focus-within .orb-bowl {
  --orb-spread-x: 1.06;
  --orb-spread-y: 1.04;
  opacity: 1;
}
.line.is-pressed .orb-core { transform: scale(.95); }
.line.is-pressed .orb-paint::before { transform: scale(.95); }
.line.is-pressed .orb-bowl { opacity: 1; }
/* A single release pulse, anchored at the base, for pointer and keyboard submit. */
.line.is-activating .orb-field { animation: orb-release-light 780ms cubic-bezier(.22, 0, .2, 1); }
.line.is-activating .orb-bowl { animation: orb-release-spread 780ms cubic-bezier(.22, 0, .2, 1); }
.line.is-activating .orb-core { animation: orb-release-core 780ms cubic-bezier(.22, 0, .2, 1); }
@keyframes orb-release-light {
  0%, 100% { filter: blur(var(--orb-rest-blur)); }
  35% { filter: blur(8px); }
}
@keyframes orb-release-spread {
  0%, 100% { transform: scale(var(--orb-spread-x), var(--orb-spread-y)); }
  40% { transform: scale(1.14, 1.1); }
}
@keyframes orb-release-core {
  0% { transform: scale(.95); }
  45% { transform: scale(1.025); }
  100% { transform: scale(1); }
}
button:focus-visible { outline: 1px solid #d6b7ff99; outline-offset: -2px; }
@media (max-width: 420px) {
  .screen { padding: 24px; min-height: 420px; }
  .line { --button-inset: 8px; padding-left: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .surface, .surface::after, .cursor-edge, .focus-edge, .focus-haze, .orb-paint::before, .orb-field, .orb-core, .orb-bowl { transition: none; animation: none !important; }
}

/* Loading carries the existing NE/SW light around the rim; the field stays still. */
@property --rim-phase { syntax: "<angle>"; inherits: false; initial-value: 135deg; }
.screen { position: relative; isolation: isolate; }
.unlock-overlay { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 32px; background: #111014; backdrop-filter: blur(0); transition: background-color .9s, opacity 1.2s cubic-bezier(.2,0,.1,1), backdrop-filter 1.2s; }
.unlock-overlay[hidden] { display: none; }
.prompt { position: relative; }
/* Keep status announcements available without adding visible copy. */
.phase { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
/* One spring-shaped ease per full orbit, carried by a steady forward drift.
   Samples blend 40% linear travel with 60% damped spring (damping .65,
   frequency 12), corrected to meet at equal nonzero loop velocity.
   The angle always advances; the damping modulates speed, not direction. */
/* Animate only the two light layers; never invalidate the input/SVG subtree. */
.line.is-loading .focus-edge::before, .line.is-loading .focus-haze::before {
  --rim-x: calc(50% + 59.4% * cos(var(--rim-phase)));
  --rim-y: calc(50% + 70.7% * sin(var(--rim-phase)));
  animation: rim-drift 4.8s linear infinite;
  animation-timing-function: linear(
    0, 0.00040 0.1%, 0.01132 1.25%, 0.03363 2.5%, 0.06464 3.75%,
    0.10227 5%, 0.14468 6.25%, 0.19027 7.5%, 0.23764 8.75%, 0.28560 10%,
    0.33319 11.25%, 0.37960 12.5%, 0.42419 13.75%, 0.46647 15%, 0.50610 16.25%,
    0.54284 17.5%, 0.57654 18.75%, 0.60718 20%, 0.63475 21.25%, 0.65936 22.5%,
    0.68112 23.75%, 0.70019 25%, 0.71676 26.25%, 0.73105 27.5%, 0.74326 28.75%,
    0.75362 30%, 0.76235 31.25%, 0.76965 32.5%, 0.77574 33.75%, 0.78080 35%,
    0.78503 36.25%, 0.78857 37.5%, 0.79159 38.75%, 0.79421 40%, 0.79656 41.25%,
    0.79873 42.5%, 0.80082 43.75%, 0.80290 45%, 0.80503 46.25%, 0.80727 47.5%,
    0.80964 48.75%, 0.81218 50%, 0.81490 51.25%, 0.81783 52.5%, 0.82097 53.75%,
    0.82432 55%, 0.82787 56.25%, 0.83162 57.5%, 0.83556 58.75%, 0.83968 60%,
    0.84396 61.25%, 0.84839 62.5%, 0.85296 63.75%, 0.85764 65%, 0.86243 66.25%,
    0.86731 67.5%, 0.87226 68.75%, 0.87728 70%, 0.88235 71.25%, 0.88746 72.5%,
    0.89261 73.75%, 0.89777 75%, 0.90295 76.25%, 0.90814 77.5%, 0.91334 78.75%,
    0.91853 80%, 0.92371 81.25%, 0.92889 82.5%, 0.93406 83.75%, 0.93921 85%,
    0.94435 86.25%, 0.94948 87.5%, 0.95459 88.75%, 0.95968 90%, 0.96477 91.25%,
    0.96983 92.5%, 0.97489 93.75%, 0.97993 95%, 0.98496 96.25%, 0.98998 97.5%,
    0.99500 98.75%, 0.99960 99.9%, 1
  );
}
.line.is-loading:where(:not(.is-stopped), :focus-within) .focus-edge { opacity: .82; }
.line.is-loading:where(:not(.is-stopped), :focus-within) .focus-haze { opacity: .6; }
/* Retain the approved broad radial falloff, including its faint connecting rim. */
.line.is-loading .focus-edge::before {
  background:
    radial-gradient(ellipse 170px 55px at var(--rim-x) var(--rim-y), #c7a5f6ab, transparent 85%),
    radial-gradient(ellipse 150px 60px at calc(100% - var(--rim-x)) calc(100% - var(--rim-y)), #c1a1ee8c, transparent 85%),
    linear-gradient(100deg, #8e6ac145, #9d7bd626 50%, #8e6ac145);
}
.line.is-loading .focus-haze::before {
  background:
    radial-gradient(ellipse 170px 45px at calc(var(--rim-x) + 4%) var(--rim-y), #bd92f5a3, transparent 90%),
    radial-gradient(ellipse 160px 50px at calc(100% - var(--rim-x)) calc(115% - var(--rim-y)), #b990ed85, transparent 90%),
    linear-gradient(110deg, #a27cd442, #8863bd18 45%, #ac83df38);
}
.line.is-loading:where(:not(.is-stopped), :focus-within) .surface { --edge-feather: 4px; }
.line.is-loading:where(:not(.is-stopped), :focus-within) .surface::after { opacity: .1; }
.line.is-loading:where(:not(.is-stopped), :focus-within) .orb-paint::before { opacity: 0; }
.line.is-loading:where(:not(.is-stopped), :focus-within) .orb-field { opacity: 1; filter: blur(5px); }
.line.is-loading:where(:not(.is-stopped), :focus-within) button svg { opacity: .35; transition: opacity .4s; }
@keyframes rim-drift {
  from { --rim-phase: 135deg; }
  to { --rim-phase: 495deg; }
}
/* A failed attempt holds its orbit phase and softly colours only the dots. */
.line.is-stopped .focus-edge::before, .line.is-stopped .focus-haze::before { animation-play-state: paused; }
.line.is-error input { color: #f0a2aa; text-shadow: 0 0 4px #ed788b66, 0 0 10px #df667d40; }
.line:not(.is-error) input { color: var(--lab-purple-light); }
.ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
.screen[data-state="revealing"] .line { transform: scale(1.035); filter: blur(9px); opacity: 0; transition: transform .9s, filter .9s, opacity .75s; }
.screen[data-state="revealing"] .phase { opacity: 0; }
.screen[data-state="revealing"] .unlock-overlay { background: #17121fbb; }
.screen.is-fading .unlock-overlay { opacity: 0; backdrop-filter: blur(0); pointer-events: none; }
.lab-content { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s; }
.screen[data-state="revealing"] .lab-content, .screen.is-fading .lab-content { opacity: 1; transform: none; }
.lab-content .replay { position: absolute; right: 24px; bottom: 24px; width: 32px; height: 32px; padding: 0; border-radius: 50%; color: #cab0ed; opacity: .65; }
.lab-content .replay:focus-visible { outline-offset: 3px; }
@media(max-width: 420px) { .unlock-overlay { padding: 24px; } }
@media(prefers-reduced-motion: reduce) {
  .line.is-loading .focus-edge::before, .line.is-loading .focus-haze::before { animation: none; }
  .unlock-overlay, .lab-content, .screen[data-state="revealing"] .line { transition: opacity .15s; transform: none; filter: none; backdrop-filter: none; }
}


/* Full viewport deployment shell; the prototype remains unchanged. */
.screen{position:fixed;inset:0;min-height:100dvh;border-radius:0;padding:0}
.lab-content{opacity:0;transition:opacity 1.2s}
.lab-content iframe{display:block;width:100%;height:100%;border:0;background:var(--content-bg)}
[hidden]{display:none!important}
