:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f2f2f4;
  --sidebar-bg: rgba(255, 255, 255, 0.78);
  --hover: rgba(0, 0, 0, 0.04);
  --hover-strong: rgba(0, 0, 0, 0.06);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #aeaeb2;
  --blue: #0A84FF;
  --indigo: #5E5CE6;
  --border: rgba(0, 0, 0, 0.08);
  --border-med: rgba(0, 0, 0, 0.12);
  --appstore-shot-border: rgba(0, 0, 0, 0.075);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.10), 0 0 0 1px rgba(0,0,0,0.04);
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 100px;
  --font: "OpenAI Sans", Arial, Helvetica, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0c;
  --surface: #18181b;
  --surface-2: #232327;
  --sidebar-bg: rgba(20, 20, 22, 0.82);
  --hover: rgba(255, 255, 255, 0.05);
  --hover-strong: rgba(255, 255, 255, 0.08);
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --blue: #4da3ff;
  --indigo: #8e8bff;
  --border: rgba(255, 255, 255, 0.08);
  --border-med: rgba(255, 255, 255, 0.14);
  --appstore-shot-border: rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
}

:root[data-theme="dark"] .input-card { background: rgba(28, 28, 32, 0.92); }
:root[data-theme="dark"] .landing-input-card { background: rgba(22, 22, 26, 0.90); }
:root[data-theme="dark"] .var-card-original {
  background: linear-gradient(150deg, rgba(77, 163, 255, 0.10) 0%, rgba(142, 139, 255, 0.06) 100%);
  border-color: rgba(77, 163, 255, 0.30);
}
:root[data-theme="dark"] .lang-chip.selected,
:root[data-theme="dark"] .device-pill.selected {
  background: linear-gradient(135deg, rgba(77, 163, 255, 0.22), rgba(142, 139, 255, 0.14));
  border-color: rgba(77, 163, 255, 0.55);
}
:root[data-theme="dark"] .google-icon { background: #ffffff; }
:root[data-theme="dark"] .hero-cta { background: linear-gradient(135deg, #1f1f24 0%, #1a1a1f 100%); }
:root[data-theme="dark"] .image-card img,
:root[data-theme="dark"] .sheet-img,
:root[data-theme="dark"] .frame-thumb { background: #0d0d10; }
:root[data-theme="dark"] .btn-dl-single { background: rgba(30, 30, 34, 0.92); color: var(--blue); }
:root[data-theme="dark"] .btn-dl-single:hover { background: #25252a; }
:root[data-theme="dark"] .link-input { background: rgba(255, 255, 255, 0.06); }
:root[data-theme="dark"] .link-input:focus { background: rgba(255, 255, 255, 0.09); }
:root[data-theme="dark"] .mode-tab.active { background: rgba(255, 255, 255, 0.10); }
:root[data-theme="dark"] .sidebar-foot {
  background:
    linear-gradient(180deg, rgba(24, 25, 30, 0.24), rgba(24, 25, 30, 0.84)),
    linear-gradient(135deg, rgba(77, 163, 255, 0.10), rgba(142, 139, 255, 0.07));
  border-top-color: rgba(255, 255, 255, 0.10);
  box-shadow:
    0 -18px 48px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
}
:root[data-theme="dark"] .sidebar-account {
  background:
    linear-gradient(180deg, rgba(42, 43, 48, 0.78), rgba(24, 25, 30, 0.64)),
    linear-gradient(135deg, rgba(77, 163, 255, 0.10), rgba(142, 139, 255, 0.07));
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.36);
}
:root[data-theme="dark"] .sidebar-account:hover {
  background:
    linear-gradient(180deg, rgba(48, 49, 55, 0.84), rgba(28, 29, 34, 0.70)),
    linear-gradient(135deg, rgba(77, 163, 255, 0.13), rgba(142, 139, 255, 0.09));
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font: inherit; border: none; outline: none; }
img { display: block; max-width: 100%; }

/* ── Base ── */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.modal-open { overflow: hidden; }

body.boot-auth-check #landingView,
body.boot-auth-check #appView {
  visibility: hidden;
}

.boot-auth-loader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background:
    radial-gradient(circle at 24% 14%, rgba(10, 132, 255, 0.14), transparent 34%),
    var(--bg);
  color: var(--text-2);
}

body.boot-auth-check .boot-auth-loader {
  display: flex;
}

.boot-auth-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border-med);
  border-top-color: var(--blue);
  animation: spin 0.75s linear infinite;
}

.boot-auth-loader p {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

/* ── Landing ── */
.landing-view {
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: visible;
  background: var(--bg);
}

.landing-nav {
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}

.nav-logo-mark {
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 5px 12px rgba(0, 0, 0, 0.14));
}

.nav-login-btn {
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  background: var(--hover);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  transition: background 0.18s ease, transform 0.18s ease;
}

.nav-login-btn:hover {
  background: var(--hover-strong);
  transform: translateY(-1px);
}

.nav-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  position: relative;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--hover);
  border: 1px solid var(--border);
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.theme-toggle:hover {
  background: var(--hover-strong);
  border-color: var(--border-med);
  transform: translateY(-1px);
}

.theme-toggle-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: inset -6px -5px 0 var(--surface);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

:root[data-theme="dark"] .theme-toggle-icon {
  box-shadow:
    0 -7px 0 -5px currentColor,
    5px -5px 0 -5px currentColor,
    7px 0 0 -5px currentColor,
    5px 5px 0 -5px currentColor,
    0 7px 0 -5px currentColor,
    -5px 5px 0 -5px currentColor,
    -7px 0 0 -5px currentColor,
    -5px -5px 0 -5px currentColor;
  transform: scale(0.86);
}

.sidebar-theme-toggle {
  width: 100%;
  border-radius: 14px;
}

.nav-profile {
  position: relative;
}

.nav-profile-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.nav-profile-btn:hover {
  transform: translateY(-1px);
}

.nav-profile-img,
.nav-profile-head-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-profile-initials,
.nav-profile-head-initials {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 15px;
  font-weight: 700;
  color: var(--surface);
  background: linear-gradient(145deg, #3e7cff 0%, #2959dd 100%);
}

.nav-profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(92vw, 320px);
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideDown 0.18s ease both;
  z-index: 30;
}

.nav-profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.nav-profile-head-img,
.nav-profile-head-initials {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
}

.nav-profile-meta {
  min-width: 0;
}

.nav-profile-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.nav-profile-email {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-profile-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  border-top: 1px solid var(--border);
}

.nav-profile-item:hover {
  background: var(--hover);
}

.nav-profile-item.danger {
  color: #d14343;
}

.landing-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 42px;
  padding: 54px 0 78px;
}

.hero {
  width: min(100% - 32px, 900px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeSlideUp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.hero-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.hero-brand-mark {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.16));
}

.hero-kicker {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-3);
}

.hero h1 {
  max-width: 820px;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text);
  background: linear-gradient(180deg, var(--text) 0%, var(--text) 60%, var(--text-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-copy {
  max-width: 650px;
  margin-top: 14px;
  color: var(--text-2);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.45;
}

.landing-stage-fan .hero-brand,
.landing-stage-fan .hero > h1,
.landing-stage-fan .hero-copy {
  display: none;
}

.landing-input-mount {
  width: min(100%, 760px);
  margin-top: 30px;
}

.landing-designed-note {
  width: min(100%, 760px);
  margin-top: 16px;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 650;
  text-align: center;
}

.landing-fetch-mount {
  width: min(100%, 860px);
  margin-top: 0;
}

.landing-stage-fan .landing-fetch-mount {
  margin-bottom: 18px;
  min-height: clamp(310px, 44vh, 460px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.landing-stage-fan .landing-input-mount {
  margin-top: 0;
}

.landing-footer {
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
  padding: 12px 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-3);
  font-size: 13px;
}

.landing-footer nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.landing-footer a,
.auth-card .auth-terms a,
.legal-document a,
.legal-back-link {
  color: var(--blue);
  text-decoration: none;
}

.landing-footer a:hover,
.auth-card .auth-terms a:hover,
.legal-document a:hover,
.legal-back-link:hover {
  text-decoration: underline;
}

.legal-page {
  width: min(100% - 32px, 880px);
  margin: 0 auto;
  padding: 34px 0 72px;
}

.legal-back-link {
  display: inline-flex;
  margin-bottom: 28px;
  font-size: 15px;
  font-weight: 700;
}

.legal-document {
  padding: 44px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.legal-kicker {
  margin-bottom: 10px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.legal-document h1 {
  margin-bottom: 24px;
  color: var(--text);
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0;
}

.legal-document h2 {
  margin: 30px 0 10px;
  color: var(--text);
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
}

.legal-document p {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1.65;
}

.landing-composer {
  width: min(100%, 760px);
  margin-top: 34px;
  padding: 10px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  text-align: left;
}

.landing-composer textarea {
  width: 100%;
  min-height: 118px;
  resize: none;
  padding: 18px 18px 8px;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
}

.landing-composer textarea::placeholder { color: var(--text-3); }

.landing-composer-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px;
}

.landing-tool-btn,
.landing-style-btn {
  height: 42px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.landing-tool-btn {
  width: 42px;
}

.landing-style-btn {
  padding: 0 18px;
  font-size: 14px;
  font-weight: 650;
}

.landing-generate-btn {
  width: auto;
  margin: 0 0 0 auto;
  padding: 0 20px;
  min-height: 44px;
  font-size: 15px;
}

.btn-google {
  min-height: 48px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border-med);
  box-shadow: var(--shadow-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn-google:hover {
  transform: translateY(-2px);
  border-color: rgba(10, 132, 255, 0.32);
  box-shadow: var(--shadow-lg);
}

.btn-google-small {
  min-height: 42px;
  padding-inline: 18px;
  box-shadow: var(--shadow-sm);
}

.hero-cta {
  margin-top: 30px;
  min-height: 58px;
  padding-inline: 30px;
  background: linear-gradient(135deg, #ffffff 0%, #f9fbff 100%);
}

.google-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #4285f4;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.showcase-carousel {
  width: 100%;
  overflow: hidden;
  padding: 34px 0 58px;
  mask-image: linear-gradient(90deg, transparent 0, black 8%, black 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, black 8%, black 92%, transparent 100%);
}

.showcase-track {
  display: flex;
  gap: 22px;
  width: max-content;
  animation: carouselDrift 95s linear infinite;
}

.showcase-track img {
  width: min(25vw, 280px);
  min-width: 180px;
  aspect-ratio: 1242 / 2688;
  object-fit: cover;
  border-radius: 24px;
  border: 1px solid var(--appstore-shot-border);
  background: var(--surface);
  box-shadow:
    var(--shadow-lg),
    inset 0 0 0 1px var(--appstore-shot-border);
}

.showcase-carousel:hover .showcase-track {
  animation-play-state: paused;
}

/* ── App shell ── */
.app-view {
  display: flex;
  min-height: 100dvh;
  background: var(--bg);
  animation: fadeIn 0.26s ease both;
  position: relative;
}

/* ── Sidebar ── */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  min-height: 100dvh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  padding: 0 0 18px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100dvh;
  overflow: hidden;
}

.sidebar-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 30;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: color 0.16s ease, transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.app-view:not(.sidebar-collapsed) .sidebar-toggle {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar-toggle:hover {
  color: var(--text);
  background: var(--surface);
  transform: translateY(-1px);
}

.app-view:not(.sidebar-collapsed) .sidebar-toggle:hover {
  background: transparent;
}

.sidebar:not(.hidden) + .app-main,
.app-view:not(.sidebar-collapsed) .app-main {
  padding-left: 32px;
}

.sidebar-brand {
  padding: 18px 18px 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-brand-name {
  font-size: 15px;
  font-weight: 500;
  color: #000000;
  letter-spacing: 0;
}

.app-brand-mark {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.14));
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 62px 10px 116px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 10px 6px 6px;
}

.sidebar-add-btn {
  margin: 0 0 4px;
  padding: 9px 10px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
  text-align: left;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease;
}

.sidebar-add-btn:hover { background: var(--hover); }

.sidebar-add-plus {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
}

.sidebar-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 12px 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.78)),
    linear-gradient(135deg, rgba(10, 132, 255, 0.08), rgba(94, 92, 230, 0.06));
  border-top: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow:
    0 -18px 44px rgba(29, 29, 31, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
}

.sidebar-account {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 14px;
  text-align: left;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(250, 252, 255, 0.50)),
    linear-gradient(135deg, rgba(10, 132, 255, 0.08), rgba(94, 92, 230, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 12px 34px rgba(29, 29, 31, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    inset 0 -1px 0 rgba(10, 132, 255, 0.06);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
}

.sidebar-account:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(250, 252, 255, 0.58)),
    linear-gradient(135deg, rgba(10, 132, 255, 0.10), rgba(94, 92, 230, 0.08));
}

.sidebar-account-img,
.sidebar-account-initials {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.sidebar-account-img { object-fit: cover; }

.sidebar-account-initials {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
}

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

.sidebar-account-meta strong,
.sidebar-account-meta small,
.sidebar-account-credits {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-meta strong {
  font-size: 12.5px;
  font-weight: 700;
}

.sidebar-account-meta small {
  font-size: 11px;
  color: var(--text-3);
}

.sidebar-sign-out {
  width: 100%;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text-3);
  text-align: left;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-sign-out:hover {
  background: var(--hover);
  color: var(--text-2);
}

/* ── Sidebar avatar ring ── */
.sidebar-account-wrap {
  position: relative;
}

.sidebar-avatar-ring {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.sidebar-ring-svg {
  position: absolute;
  inset: -5px;
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.sidebar-ring-track {
  stroke: var(--border-med);
  stroke-width: 4;
  fill: none;
}

.sidebar-ring-fill {
  stroke: var(--blue);
  stroke-width: 4;
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.sidebar-account-img,
.sidebar-account-initials {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.sidebar-account-credits {
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sidebar profile popup menu ── */
.sidebar-profile-menu {
  position: fixed;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
  animation: spmIn 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes spmIn {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.spm-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 12px;
}

.spm-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.spm-avatar-img,
.spm-avatar-initials {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.spm-avatar-initials {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
}

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

.spm-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spm-plan {
  font-size: 11.5px;
  color: var(--text-3);
}

.spm-credits-section {
  padding: 0 10px 12px;
}

.spm-credits-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--text-2);
}

.spm-credits-label {
  font-size: 12.5px;
  font-weight: 600;
}

.spm-credits-bar {
  height: 5px;
  border-radius: 100px;
  background: var(--surface-2);
  overflow: hidden;
}

.spm-credits-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--blue);
  transition: width 0.4s ease;
}

.spm-upgrade-card {
  width: calc(100% - 12px);
  margin: 0 6px 6px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 8px 8px 10px;
  border-radius: var(--r-md);
  color: var(--text);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  text-align: left;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.spm-upgrade-card:hover {
  transform: translateY(-1px);
  border-color: rgba(10, 132, 255, 0.38);
  background: linear-gradient(180deg, var(--surface-2), var(--hover));
}

.spm-upgrade-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--blue);
}

.spm-upgrade-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.spm-upgrade-copy strong {
  font-size: 13px;
  font-weight: 750;
  line-height: 1.1;
  color: var(--text);
}

.spm-upgrade-pill {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.14);
}

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

.spm-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--r-sm);
  text-align: left;
  transition: background 0.12s ease;
}

.spm-item svg { flex: 0 0 auto; color: var(--text-2); }
.spm-item:hover { background: var(--hover); }
.spm-item-danger { color: #ff3b30; }
.spm-item-danger svg { color: #ff3b30; }
.spm-item-danger:hover { background: rgba(255, 59, 48, 0.07); }

.spm-theme-item,
.spm-notification-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}

.spm-theme-item:hover,
.spm-notification-item:hover { background: var(--hover); }

.spm-theme-item svg,
.spm-notification-item svg { flex: 0 0 auto; color: var(--text-2); }
.spm-theme-item > span,
.spm-notification-item > span { flex: 1; }

.spm-theme-toggle,
.spm-notification-toggle {
  width: 36px;
  height: 20px;
  border-radius: 100px;
  background: var(--surface-2);
  border: 1px solid var(--border-med);
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex: 0 0 auto;
}

.spm-theme-toggle.active,
.spm-notification-toggle.active {
  background: var(--blue);
  border-color: transparent;
}

.spm-theme-thumb,
.spm-notification-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spm-theme-toggle.active .spm-theme-thumb,
.spm-notification-toggle.active .spm-notification-thumb {
  transform: translateX(16px);
}

.spm-notification-toggle.blocked {
  opacity: 0.46;
}

/* ── Account Management Modal ── */
.acct-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.acct-modal.hidden { display: none; }

.acct-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: default;
  border: none;
}

.acct-modal-card {
  position: relative;
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.acct-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.acct-modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.acct-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 18px;
  display: grid;
  place-items: center;
  line-height: 1;
  transition: background 0.12s ease;
}

.acct-modal-close:hover { background: var(--hover-strong); }

.notification-permission {
  position: fixed;
  inset: 0;
  z-index: 560;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.notification-permission.hidden { display: none; }

.notification-permission-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  cursor: default;
}

.notification-permission-card {
  position: relative;
  isolation: isolate;
  width: min(430px, calc(100vw - 32px));
  border-radius: 32px;
  padding: 34px 28px 28px;
  text-align: center;
  overflow: hidden;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(250, 252, 255, 0.58)),
    linear-gradient(135deg, rgba(10, 132, 255, 0.10), rgba(94, 92, 230, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow:
    0 30px 90px rgba(29, 29, 31, 0.20),
    0 14px 46px rgba(10, 132, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  animation: notificationPermissionIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notification-permission-card::before,
.notification-permission-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.notification-permission-card::before {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.28) 34%, rgba(10, 132, 255, 0.10) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.04));
}

.notification-permission-card::after {
  inset: 1px;
  border-radius: 31px;
  box-shadow:
    inset 0 0 0 1px rgba(10, 132, 255, 0.08),
    inset 0 22px 44px rgba(255, 255, 255, 0.38);
}

.notification-permission-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.54);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.58);
}

.notification-permission-close:hover { background: rgba(255, 255, 255, 0.72); }

.notification-permission-close img {
  width: 12px;
  height: 12px;
  opacity: 0.58;
}

.notification-permission-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.28));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 0 0 1px rgba(255, 255, 255, 0.54),
    0 16px 36px rgba(29, 29, 31, 0.12);
}

