/* ---- Phantom Pictures ---- */

.sidebar-logo {
  width: 32px; height: 32px; border-radius: 0; flex-shrink: 0;
  object-fit: contain; border: 0;
}
.app-sidebar[data-collapsed="true"] .sidebar-logo { display: none; }

main#main {
  max-width: none;
  padding: 8px 12px 12px;
}

.page-banner {
  margin: 0 0 8px;
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(118, 82, 214, 0.65);
  background: #090910;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.18);
  flex: 0 0 auto;
  position: relative;
}
.page-banner img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 1920 / 240;
  object-fit: contain;
  object-position: center;
}
.page-banner-with-chrome .page-banner-chrome {
  position: absolute;
  right: 10px;
  bottom: 8px;
  left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: min(72%, 640px);
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(7, 7, 12, 0.72);
  border: 1px solid rgba(118, 82, 214, 0.45);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  z-index: 2;
}
.page-banner-status {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--secondary);
  font-size: 0.82rem;
  line-height: 1.25;
  text-align: right;
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.page-banner-status .status-text {
  min-width: 0;
}
.page-banner-status .status-elapsed {
  display: none;
  flex: 0 0 auto;
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.page-banner-status .status-elapsed.is-on {
  display: inline;
}
.page-banner-status .status-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: rgba(148, 163, 184, 0.55);
  box-shadow: 0 0 0 0 rgba(181, 155, 255, 0.0);
}
#view-video .page-banner-with-chrome {
  display: flex;
  flex-direction: column;
}
#view-video .page-banner-video-chrome {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  max-width: none;
  justify-content: flex-end;
  border-radius: 0;
  box-shadow: none;
}
.page-banner-title {
  margin: 0;
  padding: 0 8px 0 4px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.page-banner-status.is-busy .status-pulse {
  background: #b59bff;
  animation: phantom-status-blink 1s ease-in-out infinite;
}
.page-banner-status.is-error .status-pulse {
  background: #f87171;
  animation: phantom-status-blink 0.85s ease-in-out infinite;
}
@keyframes phantom-status-blink {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(181, 155, 255, 0.55); }
  50% { opacity: 0.35; transform: scale(0.85); box-shadow: 0 0 0 6px rgba(181, 155, 255, 0); }
}
.page-banner-chrome .ask-toolbar-actions {
  flex: 0 0 auto;
}
.options-subsection {
  margin: 12px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid rgba(118, 82, 214, 0.28);
}
.options-subsection:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.options-subsection h4 {
  margin: 0 0 8px;
  font-size: 0.92rem;
  color: var(--accent-bright);
}
.custom-size-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 8px 0 4px;
}
.custom-size-fields label {
  grid-column: span 1;
}
.quality-description {
  margin: 4px 0 10px;
  min-height: 2.4em;
}
.photo-credit-quote {
  display: block;
  margin: 4px 0 8px;
  color: var(--antique-gold, #c9a227);
  font-size: 0.92rem;
}
.account-credits-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.account-credits-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(118, 82, 214, 0.35);
  border-radius: 8px;
  background: rgba(7, 7, 12, 0.45);
}

.brand-panel {
  background: linear-gradient(180deg, #10101a 0%, var(--panel) 48%);
  border: 1px solid var(--border-purple);
  box-shadow: inset 0 1px 0 rgba(181, 155, 255, 0.12);
}

/* ---- Ask (desktop-aligned chat) ---- */
.view-ask {
  gap: 0;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.ask-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  max-width: none;
  width: 100% !important;
  flex: 1 1 auto;
  margin-bottom: 0;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
}
.ask-panel::-webkit-resizer {
  background: transparent;
}
.ask-toolbar {
  display: none;
}
.ask-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ask-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  padding: 2px 0 6px;
  border-bottom: 1px solid rgba(118, 82, 214, 0.35);
  flex: 0 0 auto;
}
.ask-status-row .ask-status-bar {
  margin: 0;
  padding: 0;
  border: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.ask-workspace {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  border: 1px solid rgba(118, 82, 214, 0.45);
  border-radius: 10px;
  background: #07070C;
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.08);
  box-sizing: border-box;
}
.ask-workspace.ask-drop-active {
  outline: 2px dashed rgba(181, 155, 255, 0.7);
  outline-offset: -4px;
}
.ask-resize-grip {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 6;
  background:
    linear-gradient(
      135deg,
      transparent 42%,
      rgba(118, 82, 214, 0.45) 42%,
      rgba(118, 82, 214, 0.45) 48%,
      transparent 48%,
      transparent 58%,
      rgba(139, 92, 246, 0.7) 58%,
      rgba(139, 92, 246, 0.7) 64%,
      transparent 64%,
      transparent 74%,
      rgba(181, 155, 255, 0.95) 74%,
      rgba(181, 155, 255, 0.95) 80%,
      transparent 80%
    );
}
.ask-status-bar {
  margin: 0; padding: 0; color: var(--secondary);
  flex: 0 0 auto;
}
.conversation {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(41, 40, 58, 0.8);
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(59, 0, 87, 0.22), transparent 60%),
    #0A0A11;
  padding: 16px;
}
.ask-split-sash {
  flex: 0 0 8px;
  cursor: row-resize;
  background:
    linear-gradient(to bottom, transparent, rgba(118, 82, 214, 0.35), transparent);
  border-top: 1px solid rgba(118, 82, 214, 0.28);
  border-bottom: 1px solid rgba(118, 82, 214, 0.28);
}
.ask-split-sash:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: -2px;
}
.ask-lower {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding: 8px 10px 10px;
  background: #0A0A11;
}
.conversation .msg {
  display: flex; flex-direction: column; gap: 4px;
  max-width: min(820px, 96%);
  margin: 0 0 12px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel-raised); line-height: 1.5;
}
.conversation .msg .msg-role {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-bright); font-weight: 700;
}
.conversation .msg.you {
  margin-left: auto; border-color: rgba(139, 92, 246, 0.55);
  background: #19152A;
}
.conversation .msg.you .msg-role {
  color: var(--accent-bright);
}
.conversation .msg.phantom {
  margin-right: auto;
  border-color: rgba(118, 82, 214, 0.7);
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.12);
}
.conversation .msg.phantom .msg-role {
  color: #B59BFF;
}
.conversation .msg.processing {
  color: var(--muted); font-style: italic; border-style: dashed;
}
.conversation .msg.failed {
  color: #ffb4b4; border-color: rgba(239, 68, 68, 0.55);
}
.ask-composer-desktop {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  gap: 8px;
  border: 1px solid rgba(118, 82, 214, 0.55);
  border-radius: 10px;
  background: #0A0A11;
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.1);
  padding: 8px;
  overflow: hidden;
  box-sizing: border-box;
}
.ask-composer-desktop textarea {
  display: block;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 72px;
  height: 72px;
  max-height: 160px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.35;
  overflow-y: auto;
}
.ask-composer-tools {
  position: static;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0;
  flex: 0 0 auto;
  z-index: 2;
}
#video-composer-status {
  margin: 4px 0 0;
  min-height: 1.1em;
}
.ask-attach-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.ask-attach-ghost:hover,
.ask-attach-ghost:focus-visible {
  background: rgba(25, 21, 42, 0.55);
  outline: none;
}
.ask-composer-tools .ask-send,
.ask-composer-tools .ask-stop {
  min-height: var(--action-btn-min-height, 36px);
  height: var(--action-btn-height, 36px);
  padding: var(--action-btn-padding-y, 0) var(--action-btn-padding-x, 12px);
  margin: 0;
  font-size: var(--action-btn-font-size, 0.85rem);
  border-radius: var(--action-btn-radius, 8px);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ask-composer-tools .ask-stop { min-width: 4.2rem; }
.ask-composer-tools .ask-send { min-width: 4.2rem; }

#video-composer.ask-composer-desktop {
  flex-direction: row;
  align-items: stretch;
  flex-wrap: nowrap;
}
#video-composer textarea {
  width: auto;
  flex: 1 1 auto;
  min-height: 74px;
  height: 74px;
  max-height: 74px;
  resize: none;
}
#video-composer .ask-composer-tools {
  width: auto;
  justify-content: flex-end;
  align-items: flex-end;
  align-self: stretch;
  flex: 0 0 auto;
}
#video-composer .picture-enhance-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin: 0 4px 0 0;
  max-width: 5.2rem;
  font-size: 0.7rem;
  line-height: 1.1;
  text-align: center;
  color: var(--text);
  cursor: pointer;
}
.video-action-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#video-composer .ask-composer-tools .ask-send,
#video-composer .ask-composer-tools .ask-stop {
  width: 5.8rem;
  min-width: 5.8rem;
}
#btn-video-create.create-gate-blocked {
  opacity: 0.72;
  box-shadow: inset 0 0 0 1px rgba(168, 120, 255, 0.45);
  cursor: pointer;
}

