/* ────────────────────────────────────────────────────────────────────────
   Studio — design room layout. Loaded after tokens.css + components.css,
   so it inherits --bg, --text, --accent, --display, --sans, --mono, etc.
   ──────────────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

/* ────────────────────────────────────────────────────────────────────────
   Light "Design Room" look and feel. The page remaps the global dark tokens
   to a soft, paper-white palette scoped to .studio-body, so the existing
   rules below pick it up. Flat fills only (no gradients), hairline borders,
   pastel agent tints, black pill primaries, stroke/flat single-color icons.
   ──────────────────────────────────────────────────────────────────────── */
body.studio-body {
  --bg:#ffffff;
  --bg2:#ffffff;
  --bg3:#f5f5f8;
  --bg4:#ececf2;
  --text:#17171c;
  --text2:#5b5b66;
  --text3:#9090a0;
  --accent:#6b5bd6;     /* violet: mentions, focus, links, hovers */
  --accent2:#5949c6;
  --border:#ededf2;     /* hairline */
  --border2:#e3e3ea;
  --radius:10px;
  --radius-lg:16px;
  --ink:#16161c;        /* black pill */
  --live:#1faa5b;       /* live-room green */
  --eyebrow:#6b5bd6;
}

body.studio-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.studio-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.studio-cube-mark {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: block;
}
.studio-home {
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}
.studio-home:hover { color: var(--text); }
.studio-h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.studio-project {
  color: var(--text3);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.studio-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.studio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: var(--bg3);
  color: var(--text2);
  font-family: var(--mono);
  text-transform: lowercase;
  user-select: none;
}
.studio-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text3);
}
.studio-pill[data-state="live"] { color: var(--live); }
.studio-pill[data-state="live"]::before {
  background: var(--live);
  box-shadow: 0 0 6px var(--live);
}
.studio-pill[data-state="paused"] { color: var(--star); }
.studio-pill[data-state="paused"]::before { background: var(--star); }
.studio-pill[data-state="connecting"]::before { animation: studio-pulse 1.4s infinite; }
@keyframes studio-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

.studio-btn {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--sans);
  transition: background .15s, color .15s, border-color .15s;
}
.studio-btn:hover {
  color: var(--text);
  border-color: var(--text3);
  background: var(--bg4);
}

/* ── Layout ─────────────────────────────────────────────────────────── */
.studio-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  min-height: 0;
}

.studio-room {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.studio-team-strip {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  overflow-x: auto;
  scrollbar-width: thin;
}
.team-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 999px;
  font-size: 12px;
  flex-shrink: 0;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.team-chip[data-thinking="true"] {
  border-color: transparent;
  box-shadow: 0 0 0 1.5px var(--accent);
}
.team-chip-avatar {
  width: 24px; height: 24px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 11px;
}
.team-chip-name { font-weight: 500; color: var(--text); }
.team-chip-role { color: var(--text3); font-size: 11px; }
.team-chip[data-thinking="true"] .team-chip-role::after {
  content: ' …thinking';
  color: var(--accent);
}

/* ── Messages ───────────────────────────────────────────────────────── */
.studio-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}
/* The cube + constellation hero stands in for the quiet room; it is toggled
   by JS and lives above the message stream. */