.notification-permission-symbol {
  width: 34px;
  height: 34px;
  object-fit: contain;
  opacity: 0.88;
}

.notification-permission-kicker {
  font-size: 11px;
  font-weight: 760;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.notification-permission h2 {
  max-width: 330px;
  margin: 0 auto;
  font-size: 24px;
  line-height: 1.14;
  font-weight: 800;
  letter-spacing: 0;
}

.notification-permission-copy {
  max-width: 340px;
  margin: 12px auto 22px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
}

.notification-permission-enable {
  width: auto;
  min-width: 236px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 24px;
  color: #fff;
  font-size: 15px;
  font-weight: 750;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  box-shadow:
    0 14px 32px rgba(10, 132, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.notification-permission-enable:hover {
  transform: translateY(-1px);
  box-shadow:
    0 18px 38px rgba(10, 132, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

:root[data-theme="dark"] .notification-permission-card {
  background:
    linear-gradient(180deg, rgba(42, 43, 48, 0.88), rgba(24, 25, 30, 0.80)),
    radial-gradient(circle at 18% 0%, rgba(77, 163, 255, 0.18), transparent 38%);
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.52),
    0 16px 48px rgba(77, 163, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

:root[data-theme="dark"] .notification-permission-card::before {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.035) 42%, rgba(77, 163, 255, 0.10) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
}

:root[data-theme="dark"] .notification-permission-card::after {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    inset 0 20px 42px rgba(255, 255, 255, 0.055);
}

:root[data-theme="dark"] .notification-permission-close {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}

:root[data-theme="dark"] .notification-permission-close:hover {
  background: rgba(255, 255, 255, 0.13);
}

:root[data-theme="dark"] .notification-permission-close img,
:root[data-theme="dark"] .notification-permission-symbol {
  filter: invert(1);
}

:root[data-theme="dark"] .notification-permission-icon {
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.10),
    0 16px 36px rgba(0, 0, 0, 0.24);
}

.acct-modal-profile-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 0;
}

.acct-modal-avatar {
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
}

.acct-modal-avatar-img,
.acct-modal-avatar-initials {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.acct-modal-avatar-initials {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 18px;
  font-weight: 750;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
}

.acct-modal-user-info { min-width: 0; }

.acct-modal-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-modal-email {
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.acct-modal-section {
  padding: 20px 20px 0;
}

.acct-modal-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}

.acct-modal-credits-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
}

.acct-modal-credits-top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}

.acct-modal-credits-count {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
}

.acct-modal-credits-max {
  font-size: 13px;
  color: var(--text-3);
}

.acct-modal-credits-bar {
  height: 6px;
  border-radius: 100px;
  background: var(--border-med);
  overflow: hidden;
  margin-bottom: 10px;
}

.acct-modal-credits-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--blue);
  transition: width 0.4s ease;
}

.acct-modal-credits-note {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.6;
}

.acct-modal-plan-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.acct-modal-plan-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.acct-modal-plan-desc {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.acct-modal-upgrade-btn {
  padding: 7px 16px;
  background: var(--blue);
  color: white;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.acct-modal-upgrade-btn:hover { opacity: 0.88; }

.acct-modal-manage-btn {
  padding: 7px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-med);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.acct-modal-manage-btn:hover {
  background: var(--hover);
  border-color: var(--border-med);
}

.acct-modal-footer {
  padding: 20px;
  display: flex;
  justify-content: flex-end;
}

.acct-modal-signout {
  font-size: 13px;
  color: #ff3b30;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  transition: background 0.12s ease;
}

.acct-modal-signout:hover { background: rgba(255, 59, 48, 0.07); }

/* ── Pricing modal ── */
.pricing-modal {
  position: fixed;
  inset: 0;
  z-index: 620;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.pricing-modal.hidden { display: none; }

.pricing-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 16, 22, 0.48);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  cursor: default;
}

.pricing-modal-card {
  position: relative;
  width: min(1120px, calc(100vw - 32px));
  max-height: min(820px, calc(100dvh - 40px));
  overflow: auto;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 251, 255, 0.90)),
    var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 34px 90px rgba(23, 29, 45, 0.22),
    0 10px 36px rgba(10, 132, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  animation: modalIn 0.22s ease both;
}

.pricing-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 32px 18px;
}

.pricing-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--blue);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.pricing-modal-head h2 {
  font-size: 34px;
  line-height: 1.05;
  font-weight: 820;
  letter-spacing: 0;
  color: var(--text);
}

.pricing-subtitle {
  max-width: 560px;
  margin-top: 10px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.45;
}

.pricing-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.055);
  color: var(--text-2);
  font-size: 22px;
  line-height: 1;
}

.pricing-close:hover { background: rgba(0, 0, 0, 0.09); }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 390px));
  align-items: stretch;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  gap: 14px;
  padding: 12px 32px 18px;
}

.pricing-plan-card {
  --plan-accent: var(--blue);
  min-height: 430px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.58)),
    linear-gradient(135deg, rgba(10, 132, 255, 0.08), rgba(94, 92, 230, 0.05));
  border: 1px solid var(--border-med);
  box-shadow: 0 12px 34px rgba(18, 24, 38, 0.08);
}

.pricing-plan-card.featured {
  box-shadow:
    0 18px 48px rgba(10, 132, 255, 0.14),
    0 0 0 1px rgba(10, 132, 255, 0.22);
}

.pricing-plan-top {
  min-height: 82px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pricing-plan-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pricing-plan-top h3 {
  font-size: 25px;
  font-weight: 820;
  letter-spacing: 0;
  color: var(--text);
}

.pricing-savings-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 999px;
  background: #0a84ff;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow:
    0 10px 22px rgba(10, 132, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.20);
}

.pricing-plan-top p {
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-2);
}

.pricing-plan-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.12);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.pricing-go-rate {
  min-height: 20px;
  margin-top: 14px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 700;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: currentColor;
}

.pricing-go-rate.invisible {
  visibility: hidden;
}

.pricing-price-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 6px;
  color: var(--text);
}

.pricing-currency {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-2);
}

.pricing-price-row strong {
  font-size: 52px;
  line-height: 0.95;
  font-weight: 850;
  letter-spacing: 0;
}

.pricing-price-row span:last-child {
  font-size: 13px;
  color: var(--text-2);
}

.pricing-credit-pill {
  margin-top: 18px;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  width: fit-content;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.12);
  color: var(--text);
}

.pricing-credit-pill strong {
  color: var(--blue);
  font-size: 16px;
  font-weight: 850;
}

.pricing-credit-pill span {
  font-size: 12px;
  font-weight: 700;
}

.pricing-feature-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-top: 22px;
  margin-bottom: 26px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.32;
}

.pricing-feature-list li {
  position: relative;
  padding-left: 20px;
}

.pricing-feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.pricing-select-btn {
  min-height: 58px;
  margin-top: auto;
  border-radius: 999px;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5fb0ff 0%, #0a84ff 48%, #246bff 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  border: 1px solid rgba(255, 255, 255, 0.44);
  box-shadow:
    0 16px 34px rgba(10, 132, 255, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  position: relative;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease, background 0.28s ease;
}

.pricing-select-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0%, transparent 56%);
  pointer-events: none;
}

.pricing-select-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
  animation: shimmer 2.8s ease-in-out infinite 1s;
  pointer-events: none;
}

.pricing-select-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.015);
  background: linear-gradient(135deg, #66b2ff 0%, #1690ff 45%, #0a84ff 100%);
  border-color: rgba(201, 232, 255, 0.95);
  box-shadow:
    0 10px 30px rgba(10, 132, 255, 0.32),
    0 0 20px rgba(84, 188, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.pricing-select-btn:disabled {
  opacity: 0.58;
  cursor: default;
}

.pricing-plan-card.current .pricing-select-btn {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-med);
  box-shadow: none;
}

.pricing-plan-card.current .pricing-select-btn::before,
.pricing-plan-card.current .pricing-select-btn::after {
  content: none;
}

.pricing-footnote {
  padding: 0 32px 28px;
  color: var(--text-3);
  font-size: 12px;
  text-align: center;
}

:root[data-theme="dark"] .pricing-modal-card {
  background:
    linear-gradient(180deg, rgba(33, 34, 39, 0.94), rgba(20, 21, 26, 0.92)),
    var(--surface);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.58),
    0 10px 36px rgba(77, 163, 255, 0.10);
}

:root[data-theme="dark"] .pricing-plan-card {
  background:
    linear-gradient(180deg, rgba(39, 40, 46, 0.84), rgba(25, 26, 31, 0.70)),
    linear-gradient(135deg, rgba(77, 163, 255, 0.10), rgba(142, 139, 255, 0.06));
  border-color: rgba(255, 255, 255, 0.13);
}

:root[data-theme="dark"] .pricing-plan-badge,
:root[data-theme="dark"] .pricing-credit-pill {
  background: rgba(77, 163, 255, 0.16);
}

:root[data-theme="dark"] .pricing-select-btn {
  box-shadow:
    0 16px 34px rgba(10, 132, 255, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

:root[data-theme="dark"] .pricing-close {
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .pricing-close:hover {
  background: rgba(255, 255, 255, 0.13);
}

@media (max-width: 980px) {
  .pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .pricing-plan-card.featured {
    transform: none;
  }
}

@media (max-width: 620px) {
  .pricing-modal {
    padding: 12px;
  }

  .pricing-modal-card {
    width: calc(100vw - 24px);
    border-radius: 24px;
  }

  .pricing-modal-head {
    padding: 24px 20px 12px;
  }

  .pricing-modal-head h2 {
    font-size: 28px;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
    padding: 10px 18px 16px;
    width: 100%;
  }

  .pricing-plan-card {
    min-height: 0;
  }

  .pricing-footnote {
    padding: 0 20px 24px;
  }
}

/* ── Generate button credit cost badge ── */
.btn-generate-cost {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.85;
  letter-spacing: 0;
  padding-left: 2px;
  border-left: 1px solid rgba(255,255,255,0.3);
  padding-left: 8px;
  margin-left: -2px;
}

/* ── App tree in sidebar (Apps → Sets → Variations) ── */
.app-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
  cursor: grab;
  user-select: none;
}

.app-row:active {
  cursor: grabbing;
}

.app-row.is-dragging {
  opacity: 0.56;
}

.app-row.is-dragging .app-row-header {
  background: var(--hover);
}

.app-row.app-row-drop-before .app-row-header {
  box-shadow: inset 0 2px 0 var(--blue);
}

.app-row.app-row-drop-after .app-row-header {
  box-shadow: inset 0 -2px 0 var(--blue);
}

.app-row-header-wrap {
  position: relative;
}

.app-row-header {
  background: transparent;
  border: none;
  border-radius: 12px;
  width: 100%;
  padding: 8px 38px 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: background 0.16s ease;
  letter-spacing: -0.01em;
}

.app-row-header:hover { background: var(--hover); }
.app-row-header.active { background: var(--hover); }

.app-icon-tile {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: transform 0.16s ease;
}
.app-row-header:hover .app-icon-tile { transform: scale(1.04); }

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

.app-icon-tile-fallback {
  background: linear-gradient(135deg,
    hsl(var(--icon-hue, 220) 80% 64% / 0.92),
    hsl(calc(var(--icon-hue, 220) + 30) 80% 56% / 0.92));
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.02em;
}

.app-row-name {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.app-row-count {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.14s ease;
  pointer-events: none;
}

.app-row-header-wrap:hover .app-row-count,
.app-row-header-wrap.menu-open .app-row-count,
.app-row-header-wrap:focus-within .app-row-count {
  opacity: 0;
}

.app-row-more-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  color: var(--text-2);
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.app-row-header-wrap:hover .app-row-more-btn,
.app-row-header-wrap.menu-open .app-row-more-btn,
.app-row-header-wrap:focus-within .app-row-more-btn {
  opacity: 1;
  pointer-events: auto;
}

.app-row-more-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.app-row-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 8px;
  min-width: 156px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
  z-index: 30;
}

.app-row-menu-item {
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.app-row-menu-item:hover {
  background: var(--hover);
}

.app-row-menu-item.danger {
  color: #d83f3f;
}

.app-row-menu-item.danger:hover {
  background: rgba(229, 62, 62, 0.10);
}

@media (hover: none) {
  .app-row-more-btn {
    opacity: 1;
    pointer-events: auto;
  }

  .app-row-count {
    margin-right: 24px;
  }
}

.app-row-loader {
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--text-3) 22%, transparent);
  border-top-color: var(--blue);
  border-radius: 50%;
  flex-shrink: 0;
  animation: appRowSpin 1.2s linear infinite;
}

.app-row-done-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
}

