:root {
  --bg: #020611;
  --panel: rgba(7, 14, 28, 0.78);
  --panel-strong: rgba(6, 12, 24, 0.92);
  --panel-border: rgba(96, 145, 228, 0.28);
  --panel-border-strong: rgba(120, 178, 255, 0.48);
  --text-main: #e6f1ff;
  --text-soft: #86a3d6;
  --text-dim: #5f769f;
  --cyan: #6af7ff;
  --blue: #65a5ff;
  --blue-strong: #2f78ff;
  --amber: #ffb347;
  --red: #ff7d8d;
  --lcd-bg: #00120a;
  --lcd-text: #00e05a;
  --lcd-dim: #003c18;
  --shadow: 0 24px 80px rgba(0, 8, 25, 0.68);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #01040b;
  color: var(--text-main);
  font-family: "Courier New", Courier, monospace;
}

body {
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 18%, rgba(94, 195, 255, 0.18), transparent 36%),
    radial-gradient(circle at 78% 26%, rgba(67, 132, 255, 0.16), transparent 40%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.26));
  pointer-events: none;
  z-index: 0;
}

#surface-root {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
}

#gl-surface {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  background:
    radial-gradient(circle at center, rgba(12, 34, 66, 0.82), rgba(1, 4, 11, 1) 70%);
}

#surface-video,
#surface-image {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.surface-ui {
  position: relative;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.launch-frame {
  width: min(100%, 1180px);
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 420px);
  gap: 32px;
  align-items: center;
}

.launch-copy {
  align-self: end;
  max-width: 620px;
  padding: 28px 0 20vh;
  transition: opacity 420ms ease, transform 420ms ease;
  animation: launch-copy-exit 420ms ease 7.6s forwards;
}

body.intro-complete .launch-copy {
  opacity: 0;
  transform: translateX(-28px);
  pointer-events: none;
}

@keyframes launch-copy-exit {
  to {
    opacity: 0;
    transform: translateX(-28px);
    pointer-events: none;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--cyan);
}

.eyebrow::before {
  content: "";
  width: 72px;
  height: 1px;
  background: linear-gradient(90deg, rgba(106, 247, 255, 0.14), rgba(106, 247, 255, 0.86));
}

.launch-title {
  margin: 20px 0 12px;
  font-size: clamp(44px, 10vw, 104px);
  line-height: 0.94;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f3f8ff;
  text-shadow:
    0 0 14px rgba(101, 165, 255, 0.22),
    0 0 56px rgba(70, 132, 255, 0.16);
}

