:root {
  --bg: #0b0d10;
  --panel: #0f1318;
  --panel2: #0b0f14;
  --text: #e6edf3;
  --muted: #9aa6b2;
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.12);
  --accent: #4aa3ff;
  --danger: #ff5c5c;
  --radius: 1px;
  --grid: 4px;
  --btn-h: 32px;
  --brand-gold: #ffcc00;
  --brand-orange: #ff6a00;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  /* API / billing / admin: one place to change the content column width */
  --app-page-max-width: 1440px;
  /* Dot grid: applied only on diffui-content .content (see components/diffui-content.js) */
  --canvas-dot-grid-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  --canvas-dot-grid-size: 16px 16px;
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0.2px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body[data-has-app-nav="true"] {
  padding-top: 44px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border2) var(--panel2);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--panel2);
}

*::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 999px;
  border: 2px solid var(--panel2);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

*::-webkit-scrollbar-corner {
  background: var(--panel2);
}

#content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: 12px;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.headerLeft {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brandLogo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
}

.brandLogo svg {
  display: block;
}

.brandTitle {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.brandTitleHeavy {
  font-weight: 900;
}

.tabs {
  display: flex;
  gap: 4px;
}

.creatorTabs {
  display: flex;
  gap: 4px;
  margin: 0 0 12px 0;
}

.tab {
  height: var(--btn-h);
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  border-color: var(--border2);
  background: var(--panel);
}

.panelTitle {
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 calc(var(--grid) * 2) 0;
}

#pagesSidebar {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
  position: relative;
}

.pagesSidebarFooter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 12px;
  margin: -12px;
  display: flex;
  justify-content: flex-end;
  box-sizing: border-box;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: calc(var(--grid) * 3);
}

.field:last-child {
  margin-bottom: 0;
}

/* [hidden] loses to .field { display: flex } without this (same idea as .sidebarPanel[hidden]). */
.field[hidden] {
  display: none !important;
}

.label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

textarea {
  min-height: 78px;
  resize: vertical;
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  outline: none;
}

textarea:focus,
textarea:focus-visible {
  outline: 1px solid var(--brand-gold);
  outline-offset: 2px;
  border-radius: 0;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.contentHeader {
  gap: 6px;
  flex-wrap: nowrap;
}

.statusStack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.backBtn {
  width: 22px;
  height: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.backBtn[data-visible="true"] {
  display: inline-flex;
}

.btn {
  height: var(--btn-h);
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
}

.btn.primary {
  border-color: rgba(74,163,255,0.35);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle {
  display: flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.toggle button {
  height: var(--btn-h);
  padding: 0 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}

.toggle button[data-on="true"] {
  background: var(--panel);
  color: var(--text);
}

.drop {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  font-size: 11px;
}

.dropHint {
  display: block;
}

.dropHint[hidden] {
  display: none;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.thumbs .note {
  grid-column: 1 / -1;
}

.styleRefThumb {
  position: relative;
  border-radius: var(--radius);
}

.styleRefThumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--page-ratio, 3 / 4);
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #000;
  transition: opacity 0.18s ease;
}

.styleRefThumbStatus {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  z-index: 2;
  box-sizing: border-box;
  background: none;
  border: none;
  border-radius: 0;
}

/* 24×24 slot; 16×16 ring centered via ::before */
.styleRefThumbSpinner {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.styleRefThumbSpinner::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 2px solid var(--border2);
  border-top-color: rgba(188, 155, 48, 0.9);
  border-radius: 50%;
  animation: diffuiBuildSpin 0.7s linear infinite;
}

.styleRefThumbCheck {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  margin: 0;
  padding: 4px;
  pointer-events: none;
}

.styleRefThumbCheck svg {
  display: block;
  width: 16px;
  height: 16px;
}

.styleRefThumbRemove {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  margin: 0;
  padding: 4px;
  border: none;
  border-radius: 0;
  background: none;
  cursor: pointer;
}

.styleRefThumbRemove svg {
  display: block;
  width: 16px;
  height: 16px;
}

.styleRefThumb[data-busy="true"] .styleRefThumbSpinner {
  display: block;
}

.styleRefThumb[data-ready="true"] .styleRefThumbCheck {
  display: block;
}

.styleRefThumbStatus:hover .styleRefThumbSpinner,
.styleRefThumbStatus:hover .styleRefThumbCheck {
  display: none !important;
}

.styleRefThumbStatus:hover .styleRefThumbRemove {
  display: block;
}

.styleRefThumb[data-idle="true"] .styleRefThumbStatus {
  opacity: 0.45;
}

.styleRefThumb[data-idle="true"]:hover .styleRefThumbStatus {
  opacity: 1;
}

.note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.contextMenu {
  position: fixed;
  min-width: 180px;
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 6px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 2000;
  display: none;
}

.contextMenu[data-open="true"] {
  display: block;
}

.contextMenuItem {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text);
  text-align: left;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}

.contextMenuItem:hover {
  background: rgba(255, 255, 255, 0.06);
}

.contextMenuItem[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.contextMenuDivider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}


#content[data-orientation="portrait"] {
  --option-ratio: 3 / 4;
}

#content[data-orientation="landscape"] {
  --option-ratio: 4 / 3;
}