.ask-history-dialog {
  border: 1px solid rgba(118, 82, 214, 0.55);
  border-radius: 12px;
  padding: 0;
  background: #0A0A11;
  color: var(--text);
  width: min(560px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
}
.ask-history-dialog::backdrop {
  background: rgba(5, 5, 9, 0.72);
}

/* ---- Phantom themed modal ---- */
.phantom-dialog {
  border: 1px solid rgba(118, 82, 214, 0.7);
  border-radius: 14px;
  padding: 0;
  background: linear-gradient(180deg, #14121f 0%, #0A0A11 55%);
  color: var(--text);
  width: min(440px, calc(100vw - 32px));
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.2),
    0 18px 48px rgba(0, 0, 0, 0.55);
}
.phantom-dialog::backdrop {
  background: rgba(5, 5, 9, 0.78);
}
.phantom-dialog-sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 18px;
}
.phantom-dialog-sheet h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--accent-bright);
}
.verification-delivery-dialog {
  width: fit-content;
  max-width: min(30rem, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
}
.verification-delivery-dialog .phantom-dialog-sheet {
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.verification-delivery-dialog p {
  margin: 0;
}
.phantom-dialog-message {
  margin: 0;
  color: var(--secondary);
  line-height: 1.45;
  white-space: pre-wrap;
}
.explore-report-target {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(118, 82, 214, 0.45);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.explore-report-target legend {
  padding: 0 4px;
  color: var(--accent-bright);
  font-weight: 600;
}
.explore-report-target label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
}
#explore-report-live {
  margin: 0;
  min-height: 1.2em;
}
@media (max-width: 640px) {
  #explore-report-dialog .phantom-dialog-actions button,
  #explore-report-dialog select,
  #explore-report-dialog #explore-report-reason-detail,
  #explore-report-menu-item,
  .explore-action-btn.report-btn {
    min-height: 44px;
    min-width: 44px;
  }
}
.phantom-dialog-balance {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(118, 82, 214, 0.45);
  background: #0A0A11;
  color: var(--text);
  font-size: 0.9rem;
}
.phantom-dialog-sheet input,
.phantom-dialog-sheet textarea,
.phantom-dialog-sheet select {
  margin-bottom: 0;
}
.phantom-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.capture-export-dialog {
  width: min(520px, calc(100vw - 32px));
}
.capture-fieldset {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(118, 82, 214, 0.35);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.capture-fieldset legend {
  padding: 0 6px;
  color: var(--accent-bright);
  font-weight: 600;
}
#session-export-status.session-export-live,
#session-export-status.is-busy,
#session-export-status.is-complete {
  color: var(--accent-bright);
  font-weight: 600;
}
#session-export-status.is-error {
  color: #f0a0a0;
  font-weight: 600;
}
.admin-credit-balances {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.admin-elevation-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.ask-history-sheet {
  display: flex;
  flex-direction: column;
  max-height: min(70vh, 560px);
  padding: 14px 16px 16px;
  box-sizing: border-box;
}
.ask-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ask-history-header h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--accent-bright);
}
.ask-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
}
.ask-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #12121C;
}
.ask-history-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ask-history-meta strong {
  font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ask-history-meta span {
  font-size: 0.78rem;
  color: var(--muted);
}
.ask-history-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.canvas-subhero {
  margin: 0; max-width: 36ch; color: var(--secondary); font-size: 0.92rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.55);
}

.project-tools {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(140px, 1fr) auto auto;
  gap: 8px; align-items: center; margin-bottom: 14px;
}
.project-tools input, .project-tools select { margin: 0; }
.projects-list { display: grid; gap: 8px; margin-bottom: 12px; }
.projects-list .project-row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: #0A0A11;
}
.brand-details {
  margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}
.brand-details > summary {
  cursor: pointer; color: var(--accent-bright); font-weight: 600; margin-bottom: 8px;
}

/* ---- Phantom Pictures ---- */
#view-photos,
#view-video {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
#view-photos .page-banner,
#view-video .page-banner,
#view-projects .page-banner,
#view-explore .page-banner,
#view-profile .page-banner {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
}
#view-photos .page-banner img,
#view-video .page-banner img,
#view-projects .page-banner img,
#view-explore .page-banner img,
#view-profile .page-banner img {
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: 1920 / 240;
  object-fit: contain;
  object-position: center;
}
#view-photos .pictures-workspace,
#view-video .pictures-workspace {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
.pictures-workspace {
  display: grid;
  grid-template-columns: minmax(180px, 264px) minmax(0, 1fr) minmax(240px, 300px);
  gap: 12px;
  align-items: stretch;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
}
.pictures-left, .pictures-right, .pictures-centre {
  margin-bottom: 0; display: flex; flex-direction: column; min-height: 0;
  height: 100%;
}
.pictures-centre {
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.2vh, 24px);
  padding-block: clamp(8px, 2.2vh, 18px);
  min-width: 0;
}
.pictures-left.brand-panel,
.pictures-right.brand-panel {
  padding: 10px 14px 12px 12px;
  box-sizing: border-box;
}
.pictures-right.brand-panel {
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}
.pictures-right.brand-panel select,
.pictures-right.brand-panel .status {
  max-width: 100%;
  box-sizing: border-box;
}
.pictures-right.brand-panel .options-group {
  padding: 8px 10px;
}
.pictures-centre .pictures-canvas {
  flex: 0 0 auto;
  width: min(100%, 960px);
  margin-inline: auto;
}
.pictures-centre .prompt-dock {
  margin-top: 0;
}
.mode-stack { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.mode-btn {
  appearance: none; -webkit-appearance: none; font: inherit;
  width: 100%; min-height: 40px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: #12121C; color: var(--muted);
  font-weight: 700; padding: 8px 10px;
}
.mode-btn.active, .mode-btn[aria-selected="true"] {
  background: #19152A; color: var(--accent-bright); border-color: var(--accent-dim);
}
.field-label { margin-top: 4px; }
.creations-block { flex: 1; display: flex; flex-direction: column; min-height: 0; margin-top: 12px; }
.creations-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
  min-width: 0;
}
.creations-heading-row h3,
.creations-block > h3 {
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  color: var(--secondary);
  line-height: 1.3;
  min-width: 0;
  flex: 1 1 auto;
}
.creations-heading-row #btn-creations-select-all {
  flex: 0 0 calc((100% - 8px) / 2);
  width: calc((100% - 8px) / 2);
  min-width: 0;
  max-width: calc((100% - 8px) / 2);
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  margin: 0;
  padding: 0 8px;
  box-sizing: border-box;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.creations-selection-count {
  display: block;
  margin: 0 0 6px;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--muted);
}
.creations-list {
  list-style: none; margin: 0; padding: 0; flex: 1 1 auto; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px; background: #0A0A11;
  max-height: none;
  min-height: 220px;
}
.creations-list li {
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  font-size: 0.8rem; color: var(--secondary); cursor: pointer;
}
.creations-list li:hover, .creations-list li.selected {
  background: #19152A; color: var(--text);
}
.creations-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}
.creations-context-menu {
  position: fixed;
  z-index: 80;
  min-width: 160px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #14121F;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.creations-context-menu[hidden] { display: none !important; }
.creations-context-menu button {
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.creations-context-menu button:hover:not(:disabled) {
  background: #19152A;
  color: var(--accent-bright);
}
.creations-context-menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.creations-actions {
  display: flex; flex-wrap: nowrap; gap: 8px; padding-top: 10px;
  margin-top: auto;
  align-items: stretch;
}
.creations-actions-compact {
  padding-top: 0;
  margin-bottom: 10px;
}
.creations-actions .secondary {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 0 8px;
  font-size: var(--action-btn-font-size, 0.85rem);
  box-sizing: border-box;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pictures-canvas {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  max-height: min(58vh, 720px);
  min-height: 240px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(118, 82, 214, 0.45);
  background: #07070B;
}
.pictures-canvas.pictures-drop-active {
  outline: 2px solid var(--accent-bright);
  outline-offset: -2px;
}
.pictures-canvas .canvas-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center; opacity: 1;
}
/* Idle artwork keeps title + Phantom visible on desktop and phone crops. */
.pictures-canvas[data-state="idle"] .canvas-art {
  object-fit: contain;
  object-position: center top;
}
.pictures-canvas .canvas-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center; background: transparent; z-index: 2;
}
.pictures-canvas .canvas-video.is-ready {
  background: #07070B;
  z-index: 4;
}
.canvas-overlay {
  position: absolute; z-index: 1; inset: 0;
  display: block;
  padding: 0;
  text-align: center;
  background: transparent;
  pointer-events: none;
}
.canvas-hero {
  margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--text);
  text-shadow: 0 2px 12px rgba(0,0,0,0.65);
}
.drop-zone {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  pointer-events: auto;
}
.drop-zone.dragover,
.pictures-canvas.pictures-drop-active .drop-zone {
  background: rgba(91, 61, 184, 0.12);
}
.drop-zone-title,
.drop-zone-meta {
  /* Stage art already shows the drop cue; keep text for screen readers only. */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pictures-canvas[data-state="idle"] .drop-zone,
.pictures-canvas[data-state="edit"] .drop-zone,
.pictures-canvas[data-state="waiting"] .drop-zone,
.pictures-canvas[data-state="unavailable"] .drop-zone {
  display: flex;
}
.pictures-canvas:not([data-state="idle"]):not([data-state="edit"]):not([data-state="waiting"]):not([data-state="unavailable"]) .drop-zone {
  display: none;
}
.picture-composer.pictures-drop-active {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
  border-radius: 12px;
}

.prompt-dock {
  flex: 0 0 auto;
  width: min(100%, 960px);
  margin-top: clamp(12px, 2.2vh, 24px);
  margin-inline: auto;
  padding: 0;
  border: 0;
  background: transparent;
}
.prompt-dock > .picture-composer {
  margin: 0;
}
#picture-composer textarea {
  width: 100%;
}
#picture-composer .ask-composer-tools {
  align-self: stretch;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
