:root {
  --bg: #0f1419;
  --panel: #171c23;
  --panel-2: #1d242d;
  --border: #2a323d;
  --fg: #d6dde6;
  --muted: #7f8b99;
  --accent: #d98a3d;      /* rust orange */
  --ok: #4caf7d;
  --err: #e0635a;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 var(--mono);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
header h1 {
  font-size: 16px;
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex: 1;
}
header .sub { color: var(--muted); font-size: 12px; }

.sidebar {
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
}
#examples {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  overflow-y: auto;
}
button.ex {
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 9px;
  font: 12px var(--mono);
  text-align: left;
  cursor: pointer;
}
button.ex:hover { border-color: var(--accent); color: var(--accent); }

.actions { display: flex; gap: 8px; }
button.action {
  background: var(--accent);
  color: #1a1206;
  border: none;
  border-radius: 5px;
  padding: 6px 14px;
  font: 600 13px var(--mono);
  cursor: pointer;
}
button.action.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
button.action:hover { filter: brightness(1.08); }

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  min-height: 0;
  min-width: 0;
}

.pane { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.pane-title {
  padding: 7px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

#editor {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.6 var(--mono);
  padding: 12px 14px;
  tab-size: 2;
}

.right { display: flex; flex-direction: column; min-height: 0; }
.pane-body { flex: 1; overflow: auto; padding: 12px 14px; }

.right .rust-wrap { border-top: 1px solid var(--border); display: flex; flex-direction: column; max-height: 45%; }
#rust { overflow: auto; padding: 10px 14px; white-space: pre; color: var(--fg); font-size: 12px; margin: 0; }
#rust:empty::before { content: "(press Run to transpile)"; color: var(--muted); }

.status { font-weight: 600; margin-bottom: 10px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.muted { color: var(--muted); }

pre { white-space: pre-wrap; margin: 0; font: 13px/1.55 var(--mono); }

ul.diags { list-style: none; padding: 0; margin: 0; }
ul.diags li {
  border: 1px solid var(--border);
  border-left: 3px solid var(--err);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--panel);
}
ul.diags .cls { color: var(--err); font-weight: 600; }
ul.diags .loc { color: var(--muted); font-size: 12px; }
ul.diags .msg { margin-top: 3px; }
ul.diags .src {
  margin-top: 6px;
  padding: 4px 7px;
  background: var(--panel-2);
  border-radius: 3px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .workspace { flex-direction: column; }
  .sidebar {
    width: auto;
    max-height: 30%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  #examples { flex-direction: row; flex-wrap: wrap; }
  button.ex { flex: 1 1 auto; }
  main { grid-template-columns: 1fr; }
}