.grid {
  display: grid;
  height: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 0 0 auto;
  min-height: 0;
}

.gridWrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.card {
  border: 0;
  padding: 0;
  border-radius: var(--radius);
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  aspect-ratio: var(--option-ratio, 3 / 4);
  transition: background-color 0.2s ease-in-out;
}

.card[data-selected="true"] {
  outline: 1px solid rgba(74,163,255,0.6);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  aspect-ratio: var(--option-ratio, 3 / 4);
  display: block;
  background: transparent;
}

.pagesCanvasShell {
  position: relative;
  flex: 1;
  min-height: 0;
}

.pagesCanvasScroller {
  position: relative;
  height: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.pagesCanvas {
  display: flex;
  gap: 24px;
  align-items: stretch;
  height: 100%;
  width: max-content;
  padding-top: 16px;
  padding-right: 24px;
  padding-bottom: 12px;
}

.pageColumn,
.optionsColumn {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}

.pageColumn,
.pageAddColumn {
  position: relative;
}

.codeColumn {
  overflow: hidden;
  width: 0;
  transition: width 220ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .codeColumn {
    transition: none;
  }
}


.pageFrame {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
  height: 100%;
  flex: 1;
  aspect-ratio: var(--page-ratio, 3 / 4);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.pageImage {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.optionsGrid {
  display: grid;
  grid-template-columns: repeat(var(--option-cols, 3), minmax(0, 1fr));
  grid-template-rows: repeat(var(--option-rows, 3), minmax(0, 1fr));
  gap: 8px;
  height: 100%;
  flex: 1;
}

.buildHeaderRow {
  justify-content: space-between;
  align-items: center;
}

.buildActions {
  margin-top: 10px;
}

.buildSectionTitle {
  margin-top: 16px;
}

.buildErrorNotice {
  color: #fecaca;
  background: rgba(127, 29, 29, 0.35);
  border: 1px solid rgba(248, 113, 113, 0.45);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 10px;
}

.buildThumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.buildThumbCard {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.buildThumbImage {
  height: 100px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
}

.buildThumbLabel {
  max-width: 140px;
}

.buildPre {
  white-space: pre-wrap;
}

.buildStreamLabel {
  margin-top: 6px;
}

.buildDownload {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-top: 12px;
}

.projectTitle.buildSidebarProjectTitle {
  margin-top: 0;
  margin-bottom: calc(var(--grid) * 2);
}

.projectTitle.buildSidebarProjectTitle + .buildSidebarTitle {
  margin-top: 0;
}

.buildSidebarTitle {
  margin-top: 12px;
}

.buildSidebarFiles {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.buildSidebarFilesEmpty {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
}

.buildSidebarItem {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.buildSidebarItem[data-selected="true"] {
  background: var(--panel);
  border-color: var(--border);
}

.buildSidebarFolder {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 8px;
  padding-left: calc(var(--build-indent, 0) * 12px);
}

.buildSidebarFile {
  font-size: 12px;
  padding-left: calc(var(--build-indent, 0) * 12px + 8px);
}

.buildFileContent {
  overflow: auto;
  min-height: 0;
}

.buildFileContentSolo {
  flex: 1;
  max-height: none;
  margin: 0;
}

.buildSidebarPage {
  font-size: 12px;
  padding: 8px 12px;
}

@keyframes diffuiBuildSpin {
  to { transform: rotate(360deg); }
}

.buildSidebarSpinner {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border2);
  border-top-color: rgba(188, 155, 48, 0.9);
  border-radius: 50%;
  animation: diffuiBuildSpin 0.7s linear infinite;
}

.buildSidebarCheck {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.buildSidebarCheck svg {
  display: block;
  width: 16px;
  height: 16px;
}

.buildSidebarPageStatus {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.buildSidebarItem[data-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.dsShell {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 4px;
}

.dsSection {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dsSectionTitle {
  margin: 0;
  font-size: 13px;
}

.dsGrid {
  display: grid;
  gap: 16px;
}

.dsComponentsGrid {
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.dsColorsGrid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.dsEmpty {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.dsCard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.dsCardHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dsCardTitle {
  font-weight: 600;
  font-size: 13px;
}

.dsCardDesc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
}

.dsStatusChip {
  flex-shrink: 0;
}

.dsPreviewTile {
  width: 600px;
  max-width: 100%;
  height: 300px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0b111a;
  position: relative;
}

.dsPreviewViewport {
  width: 600px;
  height: 300px;
  display: block;
}

.dsPreviewFrame {
  display: block;
  border: 0;
  width: 600px;
  height: 300px;
  background: transparent;
}

.dsPreviewPlaceholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
}

.dsSwatch {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.dsSwatchChip {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: #444;
}

.dsSwatchMeta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dsSwatchName {
  font-size: 12px;
  font-weight: 600;
}

.dsSwatchHex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  margin: 0;
}

.dsSwatchUsage {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  margin: 0;
}

.buildPageSplit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  height: calc(100vh - 200px);
  min-height: 400px;
}

.buildPageCode {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.buildPageCode diffui-code-page {
  flex: 1;
  height: 100%;
}

.buildPagePreview {
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
}

.buildPagePreview diffui-page {
  flex: 1;
  height: 100%;
}

.buildPreviewImage {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.buildPreviewViewport {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.buildPreviewStage {
  position: relative;
  transform-origin: top left;
}

.buildPreviewFrame {
  display: block;
  border: 0;
  background: #fff;
}

.optionCard {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  overflow: hidden;
  cursor: pointer;
  display: grid;
  place-items: center;
  aspect-ratio: var(--option-ratio, 3 / 4);
  transition: background-color 0.2s ease-in-out;
}

.optionCard[data-selected="true"] {
  outline: 1px solid rgba(74,163,255,0.6);
}

.optionCard img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  aspect-ratio: var(--option-ratio, 3 / 4);
  display: block;
  background: transparent;
}

.skeletonCard {
  background: #161c23;
  border: 1px solid var(--border);
  transition: background-color 0.4s ease-in-out;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.skeletonCard[data-highlight="true"] {
  background: #2a3340;
}

.pagesListTitleSkeleton {
  display: block;
  height: 11px;
  width: min(100%, 132px);
  max-width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  animation: pagesListTitleSkeletonPulse 1.1s ease-in-out infinite;
}

@keyframes pagesListTitleSkeletonPulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.cardMeta {
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.focusShell {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: calc(var(--grid) * 3);
  height: 100%;
}

.focusTop {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: calc(var(--grid) * 3);
  min-height: 0;
}

.focusImage {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-y: auto;
  background: #000;
  display: grid;
  place-items: center;
}

.focusImage img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.focusActions {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel2);
  padding: calc(var(--grid) * 3);
  display: flex;
  flex-direction: column;
  gap: calc(var(--grid) * 2);
  min-width: 0;
}

.filmstrip {
  display: flex;
  gap: 6px;
  overflow: auto;
  padding: 8px 0;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 2;
}

.filmstrip img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: #000;
}

.filmstrip img[data-selected="true"] {
  outline: 1px solid rgba(74,163,255,0.6);
}

.modalTitle {
  font-size: 12px;
  color: var(--text);
}

.modalActions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.brandShareAuthLegal a {
  color: var(--brand-gold);
}
.brandShareAuthLegal a:hover {
  text-decoration: underline;
}

.editPageBody {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: calc(var(--grid) * 3);
  align-items: start;
}

.editPageThumb {
  width: 140px;
  aspect-ratio: 9 / 16;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--panel2, #0a0a0a);
  overflow: hidden;
  display: block;
  flex: 0 0 auto;
}

.editPageThumb[data-orientation="landscape"] {
  aspect-ratio: 16 / 9;
  width: 220px;
}

.editPageThumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.editPageThumb img:not([src]),
.editPageThumb img[src=""] {
  display: none;
}

#editPageInput {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  box-sizing: border-box;
}

diffui-modal:not(:defined) {
  display: none;
}

.qa {
  display: grid;
  gap: calc(var(--grid) * 3);
  margin-top: calc(var(--grid) * 3);
}

.qCard {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  padding: calc(var(--grid) * 3);
  display: grid;
  gap: calc(var(--grid) * 2);
}

.qTitle {
  font-size: 12px;
  color: var(--text);
}

.qOpts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.optBtn {
  height: var(--btn-h);
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}

.optBtn[data-on="true"] {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border2);
}

/* App view containers */
#appNav {
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--bg);
}

.viewContainer {
  padding: calc(var(--grid) * 4);
  max-width: 960px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
}

.viewContainer--full {
  padding: 0;
  max-width: none;
  margin: 0;
}

.viewContainer--full diffui-shell {
  height: 100%;
}

#brandsView:not(.hidden) {
  display: flex;
  flex-direction: column;
  --canvas-dot-grid-image: none;
  background: var(--bg);
}

#brandsView > diffui-content {
  flex: 1;
  min-height: 0;
}

#wizardView:not(.hidden) {
  display: flex;
  flex-direction: column;
}

#wizardView diffui-wizard {
  flex: 1;
  min-height: 0;
  display: flex;
}

.viewContainer.hidden {
  display: none !important;
}

#authView:not(.hidden) {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px calc(var(--grid) * 4);
  min-height: 100vh;
  box-sizing: border-box;
}

.authViewForeground {
  position: relative;
  z-index: 1;
}

/* API, billing, admin, generations list, generation settings: centered column (--app-page-max-width) */
.viewContainer--appPanel {
  padding: 0;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.appPanelCanvas {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: var(--bg);
}

.appPanelColumn {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--app-page-max-width);
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: calc(var(--grid) * 4);
}

.visuallyHidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebarColumn {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
}

.sidebarPanel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* [hidden] alone loses to .sidebarPanel { display: flex } (equal specificity, later rule). */
.sidebarPanel[hidden] {
  display: none !important;
}

.projectTitle {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: calc(var(--grid) * 2);
  line-height: 1.3;
  word-break: break-word;
}

.pagesListBody {
  flex: 1;
  min-height: 48px;
  overflow: auto;
}

#pagesList .pagesListPageTitle {
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  min-width: 0;
}

