/* ==========================================================================
   EX LIBRIS - Estilos de Biblioteca Personal, Multi-Cuenta & Club de Lectura
   Estética 0% IA: Artesanal, Editorial, Madera de Nogal, Papel Marfil & Latón
   ========================================================================== */

:root {
  /* Paleta Editorial */
  --bg-library: #14110f;
  --bg-desk: #1b1613;
  --wood-top: #3b2d22;
  --wood-face: #271d16;
  --wood-shadow: rgba(0, 0, 0, 0.65);
  --wood-trim: #4a382b;
  
  --brass-bright: #e5c378;
  --brass-gold: #c5a059;
  --brass-aged: #8a6f3b;
  --brass-plate: #221c16;
  
  --paper-cream: #f6f3eb;
  --paper-ivory: #ede8dc;
  --paper-dark: #2a2521;
  --paper-muted: #8c8278;
  
  --ink-primary: #f2ece1;
  --ink-secondary: #beb4a5;
  --ink-dim: #7d7366;
  
  --accent-burgundy: #7a262c;
  --accent-moss: #2e4438;
  --accent-navy: #1f2c3d;
  
  --shadow-shelf: 0 16px 28px rgba(0, 0, 0, 0.7);
  --shadow-book: 0 10px 24px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-book-hover: 0 18px 36px rgba(0, 0, 0, 0.65), 0 4px 10px rgba(0, 0, 0, 0.5);

  --font-serif: 'Cormorant Garamond', Garamond, Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-library);
  background-image: 
    radial-gradient(ellipse at 50% 0%, #251d18 0%, transparent 70%),
    linear-gradient(180deg, rgba(20,17,15,0.92) 0%, rgba(15,12,10,0.98) 100%);
  background-attachment: fixed;
  color: var(--ink-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Clásica */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #14110f;
}
::-webkit-scrollbar-thumb {
  background: #3a2e24;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--brass-gold);
}

/* ==========================================================================
   Encabezado & Barra de Navegación Editorial
   ========================================================================== */
.site-header {
  border-bottom: 1px solid rgba(197, 160, 89, 0.2);
  background: rgba(20, 17, 15, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand-area {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-primary);
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.korean-sub {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--brass-gold);
  letter-spacing: 0.05em;
  font-weight: 500;
  opacity: 0.9;
}

/* ==========================================================================
   Overlay de Onboarding Obligatorio (Primera Visita)
   ========================================================================== */
.onboarding-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(26, 20, 15, 0.96) 0%, rgba(10, 8, 7, 0.98) 100%);
  backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.onboarding-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.onboarding-card {
  background: #1e1713;
  border: 1px solid #453625;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(197, 160, 89, 0.2);
  border-radius: var(--radius-sm);
  max-width: 520px;
  width: 100%;
  padding: 2.25rem;
  position: relative;
  transform: translateY(16px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.onboarding-backdrop.active .onboarding-card {
  transform: translateY(0);
}

.onboarding-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brass-gold), transparent);
}

.onboarding-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.onboarding-pre {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--brass-gold);
}

.onboarding-brand {
  font-family: var(--font-serif);
  font-size: 2.35rem;
  font-weight: 700;
  color: var(--ink-primary);
  margin-top: 0.2rem;
  letter-spacing: 0.06em;
}

.korean-sub-onboarding {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--brass-gold);
}