.studio-hero {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px 48px;
  gap: 4px;
}
.studio-hero[hidden],
.studio-messages[hidden],
.studio-team-strip[hidden] { display: none; }
.studio-orbit {
  position: relative;
  width: 300px;
  max-width: 78vw;
  aspect-ratio: 1;
  margin-bottom: 18px;
}
.studio-orbit-rings { position: absolute; inset: 0; width: 100%; height: 100%; }
.studio-orbit-rings circle { fill: none; stroke: var(--border2); stroke-width: 1; }
.studio-cube {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 34%;
}
.studio-cube svg { display: block; width: 100%; height: auto; }
.studio-constellation { position: absolute; inset: 0; }
.studio-node {
  position: absolute;
  top: 50%; left: 50%;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 14px;
  border: 1px solid var(--border2);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 6px 18px rgba(20, 18, 40, .06);
}
.studio-eyebrow {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--eyebrow);
}
.studio-hero-title {
  margin: 4px 0 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.studio-hero-tagline {
  margin: 12px 0 0;
  max-width: 320px;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.6;
}
.studio-msg {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  max-width: 760px;
  animation: studio-msg-in 0.25s ease-out;
}
@keyframes studio-msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.studio-msg-avatar {
  width: 36px; height: 36px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}
.studio-msg-body { min-width: 0; }
.studio-msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
  flex-wrap: wrap;
}
.studio-msg-name { font-weight: 600; color: var(--text); }
.studio-msg-role { color: var(--text3); }
.studio-msg-time {
  color: var(--text3);
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
}
.studio-msg-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.studio-msg-text .mention {
  color: var(--accent);
  font-weight: 500;
}

.studio-msg.boss .studio-msg-avatar {
  background: var(--text);
  color: var(--bg);
}
/* Distinguish the boss's directives with a flat surface, not italics. */
.studio-msg.boss .studio-msg-text {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}

/* ── Boss input ─────────────────────────────────────────────────────── */
.studio-say {
  display: flex;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.studio-say input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
}
.studio-say input:focus {
  outline: none;
  border-color: var(--accent);
}
.studio-say input { border-radius: 999px; }
.studio-say button {
  padding: 10px 20px;
  background: var(--ink);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  transition: opacity .15s;
}
.studio-say button:hover { background: var(--ink); opacity: .85; }

/* Read-only viewers (public) see a quiet note where the directing input sits,
   and an "Observing" tag in the topbar instead of the controls. */
.studio-watch-note {
  margin: 0;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text3);
  font-family: var(--sans);
  font-size: 13px;
  flex-shrink: 0;
}
.studio-readonly-tag {
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  font-family: var(--sans);
}

/* ── Artifacts ──────────────────────────────────────────────────────── */
.studio-artifacts-empty {
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
}
.studio-artifacts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.studio-art-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--sans);
  transition: border-color .15s;
}
.studio-art-card:hover { border-color: var(--accent); }
.studio-art-badge {
  align-self: flex-start;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: var(--mono, monospace);
}
.studio-art-badge[data-type="build"]    { color: #a0e0b8; border-color: #a0e0b8; }
.studio-art-badge[data-type="design"]   { color: #c4a0e8; border-color: #c4a0e8; }
.studio-art-badge[data-type="research"] { color: #9ab8e0; border-color: #9ab8e0; }
.studio-art-badge[data-type="critique"] { color: #e0a0a0; border-color: #e0a0a0; }
.studio-art-badge[data-type="strategy"] { color: #e8d4a0; border-color: #e8d4a0; }
.studio-art-badge[data-type="direction"]{ color: #e8b4a0; border-color: #e8b4a0; }
.studio-art-card-title { font-size: 14px; color: var(--text); font-weight: 600; }
.studio-art-card-summary { font-size: 12px; color: var(--text2); line-height: 1.5; }
.studio-art-card-author { font-size: 11px; color: var(--text3); }

/* Artifact viewer modal */
.studio-art-modal {
  width: min(960px, 92vw);
  max-height: 88vh;
  padding: 0;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg2);
  color: var(--text);
  overflow: hidden;
}
.studio-art-modal::backdrop { background: rgba(0, 0, 0, .6); }
.studio-art-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.studio-art-modal-meta h2 { margin: 8px 0 4px; font-size: 18px; }
.studio-art-modal-meta p { margin: 0; font-size: 12px; }
.studio-art-modal-actions { display: flex; gap: 8px; flex-shrink: 0; }
.studio-art-modal-body {
  padding: 0;
  max-height: calc(88vh - 80px);
  overflow: auto;
  background: var(--bg);
}
.studio-art-frame {
  display: block;
  width: 100%;
  height: 70vh;
  border: 0;
  background: #fff;
}
.studio-art-code {
  margin: 0;
  padding: 18px 20px;
  font-family: var(--mono, monospace);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text2);
}
.studio-art-doc { padding: 20px 24px; font-family: var(--sans); }
.studio-art-doc h3 { font-size: 16px; margin: 18px 0 8px; }
.studio-art-doc h4 { font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--text2); margin: 18px 0 8px; }
.studio-art-doc p { font-size: 14px; line-height: 1.7; color: var(--text); margin: 0 0 10px; }
.studio-art-doc ul, .studio-art-sources { margin: 0 0 12px; padding-left: 20px; }
.studio-art-doc li { font-size: 14px; line-height: 1.7; color: var(--text); margin-bottom: 4px; }
.studio-art-sources { padding: 0 24px 20px 44px; }
.studio-art-sources a { color: var(--accent); word-break: break-word; }

/* ── Side panel ─────────────────────────────────────────────────────── */
.studio-side {
  display: flex;
  flex-direction: column;
  background: var(--bg2);
  overflow-y: auto;
  min-height: 0;
}
.studio-card {
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
}
.studio-card h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
}
.studio-card .muted, .muted {
  color: var(--text3);
  font-size: 13px;
}
.studio-brief-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: var(--text);
}

.studio-team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.studio-team-list li {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.studio-team-list .team-avatar {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
}
.studio-team-list .team-role {
  color: var(--text3);
  font-size: 11px;
}
.studio-team-list .team-nudge {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text3);
  border-radius: var(--radius);
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
  font-family: var(--sans);
  letter-spacing: 0.04em;
}
.studio-team-list .team-nudge:hover {
  color: var(--text);
  border-color: var(--text3);
}

/* ── Brief dialog ───────────────────────────────────────────────────── */
.studio-dialog {
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  background: var(--bg2);
  color: var(--text);
  padding: 24px;
  max-width: 480px;
  width: 90vw;
}
.studio-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.studio-dialog h2 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: 16px;
}
.studio-dialog label {
  display: block;
  margin-bottom: 14px;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}