.launch-subtitle {
  margin: 0;
  max-width: 28ch;
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.launch-status {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.status-pill {
  padding: 8px 12px;
  border: 1px solid rgba(102, 154, 255, 0.22);
  background: rgba(4, 9, 19, 0.44);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.status-pill strong {
  color: var(--text-main);
}

.keypad-shell {
  position: relative;
  margin-left: auto;
  width: min(100%, 328px);
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(70, 107, 160, 0.44);
  background:
    linear-gradient(180deg, rgba(14, 20, 32, 0.98), rgba(9, 14, 24, 0.98));
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(33, 56, 94, 0.3);
  backdrop-filter: blur(12px);
  transform: translateY(28px) scale(0.965);
  opacity: 0.32;
  transition: opacity 440ms ease, transform 440ms ease, border-color 440ms ease;
  animation: keypad-float 7s ease-in-out infinite;
}

body.intro-complete .keypad-shell {
  opacity: 1;
  transform: translateY(0) scale(1);
  border-color: var(--panel-border-strong);
}

@keyframes keypad-float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -10px;
  }
}

.keypad-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.keypad-brand {
  font-size: 8px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.keypad-brand strong {
  color: var(--blue);
}

.mode-chip {
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(109, 162, 255, 0.22);
  background: rgba(255, 255, 255, 0.03);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.mode-chip[data-mode="user"] {
  color: #9fe4ff;
}

.mode-chip[data-mode="founder"] {
  color: var(--amber);
}

.nav-row {
  display: grid;
  grid-template-columns: 50px 1fr 50px;
  gap: 6px;
  margin-bottom: 10px;
}

.nav-btn,
.key-btn {
  appearance: none;
  border: 1px solid rgba(72, 102, 144, 0.52);
  border-radius: 7px;
  background: linear-gradient(160deg, #181e2e, #111620);
  color: var(--text-main);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.nav-btn[disabled],
.key-btn[disabled] {
  cursor: default;
  opacity: 0.42;
  box-shadow: none;
}

.nav-btn {
  min-height: 42px;
  font-size: 16px;
  line-height: 1;
}

.nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid rgba(59, 87, 124, 0.58);
  background: rgba(7, 12, 20, 0.84);
  font-size: 8px;
  line-height: 1.4;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  padding: 0 8px;
}

.display-shell {
  margin-bottom: 10px;
  border-radius: 5px;
  border: 1px solid #003820;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(0, 18, 10, 0.98), rgba(0, 11, 6, 0.98));
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.9);
}

.display-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.display-label {
  font-size: 8px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.display-role {
  font-size: 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8fd5ff;
}

.display-line {
  min-height: 1.3em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Courier New", Courier, monospace;
}

.display-line-primary {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--lcd-text);
  text-shadow: 0 0 8px rgba(0, 224, 90, 0.16);
}

.display-line-secondary {
  margin-top: 4px;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--lcd-text);
  text-shadow: 0 0 8px rgba(0, 224, 90, 0.16);
}

.display-line-tertiary {
  margin-top: 6px;
  font-size: 9px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  white-space: normal;
}

.display-line-tertiary.alert {
  color: var(--amber);
}

.display-line-secondary.error,
.display-line-tertiary.error {
  color: var(--red);
}

.page-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 5px 6px;
  border-radius: 3px;
  border: 1px solid rgba(42, 62, 91, 0.78);
  background: rgba(8, 12, 19, 0.82);
}

.page-meta strong {
  color: var(--text-soft);
}

.key-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.key-btn {
  min-height: 58px;
  padding: 8px 6px;
  font-size: 22px;
  line-height: 1;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.key-btn span {
  display: block;
  margin-top: 6px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.key-btn.key-star {
  color: var(--amber);
}

.key-btn.key-hash {
  color: var(--cyan);
}

.key-btn[data-special="pending"] {
  border-color: rgba(255, 179, 71, 0.56);
  box-shadow: 0 0 0 1px rgba(255, 179, 71, 0.24);
}

.key-btn:active,
.nav-btn:active {
  transform: translateY(1px) scale(0.985);
  background: rgba(18, 52, 104, 0.42);
  border-color: var(--blue);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.5);
}

.keypad-footer {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.keypad-footer strong {
  color: var(--text-soft);
}

.keypad-footer .accent {
  color: var(--amber);
}

.intro-banner {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 2;
  padding: 20px 24px;
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(205, 233, 255, 0.78);
  pointer-events: none;
  transition: opacity 360ms ease;
}

body.intro-complete .intro-banner {
  opacity: 0.2;
}

.fallback-note {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(109, 162, 255, 0.18);
  background: rgba(5, 11, 22, 0.66);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .nav-btn:hover,
  .key-btn:hover {
    border-color: rgba(125, 174, 255, 0.68);
    box-shadow:
      0 0 0 1px rgba(78, 129, 210, 0.18),
      0 10px 18px rgba(0, 8, 25, 0.28);
    background: linear-gradient(160deg, #1d2539, #14192a);
    color: #f3fbff;
  }
}

@media (max-width: 980px) {
  .launch-frame {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .launch-copy {
    max-width: none;
    padding: 0;
  }

  .keypad-shell {
    margin: 0 auto;
  }
}

@media (max-width: 820px), (max-height: 860px) {
  .launch-copy {
    display: none;
  }

  .surface-ui {
    align-items: center;
    justify-content: center;
    padding: 12px;
  }

  .launch-frame {
    width: min(100%, 328px);
    grid-template-columns: 1fr;
    gap: 0;
  }

  .keypad-shell {
    width: min(100%, 320px);
    margin: 0 auto;
    padding: 12px;
    transform: none;
    animation: none;
  }

  .page-display,
  .page-meta,
  .keypad-footer,
  .intro-banner {
    display: none;
  }

  .display-line-primary {
    font-size: 10px;
  }

  .display-line-secondary {
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  .display-line-tertiary {
    font-size: 8px;
    line-height: 1.35;
    letter-spacing: 0.06em;
  }

  .key-btn {
    min-height: 52px;
    font-size: 20px;
  }
}

@media (max-width: 520px) {
  .surface-ui {
    padding: 12px;
  }

  .keypad-shell {
    align-self: center;
  }

  .nav-row {
    grid-template-columns: 52px 1fr 52px;
    gap: 6px;
  }

  .key-grid {
    gap: 8px;
  }

  .key-btn {
    min-height: 50px;
  }

  .key-btn span {
    font-size: 8px;
    letter-spacing: 0.12em;
  }
}
