/* Ported components. Each block is the library's published CSS with class names prefixed .ui-*, unchanged otherwise
   unless a comment says so. Credits and licences: js/ui/CREDITS.md.
   - HoldButton, VoicePill, SplitFlapText, TearTicket, RubberSegment: React Bits (MIT + Commons Clause v1.0, David Haz),
     https://reactbits.dev/r/<Name>-JS-CSS.json
   - Animated Beam: Magic UI (MIT), https://magicui.design/r/animated-beam.json (its Tailwind classes written out) */

/* ===== React Bits HoldButton ===== */
.ui-hold-button {
  --hb-radius: 14px;
  --hb-bg: #27272a;
  --hb-fill: #5227ff;
  --hb-text: #f5f5f5;
  --hb-fill-text: #ffffff;
  --hb-hold: 2000ms;
  --hb-release: 200ms;
  --hb-press: 0.97;
  --hb-wave: 6px;
  --hb-w: 0px;
  --hb-h: 0px;
  --hb-cycles: 2;
  --hb-p: 0;
  --hb-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --hb-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --hb-glow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 32px -6px color-mix(in srgb, var(--hb-fill) 70%, transparent);

  position: relative;
  display: inline-grid;
  place-items: center;
  isolation: isolate;
  margin: 0;
  border: 0;
  border-radius: var(--hb-radius);
  background: var(--hb-bg);
  color: var(--hb-text);
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  box-shadow: var(--hb-shadow);
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    transform 160ms var(--hb-ease-out),
    background-color 160ms ease,
    box-shadow var(--hb-release) var(--hb-ease-out);
}

.ui-hold-button--sm {
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
}

.ui-hold-button--md {
  height: 44px;
  padding: 0 22px;
  font-size: 15px;
}

.ui-hold-button--lg {
  height: 52px;
  padding: 0 28px;
  font-size: 17px;
}

@media (hover: hover) and (pointer: fine) {
  .ui-hold-button:not(:disabled):hover {
    background: color-mix(in srgb, var(--hb-bg) 92%, #fff);
  }
}

.ui-hold-button[data-phase='holding'][data-input='pointer'] {
  transform: scale(var(--hb-press));
}

.ui-hold-button[data-glow='true'][data-phase='holding'],
.ui-hold-button[data-glow='true'][data-phase='done'] {
  box-shadow: var(--hb-glow);
}

.ui-hold-button[data-glow='true'][data-phase='holding'] {
  transition:
    transform 160ms var(--hb-ease-out),
    background-color 160ms ease,
    box-shadow var(--hb-hold) linear;
}

.ui-hold-button:focus-visible {
  outline: 2px solid var(--hb-fill);
  outline-offset: 3px;
}

.ui-hold-button:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.ui-hold-button__pulse {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--hb-radius);
  pointer-events: none;
  opacity: 0;
}

.ui-hold-button[data-glow='true'][data-phase='done'] .ui-hold-button__pulse {
  animation: hb-pulse 600ms var(--hb-ease-out) forwards;
}

@keyframes hb-pulse {
  from {
    opacity: 1;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--hb-fill) 55%, transparent);
  }
  to {
    opacity: 0;
    box-shadow: 0 0 0 14px color-mix(in srgb, var(--hb-fill) 0%, transparent);
  }
}

.ui-hold-button__label {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
}

.ui-hold-button__label > span {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition:
    opacity 200ms ease,
    filter 200ms ease;
}

.ui-hold-button__icon {
  display: inline-flex;
  flex: none;
}

.ui-hold-button__icon > svg {
  display: block;
}

.ui-hold-button__done {
  opacity: 0;
  filter: blur(2px);
}

.ui-hold-button[data-phase='done'] .ui-hold-button__idle {
  opacity: 0;
  filter: blur(2px);
}

.ui-hold-button[data-phase='done'] .ui-hold-button__done {
  opacity: 1;
  filter: blur(0);
}

.ui-hold-button__clip {
  position: absolute;
  inset: 0;
  z-index: 3;
  clip-path: inset(0 round var(--hb-radius));
  pointer-events: none;
}

.ui-hold-button__fill {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--hb-fill);
  color: var(--hb-fill-text);
  clip-path: inset(
    0 calc((1 - var(--hb-p)) * (100% + 0.75 * var(--hb-wave)) - var(--hb-p) * 0.25 * var(--hb-wave)) 0 0
  );
}

.ui-hold-button[data-direction='up'] .ui-hold-button__fill {
  clip-path: inset(
    calc((1 - var(--hb-p)) * (100% + 0.75 * var(--hb-wave)) - var(--hb-p) * 0.25 * var(--hb-wave)) 0 0 0
  );
}

