/* Global utilities */
.hidden {
  display: none !important;
}

#book-details-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html,
body {
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

:root {
  --bg: #06101d;
  --bg-2: #0d1a2c;
  --bg-3: #12233a;
  --panel: rgba(11, 23, 38, 0.78);
  --panel-2: rgba(18, 31, 50, 0.92);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f7fb;
  --muted: #a5b1c2;
  --accent: #84c8ff;
  --accent-2: #d4a7ff;
  --danger: #ff7d97;
  --warning: #ffb86c;
  --success: #8df6c6;
  --shadow: 0 30px 100px rgba(0, 0, 0, 0.38);
  --radius: 28px;

  /* Material Design 3 Dark Theme Tokens */
  --md-sys-color-primary: var(--accent);
  --md-sys-color-on-primary: #003355;
  --md-sys-color-surface: var(--bg-3);
  --md-sys-color-on-surface: var(--text);
  --md-sys-color-outline: var(--line);
  --md-sys-color-surface-container: var(--bg-2);

  /* Lucide Icons */
  --icon-size: 24px;
  --icon-stroke: 2px;
}

.lucide {
  width: var(--icon-size);
  height: var(--icon-size);
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: inline-block;
  vertical-align: middle;
}

md-filled-select,
md-outlined-select {
  --md-outlined-select-text-field-container-shape: 18px;
  --md-outlined-select-text-field-outline-color: rgba(255, 255, 255, 0.09);
  --md-outlined-select-text-field-content-color: var(--text);
  --md-outlined-select-text-field-label-text-color: var(--muted);
  --md-outlined-select-menu-container-color: var(--bg-3);
  --md-menu-container-color: var(--bg-3);
}

md-select-option {
  --md-menu-item-label-text-color: var(--text);
}

option {
  background-color: #12233a;
  color: #f4f7fb;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(132, 200, 255, 0.14), transparent 30%),
    radial-gradient(circle at top right, rgba(212, 167, 255, 0.12), transparent 34%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: env(safe-area-inset-top, 12px) env(safe-area-inset-right, 12px) env(safe-area-inset-bottom, 12px) env(safe-area-inset-left, 12px);
}

@media (min-width: 768px) {
  body {
    padding: 22px;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-shell {
  max-width: 1520px;
  margin: 0 auto;
  width: 100%;
  overflow-x: hidden;
}

.site-header {
  margin-bottom: 26px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(24px);
  background: rgba(7, 17, 31, 0.55);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06111c;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-copy strong {
  font-size: 0.98rem;
}

.brand-copy em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.84rem;
}

.hero {
  margin-bottom: 24px;
}

.book-hero-display {
  position: relative;
  margin-bottom: 48px;
  border-radius: 40px;
  overflow: hidden;
  padding: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.hero-ambient-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow-blob {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: blob-float 20s infinite alternate ease-in-out;
}

.glow-1 {
  background: var(--accent);
  top: -100px;
  left: -100px;
}

.glow-2 {
  background: var(--accent-2);
  bottom: -150px;
  right: -50px;
  animation-duration: 25s;
  animation-delay: -5s;
}

.glow-3 {
  background: #00f2ff;
  top: 50%;
  left: 30%;
  width: 300px;
  height: 300px;
  animation-duration: 18s;
  animation-delay: -2s;
}

@keyframes blob-float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(40px, 60px) scale(1.1);
  }

  100% {
    transform: translate(-20px, -40px) scale(0.9);
  }
}

.book-hero-card {
  position: relative;
  z-index: 1;
  padding: 40px;
  border-radius: 36px;
  background: linear-gradient(135deg, rgba(13, 22, 40, 0.75), rgba(7, 13, 24, 0.9));
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.hero-breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.hero-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  opacity: 0.8;
  transition: all 0.2s ease;
}

.hero-back-btn:hover {
  opacity: 1;
  transform: translateX(-2px);
}

.hero-breadcrumb-sep {
  opacity: 0.2;
  font-size: 0.8rem;
}

.hero-breadcrumb-current {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-content-main {
  margin-bottom: 40px;
}

.hero-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.hero-title-row h1 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, #fff 40%, rgba(255, 255, 255, 0.7));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.hero-status-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.pill-refined {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  padding: 6px 14px;
}

.visibility-edit-form {
  display: inline;
}

.visibility-pill-form {
  display: contents;
}

.visibility-pill-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
  background: rgba(15, 23, 42, 0.6);
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  height: 44px;
  padding: 0 16px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.visibility-pill-wrap:hover {
  transform: scale(1.2) translateY(-4px);
  border-color: #84c8ff;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  color: #84c8ff;
}

.visibility-pill-wrap:focus-within {
  outline: none;
  box-shadow: none;
}

.visibility-pill-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: #fff;
  pointer-events: none;
}

.visibility-pill-wrap:hover .visibility-pill-icon {
  color: #84c8ff;
}

.visibility-pill-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  cursor: pointer;
  padding: 0 22px 0 28px;
  height: 100%;
  display: flex;
  align-items: center;
  text-align: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
}

.visibility-pill-select:focus,
.visibility-pill-select:focus-visible,
.visibility-pill-select:focus-within {
  outline: none;
  box-shadow: none;
}

.visibility-pill-select option {
  background: #1a1a2e;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
}

.pill-series {
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.25), rgba(0, 242, 255, 0.15));
  border: 1px solid rgba(132, 200, 255, 0.4);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 15px rgba(0, 242, 255, 0.15);
  backdrop-filter: blur(10px);
}

.pill-series i {
  margin-right: 6px;
  stroke-width: 2.5px;
}

.hero-meta-row {
  display: flex;
  gap: 48px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-item strong {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.meta-item strong a:hover {
  color: var(--accent);
  text-shadow: 0 0 10px rgba(132, 200, 255, 0.3);
}

.hero-lede {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.15rem;
  line-height: 1.6;
  max-width: 90ch;
  font-weight: 400;
}

.hero-lede i {
  font-style: normal;
}

.hero-dashboard-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.hero-quick-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-action-pill-group {
  display: flex;
  gap: 8px;
}

@media (max-width: 768px) {
  .book-hero-card {
    padding: 24px;
  }

  .hero-meta-row {
    gap: 24px;
  }

  .hero-dashboard-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-quick-actions {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }

  .hero-action-pill-group {
    flex-wrap: wrap;
    width: 100%;
  }

  .hero-action-pill {
    width: 100% !important;
    position: relative;
  }

  .hero-action-pill i,
  .hero-action-pill .lucide {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
  }

  .hero-action-pill span {
    display: block;
    width: 100%;
    text-align: center;
    padding-left: 0;
  }

  .visibility-pill-wrap {
    justify-content: center;
    width: 100%;
  }

  .visibility-pill-icon {
    position: static;
    transform: none;
    pointer-events: auto;
  }

  .visibility-pill-select {
    padding-left: 0;
    text-align: center;
  }
}

.hero-card,
.panel,
.book-card,
.run-card,
.thumb-card,
.page-thumb,
.story-box,
.status-box,
.empty-state,
.book-card-shell,
.cover-thumb,
.mini-insight-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.run-title-v3 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
  color: #fff;
}

.run-style-subtitle {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
  margin-bottom: 2px;
}

.reader-link {
  font-size: 0.8rem;
  color: #fff;
  cursor: pointer;
  text-decoration: underline;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.reader-link:hover {
  opacity: 1 !important;
}

.reader-links-v3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.reader-link-sep {
  opacity: 0.3;
  font-size: 0.8rem;
}

.reader-link-strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(132, 200, 255, 0.3);
  border-radius: 99px;
  color: #fff !important;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  text-decoration: none !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.85rem;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.reader-link-strong::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.reader-link-strong:hover {
  background: rgba(132, 200, 255, 0.15);
  border-color: rgba(132, 200, 255, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(132, 200, 255, 0.25);
  letter-spacing: 0.1em;
}

.reader-link-strong:hover::before {
  transform: translateX(100%);
}

.run-pills-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  margin: 18px 0 !important;
}

.reader-active {
  background: var(--bg-deep) !important;
  overflow: hidden !important;
}

.glass {
  background: linear-gradient(180deg, rgba(15, 26, 44, 0.92), rgba(8, 17, 30, 0.9));
  backdrop-filter: blur(26px);
}

.hero-card,
.panel {
  border-radius: var(--radius);
  padding: 22px;
}



.feature-pills,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pill-row.stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #d9e6f7;
  font-size: 0.82rem;
}

.pill-owner {
  background: rgba(212, 167, 255, 0.18);
  border-color: rgba(212, 167, 255, 0.35);
  color: #f0e6ff;
  font-weight: 700;
}

/* Highlighting owned comics in the Public Library view */
#home-v6-library-state[data-current-mode="public"] .home-v6-card-shell.is-author .home-v6-card {
  box-shadow: 0 0 0 2px var(--accent-2), var(--shadow);
  transform: translateY(-2px);
}

#home-v6-library-state[data-current-mode="public"] .home-v6-card-shell.is-author .pill-owner {
  background: var(--accent-2);
  color: #000;
  border-color: #fff;
}

/* Hide author badge in "Created" and "Tagged" views as it is redundant */
#home-v6-library-state[data-current-mode="created"] .pill-owner,
#home-v6-library-state[data-current-mode="tagged"] .pill-owner {
  display: none;
}

.pill-muted {
  color: var(--muted);
}

.pill-yellow,
.friend-card-actions .pill-yellow {
  background: rgba(251, 191, 36, 0.25) !important;
  border-color: rgba(251, 191, 36, 0.4) !important;
  color: #fbbf24 !important;
}

.pill-green,
.friend-card-actions .pill-green {
  background: rgba(52, 211, 153, 0.25) !important;
  border-color: rgba(52, 211, 153, 0.4) !important;
  color: #34d399 !important;
}

.pill-red,
.friend-card-actions .pill-red {
  background: rgba(248, 113, 113, 0.25) !important;
  border-color: rgba(248, 113, 113, 0.4) !important;
  color: #f87171 !important;
}

.more-inline-link {
  display: inline;
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-weight: 700;
  padding: 0;
  margin-left: 6px;
  font-style: normal;
}

.more-inline-link:hover {
  color: #fff;
}

.stat-label,
.eyebrow,
.mini-label {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
}

.hero-tagged-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.tagged-avatars {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tagged-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tagged-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tagged-avatar-fallback {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text, #fff);
}

.tagged-avatar-add {
  border: 1.5px dashed rgba(255, 255, 255, 0.25);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tagged-avatar-add:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
}

.tagged-avatar-add i,
.tagged-avatar-add .lucide {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.5);
}

.tagged-users-list {
  margin-bottom: 16px;
}

.tagged-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 12px;
  transition: background 0.1s;
}

.tagged-user-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.tagged-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tagged-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tagged-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tagged-user-name {
  font-weight: 600;
  color: var(--text, #fff);
}

.tagged-user-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.tagged-user-remove:hover {
  background: rgba(255, 80, 80, 0.15);
}

.tagged-user-remove i,
.tagged-user-remove .lucide {
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, 0.4);
}

.tagged-user-remove:hover i,
.tagged-user-remove:hover .lucide {
  color: #ff5050;
}

.tagged-users-empty {
  color: var(--muted, rgba(255, 255, 255, 0.4));
  font-size: 0.9rem;
  padding: 12px 10px;
  text-align: center;
}

.tagged-add-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.tagged-add-section .field {
  margin-bottom: 10px;
}

.tagged-add-section .field input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text, #fff);
  font-size: 0.95rem;
}

.tagged-add-section .field input::placeholder {
  color: var(--muted, rgba(255, 255, 255, 0.3));
}

.tagged-add-section .field input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
}

.tagged-friend-results {
  max-height: 200px;
  overflow-y: auto;
}

.tagged-friend-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.1s;
}

.tagged-friend-option:hover {
  background: rgba(255, 255, 255, 0.06);
}

.tagged-friend-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tagged-friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tagged-friend-option span {
  color: var(--text, #fff);
  font-size: 0.9rem;
}

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

.stat-box {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-box strong {
  display: block;
  margin-top: 8px;
  font-size: 1.25rem;
}

.surprise-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.surprise-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.65;
}

.grid.two-up {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
  margin-bottom: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel h2 {
  margin: 6px 0 0;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.stack-lg,
.stack-md {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  color: #dce6f6;
}

.field small {
  color: var(--muted);
}

.split-fields {
  display: grid;
  gap: 12px;
}

.split-fields.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.split-fields.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
}

.checkbox-field input {
  width: auto;
  margin: 0;
}

input,
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 180px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(132, 200, 255, 0.48);
  box-shadow: 0 0 0 4px rgba(132, 200, 255, 0.10);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 999px;
  padding: 0 22px;
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
  font-weight: 800;
}

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

.btn.is-loading {
  opacity: 0.85;
  pointer-events: none;
  cursor: wait;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.5);
}

.btn-primary {
  color: #08111e;
  background: linear-gradient(135deg, var(--accent), #b3dcff 55%, var(--accent-2));
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.btn-danger {
  color: white;
  background: rgba(139, 24, 50, 0.92);
  border: 1px solid rgba(255, 153, 177, 0.52);
}

.btn-small {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.9rem;
}

.book-grid,
.cast-grid,
.plan-grid,
.insight-grid {
  display: grid;
  gap: 16px;
}

.book-grid {
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.book-card-shell {
  position: relative;
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(12, 22, 37, 0.95), rgba(8, 15, 25, 0.98));
  contain: layout paint;
}

.book-card {
  display: block;
  overflow: hidden;
  border-radius: 26px;
  background: transparent;
}

.book-card img,
.thumb-card img,
.page-thumb img,
.cover-thumb img,
.reader-page-card img,
.zoom-modal-image {
  display: block;
  width: 100%;
  object-fit: cover;
}

.book-card img,
.cover-thumb img {
  aspect-ratio: 2 / 3;
}

.page-thumb img {
  aspect-ratio: 2 / 3;
}

.thumb-card img {
  aspect-ratio: 1 / 1;
}

.book-fallback {
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 3;
  color: var(--muted);
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.12), transparent), rgba(255, 255, 255, 0.02);
}

.book-card-copy {
  padding: 16px;
}

.book-card-copy h3 {
  margin: 0 0 8px;
  font-size: 1.12rem;
}

.book-card-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.icon-form {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(7, 17, 31, 0.78);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

.icon-btn-danger {
  background: rgba(110, 20, 39, 0.82);
  border-color: rgba(255, 119, 153, 0.32);
  color: #fff4f7;
}

.ghost-link {
  color: var(--muted);
}

.book-layout {
  align-items: start;
}

.cast-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.thumb-card,
.page-thumb,
.cover-thumb {
  padding: 0;
  overflow: hidden;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  text-align: left;
}

.thumb-card span,
.page-thumb span,
.cover-thumb span {
  display: block;
  padding: 10px 12px 12px;
  color: #dbe5f6;
  font-size: 0.88rem;
}

.story-panel {
  margin-bottom: 22px;
}

.story-box {
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
  padding: 18px;
  white-space: pre-wrap;
  line-height: 1.72;
  color: #dce5f6;
  max-height: 680px;
  overflow: auto;
}

.insight-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-insight-card {
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.mini-insight-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.meter {
  margin-top: 10px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.run-list {
  display: grid;
  gap: 18px;
}

.run-card {
  border-radius: 24px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(12, 23, 38, 0.9), rgba(7, 14, 25, 0.96));
}

.run-topline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.run-topline h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.run-topline p {
  margin: 0;
}

.run-topline-actions {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.error-note {
  max-width: 420px;
  color: #ffcbcb;
  font-size: 0.9rem;
  line-height: 1.5;
}

.run-media-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.cover-thumb {
  max-width: 210px;
}

.continuity-thumb {
  display: grid;
  place-items: center;
  min-height: 120px;
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.14), rgba(212, 167, 255, 0.12));
}

.run-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.pages-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.page-item-container {
  position: relative;
  transition: transform 0.2s ease;
}

.page-item-container:hover {
  transform: translateY(-4px);
}

.mini-regen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 5;
  font-size: 1.1rem;
  backdrop-filter: blur(4px);
}

