:root {
  color-scheme: dark;
  --background: #191e1b;
  --line: #323a34;
  --text: #e0e6db;
  --muted: #9aa695;
  --accent: #c5dfa3;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, textarea { font: inherit; }
button {
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 5px 8px;
}
button:hover { color: var(--text); background: #2a332b; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .4; }
.nav {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 18px;
  min-height: 46px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--line);
  background: #202622;
  font-size: 12px;
}
.brand { font: 600 15px var(--mono); color: var(--accent); }
.runtime-state { display: flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--muted); }
.runtime-state i { width: 6px; height: 6px; border-radius: 50%; background: #d0b675; }
.runtime-state[data-state="ready"] i { background: #acd27d; }
.runtime-state[data-state="error"] i { background: #e39c8e; }
.runtime-version { color: #7e8c78; font: 10px var(--mono); }
.nav-actions { display: flex; gap: 5px; align-items: center; margin-left: auto; }
.experiments-trigger { border-color: var(--line); }
.console-screen {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
  scrollbar-color: #53614d transparent;
  scrollbar-width: thin;
}
.console-entry {
  margin: 0 0 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
  font: 15px/1.65 var(--mono);
}
.console-entry.command { color: #adc792; }
.console-entry.stderr { color: #e5a897; }
.console-entry.system { color: var(--muted); }
#console-form { display: flex; align-items: flex-start; gap: 12px; }
.prompt { padding-top: 4px; color: var(--accent); font: 15px/1.65 var(--mono); }
#code {
  flex: 1;
  min-width: 0;
  min-height: 33px;
  max-height: min(250px, 50dvh);
  resize: none;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  caret-color: var(--accent);
  font: 15px/1.65 var(--mono);
  tab-size: 4;
}
#code::placeholder { color: #798673; }
.run-button { color: var(--accent); font: 18px var(--mono); }
#experiments {
  position: fixed;
  inset: 54px 12px auto auto;
  margin: 0;
  width: min(280px, calc(100vw - 24px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #232b25;
  color: var(--text);
  box-shadow: 0 8px 28px #0005;
}
#experiments h2 { margin: 0 0 12px; font-size: 13px; font-weight: 600; }
#experiments button { display: block; width: 100%; text-align: left; font-size: 13px; }
@media (max-width: 720px) {
  .nav { gap: 10px; padding: 7px 10px; font-size: 11px; }
  .runtime-version { display: none; }
  .nav-actions { gap: 2px; }
  .nav-actions button { padding: 5px 6px; }
  .console-screen { padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .console-entry, #code, .prompt { font-size: 14px; }
  #console-form { gap: 9px; }
}
@media (max-width: 360px) {
  .runtime-state #status { display: none; }
}
