/* =========================================================================
   Flomax.ai Studio — workspace, gallery, composer, lightbox.
   ========================================================================= */

/* ==================================================================== topbar */

.studio { min-height: 100dvh; }

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 13, 16, .78);
  backdrop-filter: blur(20px) saturate(1.4);
}

.topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding-left: 8px;
}

.topbar-crumb {
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  transition: background .16s, color .16s, border-color .16s;
}

.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn--sm { width: 32px; height: 32px; }
.icon-btn--sm svg { width: 18px; height: 18px; }

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 7px 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 1px rgba(20, 20, 25, .03);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}

.credit-pill:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.credit-pill > svg { width: 17px; height: 17px; color: var(--gold); }

.credit-label {
  color: var(--ink-3);
  font-weight: 500;
}

.credit-plus {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
}

.credit-plus svg { width: 14px; height: 14px; }
.credit-pill:hover .credit-plus { background: var(--primary); color: var(--primary-ink); }

.account { position: relative; }

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(120% 120% at 20% 10%, rgba(255, 255, 255, .38), transparent 55%),
    linear-gradient(135deg, #6813fd, #0248fc 55%, #01d8fc);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
  transition: transform .16s var(--ease), box-shadow .16s;
}

.avatar:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 6px 16px rgba(47, 84, 180, .26);
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: 288px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transform-origin: top right;
  animation: menu-in .18s var(--ease);
  z-index: 70;
}

@keyframes menu-in {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.menu-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px 12px;
}

.menu-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6813fd, #0248fc 55%, #01d8fc);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.menu-email {
  max-width: 190px;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-credits { margin-top: 1px; color: var(--ink-3); font-size: 11.5px; }

.menu-sep { height: 1px; margin: 4px 8px; background: var(--line); }

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  text-align: left;
  transition: background .15s, color .15s;
}

.menu-item svg { width: 18px; height: 18px; }
.menu-item:hover { background: var(--surface-2); color: var(--ink); }
.menu-item--danger:hover { background: var(--danger-soft); color: var(--danger); }

/* =================================================================== sidebar */

.sidebar {
  position: fixed;
  left: 0;
  top: var(--topbar-h);
  bottom: 0;
  z-index: 50;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px 14px;
  border-right: 1px solid var(--line);
  background: rgba(13, 13, 16, .55);
  backdrop-filter: blur(18px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.new-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 0;
  border-radius: 13px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .35);
  transition: background .16s, transform .16s var(--ease);
}

.new-btn:hover { background: #dcdce2; }
.new-btn:active { transform: scale(.99); }

.new-btn-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .08);
}

.new-btn-icon svg { width: 15px; height: 15px; }
.new-btn kbd {
  margin-left: auto;
  border-color: rgba(0, 0, 0, .18);
  background: rgba(0, 0, 0, .06);
  color: rgba(16, 16, 20, .55);
}

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

.nav-label {
  margin: 14px 10px 7px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.nav-label:first-child { margin-top: 2px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: background .15s, color .15s, box-shadow .15s;
}

.nav-item svg { width: 18px; height: 18px; color: var(--ink-3); }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }
.nav-item.is-active {
  background: rgba(255, 255, 255, .10);
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
}
.nav-item.is-active svg { color: var(--ink); }

.nav-count {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sidebar-spacer { flex: 1; min-height: 10px; }

.sidebar-credit {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(140px 90px at 100% 0%, rgba(242, 166, 0, .14), transparent 65%),
    radial-gradient(140px 90px at 0% 100%, rgba(2, 72, 252, .14), transparent 65%),
    var(--surface);
}

.sidebar-credit-top { display: flex; align-items: center; gap: 10px; }

.sidebar-credit-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--gold);
}

.sidebar-credit-icon svg { width: 18px; height: 18px; }
.sidebar-credit-value { font-size: 12.5px; font-weight: 700; }
.sidebar-credit-note { color: var(--ink-3); font-size: 10.5px; }

.sidebar-credit-btn {
  width: 100%;
  height: 32px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  transition: background .15s, border-color .15s;
}

.sidebar-credit-btn:hover { background: var(--surface-2); border-color: var(--line-strong); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 0;
}

