:root {
  color-scheme: dark;
  font: 16px/1.5 Inter, system-ui, sans-serif;
  background: #101319;
  color: #f3f5f8;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
[hidden] { display: none !important; }
a { color: #aac4ff; }
button, input { font: inherit; }
:focus-visible { outline: 3px solid #c0cdff; outline-offset: 3px; }

#launch-panel {
  position: fixed;
  z-index: 2;
  inset: 0;
  display: grid;
  justify-items: center;
  align-items: safe center;
  padding: max(2.5rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right))
    max(4rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  overflow: auto;
  background: radial-gradient(ellipse at 50% 35%, #202733 0, #13171f 42%, #101319 76%);
}
.launch-content { width: min(100%, 31rem); }
#launch-title, #picker h1 {
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 3.4rem);
  font-weight: 630;
  letter-spacing: -.055em;
  line-height: 1.05;
}
.preview-frame {
  display: none;
  margin: 1.6rem 0 1.25rem;
  overflow: hidden;
  border-radius: .7rem;
  background: #0b0d11;
  box-shadow: 0 0 0 1px #8f9cb344, 0 .9rem 3rem #05070b70;
}
#launch-panel[data-state="preview"] .preview-frame { display: block; }
#preview-image { display: block; width: 100%; height: auto; }
.launch-message { display: flex; align-items: flex-start; gap: .65rem; margin-top: 1.1rem; }
#status { margin: 0; color: #cbd2df; overflow-wrap: anywhere; white-space: pre-line; }
#elapsed {
  margin: .55rem 0 0 1.5rem;
  color: #a6b1c3;
  font: .8rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
#elapsed:empty, #status:empty, #launch-panel[data-state="preview"] #elapsed { display: none; }
.activity {
  display: none;
  width: .85rem;
  height: .85rem;
  flex: none;
  margin-top: .32rem;
  border: 2px solid #5a678055;
  border-top-color: #b6cbff;
  border-left-color: #b6cbff;
  border-radius: 50%;
  animation: turn .9s linear infinite;
}
#launch-panel[data-state="loading"] .activity { display: block; }
#launch-panel[data-state="error"] #status { color: #f0c8ba; }
#launch-panel[data-state="error"] #elapsed { margin-left: 0; }
@keyframes turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .activity { animation: none; } }

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 3rem;
  margin-top: 1.25rem;
  padding: .65rem 1.2rem;
  border: 1px solid #c1d2ff;
  border-radius: .5rem;
  background: #b5caff;
  color: #111b32;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.primary:hover { background: #ccdbff; }
.primary:active { background: #9db8f3; }
#start-live::before {
  content: '';
  border-block: .31rem solid transparent;
  border-left: .48rem solid currentColor;
}
@media (max-width: 32rem) {
  .primary { width: 100%; }
  #launch-panel { background: radial-gradient(ellipse at 50% 30%, #242c39 0, #141920 48%, #101319 80%); }
}

#screen { position: fixed; inset: 0; width: 100%; height: 100%; display: block; object-fit: fill; outline: none; touch-action: none; }
#screen[data-guest-pointer] { cursor: none; }
#launch-panel:not([hidden]) ~ #screen, #picker:not([hidden]) ~ #screen { pointer-events: none; }
.failure-actions { display: none; }
#launch-panel[data-state="error"] .failure-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem 1.2rem;
  margin-top: 1.25rem;
}
.failure-actions .primary { margin-top: 0; }
.shell-recovery { display: none; margin: 1.1rem 0 0; }
#launch-panel[data-state="error"] .shell-recovery { display: block; }
#picker {
  position: fixed;
  z-index: 3;
  inset: 0;
  width: min(31rem, calc(100% - 2.5rem));
  height: fit-content;
  max-height: 88%;
  overflow: auto;
  margin: auto;
  padding: clamp(1.2rem, 4vw, 2.25rem);
  border: 1px solid #374051;
  border-radius: .85rem;
  background: #191e27;
}
#picker h1 { font-size: 2rem; }
#picker p { color: #cbd2df; }
#picker label:not([hidden]) { display: block; margin-top: 1.5rem; }
#picker input { display: block; width: 100%; margin-top: .5rem; }
#image-error:empty { display: none; }

#diagnostics {
  position: fixed;
  z-index: 4;
  right: max(.65rem, env(safe-area-inset-right));
  bottom: max(.65rem, env(safe-area-inset-bottom));
  max-width: calc(100% - 1.3rem);
  border: 1px solid #465064;
  border-radius: .45rem;
  background: #191e27;
  color: #d9dfeb;
}
#diagnostics[open] { width: min(42rem, calc(100% - 1.3rem)); box-shadow: 0 .5rem 2rem #0008; }
summary { min-height: 2.25rem; padding: .45rem .7rem; font-size: .85rem; cursor: pointer; user-select: none; }
#console { height: min(40vh, 24rem); margin: 0; padding: .7rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #0b0d10; font: .75rem/1.5 ui-monospace, monospace; }
#shell { display: flex; align-items: center; gap: .5rem; padding: .55rem; font-size: .8rem; }
#shell input { flex: 1; min-width: 2rem; }
#shell input, #shell button { padding: .35rem; }
body.shell #diagnostics { left: .65rem; width: auto; }
body.shell #console { height: min(65vh, 42rem); }