.mini-regen-btn:hover {
  background: #3b82f6;
  border-color: white;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.mini-regen-btn.is-loading {
  background: var(--accent) !important;
  color: #000 !important;
  border-color: #fff !important;
  cursor: wait !important;
  animation: regen-spin 1.5s infinite linear, regen-glow 1s infinite alternate;
  pointer-events: all;
  /* Ensure we can see the wait cursor even if disabled */
}

@keyframes regen-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes regen-glow {
  from {
    box-shadow: 0 0 5px var(--accent);
    filter: brightness(1);
  }

  to {
    box-shadow: 0 0 20px var(--accent-2);
    filter: brightness(1.3);
  }
}

.regen-page-form {
  margin: 0;
}

.plan-box {
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  overflow: hidden;
}

.plan-box summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.035);
  font-weight: 700;
}

.plan-box summary::-webkit-details-marker {
  display: none;
}

.plan-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  padding: 14px;
}

.mini-plan-card {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px;
}

.mini-plan-card strong {
  display: block;
  margin-bottom: 8px;
}

.mini-plan-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.remix-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.remix-grid {
  margin-bottom: 12px;
}

.remix-checkbox {
  justify-content: center;
}

.status-box,
.empty-state {
  border-radius: 22px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.status-box p,
.empty-state p {
  color: var(--muted);
  margin-bottom: 0;
}

.narrow {
  max-width: 620px;
}

.delete-book-form {
  margin-top: 14px;
}

.run-delete-form {
  margin: 0;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

#style-picker-modal {
  z-index: 3000;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 15, 0.76);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  touch-action: manipulation;
  cursor: pointer;
}

.modal-card {
  position: relative;
  z-index: 2;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(15, 26, 44, 0.98), rgba(7, 14, 25, 0.98));
  box-shadow: var(--shadow);
}

.modal-card-image {
  width: min(96vw, 1520px);
  height: min(95vh, 1180px);
  margin: 2.5vh auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.modal-card-reader {
  width: min(1380px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  margin: 12px auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  padding: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 0 20px rgba(132, 200, 255, 0.25);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-close i,
.modal-close .lucide {
  width: 20px;
  height: 20px;
  stroke-width: 2.5px;
}

.modal-meta {
  margin-bottom: 14px;
  padding-right: 52px;
}

.modal-meta-reader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-subtitle {
  color: var(--muted);
  margin-top: 4px;
}

.modal-series-badge {
  margin-top: 10px;
}

.zoom-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 56px 12px 0;
  flex-wrap: wrap;
}

.zoom-modal-toolbar-left,
.zoom-modal-toolbar-right,
.reader-meta-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.zoom-btn,
.zoom-hint,
.zoom-readout {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.zoom-btn {
  cursor: pointer;
  font-weight: 700;
}

.zoom-hint,
.zoom-readout {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.zoom-readout {
  color: #dfe8f8;
  font-weight: 700;
}

.zoom-modal-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)), rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.zoom-modal-viewport {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 14px;
  cursor: grab;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y pinch-zoom;
  scrollbar-gutter: stable both-edges;
}

.zoom-modal-viewport.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.zoom-modal-canvas {
  min-width: 100%;
  min-height: 100%;
  width: max-content;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.zoom-modal-image {
  display: block;
  width: auto;
  height: auto;
  max-width: none !important;
  max-height: none !important;
  border-radius: 18px;
  margin: 0;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
  user-select: none;
  -webkit-user-drag: none;
}

.comic-reader-body {
  flex: 1;
  overflow: auto;
  padding-right: 6px;
}

.comic-reader-track {
  display: grid;
  gap: 18px;
  align-content: start;
}

.reader-page-card {
  margin: 0;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.reader-page-topline {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 1120px) {

  .hero,
  .book-hero,
  .grid.two-up {
    grid-template-columns: 1fr;
  }

  .split-fields.three,
  .insight-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding: env(safe-area-inset-top, 12px) env(safe-area-inset-right, 12px) env(safe-area-inset-bottom, 12px) env(safe-area-inset-left, 12px);
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .site-shell {
    max-width: 100%;
    overflow-x: hidden;
  }

  .hero-card,
  .panel,
  .run-card {
    padding: 16px;
  }

  .book-hero-card {
    padding: 16px;
    border-radius: 24px;
  }

  .book-grid,
  .cast-grid,
  .pages-strip,
  .split-fields.two,
  .split-fields.three,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .zoom-hint {
    display: none;
  }

  .modal-card-image {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    padding: env(safe-area-inset-top, 14px) env(safe-area-inset-right, 14px) env(safe-area-inset-bottom, 14px) env(safe-area-inset-left, 14px);
  }

  .modal-card-reader {
    width: calc(100vw - 8px);
    height: calc(100vh - 8px);
    margin: 4px auto;
    padding: env(safe-area-inset-top, 12px) env(safe-area-inset-right, 12px) env(safe-area-inset-bottom, 12px) env(safe-area-inset-left, 12px);
  }

  .modal-meta-reader {
    flex-direction: column;
  }

  .run-media-row {
    flex-direction: column;
  }

  .hero-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .hero-title-row h1 {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
  }

  .hero-status-pills {
    flex-wrap: wrap;
  }

  .hero-meta-row {
    flex-direction: column;
    gap: 16px;
  }

  .hero-lede {
    font-size: 1rem;
  }

  .hero-dashboard-bar {
    flex-direction: column;
    gap: 16px;
  }

  .hero-quick-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .hero-action-pill-group {
    flex-direction: column;
    width: 100%;
  }

  .hero-action-pill {
    width: 100% !important;
    position: relative;
  }

  .hero-action-pill i,
  .hero-action-pill .lucide {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
  }

  .hero-action-pill span {
    display: block;
    width: 100%;
    text-align: center;
    padding-left: 0;
  }

  .visibility-pill-wrap {
    justify-content: center;
    width: 100%;
  }

  .visibility-pill-icon {
    position: static;
    transform: none;
    pointer-events: auto;
  }

  .visibility-pill-select {
    padding-left: 0;
    text-align: center;
  }

  .btn {
    min-height: 48px;
  }

  .btn-small {
    min-height: 44px;
    padding: 0 14px;
  }

  .icon-btn {
    width: 48px;
    height: 48px;
  }

  .modal-close {
    width: 48px;
    height: 48px;
    top: env(safe-area-inset-top, 12px);
    right: env(safe-area-inset-right, 12px);
  }

  .iteration-hero-row {
    flex-direction: column;
  }

  .iteration-visual-column,
  .iteration-info-column {
    width: 100%;
  }

  .iteration-hero-cover-wrap {
    max-width: 200px;
    margin: 0 auto;
  }

  .mini-roster-grid {
    flex-wrap: wrap;
    justify-content: center;
  }

  .character-roster-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .pages-strip {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .page-item-container {
    min-width: 0;
  }

  input,
  textarea,
  select {
    font-size: 16px;
    padding: 12px 14px;
  }

  * {
    -webkit-tap-highlight-color: transparent;
  }

  a,
  button {
    touch-action: manipulation;
  }

  .zoom-modal-viewport {
    touch-action: pan-x pan-y pinch-zoom;
  }

  .style-picker-modal .modal-card,
  .style-lab-modal .modal-card {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    padding: env(safe-area-inset-top, 16px) env(safe-area-inset-right, 16px) env(safe-area-inset-bottom, 16px) env(safe-area-inset-left, 16px);
  }

  .sequel-planner-card {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    padding: env(safe-area-inset-top, 16px) env(safe-area-inset-right, 16px) env(safe-area-inset-bottom, 16px) env(safe-area-inset-left, 16px);
  }

  #series-bible-modal .modal-card {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    padding: env(safe-area-inset-top, 16px) env(safe-area-inset-right, 16px) env(safe-area-inset-bottom, 16px) env(safe-area-inset-left, 16px);
  }
}


/* WHHW_CAST_BUILDER_V1 */
.field-cast-composer {
  gap: 14px;
}

.cast-composer-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.pill-soft {
  background: rgba(255, 255, 255, 0.08);
}

.cast-builder {
  display: grid;
  gap: 16px;
}

.btn-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  align-self: flex-start;
}

.btn-plus.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-plus-mark,
.drop-box-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.glass-subtle {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
}

.cast-ref-card {
  display: grid;
  gap: 14px;
}

.cast-ref-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drop-box {
  position: relative;
  min-height: 220px;
  border-radius: 22px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.drop-box:hover,
.drop-box:focus-within,
.drop-box.is-dragging {
  border-color: rgba(255, 255, 255, 0.38);
  transform: translateY(-1px);
}

.drop-box-copy {
  text-align: center;
  display: grid;
  gap: 8px;
  padding: 20px;
}

.drop-box-title {
  font-weight: 700;
}

.drop-box-subtitle {
  opacity: 0.7;
  font-size: 0.94rem;
}

.drop-box-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.drop-box-filename {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(7, 17, 31, 0.82);
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
}

.compact-field {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cast-thumb-meta {
  display: block;
  opacity: 0.8;
  font-size: 0.76rem;
  margin-top: 4px;
}

.cast-thumb-ref {
  opacity: 0.62;
}

/* v3 additions */
.pill-accent {
  border-color: rgba(132, 200, 255, 0.24);
  background: rgba(132, 200, 255, 0.12);
}

.pill-soft {
  background: rgba(255, 255, 255, 0.06);
}

.run-subline {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.compact-pill-row {
  margin-top: 10px;
}

.panel-inline-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.panel-inline-head h3 {
  margin: 6px 0 0;
  font-size: 1.15rem;
}

.isolate-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
}

.ref-selector-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-action {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.ref-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ref-selector-card {
  display: grid;
  grid-template-columns: auto 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.ref-selector-card input {
  width: auto;
}

.ref-selector-card img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 16px;
}

.ref-selector-copy {
  display: grid;
  gap: 4px;
}

.ref-selector-copy span,
.ref-selector-copy em {
  color: var(--muted);
  font-size: 0.86rem;
  font-style: normal;
}

.compact-empty-state {
  padding: 18px;
}

.cast-grid-rich .thumb-card {
  text-align: left;
}

.cast-grid-rich .thumb-card small {
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 980px) {
  .ref-selector-grid {
    grid-template-columns: 1fr;
  }
}


.style-preview-panel {
  margin-top: 22px;
}

.style-preview-lede {
  margin: 0;
}

.style-lab-modal .modal-card {
  max-width: min(1500px, 96vw);
}

.modal-card-style-lab {
  width: min(1500px, 96vw);
  max-height: 92vh;
  padding: 22px;
  overflow: auto;
}

.modal-meta-style-lab {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.style-lab-toolbar {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-bottom: 22px;
}

.style-lab-dropzone {
  position: relative;
  display: none;
  gap: 14px;
  padding: 18px;
  border-radius: 26px;
  border: 1px dashed rgba(132, 200, 255, 0.45);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.style-lab-dropzone:hover,
.style-lab-dropzone.is-dragover {
  border-color: rgba(132, 200, 255, 0.85);
  background: rgba(132, 200, 255, 0.08);
  transform: translateY(-1px);
}

.style-lab-drop-copy {
  display: grid;
  gap: 6px;
}

.style-lab-drop-copy strong {
  font-size: 1.02rem;
}

.style-lab-drop-copy span {
  color: var(--muted);
}

.style-lab-stage {
  position: relative;
  min-height: 290px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.12), rgba(212, 167, 255, 0.10));
}

#style-lab-stage-image,
.style-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.style-lab-stage-empty,
.style-preview-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}

.style-lab-notes {
  display: grid;
  gap: 14px;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.style-preview-card {
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.style-preview-topline {
  padding: 12px 16px 0;
  color: var(--accent);
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.style-preview-visual {
  position: relative;
  padding: 14px;
  min-height: 240px;
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.09), rgba(212, 167, 255, 0.08));
}

.style-preview-panel-stack {
  display: grid;
  grid-template-columns: 1.35fr 0.75fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  min-height: 210px;
}

.style-preview-frame {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  background: rgba(9, 18, 30, 0.8);
}

.frame-main {
  grid-row: 1 / span 2;
}

.frame-side {
  min-height: 101px;
}

.style-preview-overlay {
  position: absolute;
  left: 24px;
  bottom: 24px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(7, 17, 31, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.style-preview-copy {
  padding: 14px 16px 18px;
  display: grid;
  gap: 12px;
}

.style-preview-copy h3 {
  margin: 0;
  font-size: 1.05rem;
}

.style-preview-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  min-height: 96px;
}

.style-preview-copy .btn {
  width: 100%;
}

.style-preview-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.33;
}

.style-preview-visual--prestige-superhero::after {
  background: radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.7), transparent 26%), linear-gradient(135deg, rgba(255, 224, 122, 0.18), transparent 45%);
}

.style-preview-visual--neo-noir::after {
  background: linear-gradient(180deg, rgba(15, 26, 44, 0.15), rgba(0, 0, 0, 0.65)), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02) 2px, transparent 2px, transparent 14px);
}

.style-preview-visual--ligne-claire::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.02));
}

.style-preview-visual--retro-pop::after {
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.25) 0 2px, transparent 2px 100%);
  background-size: 12px 12px;
}

.style-preview-visual--sunday-funnies::after {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 218, 145, 0.10));
}

.style-preview-visual--gritty-indie::after {
  background: linear-gradient(180deg, rgba(70, 50, 40, 0.18), rgba(0, 0, 0, 0.34));
}

.style-preview-visual--watercolor-dream::after {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.30), transparent 30%), radial-gradient(circle at 70% 65%, rgba(212, 167, 255, 0.18), transparent 32%);
  filter: blur(4px);
}

.style-preview-visual--manga-dynamic::after {
  background: repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18) 2px, transparent 2px, transparent 12px);
  opacity: 0.22;
}

.style-preview-visual--silver-age-satire::after {
  background: radial-gradient(circle at 20% 20%, rgba(255, 233, 121, 0.3), transparent 28%), radial-gradient(circle at 80% 10%, rgba(132, 200, 255, 0.22), transparent 26%);
}

.style-preview-visual--cinematic-painted::after {
  background: linear-gradient(180deg, rgba(255, 220, 170, 0.16), rgba(90, 60, 40, 0.20));
}

@media (max-width: 1100px) {
  .style-lab-toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .style-grid {
    grid-template-columns: 1fr;
  }

  .modal-meta-style-lab {
    flex-direction: column;
  }
}



