/* ============================================================
   MyCreations AI — Design System
   A premium, editorial aesthetic for AI-generation asset management
   ============================================================ */

/* --- 1. Design tokens -------------------------------------- */
:root {
  /* Color — sophisticated deep surfaces with warm undertones */
  --bg-base:       #0a0a0b;
  --bg-raised:    #111113;
  --bg-sunken:    #060607;
  --bg-card:      #131316;
  --bg-hover:     #1a1a1e;
  --bg-active:    #1f1f25;

  --line:         #1f1f24;
  --line-strong:  #2a2a31;
  --line-accent:  rgba(124, 107, 255, 0.24);

  --text-primary: #ededee;
  --text-secondary: #a8a8ad;
  --text-tertiary: #6a6a72;
  --text-disabled: #3a3a42;

  /* Accent — distinctive violet-to-coral */
  --accent:        #7c6bff;
  --accent-hover:  #8f7fff;
  --accent-soft:   rgba(124, 107, 255, 0.14);
  --accent-subtle: rgba(124, 107, 255, 0.08);

  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --danger:  #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display",
               "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;

  /* Spacing (4pt grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radii */
  --radius-sm: 4px;
  --radius:    6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow:    0 4px 12px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.2);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.5), 0 8px 20px rgba(0,0,0,0.3);

  /* Motion */
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms;
  --dur:      200ms;
  --dur-slow: 320ms;

  /* Layout */
  --header-h: 56px;
  --sidebar-w: 240px;
  --container-max: 1680px;
}

/* --- 2. Reset + base --------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }

/* --- 3. Icon system ---------------------------------------- */
.icon { width: 16px; height: 16px; display: inline-block; flex: 0 0 auto;
        stroke: currentColor; fill: none; stroke-width: 1.75;
        stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 12px; height: 12px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }

/* --- 4. Header --------------------------------------------- */
.header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  padding: 0 var(--space-4);
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.brand {
  display: flex; align-items: center; gap: var(--space-2);
  font-weight: 600; font-size: 14px; letter-spacing: -0.02em;
  padding-right: var(--space-3);
  margin-right: auto;
}
.brand-mark {
  width: 22px; height: 22px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, #ff6b8a 100%);
  display: grid; place-items: center;
  box-shadow: 0 2px 8px var(--accent-soft);
}
.brand-mark svg { stroke: #fff; }

/* --- 5. Buttons ------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 6px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--text-primary);
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
  user-select: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled):not(.btn-active) {
  background: var(--bg-hover);
  border-color: var(--line-strong);
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.btn-active {
  background: var(--accent-soft);
  border-color: var(--line-accent);
  color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-danger { color: var(--danger); }
.btn-danger:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  justify-content: center;
}

/* --- 6. Inputs --------------------------------------------- */
.input {
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  min-width: 0;
  transition: border-color var(--dur-fast) var(--ease);
}
.input:focus { outline: none; border-color: var(--accent); }
.input::placeholder { color: var(--text-tertiary); }

.search {
  position: relative; flex: 1; min-width: 120px; max-width: 280px;
}
.search .icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding-left: 32px;
}

/* --- 7. Account selector ---------------------------------- */
.account-selector { position: relative; }
.account-btn {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 6px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  max-width: 220px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-btn:hover { background: var(--bg-hover); border-color: var(--line-strong); }
.account-btn .chev { color: var(--text-tertiary); margin-left: auto; }
.account-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 260px; max-height: 400px; overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
}
.account-menu.open { display: block; }
.menu-group {
  padding: 6px 10px 4px;
  font-size: 10px; font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 6px;
}
.menu-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.menu-item .check {
  width: 14px; display: flex; justify-content: center;
  color: var(--accent);
}
.menu-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-divider {
  height: 1px; background: var(--line); margin: 4px 0;
}
.menu-footer {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 8px 10px; font-size: 12px; color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.menu-footer:hover { background: var(--bg-hover); color: var(--text-primary); }

/* --- 8. Filter chips --------------------------------------- */
.tabs {
  display: flex; align-items: center; gap: var(--space-1);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.chip.active {
  background: var(--bg-raised);
  border-color: var(--line-strong);
  color: var(--text-primary);
}
.chip .count {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
}
.chip.active .count {
  background: var(--accent-soft);
  color: var(--accent);
}

/* --- 9. Status bar ---------------------------------------- */
.status-bar {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  padding: var(--space-2) var(--space-4) 0;
  display: flex; align-items: center; gap: var(--space-4);
  flex-wrap: wrap;
}
.status-bar a { color: var(--accent); }
.status-bar a:hover { text-decoration: underline; }
.status-saving { color: var(--accent); }
.status-pulse::before {
  content: ""; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --- 10. Sections ----------------------------------------- */
.section {
  padding: var(--space-6) var(--space-4) var(--space-10);
  max-width: var(--container-max);
  margin: 0 auto;
}
.section.hidden { display: none; }
.section-head {
  display: flex; align-items: baseline; gap: var(--space-3);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--line);
  position: sticky; top: var(--header-h);
  background: var(--bg-base);
  z-index: 5;
  padding-top: var(--space-3);
}
.section-title {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 13px; font-weight: 600;
  letter-spacing: -0.01em;
}
.section-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 400;
}
.section-actions {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--space-2);
}