#pagesList .pagesListRowMeta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#pagesList .pagesListStyleRefToggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  color: var(--muted);
  transform: translateX(2px);
  cursor: pointer;
  border-radius: var(--radius);
  padding: 2px;
  outline: none;
}

#pagesList .pagesListStyleRefToggle .pagesListStyleRefIconSvg {
  display: block;
}

/* Inactive: hidden until row hover; 20% on row hover, full on control hover */
#pagesList .pagesListStyleRefToggle[data-style-ref-active="false"] {
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease;
}

#pagesList .pagesListPageRow:hover .pagesListStyleRefToggle[data-style-ref-active="false"] {
  opacity: 0.2;
}

#pagesList .pagesListStyleRefToggle[data-style-ref-active="false"]:hover {
  opacity: 1;
}

/* Active style ref: always visible; gold on hover */
#pagesList .pagesListStyleRefToggle[data-style-ref-active="true"] {
  opacity: 1;
  transition: color 0.12s ease;
}

#pagesList .pagesListStyleRefToggle[data-style-ref-active="true"]:hover {
  color: var(--brand-gold, #ffcc00);
}

.sidebarStyleRefLabel {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebarStyleRefLabelIcon {
  display: inline-flex;
  line-height: 0;
  color: var(--muted);
  flex-shrink: 0;
}

.sidebarStyleRefLabelIcon svg {
  display: block;
}

#pagesList .btn {
  color: var(--text);
}