.style-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.style-example-shell {
  display: grid;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.style-example-stage-viewport {
  min-height: 260px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.style-example-current {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.style-example-empty-state {
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  padding: 18px;
}

.style-example-nav {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 14px;
  cursor: pointer;
  font-size: 1.6rem;
  min-height: 260px;
}

.style-example-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.style-example-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.style-example-topic-readout {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.style-preview-card.has-generated-examples {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
}

@media (max-width: 900px) {
  .style-card-actions {
    grid-template-columns: 1fr;
  }

  .style-example-stage-card {
    grid-template-columns: 36px 1fr 36px;
  }

  .style-example-stage-viewport,
  .style-example-nav {
    min-height: 210px;
  }
}


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

.top-nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 999px;
  background: rgba(7, 17, 31, 0.55);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.top-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  color: #dbe8f8;
}

.top-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.page-title {
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.04em;
}

.compact-lede {
  max-width: none;
}

.full-comics-panel {
  min-height: 420px;
}

.selected-run-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.full-comics-empty {
  margin-top: 18px;
}

.clean-style-lab-card {
  width: min(1500px, calc(100vw - 40px));
}

.clean-style-toolbar {
  grid-template-columns: 1fr;
}

.clean-style-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.style-preview-card-clean {
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(12, 22, 37, 0.96), rgba(8, 15, 26, 0.98));
}

.style-example-shell-clean {
  display: grid;
  gap: 14px;
}

.clean-example-stage {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  min-height: 300px;
}

.clean-example-viewport {
  min-height: 300px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(11, 22, 37, 0.9), rgba(8, 15, 26, 0.96));
}

.clean-example-viewport img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  max-height: 380px;
  object-fit: contain;
  cursor: zoom-in;
  background: rgba(0, 0, 0, 0.18);
}

.style-example-empty-state {
  color: var(--muted);
  font-size: 0.96rem;
}

.clean-style-copy h3 {
  margin: 0;
  font-size: 1.08rem;
}

.clean-style-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.94rem;
}

.clean-topic-field input {
  min-height: 48px;
}

.clean-style-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.style-example-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 16, 28, 0.72);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

.style-example-nav[data-style-example-nav="prev"] {
  left: 12px;
}

.style-example-nav[data-style-example-nav="next"] {
  right: 12px;
}

.style-example-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.style-example-meta-row {
  display: grid;
  gap: 8px;
}

.style-example-topic-readout {
  color: #dbe7f7;
  font-size: 0.86rem;
}

@media (max-width: 980px) {

  .site-header-row,
  .selected-run-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .top-nav {
    width: 100%;
    justify-content: space-between;
  }

  .clean-style-grid {
    grid-template-columns: 1fr;
  }
}

.glass-subtle {
  background: rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.auth-panel {
  margin-top: calc(var(--safe-top, 20px) + 2rem);
  margin-bottom: 2rem;
}

.auth-branding {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.auth-branding .pwa-brand {
  text-decoration: none;
  pointer-events: none;
}

.selected-run-panel {
  margin-top: 32px;
}

.selected-run-card {
  padding: 32px;
  border-radius: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.selected-run-copy h2 {
  font-size: 2.2rem;
  margin: 12px 0 8px;
  letter-spacing: -0.04em;
}

.btn-large {
  min-height: 64px;
  padding: 0 42px;
  font-size: 1.1rem;
}

.reader-entry-btn {
  box-shadow: 0 20px 60px rgba(132, 200, 255, 0.25);
  font-weight: 900;
}

.btn-icon {
  margin-right: 12px;
  font-size: 1.4rem;
}

/* 3D COMIC READER V1 */
.comic-reader-modal .modal-card-reader {
  width: min(1480px, 100vw);
  height: 100vh;
  margin: 0 auto;
  border-radius: 0;
  border: none;
  background: black;
  padding: 0;
}

.comic-reader-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
}

.comic-reader-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.comic-reader-3d-stage {
  perspective: 2500px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
  padding: 40px;
  background:
    radial-gradient(circle at center, rgba(132, 200, 255, 0.05), transparent 70%),
    #000;
  overflow: hidden;
  position: relative;
}

.comic-book-3d {
  position: relative;
  width: min(500px, 45vw);
  height: min(750px, 85vh);
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  --book-z: 0px;
  --book-x: 0%;
  --pan-x: 0px;
  --pan-y: 0px;
  transform: translateX(calc(var(--book-x) + var(--pan-x))) translateY(var(--pan-y)) translateZ(var(--book-z)) rotateX(5deg);
}

.comic-reader-3d-stage.is-zoomed-active {
  cursor: grab;
}

.comic-reader-3d-stage.is-dragging {
  cursor: grabbing;
}

.comic-reader-3d-stage.is-dragging .comic-book-3d {
  transition: none;
  /* No transition during drag for responsiveness */
}

.comic-book-3d.is-open {
  --book-x: 50%;
}

.comic-book-3d.is-zoomed {
  --book-z: 800px;
}

.comic-page-3d {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.15, 0, 0.15, 1);
  cursor: pointer;
  z-index: var(--z-index, 1);
  will-change: transform;
}

.comic-page-3d.flipped {
  transform: rotateY(-180deg);
}

.comic-page-3d .page-side {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 4px;
  overflow: hidden;
  background: #0a0a0a;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.comic-page-3d .page-side.front {
  z-index: 2;
  transform: translateZ(0.5px);
}

.comic-page-3d .page-side.back {
  transform: rotateY(180deg) translateZ(0.5px);
  z-index: 1;
}

.comic-page-3d .page-side.back::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.comic-page-3d img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  user-select: none;
  -webkit-user-drag: none;
  image-rendering: auto;
  image-rendering: high-quality;
}

/* Page shading for depth */
.comic-page-3d::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.15), transparent 10%, transparent 90%, rgba(0, 0, 0, 0.15));
  z-index: 5;
  pointer-events: none;
  border-radius: inherit;
}

/* Spine interaction shadow */
.comic-page-3d .page-side::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.4), transparent);
  z-index: 10;
  pointer-events: none;
}

.comic-page-3d .page-side.back::before {
  left: auto;
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.4), transparent);
}

.reader-controls-3d {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  z-index: 500;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 16px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: opacity 0.3s, transform 0.3s;
}

.reader-controls-3d:hover {
  transform: translateX(-50%) scale(1.05);
}

.reader-btn-3d {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  transition: all 0.2s;
  position: relative;
}

.reader-btn-3d:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.1);
}

.reader-btn-3d span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
  font-weight: 700;
  opacity: 0.7;
}

.reader-btn-3d:disabled {
  opacity: 0.2;
  cursor: default;
}

.modal-meta-reader.immersive {
  position: absolute;
  top: 24px;
  left: 32px;
  z-index: 200;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 20px;
  border-radius: 16px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin: 0;
}

.modal-meta-reader.immersive * {
  pointer-events: auto;
}


@media (max-width: 800px) {
  .comic-book-3d {
    width: 85vw;
    height: auto;
    aspect-ratio: 2 / 3;
    transform: none !important;
  }
}

/* === accordion-book-page-patch === */
.accordion-shell {
  position: relative;
}

.accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
}

.accordion-toggle-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.accordion-toggle-eyebrow {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted, rgba(255, 255, 255, 0.65));
}

.accordion-toggle-title {
  display: block;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.1;
  color: #f4f7fb;
}

.accordion-toggle-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #dbe7f7;
  font-size: 1rem;
  transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}

.accordion-shell.is-open>.accordion-toggle .accordion-toggle-icon {
  transform: rotate(180deg);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.accordion-content {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.36s ease, opacity 0.22s ease, margin-top 0.22s ease;
  margin-top: 0;
}

.accordion-shell.is-open>.accordion-content {
  opacity: 1;
  pointer-events: auto;
  margin-top: 18px;
}

.book-hero .hero-card.glass.accordion-shell {
  display: block;
}

.book-hero .hero-card.glass.accordion-shell:not(.is-open) {
  padding-bottom: 20px;
}

.book-hero .hero-card.glass.accordion-shell>.accordion-toggle .accordion-toggle-title {
  font-size: 1.2rem;
}

.panel.glass.accordion-shell>.accordion-toggle {
  padding-bottom: 4px;
}

.panel.glass.accordion-shell>.accordion-toggle .accordion-toggle-title {
  font-size: clamp(1.05rem, 1.7vw, 1.4rem);
}

.panel.glass.accordion-shell.is-open>.accordion-toggle {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 980px) {
  .accordion-toggle-title {
    font-size: 1.02rem;
  }
}

/* === whhw full comic reader zoom/pan/close patch === */
.comic-reader-modal .modal-card-reader {
  position: relative;
}

.reader-close-pill {
  position: absolute;
  top: 22px;
  right: 24px;
  z-index: 950;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(9, 16, 28, 0.82);
  color: #f5f8ff;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(12px);
}

.reader-close-pill:hover {
  background: rgba(20, 31, 51, 0.92);
  border-color: rgba(255, 255, 255, 0.26);
}

.modal-card-reader .modal-close[data-close-reader="true"] {
  z-index: 960;
}

#comic-reader-3d-stage.is-wheel-zoomed {
  cursor: grab;
}

#comic-reader-3d-stage.is-wheel-zoomed.is-dragging {
  cursor: grabbing;
}

#comic-reader-3d-stage.is-wheel-zoomed #comic-book-3d,
#comic-book-3d.whhw-wheel-zoomed {
  transform-origin: center center;
  transform: translate3d(var(--pan-x, 0px), var(--pan-y, 0px), 0) scale(var(--reader-wheel-scale, 1.45)) !important;
}

.reader-controls-3d .reader-zoom-readout {
  min-width: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #dbe7f7;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.88;
}

.reader-wheel-hint {
  position: absolute;
  top: 78px;
  right: 24px;
  z-index: 920;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(7, 12, 20, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(230, 238, 248, 0.88);
  font-size: 0.78rem;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

@media (max-width: 900px) {
  .reader-close-pill {
    top: 16px;
    right: 16px;
    min-height: 38px;
    padding: 0 13px;
    font-size: 0.88rem;
  }

  .reader-wheel-hint {
    top: 62px;
    right: 16px;
    font-size: 0.72rem;
  }
}

/* === mobile-scroll-reader-patch === */
.comic-reader-modal.mobile-scroll-mode .modal-card-reader {
  width: min(100vw, 100%);
  max-width: none;
}

.comic-reader-modal.mobile-scroll-mode .modal-meta-reader {
  position: sticky;
  top: 0;
  z-index: 15;
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(7, 13, 24, 0.96), rgba(7, 13, 24, 0.84));
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.comic-reader-modal.mobile-scroll-mode .modal-meta-reader.immersive {
  position: sticky;
  top: 0;
  left: auto;
  background: linear-gradient(180deg, rgba(7, 13, 24, 0.96), rgba(7, 13, 24, 0.84));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.comic-reader-modal.mobile-scroll-mode #comic-reader-body,
.comic-reader-modal.mobile-scroll-mode #comic-reader-track {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

.comic-reader-modal.mobile-scroll-mode .reader-controls-3d,
.comic-reader-modal.mobile-scroll-mode .comic-book-3d,
.comic-reader-modal.mobile-scroll-mode .comic-reader-page,
.comic-reader-modal.mobile-scroll-mode .comic-reader-spread {
  display: none !important;
}

.comic-reader-modal.mobile-scroll-mode .mobile-reader-stack {
  display: grid;
  gap: 18px;
  padding-bottom: 28px;
}

.comic-reader-modal.mobile-scroll-mode .mobile-reader-page {
  display: grid;
  gap: 10px;
}

.comic-reader-modal.mobile-scroll-mode .mobile-reader-label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(219, 231, 247, 0.72);
  padding-inline: 6px;
}

.comic-reader-modal.mobile-scroll-mode .mobile-reader-frame {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.comic-reader-modal.mobile-scroll-mode .mobile-reader-frame img {
  display: block;
  width: 100%;
  height: auto;
  background: #08101b;
}

@media (max-width: 860px) {
  .comic-reader-modal.mobile-scroll-mode .modal-card-reader {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 14px 10px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .comic-reader-modal.mobile-scroll-mode .modal-close {
    top: max(10px, env(safe-area-inset-top, 0px));
    right: 12px;
    z-index: 30;
  }
}


.inline-form {
  display: inline-flex;
  margin: 0;
}

.top-nav-btn,
.top-nav-link-strong {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f4f7fb;
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.top-nav-btn {
  cursor: pointer;
}

.auth-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.auth-panel {
  max-width: 880px;
  margin: 0 auto;
}

.auth-note {
  margin-bottom: 16px;
}

.success-note {
  color: var(--success);
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(141, 246, 198, 0.08);
  border: 1px solid rgba(141, 246, 198, 0.22);
}

.auth-cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.inline-link {
  color: var(--accent);
  text-decoration: underline;
}

.account-avatar-card {
  width: 180px;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.04);
}

.account-avatar-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Account page crop UI */
.avatar-crop-field {
  margin-bottom: 16px;
}

.avatar-crop-card {
  width: 220px;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: rgba(255, 255, 255, 0.04);
  position: relative;
}

.avatar-crop-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.avatar-crop-card .avatar-crop-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.avatar-crop-actions {
  margin-top: 10px;
}

.avatar-crop-card .cropper-view-box,
.avatar-crop-card .cropper-face {
  border-radius: 50%;
}

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--line, #444);
  border-radius: 24px;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent, #4f46e5);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--text-color, #ccc);
  cursor: pointer;
  user-select: none;
}

.friend-list {
  display: grid;
  gap: 6px;
}

.friend-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.15s, border-color 0.15s;
}

.friend-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.friend-card-left {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  flex: 1;
  min-width: 0;
}

.friend-card-left img,
.friend-fallback {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex: 0 0 auto;
}

.friend-fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #08111e;
  font-weight: 800;
  font-size: 1rem;
}

.friend-card-info {
  min-width: 0;
  flex: 1;
}

.friend-card-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.friend-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-card-status {
  flex-shrink: 0;
}

.friend-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.friend-card-email {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-card-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.friend-card-label {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.friend-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.friend-card-actions.two-buttons {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-card {
  align-items: center;
}

.muted-line {
  color: var(--muted);
  font-size: 0.92rem;
}

.mini-label {
  display: block;
}

@media (max-width: 920px) {
  .friend-card {
    flex-wrap: wrap;
  }

  .friend-card-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 4px;
  }
}

.friend-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.friend-ref-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.friend-ref-card.is-selected {
  border-color: rgba(122, 188, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(122, 188, 255, 0.4) inset;
}

.friend-ref-card>input[type="checkbox"] {
  justify-self: start;
  transform: scale(1.2);
}

.friend-ref-thumb-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.friend-ref-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.friend-ref-copy small,
.muted-line,
.mini-label {
  display: block;
}

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

.friend-card-actions.two-buttons {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-card {
  align-items: center;
}



.library-view-toggle {
  display: flex;
  background: var(--bg-3);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
  margin-top: 12px;
}

.toggle-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.25s cubic-bezier(0.19, 1, 0.22, 1);
}

.toggle-btn .btn-label {
  letter-spacing: 0.02em;
}

.toggle-btn .btn-count {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 800;
  opacity: 0.7;
}

.toggle-btn.active {
  background: var(--accent);
  color: #06101d;
  box-shadow: 0 4px 15px rgba(132, 200, 255, 0.3);
}

.toggle-btn.active .btn-count {
  background: rgba(0, 0, 0, 0.12);
  opacity: 1;
}

.toggle-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.library-layer {
  display: none;
  animation: layerFadeIn 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.library-layer.active {
  display: block;
}

@keyframes layerFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}


.browse-run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.browse-run-card,
.profile-run-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.browse-run-card-link,
.profile-run-item {
  display: block;
  color: inherit;
  text-decoration: none;
}

.browse-run-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.browse-run-copy {
  padding: 14px;
}

.profile-card {
  max-width: 320px;
}

.profile-hero-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  margin-bottom: 12px;
}

.profile-run-list {
  display: grid;
  gap: 12px;
}

.profile-run-item {
  padding: 14px;
}

/* ==========================================================================
   PROFILE MANAGEMENT LAYOUT (PWA-Optimized)
   ========================================================================== */

.profile-manage-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.profile-manage-primary {
  display: grid;
  gap: 16px;
}

.profile-manage-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.profile-fields-column {
  display: grid;
  gap: 12px;
  align-content: start;
}

.profile-fields-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

@media (max-width: 700px) {
  .profile-manage-fields {
    grid-template-columns: 1fr;
  }
}

/* Better touch targets for friend cards */
.friend-card {
  min-height: 0;
}

.friend-card .btn-small {
  min-height: 32px;
  min-width: 70px;
  font-size: 0.8rem;
  padding: 4px 12px;
}

/* ==========================================================================
   PROFILE HERO SECTION (PWA-Optimized)
   ========================================================================== */

.profile-hero-section {
  margin-bottom: 24px;
}

.profile-hero-card {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, rgba(15, 26, 44, 0.92), rgba(8, 17, 30, 0.9));
  backdrop-filter: blur(26px);
}

.profile-hero-avatar {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 0.04);
}

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

.profile-hero-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.profile-hero-body {
  flex: 1;
  min-width: 0;
}

.profile-hero-body h1 {
  margin: 4px 0 8px;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.profile-hero-body .lede {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.profile-hero-body .pill-row {
  margin-top: 8px;
}

.profile-hero-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

@media (max-width: 640px) {
  .profile-hero-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
  }

  .profile-hero-avatar {
    width: 90px;
    height: 90px;
  }

  .profile-hero-body .pill-row {
    justify-content: center;
  }

  .profile-hero-actions {
    justify-content: center;
  }
}

/* ==========================================================================
   PWA INSTALL PROMPT
   ========================================================================== */

.pwa-installable .pwa-install-banner {
  display: flex;
  gap: 12px;
  align-items: center;
}

.pwa-install-banner {
  display: none;
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 12px);
  left: 12px;
  right: 12px;
  z-index: 999;
  background: linear-gradient(135deg, rgba(15, 26, 44, 0.97), rgba(8, 17, 30, 0.97));
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.pwa-install-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.pwa-install-banner-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pwa-install-banner-text {
  text-align: center;
}

.pwa-install-banner-text strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.pwa-install-banner-text span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.pwa-install-never-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}

.pwa-install-never-check input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.pwa-install-banner-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.pwa-install-banner-actions .btn {
  flex: 1;
  justify-content: center;
}

@media (min-width: 480px) {
  .pwa-install-banner-actions .btn {
    flex: none;
  }
}

@media (min-width: 769px) {
  .pwa-install-banner {
    bottom: 12px;
    left: auto;
    right: 12px;
    max-width: 380px;
  }
}

/* ==========================================================================
   SW UPDATE BANNER
   ========================================================================== */

.sw-update-available .sw-update-banner {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sw-update-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, rgba(15, 26, 44, 0.97), rgba(8, 17, 30, 0.97));
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.sw-update-banner-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
}