#picture-composer .picture-composer-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  order: 1;
  width: 100%;
}
#picture-composer .picture-composer-actions .ask-send,
#picture-composer .picture-composer-actions .ask-stop {
  width: 100%;
  min-width: 5.5rem;
  min-height: var(--action-btn-min-height, 36px);
  height: var(--action-btn-height, 36px);
  padding: var(--action-btn-padding-y, 0) var(--action-btn-padding-x, 12px);
  margin: 0;
  font-size: var(--action-btn-font-size, 0.85rem);
  border-radius: var(--action-btn-radius, 8px);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.creations-list li.creation-status-failed,
.creations-list li.creation-status-failed .creation-label {
  color: #fca5a5;
}
.creations-list li.creation-status-failed {
  border-left: 3px solid #ef4444;
  background: rgba(127, 29, 29, 0.22);
}
.creations-list li.creation-status-cancelled,
.creations-list li.creation-status-cancelled .creation-label {
  color: #fbbf24;
}
.creations-list li.creation-status-cancelled {
  border-left: 3px solid #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  opacity: 1;
}
.creations-list li.creation-status-waiting,
.creations-list li.creation-status-waiting .creation-label {
  color: #fbbf24;
}
.creations-list li.creation-status-waiting {
  border-left: 3px solid #f59e0b;
  background: rgba(245, 158, 11, 0.10);
}
.creations-list li.creation-status-loading,
.creations-list li.creation-status-loading .creation-label {
  color: #c4b5fd;
}
.creations-list li.creation-status-loading {
  border-left: 3px solid #7652d6;
}
.creation-status-icon {
  flex: 0 0 auto;
  width: 1.1rem;
  text-align: center;
  font-weight: 700;
  line-height: 1;
}
.creation-status-failed .creation-status-icon {
  color: #ef4444;
}
.creation-status-cancelled .creation-status-icon,
.creation-status-waiting .creation-status-icon {
  color: #fbbf24;
}
.pictures-canvas[data-state="error"] .canvas-hero,
.pictures-canvas[data-state="error"] #canvas-hero {
  color: #fecaca;
}
.page-banner-status.is-error .status-text {
  color: #fecaca;
  font-weight: 700;
}
/* Same-role action buttons inherit shared tokens — do not restack height/padding
   against .ask-send / .ask-stop (Create/Stop) or library primary/secondary. */
#view-photos button.primary:not(.ask-send):not(.ask-stop),
#view-photos button.secondary:not(.ask-send):not(.ask-stop),
#view-settings button.primary,
#view-settings button.secondary {
  min-height: var(--action-btn-min-height, 36px);
  height: var(--action-btn-height, 36px);
  padding: var(--action-btn-padding-y, 0) var(--action-btn-padding-x, 12px);
  font-size: var(--action-btn-font-size, 0.85rem);
  border-radius: var(--action-btn-radius, 8px);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Shared action height for Creations Select all / Delete / Download. */
#view-photos .creations-actions button.secondary:not(.ask-send):not(.ask-stop),
#view-photos .creations-heading-row #btn-creations-select-all {
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 0 8px;
  white-space: nowrap;
  box-sizing: border-box;
}
#view-photos .creations-actions button.secondary:not(.ask-send):not(.ask-stop) {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
}
#view-photos button:disabled,
#view-settings button:disabled,
#view-photos button[aria-disabled="true"],
.story-mode-soon:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
#view-photos button:focus-visible,
#view-settings button:focus-visible {
  outline: 3px solid var(--accent-bright);
  outline-offset: 2px;
}
.canvas-stage {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  margin: 0;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-bright);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  background: rgba(7, 7, 12, 0.55);
  pointer-events: none;
}
.canvas-timers {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: none;
}
.canvas-timers .timer-value {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 2px;
  color: #efe9ff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  overflow: hidden;
  line-height: 1;
  border-radius: 4px;
  box-sizing: border-box;
}
.canvas-timers .timer-value.timer-active {
  background: #5B3DB8;
  box-shadow: 0 0 0 2px #7652D6;
}
.pictures-canvas[data-state="result"] .canvas-overlay {
  background: transparent;
}
.pictures-canvas[data-state="result"] .canvas-art {
  object-fit: contain;
  opacity: 1;
}
#video-canvas[data-mode="text_to_video"] .drop-zone {
  display: none !important;
}
#video-canvas .canvas-overlay {
  z-index: 3;
}
#video-canvas[data-state="result"] .canvas-overlay {
  pointer-events: none;
}
#video-canvas[data-state="result"] .canvas-video.is-ready {
  z-index: 4;
}
.video-transport {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-width: 0;
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(7, 7, 12, 0.82);
  border: 1px solid rgba(118, 82, 214, 0.45);
  box-sizing: border-box;
  pointer-events: auto;
}
.video-transport-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.video-transport.hidden {
  display: none !important;
}
.video-transport-play {
  min-width: 4.4rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}
.video-transport-seek {
  flex: 1;
  min-width: 48px;
  accent-color: #7652D6;
}
.video-transport-time {
  min-width: 6.6rem;
  white-space: nowrap;
  color: #efe9ff;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.85rem;
}
.creations-block .video-transport + .creations-actions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(118, 82, 214, 0.28);
}

.options-heading { margin: 0 0 10px; font-size: 0.95rem; color: var(--accent-bright); }
.options-group {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
  background: #0A0A11;
}
.options-group > summary {
  cursor: pointer; font-weight: 600; color: var(--secondary); list-style: none;
}
.options-group > summary::-webkit-details-marker { display: none; }
.options-group > summary::after { content: " ›"; color: var(--accent-bright); }
.options-group[open] > summary::after { content: " …"; }
.options-group[open] > summary { margin-bottom: 8px; color: var(--text); }

/* ---- Admin (collapsible owner panels) ---- */
.view-admin {
  gap: 10px;
  overflow: visible;
  flex: 0 1 auto;
  min-height: min-content;
  padding-bottom: 24px;
}
.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  margin: 0;
}
.admin-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--accent-bright);
}
.admin-lead {
  margin: 4px 0 0;
}
.admin-section-title,
.admin-subhead {
  margin: 12px 0 6px;
  color: var(--accent-bright);
  font-size: 1rem;
}
.admin-card-scope {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--secondary);
  font-weight: 500;
}
.admin-card-action {
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border);
  color: inherit;
  font: inherit;
  width: 100%;
}
.admin-card-action:hover,
.admin-card-action:focus-visible {
  border-color: var(--accent-bright);
  outline: 2px solid rgba(139, 92, 246, 0.35);
  outline-offset: 2px;
}
.admin-card-warn {
  border-color: rgba(201, 167, 91, 0.55);
}
.admin-overview {
  padding: 0 12px 12px;
}
.admin-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}
.admin-card {
  background: #0A0A11;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.admin-card-label {
  display: block;
  font-size: 0.75rem;
  color: var(--secondary);
}
.admin-card-value {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
  font-weight: 700;
}
.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
}
.admin-badge-ok { color: #8dffb0; border-color: #2f6b45; }
.admin-badge-warn { color: #ffd27a; border-color: #8a6a2a; }
.admin-badge-bad { color: #ff9b9b; border-color: #8a2f2f; }
.admin-quick-actions,
.admin-toolbar,
.admin-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}
.admin-table-wrap {
  overflow: auto;
  max-height: 360px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.admin-table th,
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(118, 82, 214, 0.2);
  text-align: left;
  vertical-align: top;
}
.admin-user-detail {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0A0A11;
}
.admin-advanced {
  margin-top: 10px;
}
.admin-advanced > summary {
  cursor: pointer;
  color: var(--secondary);
  font-size: 0.85rem;
}
.admin-credit-self {
  padding: 10px;
  margin-bottom: 10px;
}
.ask-fast-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 2px 8px;
}
.ask-fast-questions button {
  font-size: 0.8rem;
  padding: 4px 10px;
}
.admin-section {
  margin: 0;
  padding: 0 12px 12px;
  border-radius: 12px;
}
.admin-section > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--accent-bright);
  padding: 12px 4px;
  border-bottom: 1px solid rgba(118, 82, 214, 0.35);
  margin: 0 0 10px;
}
.admin-section > summary::-webkit-details-marker { display: none; }
.admin-section > summary::after {
  content: " ▸";
  color: var(--secondary);
  font-weight: 600;
}
.admin-section[open] > summary::after {
  content: " ▾";
}
.admin-pre {
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0A0A11;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.78rem;
}