#pagesList .pagesListNewPageBtn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  height: var(--btn-h);
  margin: 0;
  padding: 0 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

#pagesList .pagesListNewPageBtn:hover {
  border-color: rgba(255, 106, 0, 0.35);
  background: var(--panel);
}

#pagesList .pagesListNewPageBtn:hover .pagesListNewPageLabel {
  opacity: 1;
}

#pagesList .pagesListNewPageBtn:hover .pagesListNewPageIconSvg {
  opacity: 0.9;
}

#pagesList .pagesListNewPageLabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--brand-gold);
  opacity: 0.7;
}

#pagesList .pagesListNewPageIcon {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  line-height: 0;
}

#pagesList .pagesListNewPageIconSvg {
  display: block;
  flex-shrink: 0;
  color: var(--brand-gold);
  opacity: 0.6;
}

.sidebarBottom {
  margin-top: auto;
  padding-top: calc(var(--grid) * 3);
  border-top: 1px solid var(--border);
}

.settingsInput,
.settingsTextarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  resize: vertical;
}

.codePanelScroll {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 11px;
  line-height: 1.45;
}

.workspacePanel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

#workspaceCode.workspacePanel {
  overflow: hidden;
}

.workspacePanel[hidden] {
  display: none !important;
}

.workspaceSettingsPanel.workspacePanel {
  overflow: hidden;
}