.app-sets {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px 4px 4px 38px;
}
.app-row.expanded .app-sets { display: flex; }

.app-set-row-wrap {
  display: flex;
  flex-direction: column;
  position: relative;
}

.app-set-row-wrap.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 1px;
  background: var(--blue);
}

.app-set-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 9px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: background 0.16s ease;
}
.app-set-row:hover { background: var(--hover); }

.app-set-row-wrap.active .app-set-row .app-set-title {
  color: var(--text);
  font-weight: 600;
}

.app-set-thumb {
  width: 28px;
  aspect-ratio: 9 / 16;
  border-radius: 5px;
  overflow: hidden;
  background: transparent;
  flex-shrink: 0;
}
.app-set-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  transform: scale(1.06);
  transform-origin: left center;
}

.app-set-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.app-set-palette {
  display: inline-flex;
  gap: 3px;
  flex-shrink: 0;
}
.app-set-palette-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

.app-set-vcount {
  font-size: 11px;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 1px 6px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.app-set-variations {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 6px 38px;
}
.app-set-row-wrap.expanded .app-set-variations { display: flex; }

.app-variation-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 7px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 450;
  transition: background 0.16s ease;
  letter-spacing: -0.005em;
}
.app-variation-row:hover { background: var(--hover); }
.app-variation-row.current { color: var(--text); font-weight: 550; }

.app-variation-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--text-3);
  flex-shrink: 0;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.app-variation-row.current .app-variation-dot {
  background: var(--blue);
  border-color: var(--blue);
}

.app-variation-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-variation-badge {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.app-set-fanout-hint {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  border-radius: 7px;
  text-align: left;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.app-set-fanout-hint:hover { background: var(--hover); color: var(--blue); }

.app-sets-pending { color: var(--text-2); }
.app-sets-empty {
  font-size: 12px;
  color: var(--text-3);
  padding: 4px 6px;
}

/* Page header */
.page-header {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: fadeSlideUp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.page-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.page-title {
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.02;
  color: var(--text);
  max-width: 820px;
  background: linear-gradient(180deg, var(--text) 0%, var(--text) 60%, var(--text-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-header.hidden { display: none; }

/* ── Screenshot fan (in visual stage) ── */
.screenshot-fan {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  overflow: visible;
  padding: 20px 16px 8px;
}

.screenshot-fan.hidden { display: none; }

/* Morph-out: cards fold away before generation */
.screenshot-fan.morphing .fetched-screen {
  animation: morphOut 0.5s cubic-bezier(0.55, 0, 1, 0.45) both !important;
  animation-delay: var(--morph-delay, 0ms) !important;
}

@keyframes morphOut {
  0%   { opacity: 1; transform: rotateY(0deg) scale(1);   filter: blur(0px); }
  100% { opacity: 0; transform: rotateY(-50deg) scale(0.55); filter: blur(10px); }
}

/* ── Morph loader (visual stage) ── */
.morph-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 30px 20px 36px;
  animation: fadeIn 0.35s ease both;
}

.morph-loader.hidden { display: none; }

.morph-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0;
}

.morph-dot-grid {
  --dot-size: 4px;
  --dot-gap: 13px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, var(--dot-size));
  gap: var(--dot-gap);
  padding: 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 46%, rgba(10, 132, 255, 0.14), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
}

.morph-dot-grid::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(10, 132, 255, 0.18), transparent 68%);
  filter: blur(12px);
  opacity: 0.75;
  pointer-events: none;
}

.morph-dot-grid span {
  position: relative;
  z-index: 1;
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  background: #78bdff;
  box-shadow: 0 0 10px rgba(10, 132, 255, 0.34);
  animation: gridDotFade 2.3s ease-in-out infinite;
  animation-delay: calc(var(--dot-index, 0) * 45ms);
}

.morph-dot-grid span:nth-child(1) { --dot-index: 0; }
.morph-dot-grid span:nth-child(2) { --dot-index: 1; }
.morph-dot-grid span:nth-child(3) { --dot-index: 2; }
.morph-dot-grid span:nth-child(4) { --dot-index: 3; }
.morph-dot-grid span:nth-child(5) { --dot-index: 4; }
.morph-dot-grid span:nth-child(6) { --dot-index: 5; }
.morph-dot-grid span:nth-child(7) { --dot-index: 6; }
.morph-dot-grid span:nth-child(8) { --dot-index: 7; }
.morph-dot-grid span:nth-child(9) { --dot-index: 8; }
.morph-dot-grid span:nth-child(10) { --dot-index: 9; }
.morph-dot-grid span:nth-child(11) { --dot-index: 10; }
.morph-dot-grid span:nth-child(12) { --dot-index: 11; }
.morph-dot-grid span:nth-child(13) { --dot-index: 12; }
.morph-dot-grid span:nth-child(14) { --dot-index: 13; }
.morph-dot-grid span:nth-child(15) { --dot-index: 14; }
.morph-dot-grid span:nth-child(16) { --dot-index: 15; }
.morph-dot-grid span:nth-child(17) { --dot-index: 16; }
.morph-dot-grid span:nth-child(18) { --dot-index: 17; }
.morph-dot-grid span:nth-child(19) { --dot-index: 18; }
.morph-dot-grid span:nth-child(20) { --dot-index: 19; }
.morph-dot-grid span:nth-child(21) { --dot-index: 20; }
.morph-dot-grid span:nth-child(22) { --dot-index: 21; }
.morph-dot-grid span:nth-child(23) { --dot-index: 22; }
.morph-dot-grid span:nth-child(24) { --dot-index: 23; }
.morph-dot-grid span:nth-child(25) { --dot-index: 24; }
.morph-dot-grid span:nth-child(26) { --dot-index: 25; }
.morph-dot-grid span:nth-child(27) { --dot-index: 26; }
.morph-dot-grid span:nth-child(28) { --dot-index: 27; }
.morph-dot-grid span:nth-child(29) { --dot-index: 28; }
.morph-dot-grid span:nth-child(30) { --dot-index: 29; }
.morph-dot-grid span:nth-child(31) { --dot-index: 30; }
.morph-dot-grid span:nth-child(32) { --dot-index: 31; }
.morph-dot-grid span:nth-child(33) { --dot-index: 32; }
.morph-dot-grid span:nth-child(34) { --dot-index: 33; }
.morph-dot-grid span:nth-child(35) { --dot-index: 34; }
.morph-dot-grid span:nth-child(36) { --dot-index: 35; }

@keyframes gridDotFade {
  0%, 100% {
    opacity: 0.18;
    transform: scale(0.72);
    background: rgba(120, 189, 255, 0.42);
  }
  44% {
    opacity: 1;
    transform: scale(1.28);
    background: #38a2ff;
  }
}

/* ── App main ── */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 0 32px 40px;
}

/* ── Workspace ── */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding-bottom: 60px;
}

/* Visual ordering: title/fan/loader → selected result → input → variations → edit */
.workspace > .visual-stage   { order: 1; }
.workspace > .app-library-section { order: 2; }
.workspace > .images-section { order: 2; }
.workspace > .input-card     { order: 3; }
.workspace > .var-rail       { order: 4; }
.workspace > .edit-panel     { order: 5; }

/* ── Visual Stage ── */
.visual-stage {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: clamp(240px, 42vh, 460px);
  padding-top: clamp(32px, 6vh, 72px);
  perspective: 1200px;
}

.workspace.has-results .visual-stage {
  min-height: 0;
  padding-top: 0;
}

.workspace.has-results {
  align-items: stretch;
  gap: 26px;
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
}

.workspace.is-library {
  align-items: stretch;
  width: 100%;
  max-width: 1520px;
  margin-inline: auto;
  padding-top: clamp(28px, 5vh, 56px);
}

.workspace.is-library .visual-stage {
  display: none;
}

.app-library-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: fadeSlideUp 0.35s ease both;
}

.app-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.workspace.is-library .app-library-header {
  display: none;
}

.app-library-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app-library-app-icon .app-icon-tile {
  width: 58px;
  height: 58px;
  border-radius: 15px;
  box-shadow: 0 10px 26px rgba(29, 29, 31, 0.14);
}

.app-library-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.app-library-title {
  margin-top: 3px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
  font-weight: 650;
  color: var(--text);
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.workspace.is-library .app-library-section {
  padding: 0 0 190px;
}

.workspace.is-library .app-library-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  overflow: visible;
  border-radius: 0;
}

.app-library-detail {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-library-detail-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
}

.app-library-back-btn,
.app-library-localize-btn {
  min-height: 38px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.app-library-back-btn {
  width: 38px;
  display: grid;
  place-items: center;
}

.app-library-localize-btn {
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  font-size: 13px;
  font-weight: 750;
}

.app-library-detail-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-library-set-row {
  position: relative;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border-radius: 26px;
  isolation: isolate;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.app-library-set-row::before {
  content: '';
  position: absolute;
  inset: -10px -14px;
  border-radius: 26px;
  background: rgba(0, 0, 0, 0.05);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: -1;
}

.app-library-set-row:hover {
  transform: translateY(-8px);
  z-index: 2;
}

.app-library-set-row:hover::before {
  opacity: 1;
}

.app-library-set-row-child {
  opacity: 0.94;
}

.app-library-set-row-parent.expanded .app-library-shot-card {
  box-shadow:
    0 0 0 1px rgba(10, 132, 255, 0.18),
    inset 0 0 0 1px var(--appstore-shot-border),
    0 1px 0 rgba(255, 255, 255, 0.45);
}

.app-library-shot-card {
  position: relative;
  width: min(18vw, 214px);
  max-width: 214px;
  min-width: 136px;
  aspect-ratio: 1242 / 2688;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: 20px;
  border: 1px solid var(--appstore-shot-border);
  box-shadow:
    inset 0 0 0 1px var(--appstore-shot-border),
    0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.18s ease, filter 0.18s ease;
  flex: 0 1 214px;
}

.app-library-shot-card:hover {
  filter: brightness(1.03);
}

.app-library-set-row.is-opening {
  transform: none !important;
  pointer-events: none;
}

.app-library-set-row.is-opening .app-library-shot-card,
.app-library-shot-card:disabled {
  pointer-events: none;
  cursor: progress;
  filter: brightness(0.96);
}

.app-library-shot-card img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: inherit;
  opacity: 0;
  filter: blur(10px) saturate(1.08);
  transform: scale(1.018);
  transition:
    opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.62s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
}

.app-library-shot-card.is-image-loaded img {
  opacity: 1;
  filter: none;
  transform: scale(1);
}

.app-library-shot-card.is-image-loading {
  background:
    linear-gradient(180deg, rgba(10, 132, 255, 0.10), rgba(94, 92, 230, 0.08)),
    var(--surface-2);
}

.app-library-shot-card.is-image-loading::before,
.app-library-shot-card.is-image-loading::after {
  content: '';
  position: absolute;
  pointer-events: none;
  border-radius: inherit;
  transition: opacity 0.28s ease;
}

.app-library-shot-card.is-image-loading::before {
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(105deg, transparent 28%, rgba(255, 255, 255, 0.68) 48%, transparent 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.08));
  background-size: 260% 100%, 100% 100%;
  animation: libraryImageSheen 2.8s ease-in-out infinite;
}

.app-library-shot-card.is-image-loading::after {
  inset: 10% 14% 8%;
  z-index: 1;
  background:
    linear-gradient(rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.48)) top / 100% 10% no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.34)) bottom / 100% 56% no-repeat;
  border-radius: 16px;
}

.app-library-shot-meta {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.64);
  box-shadow: 0 8px 22px rgba(29, 29, 31, 0.14);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.app-library-shot-card:hover .app-library-shot-meta,
.app-library-shot-card:focus-visible .app-library-shot-meta {
  opacity: 1;
  transform: translateY(0);
}

.app-library-shot-meta span,
.app-library-shot-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-library-shot-meta span {
  min-width: 0;
  font-size: 12px;
  font-weight: 760;
}

.app-library-shot-meta small {
  flex-shrink: 0;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
}

/* ── Row hover actions (download / delete) ── */
.app-library-row-actions {
  position: absolute;
  top: -20px;
  left: 50%;
  display: flex;
  gap: 6px;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px);
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
  z-index: 10;
}

.app-library-set-row:hover .app-library-row-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.app-library-row-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px 7px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 8px 24px rgba(29, 29, 31, 0.22),
    0 2px 8px rgba(29, 29, 31, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  color: var(--text);
}