@media (max-width: 1200px) {
  .pictures-workspace {
    grid-template-columns: 220px minmax(0, 1fr) minmax(220px, 260px);
  }
}
@media (max-width: 980px) {
  .pictures-workspace {
    grid-template-columns: 1fr;
  }
  .pictures-left, .pictures-right { order: 2; }
  .pictures-centre { order: 1; }
  #view-photos .pictures-centre {
    min-height: min(58vh, 520px);
    justify-content: center;
    box-sizing: border-box;
  }
  .creations-list { min-height: 160px; max-height: none; }
  .creations-actions { flex-wrap: nowrap; }
  .creations-actions .secondary { flex: 1 1 0; min-width: 0; }
  .creations-heading-row {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .creations-heading-row #btn-creations-select-all {
    flex: 0 0 calc((100% - 8px) / 2);
    width: calc((100% - 8px) / 2);
    min-width: 0;
    max-width: calc((100% - 8px) / 2);
  }
  .project-tools { grid-template-columns: 1fr; }
  .ask-composer-tools {
    position: static;
    justify-content: flex-end;
    padding: 0;
  }
  .ask-composer-desktop {
    flex-wrap: wrap;
  }
  .ask-composer-desktop textarea {
    flex: 1 1 100%;
    min-height: 64px;
    height: 64px;
    max-height: 140px;
    padding: 8px 10px;
  }
  #video-composer.ask-composer-desktop {
    flex-wrap: nowrap;
  }
  #video-composer textarea {
    flex: 1 1 auto;
    min-height: 74px;
    height: 74px;
    max-height: 74px;
  }
}
@media (max-width: 640px) {
  .conversation .msg { max-width: 100%; }
  .ask-composer-tools { flex-wrap: wrap; }
  #view-video .pictures-canvas {
    width: 100%;
    max-height: min(34vh, 300px);
    min-height: 180px;
  }
  #video-composer.ask-composer-desktop {
    flex-wrap: wrap;
  }
  #video-composer textarea {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
  }
}

/* Image workspace only — real widths and mobile order below the 980px stack.
   Does not restyle the shared shell drawer or the Video workspace. */
#view-photos,
#view-photos .page-banner,
#view-photos .page-banner img,
#view-photos .pictures-workspace,
#view-photos .pictures-left,
#view-photos .pictures-right,
#view-photos .pictures-centre,
#view-photos .pictures-canvas,
#view-photos .prompt-dock,
#view-photos .picture-composer,
#view-photos .pictures-fold,
#view-photos .pictures-fold-body {
  min-width: 0;
  max-width: 100%;
}
#view-photos .pictures-canvas .canvas-art {
  max-width: 100%;
}
.pictures-fold {
  border: 0;
  background: transparent;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}