.codeWorkspaceInner {
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: calc(var(--grid) * 1);
  min-height: 0;
}

.panelTitleSpaced {
  margin-top: calc(var(--grid) * 3);
}

.rowSpaced {
  margin-top: calc(var(--grid) * 2);
}

.codePagesToBuild {
  min-height: 0;
}

.codeBuildDynamicArea {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.codeBuildActions {
  margin-top: auto;
  padding-top: calc(var(--grid) * 2);
  border-top: 1px solid var(--border);
}

.sidebarPanelCodeFiles {
  min-height: 0;
}

.buildWorkspace {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

.buildFileSidebar {
  border-right: 1px solid var(--border);
  background: var(--panel2);
  overflow: auto;
  padding: calc(var(--grid) * 2);
  min-width: 0;
}

.buildFileSidebar.codeBuildFilesSidebar {
  flex: 1;
  min-height: 120px;
  border: none;
  padding: 0;
  background: transparent;
}

.buildWorkspaceMain {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.generationsLayout {
  width: 100%;
}

.projectActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(var(--grid) * 6);
  margin-bottom: calc(var(--grid) * 5);
}

.projectActionCard {
  position: relative;
  --project-action-outline: rgba(255, 255, 255, 0.2);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: calc(var(--grid) * 5);
  min-height: 96px;
  padding: calc(var(--grid) * 6) calc(var(--grid) * 7);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--panel2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.projectActionCard:hover,
.projectActionCard:focus-visible {
  --project-action-outline: rgba(255, 204, 0, 0.7);
  outline: none;
}

.projectActionCard::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to right, var(--project-action-outline) 0 6px, transparent 6px 10px) top left / 100% 1px no-repeat,
    repeating-linear-gradient(to right, var(--project-action-outline) 0 6px, transparent 6px 10px) bottom left / 100% 1px no-repeat,
    repeating-linear-gradient(to bottom, var(--project-action-outline) 0 6px, transparent 6px 10px) top left / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--project-action-outline) 0 6px, transparent 6px 10px) top right / 1px 100% no-repeat;
}