.app-library-row-action:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 30px rgba(29, 29, 31, 0.26),
    0 3px 10px rgba(29, 29, 31, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.app-library-row-action-delete {
  color: #ff3b30;
}

.app-library-row-action-delete:hover {
  color: #ff2d20;
}

.app-library-row-action-delete {
  color: #e53e3e;
}

.app-library-row-action-delete:hover {
  background: #fff1f1;
  border-color: rgba(229, 62, 62, 0.25);
}

.app-library-shot-skeleton {
  background:
    linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.72) 50%, transparent 65%),
    linear-gradient(180deg, rgba(10, 132, 255, 0.10), rgba(94, 92, 230, 0.08)),
    var(--surface-2);
  background-size: 320% 100%, 100% 100%, 100% 100%;
  animation: librarySkeletonShimmer 3.6s linear infinite;
  animation-delay: var(--card-delay, 0ms);
}

.app-library-shot-skeleton::before,
.app-library-shot-skeleton::after {
  content: '';
  position: absolute;
  left: 14%;
  right: 14%;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.app-library-shot-skeleton::before {
  top: 10%;
  height: 10%;
}

.app-library-shot-skeleton::after {
  bottom: 8%;
  height: 56%;
}

.app-library-card {
  position: relative;
  min-width: 0;
  min-height: 360px;
  padding: 12px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border);
  box-shadow:
    0 18px 48px rgba(29, 29, 31, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
  display: flex;
  flex-direction: column;
  gap: 13px;
  text-align: left;
  overflow: hidden;
  animation: fadeSlideUp 0.45s ease both;
  animation-delay: var(--card-delay, 0ms);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.app-library-card:hover {
  transform: translateY(-4px);
  border-color: rgba(10, 132, 255, 0.32);
  box-shadow: 0 24px 60px rgba(29, 29, 31, 0.12);
}

.app-library-card-art {
  aspect-ratio: 1242 / 2688;
  height: 218px;
  align-self: center;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 16px 38px rgba(29, 29, 31, 0.16);
}

.app-library-card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.app-library-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.app-library-card-kicker,
.app-library-card-meta,
.app-library-card-date {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}

.app-library-card-body strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-library-card-meta {
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-library-lang-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.app-library-lang-row span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.09);
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 750;
}

.app-library-card-date {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}

.app-library-empty {
  grid-column: 1 / -1;
  min-height: 260px;
  border-radius: 24px;
  border: 1.5px dashed var(--border-med);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--text-2);
}

.app-library-empty strong {
  color: var(--text);
  font-size: 20px;
}

/* ── Sets strip ── */
.sets-strip {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sets-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.sets-strip-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.frame-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.frame-row::-webkit-scrollbar { height: 0; }

.frame-row .frame-card {
  flex: 0 0 auto;
  width: 130px;
  scroll-snap-align: start;
}

.frame-row .empty-hint {
  flex: 1;
  padding: 24px 0;
  text-align: left;
}

.panel-title,
.sets-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.library-eyebrow {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 3px;
}

.panel-title h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.sets-heading h1 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--text);
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 400;
  color: var(--text-2);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.icon-btn:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

.project-strip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 10px;
}

.project-card {
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease;
  color: var(--text);
}

.project-card:hover {
  background: rgba(0,0,0,0.04);
}

.project-card.active {
  background: rgba(10, 132, 255, 0.10);
  color: var(--blue);
}

.project-icon {
  width: 24px;
  height: 24px;
  border-radius: 0;
  display: grid;
  place-items: center;
  color: var(--text-2);
  background: transparent;
  border: 0;
  font-weight: 700;
  font-size: 11px;
  flex: 0 0 auto;
  overflow: hidden;
}

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

.project-card strong {
  font-size: 13.5px;
  font-weight: 550;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card small {
  color: var(--text-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 22px 18px;
}

.frame-card {
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
}

.frame-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0;
  padding: 0 2px;
  outline: none;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.frame-title[contenteditable="true"]:focus {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 0 0 2px rgba(10, 132, 255, 0.35);
  overflow: visible;
}

.frame-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--appstore-shot-border);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.frame-card:hover .frame-thumb {
  border-color: rgba(10, 132, 255, 0.45);
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
  transform: translateY(-2px);
}

.frame-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.empty-hint {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--text-3);
  font-size: 14px;
}

.composer-card {
  max-width: min(100%, 620px);
  margin-top: 2px;
}

/* ── Input card ── */
.input-card {
  width: 100%;
  max-width: 760px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.84)),
    radial-gradient(circle at 16% 0%, rgba(10, 132, 255, 0.14), transparent 36%);
  border-radius: 24px;
  box-shadow:
    0 18px 58px rgba(0, 0, 0, 0.10),
    0 18px 42px -22px rgba(10, 132, 255, 0.28),
    0 0 0 1px rgba(10, 132, 255, 0.08);
  padding: 10px;
  display: flex;
  flex-direction: column;
  animation: fadeSlideUp 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s both;
  transform-origin: center center;
  position: relative;
  backdrop-filter: blur(30px) saturate(170%);
  -webkit-backdrop-filter: blur(30px) saturate(170%);
  overflow: hidden;
}

.landing-input-card {
  max-width: 760px;
  text-align: left;
  background: rgba(255, 255, 255, 0.90);
}

.input-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(10, 132, 255, 0.24) 0%,
    rgba(94, 92, 230, 0.14) 35%,
    rgba(255, 255, 255, 0.04) 60%,
    rgba(10, 132, 255, 0.12) 100%
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.8;
}

.input-card::after {
  content: '';
  position: absolute;
  inset: -46px;
  z-index: -1;
  background: radial-gradient(
    60% 50% at 50% 100%,
    rgba(10, 132, 255, 0.22) 0%,
    rgba(94, 92, 230, 0.10) 40%,
    transparent 70%
  );
  filter: blur(20px);
  pointer-events: none;
}

.composer-card { max-width: 580px; }

.input-card.exiting {
  animation: shrinkFade 0.32s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

/* ── Mode tabs ── */
.mode-tabs {
  display: flex;
  background: rgba(118, 118, 128, 0.09);
  border-radius: 16px;
  padding: 3px;
  gap: 2px;
  margin: 2px 2px 4px;
  position: relative;
  z-index: 1;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
}

.mode-tab.active {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: 0 1px 5px rgba(0,0,0,0.09), 0 0 0 1px rgba(0,0,0,0.04);
}

.mode-tab:not(.active):hover {
  color: var(--text);
  background: rgba(0,0,0,0.035);
}

/* ── Tab panels ── */
.tab-panel {
  padding: 8px 8px 5px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.tab-panel.entering {
  animation: fadeIn 0.2s ease both;
}

/* ── Upload slots ── */
.upload-slots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.upload-slot {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--r-md);
  border: 1.5px dashed var(--border-med);
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.upload-slot:hover {
  border-color: var(--blue);
  background: rgba(10, 132, 255, 0.05);
  transform: translateY(-3px);
}

.upload-slot.has-image {
  border-style: solid;
  border-color: var(--border);
  cursor: default;
}

.upload-slot.has-image:hover {
  transform: translateY(-3px);
  border-color: var(--border-med);
  background: var(--surface-2);
}

.upload-slot.drag-over {
  border-color: var(--blue);
  background: rgba(10, 132, 255, 0.08);
  transform: scale(1.03);
}

.slot-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-3);
  pointer-events: none;
  transition: color 0.15s ease;
}

.upload-slot:hover .slot-empty { color: var(--blue); }
.upload-slot.has-image .slot-empty { display: none; }

.slot-empty span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.slot-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--r-md) - 1px);
}

.slot-remove {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  line-height: 1;
}

.slot-remove::before,
.auth-close::before,
.panel-edit-close::before,
.var-picker-close::before {
  content: '';
  width: 12px;
  height: 12px;
  display: block;
  background: currentColor;
  mask: url('/assets/sf-symbols/xmark.png') center / contain no-repeat;
  -webkit-mask: url('/assets/sf-symbols/xmark.png') center / contain no-repeat;
}

.slot-remove:hover {
  background: rgba(255, 59, 48, 0.88);
  transform: scale(1.12);
}

.file-input-hidden { display: none; }

.panel-hint {
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
}

/* ── App Store link ── */
.link-row {
  display: flex;
  gap: 8px;
}

.link-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.link-icon {
  position: absolute;
  left: 14px;
  color: var(--text-3);
  pointer-events: none;
  flex-shrink: 0;
  transition: color 0.18s ease;
}

.link-input-wrap:focus-within .link-icon { color: var(--blue); }

.link-input {
  width: 100%;
  min-height: 52px;
  padding: 14px 44px 14px 44px;
  background: rgba(118, 118, 128, 0.07);
  border-radius: 16px;
  font-size: 15px;
  color: var(--text);
  border: 1.5px solid transparent;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.link-input:focus {
  border-color: rgba(10, 132, 255, 0.36);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.08);
  outline: none;
}

.link-input::placeholder { color: var(--text-3); }

/* Inline fetch spinner (inside input) */
.fetch-spinner {
  position: absolute;
  right: 14px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-med);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}

/* ── Screenshot fan ── */
.screenshot-fan {
  perspective: 900px;
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: flex-end;
  padding: 36px 40px 70px;
  overflow: visible;
}

.landing-fetch-mount .screenshot-fan {
  width: 100%;
  padding: 42px 34px 84px;
}

.fetched-screen {
  position: relative;
  height: min(34vh, 320px);
  aspect-ratio: 1242 / 2688;
  border-radius: 16px;
  border: 1px solid var(--appstore-shot-border);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.20),
    0 4px 12px rgba(0, 0, 0, 0.10),
    inset 0 0 0 1px var(--appstore-shot-border);
  transform-style: preserve-3d;
  animation: flipIn3D 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: var(--flip-delay, 0ms);
  transition: transform 0.30s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.24s ease;
  will-change: transform;
  flex-shrink: 0;
}

.fetched-screen:hover {
  transform: translateY(-10px) rotateY(-6deg) scale(1.03);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.26),
    0 6px 16px rgba(0, 0, 0, 0.12),
    inset 0 0 0 1px var(--appstore-shot-border);
  z-index: 10;
}

.fetched-screen img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

@keyframes flipIn3D {
  0%   { opacity: 0; transform: rotateY(80deg) scale(0.65) translateX(24px); filter: blur(6px); }
  55%  { opacity: 1; filter: blur(0px); }
  100% { opacity: 1; transform: rotateY(0deg) scale(1) translateX(0); filter: blur(0px); }
}

/* ── Divider ── */
.input-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.055);
  margin: 2px 8px 0;
}

/* ── Prompt ── */
.prompt-area-wrap {
  padding: 5px 4px 5px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  position: relative;
  z-index: 1;
}

.prompt-textarea {
  width: 100%;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.55;
  min-height: 64px;
  padding: 10px 12px 4px;
  border-radius: 14px;
  transition: background 0.15s ease;
}

.prompt-textarea:focus { background: rgba(0, 0, 0, 0.018); outline: none; }
.prompt-textarea::placeholder { color: var(--text-3); }

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 6px 2px;
  flex-wrap: wrap;
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.composer-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 12px;
  background: rgba(118, 118, 128, 0.08);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.05px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.18s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.composer-tool svg { color: var(--text-3); transition: color 0.15s ease; }

.composer-tool:hover {
  color: var(--text);
  border-color: var(--text-3);
  background: var(--surface);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.composer-tool:hover svg { color: var(--text-2); }

.composer-tool-pop {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.10), rgba(94, 92, 230, 0.06));
  border-color: rgba(10, 132, 255, 0.32);
  color: var(--blue);
}

.composer-tool-pop svg { color: var(--blue); }

.composer-tool-pop:hover {
  border-color: rgba(10, 132, 255, 0.55);
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.16), rgba(94, 92, 230, 0.10));
}

/* ── Generate button ── */
.btn-generate {
  margin: 0;
  padding: 0 24px;
  background: linear-gradient(135deg, #4da3ff 0%, #0a84ff 42%, #007aff 100%);
  color: white;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease;
  box-shadow: 0 8px 26px rgba(10, 132, 255, 0.30);
  position: relative;
  overflow: hidden;
  letter-spacing: -0.1px;
  border: 1px solid rgba(255, 255, 255, 0.44);
  height: 42px;
  flex-shrink: 0;
}

.btn-generate::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0%, transparent 56%);
  border-radius: inherit;
  pointer-events: none;
}

.btn-generate::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
  animation: shimmer 2.8s ease-in-out infinite 1s;
  pointer-events: none;
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.015);
  background: linear-gradient(135deg, #66b2ff 0%, #1690ff 45%, #0a84ff 100%);
  border-color: rgba(201, 232, 255, 0.95);
  box-shadow: 0 10px 30px rgba(10, 132, 255, 0.32), 0 0 20px rgba(84, 188, 255, 0.35);
}

.btn-generate:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
  border-color: rgba(195, 228, 255, 0.72);
  box-shadow: 0 4px 16px rgba(10, 132, 255, 0.28);
}

.btn-generate:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-generate > span,
.btn-generate > svg,
.btn-generate-icon {
  position: relative;
  z-index: 2;
}

.btn-generate-icon {
  flex-shrink: 0;
  animation: starPulse 2.5s ease-in-out infinite;
}

@keyframes starPulse {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50%       { transform: scale(1.18) rotate(15deg); opacity: 0.85; }
}

/* ── Error ── */
.error-msg {
  text-align: center;
  font-size: 13.5px;
  color: #FF3B30;
  padding: 0 16px 6px;
  animation: fadeIn 0.2s ease both;
}