.pictures-fold-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 8px 2px;
  cursor: pointer;
  list-style: none;
  color: var(--accent-bright);
  font-weight: 700;
}
.pictures-fold-summary::-webkit-details-marker { display: none; }
.pictures-fold-summary::after {
  content: " ▸";
  color: var(--secondary);
  font-weight: 600;
  flex: 0 0 auto;
}
.pictures-fold[open] > .pictures-fold-summary::after { content: " ▾"; }
.pictures-fold-title { min-width: 0; }
.pictures-fold-meta {
  margin-left: auto;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--secondary);
  text-align: right;
  white-space: normal;
}
.pictures-fold-body {
  min-width: 0;
  max-width: 100%;
}
@media (min-width: 981px) {
  #view-photos .pictures-left,
  #view-photos .pictures-right {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    z-index: auto;
    width: auto;
    max-width: none;
    height: 100%;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #view-photos .pictures-fold > .pictures-fold-summary { display: none; }
  #view-photos .pictures-left > .pictures-fold,
  #view-photos .pictures-right > .pictures-fold {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
  }
  #view-photos #pictures-history-fold[open] > .pictures-fold-body,
  #view-photos #pictures-options-fold[open] > .pictures-fold-body,
  #view-photos .pictures-fold > .pictures-fold-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    visibility: visible;
  }
  #view-photos #pictures-options-fold[open]::details-content {
    display: block;
  }
  #btn-picture-options.picture-options-edge,
  #btn-picture-history.picture-history-entry,
  #pictures-drawer-backdrop.picture-drawer-backdrop,
  #view-photos .picture-drawer-toolbar-mobile {
    display: none !important;
  }
  /* Desktop Image tidy: mode row above the preview; Creations fills the column.
     The history list stays expanded. Select all, Delete and Download share one
     fixed 44px row at the bottom of this column only. */
  #app-shell:has(#view-photos:not(.hidden)) main#main {
    overflow: hidden;
  }
  #view-photos.view-page {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }
  #view-photos .pictures-workspace {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
    grid-template-rows: minmax(0, 1fr);
  }
  #view-photos .pictures-left {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    height: auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
  }
  #view-photos .pictures-right {
    overflow-x: hidden;
    overflow-y: auto;
  }
  #view-photos .pictures-left > #pictures-history-fold {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }
  #view-photos #pictures-history-fold[open]::details-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
    content-visibility: visible;
  }
  #view-photos #pictures-history-fold[open] > .pictures-fold-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }
  #view-photos .pictures-right > #pictures-options-fold {
    height: auto;
    overflow: visible;
    flex: 0 0 auto;
  }
  #view-photos #pictures-options-fold[open]::details-content,
  #view-photos #pictures-options-fold > .pictures-fold-body {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
    flex: 0 0 auto;
  }
  #view-photos .pictures-left .creations-block {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    margin-top: 0;
    overflow: hidden;
  }
  #view-photos .pictures-left .creations-block > h3,
  #view-photos .pictures-left .creations-heading-row,
  #view-photos .pictures-left .creations-selection-count {
    flex: 0 0 auto;
  }
  #view-photos .pictures-left .creations-selection-count {
    height: 1.2em;
    max-height: 1.2em;
    overflow: hidden;
    white-space: nowrap;
  }
  #view-photos .pictures-left .creations-list {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #view-photos .pictures-left #creations-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 44px;
    align-items: stretch;
    gap: 8px;
    flex: 0 0 44px;
    width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    margin-top: 8px;
    padding-top: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
  }
  #view-photos .pictures-left #creations-actions > button.secondary {
    flex: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    margin: 0;
    padding: 0 8px;
    box-sizing: border-box;
    font-size: 0.8rem;
    font-weight: 650;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #view-photos .pictures-left .creations-heading-row #btn-creations-select-all {
    flex: 0 0 calc((100% - 8px) / 2);
    width: calc((100% - 8px) / 2);
    min-width: 0;
    max-width: calc((100% - 8px) / 2);
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    font-size: 0.8rem;
  }
  #view-photos .pictures-centre {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    justify-items: center;
    align-items: stretch;
    align-content: stretch;
    gap: 8px;
    padding: 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
  #view-photos .pictures-desktop-mode-row[hidden] {
    display: none !important;
  }
  #view-photos .pictures-desktop-mode-row:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 8px;
    align-items: stretch;
    width: min(100%, 960px);
    max-width: 100%;
    min-height: 0;
    margin: 0;
    justify-self: center;
    align-self: start;
  }
  #view-photos .pictures-desktop-mode-row .mode-stack,
  #view-photos .pictures-desktop-mode-row .mode-btn,
  #view-photos .pictures-desktop-mode-row .story-mode-soon {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    min-height: 40px;
    box-sizing: border-box;
  }
  #view-photos .pictures-desktop-mode-row .mode-stack {
    display: flex;
  }
  #view-photos .pictures-desktop-mode-row .mode-btn,
  #view-photos .pictures-desktop-mode-row .story-mode-soon {
    justify-content: center;
    text-align: center;
  }
  #view-photos .pictures-centre .pictures-canvas {
    align-self: end;
    justify-self: center;
    width: min(100%, 960px);
    max-width: 100%;
    height: auto;
    max-height: 100%;
    min-height: 0;
    aspect-ratio: 16 / 9;
    margin: 0;
  }
  #view-photos .pictures-centre .pictures-canvas .canvas-art {
    object-fit: contain;
    object-position: center;
  }
  #view-photos .pictures-centre .prompt-dock {
    align-self: end;
    justify-self: center;
    width: min(100%, 960px);
    max-width: 100%;
    margin: 0;
    flex: 0 0 auto;
  }
}
@media (max-width: 980px) {
  #view-photos .pictures-mobile-mode-host:not([hidden]) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    min-width: 0;
  }
  #view-photos .pictures-mobile-mode-host .mode-stack {
    display: contents;
  }
  #view-photos .pictures-mobile-mode-host .mode-btn {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    margin: 0;
    box-sizing: border-box;
  }
  #view-photos .pictures-desktop-mode-row {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    border: 0 !important;
  }
  #app-shell:has(#view-photos:not(.hidden)) main#main {
    overflow: hidden;
    height: 100svh;
    height: 100dvh;
    max-height: 100svh;
    max-height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: 0;
  }
  #app-shell:has(#view-photos:not(.hidden)) #main > .mobile-primary-reach {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  #app-shell #view-photos.view-page {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }
  #view-photos .page-banner {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: none;
    margin-bottom: 0;
    overflow: hidden;
  }
  #view-photos .page-banner img {
    flex: 0 0 auto;
    width: 100%;
    height: 48px;
    max-height: 52px;
    aspect-ratio: auto;
    object-fit: cover;
    object-position: center;
  }
  #view-photos .page-banner-chrome {
    position: relative;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 4px 0 2px;
    box-sizing: border-box;
    align-items: center;
    flex-wrap: nowrap;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  #view-photos .page-banner-status {
    min-width: 0;
    overflow: hidden;
  }
  #view-photos .pictures-workspace {
    display: flex;
    flex-direction: column;
    grid-template-columns: minmax(0, 1fr);
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    height: auto;
    overflow: hidden;
    box-sizing: border-box;
  }
  #view-photos .pictures-centre {
    order: 1;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: none;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 4px;
    padding: 0;
    overflow: hidden;
  }
  #view-photos .pictures-left,
  #view-photos .pictures-right {
    position: fixed;
    top: var(--picture-banner-end, 6.5rem);
    bottom: 0;
    z-index: 85;
    width: min(88vw, 360px);
    max-width: min(88vw, 360px);
    height: auto;
    max-height: calc(100dvh - var(--picture-banner-end, 6.5rem));
    margin: 0;
    flex: 0 0 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #090910;
    box-sizing: border-box;
    padding-top: 12px;
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    visibility: hidden;
    pointer-events: none;
  }
  #view-photos .pictures-right {
    right: 0;
    left: calc(56px + 1px + env(safe-area-inset-left, 0px));
    width: auto;
    max-width: none;
    border-left: 1px solid #29283A;
    transform: translateX(110%);
  }
  #view-photos .pictures-left {
    left: 0;
    right: auto;
    border-right: 1px solid #29283A;
    transform: translateX(-110%);
  }
  #view-photos[data-picture-options-open="true"] .pictures-right {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  #view-photos[data-picture-history-open="true"] .pictures-left {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  #view-photos .pictures-left.brand-panel,
  #view-photos .pictures-right.brand-panel {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    max-height: calc(100svh - var(--picture-banner-end, 6.5rem));
    max-height: calc(100dvh - var(--picture-banner-end, 6.5rem));
  }
  #view-photos .pictures-centre .pictures-canvas,
  #view-photos .prompt-dock,
  #view-photos #picture-composer {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-inline: 0;
  }
  #view-photos .pictures-canvas {
    flex: 0 1 auto;
    order: 1;
    aspect-ratio: 16 / 9;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: auto;
    max-height: min(58svh, var(--picture-preview-max, 62dvh));
    margin-inline: auto;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  #view-photos .pictures-canvas .canvas-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
  }
  #view-photos .prompt-dock {
    order: 2;
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
    margin: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    overflow: hidden;
    z-index: auto;
    box-sizing: border-box;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #0d0d14;
  }
  #view-photos #picture-composer.ask-composer-desktop {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "prompt"
      "actions";
    align-items: start;
    gap: 6px;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-sizing: border-box;
  }
  #view-photos #picture-composer textarea {
    grid-area: prompt;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 4.6rem;
    height: auto;
    max-height: min(7.6rem, 28svh, 32dvh);
    margin: 0;
    resize: none;
    overflow-y: auto;
    field-sizing: content;
    box-sizing: border-box;
    line-height: 1.35;
  }
  #view-photos #picture-composer .ask-composer-tools {
    display: contents;
  }
  #view-photos #picture-composer .picture-composer-actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
    column-gap: 8px;
    row-gap: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
  #view-photos #picture-composer .picture-composer-actions .ask-send,
  #view-photos #picture-composer .picture-composer-actions .ask-stop,
  #view-photos #btn-cancel-job:disabled,
  #view-photos #btn-cancel-job[disabled] {
    display: inline-flex;
    visibility: visible;
    box-sizing: border-box;
    flex: none;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
    border-width: 1px;
    border-style: solid;
    min-height: 44px;
    height: 44px;
  }
  #view-photos #picture-composer .picture-composer-actions .ask-send {
    border-color: transparent;
    font-size: 1.05rem;
    font-weight: 800;
  }
  #view-photos .pictures-fold {
    border-top: 0;
  }
  #view-photos .pictures-fold > .pictures-fold-summary {
    display: none;
  }
  #view-photos[data-picture-options-open="true"] #pictures-options-fold > .pictures-fold-body {
    display: block;
  }
  #view-photos select,
  #view-photos textarea,
  #view-photos input,
  #view-photos .options-group {
    max-width: 100%;
    min-width: 0;
  }
  #view-photos .creations-list {
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #view-photos .creations-actions {
    flex-wrap: nowrap;
  }
  /* Delete + Download equal width under the list; Select all lives in the heading. */
  #view-photos .pictures-left #creations-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 44px;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    margin-top: 8px;
    padding-top: 0;
    box-sizing: border-box;
  }
  #view-photos .pictures-left #creations-actions > button.secondary {
    flex: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    margin: 0;
    padding: 0 8px;
    box-sizing: border-box;
    font-size: 0.8rem;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #view-photos .pictures-left .creations-heading-row #btn-creations-select-all {
    flex: 0 0 calc((100% - 8px) / 2);
    width: calc((100% - 8px) / 2);
    min-width: 0;
    max-width: calc((100% - 8px) / 2);
    height: 44px;
    min-height: 44px;
    max-height: 44px;
  }
  /* Open Creations drawer: column, list scrolls, actions stay on one visible row. */
  #view-photos[data-picture-history-open="true"] #pictures-history-drawer {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  #view-photos[data-picture-history-open="true"] #pictures-history-drawer > .picture-drawer-toolbar {
    flex: 0 0 auto;
  }
  #view-photos[data-picture-history-open="true"] #pictures-history-fold {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }
  #view-photos[data-picture-history-open="true"] #pictures-history-fold[open]::details-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    content-visibility: visible;
  }
  #view-photos[data-picture-history-open="true"] #pictures-history-fold > .pictures-fold-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }
  #view-photos[data-picture-history-open="true"] .pictures-left .creations-block {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    margin-top: 0;
  }
  #view-photos[data-picture-history-open="true"] .pictures-left .creations-block > h3,
  #view-photos[data-picture-history-open="true"] .pictures-left .creations-heading-row,
  #view-photos[data-picture-history-open="true"] .pictures-left .creations-selection-count {
    flex: 0 0 auto;
  }
  #view-photos[data-picture-history-open="true"] .pictures-left .creations-list {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #view-photos[data-picture-history-open="true"] .pictures-left #creations-actions {
    flex: 0 0 44px;
  }
  #view-photos .picture-drawer-toolbar-mobile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 8px;
  }
  #view-photos .picture-drawer-title {
    margin: 0;
    font-size: 1rem;
    color: #F6F4FF;
  }
  #view-photos #btn-picture-options-close,
  #view-photos #btn-picture-history-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 0 12px;
  }
  #btn-picture-options.picture-options-edge {
    display: inline-flex;
    position: fixed;
    z-index: 45;
    right: env(safe-area-inset-right, 0px);
    top: 42%;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    height: auto;
    margin: 0;
    padding: 8px 4px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    appearance: none;
    -webkit-appearance: none;
    background: #12121C;
    color: #F6F4FF;
    border: 1px solid #29283A;
    border-right: 0;
    border-radius: 10px 0 0 10px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  }
  #btn-picture-options .picture-options-edge-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  #btn-picture-history.picture-history-entry {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 10px;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    background: #12121C;
    color: #F6F4FF;
    border: 1px solid #29283A;
    border-radius: 8px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
  }
  #pictures-drawer-backdrop.picture-drawer-backdrop {
    display: none;
  }
  #pictures-drawer-backdrop.picture-drawer-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 84;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(5, 5, 9, 0.62);
    cursor: pointer;
  }
  #view-photos.picture-keyboard-open {
    max-height: var(--picture-vv-height, 100dvh);
  }
  #view-photos.picture-keyboard-open .pictures-canvas {
    flex: 0 1 auto;
    min-height: 96px;
    max-height: min(28svh, 34dvh);
  }
  #view-photos.picture-keyboard-open .prompt-dock {
    flex: 0 0 auto;
    max-height: none;
    min-height: 0;
    position: relative;
    z-index: 4;
  }
  #view-photos.picture-keyboard-open #picture-composer textarea {
    min-height: 40px;
    height: 40px;
    max-height: 56px;
  }
  #view-photos #reference-guidance-panel {
    display: none;
  }
  #view-photos .pictures-mobile-mode-host:not([hidden]),
  #view-photos .pictures-role-controls:not([hidden]) {
    display: block;
    margin: 0 0 8px;
  }
}
@media (max-width: 980px) and (max-height: 520px) {
  #app-shell:has(#view-photos:not(.hidden)) main#main {
    padding-top: 0;
  }
  #main > .mobile-primary-reach {
    display: none;
  }
  #view-photos .page-banner {
    min-height: 0;
    max-height: none;
    margin-bottom: 0;
  }
  #view-photos .page-banner img {
    height: 36px;
    max-height: 40px;
  }
  #view-photos .pictures-centre {
    gap: 0;
    padding: 0;
  }
  #view-photos .prompt-dock {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    z-index: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
  }
  #view-photos .pictures-canvas {
    flex: 0 1 auto;
    min-height: 0;
    height: auto;
    max-height: min(42svh, var(--picture-preview-max, 46dvh));
  }
  #view-photos #picture-composer.ask-composer-desktop {
    gap: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
  }
  #view-photos #picture-composer .picture-composer-actions {
    margin: 0;
    padding: 0;
  }
  #view-photos #picture-composer textarea {
    min-height: 36px;
    height: 36px;
    max-height: 40px;
  }
}
@media (max-width: 980px) and (prefers-reduced-motion: reduce) {
  #view-photos .pictures-left,
  #view-photos .pictures-right {
    transition: none;
  }
}
#view-photos .pictures-canvas[data-state="creating"],
#view-photos .pictures-canvas[data-state="building"] {
  border-color: #7652d6;
  box-shadow: inset 0 0 0 2px rgba(118, 82, 214, 0.9);
}
/* Create submitted art: keep full message readable on phone and desktop crops. */
.pictures-canvas[data-state="creating"] .canvas-art,
.pictures-canvas[data-state="building"] .canvas-art,
.pictures-canvas[data-state="loading"] .canvas-art,
.pictures-canvas[data-state="done"] .canvas-art {
  object-fit: contain;
  object-position: center;
}
.pictures-canvas[data-state="creating"] .canvas-timers,
.pictures-canvas[data-state="building"] .canvas-timers,
.pictures-canvas[data-state="loading"] .canvas-timers,
.pictures-canvas[data-state="done"] .canvas-timers {
  display: none !important;
}
@media (max-width: 720px) {
  .pictures-canvas[data-state="creating"],
  .pictures-canvas[data-state="building"],
  .pictures-canvas[data-state="loading"],
  .pictures-canvas[data-state="done"] {
    min-height: min(42vh, 320px);
    aspect-ratio: 4 / 3;
  }
}
#view-photos .pictures-canvas[data-state="loading"],
#view-photos .pictures-canvas[data-state="waiting"] {
  border-color: #c9a75b;
  box-shadow: inset 0 0 0 2px rgba(201, 167, 91, 0.75);
}
#view-photos .pictures-canvas[data-state="error"] {
  border-color: #ef4444;
  box-shadow: inset 0 0 0 2px rgba(239, 68, 68, 0.8);
}

