/* style.css — the harness chrome. Dark, quiet, dense: the preview is the show. */

:root {
  --bg: #0e1116;
  --panel: #151b22;
  --line: #232c36;
  --text: #dce4ec;
  --dim: #8b98a5;
  --accent: #5ab0ff;
  --ok: #4cc38a;
  --warn: #e5a53d;
  --err: #e5646c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, sans-serif;
}

header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

header h1 { margin: 0; font-size: 1.25rem; letter-spacing: 0.02em; }
.tagline { margin: 0; color: var(--dim); font-size: 0.85rem; flex: 1; }

#tabs { display: flex; gap: 0.4rem; }

#tabs button {
  background: none;
  border: 1px solid transparent;
  color: var(--dim);
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}

#tabs button:hover { color: var(--text); }
#tabs button.active { color: var(--text); border-color: var(--line); background: var(--panel); }

main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
}

#sidebar {
  width: 230px;
  padding: 1rem;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
}

#sidebar h2 { margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.hint { margin: 0; color: var(--dim); font-size: 0.78rem; }

#files { display: flex; flex-direction: column; gap: 0.25rem; }

#project-bar, #session-bar { display: flex; flex-direction: column; gap: 0.4rem; }
#session-bar { flex-direction: row; align-items: center; }
#session-bar select { flex: 1; }
#session-bar button { flex: 0; width: auto; }

#resume-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px dashed var(--warn);
  border-radius: 8px;
  color: var(--warn);
  font-size: 0.85rem;
}

#resume-bar[hidden] { display: none; }
#resume-bar span { flex: 1; }

.history-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.history-row span { flex: 1; color: var(--dim); }

#files button {
  text-align: left;
  background: none;
  border: none;
  color: var(--accent);
  padding: 0.25rem 0.4rem;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}

#files button:hover { background: var(--panel); }

#editor { display: flex; flex-direction: column; gap: 0.4rem; }
#editor[hidden] { display: none; }

input, textarea, select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 0.45rem 0.6rem;
  font: inherit;
  width: 100%;
}

textarea { resize: vertical; font-family: ui-monospace, monospace; font-size: 0.82rem; }

button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}

button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.55; cursor: default; }

.row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

#view-chat {
  border-right: 1px solid var(--line);
}

#right-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#view-chat,
#right-pane section {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1.2rem;
  gap: 0.9rem;
  overflow-y: auto;
}

#right-pane section[hidden] { display: none; }
section h2 { margin: 0; font-size: 1rem; }
section h3 { margin: 0; font-size: 0.85rem; color: var(--text); }
section p { margin: 0; color: var(--dim); max-width: 60ch; }
section ol { margin: 0; padding-left: 1.2rem; color: var(--dim); display: flex; flex-direction: column; gap: 0.35rem; }
section code { background: var(--panel); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }

label { color: var(--dim); font-size: 0.8rem; margin-top: 0.4rem; }

#log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
}

.msg pre {
  margin: 0;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.85rem/1.5 ui-monospace, monospace;
}

.msg-user pre { background: #1c2a3d; }
.msg-assistant pre { background: var(--panel); }
.msg-thinking pre { background: none; border: 1px dashed var(--line); color: var(--dim); font-style: italic; }
.msg-tool pre { background: none; color: var(--accent); padding-left: 0; }
.msg-tool_result pre { background: none; color: var(--dim); padding-left: 1rem; }
.msg-error pre { background: none; color: var(--err); }

#composer { display: flex; gap: 0.5rem; }
#prompt { flex: 1; }

#preview-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ok { color: var(--ok); }
.warn { color: var(--warn); }

#console-panel {
  flex: 0 0 auto;
  max-height: 30%;
  overflow-y: auto;
}

#console-panel summary {
  cursor: pointer;
  color: var(--dim);
  font-size: 0.85rem;
}

#console-list { display: flex; flex-direction: column; gap: 0.2rem; padding-top: 0.4rem; }

.console-row {
  font: 0.78rem/1.4 ui-monospace, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--dim);
}

.console-error { color: var(--err); }
.console-warn { color: var(--warn); }

@media (max-width: 1100px) {
  body { height: auto; overflow: auto; }
  main { flex-direction: column; }
  #sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--line); }
  #view-chat { border-right: none; border-bottom: 1px solid var(--line); min-height: 60vh; }
  #right-pane section { min-height: 60vh; }
}

/* ---------------------------------------------------------- element picker */

#pick-element.active,
#circle-area.active {
  background: #e06c75;
  border-color: #e06c75;
  color: #fff;
}