.onboarding-desc {
  font-size: 0.85rem;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin-top: 0.5rem;
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-label-editorial {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  display: block;
  margin-bottom: 0.4rem;
}

.onboarding-input {
  width: 100%;
  background: #14100e;
  border: 1px solid #473827;
  border-radius: var(--radius-sm);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.8rem 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.onboarding-input:focus {
  border-color: var(--brass-gold);
  box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.15);
}

.color-picker-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.color-chip-radio {
  cursor: pointer;
  position: relative;
}

.color-chip-radio input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.color-chip-circle {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #3d3023;
  transition: all 0.2s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.color-chip-radio input:checked + .color-chip-circle {
  border-color: var(--brass-bright);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(229, 195, 120, 0.4);
}

.btn-onboarding-submit {
  width: 100%;
  justify-content: center;
  padding: 0.85rem;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* Pestañas Principales: Mi Estantería vs Club de Lectura */
.main-nav-tabs {
  display: flex;
  background: #191410;
  border: 1px solid #382c22;
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  padding: 0.45rem 1rem;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.nav-tab.active {
  background: #2b2118;
  color: var(--brass-bright);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.nav-tab:hover:not(.active) {
  color: var(--ink-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Badge de Usuario / Lector Activo */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #201a14;
  border: 1px solid #423425;
  padding: 0.35rem 0.65rem 0.35rem 0.4rem;
  border-radius: 20px;
  cursor: pointer;
  color: var(--ink-primary);
  transition: all 0.15s ease;
}

.user-profile-badge:hover {
  border-color: var(--brass-gold);
  background: #292119;
}

.user-avatar-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #8E4A49;
  color: #fff;
  font-size: 0.725rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.2);
}

.user-name-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dropdown-arrow {
  font-size: 0.65rem;
  color: var(--brass-gold);
}

/* Botones con estilo de orfebrería de latón */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.05rem;
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
}

.btn-brass {
  background: linear-gradient(180deg, #d3b168 0%, #b28e46 100%);
  color: #1a140e;
  border-color: #8f6e2b;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-brass:hover {
  background: linear-gradient(180deg, #e4c47b 0%, #c19c50 100%);
  box-shadow: 0 4px 10px rgba(197, 160, 89, 0.25);
  transform: translateY(-1px);
}
.btn-brass:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}

.btn-secondary {
  background: #231d17;
  color: var(--ink-secondary);
  border: 1px solid #3d3228;
}
.btn-secondary:hover {
  background: #2c251e;
  color: var(--ink-primary);
  border-color: var(--brass-gold);
}

.btn-icon-only {
  padding: 0.55rem;
  font-size: 0.95rem;
}

/* Selector de Modo de Vista */
.view-mode-toggle {
  display: flex;
  background: #191410;
  border: 1px solid #382c22;
  border-radius: var(--radius-sm);
  padding: 2px;
}
.view-mode-btn {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  padding: 0.4rem 0.55rem;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.view-mode-btn.active {
  background: #2f251d;
  color: var(--brass-gold);
  font-weight: 600;
}

/* ==========================================================================
   Panel de Estadísticas de Lectura
   ========================================================================== */
.stats-banner {
  max-width: 1280px;
  margin: 1.25rem auto 0;
  padding: 0 1.5rem;
}

.stats-card {
  background: #1c1713;
  border: 1px solid #33271d;
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  padding: 1.1rem 1.5rem;
  gap: 1.25rem;
  position: relative;
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--brass-gold), transparent);
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 0.2rem;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.stat-sub {
  font-size: 0.8rem;
  font-family: var(--font-sans);
  color: var(--brass-gold);
  font-weight: 400;
}

/* ==========================================================================
   Banner del Club de Lectura
   ========================================================================== */
.club-banner {
  max-width: 1280px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}

.club-card-header {
  background: #1e1814;
  border: 1px solid #443424;
  border-radius: var(--radius-sm);
  padding: 1.5rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  position: relative;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.club-card-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brass-aged), var(--brass-bright), var(--brass-aged));
}

.club-title-area {
  max-width: 600px;
}

.club-label-pre {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass-gold);
}

.club-name-title {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.15;
  margin-top: 0.15rem;
}

.club-desc-text {
  font-size: 0.85rem;
  color: var(--ink-secondary);
  margin-top: 0.35rem;
}

.club-meta-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
}

/* Badge de Código de Club */
.club-code-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: #14100c;
  border: 1px solid var(--brass-gold);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
}

.code-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink-dim);
}

.code-val {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brass-bright);
  letter-spacing: 0.05em;
}

