/* Brand tokens — kept in sync with the main site's styles.css (:root),
   not a shared import (separate Hosting target, separate static tree,
   same convention as every other copied-not-shared file in this repo).
   If the main site's palette/fonts ever change, update this file (and
   scratch-site/create-site/styles.css) to match. */
:root {
  --blue:        #2E6BE6;
  --blue-deep:   #2A3FB8;
  --blue-700:    #214FB0;
  --orange:      #F7931E;
  --ink:         #1B2333;
  --body-color:  #5A6172;
  --muted:       #8a93a5;
  --line:        #E4EAF1;
  --bg:          #F4F8FC;
  --surface:     #FFFFFF;
  --sky-2:       #EAF7FD;
  --green:       #16A34A;

  --r-sm:   10px;
  --r-md:   16px;
  --r-pill: 999px;

  --shadow-sm: 0 4px 14px -8px rgba(27,35,51,.22);

  --font-display: 'Poppins', system-ui, sans-serif;
  --font-body:    'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}
body.center-layout {
  display: flex;
  align-items: center;
  justify-content: center;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}
.brand-logo { display: flex; justify-content: center; margin-bottom: 16px; }
.brand-logo img { height: 48px; width: auto; }
.card h1 { font-family: var(--font-display); font-size: 20px; margin: 0 0 20px; text-align: center; color: var(--blue-deep); font-weight: 700; }
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.form-row label { font-weight: 700; font-size: 13px; line-height: 1.5; padding-top: 2px; }
.form-row input, .form-row textarea {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 14px;
}
.form-row textarea { resize: vertical; min-height: 110px; }
.form-row small { color: var(--muted); font-size: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--r-pill);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 20px -10px rgba(46,107,230,.5);
  transition: transform .18s, filter .18s;
}
.btn:hover { background: var(--blue-700); transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ghost { background: #fff; color: var(--blue-deep); border: 2px solid var(--blue); }
.btn-ghost:hover { background: var(--sky-2); }
.msg { padding: 10px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 14px; }
.msg-error { background: #fee2e2; color: #991b1b; }
.msg-success { background: #dcfce7; color: #166534; }
.signout-link { text-align: center; margin-top: 14px; font-size: 12px; }
.signout-link a { color: var(--muted); }
[hidden] { display: none !important; }

.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  margin: 2px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
  max-height: 180px;
  overflow-y: auto;
}
.autocomplete-list li {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.autocomplete-list li:hover,
.autocomplete-list li.active { background: var(--bg); }

/* ── Editor page header/nav — same shape as create-site's studio-header/
   studio-nav, renamed since this isn't a multi-page "studio" ──────── */
.editor-main {
  max-width: 1300px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.editor-header__brand { display: flex; align-items: center; gap: 10px; }
.editor-header__brand img { height: 32px; width: auto; }
.editor-header h1 { font-family: var(--font-display); font-size: 18px; margin: 0; color: var(--blue-deep); font-weight: 700; }
.editor-header .who { color: var(--muted); font-size: 13px; }
.editor-nav { display: flex; gap: 14px; font-size: 13px; margin-bottom: 14px; }
.editor-nav a { color: var(--muted); font-weight: 600; }

/* ── Two-panel layout — code on the left, canvas+console stacked on the
   right. Side-by-side on a real screen; stacked (code first) on narrow
   phones, since typing code needs real width more than the output does. */
.editor-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}
@media (max-width: 860px) {
  .editor-panes { grid-template-columns: 1fr; }
}
.pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pane__label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.pane-left { min-height: 420px; }
/* CodeMirror fills its mount div; the mount div fills the pane below
   the label. flex:1 on the CM wrapper (set via JS after init, since
   CodeMirror creates its own .CodeMirror element) is what makes it
   stretch instead of defaulting to its built-in 300px height. */
#codeMount { flex: 1; display: flex; }
#codeMount .CodeMirror { flex: 1; height: auto; font-size: 15px; }

.pane-right { display: flex; flex-direction: column; }
.canvas-wrap {
  flex: 1 1 55%;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow: auto;
}
.canvas-wrap canvas { display: block; }
.canvas-placeholder { color: var(--muted); font-size: 13px; text-align: center; padding: 20px; }
.console-wrap { flex: 1 1 45%; min-height: 140px; display: flex; flex-direction: column; }
#consoleOutput {
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  background: #1b2333;
  color: #e5e9f0;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
#consoleOutput .err-line { color: #ff9b9b; }

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.editor-toolbar .btn, .editor-toolbar .btn-ghost { width: auto; padding: 10px 20px; }
.btn-run { background: var(--green); box-shadow: 0 10px 20px -10px rgba(22,163,74,.5); }
.btn-run:hover { background: #128038; }
.save-status { font-size: 12px; color: var(--muted); margin-left: auto; }