.sidebar-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #6813fd, #0248fc 55%, #01d8fc);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
}

.sidebar-email {
  flex: 1;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scrim { display: none; }

/* ==================================================================== canvas */

.canvas {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-height: 100dvh;
  padding: calc(var(--topbar-h) + 40px) clamp(22px, 4vw, 64px) 300px;
}

.hero {
  max-width: 880px;
  margin: 0 auto 34px;
  padding-top: 12px;
  text-align: center;
}

/* Once there is work in the library, the marketing hero gets out of the way. */
.studio.has-creations .hero {
  margin-bottom: 28px;
  padding-top: 0;
}

.studio.has-creations .hero-badge { margin-bottom: 12px; }
.studio.has-creations .hero h1 { font-size: clamp(30px, 3.6vw, 44px); }
.studio.has-creations .hero-lede,
.studio.has-creations .suggestions { display: none; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .035em;
  backdrop-filter: blur(8px);
}

.hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px var(--yellow-soft);
}

.hero h1 {
  font-size: clamp(38px, 5.9vw, 72px);
  font-weight: 500;
  line-height: .99;
  letter-spacing: -.058em;
}

.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lede {
  max-width: 610px;
  margin: 22px auto 0;
  color: var(--ink-2);
  font-size: clamp(14.5px, 1.5vw, 16.5px);
  line-height: 1.6;
  letter-spacing: -.008em;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 24px;
}

.suggestion {
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  transition: background .15s, color .15s, border-color .15s, transform .15s var(--ease);
}

.suggestion::before {
  content: "✦";
  margin-right: 7px;
  color: #a978ff;
  font-size: 10px;
}

.suggestion:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, .10);
  color: var(--ink);
  transform: translateY(-1px);
}

/* =================================================================== library */

.library {
  max-width: 1220px;
  margin: 0 auto;
  scroll-margin-top: 90px;
}

.library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.library-title-wrap h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.03em;
}

.library-title-wrap p {
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
}

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

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 220px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  transition: border-color .16s, box-shadow .16s;
}

.search:focus-within {
  border-color: rgba(79, 140, 255, .55);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .12);
}

.search > svg { width: 16px; height: 16px; color: var(--ink-3); }

.search input {
  width: 100%;
  height: 100%;
  padding: 0 4px 0 7px;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  outline: none;
}

.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--ink-3); }

.search-clear {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
}

.search-clear svg { width: 13px; height: 13px; }

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.select-wrap > svg {
  position: absolute;
  right: 10px;
  width: 14px;
  height: 14px;
  color: var(--ink-3);
  pointer-events: none;
}

.select-wrap select {
  height: 100%;
  padding: 0 31px 0 13px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.view-toggle {
  display: flex;
  align-items: center;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.view-toggle button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  transition: background .15s, color .15s;
}

.view-toggle button svg { width: 16px; height: 16px; }
.view-toggle button:hover { color: var(--ink); }
.view-toggle button.is-active { background: var(--surface-2); color: var(--ink); }

.filters {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter {
  flex: none;
  height: 32px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  transition: background .15s, color .15s, border-color .15s;
}

.filter:hover { background: rgba(255, 255, 255, .06); color: var(--ink); }
.filter.is-active {
  border-color: transparent;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* ==================================================================== gallery */

/* Row-based wrapping grid: cards fill each row left to right, then wrap to the
   next row. (Was CSS multi-columns, which flowed top to bottom instead.) */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(282px, 1fr));
  gap: 16px;
  align-items: start;
}

.asset-card {
  position: relative;
  width: 100%;
  min-width: 0;
  animation: card-in .35s var(--ease) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.asset-card[data-ratio="2"] { width: 68%; margin-inline: auto; }

.asset-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 17px;
  background: var(--surface-3);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .30), 0 10px 30px rgba(0, 0, 0, .28);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
  cursor: pointer;
}

.asset-card[data-ratio="2"] .asset-media { aspect-ratio: 9 / 16; }

.asset-card.is-ready:hover .asset-media {
  transform: translateY(-3px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 22px 50px rgba(0, 0, 0, .45);
}

.asset-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}