/* ── Loading ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 48px 20px;
  animation: fadeIn 0.4s ease both;
}

.loader-wrap {
  position: relative;
  width: 76px;
  height: 76px;
}

.loader-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    #0A84FF 120deg,
    #5E5CE6 240deg,
    transparent 300deg
  );
  animation: spin 1.1s linear infinite;
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), black calc(100% - 6px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), black calc(100% - 6px));
}

.loader-glow {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(10, 132, 255, 0.15), transparent 70%);
  animation: glowPulse 2s ease-in-out infinite;
}

.loading-label {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.loading-dots {
  display: flex;
  gap: 7px;
}

.loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  animation: bounceDot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.22s; }
.loading-dots span:nth-child(3) { animation-delay: 0.44s; }

.loading-sub {
  font-size: 14px;
  color: var(--text-3);
}

/* ── Sheet section ── */
.sheet-section {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeSlideUp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.sheet-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sheet-img {
  width: 100%;
  display: block;
  border-radius: var(--r-xl);
  border: 1px solid var(--appstore-shot-border);
  background: var(--surface);
  box-shadow:
    var(--shadow-lg),
    inset 0 0 0 1px var(--appstore-shot-border);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-edit {
  padding: 13px 30px;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 600;
  border: 1.5px solid var(--border-med);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
}

.btn-edit:hover {
  border-color: var(--text-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-accept {
  padding: 13px 30px;
  background: linear-gradient(135deg, #0A84FF 0%, #5E5CE6 100%);
  color: white;
  border-radius: var(--r-pill);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(10, 132, 255, 0.28);
  position: relative;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease;
}

.btn-accept::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 55%);
  pointer-events: none;
}

.btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(10, 132, 255, 0.38);
}

/* ── Edit panel ── */
.edit-panel {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 20px;
  width: min(100% - 40px, 820px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideDown 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.edit-panel textarea {
  width: 100%;
  resize: none;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 14px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  border: 1.5px solid transparent;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  min-height: 76px;
}

.edit-panel textarea:focus {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.12);
}

.edit-panel textarea::placeholder { color: var(--text-3); }

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-ghost {
  padding: 11px 22px;
  color: var(--text-2);
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s ease, background 0.15s ease;
}

.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-update {
  padding: 11px 22px;
  background: linear-gradient(135deg, #0A84FF 0%, #5E5CE6 100%);
  color: white;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 3px 14px rgba(10, 132, 255, 0.28);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.btn-update:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(10, 132, 255, 0.38);
}

.btn-update:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ── Images section ── */
.images-section {
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.3s ease both;
}

.images-grid {
  display: grid;
  grid-template-columns: repeat(var(--image-count, 3), minmax(150px, 212px));
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-height: none;
  overflow-y: auto;
  padding: 4px 2px 10px;
}

.image-card {
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--appstore-shot-border);
  box-shadow:
    var(--shadow-sm),
    inset 0 0 0 1px var(--appstore-shot-border);
  overflow: hidden;
  position: relative;
  width: 100%;
  aspect-ratio: 1242 / 2688;
  animation: resultFlipIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.image-card { animation-delay: var(--flip-delay, 0ms); }

.image-card:hover {
  transform: translateY(-4px);
  box-shadow:
    var(--shadow-lg),
    inset 0 0 0 1px var(--appstore-shot-border);
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.btn-dl-single {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--blue);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  opacity: 0;
  transform: translateY(-4px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.15s ease, background 0.15s ease;
}

.btn-edit-single {
  position: absolute;
  top: 14px;
  left: 14px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  opacity: 0;
  transform: translateY(-4px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.15s ease, background 0.15s ease;
}

.image-card:hover .btn-dl-single,
.image-card:hover .btn-edit-single,
.btn-edit-single:focus-visible,
.btn-dl-single:focus-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.btn-edit-single:hover {
  color: var(--blue);
  background: white;
}

.btn-dl-single:hover {
  color: #0066d6;
  background: white;
}

.image-label {
  display: none;
}

/* ── Results header ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.results-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.set-back-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.set-back-btn:hover {
  transform: translateX(-2px);
  background: var(--surface);
  color: var(--blue);
}

.results-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.results-title {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.3px;
  color: var(--text);
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.localizations-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.localizations-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 210px;
}

.localizations-head p {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.localizations-head strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.localization-chips {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px;
}

.localization-chip {
  flex: 0 0 auto;
  min-width: 132px;
  height: 58px;
  padding: 6px 12px 6px 6px;
  border-radius: 17px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: rgba(118, 118, 128, 0.08);
  color: var(--text);
  border: 1px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.localization-chip:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.localization-chip.current {
  background: rgba(10, 132, 255, 0.10);
  border-color: rgba(10, 132, 255, 0.28);
}

.localization-thumb {
  width: 28px;
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}

.localization-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.localization-chip span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.localization-chip strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 780;
  white-space: nowrap;
}

.localization-chip small {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.localization-add-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

/* ── Download bar (legacy compat) ── */
.download-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 4px 2px 0;
}

.btn-download-all {
  padding: 12px 26px;
  background: linear-gradient(135deg, #0A84FF 0%, #5E5CE6 100%);
  color: white;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(10, 132, 255, 0.30);
  position: relative;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.28s ease;
  letter-spacing: -0.1px;
}

.btn-download-all::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 55%);
  pointer-events: none;
}

.btn-download-all:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 8px 32px rgba(10, 132, 255, 0.42);
}

.btn-download-all:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-start-over {
  padding: 12px 20px;
  color: var(--text-2);
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid var(--border-med);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-start-over:hover {
  color: var(--text);
  border-color: var(--text-2);
  transform: translateY(-1px);
}

.panel-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 22px;
}

.panel-edit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.panel-edit-card {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-height: min(920px, calc(100vh - 44px));
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-edit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-edit-kicker {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.panel-edit-header h2 {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0;
}

.panel-edit-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text-2);
  font-size: 0;
  line-height: 1;
}

.panel-edit-close:hover { background: var(--hover); color: var(--text); }

.panel-edit-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 320px;
  gap: 22px;
  padding: 22px;
}

.panel-edit-canvas-wrap {
  position: relative;
  justify-self: center;
  height: min(72vh, 700px);
  max-height: calc(100vh - 190px);
  aspect-ratio: 1242 / 2688;
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
}

.panel-edit-canvas-wrap img,
.panel-edit-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.panel-edit-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
}

.panel-edit-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-edit-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.panel-edit-field span {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 750;
}

.panel-edit-field textarea {
  min-height: 132px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 14px;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface-2);
}

.panel-edit-field input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.panel-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
}

@media (max-width: 820px) {
  .input-card {
    grid-template-columns: 1fr;
  }

  .mode-tabs {
    grid-row: auto;
    grid-column: 1;
    border-radius: 24px 24px 0 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
  }

  .mode-tab {
    min-height: 44px;
    flex-direction: row;
  }

  .tab-panel,
  .prompt-area-wrap {
    grid-column: 1;
  }

  .panel-edit-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .panel-edit-canvas-wrap {
    height: min(58vh, 560px);
  }
}

/* ── Auth modal ── */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
  padding: 34px 34px 28px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  animation: modalIn 0.22s ease both;
}

.auth-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--text-2);
  font-size: 0;
  line-height: 1;
}

.auth-close:hover { background: var(--hover); color: var(--text); }

.auth-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  align-self: center;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.16));
}

.auth-card h2 {
  text-align: center;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
}

.auth-card p {
  text-align: center;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.45;
}

.auth-google-btn {
  width: 100%;
  margin-top: 4px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.auth-error {
  margin: -2px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 59, 48, 0.08);
  color: #d92d20;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.auth-tabs span {
  padding: 10px;
  border-radius: 9px;
}

.auth-tabs .active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.auth-field input {
  height: 50px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-med);
  padding: 0 14px;
  color: var(--text);
}

.auth-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.12);
}

.auth-email-btn {
  height: 52px;
  border-radius: 14px;
  background: var(--text);
  color: var(--surface);
  font-weight: 750;
  box-shadow: var(--shadow-md);
}

.auth-card .auth-terms {
  font-size: 12px;
  color: var(--text-3);
}

.appstore-link-modal {
  position: fixed;
  inset: 0;
  z-index: 101;
  display: grid;
  place-items: center;
  padding: 24px;
}

.appstore-link-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.appstore-link-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  padding: 30px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(10, 132, 255, 0.12);
  box-shadow: 0 28px 90px rgba(29, 29, 31, 0.22);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalIn 0.22s ease both;
}

.appstore-link-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-2);
  font-size: 0;
  display: grid;
  place-items: center;
}

.appstore-link-close::before {
  content: '';
  width: 13px;
  height: 13px;
  display: block;
  background: currentColor;
  mask: url('/assets/sf-symbols/xmark.png') center / contain no-repeat;
  -webkit-mask: url('/assets/sf-symbols/xmark.png') center / contain no-repeat;
}

.appstore-link-close:hover { background: var(--hover); color: var(--text); }

.appstore-link-card h2 {
  margin-right: 38px;
  color: var(--text);
  font-size: 28px;
  font-weight: 760;
  letter-spacing: 0;
}

.appstore-link-card p {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.45;
}

.appstore-link-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
}

.appstore-link-field input {
  height: 54px;
  padding: 0 15px;
  border-radius: 15px;
  background: rgba(118, 118, 128, 0.07);
  border: 1px solid var(--border-med);
  color: var(--text);
}

.appstore-link-field input:focus {
  border-color: rgba(10, 132, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.10);
}

.appstore-link-loader {
  width: 50px;
  aspect-ratio: 1;
  margin: 4px auto 2px;
  border-radius: 50%;
  background:
    radial-gradient(farthest-side, var(--blue) 94%, #0000) top / 8px 8px no-repeat,
    conic-gradient(#0000 30%, var(--blue));
  -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 8px), #000 0);
          mask: radial-gradient(farthest-side, #0000 calc(100% - 8px), #000 0);
  animation: appStoreLinkSpin 1s infinite linear;
}

.appstore-link-card.has-fetched-url .appstore-link-submit {
  display: block;
}

.appstore-link-card.is-fetching .appstore-link-submit {
  display: none;
}

.appstore-link-submit {
  display: none;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #5fb0ff 0%, #0a84ff 48%, #246bff 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 780;
  box-shadow: 0 16px 34px rgba(10, 132, 255, 0.30);
}

:root[data-theme="dark"] .appstore-link-backdrop {
  background: rgba(3, 8, 18, 0.58);
}

:root[data-theme="dark"] .appstore-link-card {
  background:
    linear-gradient(180deg, rgba(37, 39, 45, 0.96), rgba(22, 24, 30, 0.94)),
    radial-gradient(circle at 18% 0%, rgba(77, 163, 255, 0.18), transparent 42%);
  border-color: rgba(77, 163, 255, 0.22);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] .appstore-link-close,
:root[data-theme="dark"] .appstore-link-card h2,
:root[data-theme="dark"] .appstore-link-field {
  color: rgba(245, 247, 255, 0.92);
}

:root[data-theme="dark"] .appstore-link-card p {
  color: rgba(245, 247, 255, 0.58);
}

:root[data-theme="dark"] .appstore-link-field input {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(77, 163, 255, 0.24);
  color: rgba(245, 247, 255, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .appstore-link-field input::placeholder {
  color: rgba(245, 247, 255, 0.36);
}

:root[data-theme="dark"] .appstore-link-field input:focus {
  border-color: rgba(77, 163, 255, 0.70);
  box-shadow:
    0 0 0 4px rgba(77, 163, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

@keyframes appStoreLinkSpin {
  100% { transform: rotate(1turn); }
}

/* ── Inspiration modal ── */
.inspiration-modal {
  position: fixed;
  inset: 0;
  z-index: 132;
  display: grid;
  place-items: center;
  padding: 24px;
}

.inspiration-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.inspiration-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  padding: 30px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(10, 132, 255, 0.12);
  box-shadow: 0 28px 90px rgba(29, 29, 31, 0.22);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: modalIn 0.22s ease both;
}

.inspiration-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-2);
  font-size: 0;
  display: grid;
  place-items: center;
}

.inspiration-close::before {
  content: '';
  width: 13px;
  height: 13px;
  display: block;
  background: currentColor;
  mask: url('/assets/sf-symbols/xmark.png') center / contain no-repeat;
  -webkit-mask: url('/assets/sf-symbols/xmark.png') center / contain no-repeat;
}

.inspiration-close:hover { background: var(--hover); color: var(--text); }

.inspiration-card h2 {
  margin-right: 38px;
  color: var(--text);
  font-size: 28px;
  font-weight: 760;
  letter-spacing: 0;
}

.inspiration-drop {
  min-height: 160px;
  padding: 18px;
  border-radius: 20px;
  border: 1.5px dashed var(--border-med);
  background: rgba(118, 118, 128, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.inspiration-drop.drag-over {
  border-color: rgba(10, 132, 255, 0.48);
  background: rgba(10, 132, 255, 0.06);
}

.inspiration-thumbs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.inspiration-thumb {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(29, 29, 31, 0.12);
}

.inspiration-thumb img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.inspiration-thumb button {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(29, 29, 31, 0.72);
  color: #fff;
  font-size: 0;
}

.inspiration-thumb button::before {
  content: '';
  width: 9px;
  height: 9px;
  display: block;
  margin: auto;
  background: currentColor;
  mask: url('/assets/sf-symbols/xmark.png') center / contain no-repeat;
  -webkit-mask: url('/assets/sf-symbols/xmark.png') center / contain no-repeat;
}

.inspiration-add {
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.10);
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
}

:root[data-theme="dark"] .inspiration-backdrop {
  background: rgba(0, 0, 0, 0.58);
}

:root[data-theme="dark"] .inspiration-card {
  background:
    linear-gradient(180deg, rgba(30, 31, 36, 0.96), rgba(18, 19, 23, 0.96)),
    radial-gradient(circle at 22% 0%, rgba(77, 163, 255, 0.12), transparent 38%);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

:root[data-theme="dark"] .inspiration-drop {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.16);
}

:root[data-theme="dark"] .inspiration-drop.drag-over {
  border-color: rgba(77, 163, 255, 0.46);
  background: rgba(77, 163, 255, 0.09);
}

:root[data-theme="dark"] .inspiration-add {
  background: rgba(255, 255, 255, 0.09);
  color: rgba(245, 245, 247, 0.88);
}

:root[data-theme="dark"] .inspiration-add:hover,
:root[data-theme="dark"] .inspiration-close:hover {
  background: rgba(255, 255, 255, 0.13);
}

:root[data-theme="dark"] .inspiration-thumb {
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.34);
}

:root[data-theme="dark"] .inspiration-thumb button {
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.20);
}

/* ── Variation rail (Higgsfield-style cards) ── */
.var-rail {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 4px;
  animation: fadeSlideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.18s both;
}

.var-rail-head {
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 0 6px 12px;
}

.var-rail-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.var-rail-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.var-rail-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.2px;
  color: var(--text);
}

.var-rail-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.var-rail-track {
  display: flex;
  gap: 10px;
  max-height: none;
  overflow-x: auto;
  padding: 2px 4px 14px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.var-rail-track::-webkit-scrollbar { height: 0; }
.var-rail-track::-webkit-scrollbar-track { background: transparent; }
.var-rail-track::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 999px; }

.var-card {
  flex: 0 0 92px;
  width: 92px;
  min-height: 132px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  cursor: pointer;
  position: relative;
  scroll-snap-align: start;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.18s ease,
              border-color 0.18s ease,
              background 0.18s ease;
}

.var-card.selected {
  border-color: rgba(10, 132, 255, 0.62);
  box-shadow: 0 10px 28px rgba(10, 132, 255, 0.13), 0 0 0 3px rgba(10, 132, 255, 0.10);
}

.var-card-thumbs {
  width: 100%;
  height: 92px;
  display: grid;
  grid-template-columns: repeat(var(--thumb-count), minmax(0, 1fr));
  gap: 2px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.var-card-thumb {
  width: 100%;
  height: 100%;
  min-width: 0;
  object-fit: cover;
}

.var-card:hover {
  transform: translateY(-2px);
  border-color: rgba(10, 132, 255, 0.32);
  box-shadow: 0 8px 24px rgba(10, 132, 255, 0.10), 0 0 0 1px rgba(10, 132, 255, 0.08);
}

.var-card-original {
  background: var(--surface);
  border-color: rgba(10, 132, 255, 0.22);
  cursor: default;
}

.var-card-original:hover {
  transform: none;
  border-color: rgba(10, 132, 255, 0.32);
}

.var-card-name,
.var-card-sub {
  display: block;
  width: 100%;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.var-card-sub {
  margin-top: -4px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-3);
}

/* Add card */
.var-add-card {
  flex: 0 0 92px;
  width: 92px;
  min-height: 132px;
  border-radius: 16px;
  border: 1.5px dashed var(--border-med);
  background: transparent;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
  scroll-snap-align: start;
}

.var-add-card:hover {
  color: var(--blue);
  border-color: rgba(10, 132, 255, 0.45);
  background: rgba(10, 132, 255, 0.04);
  transform: translateY(-2px);
}

.var-add-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border-med);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.var-add-card:hover .var-add-icon {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.var-add-label {
  font-size: 12.5px;
  font-weight: 650;
}

/* ── Variation picker modal ── */
.var-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 22px;
}

.var-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.var-picker-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100vh - 44px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.22s ease both;
}

