:root {
  color-scheme: dark;
  --background: #090a0c;
  --panel: #111317;
  --panel-raised: #171a1f;
  --line: #2a2e35;
  --text: #f2efe8;
  --muted: #9da1a8;
  --accent: #bd1e2d;
  --accent-bright: #e14350;
  --success: #55b979;
  --warning: #d7a84b;
  --danger: #ef5f63;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 85% -10%, rgba(189, 30, 45, 0.2), transparent 34rem),
    linear-gradient(180deg, #0d0e11, var(--background) 34rem);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  min-height: 2.55rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: #20242a;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: #525963;
  background: #282d34;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

button:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

button.primary {
  border-color: #d33644;
  background: var(--accent);
}

button.primary:hover {
  background: #ce2635;
}

.shell {
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 1.25rem;
}

.masthead,
.runtime-bar,
.console-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.masthead {
  padding: 0.3rem 0 1.25rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 5vw, 3.8rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.9;
}

h1 span {
  color: var(--accent-bright);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.32em;
  font-weight: 800;
  letter-spacing: 0.16em;
  vertical-align: top;
}

h2 {
  margin-bottom: 0.25rem;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
}

.build-tag {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.73rem;
}

.runtime,
.console-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: rgba(17, 19, 23, 0.94);
  box-shadow: 0 1.4rem 5rem rgba(0, 0, 0, 0.24);
}

.runtime {
  width: min(960px, 100%, 88vh);
  margin-inline: auto;
}

.runtime-bar,
.console-heading {
  padding: 0.9rem 1rem;
}

.status-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-group p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.status-light {
  width: 0.7rem;
  height: 0.7rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 1rem rgba(215, 168, 75, 0.6);
}

.status-light.ready {
  background: var(--success);
  box-shadow: 0 0 1rem rgba(85, 185, 121, 0.6);
}

.status-light.error {
  background: var(--danger);
  box-shadow: 0 0 1rem rgba(239, 95, 99, 0.7);
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.pointer-lock {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-right: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.pointer-lock input {
  accent-color: var(--accent-bright);
}

.progress-track {
  height: 4px;
  background: #20242a;
  opacity: 0;
  transition: opacity 160ms ease;
}

.progress-track.visible {
  opacity: 1;
}

.progress-value {
  width: 0;
  height: 100%;
  background: var(--accent-bright);
  transition: width 120ms linear;
}

.viewport {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 3;
  place-items: center;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px),
    #030405;
  background-size: 32px 32px;
  isolation: isolate;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.launch-screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  overflow: hidden;
  place-items: center;
  background: #f5f5f3;
  transition: opacity 280ms ease, visibility 280ms ease;
}

.launch-screen.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.poster-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #fff;
}

.poster-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 0 10%, rgba(0, 0, 0, 0.08) 52%, rgba(0, 0, 0, 0.28) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), transparent 38%, rgba(0, 0, 0, 0.12));
}

.poster-platform {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 1;
  padding: 0.48rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(5, 6, 8, 0.72);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}

.launch-action {
  position: relative;
  z-index: 3;
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  margin-top: 2rem;
  text-align: center;
}

.launch-action > span:last-child {
  max-width: min(34rem, calc(100vw - 3rem));
  padding: 0.55rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(8, 9, 11, 0.72);
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.22);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.78rem;
  line-height: 1.35;
  backdrop-filter: blur(8px);
}

.launch-action > span:empty {
  display: none;
}

.launch-button {
  position: relative;
  width: clamp(5.5rem, 9vw, 7rem);
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(8, 9, 11, 0.52);
  box-shadow: 0 0 0 0.7rem rgba(255, 255, 255, 0.09), 0 1rem 3rem rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.launch-button:hover:not(:disabled) {
  border-color: #fff;
  background: rgba(189, 30, 45, 0.86);
  box-shadow: 0 0 0 0.9rem rgba(255, 255, 255, 0.12), 0 1rem 3rem rgba(0, 0, 0, 0.4);
  transform: scale(1.04);
}

.play-icon {
  display: block;
  width: 0;
  height: 0;
  margin-left: 42%;
  border-top: 1.05rem solid transparent;
  border-bottom: 1.05rem solid transparent;
  border-left: 1.65rem solid #fff;
}

.launch-screen.loading .launch-button {
  border-color: transparent;
  border-top-color: #fff;
  background: rgba(8, 9, 11, 0.65);
  animation: launch-spin 900ms linear infinite;
}

.launch-screen.loading .play-icon {
  display: none;
}

.launch-screen.error .launch-button {
  border-color: var(--danger);
  animation: none;
}

@keyframes launch-spin {
  to { transform: rotate(360deg); }
}

.console-panel {
  margin-top: 1rem;
}

.console-heading {
  border-bottom: 1px solid var(--line);
}

.console-heading h2 {
  margin-bottom: 0;
}

.console-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.console-panel.collapsed .console-heading {
  border-bottom: 0;
}

.console-panel.collapsed #output {
  display: none;
}

button.quiet {
  min-height: auto;
  padding: 0.4rem 0.65rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
}

#output {
  height: 13rem;
  margin: 0;
  overflow: auto;
  padding: 1rem;
  background: #08090b;
  color: #c9cdd3;
  font: 0.76rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-error {
  color: #ff8589;
}

footer {
  padding: 1.25rem 0 0;
  color: #727780;
  font-size: 0.75rem;
  text-align: center;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 1rem, 1440px);
    padding-top: 1rem;
  }

  .masthead,
  .runtime-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .build-tag {
    display: none;
  }

  .actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .pointer-lock {
    width: 100%;
  }

  .launch-action {
    margin-top: 1rem;
  }
}
