*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e6edf3;
  --muted: #8b9cb3;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.15);
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr minmax(260px, 340px);
  grid-template-rows: 1fr;
  gap: 0;
  height: 100%;
  min-height: 0;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }
}

.sidebar,
.preview,
.chat-panel {
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--border);
  overflow: hidden;
  min-height: 0;
  max-height: 100%;
}

.chat-panel {
  border-right: none;
}

.sidebar,
.preview,
.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar h2,
.preview-title,
.chat-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.preview-hint {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
}

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  flex: 1;
  height: 0;
  min-height: 0;
}

.project-list li {
  margin-bottom: 0.35rem;
}

.project-list button {
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.project-list button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.project-list button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.project-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

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

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow: auto;
  flex: 1;
  height: 0;
  min-height: 0;
}

.chat-bubble {
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble .idx {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