/* --- 11. Date group --------------------------------------- */
.date-block { margin-bottom: var(--space-8); }
.date-block.hidden { display: none; }
.date-label {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) 0 var(--space-4);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.date-label .line {
  flex: 1; height: 1px;
  background: var(--line);
}
.date-label .count {
  padding: 1px 6px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

/* --- 12. Grid --------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
}
@media (min-width: 768px) {
  .grid { gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* --- 13. Card --------------------------------------------- */
.card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease-out);
}
.card:hover { border-color: var(--line-strong); }
.card.hidden { display: none; }
.card.selected { border-color: var(--accent); }
/* Heart pin — always visible when favorited */
.card .fav-pin {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: rgba(255, 77, 106, 0.95);
  border-radius: var(--radius-full);
  color: #fff;
  z-index: 3;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease-spring);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(255, 77, 106, 0.4);
}
.card.fav-on .fav-pin {
  opacity: 1;
  transform: scale(1);
}
.card.fav-on .fav-pin .icon { fill: #fff; stroke: none; }
.card.fav-on .btn-fav .icon {
  fill: #ff4d6a; color: #ff4d6a;
}
.card.fav-on .btn-fav {
  background: rgba(255, 77, 106, 0.15);
  border-color: rgba(255, 77, 106, 0.4);
}
.card.upscaled::after {
  content: "HD"; position: absolute;
  bottom: calc(var(--meta-h, 48px) + 8px); right: 8px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
  padding: 2px 6px;
  background: rgba(124, 107, 255, 0.92);
  color: #fff;
  border-radius: var(--radius-sm);
  letter-spacing: 0.06em;
}
.card.saved {
  outline: 1px solid rgba(74, 222, 128, 0.25);
  outline-offset: -1px;
}

.card .thumb {
  aspect-ratio: 1;
  background: var(--bg-sunken);
  overflow: hidden;
  position: relative;
}
.card .thumb img,
.card .thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--dur-slow) var(--ease-out);
}
.card:hover .thumb img { transform: scale(1.04); }
.card .hover-vid {
  position: absolute; inset: 0;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.card:hover .hover-vid { opacity: 1; }

.card .badge {
  position: absolute; bottom: 8px; left: 8px;
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700;
  padding: 2px 5px;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  color: #fff;
  border-radius: var(--radius-sm);
  letter-spacing: 0.08em;
}
.card .badge-saved {
  background: rgba(74, 222, 128, 0.22);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.card .overlay {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 6px;
  display: flex; align-items: flex-start; justify-content: space-between;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
  pointer-events: none;
}
.card:hover .overlay, .card.selected .overlay { opacity: 1; }
.card .overlay > * { pointer-events: auto; }

.card .icon-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.card .icon-btn:hover { background: rgba(0,0,0,0.85); }
.card .icon-btn.active { color: var(--accent); background: rgba(124,107,255,0.2); border-color: var(--accent); }

.card .icon-group { display: flex; gap: 4px; }

.card .meta {
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
  --meta-h: 48px;
}
.card .name {
  font-size: 12px; font-weight: 500;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .sub {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--text-tertiary);
}

.card .check {
  position: absolute; top: 6px; left: 6px;
  width: 22px; height: 22px;
  border: 1.5px solid rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: transparent;
  cursor: pointer;
  z-index: 2;
}
.card.selected .check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- 14. Lightbox ----------------------------------------- */
.lb {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(20px);
  z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  overscroll-behavior: contain;
}
.lb.open { display: flex; }
.lb-stage {
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.lb-stage img, .lb-stage video {
  max-width: 92vw; max-height: 84vh;
  object-fit: contain;
  transform-origin: 0 0;
  user-select: none;
}
.lb-stage.zoomed img, .lb-stage.zoomed video { cursor: grab; }
.lb-stage.grabbing img, .lb-stage.grabbing video { cursor: grabbing; }

.lb-bar {
  position: absolute; top: 0; left: 0; right: 0;
  padding: var(--space-3) var(--space-4);
  display: flex; align-items: center; gap: var(--space-2);
  background: linear-gradient(rgba(0,0,0,0.8), transparent);
  z-index: 2;
}
.lb-title {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 500;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-title .meta-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: var(--space-2);
}
.lb-bar .btn {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
}
.lb-bar .btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
}

.lb-nav {
  position: absolute; top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  color: #fff;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.lb-nav:hover { background: rgba(0,0,0,0.85); }
.lb-nav-prev { left: var(--space-4); }
.lb-nav-next { right: var(--space-4); }

.lb-counter {
  position: absolute; bottom: var(--space-4); left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  padding: 4px 10px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-full);
  z-index: 2;
}

.lb-info {
  position: absolute; bottom: var(--space-4); left: var(--space-4);
  max-width: 40vw;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  padding: var(--space-3) var(--space-4);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  line-height: 1.6;
  z-index: 2;
}
.lb-info b { color: var(--text-primary); font-weight: 600; margin-right: 4px; }
.lb-info .hd-badge {
  display: inline-block;
  padding: 1px 6px;
  background: linear-gradient(135deg, var(--accent), #ff6b8a);
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  border-radius: var(--radius-sm);
  margin-right: 4px;
}

.lb-help {
  position: absolute; bottom: var(--space-4); right: var(--space-4);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-tertiary);
  z-index: 2;
  display: flex; gap: var(--space-3);
}
.lb-help kbd {
  padding: 1px 5px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 10px;
}

/* Frame strip in lightbox */
.lb-frames {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: none;
  gap: 6px;
  padding: var(--space-3) var(--space-4) var(--space-4);
  overflow-x: auto;
  background: linear-gradient(transparent, rgba(0,0,0,0.85) 40%);
  z-index: 3;
  scrollbar-width: thin;
}
.lb-frames:not(:empty) { display: flex; }
.lb-frames .fr {
  position: relative; flex: 0 0 auto;
  cursor: pointer;
}
.lb-frames img {
  height: 72px; width: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: border-color var(--dur-fast) var(--ease);
}
.lb-frames .fr:hover img { border-color: var(--line-strong); }
.lb-frames .fr.upscaled img { border-color: var(--accent); }
.lb-frames .fr .idx {
  position: absolute; top: 3px; left: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 4px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  border-radius: 2px;
}
.lb-frames .fr .dl {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  background: rgba(0,0,0,0.8);
  border-radius: 2px;
  color: #fff;
}

/* Frame preview modal */
.fp {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.98);
  z-index: 200;
  display: none;
  align-items: center; justify-content: center;
}
.fp.open { display: flex; }
.fp-stage {
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.fp-stage img { max-width: 92vw; max-height: 84vh; object-fit: contain; }
.fp-strip {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; gap: 4px;
  padding: var(--space-3);
  overflow-x: auto;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  z-index: 3;
}
.fp-strip .fs { position: relative; flex: 0 0 auto; cursor: pointer; }
.fp-strip img {
  height: 64px; width: 64px; object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
}
.fp-strip .fs.current img { border-color: var(--accent); }
.fp-strip .idx {
  position: absolute; top: 2px; left: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 0 3px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  border-radius: 2px;
}

/* Upscaling indicator */
.overlay-loading {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: var(--space-3) var(--space-5);
  background: rgba(0,0,0,0.85);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: #fff;
  z-index: 5;
  display: flex; align-items: center; gap: var(--space-2);
}

/* --- 15. Footer -------------------------------------------- */
.footer {
  text-align: center;
  padding: var(--space-8) var(--space-4) var(--space-12);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.08em;
}

/* --- 16. Mobile ------------------------------------------- */
@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }
  .brand { margin-right: auto; }
  .search { max-width: 100%; order: 10; flex-basis: 100%; }
  .tabs { flex: 1; overflow-x: auto; }
  .account-btn { max-width: 140px; }
  .btn-text-mobile { display: none; }
  .section { padding: var(--space-4) var(--space-3) var(--space-8); }
  .section-head { top: 96px; padding-top: var(--space-2); margin-bottom: var(--space-3); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-2); }
  .card .meta { padding: 6px 8px; }
  .card .name { font-size: 11px; }
  .card .sub { font-size: 9px; }

  .lb-info { max-width: calc(100vw - 2 * var(--space-4)); font-size: 10px; }
  .lb-help { display: none; }
  .lb-nav { width: 40px; height: 40px; }
  .lb-nav-prev { left: var(--space-2); }
  .lb-nav-next { right: var(--space-2); }

  .account-menu { left: 0; right: 0; min-width: 0; max-width: none; }
}

/* Safe area (iPhone notch) */
@supports (padding: env(safe-area-inset-top)) {
  .header { padding-top: max(var(--space-2), env(safe-area-inset-top)); }
  .lb-bar { padding-top: max(var(--space-3), env(safe-area-inset-top)); }
  .footer { padding-bottom: max(var(--space-12), env(safe-area-inset-bottom)); }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
