:root {
  color-scheme: dark;
  --abyss: #020408;
  --panel: rgba(4, 8, 15, .92);
  --cyan: #41f5e4;
  --cyan-bright: #bafff8;
  --magenta: #ff2e88;
  --violet: #9c7bff;
  --amber: #f5d742;
  --text: #dce9f5;
  --muted: #8195a8;
  --faint: #4c6174;
  --line: rgba(65, 245, 228, .17);
  --line-strong: rgba(65, 245, 228, .42);
  --bar-height: 42px;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --display: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--abyss);
}

body,
button,
input,
textarea { font-family: var(--mono); }

button,
a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible,
.app-window:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: -2px;
}

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

.tron-field,
.atmosphere {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tron-field { z-index: 0; }

.atmosphere {
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 44%, transparent 0 22%, rgba(2, 4, 8, .15) 55%, rgba(2, 4, 8, .82) 100%),
    linear-gradient(180deg, rgba(2, 4, 8, .12), rgba(2, 4, 8, .52));
  transition: background .7s ease;
}

body[data-workspace="1"] .atmosphere {
  background:
    linear-gradient(rgba(2, 4, 8, .68), rgba(2, 4, 8, .84)),
    radial-gradient(circle at 72% 40%, rgba(65, 245, 228, .08), transparent 35%);
}

.system-bar {
  position: fixed;
  z-index: 1000;
  inset: 0 0 auto;
  height: var(--bar-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  background: rgba(2, 5, 10, .82);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
  backdrop-filter: blur(20px) saturate(1.4);
}

.system-actions,
.system-right,
.runtime-state {
  display: flex;
  align-items: center;
}

.system-actions { justify-self: start; }
.system-right {
  justify-self: stretch;
  justify-content: flex-end;
  min-width: 0;
  overflow: hidden;
}

.system-button {
  height: 100%;
  min-width: 52px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  cursor: pointer;
  transition: color .15s, background .15s;
}

.system-button:hover,
.system-button[aria-expanded="true"] {
  color: var(--cyan-bright);
  background: rgba(65, 245, 228, .08);
}

.workspace-nav-button { font-size: 1.65rem; font-family: system-ui, sans-serif; }

.dot-grid {
  width: 17px;
  display: grid;
  grid-template-columns: repeat(3, 3px);
  gap: 3px;
}

.dot-grid i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.project-tabs {
  height: 100%;
  min-width: 0;
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}

.project-tabs::-webkit-scrollbar { display: none; }

.project-tab {
  position: relative;
  min-width: 92px;
  max-width: 190px;
  height: 100%;
  padding: 0 1rem;
  overflow: hidden;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .55rem;
  letter-spacing: .12em;
  cursor: pointer;
}

.project-tab.is-active {
  color: var(--cyan-bright);
  background: rgba(65, 245, 228, .055);
}

.project-tab.is-active::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--cyan);
}

.project-tab-close {
  margin-left: .55rem;
  color: var(--faint);
}

.background-picker {
  height: 100%;
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: 0 .7rem;
  color: var(--faint);
  border-left: 1px solid var(--line);
  font-size: .5rem;
  letter-spacing: .12em;
}

.background-picker select {
  max-width: 8rem;
  padding: .2rem 1.3rem .2rem .35rem;
  color: var(--cyan);
  background: #03080d;
  border: 1px solid var(--line);
  border-radius: 2px;
  font: inherit;
  letter-spacing: .08em;
}

.source-toggle,
.background-source-panel button {
  height: 100%;
  padding: 0 .8rem;
  color: var(--cyan);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  font-size: .52rem;
  letter-spacing: .12em;
  cursor: pointer;
}

.source-toggle[aria-expanded="true"] { background: rgba(65, 245, 228, .1); }

.background-source-panel {
  position: fixed;
  z-index: 900;
  top: var(--bar-height);
  right: 0;
  bottom: 0;
  width: min(46vw, 720px);
  display: none;
  grid-template-rows: 38px 1fr 28px;
  color: var(--text);
  background: rgba(2, 5, 10, .97);
  border-left: 1px solid var(--line-strong);
  box-shadow: -24px 0 70px rgba(0, 0, 0, .48);
  resize: horizontal;
  overflow: hidden;
}