.var-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.var-picker-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.var-picker-head h2 {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text);
}

.var-picker-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-2);
  font-size: 0;
  line-height: 1;
  display: grid;
  place-items: center;
}

.var-picker-close:hover { background: var(--hover); color: var(--text); }

.var-picker-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 24px 4px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.var-pick-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.var-pick-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.var-pick-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.var-lang-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.var-search-icon {
  position: absolute;
  left: 11px;
  color: var(--text-3);
  pointer-events: none;
}

.var-lang-search {
  width: 100%;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0 14px 0 32px;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.var-lang-search:focus {
  border-color: rgba(10, 132, 255, 0.4);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.10);
  outline: none;
}

.var-lang-search::placeholder { color: var(--text-3); }

.var-chips-scroll {
  max-height: 200px;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 10px;
  background: var(--surface-2);
  scrollbar-width: thin;
  scrollbar-color: var(--border-med) transparent;
}

.var-chips-scroll::-webkit-scrollbar { width: 5px; }
.var-chips-scroll::-webkit-scrollbar-track { background: transparent; }
.var-chips-scroll::-webkit-scrollbar-thumb {
  background: var(--border-med);
  border-radius: 999px;
}

.var-lang-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lang-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--border-med);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
  white-space: nowrap;
}

.lang-chip:hover {
  color: var(--text);
  border-color: var(--text-3);
  transform: translateY(-1px);
}

.lang-chip.selected {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.16), rgba(94, 92, 230, 0.10));
  border-color: rgba(10, 132, 255, 0.5);
  color: var(--blue);
}

.lang-chip.chip-hidden { display: none; }

.var-no-results {
  font-size: 12px;
  color: var(--text-3);
  padding: 8px 4px;
  display: none;
}

.var-device-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.device-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border-med);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
  min-width: 92px;
  text-align: center;
}

.device-pill:hover {
  color: var(--text);
  border-color: var(--text-3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.device-pill.selected {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.16), rgba(94, 92, 230, 0.10));
  border-color: rgba(10, 132, 255, 0.5);
  color: var(--blue);
}

.device-pill-icon {
  opacity: 0.65;
  margin-bottom: 1px;
}

.device-pill.selected .device-pill-icon { opacity: 1; }

.device-pill-label {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -0.1px;
}

.device-pill-sub {
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.7;
}

.var-picker-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── Minimal generation composer refresh ── */
.input-card {
  max-width: 980px;
  padding: 0;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 0;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.86)),
    radial-gradient(circle at 20% 0%, rgba(10, 132, 255, 0.16), transparent 38%);
  border: 1px solid rgba(10, 132, 255, 0.12);
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.12),
    0 18px 42px -24px rgba(10, 132, 255, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.workspace.has-results .input-card {
  max-width: 100%;
  min-height: 98px;
  grid-template-columns: minmax(170px, 1.15fr) minmax(0, 4fr);
  align-items: center;
  padding: 18px 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
}

.workspace.has-results .mode-tabs,
.workspace.has-results .tab-panel,
.workspace.has-results .prompt-textarea {
  display: none;
}

.workspace.has-results .prompt-area-wrap {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(170px, 1.15fr) minmax(0, 4fr);
  align-items: center;
  gap: 20px;
  padding: 0;
}

.workspace.has-results .prompt-area-wrap::before {
  content: "Generate variations";
  display: block;
  color: var(--text);
  font-size: 15px;
  font-weight: 750;
  padding-left: 44px;
  background:
    radial-gradient(circle, rgba(10, 132, 255, 0.16) 0 16px, transparent 17px) left center / 34px 34px no-repeat;
}

.workspace.has-results .composer-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.workspace.has-results .composer-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.workspace.has-results .composer-tool {
  width: 100%;
  height: 52px;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border-med);
  color: var(--text-2);
}

.workspace.has-results .composer-tool span {
  display: inline;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.workspace.has-results .btn-generate {
  min-width: 190px;
}

.input-card::before { opacity: 0.72; }

.mode-tabs {
  grid-row: 1 / span 2;
  grid-column: 1;
  margin: 0;
  padding: 8px;
  border-radius: 28px 0 0 28px;
  background: rgba(118, 118, 128, 0.08);
  border: 0;
  border-right: 1px solid var(--border);
  flex-direction: column;
  gap: 6px;
}

.mode-tab {
  flex: 1;
  min-height: 62px;
  padding: 8px 6px;
  border-radius: 20px;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.05;
}

.mode-tab svg {
  width: 18px;
  height: 18px;
}

.mode-tab.active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--blue);
  box-shadow: 0 10px 26px rgba(10, 132, 255, 0.12), 0 0 0 1px rgba(10, 132, 255, 0.12);
}

.tab-panel {
  grid-column: 2;
  padding: 18px 20px 0;
}

.link-row { margin: 0; }

.link-input {
  min-height: 48px;
  border-radius: 18px;
  background: rgba(118, 118, 128, 0.07);
}

.upload-slots {
  grid-template-columns: repeat(3, minmax(0, 76px));
}

.upload-slot { border-radius: 16px; }

.prompt-area-wrap {
  grid-column: 2;
  padding: 10px 20px 18px;
  gap: 12px;
}

.prompt-textarea {
  min-height: 84px;
  padding: 4px 2px;
  border-radius: 0;
  background: transparent;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 500;
}

.prompt-textarea:focus { background: transparent; }

.composer-toolbar {
  padding: 0;
  align-items: flex-end;
}

.composer-tools { gap: 7px; }

.composer-tool {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  border-radius: 14px;
  background: rgba(118, 118, 128, 0.09);
  border-color: transparent;
}

.composer-tool span { display: none; }

.btn-generate {
  min-width: 138px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #68b7ff 0%, #0a84ff 46%, #5e5ce6 100%);
  box-shadow: 0 16px 34px rgba(10, 132, 255, 0.32);
}

.var-rail { max-width: 100%; }

.var-add-card {
  flex-direction: column;
}

.workspace.has-results .var-rail-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  overflow: visible;
  padding: 0 4px 24px;
}

.workspace.has-results .variation-set-card,
.workspace.has-results .variation-generate-more {
  width: 100%;
  min-height: 176px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.90);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.variation-card-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.variation-card-head strong {
  font-size: 14px;
  font-weight: 760;
  color: var(--text);
}

.variation-card-head span,
.variation-card-actions span,
.variation-generate-more small {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
}

.workspace.has-results .var-card-thumbs {
  height: 82px;
  border-radius: 12px;
  gap: 5px;
  border: 0;
  background: transparent;
}

.workspace.has-results .var-card-thumb {
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.variation-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.variation-card-actions button {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--text-2);
}

.variation-card-actions button:hover { background: var(--hover); }

.variation-generate-more {
  border: 1.5px dashed var(--border-med);
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  color: var(--text);
}

.variation-generate-more strong {
  font-size: 14px;
  font-weight: 760;
}

/* ── Source-first generation composer ── */
.input-card,
.workspace.has-results .input-card {
  width: 100%;
  max-width: 1120px;
  min-height: 148px;
  margin-inline: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px 18px;
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.input-card::before,
.input-card::after {
  content: none;
  display: none;
}

.input-card.has-source,
.input-card.has-source-content,
.workspace.is-loading .input-card,
.workspace.has-results .input-card {
  padding: 18px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,248,252,0.92)),
    radial-gradient(circle at 82% 14%, rgba(10,132,255,0.10), transparent 32%);
  border: 1px solid rgba(10, 132, 255, 0.10);
  box-shadow:
    0 22px 70px rgba(29, 29, 31, 0.10),
    0 12px 36px -24px rgba(10, 132, 255, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
  overflow: hidden;
}

.source-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.input-card.has-source .source-picker,
.workspace.is-loading .source-picker,
.workspace.has-results .source-picker {
  display: none;
}

.source-card {
  min-height: 250px;
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 0;
  box-shadow:
    0 22px 56px rgba(29, 29, 31, 0.10),
    0 12px 34px -24px rgba(10, 132, 255, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
  text-align: left;
  isolation: isolate;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.source-card:hover {
  transform: translateY(-3px);
  border-color: rgba(10, 132, 255, 0.28);
  box-shadow:
    0 24px 58px rgba(29, 29, 31, 0.12),
    0 14px 32px -22px rgba(10, 132, 255, 0.42);
}

.source-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}

.source-card-label {
  position: absolute;
  right: 42px;
  top: 62px;
  min-width: 220px;
  padding: 18px 22px 20px;
  border-radius: 24px;
  color: #000000;
  font-size: 30px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.86);
  box-shadow:
    0 14px 34px rgba(29, 29, 31, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.source-card-label strong {
  display: block;
  color: var(--blue);
}

.source-card-photos .source-card-label strong { color: #af52de; }

.source-card-plus {
  position: absolute;
  right: 66px;
  top: 170px;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--blue);
  font-size: 0;
  font-weight: 300;
  box-shadow:
    0 14px 32px rgba(29, 29, 31, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.source-card-plus::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 25px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.source-card-plus::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 25px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.source-card-photos .source-card-plus { color: #af52de; }

.tab-panel {
  padding: 0;
}

.workspace.has-results .tab-panel {
  display: none;
}

.input-card.has-upload-content #uploadPanel {
  display: none;
}

.link-input {
  min-height: 48px;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.07);
}

.input-card.has-source-content #linkPanel {
  display: none;
}

.upload-panel-card {
  min-height: 276px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 34px;
  padding: 30px 34px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 14% 18%, rgba(10, 132, 255, 0.14), transparent 30%),
    radial-gradient(circle at 86% 10%, rgba(52, 199, 89, 0.12), transparent 28%),
    linear-gradient(135deg, #f6f8fb 0%, #eef2f7 100%);
  border: 1px solid rgba(118, 118, 128, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 14px 44px rgba(29, 29, 31, 0.08);
}

.upload-panel-copy {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-panel-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
}

.upload-panel-copy p {
  max-width: 430px;
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 500;
}

.upload-slots-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.upload-slots {
  grid-template-columns: repeat(3, minmax(0, 110px));
  gap: 14px;
}

#uploadPanel .upload-slot {
  border-radius: 24px;
  border-color: rgba(118, 118, 128, 0.30);
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

#uploadPanel .upload-slot:hover {
  border-color: rgba(10, 132, 255, 0.55);
  background: rgba(255, 255, 255, 0.72);
}

.prompt-area-wrap,
.workspace.has-results .prompt-area-wrap {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.input-card:not(.has-source-content) .prompt-area-wrap {
  display: none;
}

.workspace.is-loading .input-card .prompt-area-wrap,
.workspace.has-results .input-card .prompt-area-wrap {
  display: flex;
}

.workspace.is-loading .prompt-area-wrap,
.workspace.has-results .prompt-area-wrap {
  width: 100%;
}

.workspace.is-loading .prompt-area-wrap::before,
.workspace.has-results .prompt-area-wrap::before {
  content: none;
}

.prompt-textarea {
  box-sizing: border-box;
  min-height: 112px;
  padding: 0 8px;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
  line-height: 1.45;
  font-weight: 520;
  overflow: visible;
}

.prompt-textarea:focus { background: transparent; }

.workspace.is-loading .prompt-textarea,
.workspace.has-results .prompt-textarea {
  display: block;
}

.selected-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selected-source-chip {
  min-height: 42px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 7px 5px 7px;
  border-radius: 999px;
  background: rgba(10, 132, 255, 0.10);
  color: var(--blue);
  border: 1px solid rgba(10, 132, 255, 0.16);
  font-size: 14px;
  font-weight: 760;
}

.selected-source-chip-upload {
  background: rgba(175, 82, 222, 0.10);
  color: #8e44c7;
  border-color: rgba(175, 82, 222, 0.18);
}

.selected-source-chip span:not(.selected-source-icon):not(.selected-source-empty) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-source-edit,
.selected-source-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  flex-shrink: 0;
}

.selected-source-edit:hover {
  background: rgba(255, 255, 255, 0.96);
}

.selected-source-app-icon {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  object-fit: cover;
}

.selected-source-app-fallback {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  font-size: 11px;
  font-weight: 800;
}

.selected-source-sf-icon,
.sf-symbol {
  width: 16px;
  height: 16px;
  object-fit: contain;
  opacity: 0.72;
}

.selected-source-thumbs {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.selected-source-thumbs img,
.selected-source-empty {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.90);
  box-shadow: 0 3px 8px rgba(29, 29, 31, 0.12);
}

.selected-source-thumbs img + img {
  margin-left: -10px;
}

.selected-source-empty {
  display: grid;
  place-items: center;
  color: #af52de;
  font-size: 21px;
  font-weight: 400;
}

.selected-source-reset {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: currentColor;
  opacity: 0.78;
}

.selected-source-reset .sf-symbol {
  width: 12px;
  height: 12px;
  opacity: 0.75;
}

.selected-source-reset:hover {
  background: rgba(255, 255, 255, 0.78);
  opacity: 1;
}

.composer-toolbar,
.workspace.is-loading .composer-toolbar,
.workspace.has-results .composer-toolbar {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  width: 100%;
  margin-left: auto;
}

.composer-tools,
.workspace.is-loading .composer-tools,
.workspace.has-results .composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  order: 1;
  margin-left: auto;
}

.composer-tool,
.workspace.is-loading .composer-tool,
.workspace.has-results .composer-tool {
  width: auto;
  height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.10);
  border: 0;
  color: var(--text-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.68),
    0 1px 2px rgba(29, 29, 31, 0.04);
}