.studio-dialog input,
.studio-dialog textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  resize: vertical;
  text-transform: none;
  letter-spacing: 0;
}
.studio-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.studio-dialog-actions button {
  padding: 8px 14px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg3);
  color: var(--text);
  font-family: var(--sans);
  cursor: pointer;
  font-size: 13px;
}
.studio-dialog-actions button[value="ok"] {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
  font-weight: 600;
  border-radius: 999px;
}
.studio-dialog-actions button[value="cancel"] { border-radius: 999px; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  body.studio-body { height: auto; overflow: auto; }
  .studio-grid { grid-template-columns: 1fr; }
  .studio-room { border-right: 0; border-bottom: 1px solid var(--border); }
  .studio-messages { max-height: 60vh; }
}

/* Phones: the topbar must wrap instead of letting the controls overlap the
   title, and the room chrome tightens up. */
@media (max-width: 640px) {
  .studio-topbar {
    flex-wrap: wrap;
    padding: 10px 16px;
    row-gap: 10px;
  }
  .studio-brand { width: 100%; gap: 12px; }
  .studio-controls { width: 100%; }
  .studio-h1 { font-size: 15px; }
  .studio-messages {
    padding: 16px 16px 22px;
    max-height: 52vh;
    min-height: 220px;
  }
  .studio-team-strip { padding: 12px 16px; }
  .studio-say,
  .studio-watch-note { padding: 14px 16px; }
  .studio-card { padding: 16px; }
  .studio-msg { grid-template-columns: 30px 1fr; gap: 10px; }
  .studio-msg-avatar { width: 30px; height: 30px; font-size: 13px; }

  .studio-art-modal { width: 100vw; max-height: 92vh; border-radius: 0; }
  .studio-art-modal-head { flex-direction: column; gap: 10px; padding: 14px 16px; }
  .studio-art-modal-actions { width: 100%; }
  .studio-art-modal-actions .studio-btn { flex: 1; }
  .studio-art-frame { height: 64vh; }
}
