:root {
  color-scheme: only light;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #d7cec0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #d7cec0;
}

body {
  overscroll-behavior: none;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

.gate {
  position: fixed;
  inset: 0;
  isolation: isolate;
  overflow: hidden;
  background: #d7cec0;
  cursor: text;
  -webkit-tap-highlight-color: transparent;
}

.gate-fallback,
.gate-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 46% 48%;
  user-select: none;
  -webkit-user-select: none;
}

.gate-field {
  z-index: 1;
  display: block;
  opacity: 0;
  transition: opacity 1ms steps(1, end);
}

.gate.is-rendering .gate-field {
  opacity: 1;
}

.gate-lattice {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image:
    repeating-linear-gradient(0deg, rgba(18, 16, 13, 0.13) 0, rgba(18, 16, 13, 0.13) 1px, transparent 1px, transparent 3px),
    repeating-linear-gradient(90deg, transparent 0, transparent 2px, rgba(255, 255, 255, 0.08) 2px, rgba(255, 255, 255, 0.08) 3px);
  background-position: var(--lattice-x, 0px) var(--lattice-y, 0px);
  transform: translate3d(var(--lattice-drift, 0px), 0, 0);
}

.gate-register {
  position: absolute;
  z-index: 3;
  inset: 9px 10px auto;
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr auto;
  min-height: 22px;
  border-top: 1px solid rgba(238, 231, 218, 0.52);
  border-bottom: 1px solid rgba(238, 231, 218, 0.24);
  color: rgba(246, 239, 226, 0.68);
  font-size: 7px;
  font-weight: 850;
  line-height: 20px;
  letter-spacing: 0.13em;
  text-shadow: 0 1px 6px rgba(15, 12, 9, 0.42);
  mix-blend-mode: difference;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 260ms steps(3, end), transform 540ms cubic-bezier(0.16, 0.8, 0.12, 1);
}

.gate-register span {
  min-width: 0;
  padding: 0 7px;
  border-right: 1px solid rgba(238, 231, 218, 0.22);
  overflow: hidden;
  white-space: nowrap;
}

.gate-register span:last-child {
  border-right: 0;
  text-align: right;
}

.gate-wordfield {
  position: absolute;
  z-index: 2;
  right: -1.6vw;
  bottom: -1.1vw;
  left: -1.8vw;
  display: grid;
  grid-template-columns: 0.78fr 1.42fr 0.78fr 1.42fr;
  color: rgba(141, 24, 17, 0.18);
  font-family: Arial Black, Helvetica Neue, Helvetica, sans-serif;
  font-size: clamp(58px, 13.2vw, 270px);
  font-weight: 950;
  line-height: 0.67;
  letter-spacing: -0.105em;
  mix-blend-mode: multiply;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  opacity: 0;
  transition: opacity 320ms steps(3, end), color 420ms steps(2, end), transform 720ms cubic-bezier(0.2, 0.7, 0.1, 1);
}

.gate-wordfield span {
  min-width: 0;
  border-left: 1px solid rgba(133, 24, 18, 0.16);
  overflow: hidden;
  white-space: nowrap;
}

.gate.is-ignited .gate-register,
.gate.is-ignited .gate-wordfield {
  opacity: 1;
}

.gate.is-ignited .gate-register {
  transform: translateY(0);
}

.gate-invitation {
  position: absolute;
  z-index: 7;
  left: clamp(18px, 9vw, 140px);
  bottom: clamp(54px, 12vh, 150px);
  display: grid;
  gap: 7px;
  max-width: calc(100vw - 36px);
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: rgba(240, 234, 221, 0.86);
  cursor: pointer;
  text-align: left;
  text-shadow: 0 2px 14px rgba(13, 10, 8, 0.38);
  mix-blend-mode: difference;
  transition: opacity 210ms steps(3, end), transform 440ms cubic-bezier(0.18, 0.78, 0.18, 1);
}

.gate-preedit {
  position: relative;
  display: block;
  min-width: 8.5ch;
  font-family: Arial Black, Helvetica Neue, Helvetica, sans-serif;
  font-size: clamp(46px, 9.4vw, 188px);
  font-weight: 950;
  line-height: 0.76;
  letter-spacing: -0.09em;
  white-space: nowrap;
}

.gate-preedit::after {
  content: "";
  position: absolute;
  right: 0.02em;
  bottom: -0.11em;
  left: 0.045em;
  height: 0.045em;
  min-height: 2px;
  background: currentColor;
  transform-origin: 0 50%;
  animation: preedit-rule 1.18s steps(4, end) infinite;
}

.gate-invitation small {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 0.4em;
  font-size: 7px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.17em;
}

.gate-invitation small b {
  min-width: 4.8em;
  padding: 2px 4px;
  background: currentColor;
  color: rgba(30, 27, 22, 0.88);
  font-weight: inherit;
  text-align: center;
}

.gate-invitation small i {
  font-style: normal;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 160ms steps(2, end), transform 260ms ease;
}

.gate-invitation.is-ready small i,
.gate-invitation:hover small i,
.gate-invitation:focus-visible small i {
  opacity: 1;
  transform: translateX(0);
}

