:root {
  --app-font: Inter, Arial, sans-serif;
  --bg: #17191f;
  --panel: #242832;
  --panel-2: #1d2028;
  --line: #363b48;
  --text: #e7eaf0;
  --muted: #9ca6b8;
  --blue: #4aa3ff;
  --green: #48d597;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: var(--app-font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
button, input, select { font: inherit; }
button {
  color: var(--text);
  background: #2d323e;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}
button:hover, button.active { border-color: var(--blue); background: #263a50; }
.topbar {
  height: 58px;
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #20232b;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  background: #11141b;
  border: 1px solid #4b5364;
  border-radius: 8px;
  font-weight: 800;
}
.menus { display: flex; gap: 4px; }
.menus button { background: transparent; border-color: transparent; color: var(--muted); }
.toolbar { display: flex; align-items: center; gap: 6px; }
.tool { width: 34px; height: 34px; padding: 0; }
.play { color: #07120d; background: var(--green); border-color: var(--green); font-weight: 700; }
.divider { width: 1px; height: 28px; background: var(--line); margin: 0 4px; }
.workspace {
  height: calc(100% - 84px);
  display: grid;
  grid-template-columns: 250px minmax(420px, 1fr) 330px;
  min-width: 920px;
}
.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-height: 0;
}
.inspector { border-right: 0; border-left: 1px solid var(--line); overflow: auto; }
.panel-title {
  height: 42px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.panel-title button { padding: 4px 8px; font-size: 12px; }
.center {
  min-width: 0;
  display: grid;
  grid-template-rows: 38px minmax(260px, 1fr) 210px;
  background: #111318;
}
.tabs {
  display: flex;
  align-items: end;
  gap: 2px;
  padding: 5px 8px 0;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.tab {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: #20242d;
  color: var(--muted);
}
.tab.active { color: var(--text); background: #2a2f3a; }
.viewport-wrap { position: relative; min-height: 0; }
#viewport { display: block; width: 100%; height: 100%; outline: none; }
.gizmo {
  position: absolute; right: 14px; top: 14px;
  display: grid; grid-template-columns: repeat(3, 28px); gap: 6px;
}
.gizmo span {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; font-weight: 800; background: #111823; border: 1px solid var(--line);
}
.x { color: #ff6b6b; } .y { color: #5ee18a; } .z { color: #5aa7ff; }
.runtime-banner {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  background: #122a1e; color: #8df5bf; border: 1px solid #2d8055;
  padding: 7px 12px; border-radius: 999px; font-weight: 700;
}
.made-badge {
  position: absolute;
  left: 18px;
  bottom: 16px;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  background: rgba(12, 16, 22, 0.68);
  color: #dbe8ff;
  font-weight: 800;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.ui-widget {
  position: absolute;
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  color: white;
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
}
.ui-button {
  display: grid;
  place-items: center;
  font-weight: 800;
}
.ui-text {
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.38);
  font-weight: 800;
}
.ui-panel {
  background: rgba(12,18,28,.72);
  backdrop-filter: blur(8px);
}
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 14, .82);
  padding: 18px;
}
.project-card {
  width: min(760px, 96vw);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #202631;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.project-card h1 { margin: 0 0 8px; }
.project-card p { color: var(--muted); margin: 0 0 16px; }
.project-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.project-options button {
  min-height: 112px;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.project-options b { color: #b8d9ff; font-size: 16px; }
.project-options span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.bottom {
  border-top: 1px solid var(--line);
  border-right: 0;
  overflow: hidden;
}
.mini { height: 36px; padding-top: 4px; }
.asset-grid {
  height: calc(100% - 36px);
  overflow: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 9px;
}
.asset {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
}
.asset b { color: var(--blue); font-size: 11px; text-transform: uppercase; }
.asset span { overflow-wrap: anywhere; }
.tree { padding: 8px; overflow: auto; height: calc(100% - 42px); }
.tree-row {
  width: 100%;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  text-align: left;
}
.tree-row small { color: var(--muted); }
#inspector { padding: 12px; }
#inspector h3 {
  margin: 18px 0 8px;
  font-size: 13px;
  color: #c3ccda;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
label { display: grid; gap: 6px; margin: 10px 0; color: var(--muted); font-size: 12px; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #151820;
  color: var(--text);
  border-radius: 6px;
  padding: 7px 8px;
}
input[type="checkbox"] { width: auto; }
input[type="color"] { height: 38px; padding: 3px; }
textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  background: #10141c;
  color: #b8f7d4;
  border-radius: 6px;
  padding: 9px;
  font-family: "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}
.hint {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vector {
  display: grid;
  grid-template-columns: 64px repeat(3, 1fr);
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
}
.vector span { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; margin-top: 14px; }
.console {
  height: calc(100% - 36px);
  overflow: auto;
  padding: 10px 12px;
  font-family: "Courier New", monospace;
  color: #a8f0c5;
  background: #10151a;
  font-size: 12px;
}
.module-panel {
  height: calc(100% - 36px);
  overflow: auto;
  padding: 10px;
  background: #11151d;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.module-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1b202a;
  padding: 10px;
  min-height: 82px;
}
.module-grid b {
  display: block;
  color: #b8d9ff;
  margin-bottom: 8px;
}
.module-grid span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.statusbar {
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  color: var(--muted);
  background: #151922;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.empty { color: var(--muted); }
.hidden { display: none !important; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 210px minmax(360px, 1fr) 280px; }
  .topbar { grid-template-columns: 220px 1fr; height: auto; }
  .toolbar { grid-column: 1 / -1; }
  .project-options { grid-template-columns: 1fr; }
}