.sw-update-banner-text {
  text-align: left;
}

.sw-update-banner-text strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 1px;
}

.sw-update-banner-text span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.sw-update-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

root {
  --bg: #050d19;
  --bg-2: #0a1628;
  --panel: rgba(11, 20, 36, 0.8);
  --panel-2: rgba(17, 29, 52, 0.92);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: #9fb0c9;
  --accent: #4ea1ff;
  --accent-2: #8b5cf6;
  --danger: #ff6f91;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top left, rgba(78, 161, 255, 0.14), transparent 28%), radial-gradient(circle at top right, rgba(139, 92, 246, 0.12), transparent 30%), linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: 20px;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-shell {
  max-width: 1560px;
  margin: 0 auto;
}

.glass,
.panel,
.book-card,
.book-card-shell,
.empty-state,
.hero-card,
.modal-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.glass {
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.94), rgba(8, 15, 28, 0.94));
  backdrop-filter: blur(24px);
}

.eyebrow,
.stat-label {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
}

.lede {
  color: var(--muted);
  line-height: 1.65;
}

.pill,
.pill-soft {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: #dbe6f8;
}

.pill-soft {
  background: rgba(255, 255, 255, 0.07);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

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

.btn-primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary2 {
  color: darkblue;
  font-size: 32px;
  background: rgb(131, 206, 223);
  border: 2px solid rgb(255, 255, 255);
  margin-top: 10px;
  margin-bottom: 10px;
}

.icon-form {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 17, 31, 0.78);
  color: var(--text);
  cursor: pointer;
}

.icon-btn-danger {
  background: rgba(112, 24, 45, 0.82);
  border-color: rgba(255, 111, 145, 0.28);
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  color: #dce5f5;
}

.field small {
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 180px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(78, 161, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(78, 161, 255, 0.12);
}

.stack-lg {
  display: grid;
  gap: 16px;
}

.home-v4-shell {
  display: grid;
  gap: 20px;
}

.home-v4-header {
  border-radius: 28px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.home-v4-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.home-v4-brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07111c;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.home-v4-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-v4-brand-copy strong {
  font-size: 1rem;
}

.home-v4-brand-copy span {
  color: var(--muted);
  font-size: 0.84rem;
}

.home-v4-nav {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.home-v4-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: #d7e3f6;
}

.home-v4-nav-link:hover,
.home-v4-nav-link.is-active {
  background: rgba(255, 255, 255, 0.07);
}

.home-v4-hero {
  border-radius: 30px;
  padding: 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.home-v4-hero-copy h1 {
  margin: 8px 0 10px;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.hero-card {
  display: none;
}

.home-v4-library {
  width: 1550px;
  border-radius: 30px;
  padding: 24px;
}

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

.home-v4-library-head h2 {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: -0.03em;
}

.home-v4-scroll-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.home-v4-scroll-track {
  display: flex;
  gap: 18px;
  min-width: max-content;
}

.home-v4-card-shell {
  position: relative;
  flex: 0 0 280px;
  width: 280px;
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(12, 23, 39, 0.95), rgba(8, 16, 28, 0.98));
}

.home-v4-card {
  display: block;
}

.home-v4-card-media {
  position: relative;
  min-height: 390px;
}

.home-v4-card img {
  width: 100%;
  height: 390px;
  object-fit: cover;
  display: block;
}

.home-v4-card-fallback {
  width: 100%;
  height: 390px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(78, 161, 255, 0.14), rgba(139, 92, 246, 0.12));
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.home-v4-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 8, 14, 0.02), rgba(4, 8, 14, 0.7) 72%, rgba(4, 8, 14, 0.92));
}

.home-v4-card-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px;
  z-index: 2;
}

.home-v4-card-copy h3 {
  margin: 0 0 12px;
  font-size: 1.14rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.home-v4-create-cta {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

.btn-home-v4 {
  min-width: 280px;
  min-height: 58px;
  font-size: 1rem;
  box-shadow: 0 22px 55px rgba(78, 161, 255, 0.22);
}

.empty-state {
  border-radius: 24px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.03);
}

.empty-state p {
  color: var(--muted);
  margin-bottom: 0;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 15, 0.76);
  backdrop-filter: blur(10px);
}

.home-v4-modal-card {
  position: relative;
  z-index: 2;
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 24px;
  border-radius: 30px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.98), rgba(8, 15, 28, 0.98));
}

.home-v4-modal-head {
  margin-bottom: 18px;
  padding-right: 54px;
}

.home-v4-modal-head h2 {
  margin: 8px 0;
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.home-v4-modal-lede {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.friend-manage-modal-card {
  position: relative;
  z-index: 2;
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 0;
  border-radius: 30px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.98), rgba(8, 15, 28, 0.98));
}

.friend-manage-modal-body {
  padding: 76px 24px 24px;
  overflow-y: auto;
  max-height: calc(100vh - 80px);
}

.friend-manage-modal-body .panel {
  margin-bottom: 12px;
}

.friend-manage-modal-body .panel:last-child {
  margin-bottom: 0;
}

/* Consolidated with main .modal-close definition */

.home-v4-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.field-cast-composer {
  gap: 14px;
}

.cast-composer-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.cast-builder {
  display: grid;
  gap: 16px;
}

.btn-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  align-self: flex-start;
}

.btn-plus-mark {
  font-size: 1.2rem;
  line-height: 1;
}

@media (max-width: 980px) {

  .home-v4-header,
  .home-v4-hero,
  .home-v4-library-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-v4-nav {
    width: 100%;
  }

  .home-v4-nav-link {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .home-v4-header,
  .home-v4-hero,
  .home-v4-library,
  .home-v4-modal-card {
    padding: 16px;
    border-radius: 22px;
  }

  .home-v4-hero-copy h1 {
    font-size: 2.2rem;
  }

  .home-v4-scroll-track {
    gap: 14px;
  }

  .home-v4-card-shell {
    flex: 0 0 220px;
    width: 220px;
    border-radius: 22px;
  }

  .home-v4-card-media,
  .home-v4-card img,
  .home-v4-card-fallback {
    height: 310px;
    min-height: 310px;
  }

  .btn-home-v4 {
    width: 100%;
    min-width: 0;
  }

  .home-v4-modal-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
  }

  .home-v4-modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* === home-v5 main page + slot-based create modal === */
.home-v5-shell {
  display: grid;
  gap: 20px;
}

.home-v5-header {
  border-radius: 28px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.home-v5-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.home-v5-brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07111c;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.home-v5-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-v5-brand-copy strong {
  font-size: 1rem;
}

.home-v5-brand-copy span {
  color: var(--muted);
  font-size: 0.84rem;
}

.home-v5-nav {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.home-v5-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: #d7e3f6;
}

.home-v5-nav-link:hover,
.home-v5-nav-link.is-active {
  background: rgba(255, 255, 255, 0.07);
}

.home-v5-hero {
  display: none;
}

.home-v5-library {
  width: 1550px;
  max-width: 100%;
  border-radius: 30px;
  padding: 24px;
}

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

.home-v5-library-head h2 {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: -0.03em;
}

.home-v5-scroll-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.home-v5-scroll-track {
  display: flex;
  gap: 18px;
  min-width: max-content;
}

.home-v5-card-shell {
  position: relative;
  flex: 0 0 280px;
  width: 280px;
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(12, 23, 39, 0.95), rgba(8, 16, 28, 0.98));
}

.home-v5-card {
  display: block;
}

.home-v5-card-media {
  position: relative;
  min-height: 390px;
}

.home-v5-card img {
  width: 100%;
  height: 390px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.home-v5-card-fallback {
  width: 100%;
  height: 390px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(78, 161, 255, 0.14), rgba(139, 92, 246, 0.12));
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.home-v5-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(4, 8, 14, 0.02),
      rgba(4, 8, 14, 0.7) 72%,
      rgba(4, 8, 14, 0.92));
}

.home-v5-card-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px;
  z-index: 2;
}

.home-v5-card-copy h3 {
  margin: 0 0 12px;
  font-size: 1.14rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.home-v5-create-cta {
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

.btn-home-v5 {
  min-width: 280px;
  min-height: 58px;
  font-size: 1rem;
  box-shadow: 0 22px 55px rgba(78, 161, 255, 0.22);
}

.home-v5-modal-card {
  position: relative;
  z-index: 2;
  width: min(860px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 24px;
  border-radius: 30px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.98), rgba(8, 15, 28, 0.98));
}

.home-v5-modal-head {
  margin-bottom: 18px;
  padding-right: 54px;
}

.home-v5-modal-head h2 {
  margin: 8px 0;
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.home-v5-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.field-slot-composer {
  gap: 14px;
}

.slot-composer-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.reference-slot-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.reference-slot {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
  padding: 0;
  border-radius: 18px;
  cursor: pointer;
  min-height: 104px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  overflow: hidden;
}

.reference-slot:hover,
.reference-slot:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(132, 200, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
}

.reference-slot.is-filled {
  border-color: rgba(132, 200, 255, 0.34);
}

.reference-slot-inner {
  position: relative;
  width: 100%;
  height: 104px;
  display: grid;
  place-items: center;
}

.reference-slot-plus {
  font-size: 1.8rem;
  font-weight: 700;
  color: rgba(235, 243, 255, 0.7);
  line-height: 1;
}

.reference-slot-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.slot-editor-card {
  position: relative;
  z-index: 2;
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 24px;
  border-radius: 28px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.98), rgba(8, 15, 28, 0.98));
}

.slot-editor-head {
  margin-bottom: 16px;
  padding-right: 54px;
}