.btn-copy-mini {
  background: #2a221a;
  border: 1px solid #4e3d29;
  color: var(--brass-gold);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-copy-mini:hover {
  background: var(--brass-gold);
  color: #1a140e;
}

.club-members-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.members-avatars-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.member-avatar-chip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.club-action-buttons {
  display: flex;
  gap: 0.5rem;
}

/* ==========================================================================
   Estructura de Repisas de Madera
   ========================================================================== */
.shelves-container {
  max-width: 1280px;
  margin: 1.75rem auto 3.5rem;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 3.25rem;
}

.shelf-section {
  position: relative;
}

.shelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

.brass-plaque {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--brass-plate);
  border: 1px solid #4a3a2a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 2px 6px rgba(0,0,0,0.5);
  padding: 0.4rem 1.1rem;
  border-radius: var(--radius-sm);
  position: relative;
}

.brass-screw {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a88a4e;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.2);
}

.brass-plaque-text {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #dfcaa2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.shelf-count {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--ink-dim);
  letter-spacing: 0.05em;
}

.wood-shelf {
  position: relative;
  min-height: 270px;
  padding-bottom: 24px;
}

.shelf-books-row {
  display: flex;
  align-items: flex-end;
  gap: 1.75rem;
  min-height: 250px;
  padding: 1.5rem 1.5rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.wood-shelf::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(180deg, #443427 0%, #30241b 40%, #1f1711 100%);
  border-top: 2px solid #5a4635;
  box-shadow: 
    0 12px 28px rgba(0, 0, 0, 0.75),
    0 3px 6px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

.wood-shelf::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 10px;
  right: 10px;
  height: 6px;
  background: #110d0a;
  filter: blur(4px);
  z-index: -1;
}

.empty-shelf-hint {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--ink-dim);
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  gap: 0.75rem;
  text-align: center;
}
.empty-shelf-btn {
  font-style: normal;
  font-size: 0.8rem;
}

/* ==========================================================================
   Tarjetas de Libros (Modo Portadas)
   ========================================================================== */
.book-card {
  position: relative;
  flex: 0 0 155px;
  width: 155px;
  height: 235px;
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.28s ease;
  perspective: 1000px;
  margin-bottom: 2px;
}

.book-card:hover {
  transform: translateY(-8px) scale(1.02);
  z-index: 10;
}

.book-cover-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 2px 4px 4px 2px;
  overflow: hidden;
  box-shadow: var(--shadow-book);
  background: #231e19;
  border-left: 4px solid rgba(0, 0, 0, 0.35);
}

.book-card:hover .book-cover-wrap {
  box-shadow: var(--shadow-book-hover);
}

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

.reading-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(20, 16, 13, 0.9);
  color: var(--brass-bright);
  border: 1px solid var(--brass-gold);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 2px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.book-progress-strip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(0, 0, 0, 0.6);
}

.book-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #a17c38, #e5c378);
  box-shadow: 0 0 6px rgba(229, 195, 120, 0.6);
  transition: width 0.3s ease;
}

.completed-stars-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(20, 16, 13, 0.92);
  color: var(--brass-bright);
  border: 1px solid #54432c;
  font-size: 0.65rem;
  padding: 2px 5px;
  border-radius: 2px;
  display: flex;
  gap: 1px;
}

/* Placa "Añadido por Juan" en libros del club */
.club-book-added-badge {
  position: absolute;
  bottom: 8px;
  left: 6px;
  right: 6px;
  background: rgba(18, 14, 11, 0.92);
  border: 1px solid #4a3b2b;
  border-radius: 2px;
  padding: 3px 6px;
  font-size: 0.625rem;
  color: var(--paper-cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(4px);
}

.club-book-reviews-counter {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(20, 16, 13, 0.92);
  border: 1px solid var(--brass-gold);
  color: var(--brass-bright);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 2px;
}

.btn-inspect-3d-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  background: rgba(20, 16, 13, 0.95);
  border: 1px solid var(--brass-gold);
  color: var(--brass-bright);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
  transition: all 0.2s ease;
}