.background-source-panel.is-open { display: grid; }
.background-source-panel > header,
.background-source-panel > footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-left: .8rem;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: .52rem;
  letter-spacing: .09em;
}
.background-source-panel > header strong { color: var(--cyan); }
.background-source-panel > header span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.background-source-panel > footer { border-top: 1px solid var(--line); border-bottom: 0; }

.background-editor-shell { position: relative; min-height: 0; overflow: hidden; }
.background-editor-shell pre,
.background-editor-shell textarea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  border: 0;
  font: 12px/1.55 var(--mono);
  tab-size: 2;
  white-space: pre;
}
.background-editor-shell pre { color: var(--text); pointer-events: none; }
.background-editor-shell textarea {
  color: transparent;
  caret-color: var(--cyan-bright);
  background: transparent;
  resize: none;
}
.background-editor-shell textarea::selection { color: transparent; background: rgba(65, 245, 228, .22); }

body.source-open .tron-field,
body.source-open .atmosphere { right: min(46vw, 720px); width: auto; }

.runtime-state {
  height: 100%;
  gap: .55rem;
  padding: 0 1rem;
  border-inline: 1px solid var(--line);
  color: var(--muted);
  font-size: .55rem;
  letter-spacing: .11em;
}

.runtime-led {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(245, 215, 66, .7);
  animation: blink 1.2s steps(2, end) infinite;
}

.runtime-led.is-live {
  background: var(--cyan);
  box-shadow: 0 0 11px rgba(65, 245, 228, .8);
  animation: none;
}

.runtime-led.is-error {
  background: var(--magenta);
  box-shadow: 0 0 11px rgba(255, 46, 136, .8);
  animation: none;
}

@keyframes blink { 50% { opacity: .25; } }

.workspace-viewport {
  position: fixed;
  z-index: 20;
  inset: var(--bar-height) 0 0;
  overflow: hidden;
}

.workspace-track {
  height: 100%;
  width: 200vw;
  display: flex;
  transform: translate3d(0, 0, 0);
  transition: transform .8s cubic-bezier(.16, 1, .3, 1);
  will-change: transform;
}

body[data-workspace="1"] .workspace-track { transform: translate3d(-100vw, 0, 0); }

.workspace {
  position: relative;
  width: 100vw;
  height: 100%;
  flex: 0 0 100vw;
  overflow: hidden;
}

.welcome-workspace {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  align-content: center;
  gap: clamp(30px, 7vw, 120px);
  padding: clamp(48px, 7vw, 110px);
}

.welcome-copy,
.start-button { position: relative; z-index: 2; }

.welcome-kicker {
  margin: 0;
  color: var(--cyan);
  font-size: clamp(.58rem, .85vw, .78rem);
  letter-spacing: .25em;
}