.media-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 8, 12, .02) 35%, rgba(8, 8, 12, .62) 100%);
  opacity: .55;
  transition: opacity .25s;
  pointer-events: none;
}

.asset-card:hover .media-veil { opacity: .9; }

.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, .40);
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.9);
  backdrop-filter: blur(8px);
  transition: opacity .22s, transform .22s var(--ease);
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.play-badge svg { width: 20px; height: 20px; margin-left: 2px; }

.asset-card:hover .play-badge,
.asset-card:focus-within .play-badge {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.asset-badges {
  position: absolute;
  left: 9px;
  top: 9px;
  right: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.asset-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}

.asset-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(14, 14, 18, .48);
  color: rgba(255, 255, 255, .92);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .015em;
  backdrop-filter: blur(10px);
}

.asset-pill svg { width: 11px; height: 11px; }

.asset-pill--live { background: rgba(255, 255, 255, .90); color: #1b1b1f; border-color: transparent; }

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 0 rgba(255, 214, 10, .5);
  animation: live-pulse 1.6s infinite;
}

@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 214, 10, .45); }
  70% { box-shadow: 0 0 0 6px rgba(255, 214, 10, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 214, 10, 0); }
}

.asset-star {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, .20);
  border-radius: 50%;
  background: rgba(14, 14, 18, .40);
  color: rgba(255, 255, 255, .9);
  opacity: 0;
  transition: opacity .18s, background .15s, transform .15s var(--ease);
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.asset-star svg { width: 15px; height: 15px; }
.asset-star:hover { background: rgba(14, 14, 18, .72); transform: scale(1.06); }
.asset-star.is-on { opacity: 1; color: var(--gold); }
.asset-card:hover .asset-star,
.asset-card:focus-within .asset-star { opacity: 1; }

/* Star + delete share the top-right corner; delete stays hidden until hover
   so the card keeps its clean look, and never shows while generating. */
.asset-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.asset-del {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, .20);
  border-radius: 50%;
  background: rgba(14, 14, 18, .40);
  color: rgba(255, 255, 255, .9);
  opacity: 0;
  transition: opacity .18s, background .15s, color .15s, transform .15s var(--ease);
  pointer-events: auto;
  backdrop-filter: blur(10px);
}

.asset-del svg { width: 15px; height: 15px; }
.asset-del:hover { background: var(--danger-soft); border-color: rgba(242, 139, 130, .45); color: var(--danger); transform: scale(1.06); }
.asset-card:hover .asset-del,
.asset-card:focus-within .asset-del { opacity: 1; }

/* Touch devices never hover: keep both corner buttons reachable. */
@media (hover: none) {
  .asset-star, .asset-del { opacity: 1; }
}

.asset-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 34px 12px 11px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s, transform .22s var(--ease);
  pointer-events: none;
}

.asset-card:hover .asset-overlay,
.asset-card:focus-within .asset-overlay {
  opacity: 1;
  transform: none;
}

.asset-prompt {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 9px;
  color: rgba(255, 255, 255, .94);
  font-size: 11.5px;
  line-height: 1.42;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .35);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.asset-actions {
  display: flex;
  gap: 5px;
  pointer-events: auto;
}

.asset-action {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  backdrop-filter: blur(10px);
  transition: background .15s, transform .15s var(--ease);
}

.asset-action svg { width: 15px; height: 15px; }
.asset-action:hover { background: rgba(255, 255, 255, .32); transform: translateY(-1px); }
.asset-action--danger:hover { background: var(--danger-soft); border-color: rgba(242, 139, 130, .45); color: var(--danger); }

/* generating card */

.gen-surface {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(100% 100% at 18% 8%, rgba(2, 72, 252, .42), transparent 56%),
    radial-gradient(100% 100% at 86% 20%, rgba(1, 216, 252, .40), transparent 54%),
    radial-gradient(110% 100% at 52% 108%, rgba(242, 166, 0, .34), transparent 58%),
    linear-gradient(145deg, #17171d, #24232b 58%, #15151a);
  overflow: hidden;
}

.gen-surface::after {
  content: "";
  position: absolute;
  inset: -60%;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(255, 255, 255, .13) 22deg, transparent 48deg);
  animation: gen-sweep 5s linear infinite;
}

