:root {
  --bg: #1b1c1e;
  --chrome: #2a2b2e;
  --chrome-border: #3a3b3f;
  --text: #d4d4d4;
  --muted: #8b8d93;
  --font: "SF Mono", "Menlo", "Cascadia Mono", "Consolas", "DejaVu Sans Mono", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

.window {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 32px;
  padding: 0 12px;
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-border);
  font-size: 12px;
  color: var(--muted);
  user-select: none;
  flex: none;
}

.lights { display: flex; gap: 8px; }
.lights i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff5f57;
}
.lights i:nth-child(2) { background: #febc2e; }
.lights i:nth-child(3) { background: #28c840; }

.title {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.new-session {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  font: inherit;
  padding: 2px 8px;
  cursor: pointer;
}
.new-session:hover,
.new-session:focus-visible {
  border-color: var(--chrome-border);
  color: var(--text);
  outline: none;
}

dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--chrome-border);
  border-radius: 10px;
  background: var(--chrome);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
dialog form { padding: 20px; }
dialog h1 { margin: 0 0 16px; font-size: 15px; font-weight: 600; }
fieldset { margin: 0 0 16px; padding: 0; border: 0; }
legend { margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.hint { opacity: 0.7; }

.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.options.topics { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--chrome-border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
}
.option:hover { border-color: #55575d; }
.option:has(input:checked) { border-color: var(--accent, #8b8d93); }
.option input { margin: 2px 0 0; accent-color: var(--accent, #8b8d93); }
.option .name { display: block; font-weight: 600; }
.option .desc { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.swatch { width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; display: inline-block; }

.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.actions button {
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--chrome-border);
}
.actions .secondary { background: transparent; color: var(--text); }
.actions .primary { background: #e8e8e8; color: #111; border-color: #e8e8e8; }
.actions .primary:hover { background: #fff; }
.actions button:focus-visible { outline: 2px solid #6aa5ff; outline-offset: 2px; }

#terminal {
  flex: 1;
  min-height: 0;
  padding: 8px 4px 4px 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .lights { display: none; }
  #terminal { padding: 4px; }
}