.welcome-copy h1 {
  margin: .12em 0 .04em;
  color: transparent;
  background: linear-gradient(110deg, #f1ffff 5%, var(--cyan-bright) 28%, var(--cyan) 56%, #4a9fff 78%, var(--violet));
  background-size: 200% 100%;
  background-clip: text;
  font-family: var(--display);
  font-size: clamp(5.8rem, 17vw, 14rem);
  font-weight: 900;
  line-height: .82;
  letter-spacing: .045em;
  filter: drop-shadow(0 0 34px rgba(65, 245, 228, .24));
  animation: title-shift 14s ease-in-out infinite;
}

@keyframes title-shift {
  0%, 12%, 100% { background-position: 0 50%; }
  50%, 62% { background-position: 100% 50%; }
}

.welcome-tagline {
  margin: 0;
  color: #77d9e7;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1rem, 1.7vw, 1.4rem);
  font-style: italic;
  letter-spacing: -.03em;
  text-shadow: 0 0 22px rgba(65, 245, 228, .3);
}

.start-button {
  min-width: clamp(190px, 20vw, 290px);
  min-height: clamp(105px, 11vw, 142px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.3rem;
  color: #031112;
  background: linear-gradient(115deg, #f2ffff, var(--cyan-bright) 30%, var(--cyan) 58%, #4ba8ff 82%, var(--violet));
  background-size: 220% 100%;
  border: 0;
  border-radius: 28px 4px;
  box-shadow: 0 0 25px rgba(65, 245, 228, .35), 0 0 70px rgba(156, 123, 255, .18);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 900;
  letter-spacing: .23em;
  cursor: pointer;
  opacity: .72;
  animation: start-breathe 4.5s ease-in-out infinite, title-shift 14s ease-in-out infinite;
  transition: transform .5s cubic-bezier(.16, 1, .3, 1), opacity .3s, letter-spacing .5s;
}

.start-mark {
  width: 2.8em;
  height: 2.25em;
  flex: 0 0 auto;
  object-fit: contain;
  filter: brightness(.65) saturate(1.3);
}

.start-button i { font-size: 1.8em; font-style: normal; font-weight: 300; }

.start-button:hover {
  opacity: 1;
  letter-spacing: .13em;
  transform: translateY(-4px) scale(1.04);
}

@keyframes start-breathe {
  50% { box-shadow: 0 0 35px rgba(65, 245, 228, .58), 0 0 95px rgba(156, 123, 255, .28); }
}

.welcome-coordinate {
  position: absolute;
  left: 5vw;
  bottom: calc(32px + 2.5vh);
  display: flex;
  gap: .8rem;
  align-items: center;
}

.welcome-coordinate a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s, text-shadow .15s;
}

.welcome-coordinate a:hover,
.welcome-coordinate a:focus-visible {
  color: var(--cyan-bright);
  text-shadow: 0 0 12px rgba(65, 245, 228, .45);
}
.desktop-workspace {
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(220px, .28fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(190px, .68fr);
  gap: 8px;
  padding: 12px 12px 44px;
  background: #020408;
}

.mobile-panel-tabs { display: none; }

.desktop-grid {
  position: absolute;
  z-index: 0;
  inset: 0;
  opacity: .32;
  background-image:
    linear-gradient(rgba(65, 245, 228, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(65, 245, 228, .055) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .9), transparent 95%);
}

.desktop-label,
.desktop-hint {
  position: absolute;
  color: var(--faint);
  font-size: .52rem;
  letter-spacing: .15em;
  pointer-events: none;
}

.desktop-label {
  top: 18px;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
}

.desktop-hint { right: 22px; bottom: 12px; }

.app-window {
  position: absolute;
  z-index: 10;
  min-width: 260px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  resize: both;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), inset 0 1px rgba(255, 255, 255, .035);
  backdrop-filter: blur(20px) saturate(1.15);
}

.desktop-workspace .app-window {
  position: relative;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
  min-width: 0;
  min-height: 0;
  resize: none;
  z-index: 2 !important;
  background: #030811;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .72), inset 0 1px rgba(255, 255, 255, .04);
}
.desktop-workspace .files-window { grid-column: 1; grid-row: 1 / span 2; }
.desktop-workspace .editor-window { grid-column: 2; grid-row: 1; }
.desktop-workspace .canvas-window { grid-column: 2; grid-row: 2; }
.desktop-workspace .desktop-hint { display: none; }

body[data-workspace="1"] .background-picker,
body[data-workspace="1"] .source-toggle { display: none; }

.app-window::before,
.app-window::after {
  content: "";
  position: absolute;
  z-index: 5;
  width: 10px;
  height: 10px;
  pointer-events: none;
}

.app-window::before {
  left: -1px;
  top: -1px;
  border-left: 2px solid var(--cyan);
  border-top: 2px solid var(--cyan);
}

.app-window::after {
  right: -1px;
  bottom: -1px;
  border-right: 2px solid var(--cyan);
  border-bottom: 2px solid var(--cyan);
}

.app-window.is-focused {
  border-color: rgba(65, 245, 228, .65);
  box-shadow: 0 26px 80px rgba(0, 0, 0, .65), 0 0 25px rgba(65, 245, 228, .08);
}

.app-window.is-hidden { display: none; }

.app-window.is-maximized {
  inset: 18px 18px 28px !important;
  width: auto !important;
  height: auto !important;
  resize: none;
}

.files-window { left: 2.4vw; top: 7vh; width: min(22vw, 330px); height: 73vh; }
.editor-window { left: 24.8vw; top: 4vh; width: 45vw; height: 78vh; }
.canvas-window { left: 67.5vw; top: 11vh; width: 30vw; height: 64vh; }
.window-titlebar {
  min-height: 38px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex: none;
  background: rgba(2, 5, 10, .82);
  border-bottom: 1px solid var(--line);
  user-select: none;
  cursor: move;
  touch-action: none;
}

.window-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding-left: .85rem;
  color: var(--muted);
  font-size: .58rem;
  letter-spacing: .15em;
}

.window-number { color: var(--cyan); }

.dirty-indicator {
  width: 6px;
  height: 6px;
  display: none;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 7px var(--amber);
}

.dirty-indicator.is-dirty { display: inline-block; }
.window-controls { display: flex; }

.window-controls button {
  width: 38px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.window-controls button:hover {
  color: var(--cyan);
  background: rgba(65, 245, 228, .08);
}

.window-toolbar,
.window-status {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  padding: 0 .8rem;
  color: var(--faint);
  background: rgba(2, 5, 10, .54);
  font-size: .5rem;
  letter-spacing: .12em;
}

.window-toolbar { border-bottom: 1px solid var(--line); }
.window-status { border-top: 1px solid var(--line); }

.window-toolbar button {
  padding: .3rem .45rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: .5rem;
  letter-spacing: .1em;
  cursor: pointer;
}

.window-toolbar button:hover:not(:disabled) { color: var(--cyan); }
.window-toolbar button:disabled { opacity: .28; cursor: not-allowed; }

.editor-toolbar .run-button {
  margin-left: .5rem;
  padding: .35rem .7rem;
  color: #031112;
  background: var(--cyan);
  border-radius: 2px;
}

.editor-toolbar .run-button:hover:not(:disabled) {
  color: #031112;
  background: var(--cyan-bright);
}

.editor-toolbar .paredit-button {
  color: var(--violet);
  border-color: rgba(156, 123, 255, .42);
}

.editor-toolbar .paredit-button[aria-pressed="false"] {
  color: var(--faint);
  border-color: rgba(123, 145, 164, .24);
}

.file-tree {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: .55rem 0;
}

.file-group {
  padding: .55rem .8rem .3rem;
  color: var(--faint);
  font-size: .5rem;
  letter-spacing: .14em;
}

.file-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .46rem .8rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  text-align: left;
  font-size: .66rem;
  cursor: pointer;
}

.file-row::before { content: "◇"; color: var(--faint); }
.file-row:hover { color: var(--text); background: rgba(65, 245, 228, .04); }

.file-row.is-active {
  color: var(--cyan);
  background: rgba(65, 245, 228, .07);
  border-left-color: var(--cyan);
}

.window-loading {
  padding: 1rem;
  color: var(--faint);
  font-size: .58rem;
  letter-spacing: .1em;
}

.editor-surface {
  position: relative;
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  overflow: hidden;
  background: rgba(1, 3, 7, .42);
}

.line-numbers {
  padding: .9rem .65rem;
  overflow: hidden;
  color: #31485b;
  border-right: 1px solid rgba(65, 245, 228, .08);
  font-size: .68rem;
  line-height: 1.65;
  text-align: right;
  white-space: pre;
  user-select: none;
}

.line-numbers .is-changed { color: var(--amber); }
.line-numbers .is-changed::before { content: "◆ "; color: var(--pink); }

.structural-diff {
  position: absolute;
  z-index: 5;
  top: .7rem;
  right: .7rem;
  width: min(280px, calc(100% - 1.4rem));
  max-height: calc(100% - 1.4rem);
  overflow: auto;
  padding: .7rem .8rem;
  color: var(--text);
  background: rgba(3, 11, 18, .97);
  border: 1px solid rgba(65, 245, 228, .34);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .48);
  font: .58rem/1.65 "SFMono-Regular", Consolas, monospace;
  letter-spacing: .05em;
  white-space: pre-wrap;
}