@keyframes gen-sweep {
  to { transform: rotate(360deg); }
}

.gen-orb {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: conic-gradient(from 90deg, #6813fd, #0248fc, #01d8fc, #6813fd);
  filter: blur(7px) saturate(1.2);
  animation: gen-spin 3.6s linear infinite, gen-breathe 2.8s var(--ease) infinite;
  opacity: .9;
}

.gen-orb::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #fdfdff;
  filter: blur(5px);
}

@keyframes gen-spin { to { rotate: 360deg; } }
@keyframes gen-breathe {
  0%, 100% { transform: scale(.94); }
  50% { transform: scale(1.08); }
}

.gen-copy {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 13px;
  color: #fff;
}

.gen-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

.gen-label svg { width: 14px; height: 14px; opacity: .9; }

.gen-time {
  position: absolute;
  right: 0;
  bottom: 0;
  color: rgba(255, 255, 255, .55);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.gen-bar {
  height: 3px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
}

.gen-bar span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  animation: gen-bar 1.6s var(--ease) infinite;
}

@keyframes gen-bar {
  from { transform: translateX(-110%); }
  to { transform: translateX(330%); }
}

/* failed / expired card */

.still-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 20px;
  background:
    radial-gradient(90% 80% at 50% 0%, rgba(255, 255, 255, .05), transparent 70%),
    var(--surface-2);
  color: var(--ink-3);
  text-align: center;
}

.still-message svg { width: 22px; height: 22px; }
.still-message strong { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.still-message span { max-width: 220px; font-size: 10.5px; line-height: 1.45; }

.still-message--failed {
  background:
    radial-gradient(90% 80% at 50% 0%, rgba(255, 255, 255, .04), transparent 70%),
    var(--danger-soft);
}

/* list view */

.gallery.is-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery.is-list .asset-card {
  display: flex;
  width: 100%;
  margin: 0;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(20, 20, 25, .03);
  animation: none;
  transition: border-color .16s, box-shadow .16s;
}

.gallery.is-list .asset-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.gallery.is-list .asset-media {
  width: 164px;
  flex: none;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  box-shadow: none;
}

.gallery.is-list .asset-card[data-ratio="2"] .asset-media { aspect-ratio: 9 / 16; width: 92px; }
.gallery.is-list .asset-card[data-ratio="2"] { width: 100%; }

.gallery.is-list .asset-overlay,
.gallery.is-list .asset-badges,
.gallery.is-list .play-badge { display: none; }

.asset-body {
  display: none;
  flex: 1;
  min-width: 0;
  padding: 4px 2px;
}

.gallery.is-list .asset-body { display: flex; flex-direction: column; }

.asset-body-prompt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.asset-body-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 10.5px;
}

.asset-body-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.asset-body-meta svg { width: 12px; height: 12px; }
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

.asset-body-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
}

.mini-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
}

.mini-btn svg { width: 13px; height: 13px; }
.mini-btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.mini-btn--dark { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.mini-btn--dark:hover { background: #dcdce2; border-color: #dcdce2; color: var(--primary-ink); }
.mini-btn.is-on { color: var(--gold); border-color: rgba(242, 181, 68, .32); background: var(--gold-soft); }
.mini-btn--danger:hover { background: var(--danger-soft); border-color: rgba(242, 139, 130, .45); color: var(--danger); }

.asset-body-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
}

.asset-body-status.is-live { color: #f28b82; }
.asset-body-status.is-ready { color: var(--success); }
.asset-body-status svg { width: 12px; height: 12px; }

/* ===================================================================== empty */

.empty {
  padding: 0 0 20px;
  text-align: center;
}

.empty-art {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
}

.empty-art > svg {
  position: relative;
  z-index: 2;
  width: 22px;
  height: 22px;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .2));
}

.empty-orb {
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  background: conic-gradient(from 100deg, #6813fd, #0248fc, #01d8fc, #6813fd);
  filter: blur(6px);
  animation: gen-spin 8s linear infinite;
}

.empty-orb::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #f3edff 60%, #e9e0ff);
  filter: blur(2px);
}

.empty-ring {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 50%;
  animation: ring-float 4s var(--ease) infinite;
}

