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

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-dim: #1f3a5f;
  --green: #3fb950;
  --red: #f85149;
  --input-bg: #0d1117;
  --btn-bg: #21262d;
  --btn-hover: #30363d;
  --radius: 6px;
  --font-mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

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

/* ── App shell ─────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Header ────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

header h1 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

header .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

header .spacer { flex: 1; }

header .icon-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-mono);
  cursor: default;
}

/* ── Main columns ───────────────────────────────── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Left panel (editor) ────────────────────────── */
#left-panel {
  width: 380px;
  min-width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 14px;
  gap: 8px;
}

.pane + .pane {
  border-top: 1px solid var(--border);
}

.pane-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  flex-shrink: 0;
}

textarea {
  flex: 1;
  resize: none;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 10px 12px;
  outline: none;
  min-height: 0;
  transition: border-color 0.15s;
}

textarea:focus { border-color: var(--accent); }
textarea[readonly] { color: var(--text-muted); cursor: default; }
textarea[readonly]:focus { border-color: var(--border); }

/* ── Buttons ────────────────────────────────────── */
.btn-row {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

button {
  flex: 1;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

button:hover { background: var(--btn-hover); }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d1117;
  font-weight: 600;
}

button.primary:hover { background: #79b8ff; border-color: #79b8ff; }

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── PowerPoint tip ─────────────────────────────── */
#pptx-tip {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(88,166,255,0.05);
}
#pptx-tip strong { color: var(--text); }

/* ── Status bar ─────────────────────────────────── */
#status {
  font-size: 11.5px;
  padding: 5px 0 0;
  min-height: 18px;
  flex-shrink: 0;
}
#status.ok  { color: var(--green); }
#status.err { color: var(--red); }

/* ── Right panel (3D viewer) ────────────────────── */
#right-panel {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #090c10;
}

#three-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* CSS2D label overlay */
#label-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.node-label {
  color: var(--text);
  font-size: 11px;
  font-family: var(--font-mono);
  background: rgba(13,17,23,0.75);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
}

/* ── Viewer hint ─────────────────────────────────── */
#viewer-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(13,17,23,0.6);
  padding: 4px 12px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 1s;
}
#viewer-hint.hidden { opacity: 0; }

/* ── Loading spinner ────────────────────────────── */
#loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9,12,16,0.8);
  font-size: 13px;
  color: var(--text-muted);
  gap: 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#loading.visible { opacity: 1; pointer-events: all; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