.ui-hold-button__crest {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--hb-fill);
  color: var(--hb-fill-text);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='200' viewBox='0 0 20 200' preserveAspectRatio='none'%3E%3Cpath d='M0 0H10C18 8 18 25.3 10 33.3S2 58.7 10 66.7S18 92 10 100S2 125.3 10 133.3S18 158.7 10 166.7S2 192 10 200H0Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='200' viewBox='0 0 20 200' preserveAspectRatio='none'%3E%3Cpath d='M0 0H10C18 8 18 25.3 10 33.3S2 58.7 10 66.7S18 92 10 100S2 125.3 10 133.3S18 158.7 10 166.7S2 192 10 200H0Z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: repeat-y;
  mask-repeat: repeat-y;
  -webkit-mask-size: var(--hb-wave) calc(var(--hb-h) * 2);
  mask-size: var(--hb-wave) calc(var(--hb-h) * 2);
  -webkit-mask-position-x: calc(-1 * var(--hb-wave) + var(--hb-p) * (var(--hb-w) + var(--hb-wave)));
  mask-position-x: calc(-1 * var(--hb-wave) + var(--hb-p) * (var(--hb-w) + var(--hb-wave)));
  -webkit-mask-position-y: calc(-1 * var(--hb-p) * var(--hb-cycles) * var(--hb-h));
  mask-position-y: calc(-1 * var(--hb-p) * var(--hb-cycles) * var(--hb-h));
}

.ui-hold-button[data-direction='up'] .ui-hold-button__crest {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='20' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M0 20V10C12 2 38 2 50 10S88 18 100 10S138 2 150 10S188 18 200 10V20Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='20' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M0 20V10C12 2 38 2 50 10S88 18 100 10S138 2 150 10S188 18 200 10V20Z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: repeat-x;
  mask-repeat: repeat-x;
  -webkit-mask-size: calc(var(--hb-w) * 2) var(--hb-wave);
  mask-size: calc(var(--hb-w) * 2) var(--hb-wave);
  -webkit-mask-position-x: calc(-1 * var(--hb-p) * var(--hb-cycles) * var(--hb-w));
  mask-position-x: calc(-1 * var(--hb-p) * var(--hb-cycles) * var(--hb-w));
  -webkit-mask-position-y: calc(var(--hb-h) - var(--hb-p) * (var(--hb-h) + var(--hb-wave)));
  mask-position-y: calc(var(--hb-h) - var(--hb-p) * (var(--hb-h) + var(--hb-wave)));
}

.ui-hold-button__label--fill {
  z-index: auto;
}

.ui-hold-button__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-contrast: more) {
  .ui-hold-button {
    outline: 1px solid var(--hb-text);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ui-hold-button {
    transition:
      background-color 160ms ease,
      box-shadow var(--hb-release) ease;
    transform: none !important;
  }

  .ui-hold-button__fill,
  .ui-hold-button[data-direction='up'] .ui-hold-button__fill {
    clip-path: inset(0);
    opacity: 0;
    transition: opacity var(--hb-release) ease;
  }

  .ui-hold-button__crest {
    display: none;
  }

  .ui-hold-button[data-phase='holding'] .ui-hold-button__fill,
  .ui-hold-button[data-phase='done'] .ui-hold-button__fill {
    opacity: 1;
    transition: opacity var(--hb-hold) linear;
  }

  .ui-hold-button__pulse {
    animation: none !important;
  }

  .ui-hold-button__label > span {
    transition: opacity 200ms ease;
    filter: none !important;
  }
}

/* ===== React Bits VoicePill ===== */
.ui-voice-pill {
  --vp-accent: #f5f5f5;
  --vp-icon: #a1a1aa;
  --vp-bg: #27272a;
  --vp-size: 28px;
  --vp-radius: 14px;
  --vp-reach: 8px;
  --vp-extra: 0px;
  --vp-clock-w: 0px;
  --vp-wave-w: 0px;
  --vp-slide: 0px;
  --vp-cancel: 0;
  --vp-stop: 9px;
  --vp-icon-size: 15px;
  --vp-time-size: 10px;
  --vp-open: 200ms;
  --vp-press: 0.97; /* Vivi change: the site's one press value (0.97, 150 ms ease-out) */
  --vp-hit: 8px;
  --vp-ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  position: relative;
  display: inline-grid;
  place-items: center;
  isolation: isolate;
  width: var(--vp-size);
  height: var(--vp-size);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--vp-radius);
  background: transparent;
  color: var(--vp-icon);
  font-family: inherit;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition:
    transform 150ms ease-out,
    color 150ms ease;
}

.ui-voice-pill::before {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--vp-hit));
}

.ui-voice-pill[data-state='listening'] {
  z-index: 1;
  color: var(--vp-accent);
}