.book-card:hover .btn-inspect-3d-hint {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   Modo Lomos (Spines View)
   ========================================================================== */
.view-spines .shelf-books-row {
  gap: 6px;
  align-items: flex-end;
  padding-left: 2rem;
}

.book-spine-card {
  position: relative;
  cursor: pointer;
  border-radius: 2px 2px 0 0;
  box-shadow: -2px 0 6px rgba(0,0,0,0.6), 2px 0 4px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 4px 12px;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.4, 1), box-shadow 0.22s ease;
  user-select: none;
  overflow: hidden;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.book-spine-card:hover {
  transform: translateY(-16px);
  z-index: 20;
  box-shadow: 0 12px 24px rgba(0,0,0,0.8);
}

.spine-rib {
  height: 2px;
  background: rgba(197, 160, 89, 0.6);
  box-shadow: 0 1px 1px rgba(0,0,0,0.6);
  margin: 4px 2px;
}

.spine-title-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: #f7eed8;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 140px;
  margin: auto;
  text-align: center;
}

.spine-author-vertical {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-family: var(--font-sans);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: #cfbda2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 45px;
  margin: 0 auto;
}

.spine-ribbon {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 12px;
  background: #8b1e28;
  border-radius: 0 0 2px 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* ==========================================================================
   Modales & Hilo Colaborativo de Reseñas del Club
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 7, 0.85);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #1c1713;
  border: 1px solid #3d3024;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(197, 160, 89, 0.15);
  border-radius: var(--radius-sm);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid #33271d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #211b16;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--ink-primary);
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  transition: color 0.15s ease;
  font-size: 1rem;
}
.modal-close:hover {
  color: var(--brass-gold);
}

/* Estilos de la Ficha de Lectura */
.book-detail-modal {
  max-width: 840px;
}

.book-detail-body {
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
}

.detail-cover-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
}

.detail-cover-preview {
  width: 185px;
  height: 275px;
  border-radius: 3px;
  box-shadow: var(--shadow-book-hover);
  object-fit: cover;
  background: #14110e;
}

.detail-shelf-status {
  width: 100%;
}

.status-select {
  width: 100%;
  background: #231b14;
  border: 1px solid #473827;
  color: var(--ink-primary);
  font-family: var(--font-sans);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 0.85rem;
  cursor: pointer;
}

.detail-form-col {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.detail-title {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink-primary);
}

.detail-author {
  font-size: 1rem;
  color: var(--brass-gold);
  margin-top: 0.2rem;
}

/* Control de Progreso */
.progress-control-panel {
  background: #17130f;
  border: 1px solid #382c1f;
  border-radius: var(--radius-sm);
  padding: 1.15rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.65rem;
}

.progress-label {
  font-size: 0.725rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.progress-percent-highlight {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--brass-bright);
}

.progress-slider-bar {
  width: 100%;
  height: 8px;
  background: #292017;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.progress-slider-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brass-bright);
  border: 2px solid #5a421b;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.6);
}

.page-inputs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.85rem;
  gap: 0.5rem;
}