.composer-tool.selected,
.workspace.is-loading .composer-tool.selected,
.workspace.has-results .composer-tool.selected {
  background: rgba(10, 132, 255, 0.12);
  color: var(--blue);
}

.composer-tool span,
.workspace.is-loading .composer-tool span,
.workspace.has-results .composer-tool span {
  display: inline;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.composer-tool.selected span,
.workspace.is-loading .composer-tool.selected span,
.workspace.has-results .composer-tool.selected span {
  color: var(--blue);
}

.composer-tool .sf-symbol,
.workspace.is-loading .composer-tool .sf-symbol,
.workspace.has-results .composer-tool .sf-symbol {
  width: 15px;
  height: 15px;
  opacity: 0.55;
}

.composer-tool .composer-tool-thumb ~ .sf-symbol {
  display: none;
}

.composer-tool-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1.5px solid rgba(255, 255, 255, 0.90);
  box-shadow: 0 3px 8px rgba(29, 29, 31, 0.14);
}

.composer-tool.selected .sf-symbol,
.workspace.is-loading .composer-tool.selected .sf-symbol,
.workspace.has-results .composer-tool.selected .sf-symbol {
  opacity: 0.9;
  filter: brightness(0) saturate(100%) invert(43%) sepia(95%) saturate(2362%) hue-rotate(195deg) brightness(101%) contrast(101%);
}

.composer-tool-pop {
  background: rgba(10, 132, 255, 0.09);
  color: var(--blue);
}

.reference-count-popover {
  position: fixed;
  width: max-content;
  min-width: 0;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 16px;
  background: rgba(248, 248, 250, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 18px 38px rgba(29, 29, 31, 0.16),
    0 2px 8px rgba(29, 29, 31, 0.08);
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  z-index: 140;
}

.reference-count-popover-title {
  padding: 4px 12px 2px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-2);
}

.reference-count-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 11px;
  color: var(--text);
  transition: background 0.16s ease, color 0.16s ease;
}

.reference-count-option:hover {
  background: rgba(0, 0, 0, 0.04);
}

.reference-count-option-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.52;
  transition: opacity 0.16s ease, color 0.16s ease;
}

.reference-count-option-main {
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  transition: color 0.16s ease;
}

.reference-count-option-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-left: 16px;
  opacity: 0;
  transition: opacity 0.16s ease;
  color: var(--blue);
}

.reference-count-option.selected {
  background: rgba(10, 132, 255, 0.09);
}

.reference-count-option.selected .reference-count-option-icon {
  opacity: 1;
  color: var(--blue);
}

.reference-count-option.selected .reference-count-option-main {
  font-weight: 700;
  color: var(--blue);
}

.reference-count-option.selected .reference-count-option-check {
  opacity: 1;
}

.btn-generate,
.workspace.is-loading .btn-generate,
.workspace.has-results .btn-generate {
  min-width: 168px;
  height: 58px;
  border-radius: 999px;
  background: linear-gradient(135deg, #5fb0ff 0%, #0a84ff 48%, #246bff 100%);
  color: #fff;
  box-shadow: 0 16px 34px rgba(10, 132, 255, 0.32);
  order: 2;
}

.btn-generate .sf-symbol,
.workspace.is-loading .btn-generate .sf-symbol,
.workspace.has-results .btn-generate .sf-symbol {
  width: 19px;
  height: 19px;
  opacity: 0.95;
  filter: invert(1);
}

/* ── Liquid glass composer ── */
.input-card.has-source,
.input-card.has-source-content,
.workspace.is-loading .input-card,
.workspace.has-results .input-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(250, 252, 255, 0.58)),
    linear-gradient(135deg, rgba(10, 132, 255, 0.10), rgba(94, 92, 230, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow:
    0 30px 90px rgba(29, 29, 31, 0.16),
    0 14px 46px rgba(10, 132, 255, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    inset 0 -1px 0 rgba(10, 132, 255, 0.08);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
}

.input-card.has-source::before,
.input-card.has-source-content::before,
.workspace.is-loading .input-card::before,
.workspace.has-results .input-card::before {
  content: '';
  display: block;
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.28) 34%, rgba(10, 132, 255, 0.10) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.04));
  pointer-events: none;
}

.input-card.has-source::after,
.input-card.has-source-content::after,
.workspace.is-loading .input-card::after,
.workspace.has-results .input-card::after {
  content: '';
  display: block;
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: calc(30px - 1px);
  box-shadow:
    inset 0 0 0 1px rgba(10, 132, 255, 0.08),
    inset 0 22px 44px rgba(255, 255, 255, 0.38);
  pointer-events: none;
}

.input-card.has-source > *,
.input-card.has-source-content > *,
.workspace.is-loading .input-card > *,
.workspace.has-results .input-card > * {
  position: relative;
  z-index: 1;
}

.selected-source-chip {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.16), rgba(94, 92, 230, 0.10));
  border-color: rgba(10, 132, 255, 0.22);
  color: var(--blue);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 1px 2px rgba(10, 132, 255, 0.07);
  backdrop-filter: blur(14px) saturate(155%);
  -webkit-backdrop-filter: blur(14px) saturate(155%);
}

.selected-source-chip-upload {
  background: rgba(255, 255, 255, 0.48);
  border-color: rgba(175, 82, 222, 0.20);
}

.prompt-textarea::placeholder {
  color: rgba(110, 110, 115, 0.82);
}

.composer-tool,
.workspace.is-loading .composer-tool,
.workspace.has-results .composer-tool {
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.56);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 1px 2px rgba(29, 29, 31, 0.05);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.composer-tool:hover,
.workspace.is-loading .composer-tool:hover,
.workspace.has-results .composer-tool:hover {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(10, 132, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.80),
    0 8px 20px rgba(29, 29, 31, 0.08);
}

.composer-tool.selected,
.workspace.is-loading .composer-tool.selected,
.workspace.has-results .composer-tool.selected,
.composer-tool-pop {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.16), rgba(94, 92, 230, 0.10));
  border-color: rgba(10, 132, 255, 0.20);
}

.workspace.has-results {
  padding-bottom: clamp(28px, 5vh, 64px);
}

.workspace.has-results .images-section {
  padding-bottom: 172px;
}

.workspace.has-results .input-card {
  width: min(920px, calc(100% - 40px));
  max-width: 920px;
  min-height: 0;
  align-self: center;
  padding: 14px 16px 14px;
  gap: 10px;
  position: sticky;
  bottom: clamp(14px, 3vh, 28px);
  z-index: 40;
  margin-top: -178px;
}

.workspace.has-results .prompt-area-wrap {
  gap: 10px;
}

.workspace.has-results .selected-source-row {
  display: none;
}

.workspace.has-results .prompt-textarea {
  min-height: 44px;
  max-height: 84px;
  padding: 3px 4px 0;
  font-size: 15px;
  line-height: 1.42;
}

.workspace.has-results .composer-toolbar {
  gap: 10px;
}

.workspace.has-results .composer-tools {
  justify-content: flex-start;
  margin-left: 0;
  margin-right: auto;
}

.workspace.has-results .composer-tool {
  height: 38px;
  padding: 0 13px;
}

.workspace.has-results .btn-generate {
  min-width: 148px;
  height: 48px;
  box-shadow:
    0 14px 30px rgba(10, 132, 255, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.workspace.is-library .input-card {
  width: min(920px, calc(100% - 40px));
  max-width: 920px;
  min-height: 0;
  align-self: center;
  padding: 14px 16px;
  gap: 10px;
  position: sticky;
  bottom: clamp(14px, 3vh, 28px);
  z-index: 40;
  margin-top: -172px;
  border-radius: 30px;
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(250, 252, 255, 0.58)),
    linear-gradient(135deg, rgba(10, 132, 255, 0.10), rgba(94, 92, 230, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow:
    0 30px 90px rgba(29, 29, 31, 0.16),
    0 14px 46px rgba(10, 132, 255, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    inset 0 -1px 0 rgba(10, 132, 255, 0.08);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
}

.workspace.is-library .input-card::before {
  content: '';
  display: block;
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.28) 34%, rgba(10, 132, 255, 0.10) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.04));
  pointer-events: none;
}

.workspace.is-library .input-card::after {
  content: '';
  display: block;
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 29px;
  box-shadow:
    inset 0 0 0 1px rgba(10, 132, 255, 0.08),
    inset 0 22px 44px rgba(255, 255, 255, 0.38);
  pointer-events: none;
}

.workspace.is-library .input-card > * {
  position: relative;
  z-index: 1;
}

.workspace.is-library.library-has-shots .source-picker {
  display: none;
}

.workspace.is-library.library-has-shots .prompt-area-wrap {
  width: 100%;
  display: flex;
  gap: 10px;
}

.workspace.is-library.library-has-shots .selected-source-row {
  display: none;
}

.workspace.is-library.library-has-shots .prompt-textarea {
  display: block;
  min-height: 44px;
  max-height: 84px;
  padding: 3px 4px 0;
  font-size: 15px;
  line-height: 1.42;
}

.workspace.is-library.library-has-shots .composer-toolbar {
  gap: 10px;
}

.workspace.is-library.library-has-shots .composer-tools {
  justify-content: flex-start;
  margin-left: 0;
  margin-right: auto;
}

.workspace.is-library.library-has-shots .composer-tool {
  height: 38px;
  padding: 0 13px;
}

.workspace.is-library.library-has-shots .btn-generate {
  min-width: 148px;
  height: 48px;
  box-shadow:
    0 14px 30px rgba(10, 132, 255, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

/* Dark-mode compositor polish. These rules sit after the composer refresh so they win. */
:root[data-theme="dark"] .input-card,
:root[data-theme="dark"] .input-card.has-source,
:root[data-theme="dark"] .input-card.has-source-content,
:root[data-theme="dark"] .workspace.is-loading .input-card,
:root[data-theme="dark"] .workspace.has-results .input-card,
:root[data-theme="dark"] .workspace.is-library .input-card {
  background:
    linear-gradient(180deg, rgba(42, 43, 48, 0.88), rgba(24, 25, 30, 0.80)),
    radial-gradient(circle at 18% 0%, rgba(77, 163, 255, 0.18), transparent 38%);
  border-color: rgba(255, 255, 255, 0.13);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.48),
    0 16px 48px rgba(77, 163, 255, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45);
}

:root[data-theme="dark"] .input-card.has-source::before,
:root[data-theme="dark"] .input-card.has-source-content::before,
:root[data-theme="dark"] .workspace.is-loading .input-card::before,
:root[data-theme="dark"] .workspace.has-results .input-card::before,
:root[data-theme="dark"] .workspace.is-library .input-card::before {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.035) 42%, rgba(77, 163, 255, 0.10) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
}

:root[data-theme="dark"] .input-card.has-source::after,
:root[data-theme="dark"] .input-card.has-source-content::after,
:root[data-theme="dark"] .workspace.is-loading .input-card::after,
:root[data-theme="dark"] .workspace.has-results .input-card::after,
:root[data-theme="dark"] .workspace.is-library .input-card::after {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.055),
    inset 0 20px 42px rgba(255, 255, 255, 0.055);
}

:root[data-theme="dark"] .prompt-textarea,
:root[data-theme="dark"] .workspace.has-results .prompt-textarea,
:root[data-theme="dark"] .workspace.is-library.library-has-shots .prompt-textarea {
  color: var(--text);
}

:root[data-theme="dark"] .prompt-textarea::placeholder {
  color: rgba(245, 245, 247, 0.48);
}

:root[data-theme="dark"] .composer-tool,
:root[data-theme="dark"] .workspace.is-loading .composer-tool,
:root[data-theme="dark"] .workspace.has-results .composer-tool,
:root[data-theme="dark"] .workspace.is-library.library-has-shots .composer-tool {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.20);
}

:root[data-theme="dark"] .composer-tool:hover,
:root[data-theme="dark"] .workspace.is-loading .composer-tool:hover,
:root[data-theme="dark"] .workspace.has-results .composer-tool:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.18);
}

:root[data-theme="dark"] .composer-tool span,
:root[data-theme="dark"] .workspace.has-results .composer-tool span,
:root[data-theme="dark"] .workspace.is-library.library-has-shots .composer-tool span {
  color: rgba(245, 245, 247, 0.76);
}

:root[data-theme="dark"] .composer-tool.selected,
:root[data-theme="dark"] .workspace.is-loading .composer-tool.selected,
:root[data-theme="dark"] .workspace.has-results .composer-tool.selected,
:root[data-theme="dark"] .composer-tool-pop {
  background: linear-gradient(135deg, rgba(77, 163, 255, 0.20), rgba(142, 139, 255, 0.13));
  border-color: rgba(77, 163, 255, 0.34);
  color: var(--blue);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 2px rgba(10, 132, 255, 0.10);
}

:root[data-theme="dark"] .composer-tool.selected span,
:root[data-theme="dark"] .workspace.has-results .composer-tool.selected span,
:root[data-theme="dark"] .workspace.is-library.library-has-shots .composer-tool.selected span {
  color: var(--blue);
}

:root[data-theme="dark"] .composer-tool .sf-symbol,
:root[data-theme="dark"] .workspace.is-loading .composer-tool .sf-symbol,
:root[data-theme="dark"] .workspace.has-results .composer-tool .sf-symbol,
:root[data-theme="dark"] .workspace.is-library.library-has-shots .composer-tool .sf-symbol {
  opacity: 0.64;
  filter: none;
}

:root[data-theme="dark"] .composer-tool.selected .sf-symbol,
:root[data-theme="dark"] .workspace.is-loading .composer-tool.selected .sf-symbol,
:root[data-theme="dark"] .workspace.has-results .composer-tool.selected .sf-symbol,
:root[data-theme="dark"] .workspace.is-library.library-has-shots .composer-tool.selected .sf-symbol {
  opacity: 0.9;
  filter: brightness(0) saturate(100%) invert(43%) sepia(95%) saturate(2362%) hue-rotate(195deg) brightness(101%) contrast(101%);
}

:root[data-theme="dark"] .composer-tool-thumb {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.32);
}

:root[data-theme="dark"] .selected-source-chip {
  background: linear-gradient(135deg, rgba(77, 163, 255, 0.20), rgba(142, 139, 255, 0.13));
  border-color: rgba(77, 163, 255, 0.34);
  color: var(--blue);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 1px 2px rgba(10, 132, 255, 0.10);
}

:root[data-theme="dark"] .selected-source-chip span:not(.selected-source-empty),
:root[data-theme="dark"] .selected-source-reset {
  color: var(--blue);
}