.empty-ring--a { inset: 5px; animation-delay: -.8s; }
.empty-ring--b { inset: -5px; opacity: .55; animation-delay: -2.2s; }

@keyframes ring-float {
  0%, 100% { transform: scale(1); opacity: .5; }
  50% { transform: scale(1.05); opacity: .9; }
}

.empty h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.025em;
}

.empty > p {
  max-width: 440px;
  margin: 5px auto 0;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.5;
}

.empty-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .15s var(--ease);
}

.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.btn:active { transform: scale(.985); }
.btn--dark { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn--dark:hover { background: #dcdce2; border-color: #dcdce2; color: var(--primary-ink); }
.btn--full { width: 100%; }

.idea-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 980px;
  margin: 22px auto 0;
  text-align: left;
}

.idea {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 142px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}

.idea::before {
  content: "";
  position: absolute;
  inset: 0 0 42%;
  opacity: .9;
  background: var(--idea-bg);
  transition: transform .5s var(--ease);
}

.idea::after {
  content: "";
  position: absolute;
  inset: 0 0 42%;
  background: linear-gradient(180deg, transparent 55%, rgba(13, 13, 16, .55));
}

.idea:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.idea:hover::before { transform: scale(1.04); }

.idea-tag {
  position: relative;
  z-index: 2;
  margin-bottom: 5px;
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.idea-text {
  position: relative;
  z-index: 2;
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.idea-arrow {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: var(--ink);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity .18s, transform .18s var(--ease);
  backdrop-filter: blur(6px);
}

.idea-arrow svg { width: 14px; height: 14px; }
.idea:hover .idea-arrow { opacity: 1; transform: none; }

.canvas-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 52px;
  color: var(--ink-3);
  font-size: 10.5px;
}

.foot-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

/* ================================================================== composer */

.composer-dock {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 28px clamp(16px, 3vw, 40px) 20px;
  background: linear-gradient(to top, var(--bg) 54%, rgba(13, 13, 16, .82) 76%, rgba(13, 13, 16, 0));
  pointer-events: none;
}

.composer {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  padding: 13px 15px 11px;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 25px;
  background: rgba(24, 24, 29, .92);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3), 0 28px 70px rgba(0, 0, 0, .55);
  backdrop-filter: blur(22px) saturate(1.3);
  pointer-events: auto;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}

.composer:focus-within {
  border-color: rgba(79, 140, 255, .38);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3), 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 4px rgba(79, 140, 255, .10);
}

.composer.is-dragover {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, .16), 0 30px 80px rgba(0, 0, 0, .5);
}

.composer-glow {
  position: absolute;
  inset: -1px;
  background: linear-gradient(110deg, rgba(2, 72, 252, .22), transparent 28%, transparent 72%, rgba(1, 216, 252, .22));
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}

.composer:focus-within .composer-glow { opacity: .55; }

.composer-top,
.prompt-wrap,
.composer-bar,
.attachments,
.composer-foot { position: relative; z-index: 1; }

.composer-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 500;
  transition: background .16s, color .16s, box-shadow .16s;
}

