:root {
  color-scheme: dark;
  --ink: #f7f4ec;
  --muted: rgba(247, 244, 236, 0.64);
  --line: rgba(247, 244, 236, 0.14);
  --panel: rgba(5, 7, 13, 0.52);
  --accent: #77ffe0;
  --terminal-rgb: 255, 43, 43;
  --terminal-color: rgb(var(--terminal-rgb));
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  overflow: hidden;
  background: #000104;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100%;
  min-height: 100dvh;
  position: relative;
  isolation: isolate;
}

#space {
  display: block;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  cursor: grab;
  touch-action: none;
}

#space:active {
  cursor: grabbing;
}

.hud {
  display: none;
  gap: 8px;
  left: 16px;
  max-width: min(220px, calc(100vw - 32px));
  position: fixed;
  top: 16px;
  z-index: 3;
}

.brand-block,
.selected-panel,
.quick-links,
.link-toggle,
.fallback {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.brand-block,
.selected-panel,
.fallback {
  border-radius: 8px;
  padding: 10px;
}

.brand-block {
  width: fit-content;
}

.eyebrow,
.panel-kicker {
  color: var(--accent);
  display: block;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1rem;
  letter-spacing: 0;
  line-height: 1;
}

.intro,
.selected-panel p {
  display: none;
}

.selected-panel {
  align-items: center;
  display: grid;
  gap: 5px;
  grid-template-columns: 1fr auto;
  min-width: 190px;
}

.selected-panel .panel-kicker {
  grid-column: 1 / -1;
}

.selected-panel h2 {
  font-size: 0.84rem;
  letter-spacing: 0;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-panel a,
.link-toggle {
  align-items: center;
  background: var(--ink);
  border-radius: 999px;
  color: #05070d;
  display: inline-flex;
  font-size: 0.58rem;
  font-weight: 800;
  min-height: 27px;
  padding: 0 10px;
  text-decoration: none;
  white-space: nowrap;
}

.link-toggle {
  appearance: none;
  background: var(--ink);
  border-color: transparent;
  cursor: pointer;
  justify-content: center;
  width: fit-content;
}

.quick-links {
  border-radius: 8px;
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: min(58vh, 430px);
  overflow: auto;
  padding: 3px;
  scrollbar-width: thin;
}

.quick-links button {
  appearance: none;
  background: rgba(247, 244, 236, 0.04);
  border: 0;
  border-radius: 5px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 800;
  min-height: 25px;
  overflow: hidden;
  padding: 5px 6px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-links button:hover,
.quick-links button:focus-visible {
  background: rgba(247, 244, 236, 0.13);
  outline: none;
}

.quick-links button.is-active {
  background: var(--ink);
  color: #05070d;
}

.presence-status {
  background: rgba(1, 5, 12, 0.58);
  border: 1px solid rgba(140, 231, 255, 0.18);
  border-radius: 999px;
  bottom: 16px;
  box-shadow:
    0 0 18px rgba(74, 202, 255, 0.08),
    inset 0 0 18px rgba(74, 202, 255, 0.05);
  color: rgba(200, 247, 255, 0.66);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 7px 10px;
  pointer-events: none;
  position: fixed;
  right: 16px;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(74, 202, 255, 0.26);
  z-index: 3;
}

.presence-status.is-live {
  border-color: rgba(140, 231, 255, 0.54);
  color: rgba(220, 250, 255, 0.92);
  box-shadow:
    0 0 22px rgba(74, 202, 255, 0.22),
    inset 0 0 24px rgba(74, 202, 255, 0.08);
}

.space-chat {
  background:
    linear-gradient(rgba(140, 231, 255, 0.05) 50%, transparent 50%) 0 0 / 100% 4px,
    rgba(1, 5, 12, 0.62);
  border: 0;
  border-radius: 8px;
  bottom: 52px;
  box-shadow:
    0 0 26px rgba(74, 202, 255, 0.14),
    inset 0 0 28px rgba(74, 202, 255, 0.06),
    0 20px 58px rgba(0, 0, 0, 0.34);
  color: rgba(220, 250, 255, 0.92);
  display: grid;
  gap: 8px;
  left: 16px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 10px;
  position: fixed;
  text-shadow: 0 0 9px rgba(74, 202, 255, 0.28);
  width: 320px;
  z-index: 4;
}

.chat-drawer-handle {
  display: none;
}

.space-chat-topline {
  align-items: center;
  color: rgba(200, 247, 255, 0.66);
  display: flex;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.56rem;
  font-weight: 800;
  justify-content: space-between;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.space-chat-topline .is-live {
  color: #8ce7ff;
  text-shadow: 0 0 12px rgba(74, 202, 255, 0.72);
}

.chat-access {
  display: flex;
  gap: 5px;
}

.chat-access button {
  background: rgba(74, 202, 255, 0.08);
  border: 1px solid rgba(140, 231, 255, 0.24);
  color: rgba(194, 244, 255, 0.84);
  cursor: pointer;
  font: 800 0.48rem/1.2 "SFMono-Regular", Consolas, monospace;
  min-height: 22px;
  padding: 3px 7px;
  text-transform: uppercase;
}

.chat-access button[aria-pressed="false"] {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(194, 244, 255, 0.35);
  text-shadow: none;
}

.space-chat.is-public-disabled .chat-log,
.space-chat.is-public-disabled .chat-form {
  display: none;
}

.space-chat.is-public-disabled #chat-room-label {
  color: rgba(194, 244, 255, 0.38);
}

.space-chat.is-private {
  background:
    linear-gradient(rgba(255, 128, 180, 0.07) 50%, transparent 50%) 0 0 / 100% 4px,
    rgba(9, 1, 10, 0.7);
  box-shadow:
    0 0 30px rgba(255, 74, 142, 0.2),
    inset 0 0 32px rgba(255, 74, 142, 0.08),
    0 20px 58px rgba(0, 0, 0, 0.38);
  text-shadow: 0 0 9px rgba(255, 74, 142, 0.28);
}

.space-chat.is-private .space-chat-topline {
  color: rgba(255, 198, 224, 0.78);
}

.space-chat.is-private .chat-log,
.space-chat.is-private .chat-form {
  display: none;
}

.chat-private-clear {
  background: transparent;
  border: 0;
  color: rgba(255, 198, 224, 0.82);
  cursor: pointer;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.54rem;
  font-weight: 800;
  justify-self: start;
  letter-spacing: 0.12em;
  padding: 0;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 74, 142, 0.5);
}

.private-chat-panel {
  animation: private-chat-enter 420ms cubic-bezier(0.16, 0.88, 0.22, 1);
  background:
    repeating-linear-gradient(0deg, rgba(255, 128, 180, 0.04) 0 1px, transparent 1px 4px),
    rgba(6, 1, 9, 0.86);
  border-left: 2px solid rgba(255, 151, 204, 0.9);
  box-shadow: 0 0 28px rgba(255, 74, 142, 0.2), inset 0 0 24px rgba(255, 74, 142, 0.08);
  color: rgba(255, 224, 240, 0.94);
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  position: fixed;
  width: min(320px, calc(100vw - 32px));
  z-index: 8;
}

.private-chat-panel[hidden] {
  display: none;
}

.private-chat-topline {
  align-items: center;
  color: rgba(255, 174, 214, 0.72);
  display: flex;
  font: 800 0.52rem/1.2 "SFMono-Regular", Consolas, monospace;
  justify-content: space-between;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.private-chat-topline button {
  background: transparent;
  border: 0;
  color: #ff91c6;
  cursor: pointer;
  font: 800 1rem/1 monospace;
  padding: 2px 4px;
  text-shadow: 0 0 10px rgba(255, 74, 142, 0.8);
}

.private-chat-recipient {
  color: #ffd4e8;
  font: 800 0.72rem/1.2 "SFMono-Regular", Consolas, monospace;
  margin: 0;
  text-shadow: 0 0 12px rgba(255, 74, 142, 0.68);
}

.private-chat-threads {
  display: flex;
  gap: 5px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.private-chat-thread {
  background: rgba(255, 74, 142, 0.05);
  border: 1px solid rgba(255, 151, 204, 0.22);
  color: rgba(255, 204, 229, 0.64);
  cursor: pointer;
  flex: 0 0 auto;
  font: 800 0.48rem/1.2 "SFMono-Regular", Consolas, monospace;
  min-height: 23px;
  padding: 4px 7px;
  text-transform: uppercase;
}

.private-chat-thread.is-active {
  background: rgba(255, 74, 142, 0.15);
  border-color: rgba(255, 151, 204, 0.78);
  color: #ffd4e8;
  box-shadow: 0 0 12px rgba(255, 74, 142, 0.24);
}

.private-chat-empty {
  color: rgba(255, 204, 229, 0.46);
  font: 700 0.54rem/1.45 "SFMono-Regular", Consolas, monospace;
  margin: 4px 0;
}

.private-chat-log {
  display: grid;
  gap: 5px;
  mask-image: linear-gradient(to bottom, transparent, #000 22px);
  max-height: 116px;
  min-height: 34px;
  overflow-y: auto;
  padding-top: 8px;
  scrollbar-width: thin;
}

.private-chat-form {
  display: grid;
  gap: 5px;
  grid-template-columns: 1fr auto;
}

.private-chat-form[hidden] {
  display: none;
}

.private-chat-form input,
.private-chat-form button {
  background: rgba(255, 74, 142, 0.06);
  border: 1px solid rgba(255, 151, 204, 0.3);
  color: #ffd4e8;
  font: 700 0.56rem/1.2 "SFMono-Regular", Consolas, monospace;
  min-height: 28px;
}

.private-chat-form input {
  min-width: 0;
  padding: 5px 7px;
}

.private-chat-form button {
  cursor: pointer;
  padding: 5px 9px;
  text-transform: uppercase;
}

.private-chat-tether {
  border-top: 2px dotted rgba(255, 151, 204, 0.72);
  filter: drop-shadow(0 0 5px rgba(255, 74, 142, 0.7));
  height: 0;
  pointer-events: none;
  position: fixed;
  transform-origin: 0 50%;
  z-index: 7;
}

@keyframes private-chat-enter {
  0% { filter: blur(8px); opacity: 0; transform: translateY(8px) scale(0.92); }
  55% { opacity: 1; }
  100% { filter: blur(0); opacity: 1; transform: translateY(0) scale(1); }
}

.chat-log {
  display: grid;
  gap: 5px;
  mask-image: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.24) 12px, #000 34px, #000 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgba(0, 0, 0, 0.24) 12px, #000 34px, #000 100%);
  max-height: 118px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.chat-message {
  display: grid;
  gap: 2px;
  margin: 0;
}

.chat-message[data-clickable="true"] {
  cursor: pointer;
}

.chat-name,
.chat-body {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.chat-name {
  font-size: 0.54rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-body {
  color: rgba(232, 252, 255, 0.86);
  font-size: 0.66rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chat-message.is-local .chat-body {
  color: rgba(140, 231, 255, 0.95);
}

.chat-form {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr auto;
}

.chat-form input,
.chat-form button {
  border: 0;
  border-radius: 999px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.62rem;
  min-height: 28px;
}

.chat-form input {
  background: rgba(255, 255, 255, 0.08);
  color: #e8fcff;
  outline: none;
  padding: 0 10px;
}

.chat-form input:disabled {
  opacity: 0.42;
}

.chat-form button {
  background: rgba(140, 231, 255, 0.86);
  color: #01050c;
  cursor: pointer;
  font-weight: 900;
  padding: 0 10px;
  text-transform: uppercase;
}

.bio-panel {
  animation: bio-terminal-enter 360ms ease-out;
  background:
    linear-gradient(rgba(74, 202, 255, 0.085) 50%, transparent 50%) 0 0 / 100% 3px,
    linear-gradient(135deg, rgba(74, 202, 255, 0.16), transparent 34%),
    rgba(0, 5, 12, 0.78);
  border: 0;
  border-radius: 8px;
  box-shadow:
    0 0 24px rgba(74, 202, 255, 0.38),
    0 0 70px rgba(74, 202, 255, 0.14),
    inset 0 0 38px rgba(74, 202, 255, 0.12),
    0 28px 80px rgba(0, 0, 0, 0.45);
  color: #8ce7ff;
  left: 16px;
  max-height: min(58vh, 460px);
  max-width: min(430px, calc(100vw - 32px));
  overflow: hidden;
  padding: 12px;
  position: fixed;
  text-shadow:
    0 0 8px rgba(74, 202, 255, 0.76),
    0 0 18px rgba(74, 202, 255, 0.34);
  top: 16px;
  width: 430px;
  z-index: 6;
}

.bio-panel.is-closing {
  filter: blur(6px);
  opacity: 0;
  transform: translateY(-8px) scale(0.985);
  transition:
    filter 220ms ease,
    opacity 220ms ease,
    transform 220ms ease;
}

.bio-panel::before {
  border: 0;
  border-radius: 6px;
  content: "";
  inset: 7px;
  pointer-events: none;
  position: absolute;
}

.bio-panel::after {
  animation: bio-terminal-glitch 2.8s steps(2, end) infinite;
  box-shadow:
    2px 0 0 rgba(142, 236, 255, 0.28),
    -2px 0 0 rgba(33, 105, 255, 0.22);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.bio-panel-topline {
  align-items: center;
  display: flex;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.62rem;
  font-weight: 800;
  justify-content: space-between;
  letter-spacing: 0.16em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.bio-panel-topline button {
  appearance: none;
  background: rgba(74, 202, 255, 0.12);
  border: 0;
  border-radius: 999px;
  color: #8ce7ff;
  cursor: pointer;
  font: inherit;
  height: 18px;
  line-height: 1;
  width: 18px;
}

.bio-panel-label {
  color: rgba(140, 231, 255, 0.72);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.bio-panel h2 {
  color: #d8f8ff;
  font-size: 1rem;
  line-height: 1.1;
  margin-bottom: 8px;
}

.bio-panel pre {
  color: rgba(200, 247, 255, 0.92);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.68rem;
  line-height: 1.55;
  margin: 0;
  max-height: min(40vh, 318px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 8px;
  touch-action: pan-y;
  scrollbar-width: thin;
  white-space: pre-wrap;
}

.bio-song {
  font-weight: 800;
  text-shadow: 0 0 9px currentColor, 0 0 18px currentColor;
}

.bio-red { color: #ff3131; }
.bio-dark-red { color: #8f1018; }
.bio-light-blue { color: #8bdfff; }
.bio-pink { color: #ff7ac8; }
.bio-light-pink { color: #ffb6dc; }
.bio-dark-blue { color: #244dff; }
.bio-purple { color: #a855ff; }
.bio-green { color: #61ff7b; }
.bio-blue { color: #4ea3ff; }
.bio-white { color: #ffffff; }

.bio-panel pre::after {
  animation: cursor-blink 0.8s steps(2, start) infinite;
  color: #8ce7ff;
  content: "█";
}

@keyframes bio-terminal-enter {
  from {
    opacity: 0;
    transform: translate(-10px, -8px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

@keyframes bio-terminal-glitch {
  0%,
  88%,
  100% {
    opacity: 0;
    transform: translate(0, 0);
  }

  90% {
    opacity: 0.72;
    transform: translate(2px, 0);
  }

  92% {
    opacity: 0.45;
    transform: translate(-2px, 1px);
  }

  94% {
    opacity: 0.64;
    transform: translate(1px, -1px);
  }
}

.terminal-panel {
  animation: terminal-enter 320ms ease-out;
  background:
    linear-gradient(rgba(var(--terminal-rgb), 0.04) 50%, transparent 50%) 0 0 / 100% 4px,
    rgba(5, 7, 13, 0.18);
  border: 0;
  border-radius: 4px;
  box-shadow:
    0 0 18px rgba(var(--terminal-rgb), 0.16),
    inset 0 0 18px rgba(var(--terminal-rgb), 0.05);
  color: var(--terminal-color);
  display: grid;
  gap: 5px;
  left: 50%;
  max-width: min(180px, calc(100vw - 24px));
  min-height: 0;
  padding: 5px 6px;
  position: fixed;
  text-shadow: 0 0 8px rgba(var(--terminal-rgb), 0.54);
  top: 50%;
  transform: translate(-100%, -100%);
  transition:
    border-color 140ms linear,
    box-shadow 140ms linear,
    color 140ms linear,
    opacity 220ms ease,
    transform 220ms ease,
    filter 220ms ease;
  width: max-content;
  z-index: 5;
}

.terminal-panel.is-closing {
  filter: blur(5px);
  opacity: 0;
  transform: translate(-100%, -100%) scale(0.9);
}

.terminal-panel::before {
  border: 0;
  border-radius: 4px;
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.terminal-panel::after {
  animation: terminal-glitch 2.4s steps(2, end) infinite;
  border-radius: 4px;
  box-shadow:
    1px 0 0 rgba(58, 177, 255, 0.2),
    -1px 0 0 rgba(255, 43, 43, 0.16);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.terminal-topline {
  display: block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  position: absolute;
  right: -8px;
  text-transform: uppercase;
  top: -8px;
}

.terminal-topline button {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--terminal-color);
  cursor: pointer;
  font: inherit;
  height: 18px;
  line-height: 1;
  width: 18px;
}

.terminal-label {
  color: rgba(var(--terminal-rgb), 0.72);
  display: block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  margin: 0;
}

.terminal-panel h2 {
  color: var(--terminal-color);
  font-size: 0.68rem;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 0;
}

.terminal-panel pre {
  color: rgba(var(--terminal-rgb), 0.9);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.54rem;
  line-height: 1.32;
  margin: 0;
  max-height: 48px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  white-space: pre-wrap;
}

.terminal-panel pre::after {
  animation: cursor-blink 0.8s steps(2, start) infinite;
  content: "█";
}

.terminal-panel.is-memory-clue {
  width: 240px;
  max-width: calc(100vw - 32px);
}

.terminal-panel.is-memory-clue pre {
  font-size: 0.75rem;
  line-height: 1.5;
  max-height: min(180px, 30vh);
}

.terminal-panel a {
  align-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--terminal-color);
  display: inline-flex;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.5rem;
  font-weight: 800;
  justify-self: start;
  min-height: 18px;
  padding: 0;
  text-decoration: none;
  text-transform: uppercase;
}

.terminal-tether {
  background-image: repeating-linear-gradient(
    90deg,
    rgba(var(--terminal-rgb), 0.95) 0 2px,
    transparent 2px 8px
  );
  filter: drop-shadow(0 0 8px rgba(var(--terminal-rgb), 0.72));
  height: 2px;
  left: 0;
  opacity: 0.82;
  pointer-events: none;
  position: fixed;
  top: 0;
  transform-origin: 0 50%;
  transition: opacity 220ms ease, filter 220ms ease;
  z-index: 4;
}

.terminal-tether.is-closing,
.terminal-anchor.is-closing {
  filter: blur(4px);
  opacity: 0;
}

.terminal-anchor {
  background: rgba(var(--terminal-rgb), 0.92);
  border: 1px solid rgba(247, 244, 236, 0.68);
  border-radius: 999px;
  box-shadow:
    0 0 0 7px rgba(var(--terminal-rgb), 0.1),
    0 0 18px rgba(var(--terminal-rgb), 0.75);
  height: 8px;
  left: 0;
  pointer-events: none;
  position: fixed;
  top: 0;
  transform: translate(-50%, -50%);
  width: 8px;
  z-index: 4;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

@keyframes terminal-glitch {
  0%,
  88%,
  100% {
    opacity: 0;
    transform: translate(0, 0);
  }

  90% {
    opacity: 1;
    transform: translate(2px, -1px);
  }

  92% {
    opacity: 0.55;
    transform: translate(-3px, 1px);
  }

  94% {
    opacity: 0.85;
    transform: translate(1px, 2px);
  }
}

@keyframes terminal-enter {
  from {
    opacity: 0;
    transform: translate(-100%, -100%) scale(0.92);
  }

  to {
    opacity: 1;
    transform: translate(-100%, -100%) scale(1);
  }
}

.fallback {
  bottom: 18px;
  display: grid;
  gap: 10px;
  max-width: 360px;
  position: fixed;
  right: 18px;
  z-index: 4;
}

.fallback h2 {
  font-size: 1rem;
}

.fallback p,
.fallback a {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

#fallback-links {
  display: grid;
  gap: 7px;
  max-height: 45vh;
  overflow: auto;
}

.crt-overlay {
  animation: crt-frame-warp 5.8s steps(2, end) infinite;
  backdrop-filter: blur(2.45px) contrast(1.26) brightness(1.08);
  background:
    linear-gradient(rgba(255, 255, 255, 0.07) 50%, rgba(0, 0, 0, 0.34) 50%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
  background-size: 100% 3px, 4px 100%;
  filter: blur(0.8px) brightness(1.14) contrast(1.2);
  inset: -3px;
  mix-blend-mode: screen;
  opacity: 0.9;
  pointer-events: none;
  position: fixed;
  z-index: 20;
}

.crt-overlay::before,
.crt-overlay::after {
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.crt-overlay::before {
  animation: crt-flicker 0.18s steps(2, end) infinite;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(180deg, transparent 0 7px, rgba(255, 255, 255, 0.045) 7px 8px, transparent 8px 12px);
  filter: blur(0.25px) drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
  opacity: 0.58;
}

.crt-overlay::after {
  animation: crt-glass-pulse 4.2s ease-in-out infinite alternate;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.04)),
    radial-gradient(ellipse at center, transparent 0 45%, rgba(0, 0, 0, 0.2) 72%, rgba(0, 0, 0, 0.58) 100%);
  box-shadow:
    inset 0 0 110px rgba(255, 255, 255, 0.09),
    inset 0 0 190px rgba(255, 255, 255, 0.055),
    inset 0 0 240px rgba(0, 0, 0, 0.46);
  opacity: 0.88;
}

@keyframes crt-flicker {
  0% {
    opacity: 0.46;
  }

  25% {
    opacity: 0.64;
  }

  50% {
    opacity: 0.52;
  }

  75% {
    opacity: 0.68;
  }

  100% {
    opacity: 0.56;
  }
}

@keyframes crt-glass-pulse {
  from {
    filter: blur(1px) brightness(1.04);
  }

  to {
    filter: blur(1.9px) brightness(1.22);
  }
}

@keyframes crt-frame-warp {
  0%,
  91%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  92% {
    transform: translate(0.5px, 0) scale(1.0008);
  }

  93% {
    transform: translate(-0.5px, 0.4px) scale(1);
  }

  94% {
    transform: translate(0, 0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .crt-overlay,
  .crt-overlay::before,
  .crt-overlay::after {
    animation: none;
  }
}

@media (max-width: 720px) {
  :root {
    --mobile-edge: max(12px, env(safe-area-inset-left));
    --mobile-edge-right: max(12px, env(safe-area-inset-right));
    --mobile-top: max(12px, env(safe-area-inset-top));
    --mobile-bottom: max(14px, env(safe-area-inset-bottom));
  }

  input,
  textarea,
  select {
    font-size: 16px !important;
  }

  .crt-overlay::before,
  .crt-overlay::after {
    animation-duration: 14s;
  }

  .hud {
    left: var(--mobile-edge);
    max-width: calc(100vw - var(--mobile-edge) - var(--mobile-edge-right));
    top: var(--mobile-top);
  }

  .brand-block {
    padding: 7px 8px;
  }

  .selected-panel {
    min-width: 154px;
    padding: 7px 8px;
  }

  .quick-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(34dvh, 250px);
  }

  .quick-links button {
    font-size: 0.56rem;
    min-height: 24px;
  }

  .presence-status {
    bottom: var(--mobile-bottom);
    font-size: 0.52rem;
    max-width: min(44vw, 170px);
    overflow: hidden;
    padding: 6px 8px;
    right: var(--mobile-edge-right);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .space-chat {
    bottom: auto;
    gap: 6px;
    left: 50%;
    max-height: min(42dvh, 320px);
    max-width: calc(100vw - var(--mobile-edge) - var(--mobile-edge-right));
    padding: 10px 10px 9px;
    top: var(--mobile-top);
    transform: translate(-50%, calc(-100% - 1px));
    transition: transform 420ms cubic-bezier(0.16, 0.84, 0.24, 1);
    width: min(340px, calc(100vw - var(--mobile-edge) - var(--mobile-edge-right)));
    z-index: 12;
  }

  .space-chat.is-chat-drawer-open {
    transform: translate(-50%, 0);
  }

  .space-chat.is-chat-drawer-dragging {
    transition: none;
  }

  .chat-drawer-handle {
    align-items: center;
    background: rgba(2, 10, 18, 0.9);
    border: 1px solid rgba(140, 231, 255, 0.36);
    border-top: 0;
    border-radius: 0 0 7px 7px;
    bottom: -31px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42), 0 0 18px rgba(74, 202, 255, 0.16);
    color: rgba(194, 244, 255, 0.86);
    cursor: ns-resize;
    display: flex;
    flex-direction: column;
    font: 800 0.46rem/1 "SFMono-Regular", Consolas, monospace;
    gap: 4px;
    height: 31px;
    justify-content: center;
    left: 50%;
    letter-spacing: 0.12em;
    padding: 4px 18px 5px;
    position: absolute;
    text-transform: uppercase;
    touch-action: none;
    transform: translateX(-50%);
    width: 82px;
  }

  .chat-drawer-grip {
    border-top: 2px solid rgba(140, 231, 255, 0.78);
    box-shadow: 0 0 6px rgba(74, 202, 255, 0.64);
    display: block;
    position: relative;
    width: 28px;
  }

  .chat-drawer-grip::after {
    border-top: 1px solid rgba(140, 231, 255, 0.42);
    content: "";
    left: 5px;
    position: absolute;
    top: 3px;
    width: 18px;
  }

  .private-chat-panel.is-mobile-drawer-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    visibility: hidden;
  }

  .space-chat-topline {
    font-size: 0.52rem;
  }

  .chat-log {
    max-height: min(22dvh, 88px);
  }

  .chat-form {
    gap: 5px;
  }

  .chat-form input,
  .chat-form button {
    min-height: 34px;
  }

  .chat-form button {
    font-size: 0.56rem;
  }

  .terminal-panel {
    max-width: calc(100vw - 28px - env(safe-area-inset-left) - env(safe-area-inset-right));
    padding: 5px 6px;
    width: max-content;
  }

  .terminal-panel pre {
    max-height: min(15dvh, 52px);
  }

  .bio-panel {
    left: var(--mobile-edge);
    max-height: min(58dvh, 430px);
    max-width: calc(100vw - var(--mobile-edge) - var(--mobile-edge-right));
    padding: 10px;
    top: var(--mobile-top);
    width: calc(100vw - var(--mobile-edge) - var(--mobile-edge-right));
  }

  .bio-panel pre {
    font-size: 0.62rem;
    max-height: min(39dvh, 300px);
  }
}

@media (max-width: 430px) {
  .space-chat {
    max-width: calc(100vw - var(--mobile-edge) - var(--mobile-edge-right));
    width: calc(100vw - var(--mobile-edge) - var(--mobile-edge-right));
  }

  .chat-body {
    font-size: 0.61rem;
  }

  .presence-status {
    max-width: 145px;
  }

  .private-chat-panel {
    width: min(244px, calc(100vw - 24px));
  }

  .private-chat-log {
    max-height: min(18dvh, 84px);
  }
}


.coordinate-panel {
  animation: coordinate-enter 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #c2f4ff;
  display: grid;
  gap: 8px;
  left: 50%;
  max-width: calc(100vw - 28px);
  padding: 20px 30px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
  width: min(540px, calc(100vw - 28px));
  z-index: 8;
}

.coordinate-panel[hidden] {
  display: none;
}

.coordinate-panel.is-closing {
  filter: blur(7px);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
}

.coordinate-panel.is-denied {
  animation: coordinate-denied 240ms steps(3, end);
  color: #ff6a6a;
}

.coordinate-panel.is-unlocked {
  filter: drop-shadow(0 0 18px rgba(58, 177, 255, 0.72));
}

.coordinate-kicker,
.coordinate-status {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.coordinate-status:empty {
  display: none;
}

.coordinate-beam-link {
  align-items: center;
  background: rgba(58, 177, 255, 0.1);
  border: 1px solid rgba(139, 223, 255, 0.62);
  color: #c2f4ff;
  display: flex;
  font: 800 0.62rem/1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  justify-content: center;
  min-height: 36px;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(139, 223, 255, 0.8);
}

.coordinate-beam-link[hidden] {
  display: none;
}

.coordinate-beam-link:hover,
.coordinate-beam-link:focus-visible {
  background: rgba(58, 177, 255, 0.2);
  box-shadow: 0 0 18px rgba(58, 177, 255, 0.28);
  outline: none;
}

.coordinate-panel h2 {
  font-size: 1rem;
  letter-spacing: 0;
  margin: 0;
  text-shadow: 0 0 12px rgba(139, 223, 255, 0.78);
}

.coordinate-panel form {
  display: grid;
  gap: 7px;
  grid-template-columns: minmax(0, 1fr);
}

.coordinate-digit,
.coordinate-direction-input,
.coordinate-panel form button {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(139, 223, 255, 0.58);
  border-radius: 0;
  color: #c2f4ff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.72rem;
  min-height: 38px;
}

.coordinate-digits {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.coordinate-segment {
  align-items: center;
  display: flex;
  gap: 4px;
  justify-content: center;
  min-width: 0;
}

.coordinate-digit {
  animation: coordinate-digit-arrive 460ms both cubic-bezier(0.18, 0.8, 0.2, 1);
  flex: 0 0 25px;
  min-width: 0;
  padding: 0;
  text-align: center;
  width: 25px;
}

.coordinate-direction-input {
  animation: coordinate-digit-arrive 460ms 150ms both cubic-bezier(0.18, 0.8, 0.2, 1);
  flex: 0 0 28px;
  margin-left: 4px;
  min-width: 0;
  padding: 0;
  text-align: center;
  text-transform: uppercase;
  width: 28px;
}

.coordinate-digit:nth-of-type(2n) { animation-delay: 45ms; }
.coordinate-digit:nth-of-type(3n) { animation-delay: 90ms; }
.coordinate-digit:nth-of-type(4n) { animation-delay: 135ms; }

.coordinate-digit:focus,
.coordinate-direction-input:focus {
  border-color: #c2f4ff;
  box-shadow: 0 0 14px rgba(58, 177, 255, 0.32);
  outline: none;
}

.coordinate-mark {
  color: rgba(194, 244, 255, 0.76);
  flex: 0 0 auto;
  font: 800 0.78rem/1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  text-shadow: 0 0 8px rgba(58, 177, 255, 0.5);
}

.coordinate-direction {
  margin-left: 2px;
}

.coordinate-panel form button {
  cursor: pointer;
  font-weight: 800;
  justify-self: center;
  min-width: 112px;
  padding: 0 12px;
  text-transform: uppercase;
}

.coordinate-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: currentColor;
  cursor: pointer;
  font: 800 1rem/1 monospace;
  height: 28px;
  position: absolute;
  right: 5px;
  top: 5px;
  width: 28px;
}

@keyframes coordinate-enter {
  from {
    filter: blur(9px);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.86);
  }
}

@keyframes coordinate-digit-arrive {
  from {
    filter: blur(12px);
    opacity: 0;
    text-shadow: 0 0 30px #8bdfff;
    transform: translateY(12px) scale(1.28);
  }
  to {
    filter: blur(0);
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes coordinate-denied {
  33% { transform: translate(calc(-50% - 5px), -50%); }
  66% { transform: translate(calc(-50% + 5px), -50%); }
}

@media (max-width: 720px) {
  .coordinate-panel {
    left: calc(50% + (env(safe-area-inset-left) - env(safe-area-inset-right)) / 2);
    padding: 12px;
    top: 46%;
    width: min(340px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }

  .coordinate-digit,
  .coordinate-direction-input,
  .coordinate-panel form button {
    font-size: 16px;
    min-height: 44px;
  }

  .coordinate-digit {
    flex-basis: 28px;
    width: 28px;
  }
}


.story-choice,
.archive-panel {
  animation: archive-window-enter 320ms ease-out;
  background:
    repeating-linear-gradient(0deg, rgba(154, 168, 255, 0.035) 0 1px, transparent 1px 4px),
    rgba(1, 3, 9, 0.88);
  border: 1px solid rgba(154, 168, 255, 0.52);
  box-shadow: 0 0 28px rgba(82, 107, 255, 0.2), inset 0 0 18px rgba(154, 168, 255, 0.06);
  color: #dce1ff;
  display: grid;
  gap: 9px;
  left: 50%;
  max-width: calc(100vw - 28px);
  padding: 14px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
  width: min(300px, calc(100vw - 28px));
  z-index: 8;
}

.story-choice[hidden],
.archive-panel[hidden] {
  display: none;
}

.story-choice.is-closing,
.archive-panel.is-closing {
  filter: blur(7px);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.92);
}

.story-choice p,
.archive-kicker,
.archive-file-meta {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

.story-choice h2,
.archive-panel h2 {
  font-size: 0.9rem;
  letter-spacing: 0;
  margin: 0;
  text-shadow: 0 0 12px rgba(154, 168, 255, 0.72);
}

.story-choice-actions {
  display: flex;
  gap: 8px;
}

.story-choice-actions button {
  appearance: none;
  background: rgba(6, 10, 24, 0.84);
  border: 1px solid rgba(154, 168, 255, 0.46);
  border-radius: 2px;
  color: #dce1ff;
  cursor: pointer;
  font: 800 0.62rem/1 "SFMono-Regular", Consolas, monospace;
  min-height: 34px;
  padding: 0 11px;
  text-transform: uppercase;
}

.story-choice-actions button:first-child {
  box-shadow: 0 0 14px rgba(82, 107, 255, 0.18);
}

.story-choice-close,
.archive-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: currentColor;
  cursor: pointer;
  font: 800 1rem/1 monospace;
  height: 28px;
  position: absolute;
  right: 5px;
  top: 5px;
  width: 28px;
}

.archive-player {
  display: grid;
  gap: 8px;
}

.archive-player video {
  aspect-ratio: 4 / 3;
  background: #000;
  border: 1px solid rgba(154, 168, 255, 0.28);
  box-shadow: 0 0 24px rgba(82, 107, 255, 0.14);
  display: block;
  height: auto;
  max-height: min(58vh, 480px);
  object-fit: contain;
  width: 100%;
}

.archive-file-meta {
  border-top: 1px solid rgba(154, 168, 255, 0.22);
  display: flex;
  justify-content: space-between;
  padding-top: 9px;
}

.archive-panel {
  width: min(560px, calc(100vw - 28px));
}

@keyframes archive-window-enter {
  from {
    filter: blur(8px);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

@media (max-width: 720px) {
  .story-choice,
  .archive-panel {
    left: calc(50% + (env(safe-area-inset-left) - env(safe-area-inset-right)) / 2);
    padding: 12px;
    top: 46%;
    width: min(300px, calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }

  .archive-panel {
    width: min(520px, calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }

  .story-choice-actions button {
    font-size: 0.68rem;
    min-height: 44px;
  }
}


.archive-panel {
  animation: archive-tracked-enter 300ms ease-out;
  max-height: min(68vh, 520px);
  overflow: hidden;
  transform: none;
  width: min(560px, calc(100vw - 24px));
}

.archive-panel.is-closing {
  filter: blur(7px);
  opacity: 0;
  transform: scale(0.95);
}

.archive-browser {
  display: grid;
  gap: 11px;
  grid-template-columns: 132px minmax(0, 1fr);
  min-height: 0;
}

.archive-file-list {
  align-content: start;
  border-left: 1px solid rgba(154, 168, 255, 0.46);
  display: grid;
  gap: 4px;
  max-height: min(48vh, 390px);
  overflow-y: auto;
  padding-left: 11px;
  scrollbar-color: rgba(154, 168, 255, 0.4) transparent;
}

.archive-file-list button {
  appearance: none;
  background: rgba(4, 7, 18, 0.56);
  border: 0;
  color: rgba(220, 225, 255, 0.62);
  cursor: pointer;
  display: grid;
  font: 700 0.55rem/1.2 "SFMono-Regular", Consolas, monospace;
  gap: 2px;
  min-height: 38px;
  padding: 6px 7px;
  position: relative;
  text-align: left;
}

.archive-file-list button::before {
  background: rgba(154, 168, 255, 0.48);
  content: "";
  height: 1px;
  left: -11px;
  position: absolute;
  top: 50%;
  width: 10px;
}

.archive-file-list button strong {
  color: inherit;
  font-size: 0.58rem;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.archive-file-list button.is-active {
  background: rgba(82, 107, 255, 0.18);
  box-shadow: inset 0 0 16px rgba(154, 168, 255, 0.08);
  color: #eef0ff;
  text-shadow: 0 0 9px rgba(154, 168, 255, 0.78);
}

.archive-tether {
  background-image: repeating-linear-gradient(
    90deg,
    rgba(154, 168, 255, 0.92) 0 2px,
    transparent 2px 8px
  );
  filter: drop-shadow(0 0 8px rgba(82, 107, 255, 0.68));
  height: 2px;
  left: 0;
  opacity: 0.8;
  pointer-events: none;
  position: fixed;
  top: 0;
  transform-origin: 0 50%;
  transition: opacity 220ms ease, filter 220ms ease;
  z-index: 7;
}

.archive-anchor {
  background: #9aa8ff;
  border: 1px solid rgba(247, 244, 236, 0.74);
  border-radius: 999px;
  box-shadow: 0 0 0 7px rgba(82, 107, 255, 0.12), 0 0 18px rgba(154, 168, 255, 0.82);
  height: 8px;
  left: 0;
  pointer-events: none;
  position: fixed;
  top: 0;
  transform: translate(-50%, -50%);
  transition: opacity 220ms ease, filter 220ms ease;
  width: 8px;
  z-index: 7;
}

.archive-tether.is-closing,
.archive-anchor.is-closing {
  filter: blur(4px);
  opacity: 0;
}

@keyframes archive-tracked-enter {
  from {
    filter: blur(8px);
    opacity: 0;
    transform: scale(0.92);
  }
}

@media (max-width: 720px) {
  .archive-panel {
    max-height: min(62dvh, 470px);
    padding: 10px;
    transform: none;
    width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
  }

  .archive-browser {
    gap: 7px;
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .archive-file-list {
    max-height: min(42dvh, 320px);
    padding-left: 9px;
  }

  .archive-file-list button {
    min-height: 42px;
    padding: 6px 5px;
  }

  .archive-file-list button::before {
    left: -9px;
    width: 8px;
  }
}


.archive-branch {
  animation: archive-branches-enter 320ms ease-out;
  color: #dce1ff;
  display: grid;
  gap: 7px;
  left: 0;
  max-height: min(66vh, 500px);
  padding: 8px 8px 8px 0;
  position: fixed;
  text-shadow: 0 0 9px rgba(154, 168, 255, 0.7);
  top: 0;
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
  width: 166px;
  z-index: 8;
}

.archive-branch[hidden] {
  display: none;
}

.archive-branch.is-closing {
  filter: blur(6px);
  opacity: 0;
  transform: scale(0.92);
}

.archive-branch h2 {
  font-size: 0.78rem;
  letter-spacing: 0;
  margin: 0 0 2px 13px;
}

.archive-branch .archive-kicker {
  margin-left: 13px;
}

.archive-branch-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: #dce1ff;
  cursor: pointer;
  font: 800 1rem/1 monospace;
  height: 24px;
  position: absolute;
  right: 0;
  top: 0;
  width: 24px;
}

.archive-branch .archive-file-list {
  background: transparent;
  border-left: 1px solid rgba(154, 168, 255, 0.72);
  max-height: min(54vh, 410px);
  overflow: visible;
  padding: 3px 0 3px 15px;
}

.archive-branch .archive-file-list button {
  background: rgba(2, 4, 11, 0.42);
  min-height: 34px;
}

.archive-branch .archive-file-list button:nth-child(even) {
  margin-left: 13px;
}

.archive-branch .archive-file-list button::before {
  left: -15px;
  width: 14px;
}

.archive-branch .archive-file-list button:nth-child(even)::before {
  left: -28px;
  width: 27px;
}

.archive-panel {
  width: min(390px, calc(100vw - 24px));
}

@keyframes archive-branches-enter {
  from {
    filter: blur(7px);
    opacity: 0;
    transform: scale(0.88);
  }
}

@media (max-width: 720px) {
  .archive-branch {
    max-height: min(48dvh, 390px);
    width: 132px;
  }

  .archive-branch .archive-file-list {
    max-height: min(38dvh, 310px);
    overflow-y: auto;
  }

  .archive-branch .archive-file-list button:nth-child(even) {
    margin-left: 7px;
  }

  .archive-panel {
    max-height: min(48dvh, 380px);
    width: min(350px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }
}


/* Archive branches: cyan node-and-rail language from the supplied reference. */
.archive-branch {
  color: #4cecff;
  text-shadow: 0 0 8px rgba(48, 226, 255, 0.72);
  width: 214px;
}

.archive-branch h2,
.archive-branch .archive-kicker,
.archive-branch-close {
  color: #8ff5ff;
}

.archive-branch .archive-file-list {
  border-left: 0;
  gap: 1px;
  padding: 1px 0;
}

.archive-branch .archive-file-list button,
.archive-branch .archive-file-list button:nth-child(even) {
  background: transparent;
  box-shadow: none;
  color: rgba(107, 237, 255, 0.72);
  height: 58px;
  margin-left: 0;
  min-height: 58px;
  overflow: visible;
  padding: 0;
  transform: none;
  transform-origin: 24px 39px;
  transition: color 180ms ease, filter 180ms ease, opacity 180ms ease, transform 180ms ease;
  width: 206px;
  z-index: 0;
}

.archive-branch .archive-file-list button::before,
.archive-branch .archive-file-list button:nth-child(even)::before {
  background: #30e2ff;
  box-shadow: 0 0 5px rgba(48, 226, 255, 0.8);
  content: "";
  height: 2px;
  left: 31px;
  opacity: 0.72;
  position: absolute;
  top: 39px;
  transform: rotate(-41deg);
  transform-origin: 0 50%;
  transition: opacity 160ms ease, filter 160ms ease;
  width: 53px;
}

.archive-branch .archive-file-list button::after {
  background: #30e2ff;
  box-shadow: 0 0 5px rgba(48, 226, 255, 0.8);
  content: "";
  height: 2px;
  left: 70px;
  opacity: 0.72;
  position: absolute;
  top: 4px;
  transition: opacity 160ms ease, filter 160ms ease;
  width: 124px;
}

.archive-branch .archive-file-list button strong {
  color: currentColor;
  font-size: 0.58rem;
  left: 75px;
  letter-spacing: 0;
  position: absolute;
  text-shadow: 0 0 7px rgba(48, 226, 255, 0.64);
  top: 10px;
  white-space: nowrap;
}

.archive-node {
  background: rgba(7, 29, 52, 0.88);
  border: 2px solid #30e2ff;
  box-shadow:
    0 0 7px rgba(48, 226, 255, 0.9),
    inset 0 0 6px rgba(48, 226, 255, 0.34);
  height: 20px;
  left: 10px;
  position: absolute;
  top: 31px;
  transition: filter 160ms ease, transform 160ms ease;
  width: 20px;
}

.archive-node::after {
  border: 2px solid #30e2ff;
  content: "";
  inset: 4px;
  position: absolute;
}

.archive-file-list button[data-node="1"] .archive-node,
.archive-file-list button[data-node="4"] .archive-node,
.archive-file-list button[data-node="5"] .archive-node {
  border-radius: 50%;
}

.archive-file-list button[data-node="1"] .archive-node {
  background: #30e2ff;
  box-shadow: 0 0 10px rgba(48, 226, 255, 1);
}

.archive-file-list button[data-node="1"] .archive-node::after {
  border: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(48, 226, 255, 0.24);
}

.archive-file-list button[data-node="2"] .archive-node {
  transform: rotate(45deg);
}

.archive-file-list button[data-node="2"] .archive-node::after {
  background: #30e2ff;
  border: 0;
  inset: 5px;
}

.archive-file-list button[data-node="3"] .archive-node {
  box-shadow:
    0 0 0 4px rgba(48, 226, 255, 0.38),
    0 0 9px rgba(48, 226, 255, 0.9);
}

.archive-file-list button[data-node="4"] .archive-node::after {
  background: #30e2ff;
  border: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  inset: 5px 4px 4px;
}

.archive-file-list button[data-node="5"] .archive-node::after {
  border-radius: 50%;
}

.archive-file-list button[data-node="6"] .archive-node {
  transform: rotate(45deg);
}

.archive-file-list button[data-node="6"] .archive-node::after {
  border-width: 1px;
}

.archive-branch .archive-file-list button:hover,
.archive-branch .archive-file-list button:focus-visible,
.archive-branch .archive-file-list button.is-active {
  color: #e9fdff;
  filter: drop-shadow(0 0 8px rgba(48, 226, 255, 0.46));
  outline: none;
  transform: translateX(3px) scale(1.07);
  z-index: 2;
}

@media (hover: hover) and (pointer: fine) {
  .archive-branch .archive-file-list:hover button:not(:hover):not(.is-active) {
    filter: blur(0.35px);
    opacity: 0.42;
  }
}

@media (prefers-reduced-motion: reduce) {
  .archive-branch .archive-file-list button,
  .archive-branch .archive-file-list button:nth-child(even) {
    transition-duration: 1ms;
  }
}

.archive-branch .archive-file-list button:hover::before,
.archive-branch .archive-file-list button:hover::after,
.archive-branch .archive-file-list button:focus-visible::before,
.archive-branch .archive-file-list button:focus-visible::after,
.archive-branch .archive-file-list button.is-active::before,
.archive-branch .archive-file-list button.is-active::after {
  filter: brightness(1.45);
  opacity: 1;
}

.archive-branch .archive-file-list button:hover .archive-node,
.archive-branch .archive-file-list button:focus-visible .archive-node,
.archive-branch .archive-file-list button.is-active .archive-node {
  filter: brightness(1.45);
}

.archive-tether {
  background-image: repeating-linear-gradient(
    90deg,
    rgba(48, 226, 255, 0.94) 0 2px,
    transparent 2px 8px
  );
  filter: drop-shadow(0 0 8px rgba(48, 226, 255, 0.72));
}

.archive-anchor {
  background: #30e2ff;
  box-shadow: 0 0 0 7px rgba(48, 226, 255, 0.12), 0 0 18px rgba(48, 226, 255, 0.9);
}

@media (max-width: 720px) {
  .archive-branch {
    width: 174px;
  }

  .archive-branch .archive-file-list button,
  .archive-branch .archive-file-list button:nth-child(even) {
    width: 168px;
  }

  .archive-branch .archive-file-list button::after {
    width: 92px;
  }

  .archive-branch .archive-file-list button strong {
    font-size: 0.54rem;
  }
}


/* Radial archive: each file stems from the tracked archive window. */
.archive-branch {
  animation: archive-radial-enter 320ms ease-out;
  display: block;
  height: 0;
  max-height: none;
  overflow: visible;
  padding: 0;
  width: 0;
}

.archive-branch .archive-kicker,
.archive-branch h2 {
  left: 50%;
  margin: 0;
  pointer-events: none;
  position: absolute;
  text-align: center;
  transform: translate(-50%, -58px);
  white-space: nowrap;
}

.archive-branch h2 {
  transform: translate(-50%, -43px);
}

.archive-branch-close {
  left: 20px;
  pointer-events: auto;
  right: auto;
  top: -54px;
}

.archive-branch .archive-file-list {
  display: contents;
  max-height: none;
  overflow: visible;
  padding: 0;
}

.archive-branch .archive-file-list button,
.archive-branch .archive-file-list button:nth-child(even) {
  --branch-width: 166px;
  height: 40px;
  margin: 0;
  min-height: 40px;
  pointer-events: auto;
  position: absolute;
  top: calc(var(--branch-y) - 20px);
  width: var(--branch-width);
}

.archive-branch .archive-file-list button:nth-child(odd) {
  left: calc(var(--branch-x) - var(--branch-width));
  text-align: right;
  transform-origin: 100% 50%;
}

.archive-branch .archive-file-list button:nth-child(even) {
  left: var(--branch-x);
  text-align: left;
  transform-origin: 0 50%;
}

.archive-branch .archive-file-list button:nth-child(1) {
  --branch-x: -220px;
  --branch-y: -145px;
  --stem-angle: 33.4deg;
  --stem-length: 263px;
}

.archive-branch .archive-file-list button:nth-child(2) {
  --branch-x: 220px;
  --branch-y: -145px;
  --stem-angle: 146.6deg;
  --stem-length: 263px;
}

.archive-branch .archive-file-list button:nth-child(3) {
  --branch-x: -250px;
  --branch-y: 0px;
  --stem-angle: 0deg;
  --stem-length: 250px;
}

.archive-branch .archive-file-list button:nth-child(4) {
  --branch-x: 250px;
  --branch-y: 0px;
  --stem-angle: 180deg;
  --stem-length: 250px;
}

.archive-branch .archive-file-list button:nth-child(5) {
  --branch-x: -220px;
  --branch-y: 145px;
  --stem-angle: -33.4deg;
  --stem-length: 263px;
}

.archive-branch .archive-file-list button:nth-child(6) {
  --branch-x: 220px;
  --branch-y: 145px;
  --stem-angle: -146.6deg;
  --stem-length: 263px;
}

.archive-branch .archive-file-list button::before,
.archive-branch .archive-file-list button:nth-child(even)::before {
  left: 100%;
  top: 50%;
  transform: rotate(var(--stem-angle));
  transform-origin: 0 50%;
  width: var(--stem-length);
}

.archive-branch .archive-file-list button:nth-child(even)::before {
  left: 0;
}

.archive-branch .archive-file-list button::after {
  left: 0;
  top: calc(50% + 12px);
  width: 100%;
}

.archive-branch .archive-file-list button strong {
  align-items: center;
  display: flex;
  height: 40px;
  inset: 0 28px 0 8px;
  justify-content: flex-end;
  position: absolute;
  top: 0;
}

.archive-branch .archive-file-list button:nth-child(even) strong {
  inset: 0 8px 0 28px;
  justify-content: flex-start;
}

.archive-node {
  left: auto;
  right: -10px;
  top: 10px;
}

.archive-branch .archive-file-list button:nth-child(even) .archive-node {
  left: -10px;
  right: auto;
}

.archive-branch .archive-file-list button:hover,
.archive-branch .archive-file-list button:focus-visible,
.archive-branch .archive-file-list button.is-active {
  transform: scale(1.07);
}

.archive-panel {
  z-index: 10;
}

@keyframes archive-radial-enter {
  from {
    filter: blur(8px);
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .archive-branch .archive-file-list button,
  .archive-branch .archive-file-list button:nth-child(even) {
    --branch-width: 138px;
    width: var(--branch-width);
  }

  .archive-branch .archive-file-list button:nth-child(1) {
    --branch-x: -34px;
    --branch-y: -154px;
    --stem-angle: 77.6deg;
    --stem-length: 158px;
  }

  .archive-branch .archive-file-list button:nth-child(2) {
    --branch-x: 34px;
    --branch-y: -154px;
    --stem-angle: 102.4deg;
    --stem-length: 158px;
  }

  .archive-branch .archive-file-list button:nth-child(3) {
    --branch-x: -44px;
    --branch-y: 0px;
    --stem-angle: 0deg;
    --stem-length: 44px;
  }

  .archive-branch .archive-file-list button:nth-child(4) {
    --branch-x: 44px;
    --branch-y: 0px;
    --stem-angle: 180deg;
    --stem-length: 44px;
  }

  .archive-branch .archive-file-list button:nth-child(5) {
    --branch-x: -34px;
    --branch-y: 154px;
    --stem-angle: -77.6deg;
    --stem-length: 158px;
  }

  .archive-branch .archive-file-list button:nth-child(6) {
    --branch-x: 34px;
    --branch-y: 154px;
    --stem-angle: -102.4deg;
    --stem-length: 158px;
  }

  .archive-branch .archive-kicker {
    transform: translate(-50%, -42px);
  }

  .archive-branch h2 {
    transform: translate(-50%, -28px);
  }

  .archive-branch-close {
    left: 13px;
    top: -40px;
  }
}


/* Compact archive focus dial. Branch geometry is visual language, not page structure. */
.archive-branch {
  animation: archive-dial-enter 280ms ease-out;
  display: grid;
  gap: 2px;
  grid-template-rows: auto auto 24px minmax(0, 1fr) 24px;
  height: 286px;
  max-height: calc(100dvh - 24px);
  overflow: hidden;
  padding: 8px;
  transition: opacity 220ms ease, filter 220ms ease, transform 220ms ease;
  width: 220px;
}

.archive-branch .archive-kicker,
.archive-branch h2 {
  left: auto;
  margin: 0;
  pointer-events: none;
  position: static;
  text-align: left;
  transform: none;
  white-space: nowrap;
}

.archive-branch h2 {
  font-size: 0.78rem;
}

.archive-branch-close {
  left: auto;
  pointer-events: auto;
  right: 3px;
  top: 3px;
}

.archive-dial-step {
  appearance: none;
  align-self: center;
  background: transparent;
  border: 0;
  color: rgba(143, 245, 255, 0.72);
  cursor: pointer;
  font: 700 0.62rem/1 monospace;
  height: 24px;
  justify-self: center;
  padding: 0;
  text-shadow: 0 0 8px rgba(48, 226, 255, 0.72);
  width: 30px;
}

.archive-dial-step:hover,
.archive-dial-step:focus-visible {
  color: #e9fdff;
  outline: none;
  text-shadow: 0 0 12px #30e2ff;
}

.archive-branch .archive-file-list {
  display: block;
  height: 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
  max-height: none;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.archive-branch .archive-file-list button,
.archive-branch .archive-file-list button:nth-child(odd),
.archive-branch .archive-file-list button:nth-child(even) {
  background: transparent;
  color: rgba(107, 237, 255, 0.72);
  filter: blur(var(--dial-blur));
  height: 42px;
  left: 4px;
  margin: 0;
  min-height: 42px;
  opacity: var(--dial-opacity);
  padding: 0;
  pointer-events: auto;
  position: absolute;
  right: auto;
  text-align: left;
  top: 50%;
  transform:
    translateY(calc(-50% + var(--dial-y)))
    translateX(var(--dial-x))
    scale(var(--dial-scale));
  transform-origin: 24px 50%;
  transition:
    color 220ms ease,
    filter 220ms ease,
    opacity 220ms ease,
    transform 300ms cubic-bezier(0.2, 0.75, 0.2, 1);
  width: 200px;
}

.archive-branch .archive-file-list button::before,
.archive-branch .archive-file-list button:nth-child(even)::before {
  background: #30e2ff;
  height: 2px;
  left: 27px;
  opacity: 0.72;
  top: 27px;
  transform: rotate(-38deg);
  transform-origin: 0 50%;
  width: 31px;
}

.archive-branch .archive-file-list button::after {
  background: #30e2ff;
  height: 2px;
  left: 51px;
  opacity: 0.72;
  top: 8px;
  width: 138px;
}

.archive-branch .archive-file-list button strong,
.archive-branch .archive-file-list button:nth-child(even) strong {
  align-items: center;
  display: flex;
  font-size: 0.56rem;
  height: 30px;
  inset: 7px 5px 5px 58px;
  justify-content: flex-start;
  position: absolute;
  top: auto;
}

.archive-branch .archive-file-list .archive-node,
.archive-branch .archive-file-list button:nth-child(even) .archive-node {
  height: 18px;
  left: 8px;
  right: auto;
  top: 18px;
  width: 18px;
}

.archive-branch .archive-file-list button:hover,
.archive-branch .archive-file-list button:focus-visible,
.archive-branch .archive-file-list button.is-active,
.archive-branch .archive-file-list button.is-dial-focused {
  color: #e9fdff;
  filter: blur(0) drop-shadow(0 0 8px rgba(48, 226, 255, 0.46));
  opacity: 1;
  outline: none;
  transform:
    translateY(calc(-50% + var(--dial-y)))
    translateX(var(--dial-x))
    scale(var(--dial-focus-scale));
  z-index: 2;
}

.archive-branch .archive-file-list:hover button:not(:hover):not(.is-active):not(.is-dial-focused) {
  filter: blur(var(--dial-blur));
  opacity: var(--dial-opacity);
}

.archive-branch.has-open-asset {
  filter: blur(2px);
}

@keyframes archive-dial-enter {
  from {
    filter: blur(7px);
    opacity: 0;
    transform: scale(0.94);
  }
}

@media (max-width: 720px) {
  .archive-branch {
    height: min(260px, calc(100dvh - 24px));
    padding: 7px;
    width: 184px;
  }

  .archive-branch .archive-file-list button,
  .archive-branch .archive-file-list button:nth-child(odd),
  .archive-branch .archive-file-list button:nth-child(even) {
    width: 170px;
  }

  .archive-branch .archive-file-list button::after {
    width: 107px;
  }

  .archive-branch .archive-file-list button strong,
  .archive-branch .archive-file-list button:nth-child(even) strong {
    font-size: 0.52rem;
  }
}


.archive-panel {
  transform: translate(-50%, -50%);
}

.archive-panel.is-closing {
  transform: translate(-50%, -50%) scale(0.95);
}

.archive-branch.has-open-asset {
  filter: blur(2px);
  opacity: 0.14 !important;
  pointer-events: none !important;
}


/* Plain archive selection: no branch symbols or stems. */
.archive-branch .archive-file-list button::before,
.archive-branch .archive-file-list button::after,
.archive-branch .archive-file-list .archive-node {
  display: none !important;
}

.archive-branch .archive-file-list button,
.archive-branch .archive-file-list button:nth-child(odd),
.archive-branch .archive-file-list button:nth-child(even) {
  background: transparent;
  border-left: 2px solid transparent;
  box-shadow: none;
  padding: 0 10px;
  transition:
    background-color 320ms ease,
    border-color 320ms ease,
    color 320ms ease,
    filter 360ms ease,
    opacity 360ms ease,
    transform 480ms cubic-bezier(0.18, 0.72, 0.2, 1);
}

.archive-branch .archive-file-list button strong,
.archive-branch .archive-file-list button:nth-child(even) strong {
  align-items: center;
  display: flex;
  font-size: 0.58rem;
  height: 100%;
  inset: 0 8px;
  justify-content: center;
  position: absolute;
  text-align: center;
  top: 0;
}

.archive-branch .archive-file-list button:hover:not(.is-dial-focused):not(.is-active) {
  background: rgba(48, 226, 255, 0.025);
  border-color: transparent;
  color: rgba(143, 245, 255, 0.82);
  filter: blur(var(--dial-blur));
  opacity: var(--dial-opacity);
  transform:
    translateY(calc(-50% + var(--dial-y)))
    translateX(var(--dial-x))
    scale(var(--dial-scale));
}

.archive-branch .archive-file-list button.is-dial-focused,
.archive-branch .archive-file-list button.is-active {
  background: rgba(48, 226, 255, 0.1);
  border-color: #30e2ff;
  box-shadow: inset 10px 0 18px -16px rgba(48, 226, 255, 0.9);
  color: #e9fdff;
  filter: blur(0) drop-shadow(0 0 7px rgba(48, 226, 255, 0.34));
  opacity: 1;
}

@media (max-width: 720px) {
  .archive-branch .archive-file-list button strong,
  .archive-branch .archive-file-list button:nth-child(even) strong {
    font-size: 0.54rem;
  }
}


/* Chat identity: distinguish this browser from other visitors. */
.chat-message.is-local {
  justify-items: end;
  text-align: right;
}

.chat-message.is-local .chat-name {
  color: #c2f4ff;
  text-shadow: 0 0 10px rgba(74, 202, 255, 0.72);
}

.chat-message.is-local .chat-body {
  border-right: 1px solid rgba(140, 231, 255, 0.58);
  color: rgba(194, 244, 255, 0.98);
  padding-right: 6px;
}

.chat-message.is-remote {
  justify-items: start;
  text-align: left;
}

.chat-message.is-remote .chat-body {
  border-left: 1px solid rgba(232, 252, 255, 0.2);
  padding-left: 6px;
}


.chat-message.is-owner .chat-name {
  color: #c2f4ff;
  text-shadow: 0 0 12px rgba(74, 202, 255, 0.9);
}

.chat-message.is-owner .chat-body {
  border-left-color: rgba(140, 231, 255, 0.66);
}


.archive-branch[data-collection="nightcrawler"] {
  color: #ff9cad;
  text-shadow: 0 0 9px rgba(255, 71, 111, 0.58);
}

.archive-branch[data-collection="nightcrawler"] .archive-kicker,
.archive-branch[data-collection="nightcrawler"] h2 {
  color: #ffc0cb;
}

/* Stable media windows: collection titles and video ratios never resize the UI. */
.archive-branch {
  height: 286px;
  min-height: 286px;
  max-height: 286px;
  min-width: 220px;
  max-width: 220px;
  width: 220px;
}

.archive-branch h2 {
  min-height: 1em;
  overflow: hidden;
  padding-right: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
  height: min(440px, calc(100dvh - 28px));
  max-height: min(440px, calc(100dvh - 28px));
  min-height: min(440px, calc(100dvh - 28px));
  width: min(520px, calc(100vw - 28px));
}

.archive-panel h2 {
  min-height: 1.1em;
  overflow: hidden;
  padding-right: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-player {
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.archive-player video {
  aspect-ratio: auto;
  height: 100%;
  max-height: none;
  min-height: 0;
  object-fit: contain;
  width: 100%;
}

@media (max-width: 720px) {
  .archive-branch {
    height: 260px;
    min-height: 260px;
    max-height: 260px;
    min-width: 184px;
    max-width: 184px;
    width: 184px;
  }

  .archive-panel {
    height: min(400px, calc(100dvh - 32px));
    max-height: min(400px, calc(100dvh - 32px));
    min-height: min(400px, calc(100dvh - 32px));
    width: min(340px, calc(100vw - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }
}

/* Exact archive filenames remain readable inside fixed-size windows. */
.archive-branch {
  grid-template-rows: auto auto 34px 24px minmax(0, 1fr) 24px;
}

.archive-dial-name {
  color: rgba(233, 253, 255, 0.82);
  font: 700 0.48rem/1.15 "SFMono-Regular", Consolas, monospace;
  margin: 0;
  max-height: 34px;
  overflow: auto;
  overflow-wrap: anywhere;
  padding: 3px 20px 3px 1px;
  scrollbar-width: none;
}

.archive-dial-name::-webkit-scrollbar {
  display: none;
}

.archive-branch .archive-file-list button strong,
.archive-branch .archive-file-list button:nth-child(even) strong {
  justify-content: flex-start;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-panel h2 {
  height: 2.35em;
  line-height: 1.12;
  min-height: 2.35em;
  overflow: auto;
  overflow-wrap: anywhere;
  padding-right: 24px;
  text-overflow: clip;
  white-space: normal;
}

#archive-file-name {
  max-height: 2.4em;
  max-width: 72%;
  overflow: auto;
  overflow-wrap: anywhere;
  text-align: right;
}

@media (max-width: 720px) {
  .archive-dial-name {
    font-size: 0.45rem;
  }
}
