@media (max-width: 760px) {
  .image-workspace .gallery-heading {
    flex-wrap: wrap;
    gap: 8px;
  }
  .image-workspace .gallery-tools {
    flex-wrap: wrap;
    max-width: 100%;
  }
}
body {
  background: var(--bg);
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.topbar {
  gap: 36px;
  border-bottom: 1px solid #191c1d;
  background: #0e1011;
}
.brand-note {
  font-size: 11px; /* was 8px; review L8 */
  letter-spacing: 1.5px;
}
.brand-icon {
  color: var(--accent);
}
.nav-item.active {
  color: var(--accent);
}
.nav-item.active:after {
  display: none;
}
.nav-item {
  font-size: 16px;
}
.notice {
  z-index: 40;
  background: #24282a;
  border: 1px solid #52602a;
}
.primary {
  background: var(--accent);
  color: #131600;
  border-radius: 14px;
  font-weight: 700;
}
.primary:disabled {
  opacity: 0.45;
}
.pill {
  background: #202224;
  border: 1px solid #303522;
  border-radius: 13px;
  font-size: 14px;
  padding: 12px 15px;
  min-height: 48px;
  max-width: 240px;
  color: #efefed;
}
.pill:hover {
  background: #292c2d;
}
.gallery-heading {
  min-height: 63px;
}
.gallery-heading h1 {
  margin: 0;
}
.gallery-tools > .pill {
  font-size: 13px;
  padding: 9px 12px;
  min-height: 40px;
}
.gallery-tools input[type='range'] {
  width: 125px;
  accent-color: #eee;
  height: 24px;
  border: 0;
  background: transparent;
  padding: 0;
}
.view-toggle {
  display: flex;
  background: #17191b;
  border-radius: 14px;
  padding: 3px;
}
.view-toggle button {
  background: transparent;
  border: 0;
  padding: 10px 13px;
  color: var(--muted);
  border-radius: 11px;
  font-size: 13px;
}
.view-toggle .active {
  color: #fff;
  background: #232628;
}
.history-filters {
  display: flex;
  gap: 8px;
  padding: 0 25px 15px;
}
.history-filters input,
.history-filters select {
  max-width: 230px;
  font-size: 12px;
  background: #1d2021;
  border-color: var(--border);
  border-radius: 10px;
}
.creative-gallery {
  padding: 0 24px 310px;
  gap: 10px;
  display: grid;
  align-items: start;
}
.creative-gallery.columns-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.creative-gallery.columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.creative-gallery.columns-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.creative-gallery.columns-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.creative-gallery.columns-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.history-item {
  overflow: hidden;
  min-width: 0;
  background: #1c1e20;
  position: relative;
}
.history-preview {
  position: relative;
  height: 100%;
  aspect-ratio: 3/4;
  background: #1c1e20;
  overflow: hidden;
}
.history-preview img,
.history-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.preview-open {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.preview-open:hover {
  background: #fff1;
}
.like-button {
  position: absolute;
  right: 10px;
  top: 10px;
  border: 1px solid #5557;
  border-radius: 50%;
  background: #17191bc9;
  color: #eee;
  font-size: 22px;
  width: 38px;
  height: 38px;
  padding: 0;
  z-index: 1;
  opacity: 0;
}
.history-item:hover .like-button,
.like-button:focus-visible,
.like-button.liked {
  opacity: 1;
}
.like-button.liked {
  color: var(--accent);
}
.history-copy {
  padding: 15px;
  min-width: 0;
}
.image-workspace .history-copy {
  display: none;
}
.history-model {
  display: inline-block;
  border: 1px solid #35383a;
  color: #f3f3f0;
  font-weight: 600;
}
.history-prompt {
  display: block;
  text-align: left;
  white-space: pre-wrap;
  color: var(--muted);
  border: 0;
  background: transparent;
  padding: 0;
  overflow-wrap: anywhere;
  width: 100%;
  overflow: auto;
}
.history-prompt:hover {
  color: #d9dbd5;
}
.history-prompt mark {
  color: var(--accent);
  background: none;
  font-weight: 600;
}
.history-references {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.history-references img,
.history-references video {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
}
.history-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 13px 0;
}
.history-settings span {
  background: #222528;
  font-size: 12px;
  color: #ddd;
}
.history-copy time {
  font-size: 12px;
  color: var(--muted);
}
.history-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.history-actions button {
  background: transparent;
  border-color: #373b3c;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 11px;
  color: #999;
}
.generation-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: var(--accent);
  padding: 26px;
  text-align: center;
}
.generation-state small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.empty {
  min-height: 45vh;
  grid-column: 1/-1;
}
.empty h2 {
  font-size: 23px;
  color: #bfc4bb;
}
.empty p {
  font-size: 14px;
}
.empty-symbol {
  color: #c9de65;
}
.composer {
  position: relative;
}
.composer-top {
  font-size: 11px; /* was 10px; review L8 */
  gap: 12px;
  opacity: 0.75;
}
.composer textarea::placeholder {
  color: #979d98;
}
.controls {
  gap: 8px;
  flex-wrap: wrap;
}
.composer-footer {
  font-size: 11px; /* was 10px; review L8 */
  padding-top: 3px;
}
.references {
  gap: 9px;
}
.reference {
  width: 70px;
  height: 70px;
  border-radius: 13px;
  border-color: #44484b;
  flex-shrink: 0;
}
.reference img,
.reference video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.reference select {
  font-size: 11px; /* was 9px; review L8 */
  background: #111d;
  color: #e9ece8;
  border: 0;
}
.reference button {
  width: 23px;
  height: 23px;
  z-index: 2;
  background: #373b3f;
  border-color: #555;
  color: white;
}
.reference-warning {
  position: absolute;
  bottom: 0;
  font-size: 11px; /* was 9px; review L8 */
  color: #f88;
  background: #111;
}
.audio-preview {
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: #262b2e;
  color: var(--accent);
  font-size: 32px;
  border-radius: 12px;
}
.audio-preview small {
  max-width: 95%;
  font-size: 11px; /* was 10px; review L8 */
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.selection-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.element-chip,
.camera-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 7px;
  padding: 4px 7px;
  font-size: 13px;
}
.element-chip {
  color: var(--accent);
  background: #29310e;
}
.camera-chip {
  color: var(--blue);
  background: #1e2a3c;
}
.element-chip button,
.camera-chip button {
  color: inherit;
  border: 0;
  background: none;
  padding: 0 2px;
  font-size: 16px;
}
.history-chips {
  margin-top: 20px;
}
.mention-suggestions {
  position: absolute;
  left: 24px;
  bottom: 120px;
  min-width: 250px;
  max-width: 85%;
  border: 1px solid #555;
  border-radius: 14px;
  background: #282d2f;
  box-shadow: 0 12px 30px #0008;
  z-index: 12;
  padding: 6px;
}
.mention-suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  color: var(--accent);
  border: 0;
  background: transparent;
  padding: 10px;
  border-radius: 7px;
}
.mention-suggestions button:hover,
.mention-suggestions button:focus,
.mention-suggestions button.highlighted {
  background: #39412a;
}
.mention-suggestions small {
  color: var(--muted);
  margin-left: 8px;
}
.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
}
.video-history.grid .history-preview {
  aspect-ratio: 4/3;
  min-height: 180px;
}
.video-history.grid .history-copy {
  padding: 12px;
}
.video-history.grid .history-prompt {
  font-size: 13px;
  max-height: 70px;
  margin: 10px 0;
}
.video-history.grid .history-chips {
  margin-top: 10px;
}
.video-history .like-button {
  opacity: 1;
}
.video-workspace .gallery-tools > #history-help {
  font-size: 11px;
}
.video-workspace .gallery-tools .quiet {
  font-size: 11px;
  padding: 5px;
}
.video-workspace .gallery-tools input[type='range'] {
  width: 75px;
}
.video-workspace .gallery-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.library-modal {
  width: min(1120px, calc(100vw - 56px));
  padding: 0;
  background: #242729;
  border-radius: 25px;
  max-height: 80vh;
}
.library-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1d2022;
  padding: 18px 21px;
  border-radius: 25px 25px 0 0;
  gap: 16px;
}
.library-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.library-tabs button {
  background: transparent;
  border: 0;
  border-radius: 25px;
  color: var(--muted);
  font-size: 14px;
  padding: 11px 17px;
}
.library-tabs button.active {
  background: #f6f6f3;
  color: #121415;
}
.library-toolbar {
  padding: 16px 21px;
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #34383a;
}
.library-toolbar strong {
  font-size: 15px;
  margin-right: auto;
}
.library-toolbar input {
  width: 210px;
  background: #1d2021;
  font-size: 12px;
  padding: 10px;
  border-radius: 10px;
}
.library-toolbar select {
  width: 165px;
  font-size: 11px;
  background: #1d2021;
  border-color: #414744;
  border-radius: 10px;
}
.library-body {
  display: flex;
  gap: 17px;
  padding: 18px 20px;
  min-height: 340px;
  max-height: 55vh;
  overflow: auto;
}
.element-categories {
  display: flex;
  flex-direction: column;
  width: 150px;
  flex-shrink: 0;
  gap: 5px;
  align-self: flex-start;
}
.element-categories button {
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  padding: 11px;
  color: #e1e4dd;
  font-size: 13px;
}
.element-categories button.active {
  background: #353a3b;
}
.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
  width: 100%;
  align-items: start;
  /* Rows keep their cards' full height and the grid scrolls inside .library-body. Stretched to the body's height,
     the rows shrank to fit and clipped the cards, so later rows overlapped earlier ones. */
  align-self: flex-start;
  grid-auto-rows: max-content;
}
.library-card {
  padding: 0;
  min-width: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 8px;
  color: #e3e6dc;
}
.library-select {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  gap: 7px;
  overflow: hidden;
}
.library-card img,
.library-card video,
.library-card .audio-preview {
  width: 100%;
  height: 210px;
  object-fit: contain;
  background: #303436;
  border-radius: 12px;
}
.library-card > span:not(.audio-preview),
.library-select > span:not(.audio-preview, .audio-tile),
.library-card strong {
  font-size: 13px;
  padding: 0 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.library-card .library-select > span.library-owner {
  color: #a6aca5;
  font-size: 11px;
}
.library-card .element-card-name {
  color: #a6aca5;
}
.library-card .element-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  font-size: 11px; /* was 10px; review L8 */
  color: #9aab82;
}
.element-card-actions button {
  border: 0;
  background: #353b3b;
  padding: 2px 7px;
  border-radius: 5px;
}
.new-element {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 210px;
  border: 1px dashed #4a5050;
  background: #303436;
  border-radius: 13px;
  gap: 12px;
}
.new-element > span {
  font-size: 35px !important;
  line-height: 52px;
  min-width: 55px;
  height: 55px;
  text-align: center;
  border-radius: 50%;
  background: radial-gradient(#595e5d, #303536);
  border: 1px solid #666b68;
}
.new-element small {
  font-size: 11px; /* was 10px; review L8 */
  color: var(--muted);
}
.library-card:hover img,
.library-card:hover video {
  outline: 2px solid #6b755b;
  outline-offset: -2px;
}
.library-empty {
  grid-column: 1/-1;
  color: var(--muted);
  font-size: 14px;
  padding: 40px;
}
.library-modal > .error {
  padding: 0 20px;
  font-size: 13px;
}
.library-modal > #library-note {
  padding: 0 20px 8px;
  margin: 0;
}
.element-modal {
  background: #202426;
  width: min(520px, calc(100vw - 40px));
}
.element-modal input,
.element-modal textarea,
.element-modal select {
  background: #171c1d;
  border-color: #444a48;
  border-radius: 10px;
}
.share-toggle {
  display: flex;
  gap: 10px;
  align-items: center;
}
.share-toggle input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
.element-source-list {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.element-source-list button {
  position: relative;
  width: 75px;
  height: 75px;
  padding: 0;
  border: 0;
}
.element-source-list img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}
.element-source-list button span {
  position: absolute;
  top: 0;
  right: 0;
  background: #252a2b;
  color: #fff;
  border-radius: 50%;
  padding: 2px 6px;
}
.camera-modal {
  width: min(850px, calc(100vw - 40px));
  background: #202426;
}
.native-import {
  grid-column: 1/-1;
  display: grid;
  gap: 12px;
}
.native-import select {
  width: 100%;
  font-size: 12px;
}
.native-element-import {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid #505654;
  border-radius: 12px;
  margin-top: 12px;
}
.native-element-import select {
  width: auto;
}
.native-element-import button {
  font-size: 12px;
}
@media (max-width: 760px) {
  .video-workspace .gallery-tools {
    flex-wrap: wrap;
  }
  .video-workspace .video-history {
    min-width: 0;
    width: 100%;
  }
}
@media (max-width: 1100px) {
  .topbar {
    gap: 24px;
  }
  .video-workspace .gallery-tools input[type='range'],
  .video-workspace #history-help {
    display: none;
  }
  .composer {
    padding: 18px;
  }
  .pill {
    font-size: 12px;
    padding: 10px 12px;
    min-height: 42px;
  }
  .library-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .library-card img,
  .library-card video {
    height: 180px;
  }
  .library-tabs button {
    font-size: 12px;
    padding: 9px 12px;
  }
}
@media (max-width: 760px) {
  .brand {
    font-size: 14px;
  }
  .brand-icon {
    font-size: 24px;
  }
  .nav-item {
    font-size: 12px;
  }
  .user-name {
    display: none;
  }
  #identity .quiet {
    font-size: 11px; /* was 10px; review L8 */
    padding: 5px;
  }
  .gallery-heading {
    padding: 12px 15px;
  }
  .gallery-heading h1 {
    font-size: 15px;
  }
  .gallery-tools #gallery-size {
    width: 65px;
  }
  .creative-gallery {
    padding: 0 12px 330px;
  }
  .creative-gallery.columns-3,
  .creative-gallery.columns-4,
  .creative-gallery.columns-5,
  .creative-gallery.columns-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .history-preview {
    min-height: 160px;
  }
  .composer textarea {
    min-height: 55px;
  }
  .composer-top {
    display: none;
  }
  .composer-bottom {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
  }
  .controls {
    gap: 6px;
  }
  .pill {
    font-size: 11px;
    padding: 8px 10px;
    min-height: 36px;
  }
  .reference {
    width: 55px;
    height: 55px;
  }
  .gallery-tools > .quiet {
    font-size: 11px; /* was 10px; review L8 */
  }
  .like-button {
    opacity: 1;
  }
  .library-modal {
    width: calc(100vw - 20px);
    max-height: 90vh;
    border-radius: 20px;
  }
  .library-top {
    padding: 12px;
    gap: 5px;
  }
  .library-tabs {
    gap: 0;
  }
  .library-tabs button {
    font-size: 11px;
    padding: 8px 10px;
  }
  .library-toolbar {
    padding: 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .library-toolbar strong {
    font-size: 13px;
  }
  .library-toolbar input {
    width: 100%;
    order: 3;
  }
  .library-toolbar select {
    width: 140px;
  }
  .library-body {
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 12px;
    max-height: 60vh;
  }
  .element-categories {
    flex-direction: row;
    width: 100%;
    gap: 4px;
    flex-wrap: wrap;
  }
  .element-categories button {
    font-size: 11px;
    padding: 8px;
  }
  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .library-card img,
  .library-card video {
    height: 165px;
  }
  .new-element {
    min-height: 165px;
  }
  .history-filters input {
    max-width: 100%;
    width: 100%;
  }
}

/* Removing an Element, or an upload from its preview in Assets: a tinted danger button, and its confirm step in
   place of it (no browser dialog). */
.element-remove {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.element-remove > .danger {
  justify-self: start;
}
.element-remove-confirm {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--danger);
  border-radius: 12px;
  background: var(--danger-bg);
}
.element-remove-confirm p {
  margin: 0;
  color: var(--text);
}
.element-remove-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.element-remove[hidden],
.element-remove-confirm[hidden],
#element-remove[hidden],
#asset-remove[hidden] {
  display: none;
}