.admin-user-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.admin-user-drawer.hidden {
  display: none;
}

.admin-user-drawer.is-open {
  pointer-events: auto;
}

.admin-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 9, 0.55);
  border: 0;
  cursor: pointer;
}

.admin-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(820px, 100vw);
  display: flex;
  flex-direction: column;
  background: #0d0d14;
  border-left: 1px solid rgba(168, 120, 255, 0.35);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.55);
  color: #f6f4ff;
}

.admin-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(168, 120, 255, 0.2);
  flex-shrink: 0;
}

.admin-drawer-name {
  margin: 0;
  font-size: 1.35rem;
  color: #f6f4ff;
}

.admin-drawer-email {
  margin: 0.25rem 0 0.5rem;
}

.admin-drawer-id-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.admin-drawer-id {
  font-size: 0.8rem;
  word-break: break-all;
  color: #b59bff;
}

.admin-drawer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(168, 120, 255, 0.35);
  background: rgba(59, 0, 87, 0.35);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.admin-badge.is-active { border-color: rgba(110, 231, 183, 0.5); color: #a7f3d0; }
.admin-badge.is-warn { border-color: rgba(201, 167, 91, 0.6); color: #e8d39a; }
.admin-badge.is-danger { border-color: rgba(239, 68, 68, 0.7); color: #fecaca; }
.admin-badge.is-staff { border-color: rgba(139, 92, 246, 0.7); color: #ddd6fe; }

.admin-drawer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(168, 120, 255, 0.15);
  flex-shrink: 0;
}

.admin-drawer-tab {
  border: 1px solid rgba(168, 120, 255, 0.25);
  background: transparent;
  color: #d8cff5;
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
}

.admin-drawer-tab.active,
.admin-drawer-tab[aria-selected="true"] {
  background: rgba(139, 92, 246, 0.25);
  border-color: #8b5cf6;
  color: #f6f4ff;
}

.admin-drawer-tab:focus-visible,
.admin-drawer-panel button:focus-visible,
.admin-drawer-panel input:focus-visible,
.admin-drawer-panel select:focus-visible {
  outline: 2px solid #c9a75b;
  outline-offset: 2px;
}

.admin-drawer-flash {
  margin: 0;
  padding: 0.5rem 1.25rem;
  min-height: 1.5rem;
  flex-shrink: 0;
}

.admin-drawer-flash.is-error { color: #fecaca; }
.admin-drawer-flash.is-ok { color: #a7f3d0; }

.admin-drawer-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 1rem 1.25rem 2rem;
}

.admin-drawer-section h3 {
  margin: 0 0 0.75rem;
  color: #e8d9ff;
}

.admin-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.admin-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(168, 120, 255, 0.18);
  background: rgba(7, 7, 11, 0.55);
}

.admin-field-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b59bff;
}

.admin-field-value {
  font-size: 0.95rem;
  color: #f6f4ff;
}

.admin-wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0 1.25rem;
}

.admin-wallet-card {
  padding: 0.75rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(168, 120, 255, 0.22);
  background: rgba(12, 8, 18, 0.9);
}

.admin-wallet-card strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #e8d9ff;
}

.admin-wallet-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.5rem;
  font-size: 0.82rem;
}

.admin-wallet-card dt { color: #b59bff; }
.admin-wallet-card dd { margin: 0; text-align: right; }

.admin-drawer-form {
  display: grid;
  gap: 0.65rem;
  max-width: 28rem;
  margin: 0.75rem 0 1.25rem;
  padding: 0.85rem;
  border-radius: 0.6rem;
  border: 1px solid rgba(168, 120, 255, 0.22);
  background: rgba(7, 7, 11, 0.45);
}

.admin-drawer-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.admin-drawer-form .admin-toolbar {
  margin: 0;
}

.admin-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.admin-btn-warn {
  border-color: rgba(201, 167, 91, 0.7) !important;
  color: #e8d39a !important;
}

.admin-btn-danger {
  border-color: rgba(239, 68, 68, 0.75) !important;
  color: #fecaca !important;
  background: rgba(127, 29, 29, 0.35) !important;
}

.admin-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.admin-activity-list li {
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(168, 120, 255, 0.18);
  background: rgba(7, 7, 11, 0.4);
}

.admin-activity-list details summary {
  cursor: pointer;
}

.admin-subtabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 720px) {
  .admin-drawer-panel {
    width: 100vw;
  }
  .admin-drawer-header {
    position: sticky;
    top: 0;
    background: #0d0d14;
    z-index: 2;
  }
  .admin-drawer-tabs {
    position: sticky;
    top: 4.5rem;
    background: #0d0d14;
    z-index: 2;
  }
}