.ui-voice-pill[data-pressed] {
  transform: scale(var(--vp-press));
}

.ui-voice-pill:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.ui-voice-pill__capsule {
  position: absolute;
  inset: 0 0 0 calc(-1 * (var(--vp-reach) + var(--vp-extra)));
  border-radius: var(--vp-radius);
  background: var(--vp-bg);
  clip-path: inset(0 0 0 calc(var(--vp-reach) + var(--vp-extra)) round var(--vp-radius));
  pointer-events: none;
  transition:
    clip-path var(--vp-open) var(--vp-ease-out),
    background-color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .ui-voice-pill[data-state='idle']:not(:disabled):hover .ui-voice-pill__capsule {
    background: color-mix(in srgb, var(--vp-icon) 10%, var(--vp-bg));
  }
}

.ui-voice-pill[data-state='listening'] .ui-voice-pill__capsule {
  clip-path: inset(0 0 round var(--vp-radius));
}

.ui-voice-pill__time {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 100%;
  display: grid;
  place-items: center;
  width: var(--vp-clock-w);
  box-sizing: border-box;
  color: var(--vp-accent);
  font-size: var(--vp-time-size);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  opacity: 0;
  filter: blur(2px);
  transform: translateX(var(--vp-slide));
  pointer-events: none;
  transition:
    opacity 200ms ease,
    filter 200ms ease,
    transform 240ms var(--vp-ease-out);
}

.ui-voice-pill[data-state='listening'] .ui-voice-pill__time {
  opacity: calc(1 - var(--vp-cancel));
  filter: blur(0);
}

.ui-voice-pill__wave {
  position: absolute;
  color: var(--vp-accent);
  top: 18%;
  right: calc(100% + var(--vp-clock-w));
  width: var(--vp-wave-w);
  height: 64%;
  opacity: 0;
  filter: blur(2px);
  transform: translateX(var(--vp-slide));
  pointer-events: none;
  transition:
    opacity 200ms ease,
    filter 200ms ease,
    transform 240ms var(--vp-ease-out);
}

.ui-voice-pill[data-state='listening'] .ui-voice-pill__wave {
  opacity: calc(1 - var(--vp-cancel));
  filter: blur(0);
}

.ui-voice-pill__cancel {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: var(--vp-extra);
  color: var(--vp-accent);
  font-size: var(--vp-time-size);
  font-weight: 500;
  line-height: 1;
  opacity: var(--vp-cancel);
  pointer-events: none;
}

.ui-voice-pill[data-sliding] .ui-voice-pill__time,
.ui-voice-pill[data-sliding] .ui-voice-pill__wave,
.ui-voice-pill[data-sliding] .ui-voice-pill__glyph {
  transition-property: opacity, filter;
}

.ui-voice-pill__glyph {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--vp-size);
  height: var(--vp-size);
  transform: translateX(var(--vp-slide));
  transition: transform 240ms var(--vp-ease-out);
}

.ui-voice-pill__glyph > * {
  grid-area: 1 / 1;
  transition:
    opacity 200ms ease,
    filter 200ms ease,
    transform 200ms var(--vp-ease-out);
}

.ui-voice-pill__mic {
  display: inline-flex;
}

.ui-voice-pill__stop {
  width: var(--vp-stop);
  height: var(--vp-stop);
  border-radius: 22%;
  background: currentColor;
  opacity: 0;
  filter: blur(2px);
  transform: scale(0.6);
}

.ui-voice-pill[data-state='listening'] .ui-voice-pill__mic {
  opacity: 0;
  filter: blur(2px);
  transform: scale(0.7);
}

.ui-voice-pill[data-state='listening'] .ui-voice-pill__stop {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

.ui-voice-pill[data-input='key'] .ui-voice-pill__capsule,
.ui-voice-pill[data-input='key'] .ui-voice-pill__time,
.ui-voice-pill[data-input='key'] .ui-voice-pill__glyph > * {
  transition-duration: 0ms;
}

@media (prefers-reduced-motion: reduce) {
  .ui-voice-pill {
    transform: none !important;
    transition: color 150ms ease;
  }

  .ui-voice-pill__capsule {
    transition: background-color 150ms ease;
  }

  .ui-voice-pill__glyph > * {
    filter: none !important;
    transform: none !important;
    transition: opacity 200ms ease;
  }

  .ui-voice-pill__time,
  .ui-voice-pill__wave,
  .ui-voice-pill__glyph {
    filter: none !important;
    transition-property: opacity;
  }
}

/* ===== React Bits SplitFlapText ===== */
.ui-split-flap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--split-flap-gap, 6px);
  color: var(--split-flap-text-color, #f8fafc);
  font-family: 'SFMono-Regular', 'Roboto Mono', 'Cascadia Code', 'Liberation Mono', Menlo, monospace;
  font-size: var(--split-flap-font-size, 52px);
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0.035em;
  white-space: pre;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.ui-split-flap__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ui-split-flap__tile {
  position: relative;
  flex: none;
  width: 0.78em;
  height: 1.08em;
  overflow: hidden;
  border-radius: var(--split-flap-radius, 8px);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.16), transparent 44%),
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--split-flap-tile-color, #111827) 82%, white),
      var(--split-flap-tile-color, #111827)
    );
  box-shadow:
    0 0.035em 0.08em rgba(255, 255, 255, 0.08) inset,
    0 -0.05em 0.1em rgba(0, 0, 0, 0.38) inset,
    0 calc(0.16em * var(--split-flap-lift, 1)) calc(0.38em * var(--split-flap-lift, 1))
      rgba(0, 0, 0, var(--split-flap-drop, 0.28));
  perspective: 10em;
  transform-style: preserve-3d;
  isolation: isolate;
}