.mode-tab svg { width: 14px; height: 14px; }
.mode-tab:hover { color: var(--ink); }
.mode-tab.is-active {
  background: var(--surface-3);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

.composer-hint {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 10.5px;
  white-space: nowrap;
}

.attachments {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
}

/* Extend mode: the source clip replaces the settings row. */
.source-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.source-chip-icon {
  flex: none;
  width: 17px;
  height: 17px;
  color: var(--gold);
}

.source-chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.source-chip-text strong {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
}

.source-chip-text small {
  overflow: hidden;
  color: var(--ink-3);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-chip-x {
  display: grid;
  place-items: center;
  flex: none;
  margin-left: auto;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
}

.source-chip-x:hover { background: var(--surface-3); color: var(--ink); }
.source-chip-x svg { width: 12px; height: 12px; }

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

.attachment {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 11px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

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

.attachment-remove {
  position: absolute;
  right: 3px;
  top: 3px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(14, 14, 18, .62);
  color: #fff;
  backdrop-filter: blur(4px);
}

.attachment-remove svg { width: 11px; height: 11px; }

.attach-drop {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 58px;
  padding: 0 13px;
  border: 1px dashed rgba(255, 255, 255, .18);
  border-radius: 11px;
  background: rgba(255, 255, 255, .03);
  color: var(--ink-3);
  text-align: left;
  transition: border-color .15s, background .15s, color .15s;
}

.attach-drop:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink-2); }
.attach-drop svg { width: 18px; height: 18px; }
.attach-drop span { display: block; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.attach-drop small { display: block; font-size: 9.5px; color: var(--ink-3); }

.prompt-wrap { position: relative; }

.prompt-wrap textarea {
  display: block;
  width: 100%;
  min-height: 58px;
  max-height: 190px;
  padding: 11px 2px 5px;
  border: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -.008em;
  outline: none;
  resize: none;
  overflow-y: auto;
}

.prompt-wrap textarea::placeholder { color: #6c6c78; }

.prompt-count {
  position: absolute;
  right: 2px;
  bottom: 4px;
  color: #6c6c78;
  font-size: 9.5px;
  opacity: 0;
  transition: opacity .2s;
  font-variant-numeric: tabular-nums;
}

.prompt-wrap.is-near .prompt-count { opacity: 1; }

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.composer-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tool-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  transition: background .15s, color .15s;
}

.tool-btn svg { width: 18px; height: 18px; }
.tool-btn:hover { background: var(--surface-2); color: var(--ink); }

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.model-spark { width: 14px; height: 14px; color: #a978ff; }

.model-tag {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.composer-settings {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.seg {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 27px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
  font-variant-numeric: tabular-nums;
}

.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active {
  background: var(--surface-3);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.ratio-icon {
  display: inline-block;
  border: 1.4px solid currentColor;
  border-radius: 1.5px;
  opacity: .75;
}

.ratio-icon--wide { width: 13px; height: 8px; }
.ratio-icon--tall { width: 8px; height: 13px; }

.generate {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px 0 5px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -.005em;
  transition: background .16s, transform .16s var(--ease), opacity .16s;
  overflow: hidden;
}

.generate:hover { background: #dcdce2; }
.generate:active { transform: scale(.985); }
.generate:disabled { opacity: .55; }

.generate-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .08);
}

.generate-icon svg { width: 16px; height: 16px; }

.generate .btn-spinner { display: none; }
.generate.is-loading .generate-icon { display: none; }
.generate.is-loading .generate-label { display: none; }
.generate.is-loading .btn-spinner { display: block; margin: 0 4px; }

.btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(0, 0, 0, .20);
  border-top-color: var(--primary-ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 9.5px;
}

.cost-line { display: inline-flex; align-items: center; gap: 4px; }
.cost-line svg { width: 12px; height: 12px; color: var(--gold); }
.foot-hint { display: inline-flex; align-items: center; gap: 3px; }
.foot-hint kbd { height: 17px; min-width: 17px; font-size: 9px; border-radius: 4px; }

/* ================================================================== lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(14px);
  animation: fade-in .22s var(--ease);
}

@keyframes fade-in { from { opacity: 0; } }

.lightbox-close {
  position: absolute;
  right: 22px;
  top: 22px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: rgba(255, 255, 255, .10);
  color: #fff;
  backdrop-filter: blur(8px);
  transition: background .15s, transform .15s;
}

.lightbox-close:hover { background: rgba(255, 255, 255, .22); transform: rotate(90deg); }

.lb-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  width: min(1240px, 100%);
  max-height: calc(100dvh - 80px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 26px;
  background: #111116;
  box-shadow: var(--shadow-lg);
  animation: lb-in .28s var(--ease);
}

@keyframes lb-in {
  from { opacity: 0; transform: translateY(12px) scale(.99); }
}

.lb-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  max-height: calc(100dvh - 80px);
  padding: 22px;
  background:
    radial-gradient(80% 70% at 50% 45%, rgba(255, 255, 255, .05), transparent 70%),
    #0b0b0e;
}

.lb-stage video {
  display: block;
  width: 100%;
  max-height: calc(100dvh - 124px);
  border-radius: 10px;
  background: #000;
  outline: none;
}

.lb-panel {
  display: flex;
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  background: var(--surface);
}

.lb-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.lb-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}

.lb-del:hover { background: var(--danger-soft); color: var(--danger); }

.lb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 600;
}

.lb-badge svg { width: 12px; height: 12px; color: #a978ff; }

#lb-star svg { width: 18px; height: 18px; }
#lb-star[aria-pressed="true"] { color: var(--gold); background: var(--gold-soft); }

.lb-prompt {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: -.025em;
}

.lb-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.lb-meta > div {
  padding: 9px 11px;
  background: var(--surface);
}

.lb-meta dt {
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.lb-meta dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.lb-expiry {
  margin-top: 10px;
  color: var(--ink-3);
  font-size: 10.5px;
}

.lb-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 22px;
}

.lb-actions .btn { width: 100%; height: 42px; justify-content: flex-start; padding-inline: 14px; }
.lb-actions .btn--dark { justify-content: center; }

.lb-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.5;
}


/* =========================================================== credit history */

.credit-history-btn { margin-top: 16px; }

.modal-card--history { width: min(520px, 100%); }

.hist-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.hist-summary > div { min-width: 0; }

/* The balance cell is the one that matters, so it gets the full row. */
.hist-summary-balance {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.hist-sum-label {
  margin: 0 0 4px;
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.hist-sum-value {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hist-summary-balance .hist-sum-value { font-size: 22px; }

.hist-sum-value.is-out,
.hist-delta.is-out { color: var(--danger); }
.hist-sum-value.is-in,
.hist-delta.is-in { color: var(--success); }

.hist-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 44vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.hist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}

.hist-row:last-child { border-bottom: 0; }

.hist-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.hist-dot--out { background: var(--danger); }
.hist-dot--in { background: var(--success); }

.hist-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }

.hist-reason {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.hist-meta {
  color: var(--ink-3);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.hist-delta {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hist-note {
  margin: 16px 0 0;
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
}

.hist-note--error { color: var(--danger); }

.hist-more { margin-top: 14px; }

@media (max-width: 560px) {
  .hist-list { max-height: 38vh; }
  .hist-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ================================================================= responsive */

.only-mobile { display: none; }

@media (max-width: 1180px) {
  :root { --sidebar-w: 244px; }
  .auth-stage { margin-left: 20px; width: 500px; }
  .stage-card--c { left: 290px; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .composer-hint { display: none; }
}

@media (max-width: 1020px) {
  .auth { grid-template-columns: 1fr 1fr; }
  .auth-stage { display: none; }
  .auth-copy { margin-top: clamp(60px, 16vh, 160px); }
  .auth-visual { padding-bottom: 48px; }
  .auth-foot { margin-top: auto; }
}

@media (max-width: 900px) {
  :root { --topbar-h: 60px; }

  .auth { grid-template-columns: 1fr; }
  .auth-visual {
    min-height: auto;
    padding: 26px 24px 30px;
  }
  .auth-copy { margin-top: 34px; }
  .auth-copy h1 { font-size: clamp(38px, 9vw, 52px); }
  .auth-lede { font-size: 14.5px; margin-top: 16px; }
  .auth-foot { display: none; }
  .auth-panel { padding: 30px 24px 50px; border-left: 0; border-top: 1px solid var(--line); }
  .auth-card { width: min(440px, 100%); margin: 0 auto; }
  .auth-card-mark { display: none; }

  .only-mobile { display: grid; }
  .topbar { padding: 0 12px; gap: 6px; }
  .topbar-center { padding-left: 2px; }
  .topbar-crumb { display: none; }
  .brand-tag { display: none; }
  .credit-label { display: none; }
  .credit-pill { padding-left: 9px; gap: 5px; }
  .topbar .avatar { width: 34px; height: 34px; }
  .topbar .icon-btn { width: 36px; height: 36px; }

  .sidebar {
    top: 0;
    z-index: 80;
    width: min(300px, 86vw);
    padding-top: 18px;
    background: var(--bg);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform .3s var(--ease);
  }

  body.nav-open .sidebar { transform: none; }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 75;
    display: block;
    border: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
    animation: fade-in .2s;
  }

  .canvas {
    margin-left: 0;
    width: 100%;
    padding: calc(var(--topbar-h) + 30px) 18px 290px;
  }

  .composer-dock { left: 0; padding: 24px 12px 12px; }
  .composer { border-radius: 22px; padding: 12px 12px 10px; }
  .composer-settings { gap: 5px; }
  .seg-btn { padding: 0 7px; }
  .model-pill { max-width: 136px; overflow: hidden; }

  .lightbox { padding: 0; align-items: stretch; }
  .lightbox-close { top: 12px; right: 12px; }
  .lb-inner {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 44dvh) minmax(0, 1fr);
    width: 100%;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .lb-stage { padding: 12px; min-height: 0; }
  .lb-stage video { max-height: 100%; }
  .lb-panel { border-radius: 22px 22px 0 0; padding: 20px; }
  .lb-actions { margin-top: 16px; flex-direction: row; flex-wrap: wrap; }
  .lb-actions .btn { flex: 1 1 46%; width: auto; min-width: 130px; }
  .lb-actions .btn--dark { flex-basis: 100%; }
}

@media (max-width: 760px) {
  .hero { margin-bottom: 28px; }
  .hero h1 { font-size: clamp(34px, 10vw, 48px); }
  .hero-lede { margin-top: 16px; }
  .suggestions { margin-top: 18px; }
  .library-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .library-tools { width: 100%; }
  .search { flex: 1; width: auto; min-width: 130px; }
  .select-wrap { display: none; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
  .asset-card[data-ratio="2"] { width: 72%; }
  .idea-grid { grid-template-columns: 1fr 1fr; }
  .canvas-foot { margin-top: 36px; }
  .composer-bar { gap: 7px; }
  .composer-settings { flex: 1; justify-content: flex-end; }
  .seg { padding: 2px; }
  .seg-btn { height: 26px; padding: 0 7px; font-size: 10px; }
  .generate { height: 38px; }
  .generate-label { display: none; }
  .generate { padding: 0 4px; }
  .generate-icon { width: 30px; height: 30px; }
  .generate .btn-spinner { margin: 0 8px; }
  .composer-foot { display: none; }
  .prompt-wrap textarea { min-height: 52px; font-size: 15.5px; }
  .mode-tab { padding: 0 8px; }
  .mode-tab svg { display: none; }
}

@media (max-width: 560px) {
  .topbar { gap: 4px; }
  .topbar-actions { gap: 2px; }
  #help-btn { display: none; }
  .credit-pill { height: 34px; font-size: 11.5px; }
  .credit-plus { width: 22px; height: 22px; }
  .canvas { padding-left: 12px; padding-right: 12px; padding-bottom: 330px; }
  .hero-badge { font-size: 10px; }
  .hero h1 { font-size: 35px; }
  .suggestions { display: none; }
  .filters { margin-bottom: 12px; }
  .library-tools { gap: 5px; }
  .gallery { grid-template-columns: 1fr; }
  .asset-card[data-ratio="2"] { width: 100%; }
  .gallery.is-list .asset-media { width: 120px; }
  .gallery.is-list .asset-card[data-ratio="2"] .asset-media { width: 76px; }
  .idea-grid { grid-template-columns: 1fr; }
  .idea { min-height: 120px; }
  .empty { padding-top: 0; }
  .empty-art { width: 64px; height: 64px; margin-bottom: 12px; }
  .composer-dock { padding: 18px 8px 8px; }
  .composer { border-radius: 20px; }
  .mode-tabs { width: 100%; }
  .mode-tab { flex: 1; justify-content: center; }
  .attachments { overflow-x: auto; }
  .composer-left { display: none; }
  .composer-settings { width: 100%; justify-content: space-between; }
  .composer-bar { flex-direction: column; align-items: stretch; }
  .gallery.is-list .asset-card { gap: 10px; }
  .lb-actions .btn { min-width: 0; }
  .toasts { right: 10px; top: calc(var(--topbar-h) + 8px); width: calc(100vw - 20px); }
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* The composer floats over the page. On screens without room for the two-row
   inspiration grid, hide it instead of leaving cards half-covered. The hero
   suggestions and the Inspiration action still provide prompts. */

@media (max-height: 1300px) {
  .idea-grid { display: none; }
}