.quick-unsupported-note {
  color: var(--phantom-antique-gold, #c9a227);
  margin: 0.35rem 0 0.6rem;
}

.quick-unsupported-note.hidden {
  display: none;
}

.auth-account-denial {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 0.75rem;
  background: rgba(20, 12, 28, 0.72);
}

.auth-account-denial h3 {
  margin: 0 0 0.35rem;
  color: var(--phantom-antique-gold, #c9a227);
  font-size: 1.05rem;
}

.auth-account-denial.hidden {
  display: none;
}

.pictures-nav-denial {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 0.75rem;
  background: rgba(20, 12, 28, 0.72);
}

.pictures-nav-denial h3 {
  margin: 0 0 0.4rem;
  color: var(--phantom-antique-gold, #c9a227);
  font-size: 1.05rem;
}

.pictures-nav-denial .creations-actions {
  margin-top: 0.75rem;
}

#admin-availability-products th,
#admin-availability-always th {
  white-space: nowrap;
}

/* R2-A03 create guidance */
.create-guidance-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 4, 10, 0.72); padding: 16px;
}
.create-guidance-overlay.hidden { display: none !important; }
.create-guidance-card {
  width: min(720px, 100%); max-height: 90vh; overflow: auto;
  padding: 20px 22px; border-radius: 14px;
  border: 1px solid rgba(118, 82, 214, 0.55);
  background: linear-gradient(160deg, #140f1c 0%, #1a1028 55%, #0d0b14 100%);
  color: #f3eefe;
}
.create-guidance-tiers {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 12px 0 18px;
}
.create-guidance-tier {
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 10px; padding: 12px; background: rgba(20, 12, 32, 0.65);
}
.create-guidance-examples { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }

/* R2-A04 creative loop + provenance */
.creative-loop-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.provenance-disclosure {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, 0.4); background: rgba(18, 12, 28, 0.8);
  color: #e8dff8; font-size: 0.92rem;
}

/* R2-A05 reference guidance */
.reference-guidance-panel { margin-top: 10px; }
.reference-guidance-item {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: center;
  border: 1px solid rgba(118, 82, 214, 0.4); border-radius: 8px; padding: 8px; margin-bottom: 8px;
}
.reference-guidance-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.reference-intent-weights { font-size: 0.9rem; color: #d4c4f5; }

/* ---- Settings accordion (B4) ---- */
.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 720px;
}
.settings-intro {
  padding: 12px 14px;
  margin: 0;
}
.settings-section {
  padding: 0 12px 12px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(10, 10, 17, 0.72);
}
.settings-section > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--accent-bright);
  padding: 12px 2px;
}
.settings-section > summary::-webkit-details-marker { display: none; }
.settings-section > summary::after {
  content: " ▸";
  color: var(--accent-bright);
}
.settings-section[open] > summary::after { content: " ▾"; }
.settings-section[open] > summary { margin-bottom: 6px; }
.settings-section h3 {
  margin: 12px 0 6px;
  font-size: 0.95rem;
  color: var(--text);
}
.settings-agreements-host {
  margin-top: 8px;
}
@media (max-width: 720px) {
  .settings-stack { max-width: 100%; }
  .settings-section { border-radius: 8px; }
}

/* Narrow pages other than the Image shell drawer: wrap controls, one Community
   column, and keep admin tables in their own scroller so the page does not. */
@media (max-width: 720px) {
  #view-ask,
  #view-video,
  #view-projects,
  #view-explore,
  #view-profile,
  #view-settings,
  #view-help,
  #view-promote,
  #view-admin {
    min-width: 0;
    max-width: 100%;
  }
  #view-ask .page-banner,
  #view-video .page-banner,
  #view-projects .page-banner,
  #view-explore .page-banner,
  #view-profile .page-banner,
  #view-settings .page-banner,
  #view-help .page-banner {
    margin-top: 0;
  }
  .page-banner-title { white-space: normal; }
  .page-banner-chrome,
  .page-banner-video-chrome {
    left: 8px;
    right: 8px;
    max-width: none;
    justify-content: flex-start;
  }
  #view-promote .panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .library-toolbar,
  .library-paging,
  .explore-filter-row,
  .admin-toolbar,
  .admin-quick-actions,
  .admin-subtabs,
  #view-promote .panel {
    flex-wrap: wrap;
  }
  .library-batch-actions {
    margin-left: 0;
    flex: 1 1 100%;
  }
  #btn-library-actions,
  #view-promote button.primary,
  #view-promote button.secondary {
    max-width: 100%;
  }
  #explore-feed.gallery {
    grid-template-columns: 1fr;
  }
  #view-admin {
    overflow-x: hidden;
  }
  #view-admin .admin-table-wrap,
  #view-admin .admin-release-wave-table-wrap,
  #view-admin .table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
@media (max-width: 480px) {
  .library-grid {
    grid-template-columns: 1fr;
  }
  #btn-library-actions {
    width: 100%;
  }
  .library-batch-actions .actions-menu-popup {
    left: 0;
    right: auto;
    max-width: calc(100vw - 24px);
  }
  #view-ask input,
  #view-ask textarea,
  #view-ask select,
  #view-video input,
  #view-video textarea,
  #view-video select,
  #view-profile input,
  #view-profile textarea,
  #view-profile select,
  #view-settings input,
  #view-settings textarea,
  #view-settings select,
  #view-help input,
  #view-help textarea,
  #view-help select,
  #view-admin input,
  #view-admin textarea,
  #view-admin select,
  #view-projects select,
  #view-explore input,
  #view-promote input,
  #view-promote textarea {
    max-width: 100%;
    box-sizing: border-box;
  }
  .profile-layout,
  .settings-stack,
  .ask-panel,
  #video-workspace,
  #view-promote .panel {
    min-width: 0;
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  #main > .mobile-primary-reach {
    display: flex;
    gap: 8px;
    margin: 0 0 8px;
    min-width: 0;
  }
  #main > .mobile-primary-reach .nav-item {
    position: static;
    visibility: visible;
    width: auto;
    min-height: 40px;
    pointer-events: auto;
  }
}

/* Library phones match Community: same 720px column, 12px panel gutter, one
   card across. Desktop density stays on .library-grid in app.css. */
@media (max-width: 720px) {
  #view-projects {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }
  #view-projects > .page-banner {
    order: -1;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    margin-top: 0;
  }
  #view-projects .library-controls-section,
  #view-projects .library-gallery-section {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    padding: 12px;
    box-sizing: border-box;
  }
  #view-projects .library-grid {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 12px;
  }
  #view-projects .library-card,
  #view-projects .library-thumb {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  #view-projects .library-thumb {
    aspect-ratio: 1 / 1;
  }
  #view-projects .library-toolbar,
  #view-projects .library-paging {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  #view-projects .library-toolbar button,
  #view-projects .library-paging button,
  #view-projects .library-toolbar select,
  #view-projects #btn-library-retry {
    min-height: 44px;
    min-width: 44px;
    height: auto;
    box-sizing: border-box;
  }
  #view-projects .library-filter-select {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    max-width: 100%;
  }
  #view-projects .library-filter-select select {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    margin-bottom: 0;
  }
  #view-projects .library-batch-actions {
    margin-left: 0;
    flex: 1 1 100%;
    max-width: 100%;
  }
  #view-projects #btn-library-actions {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 980px) {
  #view-projects .library-toolbar button,
  #view-projects .library-paging button,
  #view-projects .library-toolbar select,
  #view-projects .library-filter-select select,
  #view-projects #btn-library-retry {
    min-height: 44px;
    min-width: 44px;
    height: 44px;
    box-sizing: border-box;
  }
}

/* Creations actions fallback. 96px is two 44px targets plus one 8px gap.
   Narrower than that, wrap instead of clipping. Does not restyle other pages. */
#view-photos .pictures-left .creations-block {
  container-type: inline-size;
  container-name: pictures-creations;
}
@container pictures-creations (max-width: 96px) {
  #view-photos .pictures-left #creations-actions {
    display: flex;
    flex-wrap: wrap;
    grid-template-columns: none;
    grid-template-rows: none;
    height: auto;
    max-height: none;
    flex-basis: auto;
  }
  #view-photos .pictures-left #creations-actions > button.secondary {
    flex: 1 1 calc(50% - 4px);
    width: auto;
    min-width: 44px;
    max-width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 44px;
  }
}
@container pictures-creations (max-width: 200px) {
  #view-photos .pictures-left .creations-heading-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  #view-photos .pictures-left .creations-heading-row h3 {
    flex: 1 1 100%;
  }
  #view-photos .pictures-left .creations-heading-row #btn-creations-select-all {
    flex: 0 0 calc((100% - 8px) / 2);
    width: calc((100% - 8px) / 2);
    min-width: 0;
    max-width: calc((100% - 8px) / 2);
    margin-left: auto;
  }
}
/* Story mode: equal creation choices and a bounded, keyboard-friendly editor. */
.mode-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.mode-stack > .mode-btn {
  width: 100%;
  min-height: 2.75rem;
}