.ui-split-flap__tile::before {
  content: '';
  position: absolute;
  z-index: 8;
  top: calc(50% - var(--split-flap-hinge, 1px) / 2);
  left: 0;
  width: 100%;
  height: var(--split-flap-hinge, 1px);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.18) 18%,
    rgba(0, 0, 0, var(--split-flap-hinge-shade, 0.64)) 50%,
    rgba(255, 255, 255, 0.14) 82%,
    transparent
  );
  box-shadow:
    0 -1px 0 rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.ui-split-flap__tile::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 9;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2) inset;
  pointer-events: none;
}

.ui-split-flap__half,
.ui-split-flap__flap {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 34%), var(--split-flap-tile-color, #111827);
  backface-visibility: hidden;
}

.ui-split-flap__half--top,
.ui-split-flap__flap--front {
  top: 0;
}

.ui-split-flap__half--bottom,
.ui-split-flap__flap--back {
  bottom: 0;
}

.ui-split-flap__half--bottom,
.ui-split-flap__flap--back {
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.06), transparent 38%),
    color-mix(in srgb, var(--split-flap-tile-color, #111827) 92%, black);
}

.ui-split-flap__char {
  position: absolute;
  left: 0;
  width: 100%;
  height: 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--split-flap-text-color, #f8fafc);
  text-shadow:
    0 0.025em 0 rgba(255, 255, 255, 0.16),
    0 0.09em 0.16em rgba(0, 0, 0, 0.42);
}

.ui-split-flap__half--top .ui-split-flap__char,
.ui-split-flap__flap--front .ui-split-flap__char {
  top: 0;
}

.ui-split-flap__half--bottom .ui-split-flap__char,
.ui-split-flap__flap--back .ui-split-flap__char {
  bottom: 0;
}

.ui-split-flap__flap {
  z-index: 6;
  will-change: transform, filter;
  transform-style: preserve-3d;
}

.ui-split-flap__flap--front {
  transform-origin: center bottom;
  box-shadow: inset 0 var(--split-flap-edge, 0em) 0 rgba(255, 255, 255, 0.16);
  animation: split-flap-front var(--split-flap-flip-duration, 0.12s) linear both;
}

.ui-split-flap__flap--back {
  transform-origin: center top;
  transform: rotateX(90deg);
  box-shadow: inset 0 calc(var(--split-flap-edge, 0em) * -1) 0 rgba(0, 0, 0, 0.4);
  animation: split-flap-back var(--split-flap-flip-duration, 0.12s) linear both;
}

.ui-split-flap__shade {
  position: absolute;
  z-index: 4;
  left: 0;
  width: 100%;
  height: 50%;
  pointer-events: none;
  animation: split-flap-shade-top var(--split-flap-flip-duration, 0.12s) linear both;
}

.ui-split-flap__shade--top {
  top: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, var(--split-flap-cast, 0)), transparent 85%);
}

.ui-split-flap__shade--bottom {
  bottom: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, var(--split-flap-cast, 0)), transparent 90%);
  animation-name: split-flap-shade-bottom;
}

.ui-split-flap--glare .ui-split-flap__flap::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
      180deg,
      transparent 32%,
      rgba(255, 255, 255, var(--split-flap-glare, 0)) 50%,
      transparent 68%
    )
    0 100% / 100% 300% no-repeat;
  animation: split-flap-glare-front var(--split-flap-flip-duration, 0.12s) linear both;
}

.ui-split-flap--glare .ui-split-flap__flap--back::after {
  animation-name: split-flap-glare-back;
}

