@font-face { font-family: 'Space Grotesk'; src: url('fonts/SpaceGrotesk-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('fonts/SpaceGrotesk-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('fonts/JetBrainsMono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }

/* HOAI "Studio" surface */
:root {
  --canvas: #1A1D31; --deep: #131726; --panel: #0E121F; --well: #070C16; --line: #2C3245;
  --ink: #F2F2F2; --muted: #9FB4C6; --green: #17BB66; --blue: #2E8AE3; --purple: #B55CDE; --orange: #F28523;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 500 15px/1.45 'Space Grotesk', system-ui, sans-serif; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h2 { font-size: 18px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--deep); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; display: flex; gap: 10px; align-items: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.top-right { display: flex; gap: 12px; align-items: center; }
main { max-width: 1500px; margin: 0 auto; padding: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.narrow { max-width: 380px; margin: 60px auto; }
.step { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.step span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--purple); color: #060606; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.error { color: var(--orange); min-height: 1.2em; }
button, .file { font: inherit; font-weight: 700; background: var(--green); color: #060606; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button:disabled { opacity: 0.45; cursor: progress; }
button.ghost, .file { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.small { padding: 4px 10px; font-size: 13px; }
.file { display: inline-block; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file:focus-within { outline: 2px solid var(--purple); }
input, select { font: inherit; background: var(--well); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
input[type=range] { width: 100%; padding: 0; accent-color: var(--green); }
label { display: block; margin: 8px 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; }
#login-form input { width: 100%; margin-bottom: 12px; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* runs and concept cards */
.run { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.run:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.run-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { background: var(--deep); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.card.chosen { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.role { font: 400 12px 'JetBrains Mono', monospace; color: var(--purple); }
.card .idea { font-size: 13px; color: #D8DEE6; }
.card details { font-size: 12px; color: var(--muted); }
.card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: var(--well); cursor: pointer; }
.thumb { position: relative; }
.thumb .ph { aspect-ratio: 16 / 9; border-radius: 6px; background: repeating-linear-gradient(45deg, var(--well), var(--well) 10px, var(--deep) 10px, var(--deep) 20px); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font: 400 11px 'JetBrains Mono', monospace; padding: 2px 6px; border-radius: 4px; background: var(--well); border: 1px solid var(--line); }
.badge.ok { color: var(--green); border-color: #1d5c3c; }
.badge.warn { color: var(--orange); border-color: #6b4318; }
.versions { display: flex; gap: 6px; flex-wrap: wrap; }
.versions button { padding: 2px 8px; font-size: 12px; }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.stage canvas#canvas { width: 100%; height: auto; display: block; border-radius: 8px; touch-action: none; background: var(--well); }
.previews { display: flex; gap: 16px; margin-top: 12px; align-items: flex-end; flex-wrap: wrap; }
.previews figure { margin: 0; }
.previews canvas { display: block; border-radius: 4px; }
#pv320 { width: 320px; height: 180px; }
#pv170 { width: 170px; height: 96px; }
figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.controls .group { border-bottom: 1px solid var(--line); padding: 10px 0; }
.controls .group:first-child { padding-top: 0; }
.controls .group > button { width: 100%; margin-top: 6px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border-radius: 0; background: transparent; color: var(--ink); }
.seg button[aria-pressed=true] { background: var(--purple); color: #060606; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photos button { padding: 0; background: none; border: 2px solid transparent; border-radius: 6px; }
.photos button[aria-pressed=true] { border-color: var(--green); }
.photos img { display: block; height: 64px; border-radius: 4px; }
.status { position: sticky; bottom: 0; margin: 0; padding: 8px 12px; background: var(--deep); border-top: 1px solid var(--line); min-height: 1.4em; font-size: 14px; }
.status:empty { display: none; }

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  main { padding: 16px; }
}
