.app {
  --ice: #dce8ff;
  --muted: rgba(205, 220, 247, 0.62);
  --panel: rgba(8, 13, 24, 0.7);
  position: fixed;
  inset: 0;
  overflow: hidden;
  color: var(--ice);
  background:
    radial-gradient(circle at 50% 8%, rgba(53, 83, 142, 0.17), transparent 40%),
    #03050a;
  font-family: var(--font-geist-sans), system-ui, sans-serif;
}

.app::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(3, 5, 10, 0.2), transparent 18%, transparent 75%, rgba(3, 5, 10, 0.54)),
    radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.38));
  content: "";
}

.stage,
.canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.canvas {
  display: block;
  touch-action: none;
  cursor: grab;
}

.canvas:active { cursor: grabbing; }

.header {
  position: fixed;
  top: clamp(16px, 2.5vw, 30px);
  right: clamp(16px, 2.5vw, 32px);
  left: clamp(16px, 2.5vw, 32px);
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.homeLink {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(183, 208, 251, 0.28);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(108, 145, 211, 0.23), rgba(21, 35, 63, 0.32));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.09), 0 12px 35px rgba(0, 0, 0, 0.2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: -0.05em;
}

.homeLink strong,
.homeLink small { display: block; }
.homeLink strong { font-size: 18px; font-weight: 610; letter-spacing: -0.02em; }
.homeLink small { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }

.axisKey {
  display: grid;
  grid-template-columns: auto auto;
  gap: 5px 13px;
  padding: 11px 14px;
  border: 1px solid rgba(183, 208, 251, 0.16);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.axisKey span:nth-child(even) { color: var(--muted); }
.spaceDot,
.timeDot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 6px 1px 0;
  border-radius: 99px;
  background: #a8c7ff;
  box-shadow: 0 0 9px #6e9df4;
}
.timeDot { background: #748fca; box-shadow: 0 0 9px #496aa8; }

.readout {
  position: fixed;
  top: 50%;
  left: clamp(16px, 2.5vw, 32px);
  z-index: 3;
  display: grid;
  gap: 17px;
  width: 126px;
  transform: translateY(-50%);
  pointer-events: none;
}

.readout div {
  padding-left: 12px;
  border-left: 1px solid rgba(157, 190, 246, 0.34);
}

.readout span,
.readout strong { display: block; }
.readout span { color: var(--muted); font-size: 9px; letter-spacing: 0.13em; text-transform: uppercase; }
.readout strong { margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; font-weight: 520; }

.controls {
  position: fixed;
  right: clamp(16px, 2.5vw, 32px);
  bottom: clamp(20px, 3vw, 34px);
  left: clamp(16px, 2.5vw, 32px);
  z-index: 3;
  display: grid;
  grid-template-columns: auto minmax(160px, 210px) minmax(170px, 250px) auto;
  gap: 24px;
  align-items: center;
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px;
  border: 1px solid rgba(183, 208, 251, 0.18);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(22px);
}

.transport { display: flex; gap: 5px; }

.transport button {
  min-height: 40px;
  padding: 0 12px;
  color: rgba(220, 232, 255, 0.76);
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.transport button:hover,
.transport button:focus-visible {
  color: #f4f7ff;
  border-color: rgba(181, 207, 249, 0.16);
  background: rgba(125, 158, 218, 0.12);
  outline: none;
}

.transport button:active { transform: scale(0.96); }
.transport button:disabled { opacity: 0.32; cursor: not-allowed; }

.transport .primaryButton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 84px;
  color: #f4f7ff;
  border-color: rgba(181, 207, 249, 0.19);
  background: linear-gradient(145deg, rgba(99, 135, 202, 0.3), rgba(52, 78, 126, 0.22));
}

.primaryButton span { width: 13px; font-size: 13px; }

.presetControl {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.presetControl > span,
.presetControl small {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.presetControl > span { color: var(--muted); }
.presetControl small { color: rgba(205, 220, 247, 0.44); }

.presetControl select {
  width: 100%;
  height: 28px;
  padding: 0 28px 0 9px;
  color: #e8efff;
  border: 1px solid rgba(181, 207, 249, 0.18);
  border-radius: 8px;
  background: rgba(58, 79, 119, 0.32);
  color-scheme: dark;
  cursor: pointer;
  font-size: 10px;
}

.presetControl select:focus-visible {
  border-color: rgba(169, 197, 245, 0.7);
  outline: 2px solid rgba(169, 197, 245, 0.3);
  outline-offset: 2px;
}

.speedControl { min-width: 0; }
.speedControl > span { display: flex; justify-content: space-between; margin-bottom: 7px; }
.speedControl b,
.speedControl output { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.speedControl b { color: var(--muted); }

.speedControl input {
  width: 100%;
  height: 2px;
  margin: 0;
  border-radius: 99px;
  appearance: none;
  background: rgba(154, 184, 234, 0.25);
  cursor: pointer;
}

.speedControl input::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  border: 2px solid #dbe8ff;
  border-radius: 50%;
  appearance: none;
  background: #6c8dcc;
  box-shadow: 0 0 0 4px rgba(105, 143, 208, 0.14), 0 0 14px rgba(111, 155, 232, 0.55);
}

.toggles { display: flex; gap: 14px; }
.toggles label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  white-space: nowrap;
}

.toggles input { position: absolute; opacity: 0; pointer-events: none; }
.toggles label > span {
  position: relative;
  width: 25px;
  height: 14px;
  border: 1px solid rgba(176, 202, 246, 0.24);
  border-radius: 99px;
  background: rgba(52, 68, 98, 0.62);
  transition: background 160ms ease;
}

.toggles label > span::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #91a6cc;
  transition: transform 160ms ease, background 160ms ease;
  content: "";
}

.toggles input:checked + span { background: rgba(71, 108, 174, 0.78); }
.toggles input:checked + span::after { background: #e4edff; transform: translateX(11px); }
.toggles input:focus-visible + span { outline: 2px solid #a9c5f5; outline-offset: 3px; }

.hint {
  position: fixed;
  right: 0;
  bottom: 4px;
  left: 0;
  z-index: 3;
  margin: 0;
  color: rgba(185, 203, 235, 0.34);
  font-size: 8px;
  letter-spacing: 0.13em;
  text-align: center;
  text-transform: uppercase;
  pointer-events: none;
}

@media (max-width: 1050px) {
  .controls { grid-template-columns: auto minmax(150px, 0.8fr) minmax(160px, 1fr); gap: 12px 18px; }
  .toggles { grid-column: 1 / -1; justify-content: flex-end; padding: 0 4px 2px; }
}

@media (max-width: 680px) {
  .header { top: 14px; right: 14px; left: 14px; }
  .homeLink small,
  .axisKey span:nth-child(even) { display: none; }
  .axisKey { grid-template-columns: auto; }
  .readout { top: 88px; left: 14px; display: flex; width: auto; transform: none; }
  .readout div { min-width: 74px; }
  .readout div:last-child { display: none; }
  .controls { right: 10px; bottom: 16px; left: 10px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; padding: 9px; }
  .transport { display: grid; grid-template-columns: repeat(4, 1fr); }
  .transport button { padding: 0 7px; font-size: 10px; }
  .transport .primaryButton { justify-content: center; min-width: 0; }
  .presetControl { padding: 0 7px; }
  .speedControl { padding: 0 7px; }
  .toggles { justify-content: space-between; padding: 0 7px 2px; }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .transport button,
  .toggles label > span,
  .toggles label > span::after { transition-duration: 0.01ms; }
}