.ui-split-flap--minimal .ui-split-flap__tile {
  background: none;
  box-shadow: none;
  -webkit-mask:
    linear-gradient(#000 0 0) top / 100% calc(50% - var(--split-flap-split, 0.045em) / 2) no-repeat,
    linear-gradient(#000 0 0) bottom / 100% calc(50% - var(--split-flap-split, 0.045em) / 2) no-repeat;
  mask:
    linear-gradient(#000 0 0) top / 100% calc(50% - var(--split-flap-split, 0.045em) / 2) no-repeat,
    linear-gradient(#000 0 0) bottom / 100% calc(50% - var(--split-flap-split, 0.045em) / 2) no-repeat;
}

.ui-split-flap--minimal .ui-split-flap__tile::before,
.ui-split-flap--minimal .ui-split-flap__tile::after,
.ui-split-flap--minimal .ui-split-flap__flap::after {
  display: none;
}

.ui-split-flap--minimal .ui-split-flap__half,
.ui-split-flap--minimal .ui-split-flap__flap {
  background: none;
  box-shadow: none;
}

.ui-split-flap--minimal .ui-split-flap__char {
  text-shadow: none;
}

.ui-split-flap--minimal .ui-split-flap__tile.is-flipping .ui-split-flap__half--top {
  animation: split-flap-reveal var(--split-flap-flip-duration, 0.12s) linear both;
}

.ui-split-flap--minimal .ui-split-flap__tile.is-flipping .ui-split-flap__half--bottom {
  animation: split-flap-cover var(--split-flap-flip-duration, 0.12s) linear both;
}

@keyframes split-flap-front {
  0% {
    transform: rotateX(0deg);
    filter: brightness(var(--split-flap-front-from, 1.08));
    animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
  }

  50%,
  100% {
    transform: rotateX(-90deg);
    filter: brightness(var(--split-flap-front-to, 0.52));
  }
}

@keyframes split-flap-back {
  0%,
  50% {
    transform: rotateX(90deg);
    filter: brightness(var(--split-flap-back-from, 0.58));
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }

  100% {
    transform: rotateX(0deg);
    filter: brightness(1);
  }
}

@keyframes split-flap-shade-top {
  0%,
  32% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@keyframes split-flap-shade-bottom {
  0% {
    opacity: 0;
    animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
  }

  50%,
  100% {
    opacity: 1;
  }
}

@keyframes split-flap-glare-front {
  0% {
    background-position: 0 100%;
    opacity: 0;
  }

  30% {
    opacity: 1;
  }

  50%,
  100% {
    background-position: 0 0%;
    opacity: 0.75;
  }
}

@keyframes split-flap-glare-back {
  0%,
  50% {
    background-position: 0 100%;
    opacity: 0.75;
  }

  100% {
    background-position: 0 0%;
    opacity: 0;
  }
}

@keyframes split-flap-reveal {
  0% {
    clip-path: inset(0 0 100% 0);
  }

  23.14% {
    clip-path: inset(0 0 99.21% 0);
  }

  29.67% {
    clip-path: inset(0 0 95.55% 0);
  }

  33.95% {
    clip-path: inset(0 0 89.09% 0);
  }

  37.41% {
    clip-path: inset(0 0 79.46% 0);
  }

  40.56% {
    clip-path: inset(0 0 66.05% 0);
  }

  43.73% {
    clip-path: inset(0 0 47.69% 0);
  }

  47.38% {
    clip-path: inset(0 0 21.22% 0);
  }

  50%,
  100% {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes split-flap-cover {
  0%,
  50% {
    clip-path: inset(0 0 0 0);
  }

  54.42% {
    clip-path: inset(35.75% 0 0 0);
  }

  57.44% {
    clip-path: inset(55.86% 0 0 0);
  }

  60.39% {
    clip-path: inset(70.63% 0 0 0);
  }

  63.65% {
    clip-path: inset(81.86% 0 0 0);
  }

  67.65% {
    clip-path: inset(90.23% 0 0 0);
  }

  73.17% {
    clip-path: inset(96% 0 0 0);
  }

  82.62% {
    clip-path: inset(99.25% 0 0 0);
  }

  100% {
    clip-path: inset(100% 0 0 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ui-split-flap__flap,
  .ui-split-flap__flap::after,
  .ui-split-flap__shade,
  .ui-split-flap__half {
    animation: none !important;
  }
}

/* ===== React Bits TearTicket ===== */
.ui-tear-ticket {
  --tt-w: 460px;
  --tt-h: 250px;
  --tt-stub: 150px;
  --tt-bg: #27272a;
  --tt-stub-bg: #27272a;
  --tt-ink: #f5f5f5;
  --tt-edge: transparent;
  --tt-edge-w: 1;
  --tt-parallax: 6px;
  --tt-body-w: 310px;
  --tt-body-h: 250px;
  --tt-inset: 8px;
  --tt-span: 0.78;
  --tt-art-radius: 8px;
  --tt-fit: 1;

  position: relative;
  width: min(var(--tt-w), 100%);
  color: var(--tt-ink);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.ui-tear-ticket[data-disabled] {
  opacity: 0.6;
}

.ui-tear-ticket__stage {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--tt-w);
  height: var(--tt-h);
  transform: scale(var(--tt-fit));
  transform-origin: top left;
  transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ui-tear-ticket[data-shift='x'] .ui-tear-ticket__stage {
  transform: translateX(calc(var(--tt-stub) * var(--tt-fit) / 2)) scale(var(--tt-fit));
}

.ui-tear-ticket[data-shift='y'] .ui-tear-ticket__stage {
  transform: translateY(calc(var(--tt-stub) * var(--tt-fit) / 2)) scale(var(--tt-fit));
}

.ui-tear-ticket__plane {
  position: absolute;
  inset: 0;
}

.ui-tear-ticket__piece {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ui-tear-ticket__piece--stub {
  outline: none;
  will-change: transform;
}

.ui-tear-ticket__edge {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ui-tear-ticket__edge path {
  fill: none;
  stroke: var(--tt-edge);
  stroke-width: var(--tt-edge-w);
}

.ui-tear-ticket__paper {
  position: absolute;
  inset: 0;
  background: var(--tt-bg);
  pointer-events: auto;
}

.ui-tear-ticket__paper--stub {
  background: var(--tt-stub-bg);
  cursor: grab;
  touch-action: none;
}

.ui-tear-ticket[data-grabbing] .ui-tear-ticket__paper--stub {
  cursor: grabbing;
}

.ui-tear-ticket[data-disabled] .ui-tear-ticket__paper--stub {
  cursor: default;
}

.ui-tear-ticket__art {
  position: absolute;
  top: var(--tt-inset);
  left: var(--tt-inset);
  width: calc(var(--tt-body-w) - var(--tt-inset) * 2);
  height: calc(var(--tt-body-h) * var(--tt-span) - var(--tt-inset) * 2);
  border-radius: var(--tt-art-radius);
  overflow: hidden;
}

.ui-tear-ticket__image {
  position: absolute;
  top: calc(var(--tt-parallax) * -1);
  left: calc(var(--tt-parallax) * -1);
  width: calc(100% + var(--tt-parallax) * 2);
  max-width: none;
  height: calc(100% + var(--tt-parallax) * 2);
  object-fit: cover;
  -webkit-user-drag: none;
  transition: filter 700ms ease;
}

.ui-tear-ticket[data-used] .ui-tear-ticket__image {
  filter: grayscale(1) brightness(0.75);
}

.ui-tear-ticket__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--tt-bg) 0%,
    color-mix(in srgb, var(--tt-bg) 72%, transparent) 30%,
    color-mix(in srgb, var(--tt-bg) 18%, transparent) 58%,
    transparent 80%
  );
}

.ui-tear-ticket__content {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(var(--tt-w) - var(--tt-stub));
  transition: opacity 500ms ease;
}

.ui-tear-ticket[data-used] .ui-tear-ticket__content {
  opacity: 0.55;
}

.ui-tear-ticket__stub {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--tt-stub);
}

.ui-tear-ticket[data-orientation='vertical'] .ui-tear-ticket__content {
  bottom: auto;
  width: 100%;
  height: calc(var(--tt-h) - var(--tt-stub));
}

.ui-tear-ticket[data-orientation='vertical'] .ui-tear-ticket__stub {
  top: auto;
  left: 0;
  width: auto;
  height: var(--tt-stub);
}

.ui-tear-ticket[data-instant] .ui-tear-ticket__stage,
.ui-tear-ticket[data-instant] .ui-tear-ticket__content,
.ui-tear-ticket[data-instant] .ui-tear-ticket__image {
  transition-duration: 0ms;
}

.ui-tear-ticket__fibres {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.ui-tear-ticket__fibres path {
  fill: none;
  stroke: var(--tt-bg);
  stroke-linecap: round;
  opacity: 0;
}

.ui-tear-ticket__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .ui-tear-ticket__stage {
    transition: none;
  }
}

/* ===== React Bits RubberSegment ===== */
.ui-rubber-segment {
  /* Vivi: colours come from the design system (css/ds.css --ds-seg-*); React Bits' own values are the fallback */
  --rs-track: var(--ds-seg-track, #27272a);
  --rs-thumb: var(--ds-seg-thumb, #fafafa);
  --rs-ink: var(--ds-seg-ink, #fafafa);
  --rs-ink-active: var(--ds-seg-ink-on, #18181b);
  --rs-radius: 10px;
  --rs-inset: 3px;
  --rs-thumb-radius: 7px;
  --rs-h: 36px;
  --rs-font: 13px;
  --rs-pad: 14px;
  --rs-min: 44px;
  --rs-idle: 0.7;
  --rs-hover: 0.9;
  --rs-ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  vertical-align: middle;
  padding: var(--rs-inset);
  border-radius: var(--rs-radius);
  background: var(--rs-track);
  font-family: inherit;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.ui-rubber-segment[data-equal] {
  grid-auto-columns: minmax(0, 1fr);
}

.ui-rubber-segment[aria-disabled='true'] {
  opacity: 0.5;
  pointer-events: none;
}

.ui-rubber-segment__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: calc(var(--rs-h) - var(--rs-inset) * 2);
  min-width: var(--rs-min);
  margin: 0;
  padding: 0 var(--rs-pad);
  border: 0;
  border-radius: var(--rs-thumb-radius);
  background: none;
  color: var(--rs-ink);
  opacity: var(--rs-idle);
  font: inherit;
  font-size: var(--rs-font);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  transition:
    opacity 160ms ease,
    transform 150ms ease-out;
}

.ui-rubber-segment__item[aria-checked='true'] {
  cursor: default;
}

.ui-rubber-segment[data-draggable] .ui-rubber-segment__item[aria-checked='true'] {
  cursor: grab;
}

.ui-rubber-segment[data-held],
.ui-rubber-segment[data-held] .ui-rubber-segment__item {
  cursor: grabbing;
}

.ui-rubber-segment__item[data-pressed] {
  transform: scale(0.97); /* Vivi change: 0.96 -> the site's 0.97 */
}

.ui-rubber-segment__item:focus-visible {
  outline: var(--ds-focus-w, 2px) solid var(--ds-focus-c, var(--rs-thumb));
  outline-offset: var(--ds-focus-offset, 3px);
}

@media (hover: hover) and (pointer: fine) {
  .ui-rubber-segment__item[aria-checked='false']:hover {
    opacity: var(--rs-hover);
  }
}

.ui-rubber-segment__thumb {
  position: absolute;
  inset: var(--rs-inset);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  background: var(--rs-thumb);
  color: var(--rs-ink-active);
  pointer-events: none;
}

.ui-rubber-segment[data-equal] .ui-rubber-segment__thumb {
  grid-auto-columns: minmax(0, 1fr);
}

.ui-rubber-segment__copy {
  color: inherit;
  opacity: 1;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .ui-rubber-segment__item {
    transition: opacity 160ms ease;
  }
}

/* ===== Magic UI Animated Beam: "pointer-events-none absolute top-0 left-0 transform-gpu stroke-2" ===== */
.ui-animated-beam {
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  transform: translate3d(0, 0, 0);
  stroke-width: 2;
}

/* ===== Magic UI Border Beam: "pointer-events-none absolute inset-0 rounded-[inherit] border-(length:--border-beam-width)
   border-transparent mask-[linear-gradient(transparent,transparent),linear-gradient(#000,#000)] mask-intersect
   [mask-clip:padding-box,border-box]"; the beam: "absolute aspect-square bg-linear-to-l from-(--color-from)
   via-(--color-to) to-transparent", offset-path rect(0 auto auto 0 round size). Vivi: hidden until [data-active];
   moves only with no motion preference and Pause motion off. ===== */
.ui-border-beam {
  pointer-events: none; position: absolute; inset: 0; z-index: 30; border-radius: inherit;
  border: var(--border-beam-width) solid transparent;
  mask: linear-gradient(transparent, transparent) padding-box, linear-gradient(#000, #000) border-box;
  mask-composite: intersect;
  opacity: 0; transition: opacity 0.45s var(--ease-out, ease-out);
}
.ui-border-beam[data-active] { opacity: 1; }
.ui-border-beam > i {
  position: absolute; aspect-ratio: 1 / 1; width: var(--size);
  background: linear-gradient(to left, var(--color-from), var(--color-to), transparent);
  offset-path: rect(0 auto auto 0 round var(--size));
  offset-distance: var(--bb-from);
}
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="off"]) .ui-border-beam[data-active] > i { animation: ui-border-beam var(--bb-duration) linear var(--bb-delay) infinite; }
}
.ui-border-beam[data-paused] > i { animation-play-state: paused; }
@keyframes ui-border-beam { from { offset-distance: var(--bb-from); } to { offset-distance: var(--bb-to); } }

/* ===== Vivi: a hold let go too early springs back with a small "no" (exaggerated feedback, then follow-through):
   horizontal only, decaying, on the translate property so it never fights the press scale */
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="off"]) .ui-hold-button[data-miss] { animation: hb-miss 320ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
}
@keyframes hb-miss { 20% { translate: -5px 0; } 40% { translate: 4px 0; } 60% { translate: -2.5px 0; } 80% { translate: 1px 0; } 100% { translate: 0 0; } }

/* ===== Vivi: the page's own "Pause motion" switch gets the same treatment as prefers-reduced-motion ===== */
html[data-motion="off"] {
  .ui-hold-button { transition: background-color 160ms ease, box-shadow var(--hb-release) ease; transform: none !important; }
  .ui-hold-button__fill, .ui-hold-button[data-direction='up'] .ui-hold-button__fill { clip-path: inset(0); opacity: 0; transition: opacity var(--hb-release) ease; }
  .ui-hold-button__crest { display: none; }
  .ui-hold-button[data-phase='holding'] .ui-hold-button__fill, .ui-hold-button[data-phase='done'] .ui-hold-button__fill { opacity: 1; transition: opacity var(--hb-hold) linear; }
  .ui-hold-button__pulse { animation: none !important; }
  .ui-hold-button__label > span { transition: opacity 200ms ease; filter: none !important; }

  .ui-voice-pill { transform: none !important; transition: color 150ms ease; }
  .ui-voice-pill__capsule { transition: background-color 150ms ease; }
  .ui-voice-pill__glyph > * { filter: none !important; transform: none !important; transition: opacity 200ms ease; }
  .ui-voice-pill__time, .ui-voice-pill__wave, .ui-voice-pill__glyph { filter: none !important; transition-property: opacity; }

  .ui-split-flap__flap, .ui-split-flap__flap::after, .ui-split-flap__shade, .ui-split-flap__half { animation: none !important; }

  .ui-tear-ticket__stage { transition: none; }

  .ui-rubber-segment__item { transition: opacity 160ms ease; }
}

/* ---- permissionToggle (js/ui/permission-toggle.js): a design-system control (css/ds.css): .ds-label above, .ds-seg,
   .ds-hint below, .ds-tooltip per level. Same look on every surface; the #work stage changes it only through tokens
   (.ds-dark). Four labels fit narrow notes by wrapping to two lines. */
.ui-perm { display: grid; gap: var(--ds-2, 8px); }
.ui-perm-desc { min-height: 2.8em; }
.ui-perm .ui-rubber-segment {
  display: grid; width: 100%;
  --rs-font: 0.8125rem !important; --rs-pad: 4px !important; --rs-min: 0px !important;
}
/* columns weighted by label length (the thumb copy uses the same columns), so "Handle the routine" gets the room
   for two balanced lines instead of three; text never wraps past two lines at the widths the notes use */
.ui-perm .ui-rubber-segment, .ui-perm .ui-rubber-segment__thumb {
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr);
}
.ui-perm .ui-rubber-segment__item {
  height: auto; min-height: 2.5rem; padding-block: 5px;
  white-space: normal; text-align: center; line-height: 1.15; text-wrap: balance; opacity: 0.85;
}
/* the level tooltip (.ds-tooltip): Vivi explaining itself, in the approval card's language (orb + title row, body,
   a muted context line) */
.ui-perm-tip p { margin: 0; }
.ui-perm-tip-head { display: flex; align-items: center; gap: var(--ds-2, 8px); }
.ui-perm-tip-head b { font-weight: 600; }
.ui-perm-tip-def { color: var(--ink-3); }
.ui-perm-tip-body { margin-top: 6px !important; }
.ui-perm-tip-ctx { margin-top: var(--ds-2, 8px) !important; padding-top: var(--ds-2, 8px); border-top: 1px solid var(--ds-divider, var(--line)); color: var(--ink-2); }
.ui-perm .ui-rubber-segment .ui-rubber-segment__item { font-size: var(--rs-font); font-weight: 500; line-height: 1.15; }

/* VoicePill with a face (Vivi's orb): the orb stays while listening (it turns and pulses itself), no stop square */
.ui-voice-pill--face .ui-voice-pill__mic { display: grid; place-items: center; width: 100%; height: 100%; }
.ui-voice-pill--face[data-state='listening'] .ui-voice-pill__mic { opacity: 1; filter: none; transform: none; }
.ui-voice-pill--face .ui-voice-pill__stop { display: none; }

/* ShinyText (React Bits, js/ui/shiny-text.js): the text is painted by its background, a sheen sweeps through it */
.ui-shiny-text {
  position: relative;
  display: inline-block;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ui-shiny-text__glow {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  filter: blur(0.14em);
  pointer-events: none;
  user-select: none;
}
/* forced colours drop backgrounds: keep the text itself */
@media (forced-colors: active) { .ui-shiny-text { -webkit-text-fill-color: currentColor; background: none !important; } }