.slot-editor-head h3 {
  margin: 8px 0 0;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

.slot-editor-body {
  display: grid;
  gap: 16px;
}

.slot-editor-dropzone {
  width: 100%;
  border: 1px dashed rgba(132, 200, 255, 0.4);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 24px;
  min-height: 260px;
  padding: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.slot-editor-dropzone:hover,
.slot-editor-dropzone:focus-visible,
.slot-editor-dropzone.is-dragover {
  border-color: rgba(132, 200, 255, 0.8);
  background: rgba(132, 200, 255, 0.08);
  transform: translateY(-1px);
}

.slot-editor-dropcopy {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  color: var(--muted);
}

.slot-editor-plus {
  font-size: 2rem;
  line-height: 1;
  color: #f2f7ff;
}

.slot-editor-dropcopy strong {
  color: #f2f7ff;
  font-size: 1rem;
}

.slot-editor-preview {
  width: 100%;
  height: 100%;
  min-height: 230px;
  object-fit: cover;
  object-position: center;
  border-radius: 18px;
  display: block;
}

.slot-editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

.slot-editor-actions-right {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {

  .home-v5-header,
  .home-v5-library-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-v5-nav {
    width: 100%;
  }

  .home-v5-nav-link {
    flex: 1 1 auto;
    justify-content: center;
  }

  .reference-slot-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {

  .home-v5-header,
  .home-v5-library,
  .home-v5-modal-card,
  .slot-editor-card {
    padding: 16px;
    border-radius: 22px;
  }

  .home-v5-scroll-track {
    gap: 14px;
  }

  .home-v5-card-shell {
    flex: 0 0 220px;
    width: 220px;
    border-radius: 22px;
  }

  .home-v5-card-media,
  .home-v5-card img,
  .home-v5-card-fallback {
    height: 310px;
    min-height: 310px;
  }

  .reference-slot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .reference-slot-inner {
    height: 88px;
  }

  .slot-editor-dropzone {
    min-height: 220px;
  }

  .btn-home-v5 {
    width: 100%;
    min-width: 0;
  }

  .home-v5-modal-card,
  .slot-editor-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
  }

  .home-v5-modal-actions,
  .slot-editor-actions,
  .slot-editor-actions-right {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
}

/* === home-v6 main page + slot modal corrections === */
.home-v6-shell {
  display: grid;
  gap: 20px;
}

.home-v6-header {
  width: 500px;
  border-radius: 28px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.home-v6-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.home-v6-brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #07111c;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.home-v6-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-v6-brand-copy strong {
  font-size: 1rem;
}

.home-v6-brand-copy span {
  color: var(--muted);
  font-size: 0.84rem;
}

.home-v6-nav {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

.home-v6-nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: #d7e3f6;
}

.home-v6-nav-link:hover,
.home-v6-nav-link.is-active {
  background: rgba(255, 255, 255, 0.07);
}

.home-v6-hero {
  padding: 100px 40px;
  margin-bottom: 40px;
  border-radius: 48px;
  background: radial-gradient(circle at top left, rgba(132, 200, 255, 0.08), transparent),
    linear-gradient(180deg, rgba(15, 26, 44, 0.8), rgba(8, 17, 30, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
  box-shadow: var(--shadow);
}

.home-v6-hero-copy {
  max-width: 840px;
}

.home-v6-hero-copy h1 {
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
  font-weight: 900;
  margin: 16px 0 24px;
  background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-v6-hero-copy .lede {
  font-size: 1.25rem;
  margin: 0 auto;
}

.home-v6-library {
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  border-radius: 36px;
  padding: 32px;
  background: rgba(18, 31, 50, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.3);
}

.home-v6-library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid transparent;
  /* Make header sticky */
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  padding-top: 32px;
  margin-top: -32px;
  /* offset the top padding visually */
  transition: background-color 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}

.home-v6-library-head.is-stuck {
  background: rgba(14, 25, 41, 0.98) !important;
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.home-v6-library-head h2 {
  margin: 8px 0 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#home-v6-section-title {
  margin-left: 16px;
}

.home-v6-grid-container {
  width: 100%;
  margin-top: 10px;
  overflow: visible;
}

.home-v6-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 32px;
  width: 100%;
}

.home-v6-card-shell {
  position: relative;
  width: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(14, 24, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.45s cubic-bezier(0.23, 1, 0.32, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.home-v6-card-shell.is-processing {
  pointer-events: none;
  opacity: 0.7;
  filter: grayscale(0.3) contrast(0.9);
  animation: card-processing-pulse 1.2s infinite ease-in-out;
  border-color: rgba(255, 100, 100, 0.3) !important;
}

@keyframes card-processing-pulse {
  0% {
    transform: scale(1);
    filter: grayscale(0.3) brightness(1);
  }

  50% {
    transform: scale(0.97);
    filter: grayscale(0.6) brightness(0.8);
  }

  100% {
    transform: scale(1);
    filter: grayscale(0.3) brightness(1);
  }
}

.home-v6-card-shell.is-removing {
  pointer-events: none;
  z-index: 10;
  animation: card-removing 0.6s forwards cubic-bezier(0.4, 0, 0.2, 1);
}

.home-v6-card-shell:hover {
  transform: translateY(-12px) scale(1.03);
  border-color: rgba(132, 200, 255, 0.5);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 30px rgba(132, 200, 255, 0.2);
  z-index: 10;
}

.home-v6-card {
  display: block;
}

.home-v6-card-media {
  position: relative;
  width: 100%;
  padding-top: 145%;
  /* Professional comic ratio */
  background: var(--bg-3);
  overflow: hidden;
}

.home-v6-card img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.home-v6-card-shell:hover img {
  transform: scale(1.15);
}

.home-v6-card-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.1), rgba(212, 167, 255, 0.1));
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  padding: 24px;
}

.home-v6-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      transparent 40%,
      rgba(4, 11, 22, 0.3) 60%,
      rgba(4, 11, 22, 0.9) 85%,
      rgba(4, 11, 22, 1) 100%);
  opacity: 0.9;
  transition: opacity 0.4s ease;
}

.home-v6-card-shell:hover .home-v6-card-overlay {
  opacity: 1;
}

.home-v6-card-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px;
  z-index: 2;
  transform: translateY(5px);
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.home-v6-card-shell:hover .home-v6-card-copy {
  transform: translateY(0);
}

.home-v6-card-copy h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  line-height: 1.3;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-delete-form {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  opacity: 0;
  transform: scale(0.7);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.home-v6-card-shell:hover .card-delete-form {
  opacity: 1;
  transform: scale(1);
}

.delete-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 60, 100, 0.85);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 1.4rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.delete-icon-btn:hover {
  background: #ff3c64;
  transform: scale(1.1) rotate(90deg);
  border-color: rgba(255, 255, 255, 0.3);
}

.quick-add-book-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent-gradient, linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%));
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10;
}

.quick-delete-series-btn {
  position: absolute;
  top: 62px;
  right: 12px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10;
}

.quick-delete-series-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 12px 24px rgba(220, 38, 38, 0.5);
  border-color: rgba(255, 255, 255, 0.5);
}

.quick-add-book-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.5);
  border-color: rgba(255, 255, 255, 0.5);
}

.quick-add-book-btn i,
.quick-add-book-btn svg,
.quick-delete-series-btn i,
.quick-delete-series-btn svg {
  width: 20px;
  height: 20px;
  pointer-events: none;
}

/* Pulsing effect to draw attention to the add button on series list if the user is the author */
@keyframes card-removing {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: blur(0);
  }

  25% {
    transform: scale(1.04);
    opacity: 0.9;
    filter: blur(0);
  }

  100% {
    transform: scale(0.75);
    opacity: 0;
    filter: blur(12px);
  }
}

@keyframes quick-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
  }
}

.series-card-shell:hover .quick-add-book-btn {
  animation: quick-pulse 2s infinite;
}

.home-v6-card-button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: block;
  color: inherit;
}

.series-media {
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.04), rgba(212, 167, 255, 0.04));
}

.home-v6-create-cta {
  display: flex;
  justify-content: center;
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  z-index: 99;
  pointer-events: none;
}

.home-v6-create-cta .btn-main-generate-wrapper {
  pointer-events: auto;
  margin-top: 0;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2), 0 12px 30px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-1);
}

.home-v6-create-cta .btn-home-v6 {
  min-width: 260px;
  min-height: 52px;
  font-size: 1rem;
  justify-content: center;
  /* Resting "pop" state before interaction */
  background: rgba(10, 16, 26, 0.6);
  /* increased translucency for clearer frosted effect */
  backdrop-filter: blur(32px);
  /* much stronger blur */
  -webkit-backdrop-filter: blur(32px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  /* slightly brighter border for deeper frost look */
}

/* Dynamic glowing effect on hover and active */
.home-v6-create-cta .btn-home-v6:hover,
.home-v6-create-cta .btn-home-v6:active {
  background: var(--accent) !important;
  color: #06101d !important;
  box-shadow: 0 0 25px rgba(132, 200, 255, 0.4) !important;
}

.home-v6-create-cta .btn-home-v6:hover .btn-count,
.home-v6-create-cta .btn-home-v6:active .btn-count {
  background: rgba(0, 0, 0, 0.12);
  opacity: 1;
}

.home-v6-modal-card {
  position: relative;
  z-index: 2;
  width: min(900px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 24px;
  border-radius: 30px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.98), rgba(8, 15, 28, 0.98));
}

.home-v6-modal-head {
  margin-bottom: 18px;
  padding-right: 54px;
}

.home-v6-modal-head h2 {
  margin: 8px 0;
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.home-v6-modal-lede {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.home-v6-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.field-radio-group {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.radio-option {
  display: flex;
}

.radio-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.radio-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  color: #b0b9cc;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
  font-size: 0.92rem;
  user-select: none;
}

.radio-option input:checked + label {
  border-color: #84c8ff;
  background: rgba(132, 200, 255, 0.15);
  color: #f2f7ff;
  box-shadow: 0 0 0 1px rgba(132, 200, 255, 0.3);
}

.field-hint {
  font-size: 0.78rem;
  color: #7a8396;
  line-height: 1.4;
}

.field-slot-composer {
  gap: 14px;
}

.slot-composer-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.reference-slot-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.reference-slot {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
  padding: 0;
  border-radius: 18px;
  cursor: pointer;
  min-height: 104px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  overflow: hidden;
}

.reference-slot:hover,
.reference-slot:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(132, 200, 255, 0.5);
  background: rgba(255, 255, 255, 0.06);
}

.reference-slot.is-filled {
  border-color: rgba(132, 200, 255, 0.34);
}

.reference-slot-surface {
  position: relative;
  width: 100%;
  height: 104px;
  display: grid;
  place-items: center;
  background-color: rgba(255, 255, 255, 0.03);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  overflow: hidden;
}

.reference-slot-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 8, 14, 0.06), rgba(4, 8, 14, 0.58));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.reference-slot-surface.has-image::after {
  opacity: 1;
}

.reference-slot-plus {
  position: relative;
  z-index: 2;
  font-size: 1.8rem;
  font-weight: 700;
  color: rgba(235, 243, 255, 0.7);
  line-height: 1;
}

.reference-slot-label {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
  color: #f4f7fb;
  text-align: left;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reference-slot-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(8, 15, 28, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f7fb;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
}

.slot-editor-card {
  position: relative;
  z-index: 2;
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  margin: 14px auto;
  padding: 24px;
  border-radius: 28px;
  overflow: auto;
  background: linear-gradient(180deg, rgba(14, 24, 42, 0.98), rgba(8, 15, 28, 0.98));
}

.slot-editor-head {
  margin-bottom: 16px;
  padding-right: 54px;
}

.slot-editor-head h3 {
  margin: 8px 0 0;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

.slot-editor-body {
  display: grid;
  gap: 16px;
}

.slot-editor-dropzone {
  width: 100%;
  border: 1px dashed rgba(132, 200, 255, 0.4);
  background-color: rgba(255, 255, 255, 0.03);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: 24px;
  min-height: 320px;
  padding: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
  position: relative;
}

.slot-editor-dropzone:hover,
.slot-editor-dropzone:focus-visible,
.slot-editor-dropzone.is-dragover {
  border-color: rgba(132, 200, 255, 0.8);
  background-color: rgba(132, 200, 255, 0.08);
  transform: translateY(-1px);
}

.slot-editor-dropzone.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 8, 14, 0.1), rgba(4, 8, 14, 0.46));
  pointer-events: none;
}

.slot-editor-dropcopy {
  height: 100%;
  min-height: 290px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  color: var(--muted);
  position: relative;
  z-index: 2;
}

.slot-editor-plus {
  font-size: 2rem;
  line-height: 1;
  color: #f2f7ff;
}

.slot-editor-dropcopy strong {
  color: #f2f7ff;
  font-size: 1rem;
}

.slot-editor-helper-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.slot-helper-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.slot-helper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.slot-helper-note {
  color: var(--muted);
  line-height: 1.45;
}

.slot-editor-search-results {
  display: grid;
  gap: 10px;
  max-height: 210px;
  overflow: auto;
}

.slot-search-result {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #f4f7fb;
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
}

.slot-search-result:hover {
  border-color: rgba(132, 200, 255, 0.45);
  background: rgba(132, 200, 255, 0.09);
}

.slot-search-thumb {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: block;
}

.slot-search-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.slot-search-copy strong {
  display: block;
  line-height: 1.15;
}

.slot-search-copy small {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.2;
}

.slot-search-empty {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 12px 2px 2px;
}

.slot-editor-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

.slot-editor-actions-right {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {

  .home-v6-header,
  .home-v6-library-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-v6-nav {
    width: 100%;
  }

  .home-v6-nav-link {
    flex: 1 1 auto;
    justify-content: center;
  }

  .reference-slot-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .slot-editor-helper-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
    max-width: 100vw;
    overflow-x: hidden;

  }

  .site-shell {
    max-width: 100%;
    overflow-x: hidden;
  }

  .home-v6-header,
  .home-v6-library,
  .home-v6-modal-card,
  .slot-editor-card {
    padding: 16px;
    border-radius: 22px;
    width: 100%;
    max-width: 100%;
  }

  .home-v6-grid-container {
    overflow: hidden;
  }

  /* Make comics full width on mobile */
  .home-v6-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
    padding: 0;
  }

  .home-v6-card-shell {
    border-radius: 20px;
    aspect-ratio: auto;
    width: 100%;
    overflow: hidden;
  }

  .home-v6-card-media {
    padding-top: 140%;
  }

  .home-v6-card-copy {
    padding: 16px;
  }

  .home-v6-card-copy h3 {
    font-size: 1.05rem;
  }

  .reference-slot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .reference-slot-surface {
    height: 88px;
  }

  .slot-editor-dropzone {
    min-height: 260px;
  }

  .btn-home-v6 {
    width: 100%;
    min-width: 0;
  }

  .home-v6-modal-card,
  .slot-editor-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
  }

  .home-v6-modal-actions,
  .slot-editor-actions,
  .slot-editor-actions-right {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }
}



/* === v5 admin system === */
.admin-grid {
  display: grid;
  gap: 18px;
}

.admin-two-up {
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  align-items: start;
}

.admin-dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 18px;
}

.admin-nav-card {
  display: grid;
  gap: 8px;
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: var(--shadow);
}

.admin-nav-card h3,
.admin-user-card h3 {
  margin: 0;
}

.admin-nav-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-link-pill {
  text-decoration: none;
}

.admin-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px;
}

.checkbox-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.checkbox-card input {
  width: auto;
  margin-top: 4px;
}

.checkbox-card span {
  display: grid;
  gap: 4px;
}

.checkbox-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.82rem;
}

.admin-user-head {
  margin-bottom: 14px;
}

.admin-avatar,
.admin-avatar-fallback {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  object-fit: cover;
}

.admin-thumb-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 980px) {
  .admin-two-up {
    grid-template-columns: 1fr;
  }
}


/* === home-v5-client-filters === */
.home-v5-nav .filter-btn {
  appearance: none;
  border: 0;
  cursor: pointer;
}

.home-v5-nav .filter-btn.is-active {
  background: rgba(255, 255, 255, 0.10);
}

/* === home-v6 in-place homepage filters === */
.home-v6-nav button.home-v6-nav-link {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}





/* === STYLE PICKER REFACTOR === */
.style-picker-container {
  width: min(1400px, calc(100vw - 32px)) !important;
  height: 90vh !important;
  /* Definite height for reliable flex-scrolling */
  max-height: 90vh !important;
  margin: auto !important;
  display: flex !important;
  flex-direction: column;
  overflow: hidden !important;
  padding: 0 !important;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  background: linear-gradient(180deg, rgba(15, 26, 44, 0.98), rgba(7, 14, 25, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  z-index: 10;
}

.style-picker-header {
  padding: 20px 24px 14px;
  background: rgba(15, 26, 44, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}


.modal-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-top: 4px;
}

.btn-surprise {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 16px;
  border: 1px solid rgba(132, 200, 255, 0.35);
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.12), rgba(0, 102, 255, 0.12));
  color: #c4e4ff;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

.btn-surprise:hover {
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.22), rgba(0, 102, 255, 0.22));
  border-color: rgba(132, 200, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  color: #fff;
}

.btn-surprise:active {
  transform: translateY(0);
}

.btn-surprise .icon {
  font-size: 1.1rem;
}

.style-picker-header-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.style-picker-header-actions .style-picker-search {
  flex: 1;
  padding: 0;
  position: static;
  background: none;
}

@media (max-width: 600px) {
  .btn-surprise {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }
}

.style-picker-search {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 16px 0 12px;
  background: linear-gradient(180deg, rgba(7, 14, 25, 0.98) 80%, transparent);
}

.style-picker-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.style-picker-search-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.style-picker-search-input:focus {
  border-color: var(--accent, #00b4ff);
  box-shadow: 0 0 0 3px rgba(0, 180, 255, 0.15);
}



/* Modal close z-index overrides */
.style-lab-modal .modal-close {
  z-index: 110 !important;
}

.style-picker-container .modal-close {
  z-index: 110 !important;
}

.style-picker-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
  padding-right: 48px;
  /* Room for close button */
}

.style-picker-title-group {
  min-width: 0;
}

.style-picker-buckets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.style-bucket-btn {
  appearance: none;
  width: 100%;
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: #e5eefb;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 12px;
  text-align: center;
  transition: all 0.2s ease;
}

.style-bucket-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.style-bucket-btn.active,
.style-bucket-btn.is-active {
  border-color: rgba(123, 199, 255, 0.55);
  background: rgba(123, 199, 255, 0.16);
  box-shadow: 0 0 0 1px rgba(123, 199, 255, 0.18) inset;
}

/* === STYLE PICKER FAVORITES === */
.style-bucket-btn-favorites {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(255, 125, 151, 0.18), rgba(212, 167, 255, 0.18));
  border: 1px solid rgba(255, 125, 151, 0.45);
  color: #ffd1dc;
  box-shadow:
    0 0 0 1px rgba(255, 125, 151, 0.18) inset,
    0 8px 26px -10px rgba(255, 125, 151, 0.55);
  transform: translateY(-1px);
}