.page-stepper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-step {
  background: #261e16;
  border: 1px solid #443423;
  color: var(--ink-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn-step:hover {
  background: #33271c;
  color: var(--brass-gold);
  border-color: var(--brass-gold);
}

.page-number-box {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}

.input-page-current {
  width: 75px;
  background: #110e0b;
  border: 1px solid #4a3a27;
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0.35rem 0.5rem;
  text-align: right;
  border-radius: var(--radius-sm);
}

.input-page-total {
  width: 75px;
  background: #110e0b;
  border: 1px solid #36291c;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 0.35rem 0.5rem;
  text-align: left;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   HILO DE RESEÑAS COLABORATIVAS DEL CLUB (Juan, Pepe, etc.)
   ========================================================================== */
.club-reviews-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.club-reviews-thread {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.club-review-card {
  background: #181310;
  border: 1px solid #362b1f;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.review-author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.review-author-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.review-author-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-author-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-primary);
}

.review-author-date {
  font-size: 0.7rem;
  color: var(--ink-dim);
}

.review-stars {
  color: var(--brass-bright);
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.review-quote-text {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.5;
  color: #e5decb;
  font-style: italic;
  padding-left: 0.25rem;
}

.my-review-box {
  background: #14100d;
  border: 1px solid #443525;
  border-radius: var(--radius-sm);
  padding: 1rem;
}

/* ==========================================================================
   Gestión de Usuarios / Cuentas
   ========================================================================== */
.users-list-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.user-item-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #211a14;
  border: 1px solid #382c20;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-primary);
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.user-item-btn:hover {
  background: #2b221a;
  border-color: var(--brass-gold);
}

.user-item-btn.active {
  background: #2f251d;
  border-color: var(--brass-bright);
}

/* Búsqueda */
.search-modal {
  max-width: 760px;
}
.search-bar-wrap {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid #2d231a;
  position: relative;
}
.search-input {
  width: 100%;
  background: #14110e;
  border: 1px solid #423425;
  border-radius: var(--radius-sm);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  outline: none;
}
.search-input:focus {
  border-color: var(--brass-gold);
}
.search-icon-inside {
  position: absolute;
  left: 2.35rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brass-gold);
  pointer-events: none;
}
.search-results-list {
  padding: 1.1rem 1.5rem;
  max-height: 440px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.search-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #211a14;
  border: 1px solid #33271d;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
}
.search-item-thumb {
  width: 44px;
  height: 66px;
  object-fit: cover;
  border-radius: 2px;
  background: #14110e;
  flex-shrink: 0;
}
.search-item-details {
  flex: 1;
  min-width: 0;
}
.search-item-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item-author {
  font-size: 0.8rem;
  color: var(--brass-gold);
}
.search-item-meta {
  font-size: 0.725rem;
  color: var(--ink-dim);
}

/* Visor 3D */
.viewer-3d-modal {
  max-width: 900px;
}
.viewer-3d-canvas-container {
  width: 100%;
  height: 440px;
  background: radial-gradient(circle at 50% 45%, #241d17 0%, #120f0c 85%);
  position: relative;
  overflow: hidden;
  cursor: grab;
}
.viewer-3d-controls {
  padding: 0.85rem 1.5rem;
  background: #181310;
  border-top: 1px solid #31261b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.viewer-hints {
  font-size: 0.725rem;
  color: var(--ink-dim);
}
.angle-buttons-group {
  display: flex;
  gap: 0.35rem;
}

/* Reseña y Citas */
.review-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.rating-stars-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.star-btn, .club-star-btn {
  background: transparent;
  border: none;
  font-size: 1.35rem;
  color: #443729;
  cursor: pointer;
  line-height: 1;
}
.star-btn.active, .club-star-btn.active {
  color: var(--brass-bright);
}
.review-textarea {
  width: 100%;
  min-height: 95px;
  background: #16120e;
  border: 1px solid #3a2e20;
  border-radius: var(--radius-sm);
  color: var(--ink-primary);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  padding: 0.75rem 0.85rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
.review-textarea:focus {
  border-color: var(--brass-gold);
}

.quotes-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.quotes-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quote-bubble {
  background: #16120e;
  border-left: 3px solid var(--brass-gold);
  padding: 0.65rem 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.925rem;
  color: #dfd8cb;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.btn-remove-quote {
  background: transparent;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
}
.add-quote-row {
  display: flex;
  gap: 0.4rem;
}
.input-quote-text {
  flex: 1;
  background: #14110e;
  border: 1px solid #3b2e21;
  color: var(--ink-primary);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  outline: none;
}
.input-quote-page {
  width: 80px;
  background: #14110e;
  border: 1px solid #3b2e21;
  color: var(--ink-primary);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  outline: none;
}

/* Pie de Página */
.site-footer {
  border-top: 1px solid #281f17;
  padding: 2.25rem 1.5rem;
  text-align: center;
  font-family: var(--font-serif);
  color: var(--ink-dim);
  font-size: 0.95rem;
}
.footer-content {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.footer-quote {
  font-style: italic;
  color: var(--brass-gold);
}
.footer-actions {
  margin-top: 0.85rem;
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #231b14;
  border: 1px solid var(--brass-gold);
  color: var(--paper-cream);
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0,0,0,0.6);
  z-index: 9999;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
}
.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   OPTIMIZACIÓN RESPONSIVE PARA CELULARES Y TABLETS
   ========================================================================== */
@media (max-width: 860px) {
  .header-container {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .main-nav-tabs {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .book-detail-body {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .detail-cover-col {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .detail-cover-preview {
    width: 120px;
    height: 180px;
  }

  .detail-shelf-status {
    flex: 1;
    min-width: 160px;
  }

  .club-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .club-meta-actions {
    align-items: flex-start;
    width: 100%;
  }

  .club-action-buttons {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 540px) {
  .brand-tagline {
    display: none;
  }

  .hide-on-mobile {
    display: none;
  }

  .shelves-container {
    padding: 0 0.85rem;
    gap: 2.25rem;
  }

  .shelf-books-row {
    padding: 1rem 0.5rem 0;
    gap: 1rem;
  }

  .book-card {
    flex: 0 0 130px;
    width: 130px;
    height: 195px;
  }

  .brass-plaque-text {
    font-size: 0.85rem;
  }

  .viewer-3d-canvas-container {
    height: 320px;
  }

  .modal-overlay {
    padding: 0.5rem;
    align-items: flex-end;
  }

  .modal-content {
    max-height: 95vh;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .page-inputs-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* ==========================================================================
   UI/UX PRO MAX & ERGONOMÍA MÓVIL (PULGAR, TÁCTIL 48PX, TIPOGRAFÍA 16PX)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Ergonomía Táctil: Botones e interactivos mínimo 48x48 px */
  .btn {
    min-height: 48px;
    padding: 0.75rem 1.15rem;
    font-size: 0.875rem;
  }

  .modal-close {
    min-width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
  }

  .btn-step {
    min-width: 48px;
    min-height: 48px;
    font-size: 1.2rem;
  }

  .star-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
  }

  .quick-action-btn {
    min-height: 48px;
    padding: 0.65rem 1rem;
  }

  /* Tipografía y lectura móvil: Mínimo 16px para evitar auto-zoom en iOS Safari */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="url"],
  input[type="search"],
  select,
  textarea,
  .search-input,
  .onboarding-input,
  .review-textarea,
  .page-number-input {
    font-size: 16px !important;
    min-height: 48px;
  }

  textarea.review-textarea {
    min-height: 90px !important;
  }

  /* Barra de Navegación Inferior Móvil Fija */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(22, 17, 13, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.75);
    z-index: 999;
    align-items: center;
    justify-content: space-around;
  }

  .bnav-item {
    flex: 1;
    height: 100%;
    min-width: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--ink-dim);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.1s ease;
    padding: 0.25rem;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .bnav-item:active {
    transform: scale(0.95);
  }

  .bnav-item.active {
    color: var(--brass-bright);
  }

  .bnav-icon {
    font-size: 1.25rem;
    line-height: 1;
    display: block;
  }

  .bnav-label {
    line-height: 1;
  }

  /* Botón central elevado para Añadir Libro rápido */
  .bnav-add-btn {
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e8c872 0%, #b28e46 100%);
    color: #14100c;
    margin-top: -22px;
    box-shadow: 0 4px 18px rgba(212, 175, 55, 0.5);
    border: 3px solid #1c1510;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .bnav-add-btn:active {
    transform: scale(0.92);
  }

  .bnav-add-icon {
    font-size: 1.85rem;
    font-weight: 300;
    line-height: 1;
    margin-top: -2px;
    color: #14100c;
  }

  /* Toast por encima de la barra móvil */
  .toast-notice {
    bottom: 5.5rem;
    right: 1rem;
    left: 1rem;
    text-align: center;
    justify-content: center;
  }

  /* Simplificar header en móviles para dejar espacio a la barra inferior */
  .main-nav-tabs {
    display: none; /* Se navega desde la barra inferior */
  }

  .header-actions .btn-brass {
    padding: 0.45rem 0.85rem;
    min-height: 42px;
  }
}