:root[data-theme="dark"] .selected-source-edit,
:root[data-theme="dark"] .selected-source-icon,
:root[data-theme="dark"] .selected-source-thumbs img,
:root[data-theme="dark"] .selected-source-empty {
  background: rgba(225, 239, 255, 0.16);
  border-color: rgba(133, 190, 255, 0.42);
}

:root[data-theme="dark"] .selected-source-reset:hover {
  background: rgba(77, 163, 255, 0.14);
}

:root[data-theme="dark"] .reference-count-popover {
  background: rgba(30, 31, 36, 0.94);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.46),
    0 2px 9px rgba(0, 0, 0, 0.30);
}

:root[data-theme="dark"] .reference-count-option:hover {
  background: rgba(255, 255, 255, 0.07);
}

:root[data-theme="dark"] .reference-count-popover-title {
  color: rgba(245, 245, 247, 0.64);
}

:root[data-theme="dark"] .reference-count-option-icon {
  opacity: 0.62;
}

:root[data-theme="dark"] .reference-count-option.selected {
  background: rgba(77, 163, 255, 0.14);
}

:root[data-theme="dark"] .reference-count-option.selected .reference-count-option-icon {
  opacity: 0.95;
}

.workspace #uploadPanel .upload-panel-card,
.landing-input-card #uploadPanel .upload-panel-card {
  min-height: 276px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 34px;
  padding: 30px 34px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 14% 18%, rgba(10, 132, 255, 0.14), transparent 30%),
    radial-gradient(circle at 86% 10%, rgba(52, 199, 89, 0.12), transparent 28%),
    linear-gradient(135deg, #f6f8fb 0%, #eef2f7 100%);
  border: 1px solid rgba(118, 118, 128, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 14px 44px rgba(29, 29, 31, 0.08);
}

.workspace #uploadPanel .upload-panel-copy,
.landing-input-card #uploadPanel .upload-panel-copy {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workspace #uploadPanel .upload-panel-copy h2,
.landing-input-card #uploadPanel .upload-panel-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
}

.workspace #uploadPanel .upload-panel-copy p,
.landing-input-card #uploadPanel .upload-panel-copy p {
  max-width: 430px;
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 500;
}

.workspace #uploadPanel .upload-slots-wrap,
.landing-input-card #uploadPanel .upload-slots-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.workspace #uploadPanel .upload-slots,
.landing-input-card #uploadPanel .upload-slots {
  grid-template-columns: repeat(3, minmax(0, 110px));
  gap: 14px;
}

:root[data-theme="dark"] .btn-generate,
:root[data-theme="dark"] .workspace.is-loading .btn-generate,
:root[data-theme="dark"] .workspace.has-results .btn-generate {
  box-shadow:
    0 16px 34px rgba(10, 132, 255, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

:root[data-theme="dark"] .btn-fan-out,
:root[data-theme="dark"] .app-library-localize-btn,
:root[data-theme="dark"] .app-library-back-btn,
:root[data-theme="dark"] .set-back-btn {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--blue);
}

:root[data-theme="dark"] .btn-fan-out:hover,
:root[data-theme="dark"] .app-library-localize-btn:hover,
:root[data-theme="dark"] .app-library-back-btn:hover,
:root[data-theme="dark"] .set-back-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

:root[data-theme="dark"] .app-library-set-row::before {
  background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .app-library-row-action {
  background: rgba(44, 44, 50, 0.92);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.42),
    0 2px 8px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: rgba(245, 245, 247, 0.90);
}

:root[data-theme="dark"] .app-library-row-action:hover {
  background: rgba(58, 58, 66, 0.96);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.50),
    0 3px 10px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

:root[data-theme="dark"] .app-library-row-action-delete {
  color: #ff6b6b;
}

:root[data-theme="dark"] .app-library-row-action-delete:hover {
  color: #ff4444;
}

:root[data-theme="dark"] .app-row-more-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-2);
}

:root[data-theme="dark"] .app-row-more-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

:root[data-theme="dark"] .app-row-menu {
  background: rgba(24, 24, 28, 0.98);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
}

:root[data-theme="dark"] .app-row-menu-item.danger:hover {
  background: rgba(229, 62, 62, 0.20);
}

.showcase-track img,
.app-library-shot-card,
.fetched-screen,
.frame-thumb,
.sheet-img,
.image-card,
.compare-tile-thumb {
  outline: 0.5px solid var(--appstore-shot-border);
  outline-offset: -0.5px;
  border-color: transparent;
}

.showcase-track img {
  box-shadow: var(--shadow-lg);
}

.app-library-shot-card {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.30);
}

.app-library-set-row-parent.expanded .app-library-shot-card {
  box-shadow:
    0 0 0 1px rgba(10, 132, 255, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.30);
}

.fetched-screen {
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.20),
    0 4px 12px rgba(0, 0, 0, 0.10);
}

.fetched-screen:hover {
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.26),
    0 6px 16px rgba(0, 0, 0, 0.12);
}

.sheet-img {
  box-shadow: var(--shadow-lg);
}

.image-card {
  box-shadow: var(--shadow-sm);
}

.image-card:hover {
  box-shadow: var(--shadow-lg);
}

.compare-tile-thumb {
  box-shadow: var(--shadow-sm);
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Keyframes ── */
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-22px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shrinkFade {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.92) translateY(12px); }
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(44px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes resultFlipIn {
  0%   { opacity: 0; transform: rotateY(55deg) scale(0.6); filter: blur(10px); }
  55%  { opacity: 1; filter: blur(0px); }
  100% { opacity: 1; transform: rotateY(0deg) scale(1); filter: blur(0px); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes appRowSpin {
  to { transform: translateY(-50%) rotate(360deg); }
}

@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0.55); opacity: 0.5; }
  40%           { transform: scale(1);    opacity: 1; }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%       { opacity: 0.9; transform: scale(1.08); }
}

@keyframes shimmer {
  0%   { left: -100%; }
  100% { left: 200%; }
}

@keyframes librarySkeletonIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes librarySkeletonShimmer {
  0%, 15%   { background-position: 200% 0, 0 0, 0 0; }
  85%, 100% { background-position: -100% 0, 0 0, 0 0; }
}

@keyframes libraryImageSheen {
  0%, 18%   { background-position: 180% 0, 0 0; opacity: 0.88; }
  72%, 100% { background-position: -90% 0, 0 0; opacity: 0.56; }
}

@keyframes carouselDrift {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-50% - 11px)); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes notificationPermissionIn {
  from { opacity: 0; transform: translateY(18px) scale(0.94); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* ── Responsive ── */
@media (max-width: 700px) {
  .landing-nav { width: calc(100% - 24px); }
  .landing-footer {
    width: calc(100% - 24px);
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
  .legal-page {
    width: calc(100% - 24px);
    padding-top: 22px;
  }
  .legal-document {
    padding: 28px 20px;
    border-radius: 18px;
  }
  .btn-google-small { padding-inline: 14px; font-size: 0; gap: 0; }
  .hero-brand { margin-bottom: 18px; gap: 8px; }
  .hero-brand-mark { width: 74px; height: 74px; }
  .hero-kicker { font-size: 11px; }
  .hero h1 { font-size: 40px; }
  .hero-copy { font-size: 17px; }
  .landing-composer { margin-top: 26px; border-radius: 22px; }
  .landing-composer textarea { min-height: 106px; font-size: 15px; }
  .landing-style-btn { display: none; }
  .landing-generate-btn { padding-inline: 16px; }
  .landing-input-mount { margin-top: 26px; }
  .landing-stage-fan .landing-fetch-mount { min-height: clamp(300px, 48vh, 430px); }
  .landing-fetch-mount .screenshot-fan { padding: 34px 22px 76px; }
  .showcase-carousel { padding: 26px 0 46px; }
  .showcase-track { gap: 14px; }
  .showcase-track img { width: 58vw; min-width: 0; border-radius: 20px; }

  .app-view { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    min-height: 0;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    overflow-x: auto;
  }
  .sidebar-brand { padding: 0; border: none; margin: 0; flex-shrink: 0; }
  .sidebar-brand-name { display: none; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding: 0; gap: 4px; flex: 1; }
  .sidebar-label { display: none; }
  .sidebar-add-btn { white-space: nowrap; margin: 0; padding: 6px 10px; }
  .sidebar-foot { padding: 0; flex-shrink: 0; }
  .sidebar-sign-out { white-space: nowrap; }
  .sidebar-toggle { top: 12px; left: 12px; }
  .project-strip { flex-direction: row; gap: 4px; }
  .app-row { flex-direction: row; }
  .app-row .app-sets, .app-chevron, .app-row-count { display: none !important; }
  .app-row-name { font-size: 12px; }

  .app-main { padding: 14px 14px 32px; gap: 18px; }
  .workspace.is-library { padding-top: 18px; }
  .app-library-header { align-items: flex-start; flex-direction: column; }
  .app-library-title { max-width: 100%; font-size: 34px; }
  .app-library-grid { grid-template-columns: 1fr; }
  .localizations-panel { align-items: stretch; flex-direction: column; }
  .localizations-head { width: 100%; }
  .input-card { max-width: 100%; }
  .source-picker { grid-template-columns: 1fr; gap: 12px; }
  .source-card { min-height: 168px; border-radius: 20px; }
  .source-card-label {
    right: 18px;
    top: 24px;
    min-width: 176px;
    padding: 14px 16px 16px;
    border-radius: 18px;
    font-size: 24px;
  }
  .source-card-plus {
    right: 28px;
    top: auto;
    bottom: 22px;
    width: 48px;
    height: 48px;
    font-size: 31px;
  }
  .upload-panel-card {
    min-height: 0;
    grid-template-columns: 1fr;
    justify-items: stretch;
    gap: 22px;
    padding: 24px 18px 22px;
    border-radius: 22px;
  }
  .upload-panel-copy {
    max-width: none;
    text-align: left;
  }
  .upload-panel-copy h2 { font-size: 23px; }
  .upload-panel-copy p { font-size: 14px; }
  .upload-slots-wrap { width: 100%; }
  #uploadPanel .upload-slots {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #uploadPanel .upload-slot { border-radius: 18px; }
  .composer-toolbar { gap: 8px; }
  .btn-generate { width: 100%; justify-content: center; }
  .results-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .results-title { font-size: 19px; }
  .images-section { max-width: 100%; }
  .var-card, .var-add-card { width: 100%; min-height: 82px; }
  .images-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .upload-slots { gap: 8px; }
  .sheet-actions { flex-direction: column; align-items: stretch; }
  .btn-edit, .btn-accept { justify-content: center; }
  .edit-panel { width: calc(100% - 28px); }
  .frame-row .frame-card { width: 110px; }
  .auth-card { padding: 30px 22px 24px; border-radius: 24px; }
}

/* ── Compare strip (variations of active set, above results grid) ── */
.compare-strip {
  display: flex;
  gap: 10px;
  padding: 8px 2px 14px;
  margin: -4px 0 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.compare-strip::-webkit-scrollbar { height: 6px; }
.compare-strip::-webkit-scrollbar-thumb { background: var(--border-med); border-radius: 3px; }

.compare-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.compare-tile:hover { background: var(--hover); }
.compare-tile.current {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 6%, transparent);
}
.compare-tile-thumb {
  width: 56px;
  aspect-ratio: 9 / 16;
  border-radius: 7px;
  border: 1px solid var(--appstore-shot-border);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow:
    var(--shadow-sm),
    inset 0 0 0 1px var(--appstore-shot-border);
}
.compare-tile-thumb img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
}
.compare-tile-label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.compare-tile.current .compare-tile-label { color: var(--text); font-weight: 600; }

/* ── Fan-out button ── */
.btn-fan-out {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 0;
  cursor: pointer;
  transition: filter 0.16s ease, transform 0.16s ease;
}
.btn-fan-out:hover { filter: brightness(1.06); }
.btn-fan-out:active { transform: scale(0.98); }

/* ── Photos title row ── */
.photos-title-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.photos-title-row label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.photos-title-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
#photosAppNameInput {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  border: 1px solid transparent;
  transition: border-color 0.16s ease, background 0.16s ease;
}
#photosAppNameInput:focus {
  border-color: var(--blue);
  background: var(--surface);
}
.btn-suggest {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  border: 0;
  cursor: pointer;
  transition: background 0.16s ease;
}
.btn-suggest:hover { background: var(--hover-strong); }
.btn-suggest .sf-symbol { width: 14px; height: 14px; }

/* ── Source picker pulse for new-app flow ── */
@keyframes source-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--blue) 35%, transparent); }
  70%  { box-shadow: 0 0 0 14px color-mix(in srgb, var(--blue) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--blue) 0%, transparent); }
}
.source-picker.pulse-once {
  animation: source-pulse 0.7s ease-out;
  border-radius: var(--r-md);
}

/* ── Fan-out picker: 'Select all' chip ── */
.lang-chip-all {
  border: 1px dashed var(--border-med);
  color: var(--blue);
  font-weight: 600;
}
.lang-chip-all:hover { background: color-mix(in srgb, var(--blue) 6%, transparent); }

@media (max-width: 700px) {
  .workspace.has-results .images-section {
    padding-bottom: 218px;
  }

  .workspace.is-library .app-library-section {
    padding-bottom: 238px;
  }

  .workspace.is-library .app-library-grid {
    align-items: stretch;
    gap: 4px;
  }

  .app-library-detail,
  .app-library-detail-rows {
    gap: 4px;
  }

  .app-library-set-row {
    gap: 4px;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-library-set-row::-webkit-scrollbar {
    display: none;
  }

  .app-library-shot-card {
    width: min(31vw, 150px);
    min-width: min(31vw, 150px);
    border-radius: 14px;
  }

  .workspace.is-library .input-card {
    width: calc(100% - 18px);
    padding: 12px;
    bottom: 10px;
    margin-top: -214px;
    border-radius: 24px;
  }

  .workspace.has-results .input-card {
    width: calc(100% - 18px);
    padding: 12px;
    bottom: 10px;
    margin-top: -198px;
    border-radius: 24px;
  }

  .workspace.has-results .prompt-textarea {
    min-height: 56px;
    max-height: 108px;
    font-size: 14.5px;
  }

  .workspace.has-results .composer-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace.has-results .composer-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .workspace.has-results .composer-tool {
    height: 36px;
    padding: 0 11px;
  }

  .workspace.has-results .composer-tool span {
    font-size: 12px;
  }

  .workspace.has-results .btn-generate {
    width: 100%;
    min-width: 0;
    height: 48px;
  }
}


.app-library-scroll-sentinel { height: 1px; width: 100%; }