.style-bucket-btn-favorites::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  padding: 1px;
  background: linear-gradient(135deg, #ff7d97, #d4a7ff);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0.35;
  pointer-events: none;
}

.style-bucket-btn-favorites:hover {
  background: linear-gradient(135deg, rgba(255, 125, 151, 0.30), rgba(212, 167, 255, 0.30));
  color: #fff;
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(255, 125, 151, 0.30) inset,
    0 14px 36px -10px rgba(255, 125, 151, 0.70);
}

.style-bucket-btn-favorites.active,
.style-bucket-btn-favorites.is-active {
  background: linear-gradient(135deg, rgba(255, 125, 151, 0.38), rgba(212, 167, 255, 0.38));
  color: #fff;
  border-color: rgba(255, 209, 220, 0.85);
  box-shadow:
    0 0 0 1px rgba(255, 209, 220, 0.45) inset,
    0 0 0 4px rgba(255, 125, 151, 0.18),
    0 18px 50px -10px rgba(255, 125, 151, 0.75);
  transform: translateY(-2px);
}

.style-bucket-fav-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  filter: drop-shadow(0 0 6px rgba(255, 125, 151, 0.55));
  transition: transform 0.2s ease;
}

.style-bucket-btn-favorites:hover .style-bucket-fav-icon {
  transform: scale(1.15) rotate(-6deg);
}

.style-bucket-fav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.style-bucket-btn-favorites.active .style-bucket-fav-count,
.style-bucket-btn-favorites.is-active .style-bucket-fav-count {
  background: linear-gradient(135deg, #ff7d97, #d4a7ff);
  border-color: rgba(255, 255, 255, 0.5);
  color: #1a0008;
}

/* === STYLE CARD FAVORITE BUTTON === */
.style-fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 14, 26, 0.55);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.65);
}

.style-fav-btn:hover {
  transform: scale(1.08);
  border-color: rgba(255, 125, 151, 0.55);
  color: #ff9eb0;
  background: rgba(20, 8, 14, 0.7);
  box-shadow: 0 8px 22px -8px rgba(255, 125, 151, 0.6);
}

.style-fav-btn:focus-visible {
  outline: none;
  border-color: rgba(255, 125, 151, 0.85);
  box-shadow: 0 0 0 3px rgba(255, 125, 151, 0.30);
}

.style-fav-btn:disabled {
  opacity: 0.65;
  cursor: progress;
}

.style-fav-btn .lucide,
.style-fav-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  transition: fill 0.2s ease, transform 0.2s ease;
}

.style-fav-btn.is-fav {
  background: linear-gradient(135deg, #ff7d97, #d4a7ff);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
  box-shadow: 0 8px 22px -8px rgba(255, 125, 151, 0.75);
}

.style-fav-btn.is-fav .lucide,
.style-fav-btn.is-fav svg {
  fill: #fff;
  stroke: #fff;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.55));
  animation: styleFavPop 0.35s ease;
}

.style-fav-btn.is-fav:hover {
  filter: brightness(1.08);
  box-shadow: 0 10px 26px -8px rgba(255, 125, 151, 0.95);
}

@keyframes styleFavPop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* Filled card border treatment when favorited */
.style-picker-card.is-fav {
  border-color: rgba(255, 125, 151, 0.45);
  box-shadow:
    0 0 0 1px rgba(255, 125, 151, 0.18) inset,
    0 14px 36px -16px rgba(255, 125, 151, 0.45);
}

.style-picker-card.is-fav:hover {
  border-color: rgba(255, 125, 151, 0.7);
}

/* === STYLE PICKER FAVORITES EMPTY STATE === */
.style-picker-favorites-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  border-radius: 22px;
  border: 1px dashed rgba(255, 125, 151, 0.35);
  background: linear-gradient(135deg, rgba(255, 125, 151, 0.06), rgba(212, 167, 255, 0.06));
  color: var(--muted, #a5b1c2);
  margin: 12px 0;
  gap: 10px;
}

.style-picker-favorites-empty.hidden {
  display: none !important;
}

.style-picker-favorites-empty > svg,
.style-picker-favorites-empty > i {
  width: 44px;
  height: 44px;
  color: rgba(255, 125, 151, 0.85);
  fill: rgba(255, 125, 151, 0.85);
  stroke: rgba(255, 125, 151, 0.85);
  filter: drop-shadow(0 0 12px rgba(255, 125, 151, 0.4));
}

.style-picker-favorites-empty h3 {
  margin: 0;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}

.style-picker-favorites-empty p {
  margin: 0;
  max-width: 420px;
  line-height: 1.5;
}

.style-picker-favorites-empty .heart-inline {
  color: #ff7d97;
  font-size: 1.1em;
  text-shadow: 0 0 8px rgba(255, 125, 151, 0.55);
}

.style-picker-bucket-description {
  min-height: 54px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.style-picker-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto !important;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  /* Custom Scrollbar Styles */
  scrollbar-width: thin;
  scrollbar-color: rgba(132, 200, 255, 0.3) rgba(0, 0, 0, 0.1);
}

.style-picker-body::-webkit-scrollbar,
.generate-modal-card::-webkit-scrollbar,
.sequel-planner-body::-webkit-scrollbar {
  width: 8px;
}

.style-picker-body::-webkit-scrollbar-track,
.generate-modal-card::-webkit-scrollbar-track,
.sequel-planner-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

.style-picker-body::-webkit-scrollbar-thumb,
.generate-modal-card::-webkit-scrollbar-thumb,
.sequel-planner-body::-webkit-scrollbar-thumb {
  background: rgba(132, 200, 255, 0.25);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.style-picker-body::-webkit-scrollbar-thumb:hover,
.generate-modal-card::-webkit-scrollbar-thumb:hover,
.sequel-planner-body::-webkit-scrollbar-thumb:hover {
  background: rgba(132, 200, 255, 0.4);
  background-clip: padding-box;
}

.sequel-planner-card {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

.sequel-planner-card .modal-meta {
  padding: 24px 24px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0;
}

.sequel-planner-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
  background: rgba(15, 26, 44, 0.5);
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
}


.style-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 16px;
}

.style-picker-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 22px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.style-picker-card:hover {
  transform: translateY(-2px);
  border-color: rgba(132, 200, 255, 0.3);
}

.style-picker-card.hidden {
  display: none !important;
}

.style-picker-media {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  min-height: 250px;
  aspect-ratio: 2 / 3;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.style-picker-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.style-picker-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.style-picker-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.style-picker-copy strong {
  font-size: 1rem;
}

.style-picker-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.style-picker-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.style-picker-generate-row {
  display: flex;
  gap: 8px;
}

.style-picker-generate-row.hidden {
  display: none !important;
}

.style-picker-buckets-mobile {
  display: none;
}

.style-bucket-select {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}

.style-bucket-select option {
  background: #0d1a2d;
  color: #fff;
}

.style-bucket-select.is-favorites {
  border-color: rgba(255, 125, 151, 0.6);
  background: linear-gradient(135deg, rgba(255, 125, 151, 0.12), rgba(212, 167, 255, 0.12));
  box-shadow: 0 0 0 2px rgba(255, 125, 151, 0.25), 0 0 20px rgba(255, 125, 151, 0.15);
}


.style-picker-generate-row input {
  min-width: 0;
  flex: 1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.85rem;
}

@media (max-width: 980px) {
  .style-picker-container {
    width: calc(100vw - 16px) !important;
    height: 94dvh !important;
    max-height: 94dvh !important;
    margin: auto !important;
  }

  .style-picker-header {
    padding: 18px 18px 12px;
  }

  .style-picker-meta {
    flex-direction: column;
    gap: 12px;
    padding-right: 40px;
  }

  .style-picker-buckets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .style-picker-body {
    padding: 16px;
  }

  .style-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 600px) {
  .style-picker-container {
    width: calc(100vw - 8px) !important;
    height: 98dvh !important;
    max-height: 98dvh !important;
    border-radius: 20px;
  }

  .style-picker-header {
    padding: 12px 14px 6px;
  }

  .modal-title {
    font-size: 1.1rem !important;
  }


  .modal-subtitle {
    font-size: 0.82rem !important;
    line-height: 1.3;
    margin-top: 2px;
  }

  .style-picker-meta {
    gap: 8px;
    padding-right: 36px;
  }

  .style-picker-buckets-grid {
    display: none !important;
  }

  .style-picker-buckets-mobile {

    display: block !important;
    margin-bottom: 8px;
  }

  .style-bucket-select {
    min-height: 44px;
    font-size: 0.88rem;
    padding: 0 12px;
    border-radius: 10px;
  }

  .style-picker-header-actions {
    margin-top: 8px;
  }

  .btn-surprise {
    width: 100%;
    justify-content: center;
    padding: 10px;
    font-size: 0.78rem;
    border-radius: 12px;
  }

  .style-picker-search {
    padding: 0 0 8px;
  }

  .style-picker-body {
    padding: 10px;
  }

  .style-picker-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-bottom: 50px;
  }

  .style-picker-card {
    flex-direction: row;
    padding: 8px;
    border-radius: 14px;
    gap: 10px;
    align-items: stretch;
  }

  .style-picker-media {
    min-height: 0;
    aspect-ratio: 1 / 1;
    width: 100px;
    flex-shrink: 0;
    border-radius: 10px;
  }

  .style-picker-copy {
    flex: 1;
    min-width: 0;
    gap: 4px;
  }

  .style-picker-copy strong {
    font-size: 0.88rem;
  }

  .style-picker-copy p {
    font-size: 0.75rem;
    -webkit-line-clamp: 2;
    line-height: 1.3;
  }

  .style-picker-copy .pill-soft {
    font-size: 0.6rem;
    padding: 1px 5px;
  }

  .style-picker-actions {
    gap: 6px;
  }

  .style-picker-actions .btn {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  .pill-soft {
    font-size: 0.65rem;
    padding: 2px 6px;
  }
}




/* WHHW_FULL_COMIC_VIEWER_QUALITY_V1 */
.comic-page-3d img {
  image-rendering: auto !important;
  image-rendering: high-quality !important;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.reader-flat-stage {
  display: none;
  grid-template-columns: 1fr;
  gap: 18px;
  width: min(1120px, 92vw);
  margin: 0 auto;
  padding: 26px 0 90px;
}

.reader-flat-page {
  display: grid;
  gap: 10px;
}

.reader-flat-label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(219, 231, 247, 0.76);
  padding-inline: 6px;
}

.reader-flat-frame {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.reader-flat-frame img {
  display: block;
  width: 100%;
  height: auto;
  background: #08101b;
}

.comic-reader-modal.reader-flat-mode .comic-reader-3d-stage,

.comic-reader-modal.reader-flat-mode .reader-flat-stage {
  display: grid !important;
}

.comic-reader-modal.reader-flat-mode #comic-reader-track {
  display: block;
}

.comic-reader-modal.reader-flat-mode .modal-card-reader {
  overflow-y: auto;
}

.comic-reader-modal.reader-flat-mode .reader-close-pill {
  position: fixed !important;
  top: 18px !important;
  right: 18px !important;
  z-index: 9999 !important;
}

@media (max-width: 900px) {
  .reader-flat-stage {
    width: min(100%, 96vw);
    padding-bottom: 72px;
  }
}


/* sequel-series-patch */
#series-modal-books.book-grid {
  margin-top: 6px;
}

/* series-stack-v2 */
.series-stack {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
}

.series-stack-item {
  position: absolute;
  width: 65%;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  background: #0a111e;
  transition: all 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  transform-origin: bottom center;
}

.series-stack-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Natural Stack Positions */
.series-stack-item-1 {
  transform: translateY(-24px) scale(0.88);
  z-index: 1;
  opacity: 0.5;
}

.series-stack-item-2 {
  transform: translateY(-12px) scale(0.94);
  z-index: 2;
  opacity: 0.75;
}

.series-stack-item-3 {
  transform: translateY(0) scale(1.0);
  z-index: 3;
}

/* Hover Expansion */
.home-v6-card-shell:hover .series-stack-item-1 {
  transform: translateY(-50px) translateX(-45px) rotate(-8deg) scale(0.9);
  opacity: 0.8;
}

.home-v6-card-shell:hover .series-stack-item-2 {
  transform: translateY(-30px) translateX(-15px) rotate(-3deg) scale(0.95);
  opacity: 0.9;
}

.home-v6-card-shell:hover .series-stack-item-3 {
  transform: translateY(10px) translateX(25px) rotate(5deg) scale(1.02);
}

/* Status Badges */
.pill-status {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-width: 1px;
  border-style: solid;
}

.pill-ongoing {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
}

.pill-hiatus {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fcd34d;
}

.pill-finalized {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
}

@keyframes pillActivePulseBlue {
  0% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(56, 189, 248, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
  }
}

@keyframes pillActivePulsePurple {
  0% {
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.4);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(167, 139, 250, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(167, 139, 250, 0);
  }
}

.pill-status[data-status="queued"],
.pill-status[data-status="planning"],
.pill-status[data-status="identity_discovery"],
.pill-status[data-status="identity_preview"],
.pill-status[data-status="rendering"] {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
  animation: pillActivePulseBlue 2s infinite;
}

.pill-status[data-status="rendering_cover"] {
  background: rgba(167, 139, 250, 0.15);
  border-color: rgba(167, 139, 250, 0.5);
  color: #c4b5fd;
  animation: pillActivePulsePurple 2s infinite;
}

.pill-status[data-status="complete"] {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.3);
  color: #6ee7b7;
}

.pill-status[data-status="failed"] {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fca5a5;
}

/* Series Book Numbering & Reordering */
.book-card-shell {
  position: relative;
}

.book-sequence-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  pointer-events: none;
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.reorder-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.reorder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.reorder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: grab;
  transition: all 0.2s ease;
}

.reorder-item:active {
  cursor: grabbing;
}

.reorder-item.sortable-ghost {
  opacity: 0.4;
  background: rgba(255, 255, 255, 0.1);
  border-style: dashed;
}

.reorder-handle {
  color: rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.reorder-item-thumb {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
}

.reorder-item-title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.reorder-item-index {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

@media (max-width: 760px) {
  .series-stack-item {
    width: 55%;
  }

  .home-v6-card-shell:hover .series-stack-item {
    transform: none !important;
    opacity: initial !important;
  }

  /* On mobile, keep the stack static but pretty */
  .series-stack-item-1 {
    transform: translateY(-16px) scale(0.9);
    opacity: 0.6;
  }

  .series-stack-item-2 {
    transform: translateY(-8px) scale(0.95);
    opacity: 0.8;
  }

  .series-stack-item-3 {
    transform: translateY(0) scale(1.0);
  }
}

/* auto-open-reader-sequel-tab */
.open-sequel-tab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 1200;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, rgba(29, 43, 77, 0.96), rgba(16, 24, 45, 0.96));
  color: #f5f8ff;
  border-radius: 999px;
  min-height: 46px;
  padding: 0 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.open-sequel-tab:hover {
  transform: translateY(-2px);
}

.open-sequel-tab.hidden {
  display: none;
}

@media (max-width: 900px) {
  .open-sequel-tab {
    right: 12px;
    bottom: 14px;
    min-height: 42px;
    padding: 0 14px;
    font-size: 0.92rem;
  }
}

/* sequel-ref-cards */
#sequel-ref-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.sequel-ref-card-list-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.sequel-ref-card-list-slot {
  min-height: 104px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.025));
  display: flex;
  align-items: center;
  justify-content: center;
}

.sequel-ref-card-list-slot button {
  width: 100%;
  height: 104px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 2rem;
  font-weight: 800;
  cursor: pointer;
}