.editor-surface textarea {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: .9rem 1rem;
  resize: none;
  color: transparent;
  background: transparent;
  border: 0;
  outline: 0;
  caret-color: var(--cyan);
  font-size: .68rem;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.code-highlight {
  grid-column: 2;
  grid-row: 1;
  z-index: 0;
  min-width: 0;
  margin: 0;
  padding: .9rem 1rem;
  overflow: hidden;
  color: #c9d8e6;
  font: .68rem/1.65 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  tab-size: 2;
  white-space: pre;
  pointer-events: none;
  will-change: transform;
}

.code-highlight .paren-0 { color: #41f5e4; }
.code-highlight .paren-1 { color: #f5d742; }
.code-highlight .paren-2 { color: #ff2e88; }
.code-highlight .paren-3 { color: #9c7bff; }
.code-highlight .paren-4 { color: #6ee7ff; }
.code-highlight .paren-5 { color: #a6ff6e; }
.code-highlight .comment { color: #53677a; }
.code-highlight .string { color: #f5d742; }
.code-highlight .keyword { color: #9c7bff; }
.code-highlight .unmatched { color: #ff2e88; background: rgba(255, 46, 136, .15); }
.code-highlight .eval-target { background: rgba(65, 245, 228, .12); box-shadow: inset 0 -1px 0 rgba(65, 245, 228, .34); }

.inline-eval {
  position: absolute;
  z-index: 3;
  max-width: min(42%, 340px);
  overflow: hidden;
  padding: 1px 6px;
  color: var(--cyan);
  background: rgba(2, 12, 16, .94);
  border: 1px solid rgba(65, 245, 228, .28);
  font: .61rem/1.35 "SFMono-Regular", Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.inline-eval.is-error { color: var(--pink); border-color: rgba(255, 46, 136, .35); }
.inline-eval.is-pending { color: var(--amber); border-color: rgba(245, 215, 66, .4); }

.hal-completions {
  position: absolute;
  z-index: 4;
  min-width: 190px;
  max-width: 320px;
  max-height: 190px;
  overflow: auto;
  padding: 4px;
  background: #071019;
  border: 1px solid rgba(65, 245, 228, .32);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}

.hal-completion {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 6px 8px;
  color: var(--text);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.hal-completion strong { color: var(--cyan); font: .64rem "SFMono-Regular", Consolas, monospace; }
.hal-completion small { color: var(--muted); font-size: .52rem; }
.hal-completion.is-active, .hal-completion:hover { background: rgba(65, 245, 228, .1); }

.editor-surface textarea::selection {
  color: #fff;
  background: rgba(65, 245, 228, .25);
}

.canvas-wrap {
  position: relative;
  min-height: 0;
  flex: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(45deg, rgba(65, 245, 228, .025) 25%, transparent 25%, transparent 75%, rgba(65, 245, 228, .025) 75%),
    #010307;
  background-size: 18px 18px;
}

.canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: .6rem;
  color: var(--faint);
  text-align: center;
  letter-spacing: .16em;
  pointer-events: none;
}

.canvas-empty span {
  color: var(--cyan);
  font-size: 1rem;
  text-shadow: 0 0 18px rgba(65, 245, 228, .5);
}

.canvas-empty small { font-size: .5rem; }
.canvas-empty.is-hidden { display: none; }

.app-launcher {
  position: fixed;
  z-index: 1100;
  top: calc(var(--bar-height) + 10px);
  left: 10px;
  width: min(420px, calc(100vw - 20px));
  color: var(--text);
  background: rgba(3, 7, 13, .96);
  border: 1px solid var(--line-strong);
  box-shadow: 0 32px 90px rgba(0, 0, 0, .68), 0 0 35px rgba(65, 245, 228, .08);
  backdrop-filter: blur(24px) saturate(1.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px) scale(.97);
  transform-origin: top left;
  transition: opacity .18s, transform .25s cubic-bezier(.16, 1, .3, 1), visibility .18s;
}

.app-launcher.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.launcher-head,
.launcher-foot {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: .55rem;
  letter-spacing: .16em;
}

.system-bottom-bar {
  position: fixed;
  z-index: 1000;
  inset: auto 0 0;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  background: rgba(2, 5, 10, .82);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.bottom-spacer { flex: 1; }

.home-tools {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  border-left: 1px solid var(--line);
}

.background-audio {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  border-left: 1px solid var(--line);
}

.background-audio button,
.background-audio label {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: 0 .7rem;
  color: var(--cyan);
  background: transparent;
  border: 0;
  font: .52rem var(--mono);
  letter-spacing: .1em;
}

.background-audio button { cursor: pointer; border-right: 1px solid var(--line); }
.background-audio button:hover { color: var(--cyan-bright); background: rgba(65, 245, 228, .08); }
.background-audio input { width: 64px; accent-color: var(--cyan); }

.publish-button {
  align-self: stretch;
  padding: 0 .9rem;
  color: var(--cyan);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  font: .55rem var(--mono);
  letter-spacing: .12em;
  cursor: pointer;
}

.publish-button:disabled { display: none; }
.publish-button:hover { color: var(--cyan-bright); background: rgba(65, 245, 228, .08); }

.help-button {
  align-self: stretch;
  padding: 0 .85rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  font: .55rem var(--mono);
  letter-spacing: .12em;
  cursor: pointer;
}

.help-button:hover { color: var(--cyan-bright); background: rgba(65, 245, 228, .08); }

.launcher-index { color: var(--cyan); }

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  padding: 1px;
  background: var(--line);
}

.app-tile {
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  color: var(--muted);
  background: #050a12;
  border: 0;
  font-size: .58rem;
  letter-spacing: .12em;
  text-decoration: none;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.app-tile:hover { color: var(--cyan-bright); background: rgba(65, 245, 228, .08); }

.app-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  background: rgba(65, 245, 228, .06);
  border: 1px solid var(--line-strong);
  border-radius: 8px 2px;
  font-size: .8rem;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(65, 245, 228, .07);
}

.app-icon-canvas { color: var(--magenta); border-color: rgba(255, 46, 136, .42); }
.app-icon-editor { color: var(--violet); border-color: rgba(156, 123, 255, .45); font-size: .62rem; }

.launcher-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  color: var(--faint);
}

.launcher-projects {
  border-top: 1px solid var(--line);
  max-height: 210px;
  overflow: auto;
}

.launcher-projects > strong {
  display: block;
  padding: .8rem 1rem .55rem;
  color: var(--faint);
  font-size: .5rem;
  letter-spacing: .15em;
}

.saved-workspace,
.launcher-empty {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-top: 1px solid rgba(65, 245, 228, .08);
  font: .55rem var(--mono);
  letter-spacing: .08em;
  text-align: left;
}

.saved-workspace { cursor: pointer; }
.saved-workspace:hover { color: var(--cyan-bright); background: rgba(65, 245, 228, .06); }

.launcher-scrim {
  position: fixed;
  z-index: 1090;
  inset: var(--bar-height) 0 0;
  display: none;
  background: rgba(0, 0, 0, .16);
}

.launcher-scrim.is-open { display: block; }

.hara-dialog {
  width: min(430px, calc(100vw - 30px));
  padding: 0;
  color: var(--text);
  background: #050a12;
  border: 1px solid var(--line-strong);
  box-shadow: 0 35px 110px #000, 0 0 30px rgba(65, 245, 228, .12);
}

.hara-dialog::backdrop {
  background: rgba(0, 2, 5, .72);
  backdrop-filter: blur(4px);
}

.dialog-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 1rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: .58rem;
  letter-spacing: .15em;
}

.workspace-template-dialog,
.publish-dialog { width: min(620px, calc(100vw - 24px)); }

.workspace-name-field {
  display: grid;
  gap: .45rem;
  padding: 1rem;
  color: var(--muted);
  font-size: .55rem;
  letter-spacing: .14em;
}

.workspace-name-field input {
  min-height: 42px;
  padding: 0 .8rem;
  color: var(--text);
  background: #020408;
  border: 1px solid var(--line);
  font-size: .75rem;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  padding: 1px;
  background: var(--line);
}

.template-option {
  min-height: 104px;
  display: grid;
  place-content: center;
  gap: .6rem;
  color: var(--muted);
  background: #040911;
  border: 0;
  font: .58rem var(--mono);
  letter-spacing: .09em;
  cursor: pointer;
}

.template-option::before {
  content: attr(data-symbol);
  color: var(--cyan);
  font-size: 1rem;
}

.template-option:hover { color: var(--cyan-bright); background: rgba(65, 245, 228, .07); }

.publish-summary {
  display: grid;
  gap: .38rem;
  padding: 1.25rem 1.25rem 1rem;
  background: linear-gradient(120deg, rgba(65, 245, 228, .09), transparent 62%);
  border-bottom: 1px solid rgba(65, 245, 228, .12);
}

.publish-summary strong { color: var(--cyan-bright); font: .82rem var(--mono); letter-spacing: .06em; }
.publish-summary > span:last-child,
.publish-eyebrow { color: var(--faint); font: .5rem var(--mono); letter-spacing: .14em; }
.publish-eyebrow { color: var(--cyan); }

.publish-intro,
.publish-note {
  margin: 0;
  padding: .9rem 1.25rem;
  color: var(--muted);
  font-size: .62rem;
  line-height: 1.6;
}

.publish-visibility {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
  padding: .15rem 1.25rem 1.05rem;
  color: var(--cyan-bright);
  font-size: .56rem;
  letter-spacing: .08em;
}

.publish-visibility span { width: 100%; margin-left: 1.42rem; color: var(--faint); font-size: .5rem; letter-spacing: .04em; }

.publish-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
}

.publish-option {
  min-height: 128px;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: .38rem;
  padding: 1.05rem 1.2rem;
  color: var(--muted);
  background: #040911;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.publish-option strong { font: .62rem var(--mono); letter-spacing: .08em; }
.publish-option small { color: var(--faint); font: .48rem var(--mono); letter-spacing: .13em; }
.publish-option-icon { color: var(--cyan); font: 1.35rem var(--mono); line-height: 1; }
.publish-option:hover:not(:disabled) { color: var(--cyan-bright); background: rgba(65, 245, 228, .08); }
.publish-option:hover:not(:disabled) small { color: var(--cyan); }
.publish-option:disabled { cursor: not-allowed; opacity: .42; }
.publish-option-github { background: linear-gradient(135deg, rgba(156, 123, 255, .12), #040911 65%); }
.publish-option-github .publish-option-icon { color: #bca8ff; }

.publish-auth {
  display: block;
  margin: 1rem 1.25rem 0;
  color: var(--cyan);
  font: .55rem var(--mono);
  letter-spacing: .1em;
}

.publish-code {
  display: block;
  margin: .65rem 1.25rem 0;
  padding: .55rem .7rem;
  color: var(--cyan-bright);
  background: #020408;
  border: 1px dashed var(--line-strong);
  font: .7rem var(--mono);
  letter-spacing: .15em;
}

.publish-auth[hidden],
.publish-code:empty { display: none; }
.publish-note.is-error { color: #ff9da0; }

.dialog-head button {
  align-self: stretch;
  width: 42px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line);
  cursor: pointer;
}

.hara-dialog label {
  display: grid;
  gap: .6rem;
  padding: 1.2rem 1.2rem .7rem;
  color: var(--faint);
  font-size: .52rem;
  letter-spacing: .13em;
}

.hara-dialog input {
  width: 100%;
  padding: .75rem .8rem;
  color: var(--cyan-bright);
  background: #010408;
  border: 1px solid var(--line);
  outline: none;
}

.hara-dialog p {
  min-height: 1.2em;
  margin: 0;
  padding: 0 1.2rem;
  color: var(--muted);
  font-size: .62rem;
}

.help-content { padding: 1.2rem; color: var(--muted); font: .7rem/1.6 system-ui, sans-serif; }
.help-content p { padding: 0; margin: 0 0 1rem; }
.help-content dl { display: grid; gap: .6rem; margin: 0; }
.help-content dl div { display: grid; grid-template-columns: 6rem 1fr; gap: .75rem; }
.help-content dt { color: var(--cyan-bright); font: .58rem var(--mono); letter-spacing: .08em; }
.help-content dd { margin: 0; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: 1rem 1.2rem 1.2rem;
}

.dialog-actions button {
  padding: .55rem .8rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  font-size: .55rem;
  letter-spacing: .1em;
  cursor: pointer;
}

.dialog-actions .dialog-confirm {
  color: #031112;
  background: var(--cyan);
  border-color: var(--cyan);
}

.toast-stack {
  position: fixed;
  z-index: 1300;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: min(420px, calc(100vw - 36px));
  padding: .75rem 1rem;
  color: var(--text);
  background: rgba(4, 9, 16, .96);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--cyan);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  font-size: .6rem;
  line-height: 1.5;
  letter-spacing: .06em;
  animation: toast-in .3s cubic-bezier(.16, 1, .3, 1);
}

.toast.is-error { border-left-color: var(--magenta); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

@media (max-width: 900px) {
  .welcome-workspace {
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: start;
  }

  .start-button { min-height: 84px; }
}

@media (max-width: 700px) {
  :root { --bar-height: 48px; }
  .system-bar { grid-template-columns: 1fr auto 1fr; }
  .system-button { min-width: 48px; }
  .workspace-nav-button { display: none; }
  .project-tab { min-width: 78px; padding: 0 .7rem; font-size: .5rem; }
  .background-picker { display: none !important; }
  .background-audio label { display: none; }
  .source-toggle { display: block; }
  .background-source-panel {
    top: auto;
    left: 0;
    width: 100%;
    height: 58vh;
    resize: vertical;
    border-top: 1px solid var(--line-strong);
    border-left: 0;
  }
  body.source-open .tron-field,
  body.source-open .atmosphere { inset: 0 0 58vh; width: 100%; height: auto; }
  .system-bottom-bar .runtime-state span:last-child { display: none; }
  .system-bottom-bar .runtime-state { min-width: 46px; padding: 0 .8rem; }
  .welcome-workspace {
    padding: 9vh 7vw 12vh;
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: stretch;
    gap: 2rem;
  }
  .welcome-copy h1 { font-size: clamp(4.8rem, 28vw, 8rem); }
  .welcome-kicker { font-size: .5rem; letter-spacing: .18em; }
  .welcome-tagline { font-size: 1rem; }
  .start-button { width: 100%; min-width: 0; min-height: 86px; }
  .welcome-coordinate { left: 7vw; bottom: 52px; font-size: .58rem; }
  .launcher-grid { grid-template-columns: repeat(2, 1fr); }
  .app-tile { min-height: 96px; }
  .template-grid { grid-template-columns: repeat(2, 1fr); }
  .publish-options { grid-template-columns: 1fr; }
  .desktop-workspace {
    display: block;
    padding: 48px 8px 40px;
  }
  .mobile-panel-tabs {
    position: absolute;
    z-index: 20;
    inset: 8px 8px auto;
    height: 40px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  .desktop-workspace .app-window {
    position: absolute;
    inset: 56px 8px 40px !important;
    width: auto !important;
    height: auto !important;
  }
  .desktop-workspace .app-window:not(.is-focused) { display: none; }
  .desktop-workspace .app-window.is-focused { display: flex; }
  .window-titlebar { min-height: 42px; }
  .window-controls button { min-width: 44px; }
  .window-toolbar { overflow-x: auto; }
  .window-toolbar > span,
  .window-status span:last-child { display: none; }
  .toast-stack { right: 10px; bottom: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
