:root {
  --green: #4dff9e;
  --green-dim: #1f7a4d;
  --cyan: #6cf0ff;
  --red: #ff3b5c;
  --blue: #3b7bff;
  --bg: #02060a;
  --ink: #c9f7dd;
  --font: "SFMono-Regular", "JetBrains Mono", "Fira Code", ui-monospace, Menlo,
    Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app,
.wttm {
  position: fixed;
  inset: 0;
}

wttm-scene {
  position: absolute;
  inset: 0;
  display: block;
}

wttm-scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1rem, 3vw, 2.5rem);
}

.hud {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 42ch;
  text-shadow: 0 0 12px rgba(77, 255, 158, 0.35);
}

.hud h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}

.hud .subtitle {
  margin: 0;
  font-size: clamp(0.72rem, 1.4vw, 0.9rem);
  color: var(--green-dim);
  letter-spacing: 0.04em;
}

.hud .who {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--cyan);
  opacity: 0.75;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  font-size: clamp(0.66rem, 1.2vw, 0.78rem);
  color: var(--green-dim);
  letter-spacing: 0.03em;
}

.footer .keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}

.footer kbd {
  font-family: inherit;
  color: var(--green);
  border: 1px solid rgba(77, 255, 158, 0.3);
  border-radius: 0.3rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.9em;
}

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: rgba(77, 255, 158, 0.85);
  box-shadow: 0 0 6px rgba(77, 255, 158, 0.8);
}

.crosshair::before {
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  transform: translateX(-50%);
}

.crosshair::after {
  top: 50%;
  left: 0;
  height: 1px;
  width: 100%;
  transform: translateY(-50%);
}

.brand {
  color: var(--green-dim);
  opacity: 0.6;
}

.colophon {
  display: flex;
  align-items: baseline;
  gap: 0.35rem 0.9rem;
  color: var(--green-dim);
}

.colophon a {
  pointer-events: auto;
  text-decoration: none;
  border-bottom: 1px solid rgba(77, 255, 158, 0.35);
}

.colophon .license {
  font-size: 0.85em;
  opacity: 0.8;
}

.status {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--green-dim);
  text-transform: uppercase;
  animation: pulse 1.8s ease-in-out infinite;
}

.status.error {
  color: var(--red);
  animation: none;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.blue {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, #00131f, #000 70%);
  pointer-events: auto;
  text-align: center;
  padding: 2rem;
}

.blue .card {
  max-width: 40ch;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.blue h2 {
  margin: 0;
  color: var(--blue);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: clamp(1rem, 2.2vw, 1.4rem);
}

.blue p {
  margin: 0;
  color: #9fc3ff;
  font-size: 0.9rem;
  line-height: 1.6;
}

.blue button {
  pointer-events: auto;
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(108, 240, 255, 0.4);
  border-radius: 0.35rem;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.blue button:hover {
  background: rgba(108, 240, 255, 0.12);
  border-color: var(--cyan);
}

.scanlines::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
}

.vignette::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0.65) 100%
  );
}

@media (prefers-reduced-motion: reduce) {
  .status {
    animation: none;
  }
}

.toggle {
  position: absolute;
  top: clamp(1rem, 3vw, 2.5rem);
  right: clamp(1rem, 3vw, 2.5rem);
  z-index: 5;
  pointer-events: auto;
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  background: rgba(2, 12, 8, 0.6);
  border: 1px solid rgba(77, 255, 158, 0.4);
  border-radius: 0.35rem;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

.toggle:hover,
.toggle:focus {
  background: rgba(77, 255, 158, 0.14);
  outline: none;
}

.note {
  position: absolute;
  left: 50%;
  bottom: 15%;
  transform: translateX(-50%);
  max-width: 46ch;
  text-align: center;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: rgba(2, 12, 8, 0.88);
  border: 1px solid rgba(77, 255, 158, 0.4);
  border-radius: 0.4rem;
  padding: 0.6rem 1rem;
  pointer-events: none;
}

.keys.hint kbd {
  animation: hintpulse 1.1s ease-in-out infinite;
  border-color: var(--green);
  color: #eafff4;
  background: rgba(77, 255, 158, 0.16);
}

@keyframes hintpulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(77, 255, 158, 0);
  }
  50% {
    box-shadow: 0 0 14px rgba(77, 255, 158, 0.7);
  }
}

.flat {
  position: fixed;
  inset: 0;
  overflow: auto;
  padding: clamp(1rem, 4vw, 3rem);
  background: #02060a;
  color: var(--ink);
}

/* The rain sits behind the whole simple view and stays put while it scrolls. */
.flat .rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.55;
  pointer-events: none;
}

.flat-inner {
  position: relative;
  z-index: 1;
  max-width: min(1100px, 100%);
  margin: 0 auto;
}

/* Title and actions share a row and wrap: the toggle drops below the title on
   a narrow viewport instead of landing on top of it. */
.flat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.5rem;
}