.sequel-ref-card {
  display: flex;
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.sequel-ref-card-thumb {
  position: relative;
  width: 110px;
  min-height: 110px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.sequel-ref-card-thumb img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.sequel-ref-card .sequel-ref-card-remove {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 15, 30, 0.72);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.sequel-ref-card-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}

.sequel-ref-card-fields label:last-child {
  grid-column: 1 / -1;
}

@media (max-width: 980px) {
  .sequel-ref-card-list-slots {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .sequel-ref-card-list-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sequel-ref-card {
    flex-direction: column;
  }

  .sequel-ref-card-thumb {
    width: 100%;
    min-height: auto;
    aspect-ratio: 16 / 9;
  }

  .sequel-ref-card-thumb img {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .sequel-ref-card-fields {
    grid-template-columns: 1fr;
  }

  .sequel-ref-card-fields label:last-child {
    grid-column: auto;
  }
}

/* === Create Button 'Pop' Overhaul === */
.btn-create-pop {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #00b4ff 0%, #7b61ff 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 99px;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 32px rgba(123, 97, 255, 0.25);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  position: relative;
  overflow: hidden;
}

.btn-create-pop::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.2),
      transparent);
  transition: 0.5s;
}

.btn-create-pop:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 48px rgba(123, 97, 255, 0.4);
  filter: brightness(1.1);
}

.btn-create-pop:hover::before {
  left: 100%;
}

.btn-create-pop:active {
  transform: translateY(-1px) scale(0.98);
}

.btn-create-pop .create-icon {
  width: 20px;
  height: 20px;
  stroke-width: 3px;
}

@keyframes create-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(123, 97, 255, 0.4);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(123, 97, 255, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(123, 97, 255, 0);
  }
}

.btn-create-pop {
  animation: create-pulse 2.5s infinite;
}

@media (max-width: 600px) {
  .header-group {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 16px;
  }

  .header-actions-right {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }

  .btn-create-pop {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 1rem;
    border-radius: 16px;
  }

  .btn-create-pop .create-label {
    display: inline;
  }

  .btn-create-pop .create-icon {
    margin: 0;
  }
}

/* === iteration-v2 premium book details layout === */
.iteration-v2 {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 32px;
  margin-bottom: 40px;
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
}

.iteration-v2:hover {
  border-color: rgba(132, 200, 255, 0.3);
}

.iteration-hero-row {
  display: flex;
  gap: 40px;
  margin-bottom: 32px;
}

.iteration-visual-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 0 0 240px;
}

.iteration-hero-cover-wrap {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  background: #000;
}

.iteration-hero-btn {
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: #000;
  cursor: pointer;
}

.iteration-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.iteration-hero-btn:hover .iteration-hero-img {
  transform: scale(1.05);
}

.iteration-hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #fff;
}

.iteration-hero-btn:hover .iteration-hero-overlay {
  opacity: 1;
}

.iteration-continuity-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.iteration-continuity-pill {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.iteration-continuity-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.iteration-info-column {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  flex: 1;
}

.iteration-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.iteration-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.iteration-title {
  font-size: 2rem;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  letter-spacing: -0.01em;
}

.iteration-style-tag {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  background: rgba(132, 200, 255, 0.1);
  color: #84c8ff;
  border-radius: 6px;
  letter-spacing: 0.1em;
}

.iteration-date {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
  white-space: nowrap;
}

.iteration-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.iteration-actions-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.iteration-secondary-actions {
  display: flex;
  gap: 8px;
}

.iteration-secondary-actions form {
  display: contents;
}

.btn-micro {
  height: 32px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
}

.btn-micro:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-micro.btn-danger:hover {
  background: rgba(244, 67, 54, 0.15);
  color: #ef5350;
  border-color: rgba(244, 67, 54, 0.3);
}

.pill-featured {
  cursor: pointer;
  transition: all 0.2s;
}

.pill-featured:hover {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}

.pill-featured-active {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
  border-color: rgba(255, 193, 7, 0.3);
}

.pill-featured-active:hover {
  background: rgba(255, 193, 7, 0.25);
  color: #ffd54f;
}

.btn-featured-active {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
  border-color: rgba(255, 193, 7, 0.3);
}

.btn-featured-active:hover {
  background: rgba(255, 193, 7, 0.25);
  color: #ffd54f;
}

.iteration-progress-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.04), rgba(120, 80, 255, 0.03));
  border-radius: 14px;
  border: 1px solid rgba(132, 200, 255, 0.1);
  position: relative;
}

.iteration-progress-container::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(132, 200, 255, 0.45), transparent 60%);
  opacity: 0.08;
  z-index: -1;
  filter: blur(8px);
}

.iteration-progress-text {
  font-size: 0.85rem;
  font-weight: 800;
  color: #84c8ff;
  letter-spacing: 0.02em;
}

.iteration-progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: visible;
  position: relative;
}

.iteration-progress-fill {
  height: 100%;
  background: #84c8ff;
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow:
    0 0 4px rgba(132, 200, 255, 0.45),
    0 0 10px rgba(132, 200, 255, 0.45),
    0 0 20px rgba(132, 200, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.iteration-progress-fill.is-indeterminate {
  background-image: linear-gradient(45deg,
      rgba(255, 255, 255, 0.2) 25%,
      transparent 25%,
      transparent 50%,
      rgba(255, 255, 255, 0.2) 50%,
      rgba(255, 255, 255, 0.2) 75%,
      transparent 75%,
      transparent);
  background-size: 1rem 1rem;
  animation: progress-stripes 0.8s linear infinite;
}

.iteration-progress-fill.is-processing {
  overflow: hidden;
  animation: progress-pulse 2s ease-in-out infinite;
}

.iteration-progress-fill.is-processing::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(105deg,
      transparent 0%,
      transparent 35%,
      rgba(255, 255, 255, 0.45) 50%,
      transparent 65%,
      transparent 100%);
  animation: progress-shimmer 1.4s ease-in-out infinite;
}

.iteration-progress-fill.is-processing::after {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  bottom: -4px;
  border-radius: 7px;
  background: #84c8ff;
  filter: blur(6px);
  opacity: 0.25;
  z-index: -1;
  animation: progress-glow-breathe 2s ease-in-out infinite;
}

@keyframes progress-shimmer {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(220%); }
}

@keyframes progress-pulse {
  0%, 100% {
    box-shadow:
      0 0 4px rgba(132, 200, 255, 0.45),
      0 0 10px rgba(132, 200, 255, 0.45),
      0 0 20px rgba(132, 200, 255, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }
  50% {
    box-shadow:
      0 0 6px rgba(132, 200, 255, 0.75),
      0 0 16px rgba(132, 200, 255, 0.45),
      0 0 30px rgba(132, 200, 255, 0.45),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
}

@keyframes progress-glow-breathe {
  0%, 100% { opacity: 0.15; transform: scaleX(0.97); }
  50% { opacity: 0.3; transform: scaleX(1.01); }
}

@keyframes progress-stripes {
  from { background-position: 1rem 0; }
  to { background-position: 0 0; }
}

.iteration-pages-strip-wrap {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 900px) {
  .iteration-hero-row {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .iteration-visual-column {
    max-width: 240px;
    margin: 0 auto;
  }

  .iteration-title {
    font-size: 1.6rem;
  }

  .iteration-v2 {
    padding: 24px;
  }

  .iteration-actions-row {
    flex-direction: column;
    align-items: stretch;
  }

  .iteration-secondary-actions {
    flex-direction: column;
  }

  .iteration-secondary-actions .btn-micro,
  .iteration-secondary-actions a.btn-micro {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   PWA NAVIGATION ARCHITECTURE (App-First)
   ========================================================================== */

:root {
  --nav-height: 72px;
  --bottom-nav-height: 64px;
}

/* Site-wide Shell Padding for Nav */
.site-shell {
  padding-top: var(--nav-height);
  padding-bottom: 0;
  /* Default */
}

@media (max-width: 768px) {
  .site-shell {
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }
}

/* 1. Master Top Header (Consolidated) */
.pwa-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  background: rgba(6, 16, 29, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  padding-top: env(safe-area-inset-top);
  transition: transform 0.3s ease, background 0.3s ease;
}

/* Collapsing State for Header on Scroll */
.pwa-header.is-collapsed {
  transform: translateY(calc(var(--nav-height) * -1));
}

.pwa-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06111c;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 0.9rem;
}

.pwa-brand-copy {
  display: flex;
  flex-direction: column;
}

.pwa-brand-copy strong {
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  /* Limit width to protect buttons */
}

@media (max-width: 480px) {
  .pwa-brand-copy {
    display: none;
  }
}


/* 2. Desktop Navigation */
.pwa-desktop-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

@media (max-width: 768px) {
  .pwa-desktop-nav {
    display: none;
  }
}

.pwa-nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}

.pwa-nav-link:hover,
.pwa-nav-link.active {
  color: var(--text);
}

/* 3. Mobile Bottom Navigation Bar */
.pwa-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 1000;
  background: rgba(11, 23, 38, 0.95);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--line);
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 768px) {
  .pwa-bottom-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
}

.pwa-bottom-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 25%;
  height: 100%;
}

.pwa-bottom-link .lucide {
  --icon-size: 20px;
  --icon-stroke: 2.5px;
}

.pwa-bottom-link.active {
  color: var(--accent);
  position: relative;
}

.pwa-bottom-link.active::after {
  content: '';
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
}

/* 4. User Profile Trigger */
.pwa-user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.2s;
}

.user-avatar:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}

/* 5. Segmented Control (Filter Tabs) */
.pwa-segmented-control {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  position: relative;
}

.pwa-segment-btn {
  position: relative;
  z-index: 2;
  min-height: 36px;
  padding: 0 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.3s;
}

.pwa-segment-btn.active {
  color: var(--bg);
}

.pwa-segment-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  bottom: 4px;
  background: var(--accent);
  border-radius: 999px;
  z-index: 1;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
}

