/* PersonaBuddy Unified Theme & Design System */
:root {
  --blue: #5A9AFF;
  --blue-light: #8FD3FF;
  --pink: #FF6FAE;
  --pink-light: #FFC1E0;
  --pink-soft: #FFF4F9;
  --violet: #A788FA;
  --violet-soft: #F4EFFF;
  --navy: #15213D;
  --navy-light: #2A3859;
  --muted: #64748B;
  --line: #E8ECF5;
  --bg: #FFFFFF;
  --soft-bg: #FAF9FE;
  --card-bg: #FFFFFF;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(21, 33, 61, 0.04);
  --shadow-md: 0 8px 24px rgba(21, 33, 61, 0.08);
  --shadow-glow: 0 8px 24px rgba(255, 111, 174, 0.2);
  --grad-primary: linear-gradient(100deg, var(--pink), var(--violet), var(--blue));
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--navy);
  background: #fff;
  line-height: 1.5;
}

button, input, select { font: inherit; }
a { text-decoration: none; color: inherit; }

/* Layout Grid */
.pb-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

/* Sidebar */
.pb-sidebar {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  background: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
}

.pb-brand {
  height: 80px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.pb-brand img { height: 34px; width: auto; margin-right: 10px; }
.pb-brand span { color: var(--pink); }

.pb-nav { padding: 18px 14px; flex: 1; overflow-y: auto; }
.pb-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  margin: 4px 0;
  border-radius: var(--radius-md);
  color: #59667d;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.pb-nav-item:hover { background: #f7f8fc; color: var(--navy); }
.pb-nav-item.active { color: var(--pink); background: var(--pink-soft); font-weight: 700; }
.pb-nav-item i { font-style: normal; font-size: 18px; width: 22px; text-align: center; }

.pb-pro-box {
  margin: 16px 18px;
  padding: 18px;
  border: 1px solid #e7e4f8;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #fcfbff, #f4f6ff);
}
.pb-pro-box h4 { margin: 0 0 6px; font-size: 14px; font-weight: 750; color: #5b46b0; }
.pb-pro-box p { margin: 0 0 14px; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* Sidebar: talk-to-an-expert lead card */
.pb-expert-card {
  position: relative;
  margin: 14px 14px 0;
  padding: 18px 16px;
  border-radius: 16px;
  background: linear-gradient(165deg, #1b2036 0%, #0a0c16 100%);
  border: 1px solid rgba(243, 199, 126, 0.22);
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}
.pb-expert-glow {
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(243, 199, 126, 0.35), transparent 70%);
  pointer-events: none;
}
.pb-expert-icon {
  position: relative;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 15px;
  color: #f3c77e;
  background: rgba(243, 199, 126, 0.12);
  border: 1px solid rgba(243, 199, 126, 0.35);
  margin-bottom: 10px;
}
.pb-expert-card h4 {
  position: relative;
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
}
.pb-expert-card p {
  position: relative;
  margin: 0 0 14px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
}
.pb-expert-card form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pb-expert-card input[type="email"] {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}
.pb-expert-card input[type="email"]::placeholder { color: rgba(255, 255, 255, 0.35); }
.pb-expert-card input[type="email"]:focus { border-color: #f3c77e; }
.pb-expert-card button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(100deg, #f3c77e, #e08a4b);
  color: #1a1204;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: filter 0.15s;
}
.pb-expert-card button:hover { filter: brightness(1.05); }
.pb-expert-card button:disabled { opacity: 0.6; cursor: default; }

.pb-profile {
  border-top: 1px solid var(--line);
  padding: 14px 20px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}
.pb-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-light), var(--pink-light));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}
.pb-profile > div:not(.pb-avatar) {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.pb-profile > div:not(.pb-avatar) b,
.pb-profile > div:not(.pb-avatar) small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#pbLogoutLink {
  flex: 1 1 100%;
  text-align: end;
  margin-inline-start: 0 !important;
}

/* Main Area */
.pb-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Top Bar */
.pb-topbar {
  height: 80px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 20px;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}
.pb-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 650;
  color: #56647a;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.pb-back-btn:hover { background: #f3f5fa; }
.pb-crumb { font-size: 13.5px; font-weight: 650; color: var(--muted); }
.pb-crumb b { color: var(--navy); }
.pb-spacer { flex: 1; }

/* Token Pill & Cost Badge */
.pb-token-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e1e5f0;
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 750;
  color: var(--navy);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.pb-token-pill:hover { border-color: var(--pink); cursor: pointer; }
.pb-token-pill .icon { color: #f59e0b; font-size: 16px; }
.pb-token-pill b { color: var(--pink); }

.pb-token-cost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff0f7;
  color: #ff3f91;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid #ffd2e5;
  margin-left: 6px;
}

/* 3-Phase Stepper */
.pb-stepper {
  height: 74px;
  border-bottom: 1px solid #f0f1f6;
  display: flex;
  align-items: center;
  padding: 0 35px;
  background: #fdfdfd;
  overflow-x: auto;
}
.pb-phase-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pb-phase-tag {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8a96a9;
  background: #eef2f8;
  padding: 4px 8px;
  border-radius: 6px;
  margin-right: 6px;
}
.pb-phase-tag.active { background: #ffe4f0; color: #e1277b; }
.pb-step {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #9aa4b5;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.15s;
}
.pb-step .dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #dce2ed;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: #fff;
  color: #7b889b;
}
.pb-step.active { color: var(--pink); font-weight: 750; }
.pb-step.active .dot { border-color: var(--pink); background: var(--pink); color: #fff; }
.pb-step.done { color: var(--navy); }
.pb-step.done .dot { border-color: var(--pink); color: var(--pink); background: var(--pink-soft); }
.pb-step-line { width: 32px; height: 1px; background: #e3e7ef; margin: 0 6px; flex-shrink: 0; }

/* Content Area & Layout */
.pb-content {
  padding: 32px 38px 48px;
  flex: 1;
}
.pb-header-area { margin-bottom: 26px; }
.pb-title { font-size: 26px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.6px; }
.pb-subtitle { color: var(--muted); font-size: 14px; margin: 0; }

.pb-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}

/* Card & Box Elements */
.pb-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.pb-box-label {
  font-size: 14px;
  font-weight: 750;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pb-box-label small { font-weight: 500; color: var(--muted); font-size: 12px; }

/* Grid of Choices */
.pb-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pb-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pb-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pb-field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }

.pb-choice-card {
  border: 1px solid #e1e5ed;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 12px 10px;
  color: #4f5d73;
  font-weight: 650;
  font-size: 12.5px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}
.pb-choice-card:hover { border-color: #cbd5e1; transform: translateY(-2px); }
.pb-choice-card.active {
  border: 2px solid var(--pink);
  color: #ff3f91;
  background: var(--pink-soft);
  box-shadow: 0 4px 14px rgba(255, 111, 174, 0.12);
}

/* Pills & Badges */
.pb-pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.pb-pill {
  border: 1px solid #e1e5ed;
  border-radius: 30px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: #556277;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}
.pb-pill:hover { border-color: #cbd5e1; }
.pb-pill.active {
  border-color: var(--pink);
  color: #ff3f91;
  background: var(--pink-soft);
  font-weight: 700;
}

/* Buttons */
.pb-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 650;
  font-size: 13.5px;
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  user-select: none;
}
.pb-btn:hover {
  background: #f1f4f9;
  border-color: #cbd5e1;
  color: var(--navy);
  transform: translateY(-1px);
}
.pb-btn:active {
  transform: translateY(0);
}
.pb-btn-primary {
  border: 0 !important;
  color: #fff !important;
  background: var(--grad-primary) !important;
  box-shadow: 0 6px 18px rgba(167, 136, 250, 0.28);
}
.pb-btn-primary:hover {
  background: linear-gradient(100deg, #ff5099, #9974fa, #458cff) !important;
  color: #fff !important;
  box-shadow: 0 8px 24px rgba(167, 136, 250, 0.45);
  transform: translateY(-2px);
}
.pb-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(167, 136, 250, 0.3);
}
.pb-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Sticky Preview Panel */
.pb-preview-panel {
  border: 1px solid #e8e8f4;
  border-radius: var(--radius-xl);
  padding: 22px;
  background: linear-gradient(145deg, #fbfaff, #f5f8ff);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 100px;
}
.pb-preview-header { margin-bottom: 14px; }
.pb-preview-header h3 { font-size: 15px; margin: 0 0 4px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.pb-preview-header p { font-size: 12px; color: var(--muted); margin: 0; }

.pb-preview-stage {
  height: 320px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #eee8e2, #ffffff);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #eaeef6;
  margin-bottom: 16px;
}
.pb-preview-img { width: 100%; height: 100%; object-fit: cover; }

.pb-summary-rows { display: grid; gap: 8px; margin-top: 14px; }
.pb-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed #edf0f7;
}
.pb-summary-row span { color: var(--muted); }
.pb-summary-row b { font-weight: 700; color: var(--navy); }

/* Toast & Feedback Notifications */
.pb-toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pb-toast {
  background: #17213d;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease-out;
}
.pb-toast.deduct {
  background: linear-gradient(135deg, #ff3f91, #845ef7);
  border: 1px solid rgba(255,255,255,0.2);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 1100px) {
  .pb-layout { grid-template-columns: 1fr !important; }
  .pb-preview-panel { position: static !important; width: 100% !important; margin-top: 20px !important; }
}
@media (max-width: 768px) {
  .pb-app { grid-template-columns: 1fr !important; }
  .pb-sidebar { display: none !important; width: 0 !important; }
  .pb-main { width: 100% !important; min-width: 0 !important; }
  .pb-content { padding: 16px 12px !important; }
  .pb-content-area { padding: 16px 12px !important; }
  .pb-topbar { padding: 0 12px !important; }
  .pb-stepper { padding: 0 12px !important; overflow-x: auto !important; }
  .pb-stepper-bar { padding: 0 12px !important; overflow-x: auto !important; }
  .pb-fixed-bottom-bar { left: 0 !important; width: 100% !important; padding: 12px 16px !important; flex-wrap: wrap !important; gap: 10px !important; justify-content: center !important; }
  .pb-fixed-bottom-bar > * { flex: 1 1 auto !important; text-align: center !important; }
  .pb-grid-4, .pb-grid-3 { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .pb-field-pair { grid-template-columns: 1fr !important; gap: 10px !important; }
  .pb-split-layout { grid-template-columns: minmax(0, 1fr) !important; }
  .pb-topbar-right { flex-wrap: wrap !important; justify-content: flex-end !important; row-gap: 8px !important; }
  .pb-topbar { height: auto !important; flex-wrap: wrap !important; padding-top: 10px !important; padding-bottom: 10px !important; }
  .pb-mobile-menu-btn { display: flex !important; }
}

/* Mobile nav — the sidebar (Dashboard/Create Character/My Characters/Plans, sign out, delete
   account) is the ONLY way to move between sections, and it's fully hidden ≤768px above. This
   hamburger + slide-in panel is the only way to reach any of that on a phone. The .pb-sidebar
   rule below intentionally uses two classes (higher specificity) so it wins over the plain
   `.pb-sidebar { display:none !important; }` rule above — and any page's own duplicate of that
   rule in an inline <style> block — regardless of CSS source order. */
.pb-mobile-menu-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100001;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  align-items: center;
  justify-content: center;
  font-size: 19px;
  cursor: pointer;
  color: var(--navy);
}
.pb-mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 100002;
}
.pb-mobile-backdrop.active { display: block; }
@media (max-width: 768px) {
  .pb-sidebar.pb-mobile-open {
    display: flex !important;
    position: fixed !important;
    top: 0; left: 0;
    width: 82vw !important;
    max-width: 320px;
    height: 100vh !important;
    z-index: 100003;
    box-shadow: 0 0 40px rgba(0,0,0,0.25);
  }
}

/* Futuristic AI Generator Overlay & Laser Shimmer Scanner */
.pb-gen-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 50;
  border-radius: inherit;
  color: #fff;
}

.pb-ai-radar {
  position: relative;
  width: 76px;
  height: 76px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pb-ai-radar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px dashed rgba(255, 111, 174, 0.65);
  animation: spin 6s linear infinite;
}

.pb-ai-radar-pulse {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 111, 174, 0.35) 0%, transparent 70%);
  animation: radarPulse 1.8s ease-in-out infinite;
}

.pb-ai-radar-icon {
  font-size: 28px;
  color: #ff6fae;
  animation: floatBounce 2s ease-in-out infinite;
  z-index: 2;
}

.pb-ai-scanner-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ff6fae, #5a9aff, transparent);
  box-shadow: 0 0 12px #ff6fae;
  animation: scanDown 2.2s ease-in-out infinite;
  z-index: 10;
}

.pb-ai-progress-bar {
  width: 170px;
  height: 5px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 14px;
  position: relative;
}

.pb-ai-progress-fill {
  position: absolute;
  inset-y: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(90deg, #ff6fae, #5a9aff);
  border-radius: 99px;
  animation: progressIndeterminate 1.6s ease-in-out infinite;
}

@keyframes radarPulse {
  0% { transform: scale(0.8); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.9; }
  100% { transform: scale(0.8); opacity: 0.4; }
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes scanDown {
  0% { top: 0%; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

@keyframes progressIndeterminate {
  0% { left: -40%; width: 40%; }
  50% { width: 60%; }
  100% { left: 100%; width: 40%; }
}

/* ==========================================================================
   Full-Screen High-Res Lightbox Modal
   ========================================================================== */
.pb-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease-out;
}
.pb-lightbox.active {
  display: flex;
}
.pb-lightbox-close {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10001;
}
.pb-lightbox-close:hover {
  background: rgba(255, 111, 174, 0.4);
  border-color: #ff6fae;
  transform: scale(1.1);
}
.pb-lightbox-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 88vh;
  position: relative;
}
.pb-lightbox-img {
  max-width: 85vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  display: block;
}
.pb-lightbox-bar {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 700px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 18px;
  border-radius: 14px;
  color: #fff;
}

/* Lightbox download menu: quality tiers (512/1024 free, 2K/4K locked) */
.pb-lb-dl-wrap { position: relative; }
.pb-lb-dl-menu {
  display: none;
  position: absolute; bottom: calc(100% + 10px); right: 0;
  width: 230px;
  background: #14182c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  padding: 6px;
  z-index: 10;
}
.pb-lb-dl-menu.active { display: block; }
.pb-lb-dl-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 10px;
  cursor: pointer;
}
.pb-lb-dl-state { width: 18px; text-align: center; font-size: 13px; flex-shrink: 0; }
.pb-lb-dl-res { font-size: 13px; font-weight: 800; color: #fff; width: 42px; flex-shrink: 0; }
.pb-lb-dl-note { font-size: 10.5px; color: rgba(255, 255, 255, 0.45); }
.pb-lb-dl-row.pb-lb-dl-ready { background: rgba(255, 111, 174, 0.14); }
.pb-lb-dl-row.pb-lb-dl-ready:hover { background: rgba(255, 111, 174, 0.24); }
.pb-lb-dl-row.pb-lb-dl-ready .pb-lb-dl-state { color: #4ade80; }
.pb-lb-dl-row.pb-lb-dl-ready .pb-lb-dl-note { color: #ff8fc0; font-weight: 650; }
.pb-lb-dl-row.pb-lb-dl-off { opacity: 0.4; cursor: default; }
.pb-lb-dl-row.pb-lb-dl-locked:hover { background: rgba(167, 136, 250, 0.16); }
.pb-lb-dl-row.pb-lb-dl-locked .pb-lb-dl-state { font-size: 14px; }
.pb-lightbox-title {
  font-size: 14px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pb-lightbox-actions {
  display: flex;
  gap: 10px;
}
.pb-lightbox-btn {
  background: var(--pink);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  text-decoration: none;
}
.pb-lightbox-btn:hover {
  background: #ff3f91;
  transform: translateY(-2px);
}

/* Lightbox Prev / Next Nav Arrows */
.pb-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10002;
  user-select: none;
}
.pb-lightbox-nav:hover {
  background: var(--pink);
  border-color: var(--pink);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 0 20px rgba(255, 111, 174, 0.5);
}
.pb-lightbox-nav.prev {
  left: 30px;
}
.pb-lightbox-nav.next {
  right: 30px;
}
.pb-lightbox-counter {
  font-size: 12px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 8px;
  margin-left: 8px;
  font-weight: 700;
}

/* Stage Zoom Icon overlay */
.pb-stage-zoom-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(6px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 8;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.pb-stage-zoom-badge:hover {
  background: var(--pink);
  border-color: var(--pink);
  transform: scale(1.06);
}



/* Auto-Save Badge */
.pb-auto-save-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
  color: #10b981;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 5px 12px;
  border-radius: var(--radius-full);
}

/* Empty Stage Styling (Clean, Zero Stock Mockup) */
.pb-empty-stage {
  border: 2px dashed #cbd5e1;
  background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
  text-align: center;
  min-height: 290px;
  border-radius: var(--radius-lg);
  width: 100%;
}
.pb-empty-stage-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--pink);
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}
.pb-empty-stage b {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 4px;
}
.pb-empty-stage span {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
  max-width: 200px;
}

/* Social Safe-Zone Overlay (9:16) */
.pb-safe-zone-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
  z-index: 15;
}
.pb-safe-zone-overlay.active { display: block; }
.pb-safe-zone-box {
  position: absolute;
  top: 12%; bottom: 22%; left: 8%; right: 18%;
  border: 1.5px dashed rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  box-shadow: inset 0 0 15px rgba(255, 111, 174, 0.25);
}
.pb-safe-zone-label {
  position: absolute;
  top: 6px; left: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 9px;
  font-weight: 750;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Universal Fullscreen Lightbox */
.pb-lightbox {
  position: fixed; inset: 0;
  background: rgba(10, 15, 30, 0.94);
  backdrop-filter: blur(14px);
  z-index: 10000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.pb-lightbox.active { display: flex; }
.pb-lightbox-close {
  position: absolute; top: 24px; right: 28px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff; font-size: 20px;
  display: grid; place-items: center; cursor: pointer;
  z-index: 10005;
}
.pb-lightbox-close:hover { background: var(--pink); border-color: var(--pink); }
.pb-lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10005; user-select: none;
}
.pb-lightbox-nav:hover { background: var(--pink); border-color: var(--pink); }
.pb-lightbox-nav.prev { left: 30px; }
.pb-lightbox-nav.next { right: 30px; }
.pb-lightbox-container {
  display: flex; flex-direction: column; align-items: center;
  max-width: 90vw; max-height: 88vh; position: relative;
}
.pb-lightbox-img {
  max-width: 85vw; max-height: 75vh; object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.15); display: block;
}
.pb-lightbox-bar {
  margin-top: 16px; display: flex; align-items: center;
  justify-content: space-between; width: 100%; max-width: 700px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 18px; border-radius: 14px; color: #ffffff;
}
.pb-stage-zoom-badge {
  position: absolute; bottom: 12px; right: 12px;
  background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(6px);
  color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 14px; border-radius: 20px;
  font-size: 11.5px; font-weight: 750;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; z-index: 8;
}
.pb-stage-zoom-badge:hover { background: var(--pink); border-color: var(--pink); }


/* Modern Curved Topbar & Pills */
.pb-auto-save-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  border: 1.5px solid #a7f3d0;
  padding: 6px 14px;
  border-radius: 9999px;
  box-shadow: 0 1px 4px rgba(16, 185, 129, 0.1);
}

.pb-token-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1.5px solid #fed7aa;
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 750;
  color: #9a3412;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}
.pb-token-pill:hover {
  transform: scale(1.03);
  border-color: #f97316;
}

.pb-pro-box {
  margin: 16px 14px;
  padding: 16px;
  border: 1.5px solid #e7e4f8;
  border-radius: 18px;
  background: linear-gradient(145deg, #fcfbff, #f4f6ff);
}
.pb-pro-box h4 {
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 800;
  color: #5b46b0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pb-pro-box p {
  margin: 0 0 12px;
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.4;
}


.pb-pro-box, .pb-sidebar-pro {
  margin: 16px 14px;
  padding: 18px 16px;
  border: 1.5px solid #e7e4f8;
  border-radius: 18px;
  background: linear-gradient(145deg, #fcfbff 0%, #f4f6ff 100%);
  box-shadow: 0 4px 14px rgba(91, 70, 176, 0.05);
}
.pb-pro-box h4, .pb-sidebar-pro h4 {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 800;
  color: #5b46b0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pb-pro-box p, .pb-sidebar-pro p {
  margin: 0 0 12px;
  font-size: 11.5px;
  color: #64748b;
  line-height: 1.4;
}
.pb-pro-btn, .pb-btn-pro {
  width: 100%;
  background: linear-gradient(100deg, #ff6fae, #a788fa, #5a9aff);
  color: #ffffff;
  border: 0;
  padding: 10px 14px;
  border-radius: 11px;
  font-weight: 750;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(167, 136, 250, 0.25);
  transition: all 0.2s ease;
}
.pb-pro-btn:hover, .pb-btn-pro:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(167, 136, 250, 0.4);
}

/* ==========================================================================
   AI GENERATION OVERLAY & ALBUM HISTORY THUMBNAIL REFINEMENTS
   ========================================================================== */

.pb-gen-overlay {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(15, 23, 42, 0.88) !important;
  backdrop-filter: blur(10px) !important;
  border-radius: 16px !important;
  display: none;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 50 !important;
  color: #ffffff !important;
  text-align: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
}

.pb-gen-overlay.active {
  display: flex !important;
}

.pb-history-strip {
  display: flex !important;
  flex-direction: row !important;
  gap: 8px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 6px 2px !important;
  max-width: 100% !important;
  scrollbar-width: thin;
}

.pb-history-thumb {
  width: 54px !important;
  height: 64px !important;
  min-width: 54px !important;
  max-width: 54px !important;
  max-height: 64px !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  border: 2px solid #e2e8f0 !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  background: #f1f5f9 !important;
  transition: all 0.2s ease !important;
}

.pb-history-thumb:hover {
  border-color: #ff6fae !important;
  transform: scale(1.05);
}

.pb-history-thumb.active {
  border-color: #ff3f91 !important;
  box-shadow: 0 0 0 2px rgba(255, 63, 145, 0.3) !important;
}

.pb-history-thumb img {
  width: 100% !important;
  height: 100% !important;
  max-height: 64px !important;
  object-fit: cover !important;
  display: block !important;
}

/* 2x2 quality/price grid: 512 & 1024 free (light), 2K & 4K locked (dark) —
   1024 sits directly above 2K so equal-priced tiers line up and the quality jump is obvious. */
.pb-quality-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.pb-qgen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 6px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.pb-qgen-btn:hover { transform: translateY(-1px); }
.pb-qgen-light {
  background: linear-gradient(145deg, #fff8fb 0%, #f4f0ff 100%);
  border: 1.5px solid #f0d9ec;
  color: #0f172a;
}
.pb-qgen-light:hover { border-color: #ff6fae; box-shadow: 0 4px 12px rgba(255, 111, 174, 0.15); }
.pb-qgen-dark {
  background: linear-gradient(100deg, #ff6fae, #a788fa, #5a9aff);
  border: none;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(167, 136, 250, 0.3);
}
.pb-qgen-dark:hover { box-shadow: 0 6px 18px rgba(167, 136, 250, 0.45); }
.pb-qgen-lock { font-size: 20px; opacity: 0.95; line-height: 1; }
.pb-qgen-label { font-weight: 800; }
.pb-qgen-price { opacity: 0.85; white-space: nowrap; }
.pb-qgen-price b { font-size: 14px; font-weight: 900; }