.profile-focus-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-block: 1rem;
}

.story-mode-dialog {
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
}
.story-mode-sheet {
  display: flex;
  flex-direction: column;
  width: min(58rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: hidden;
}
.story-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-bottom: 12px;
}
.story-dialog-footer {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 10px 2px 2px;
  background: #0d0d14;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 2;
}
#story-selection-count {
  margin-right: auto;
}
.upgrade-page .upgrade-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
  align-items: stretch;
}
.upgrade-offering {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0a0a11;
}
.upgrade-offering h4,
.upgrade-offering p { margin: 0; }
.upgrade-offering button { margin-top: auto; align-self: flex-start; }
.upgrade-membership-summary h3,
#upgrade-current { display: inline; }
#view-video .pictures-centre {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  justify-items: stretch;
  align-content: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  padding: 8px;
  box-sizing: border-box;
  overflow: hidden;
}
#view-video .video-mode-row {
  display: block;
  position: static;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  transform: none;
  left: auto;
  right: auto;
  box-sizing: border-box;
}
#view-video .video-mode-row .mode-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  box-sizing: border-box;
}
#view-video .video-mode-row .mode-btn {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  position: static;
  transform: none;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
#view-video .pictures-canvas {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  margin: 0;
  box-sizing: border-box;
}
#view-video .prompt-dock,
#view-video #video-composer {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  box-sizing: border-box;
}
#view-video .creations-heading-row #btn-video-creations-select-all,
#view-video .creations-actions button.secondary {
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 0 8px;
  white-space: nowrap;
  box-sizing: border-box;
}
#view-video .creations-actions button.secondary {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
}
#view-video button:disabled,
#view-video button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
#view-video .creations-list li.creation-status-ready .creation-label {
  color: var(--text);
}
#view-video .canvas-timers,
#view-video .status-elapsed {
  display: none !important;
}
@media (max-width: 980px) {
  #view-video .pictures-centre {
    min-height: min(70vh, 640px);
  }
  #view-video .pictures-canvas {
    min-height: 160px;
  }
  /* Stacked Video columns were height:100% inside a viewport-locked flex
     track, so Creations and Options collapsed to a heading and overlapped
     their lists. Grow those panels to their contents and scroll inside them. */
  #app-shell #view-video.view-page {
    flex: 0 0 auto;
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  #view-video #video-workspace {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    height: auto;
    min-height: auto;
    max-height: none;
    overflow: visible;
    align-items: stretch;
  }
  #view-video #video-workspace > .pictures-centre {
    order: 1;
    flex: 0 0 auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }
  #view-video #video-workspace > .pictures-left,
  #view-video #video-workspace > .pictures-right {
    order: 2;
    flex: 0 0 auto;
    align-self: stretch;
    height: auto;
    min-height: auto;
    max-height: none;
    overflow: hidden;
    position: relative;
  }
  #view-video .pictures-left .creations-block {
    flex: 0 0 auto;
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  #view-video .pictures-left .creations-list {
    flex: 0 1 auto;
    min-height: 120px;
    max-height: min(280px, 42vh);
    overflow-x: hidden;
    overflow-y: auto;
  }
  #view-video .pictures-left .creations-actions {
    flex: 0 0 auto;
    margin-top: 0;
  }
  #view-video #video-workspace > .pictures-right {
    overflow-x: hidden;
    overflow-y: auto;
    max-height: min(480px, 80vh);
  }
}
#view-video .pictures-canvas,
#view-photos .pictures-canvas,
#view-video .canvas-art,
#view-photos .canvas-art,
#view-video .canvas-video {
  max-width: 100%;
  min-width: 0;
}
#view-video .pictures-right,
#view-photos .pictures-right {
  min-width: 0;
  align-self: stretch;
}
@media (min-width: 981px) {
  #view-photos .page-banner-with-chrome,
  #view-video .page-banner-with-chrome {
    display: flex;
    flex-direction: column;
  }
  #view-photos .page-banner-chrome,
  #view-video .page-banner-video-chrome {
    position: static;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
  #view-photos .pictures-workspace,
  #view-video .pictures-workspace {
    display: grid;
    grid-template-columns: minmax(0, 264px) minmax(0, 1fr) minmax(0, 300px);
    overflow: hidden;
  }
  #view-photos .pictures-left,
  #view-photos .pictures-centre,
  #view-photos .pictures-right,
  #view-video .pictures-left,
  #view-video .pictures-centre,
  #view-video .pictures-right {
    min-width: 0;
    max-width: 100%;
    position: relative;
    z-index: auto;
  }
  #view-photos .pictures-centre,
  #view-video .pictures-centre {
    overflow: hidden;
  }
  #view-photos .pictures-canvas,
  #view-video .pictures-canvas {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

.story-heading-row,
.story-scene-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.story-route-chooser {
  max-width: 36rem;
  margin: 1.25rem auto;
  padding-inline: clamp(.75rem, 4vw, 1.5rem);
}

.story-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-block: 1rem;
}

.story-choice-grid .story-choice-existing {
  grid-column: 1 / -1;
  justify-self: center;
  width: calc(50% - .375rem);
}

.story-choice-btn {
  min-height: 4.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
}

.story-choice-btn:disabled,
.story-choice-btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
}

.story-choice-grid label,
.story-object-preview,
.story-scene-card,
.story-shared-settings {
  border: 1px solid var(--brand-border, #7852a9);
  border-radius: .75rem;
  padding: .9rem;
}

.story-choice-grid label {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  text-align: center;
}

.story-scenes {
  display: grid;
  gap: .8rem;
  padding-left: 1.5rem;
}

.story-scene-card textarea,
.story-mode-sheet > section input,
.story-mode-sheet > section textarea,
.story-mode-sheet > section select {
  width: 100%;
}

.story-setting-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}

#story-custom-size {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}

#story-custom-size[hidden] { display: none; }

.story-scene-preview {
  display: block;
  width: min(100%, 26rem);
  max-height: 18rem;
  margin: 0 auto .75rem;
  border-radius: .65rem;
  object-fit: contain;
}

@media (max-width: 700px) {
  .story-route-chooser {
    max-width: none;
    margin-inline: 0;
    padding-inline: 0;
  }
  .story-choice-grid { grid-template-columns: minmax(0, 1fr); }
  .story-choice-grid .story-choice-existing {
    grid-column: auto;
    justify-self: stretch;
    width: 100%;
  }
  .story-setting-grid { grid-template-columns: 1fr; }
  .story-heading-row { align-items: flex-start; }
}

/* Media frames are identical in Library and Community. Picture borders keep
   their existing theme; selection uses a ring without erasing type colour. */
:is(.library-card, .explore-card)[data-media-kind="story"] {
  border: 2px solid #8B5CF6;
}
:is(.library-card, .explore-card)[data-media-kind="video"] {
  border: 2px solid #C9A75B;
}
.library-card.selected:is([data-media-kind="story"], [data-media-kind="video"]) {
  box-shadow: 0 0 0 2px var(--accent-bright, #B59BFF);
}

#view-profile .phantom-profile-banner {
  display: grid;
  grid-template-columns: minmax(8.5rem, 36%) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  min-height: clamp(120px, 12.5vw, 180px);
  padding: 12px 88px 12px 16px;
}
#view-profile .phantom-profile-banner > img {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 152px;
  aspect-ratio: 1974 / 797;
  object-fit: contain;
}
#view-profile .profile-banner-copy {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 8px;
  color: #F6F4FF;
  background: rgba(5, 5, 9, 0.82);
}
#view-profile .profile-banner-copy h2 {
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 2rem);
  line-height: 1.2;
}
@media (max-width: 640px) {
  #view-profile .phantom-profile-banner {
    display: block;
    min-height: 0;
    padding: 10px 80px 80px 10px;
  }
  #view-profile .profile-banner-copy {
    margin: 0 0 8px;
    padding: 4px 8px;
  }
  #view-profile .phantom-profile-banner > img {
    width: 100%;
    max-height: 120px;
  }
}

/* Shared keyboard feedback across every workspace, including Store and QR. */
#app-shell :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--phantom-focus, #B59BFF);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  #app-shell *, #app-shell *::before, #app-shell *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