/* Contextual Header (Library Specific) */
.library-context-header {
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

/* User Profile Header Component */
.pwa-user-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-group {
  display: flex;
  align-items: center;
  gap: 16px;
  /* Increased from 10px for better separation */
}

@media (max-width: 480px) {
  .auth-group {
    gap: 10px;
    /* Slightly tighter on mobile but better than before */
  }

  .auth-group .btn-small {
    padding: 0 14px;
    font-size: 0.85rem;
  }
}


.user-avatar-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-btn:hover {
  transform: scale(1.05);
}

.user-avatar-btn.active .user-avatar {
  box-shadow: 0 0 0 2px var(--info);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00b4ff 0%, #0077ff 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.user-avatar--with-image {
  overflow: hidden;
  background: none;
}

.user-avatar--with-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* User Menu Dropdown */
.user-menu-wrapper {
  position: relative;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 240px;
  background: rgba(20, 20, 22, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
  animation: menuAppear 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-menu-dropdown[hidden] {
  display: none;
}

@keyframes menuAppear {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-menu-header {
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.user-menu-header strong {
  font-size: 0.95rem;
  color: #fff;
  display: block;
}

.user-menu-header span {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.user-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.user-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  background: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.user-menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.user-menu-item .lucide {
  --icon-size: 18px;
  --icon-stroke: 2px;
  color: var(--accent);
}

.logout-item {
  color: #ff4d4d;
}

.logout-item .lucide {
  color: #ff4d4d;
}

.user-menu-version {
  padding: 8px 16px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
}

@media (max-width: 768px) {
  .pwa-mobile-only {
    display: flex;
  }
}

/* Responsive Utilities */
.desktop-only {
  display: flex !important;
}

.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }
}

/* Admin Layout — Header with hamburger drawer */
.admin-layout .pwa-header {
  left: 0;
}

.admin-layout .pwa-bottom-bar {
  display: none !important;
}

.admin-layout .admin-page-content {
  /* site-shell already provides padding-top: var(--nav-height) */
}

/* Generator Refactor */
.generator-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.generator-title h2 {
  margin: 4px 0 0;
  font-size: 1.8rem;
  letter-spacing: -0.04em;
}

.continuity-lock-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px;
  background: rgba(132, 200, 255, 0.08);
  border: 1px solid rgba(132, 200, 255, 0.2);
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.continuity-lock-preview:hover {
  background: rgba(132, 200, 255, 0.12);
  border-color: rgba(132, 200, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.continuity-thumbnail {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.continuity-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.continuity-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(6, 16, 29, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 0;
  font-size: 0.6rem;
  font-weight: 900;
  color: var(--accent);
  text-transform: uppercase;
}

.continuity-info {
  display: flex;
  flex-direction: column;
}

.continuity-info small {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.continuity-info strong {
  font-size: 0.82rem;
  color: #fff;
}

@charset "UTF-8";

/* Homepage v6.1 Art Ribbon Overhaul */

.art-ribbon-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
}

.art-ribbon-container {
  position: absolute;
  top: calc(22% + 10px);
  left: 0;
  width: 100%;
  height: 260px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
  mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
  opacity: 0.55;
  z-index: 1;
}

.art-ribbon-track {
  display: flex;
  width: max-content;
  animation: ribbonScroll 45s linear infinite;
  will-change: transform;
}

.art-ribbon-item {
  flex: 0 0 340px;
  height: 260px;
  margin-right: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 12px solid #fff;
  box-shadow: 18px 18px 0px rgba(0, 0, 0, 0.3);
  transform: rotate(-1.5deg);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1;
  /* Organic border base */
  border-radius: 4% 95% 6% 95% / 95% 4% 92% 5%;
}

/* Variant 1: Slightly skewed right top */
.art-ribbon-item:nth-child(5n+1) {
  border-radius: 4% 96% 6% 94% / 94% 5% 95% 6%;
}

/* Variant 2: Slightly skewed left bottom */
.art-ribbon-item:nth-child(5n+2) {
  border-radius: 96% 4% 94% 6% / 5% 94% 6% 95%;
  transform: rotate(1.4deg) translateY(15px);
}

/* Variant 3: Almost rectangular but wobbly */
.art-ribbon-item:nth-child(5n+3) {
  border-radius: 2% 98% 3% 97% / 97% 4% 94% 3%;
  transform: rotate(-0.8deg) translateY(-5px);
}

/* Variant 4: Sharp tapered effect */
.art-ribbon-item:nth-child(5n+4) {
  border-radius: 98% 2% 97% 3% / 2% 97% 3% 98%;
  transform: rotate(2deg) translateY(10px);
}

/* Variant 5: "Bubble" panel style */
.art-ribbon-item:nth-child(5n+5) {
  border-radius: 6% 94% 8% 92% / 93% 7% 91% 9%;
  transform: rotate(-2deg) translateY(5px);
}

.art-ribbon-item:hover {
  transform: scale(1.08) rotate(0deg) translateY(-12px) !important;
  z-index: 10;
  border-color: var(--accent);
  box-shadow: 25px 25px 50px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  /* Snap to regular on hover for focus */
}

.art-ribbon-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.95;
  transition: transform 0.3s ease;
}

@keyframes ribbonScroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

/* Glass Hero Enhancements */
.home-v6-shell {
  position: relative;
  z-index: 2;
  background: transparent !important;
}

.home-v6-hero.glass-overhaul {
  background: rgba(13, 26, 44, 0.28) !important;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 40px;
  padding: 60px 40px;
  margin: 40px auto;
  text-align: center;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5);
}

.home-v6-hero-copy {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.home-v6-hero-copy h1 {
  font-size: clamp(2.5rem, 6vw, 5.2rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 0.9;
  margin: 20px 0;
  background: linear-gradient(180deg, #fff 0%, #a5b1c2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-v6-hero-copy .lede {
  font-size: 1.25rem;
  margin: 0 auto;
  max-width: 60ch;
}

/* PWA Header Overrides for Home */
.pwa-header.glass-home {
  background: rgba(6, 16, 29, 0.6) !important;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

/* Character Roster Styles */
.character-roster-section {
  margin-bottom: 24px;
}

.character-roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.character-portrait-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.character-portrait-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  border-color: rgba(132, 200, 255, 0.3);
}

.character-portrait-image {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  display: block;
  background: #1a1a1a;
}

.character-portrait-card.is-deceased {
  filter: grayscale(1) opacity(0.7);
}

.character-card-flags {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.character-status-pill {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.character-status-pill[data-status="deceased"] {
  background: rgba(220, 38, 38, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

.character-status-pill[data-status="alive"] {
  background: rgba(5, 150, 105, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

.character-portrait-info {
  padding: 12px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.9));
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.character-portrait-name {
  display: block;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
}

.character-meta-lower {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.character-portrait-handle {
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.character-dna-tag {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 4px;
}

.character-wardrobe-preview {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-bible-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(132, 200, 255, 0.1);
  border: 1px solid rgba(132, 200, 255, 0.2);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* Generator Mini-Roster Styles */
.continuity-lock-mini-roster {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 10px 10px 20px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: fit-content;
  margin-bottom: 24px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.continuity-lock-mini-roster:hover {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(132, 200, 255, 0.3);
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.2),
    0 10px 10px -5px rgba(0, 0, 0, 0.1),
    0 0 0 3px rgba(132, 200, 255, 0.1);
  transform: translateY(-2px);
}

.continuity-lock-mini-roster:active {
  transform: translateY(0) scale(0.97);
  background: rgba(15, 23, 42, 0.8);
}

.continuity-lock-mini-roster .continuity-info {
  display: flex;
  flex-direction: column;
  padding-right: 12px;
}

.continuity-view-bible {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #84c8ff;
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: -0.01em;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.continuity-lock-mini-roster:hover .continuity-view-bible {
  opacity: 1;
}

.continuity-view-bible i {
  width: 14px;
  height: 14px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.continuity-lock-mini-roster:hover .continuity-view-bible i {
  transform: translateX(4px);
}

.mini-roster-grid {
  display: flex;
  align-items: center;
  margin-right: 8px;
}

@keyframes rosterFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.8);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.mini-roster-item {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #0f172a;
  margin-left: -16px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: #1e293b;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  animation: rosterFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.mini-roster-item:nth-child(1) {
  animation-delay: 0.1s;
}

.mini-roster-item:nth-child(2) {
  animation-delay: 0.2s;
}

.mini-roster-item:nth-child(3) {
  animation-delay: 0.3s;
}

.mini-roster-item:nth-child(4) {
  animation-delay: 0.4s;
}

.mini-roster-item:nth-child(5) {
  animation-delay: 0.5s;
}

.mini-roster-item:first-child {
  margin-left: 0;
}

.mini-roster-item:hover {
  transform: scale(1.2) translateY(-4px);
  z-index: 30 !important;
  border-color: #84c8ff;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.mini-roster-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-roster-more {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: -16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  z-index: 5;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  animation: rosterFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.6s;
}

.continuity-lock-mini-roster:hover .mini-roster-more {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.continuity-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.continuity-badge-mini {
  font-size: 0.62rem;
  font-weight: 900;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.continuity-lock-mini-roster:hover .continuity-badge-mini {
  background: rgba(132, 200, 255, 0.2);
  color: #84c8ff;
  border-color: rgba(132, 200, 255, 0.2);
}

.continuity-lock-mini-roster .continuity-info strong {
  font-size: 0.85rem;
  color: var(--text);
}

.portrait-mini-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.page-item-container {
  position: relative;
  transition: transform 0.2s ease;
}

.page-item-container:hover {
  transform: translateY(-4px);
}

.hero-actions-group {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.panel-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.panel-actions-stack.hero-level {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.hero-action-pill {
  width: auto;
  min-width: 44px;
  height: 44px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  border: 3px solid #0f172a;
  color: #fff;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  padding: 0 16px;
  gap: 8px;
}

.hero-action-pill.secondary {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

.hero-action-pill:hover {
  transform: scale(1.2) translateY(-4px);
  border-color: #84c8ff;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  color: #84c8ff;
}

.hero-action-pill.accent {
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 15px -3px rgba(79, 70, 229, 0.4);
  animation: pill-pulse 2s infinite;
}

.hero-action-pill.accent:hover {
  border-color: #fff;
  box-shadow: 0 15px 25px -5px rgba(79, 70, 229, 0.6);
  color: #fff;
}

@keyframes pill-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
  }

  70% {
    box-shadow: 0 0 0 12px rgba(139, 92, 246, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
  }
}

.hero-action-pill i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.hero-action-pill span {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.action-label-group {
  margin-left: 8px;
  opacity: 0.6;
}

.panel-heading h2 {
  margin-bottom: 0;
}

.panel-heading-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 20px;
}

.generate-modal-card {
  width: min(800px, 94vw);
  margin: 6vh auto;
  padding: 32px;
  max-height: 88vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(132, 200, 255, 0.25) transparent;
  --style-bg-image: none;
}

.generate-modal-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--style-bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  transition: opacity 0.45s ease;
}

.generate-modal-card.style-bg-loaded::before {
  opacity: 0.1;
}

.generate-modal-card > *:not(.modal-close) {
  position: relative;
  z-index: 1;
}

.generate-modal-card input,
.generate-modal-card textarea,
.generate-modal-card select,
.generate-modal-card md-outlined-select,
.generate-modal-card .btn-secondary,
.generate-modal-card .style-picker-trigger {
  background: #000;
  border-color: rgba(255, 255, 255, 0.15);
}

.generate-modal-card md-outlined-select {
  --md-outlined-select-text-field-container-color: #000;
  --md-outlined-select-text-field-focus-label-text-color: #fff;
  --md-outlined-select-text-field-hover-label-text-color: #fff;
  --md-outlined-select-text-field-container-shape: 18px;
  --md-sys-color-surface-container: #000;
  --md-sys-color-surface-container-high: #000;
  --md-sys-color-surface-container-highest: #000;
  --md-outlined-select-menu-container-color: #000;
  --md-menu-container-color: #000;
  --md-menu-item-container-color: #000;
  --md-menu-item-hover-state-layer-color: rgba(255, 255, 255, 0.08);
  --md-menu-item-focus-state-layer-color: rgba(255, 255, 255, 0.08);
  --md-menu-item-selected-container-color: #000;
  background: #000;
  border-radius: 18px;
  color: #fff;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.danger-zone-mini {
  margin-top: 40px;
  padding: 24px;
  background: rgba(220, 38, 38, 0.05);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 16px;
}

.danger-zone-head {
  margin-bottom: 16px;
}

.danger-zone-head .eyebrow {
  color: #ef4444;
}

/* Series Continuity Roster */
.continuity-lock-mini-roster {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(132, 200, 255, 0.05);
  border: 1px solid rgba(132, 200, 255, 0.15);
  border-radius: 24px;
  width: fit-content;
  backdrop-filter: blur(10px);
  margin-top: 24px;
}

.mini-roster-grid {
  display: flex;
  align-items: center;
}

.mini-roster-item {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--bg-3);
  overflow: hidden;
  margin-right: -12px;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
}

.mini-roster-item:hover {
  transform: translateY(-4px) scale(1.1);
  z-index: 20 !important;
  border-color: var(--accent);
}

.mini-roster-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait-mini-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--muted);
}

.mini-roster-more {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  margin-left: 14px;
  color: var(--muted);
}

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

.continuity-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.continuity-badge-mini {
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(132, 200, 255, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
}

.continuity-badge-row small {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
}

.continuity-info strong {
  font-size: 0.9rem;
  color: #fff;
  letter-spacing: -0.01em;
}


/* Continuity Gate: Identity Checkpoint Styles */
.status-box-warning {
  background: rgba(255, 184, 108, 0.1) !important;
  border: 1px solid var(--warning) !important;
  color: var(--warning) !important;
}

.identity-review-checkpoint {
  margin: 12px 0;
  padding: 24px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 184, 108, 0.08), rgba(212, 167, 255, 0.08));
  border: 1px solid var(--warning);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideInDown 0.4s ease-out;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.identity-review-copy p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.identity-review-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


.review-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--accent);
}

.review-banner-text {
  display: flex;
  flex-direction: column;
}

.review-banner-text strong {
  font-size: 16px;
  color: var(--text);
}

.review-banner-text span {
  font-size: 13px;
  color: var(--muted);
}

.continuity-review-banner .btn-primary {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .continuity-review-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* 'NEW' character badges */
.character-new-badge {
  background: var(--warning);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.character-new-indicator {
  background: rgba(255, 184, 108, 0.15);
  color: var(--warning);
  border: 1px solid var(--warning);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Mini Roster NEW tag */
.mini-roster-new-tag {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--warning);
  color: #000;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  z-index: 20;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Entrance Animations */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  to {
    opacity: 1;
  }
}

.anim-fade-up {
  animation: fade-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.anim-fade-in {
  animation: fade-in 0.4s ease forwards;
}

.continuity-badge-none {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* PWA Centering & Mobile Layout Overflow Fixes */
.header-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.library-title-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

@media (max-width: 480px) {
  .library-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .library-context-header {
    justify-content: center;
    width: 100%;
    padding: 16px 0;
  }
}

/* ========================================
   Notification Center
   ======================================== */

.notification-wrapper {
  position: relative;
}

.notification-trigger {
  position: relative;
  background: none;
  border: none;
  color: #888;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
}

.notification-trigger:hover,
.notification-trigger.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.notification-trigger svg {
  width: 20px;
  height: 20px;
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border-radius: 999px;
  pointer-events: none;
}

.notification-badge--mobile {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  font-size: 0.55rem;
  line-height: 14px;
}

.pwa-bottom-icon-wrap {
  position: relative;
  display: inline-flex;
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: rgba(20, 20, 22, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
  animation: menuAppear 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-dropdown[hidden] {
  display: none;
}

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.notification-dropdown-header strong {
  color: #e2e8f0;
  font-size: 0.9rem;
}

.notification-mark-all {
  background: none;
  border: none;
  color: #60a5fa;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.notification-mark-all:hover {
  background: rgba(96, 165, 250, 0.1);
}

.notification-list {
  max-height: 360px;
  overflow-y: auto;
}

.notification-empty {
  padding: 32px 16px;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.notification-dropdown .notification-item-wrapper:last-child .notification-item {
  border-bottom: none;
}

.notification-dropdown .notification-item-wrapper .notification-item-actions {
  padding-bottom: 8px;
}

.notification-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.notification-item--unread {
  background: rgba(96, 165, 250, 0.06);
}

.notification-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  color: #94a3b8;
}

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

.notification-item-body {
  flex: 1;
  min-width: 0;
}

.notification-item-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-item-message {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.notification-item-time {
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 4px;
}

.notification-view-all {
  display: block;
  text-align: center;
  padding: 12px;
  font-size: 0.8rem;
  color: #60a5fa;
  text-decoration: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.15s;
}

.notification-view-all:hover {
  background: rgba(96, 165, 250, 0.08);
}

/* Notifications Page */
.notifications-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

.notifications-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.notifications-page-header h1 {
  font-size: 1.5rem;
  color: #e2e8f0;
  margin: 0;
}

.notifications-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.notification-filter-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.notification-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.notification-filter-btn.active {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.3);
  color: #60a5fa;
}

.notifications-list-page .notification-item {
  border-radius: 12px;
  margin-bottom: 4px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.notifications-empty-state {
  text-align: center;
  padding: 64px 16px;
  color: #64748b;
}

.notifications-empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.notifications-empty-state p {
  font-size: 0.95rem;
  margin: 0;
}

/* Notification action buttons for friend requests */
.notification-item-wrapper {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.notification-item-wrapper .notification-item {
  border-bottom: none;
}

.notification-item-actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px 60px;
}

.btn-tiny {
  padding: 4px 12px;
  font-size: 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-weight: 500;
  transition: opacity 0.15s;
}

.btn-tiny:hover {
  opacity: 0.85;
}

.notification-item-action-result {
  font-size: 0.7rem;
  color: #64748b;
  font-style: italic;
}

.notifications-list-page .notification-item-wrapper {
  border-radius: 12px;
  margin-bottom: 4px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.notifications-list-page .notification-item-wrapper .notification-item {
  border-radius: 12px 12px 0 0;
}

.notifications-list-page .notification-item-wrapper .notification-item-actions {
  padding-left: 60px;
  padding-bottom: 12px;
}

/* Admin broadcast notification styling */
.notif-type-admin_broadcast {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(59, 130, 246, 0.06));
  border: 1px solid rgba(124, 58, 237, 0.15) !important;
}

.notif-type-admin_broadcast .notification-item-icon {
  background: rgba(124, 58, 237, 0.2);
  color: #a78bfa;
}

.notif-type-admin_broadcast .notification-item-title {
  color: #c4b5fd;
  font-weight: 600;
}

.notifications-list-page .notif-type-admin_broadcast {
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(59, 130, 246, 0.06));
  border: 1px solid rgba(124, 58, 237, 0.15) !important;
}

.notifications-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.notifications-pagination a,
.notifications-pagination span {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  text-decoration: none;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.15s;
}

.notifications-pagination a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.notifications-pagination .active {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.3);
  color: #60a5fa;
}

@media (max-width: 480px) {
  .notification-dropdown {
    position: fixed;
    top: auto;
    bottom: 60px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 60vh;
    border-radius: 16px;
  }

  .notifications-page {
    padding: 16px 12px;
  }
}

/* Friend request status badges */
.notif-status-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 500;
  vertical-align: middle;
}

.notif-status-pending {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.notif-status-accepted {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.notif-status-declined {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

/* ── Relationship Graph ── */
.relationship-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.relationship-graph-container {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
  margin-bottom: 12px;
}

.relationship-graph-container svg {
  display: block;
}

.rel-link:hover {
  opacity: 1 !important;
}

.rel-node:hover circle {
  filter: brightness(1.3);
}

.relationship-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 8px 4px;
  font-size: 12px;
  color: #b2bec3;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  opacity: 0.8;
  cursor: default;
}

.legend-item.is-single {
  color: #636e72;
}

/* ── Relationship Popover ── */
.rel-popover {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  background: #0d1a2c;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 20px;
  min-width: 360px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.rel-popover-inner h4 {
  margin: 0 0 16px;
  font-size: 16px;
  color: #dfe6e9;
}

.rel-popover-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.rel-popover-row label {
  min-width: 60px;
  font-size: 13px;
  color: #b2bec3;
}

.rel-popover-select {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #dfe6e9;
  font-size: 13px;
}

.rel-popover-arrow {
  color: #636e72;
  font-size: 18px;
}

.rel-popover-row input[type="range"] {
  flex: 1;
  accent-color: #0984e3;
}

.rel-popover-row select {
  flex: 1;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #dfe6e9;
  font-size: 13px;
}

.rel-popover-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* ── Context Menu ── */
.rel-context-menu {
  position: fixed;
  z-index: 10001;
  background: #0d1a2c;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 6px 0;
  min-width: 180px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.rel-context-item {
  padding: 8px 16px;
  font-size: 13px;
  color: #dfe6e9;
  cursor: pointer;
  transition: background 0.15s;
}

.rel-context-item:hover {
  background: rgba(9, 132, 227, 0.15);
}

.rel-context-note {
  font-size: 11px;
  color: #636e72;
  cursor: default;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 4px;
  padding-top: 8px;
}

.rel-context-note:hover {
  background: transparent;
}