:root {
  --page: #fff7fb;
  --paper: #ffffff;
  --ink: #132034;
  --text: #253348;
  --muted: #687488;
  --line: #e5dfea;
  --line-strong: #d8cadb;
  --rose: #ff8fbc;
  --rose-soft: #ffe1ed;
  --mint: #79e4bc;
  --mint-soft: #dcfbef;
  --sky: #7fbdf7;
  --sky-soft: #e5f3ff;
  --lilac: #a99bff;
  --sun: #ffd874;
  --radius: 8px;
  --shadow: 0 18px 44px rgba(72, 52, 82, 0.13);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(135deg, rgba(255, 225, 237, 0.9), rgba(229, 243, 255, 0.88) 52%, rgba(220, 251, 239, 0.9)),
    var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, "Segoe UI", Arial, sans-serif;
}

body, button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select, input, textarea { color: inherit; }
button { cursor: pointer; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.studio-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  grid-template-rows: 64px 1fr;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 247, 251, 0.94);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 950;
  white-space: nowrap;
}

.spark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--rose), var(--sun));
  color: #321a32;
}

.topnav,
.account-strip,
.status-pills,
.quick-prompts,
.run-actions,
.result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topnav a,
.ghost {
  color: #6f6575;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius);
  padding: 8px 10px;
  font-weight: 850;
}

.topnav a.active,
.topnav a:hover {
  color: #7a2854;
  background: var(--rose-soft);
  border-color: rgba(255, 143, 188, 0.4);
}

.account-strip { margin-left: auto; }
.plan-pill {
  border: 1px solid rgba(121, 228, 188, 0.45);
  background: var(--mint-soft);
  color: #19684f;
  padding: 8px 11px;
  border-radius: var(--radius);
  font-weight: 900;
}

.avatar {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--sky), var(--lilac));
  color: #101f34;
  font-weight: 950;
}

.control-panel {
  grid-row: 2;
  height: calc(100vh - 64px);
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 16px;
}

.panel-head { margin: 0 0 12px; }

.eyebrow {
  margin: 0 0 6px;
  color: #9a4b79;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 950;
}

.panel-head h1,
.prompt-topline h2,
.run-card h2,
.results-head h2 {
  margin: 0;
  color: var(--ink);
  line-height: 1.05;
}

.panel-head h1 { font-size: 24px; }
.control-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(255, 250, 253, 0.86);
}

.control-section.compact { padding-bottom: 14px; }
.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--ink);
}

.section-label span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  background: var(--sky-soft);
  color: #29536f;
  font-size: 12px;
  font-weight: 950;
}

.section-label strong { font-size: 14px; }
label {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
  padding: 10px 11px;
  outline: 0;
}

textarea { min-height: 74px; resize: vertical; line-height: 1.45; }
select:focus,
input:focus,
textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(255, 143, 188, 0.16);
}

.media-toggle,
.size-grid {
  display: grid;
  gap: 7px;
}

.media-toggle { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.size-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.media-toggle button,
.size-grid button,
.quick-prompts button,
.result-actions button,
.secondary-action,
.upload-button,
.results-head button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: #675d70;
  padding: 8px 9px;
  font-size: 12px;
  font-weight: 900;
}

.media-toggle .selected,
.size-grid .selected {
  background: var(--rose-soft);
  border-color: rgba(255, 143, 188, 0.48);
  color: #7a2854;
}

.dimension-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.toggle-stack {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #45566d;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--rose);
}

.upload-button { width: 100%; border-style: dashed; background: rgba(255, 225, 237, 0.48); color: #7a2854; }
.sticky-create {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 14px -4px 0;
  border: 1px solid rgba(255, 143, 188, 0.38);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.sticky-create span,
.review-grid span,
.queue-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.sticky-create strong { display: block; margin-top: 3px; color: #7a2854; font-size: 20px; }
.sticky-create button,
.primary-action {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--rose), var(--sun));
  color: #321a32;
  padding: 10px 14px;
  font-weight: 950;
}

.workbench {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 18px;
  min-width: 0;
  overflow: auto;
}

.prompt-panel,
.run-card,
.queue-card,
.results-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.prompt-panel {
  grid-column: 1;
  grid-row: 1;
  align-self: start;
  padding: 16px;
}

.prompt-topline,
.results-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.prompt-topline h2,
.results-head h2 { font-size: 30px; }
.status-pills span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: #675d70;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 900;
}

.chat-row {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.assistant-note {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  border: 1px solid rgba(127, 189, 247, 0.38);
  border-radius: var(--radius);
  padding: 11px;
  background: var(--sky-soft);
  color: #31516b;
}

.assistant-note span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  background: var(--mint-soft);
  color: #19684f;
  font-weight: 950;
}

.assistant-note p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.prompt-box textarea {
  min-height: 124px;
  height: 100%;
  background: #ffffff;
  font-size: 15px;
}

.quick-prompts { margin-top: 12px; }
.quick-prompts button:hover,
.result-actions button:hover,
.secondary-action:hover,
.results-head button:hover {
  border-color: var(--rose);
  color: #7a2854;
}

.run-panel {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  gap: 14px;
  align-content: start;
}

.run-card,
.queue-card { padding: 15px; }
.run-card h2 { font-size: 24px; margin-bottom: 14px; }
.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.review-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fffafd;
}

.review-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 13px;
}

.run-actions { margin-top: 13px; }
.primary-action,
.secondary-action { flex: 1; }
.queue-card { display: grid; gap: 9px; }
.queue-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: #ffffff;
}

.queue-item span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--mint);
}

.queue-item strong {
  color: var(--ink);
  font-size: 13px;
}

.results-panel {
  grid-column: 1;
  grid-row: 2;
  padding: 16px;
}

.results-head h2 { margin-top: 0; }
.result-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.result-preview {
  position: relative;
  min-height: 185px;
  background:
    linear-gradient(180deg, rgba(19, 32, 52, 0.02), rgba(19, 32, 52, 0.62)),
    url("/assets/family-hero.png") center / 260% no-repeat;
}

.result-card.invite .result-preview { background-position: 18% 18%; }
.result-card.product .result-preview { background-position: 26% 72%; }
.result-card.classroom .result-preview { background-position: 58% 16%; }
.result-preview span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  border-radius: var(--radius);
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.88);
  color: #7a2854;
  font-size: 12px;
  font-weight: 950;
}

.result-meta {
  padding: 12px 12px 4px;
}

.result-meta strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
}

.result-meta p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.result-actions {
  padding: 10px 12px 12px;
}

@media (max-width: 1180px) {
  .studio-shell { grid-template-columns: 308px minmax(0, 1fr); }
  .workbench { grid-template-columns: 1fr; }
  .run-panel { grid-column: 1; grid-row: auto; grid-template-columns: 1fr 1fr; }
  .results-panel { grid-column: 1; grid-row: auto; }
}

@media (max-width: 900px) {
  .studio-shell {
    display: block;
    min-height: 100vh;
  }
  .topbar {
    position: relative;
    flex-wrap: wrap;
    min-height: 0;
    padding: 12px 14px;
  }
  .topnav { order: 3; width: 100%; overflow-x: auto; }
  .account-strip { margin-left: 0; }
  .control-panel {
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sticky-create { position: static; }
  .workbench { padding: 14px; }
  .chat-row,
  .run-panel,
  .result-strip { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .brand span { font-size: 18px; }
  .prompt-topline,
  .results-head { display: grid; }
  .prompt-topline h2,
  .results-head h2 { font-size: 25px; }
  .dimension-row,
  .review-grid { grid-template-columns: 1fr; }
  .size-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-preview { min-height: 220px; }
}