.gate-invitation:focus-visible .gate-preedit,
.gate-invitation:hover .gate-preedit {
  transform: translateX(1px);
}

.gate.is-ignited .gate-invitation {
  opacity: 0;
  transform: translateX(12px) skewX(-1deg);
  pointer-events: none;
}

.gate.is-jazzing .gate-register {
  transform: translateX(1px);
  color: rgba(246, 239, 226, 0.88);
}

.gate.is-jazzing .gate-wordfield {
  color: rgba(141, 24, 17, 0.28);
  transform: translate3d(-1px, 0, 0) skewX(-0.12deg);
}

.gate-entry {
  position: absolute;
  z-index: 4;
  left: clamp(18px, 24vw, 30rem);
  right: clamp(18px, 10vw, 12rem);
  top: clamp(63%, 70vh, 78%);
  height: 28px;
  margin: 0;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 320ms steps(3, end) 180ms, transform 620ms cubic-bezier(0.18, 0.78, 0.18, 1) 120ms;
}

.gate.is-ignited .gate-entry {
  opacity: 1;
  transform: translateY(0);
}

.gate-entry::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(17, 15, 12, 0.06);
  transform: scaleX(0.04);
  transform-origin: 0 50%;
  transition: transform 900ms cubic-bezier(0.2, 0.7, 0.1, 1), background 180ms steps(1, end);
}

.gate[data-state="composing"] .gate-entry::after,
.gate[data-state="submitting"] .gate-entry::after,
.gate[data-state="rejected"] .gate-entry::after {
  transform: scaleX(1);
  background: rgba(17, 15, 12, 0.23);
}

.gate-entry input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0 0 7px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: rgba(20, 17, 14, 0.38);
  caret-color: transparent;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.55em;
  text-shadow: 0.35px 0 rgba(183, 25, 20, 0.16);
  -webkit-appearance: none;
  appearance: none;
}

.gate-entry input:focus-visible {
  outline: 0;
}

.gate-caret {
  position: absolute;
  z-index: 5;
  left: clamp(18px, 24vw, 30rem);
  top: calc(clamp(63%, 70vh, 78%) + 4px);
  width: 1px;
  height: 11px;
  background: rgba(18, 16, 13, 0.33);
  opacity: 0;
  transform: translateX(var(--caret-x, 0));
  pointer-events: none;
}

.gate[data-state="composing"] .gate-caret {
  opacity: 0.72;
  animation: caret-phase 1.47s steps(1, end) infinite;
}

.gate:not(.is-ignited) .gate-caret,
.gate:not(.is-ignited) .gate-status {
  display: none;
}

.gate-status {
  position: absolute;
  z-index: 5;
  left: clamp(18px, 24vw, 30rem);
  top: calc(clamp(63%, 70vh, 78%) + 35px);
  max-width: min(58ch, 60vw);
  margin: 0;
  color: rgba(183, 25, 20, 0.58);
  font-size: 7px;
  line-height: 1.2;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0;
}

.gate[data-state="rejected"] .gate-status,
.gate[data-state="held"] .gate-status {
  opacity: 1;
}

.gate[data-state="accepted"] .gate-field,
.gate[data-state="rejected"] .gate-field {
  animation: conversion-snap 180ms steps(2, end) 1;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes caret-phase {
  0%, 43% { opacity: 0.72; }
  44%, 100% { opacity: 0.14; }
}

@keyframes conversion-snap {
  0% { transform: translateX(0); filter: none; }
  32% { transform: translateX(-1px); filter: contrast(1.015) saturate(0.985); }
  64% { transform: translateX(1px); filter: contrast(0.995) saturate(1.01); }
  100% { transform: translateX(0); filter: none; }
}

@keyframes preedit-rule {
  0%, 31% { transform: scaleX(0.14); }
  32%, 67% { transform: scaleX(0.72); }
  68%, 100% { transform: scaleX(1); }
}

@media (max-aspect-ratio: 3 / 4) {
  .gate-entry,
  .gate-caret,
  .gate-status {
    left: clamp(20px, 22vw, 8rem);
    right: clamp(20px, 8vw, 5rem);
  }

  .gate-register {
    grid-template-columns: 1fr 1fr auto;
  }

  .gate-register span:nth-child(3) {
    display: none;
  }

  .gate-wordfield {
    right: -4vw;
    bottom: 3vh;
    left: -5vw;
    grid-template-columns: 0.75fr 1.45fr;
    font-size: clamp(82px, 25vw, 180px);
  }

  .gate-wordfield span:nth-child(n + 3) {
    display: none;
  }

  .gate-invitation {
    left: 18px;
    bottom: 14vh;
  }

  .gate-preedit {
    font-size: clamp(42px, 15vw, 90px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gate-field,
  .gate-lattice,
  .gate-caret,
  .gate-register,
  .gate-wordfield {
    animation: none !important;
    transform: none !important;
  }

  .gate-lattice {
    display: none;
  }

  .gate-preedit::after {
    animation: none !important;
    transform: scaleX(1);
  }
}