.flat-head .hud {
  max-width: 62ch;
  flex: 1 1 20rem;
}

.flat-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 0 0 auto;
}

.flat .toggle,
.flat .settings-button {
  position: static;
}

.settings-button {
  pointer-events: auto;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--green);
  background: rgba(2, 12, 8, 0.6);
  border: 1px solid rgba(77, 255, 158, 0.4);
  border-radius: 0.35rem;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.settings-button:hover,
.settings-button:focus {
  background: rgba(77, 255, 158, 0.14);
  outline: none;
}

.settings-wrap {
  position: relative;
  display: inline-flex;
}

/* A dropdown anchored to the gear, not a block in the page flow. */
.settings {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 10;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(77, 255, 158, 0.35);
  border-radius: 0.5rem;
  background: rgba(2, 12, 8, 0.95);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: max-content;
  max-width: min(20rem, 78vw);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.setting {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}

.setting input {
  accent-color: var(--green);
  width: 1rem;
  height: 1rem;
}

.setting-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--green-dim);
}

.blurb {
  margin: 0.35rem 0 0;
  font-size: clamp(0.75rem, 1.4vw, 0.9rem);
  color: var(--cyan);
  opacity: 0.9;
}

/* Side by side while there is room, one below the other once a column would be
   narrower than the cards can stand. */
.flat-catalog {
  margin: 1.5rem auto 4rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  align-items: start;
  gap: 1.8rem;
}

.flat-category h2 {
  margin: 0;
  color: var(--green);
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(77, 255, 158, 0.25);
  padding-bottom: 0.35rem;
}

.flat-category ul {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.card {
  border: 1px solid rgba(77, 255, 158, 0.18);
  border-radius: 0.5rem;
  background: rgba(3, 12, 16, 0.55);
  overflow: hidden;
}

.card:hover,
.card:focus-within {
  border-color: rgba(77, 255, 158, 0.5);
  background: rgba(77, 255, 158, 0.06);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
}

.card-icon {
  position: relative;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 1.25rem;
}

.card-emoji {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.card-favicon {
  position: relative;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.25rem;
  object-fit: contain;
  background: rgba(2, 12, 8, 0.85);
}

.card-favicon.failed {
  display: none;
}

.card-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d9ffe9;
  font-weight: 600;
  text-decoration: none;
}

.card-title:hover,
.card-title:focus {
  color: var(--green);
  outline: none;
}

.card-toggle {
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--green);
  background: transparent;
  border: 1px solid rgba(77, 255, 158, 0.35);
  border-radius: 0.3rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
}

.card-toggle:hover,
.card-toggle:focus {
  background: rgba(77, 255, 158, 0.14);
  outline: none;
}

.card-body {
  display: none;
  margin-top: -0.1rem;
  padding: 0.6rem 0.85rem 0.75rem 3.05rem;
  border-top: 1px solid rgba(77, 255, 158, 0.12);
}

.card.expanded .card-body {
  display: block;
}

.card-body p {
  margin: 0 0 0.5rem;
  color: var(--green-dim);
  font-size: 0.8rem;
  line-height: 1.5;
}

.card-open {
  color: var(--green);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-bottom: 1px solid rgba(77, 255, 158, 0.35);
}

.card-open:hover,
.card-open:focus {
  color: #eafff4;
  outline: none;
}

.flat-footer {
  margin: 0 auto 2.5rem;
  display: flex;
  justify-content: flex-end;
}

wttm-scene canvas {
  touch-action: none;
}

.footer a {
  pointer-events: auto;
}

.auth {
  display: inline-block;
  pointer-events: auto;
  color: var(--green);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  background: rgba(2, 12, 8, 0.6);
  border: 1px solid rgba(77, 255, 158, 0.4);
  border-radius: 0.35rem;
  padding: 0.45rem 0.85rem;
}

.auth:hover,
.auth:focus {
  background: rgba(77, 255, 158, 0.14);
  outline: none;
}

/* In the colophon it reads as a link beside the brand, not a button. */
.colophon .auth {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(77, 255, 158, 0.4);
  border-radius: 0;
  padding: 0;
  font-size: 0.85em;
  letter-spacing: normal;
  text-transform: none;
}

.touch {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.touch .pad {
  position: absolute;
  width: 3.2rem;
  height: 3.2rem;
  pointer-events: auto;
  border-radius: 50%;
  border: 1px solid rgba(77, 255, 158, 0.5);
  background: rgba(2, 12, 8, 0.5);
  color: var(--green);
  font-size: 1.05rem;
  line-height: 1;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch .up {
  left: 50%;
  bottom: 9rem;
  transform: translateX(-50%);
}

.touch .down {
  left: 50%;
  bottom: 4.6rem;
  transform: translateX(-50%);
}

.touch .left {
  left: 1.6rem;
  bottom: 6.8rem;
}

.touch .right {
  right: 1.6rem;
  bottom: 6.8rem;
}

.touch .gyro {
  left: 50%;
  bottom: 0.8rem;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  border-radius: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
