.catalog-list .lora-card button {
  display: inline-flex;
  min-height: 38px;
  grid-template-rows: none;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #252525;
  color: #fff;
  text-align: center;
  transform: none;
}

.catalog-list .lora-card button:hover {
  border: 0;
  background: #333;
  transform: none;
}

.catalog-list .lora-card .view-lora {
  padding: 0 8px;
  background: transparent;
  color: #b4b4b4;
}

.catalog-list .lora-card button:disabled {
  background: #1f1f1f;
  color: #777;
}

.empty-state svg {
  width: 36px;
  height: 36px;
}

.media-expand svg,
.icon-button svg {
  pointer-events: none;
}

.ratio-shape {
  display: block;
  width: 32px;
  height: 32px;
  overflow: visible;
  border: 0;
}

.ratio-shape rect {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.generation-media img,
.generation-media video {
  aspect-ratio: auto;
}
.media-retry { position: absolute; z-index: 4; left: 12px; bottom: 12px; max-width: calc(100% - 24px); }
.lora-preview, .review-preview { position: relative; }
.media-frame { position: relative; width: 100%; }
.media-space { display: block; width: 100%; height: auto; max-height: 460px; pointer-events: none; }
.generation-media .media-frame > img, .generation-media .media-frame > video,
.review-preview .media-frame > img, .review-preview .media-frame > video {
  position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: contain;
}
/* Operational controls share the existing typography and remain usable on mobile. */
.operations-list { display: grid; gap: 24px; margin-top: 24px; }
.operations-list pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.operations-list details { padding-top: 16px; }
.operations-list code { overflow-wrap: anywhere; }
.operations-list .plain-section { min-width: 0; }
.topbar nav { overflow-x: auto; flex-wrap: wrap; }
#budgetsForm, #passwordForm { max-width: 680px; margin-bottom: 32px; }
.creator-row .row-actions { flex-wrap: wrap; }
/* File drag feedback stays active independently of OS animation preferences. */
.drop-zone { isolation: isolate; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.drop-zone:focus-visible { outline: 2px solid #c5f5b4; outline-offset: 4px; }
.drop-zone > small { text-align: center; line-height: 1.6; }
.drop-zone .source-replace { position: absolute; z-index: 1; bottom: 12px; left: 12px; right: 12px; padding: 8px 12px; border-radius: 9px; background: #111e; color: #eee; font-size: 11px; }
.source-drop-overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; background: #142019; color: #d7f9c9; opacity: 0; transform: scale(.97); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.source-drop-overlay svg { width: 52px; height: 52px; }
.drop-zone .source-drop-overlay small { color: #bad2b4; }
.drop-zone.is-dragging { border-color: #b9ed9f; box-shadow: 0 0 0 4px #b9ed9f24; }
.drop-zone.is-dragging .source-drop-overlay { opacity: 1; transform: scale(1); }
.drop-zone.is-dragging .source-drop-overlay svg { animation: source-drop-float 1s ease-in-out infinite; }
.drop-zone.source-arrived { animation: source-accepted .7s ease-out; }
.drop-zone[aria-busy="true"] { border-color: #b9ed9f; }
#sourceError:empty { display: none; }
@keyframes source-drop-float { 0%, 100% { transform: translateY(2px); } 50% { transform: translateY(-5px); } }
@keyframes source-accepted { 0% { box-shadow: 0 0 0 6px #b9ed9f60; border-color: #b9ed9f; } 100% { box-shadow: 0 0 0 0 #b9ed9f00; } }
.generation-loras { display: flex; gap: 8px; max-width: 100%; min-width: 0; margin: 12px 0; padding: 2px 2px 8px; list-style: none; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #555 transparent; }
.generation-loras:focus-visible { outline: 1px solid #c5f5b4; outline-offset: 3px; border-radius: 10px; }
.generation-lora { flex: 0 0 220px; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px; border: 1px solid #2b2b2b; border-radius: 10px; background: #141414; }
.generation-lora-preview { position: relative; flex: 0 0 48px; width: 48px; height: 48px; overflow: hidden; border-radius: 6px; background: #222; }
.generation-lora-preview img, .generation-lora-preview video { display: block; width: 100%; height: 100%; object-fit: cover; }
.generation-lora-placeholder { display: grid; place-items: center; height: 100%; color: #888; }
.generation-lora-placeholder svg { width: 22px; height: 22px; }
.generation-lora-copy { min-width: 0; display: grid; gap: 4px; }
.generation-lora-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 550; color: #e4e4e4; }
.generation-lora-copy small { font-size: 11px; color: #aaa; }

.creator-topbar { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 24px; padding-block: 10px; }
.creator-topbar nav { justify-content: center; }
.creator-topbar .account { gap: 16px; min-width: 0; }
.account-balance { display: grid; gap: 3px; padding-left: 16px; border-left: 1px solid #393939; white-space: nowrap; }
.account-balance > span { font-size: 10px; color: #aaa; }
.platform-defaults { grid-template-columns: 1.4fr repeat(4, minmax(110px, 1fr)) auto; }
.account-balance strong { color: #fff; font-size: 16px; font-variant-numeric: tabular-nums; }
.account-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-quota { --quota-color: #b9e4a0; display: grid; gap: 3px; width: 210px; padding: 8px 12px; border: 1px solid #30372d; border-radius: 10px; background: #11160f; }
.header-quota.quota-medium { --quota-color: #edc66d; background: #19160f; border-color: #3c3422; }
.header-quota.quota-low { --quota-color: #f08a9b; background: #1d1114; border-color: #47242c; }
.header-quota-title, .header-quota-amount { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.header-quota-title > span { font-size: 10px; color: #ddd; }
.header-quota-title > small { color: var(--quota-color); font-size: 9px; white-space: nowrap; }
.header-quota-amount strong { color: var(--quota-color); font-size: 16px; font-variant-numeric: tabular-nums; }
.header-quota-amount > span, .header-quota-hint { color: #999; font-size: 9px; }
.header-quota progress { appearance: none; display: block; width: 100%; height: 4px; margin: 2px 0; overflow: hidden; border: 0; border-radius: 4px; background: #ffffff14; color: var(--quota-color); }
.header-quota progress::-webkit-progress-bar { background: #ffffff14; border-radius: 4px; }
.header-quota progress::-webkit-progress-value { background: var(--quota-color); border-radius: 4px; transition: width .25s ease; }
.header-quota progress::-moz-progress-bar { background: var(--quota-color); border-radius: 4px; }
.header-quota { width: 265px; }
.header-quota-details { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: #aaa; }
.header-quota-details b { color: #eee; font-weight: 500; }
.generation-estimate { margin: 0; color: #c5dfb8; font-size: 13px; }
.estimation-section { margin-top: 32px; }
.estimation-settings, .estimation-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.estimation-row { margin: 16px 0; padding: 16px; border: 1px solid #333; border-radius: 10px; }
.estimation-stat { grid-column: 1 / -1; color: #aaa; margin: 0; font-size: 12px; }
@media (max-width: 680px) {
  .estimation-settings, .estimation-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header-quota-title { flex-wrap: wrap; gap: 0 8px; }
  .header-quota-details { flex-direction: column; gap: 0; }
}
@media (max-width: 1100px) {
  .platform-defaults { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .creator-topbar { grid-template-columns: auto 1fr; gap: 8px 16px; }
  .creator-topbar nav { justify-content: flex-start; }
}
@media (max-width: 680px) {
  .creator-topbar { position: relative; grid-template-columns: minmax(0, 1fr); padding: 12px 16px; gap: 12px; }
  .creator-topbar nav { grid-column: 1; grid-row: 3; flex-wrap: nowrap; }
  .creator-topbar .account { display: grid; grid-template-columns: minmax(0, 1fr) auto 36px; gap: 12px; }
  .creator-topbar .header-quota { width: 100%; padding: 8px 10px; }
  .creator-topbar .account-name { grid-column: 1 / -1; grid-row: 2; max-width: 100%; font-size: 11px; color: #aaa; }
  .creator-topbar .account .icon-button { width: 36px; height: 36px; }
  .creator-topbar .account-balance { padding-left: 12px; }
}

/* Result controls stay available to touch and keyboard users as well as on hover. */
.result-controls { position: absolute; z-index: 3; inset: auto 0 0; display: flex; align-items: center; gap: 8px; padding: 28px 10px 10px; color: #fff; background: linear-gradient(transparent, #000d); }
.result-controls button { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; padding: 9px; border: 0; border-radius: 50%; background: #191919cc; color: #fff; cursor: pointer; }
.result-controls button:hover { background: #444; }
.result-controls svg { width: 20px; height: 20px; }
.result-controls button:focus-visible, .result-seek:focus-visible { outline: 2px solid #c5f5b4; outline-offset: 3px; }
.result-time { flex: none; font-size: 11px; font-variant-numeric: tabular-nums; }
.result-controls .result-seek { min-width: 0; flex: 1; width: 100%; height: 32px; padding: 0; margin: 0; accent-color: #c5f5b4; cursor: pointer; }
.generation-media:has(.result-player) > .media-expand { top: 12px; bottom: auto; }

/* Both media and caption must fit inside the dialog's allocated grid tracks. */
.media-lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; width: calc(100vw - 24px); height: calc(100dvh - 24px); max-width: none; max-height: none; overflow: hidden; }
.media-lightbox > .dialog-close { position: absolute; top: 12px; right: 12px; float: none; margin: 0; background: #222d; }
.media-lightbox .lightbox-media { min-width: 0; min-height: 0; height: 100%; padding: 12px; overflow: hidden; }
.media-lightbox .lightbox-media > img, .media-lightbox .lightbox-media > video { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.media-lightbox .lightbox-caption { min-width: 0; min-height: 0; gap: 12px; padding: 14px 20px; }
.media-lightbox .lightbox-caption > div:first-child { min-width: 0; }
.media-lightbox .lightbox-facts { flex-shrink: 0; }
body:has(.media-lightbox[open]) { overflow: hidden; }
@media (max-width: 820px) {
  .media-lightbox .lightbox-caption { gap: 8px; padding: 12px; }
  .media-lightbox .lightbox-caption > div:first-child { width: 100%; }
}
@media (max-width: 680px) {
  .media-lightbox[open] { width: 100vw; height: 100dvh; border-radius: 0; }
  .media-lightbox .lightbox-media { padding: 6px; }
}
@media (max-height: 480px) {
  .media-lightbox .lightbox-caption { flex-direction: row; align-items: center; padding: 8px 12px; }
  .media-lightbox .lightbox-caption > div:first-child { max-width: 50%; }
}