.projectActionCard--canvas {
  background:
    linear-gradient(90deg, rgba(255, 106, 0, 0.06), rgba(255, 204, 0, 0.03)),
    var(--panel2);
}

.projectActionIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  color: var(--text);
  flex-shrink: 0;
}

.projectActionIcon--canvas,
.projectActionCard--canvas .projectActionArrow,
.projectActionCard--canvas .projectActionTitle {
  color: var(--brand-gold);
}

.projectActionIcon svg {
  display: block;
  width: 44px;
  height: auto;
}

.projectActionCopy {
  display: flex;
  flex-direction: column;
  gap: calc(var(--grid) * 1);
  min-width: 0;
}

.projectActionTitle {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.projectActionDescription {
  max-width: 460px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.projectActionArrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}

.projectActionArrow svg {
  display: block;
}

.generationsHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: calc(var(--grid) * 2);
}

.pageTitle {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.generationsToolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: calc(var(--grid) * 4);
  flex-wrap: wrap;
}

.generationsSearchWrap {
  flex: 1;
  min-width: 160px;
  max-width: 360px;
}

.generationsSearchInput {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel2);
  color: var(--text);
  font-size: 12px;
  outline: none;
}

.generationsSearchInput:focus {
  border-color: rgba(188, 155, 48, 0.75);
}

.generationsSearchInput::placeholder {
  color: var(--muted);
}

.creationsViewToggle {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.creationsViewToggleBtn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 1px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creationsViewToggleBtn:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--panel);
}

.creationsViewToggleBtn[data-active="true"] {
  color: #bc9b30;
  border-color: var(--border2);
  background: linear-gradient(90deg, rgba(255, 106, 0, 0.2) 0%, rgba(255, 204, 0, 0.2) 100%);
}

.creationsViewToggleBtn svg {
  display: block;
  width: 24px;
  height: 24px;
}

.generationsList {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.creationListHeader {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(84px, 120px) 56px;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.creationListHeaderCell--built {
  text-align: center;
}

.creationListRow {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(84px, 120px) 56px;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: center;
  padding: 8px 14px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
  box-sizing: border-box;
}

.creationListRow:last-child {
  border-bottom: 0;
}

.creationListRow:nth-child(2n + 3) {
  background: rgba(255, 255, 255, 0.03);
}

.creationListRow:hover {
  background: rgba(255, 255, 255, 0.06);
}

.creationListTitle {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creationListPages {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.creationListPageThumb {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--panel2);
  overflow: hidden;
}

.creationListPageThumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creationListType {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--muted);
}

.creationListBuilt {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.creationListBuilt svg {
  display: block;
}

.generationsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: calc(var(--grid) * 4);
}

/* [hidden] loses to display:* rules on these classes (same idea as .sidebarPanel[hidden]). */
.generationsGrid[hidden],
.generationsList[hidden],
.generationCard[hidden],
.creationListRow[hidden] {
  display: none !important;
}

.generationCard {
  width: 500px;
  max-width: 100%;
  height: 200px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
}

.generationCard:hover {
  border-color: var(--border2);
}

.generationCardTitle {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.generationCardThumbs {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2px;
  padding: 2px;
  min-height: 0;
  background: var(--panel2);
}

/* One preview (e.g. canvas composite thumbnail): fill the whole card area instead of a single 2×2 cell. */
.generationCardThumbs:has(> .generationCardThumb:only-child) {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.generationCardThumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.generationCardPlaceholder {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
}

.generationsEmpty {
  text-align: center;
  padding: 24px;
}

@media (max-width: 840px) {
  .projectActions {
    grid-template-columns: 1fr;
    gap: calc(var(--grid) * 3);
  }

  .projectActionCard {
    min-height: 92px;
    padding: calc(var(--grid) * 5);
  }
}
