* {
  box-sizing: border-box;
}

html, body, #root {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
}

/* Liquid Background with Purple Theme */
.liquid-bg {
  background: linear-gradient(135deg, #FAF8FF 0%, #F5F0FF 50%, #EDE5FF 100%);
  position: relative;
  overflow: hidden;
}

/* Blob container */
.blob-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Animated Lilac Blobs — more, spread out, slightly darker */
.blob {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
  will-change: transform;
}

.blob-1 {
  width: 340px; height: 340px;
  background: radial-gradient(circle at 30% 30%, #DDD6FE 0%, #C4B5FD 50%, #DDD6FE 100%);
  top: -8%; left: -6%;
  animation: float1 26s ease-in-out infinite;
}
.blob-2 {
  width: 280px; height: 280px;
  background: radial-gradient(circle at 70% 30%, #E9E5FF 0%, #DDD6FE 50%, #D0C7FE 100%);
  top: 5%; right: 15%;
  animation: float2 30s ease-in-out infinite;
}
.blob-3 {
  width: 260px; height: 260px;
  background: radial-gradient(circle at 50% 50%, #D0C7FE 0%, #DDD6FE 50%, #E5DEFF 100%);
  bottom: -6%; left: 30%;
  animation: float3 23s ease-in-out infinite;
}
.blob-4 {
  width: 220px; height: 220px;
  background: radial-gradient(circle at 40% 60%, #E5DEFF 0%, #DDD6FE 50%, #D0C7FE 100%);
  bottom: 25%; right: -4%;
  animation: float4 28s ease-in-out infinite;
}
.blob-5 {
  width: 200px; height: 200px;
  background: radial-gradient(circle at 60% 40%, #D0C7FE 0%, #C4B5FD 60%, #DDD6FE 100%);
  top: 45%; left: 8%;
  animation: float5 21s ease-in-out infinite;
}
.blob-6 {
  width: 240px; height: 240px;
  background: radial-gradient(circle at 30% 70%, #DDD6FE 0%, #D0C7FE 50%, #C4B5FD 100%);
  top: 15%; left: 45%;
  animation: float6 25s ease-in-out infinite;
}
.blob-7 {
  width: 180px; height: 180px;
  background: radial-gradient(circle at 50% 30%, #E5DEFF 0%, #DDD6FE 50%, #D0C7FE 100%);
  bottom: 10%; right: 30%;
  animation: float7 27s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(80px, 60px) scale(1.08); }
  50% { transform: translate(40px, 120px) scale(0.95); }
  75% { transform: translate(-40px, 80px) scale(1.04); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-70px, 80px) scale(1.05); }
  50% { transform: translate(-100px, 40px) scale(1.08); }
  75% { transform: translate(-50px, -40px) scale(0.95); }
}
@keyframes float3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(60px, -50px) scale(1.06); }
  50% { transform: translate(120px, -80px) scale(0.93); }
  75% { transform: translate(40px, -30px) scale(1.03); }
}
@keyframes float4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-60px, -70px) scale(0.95); }
  50% { transform: translate(-30px, 50px) scale(1.08); }
  75% { transform: translate(40px, -20px) scale(1.02); }
}
@keyframes float5 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(50px, -40px) scale(1.1); }
  50% { transform: translate(70px, 30px) scale(0.92); }
  75% { transform: translate(20px, 60px) scale(1.04); }
}
@keyframes float6 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-50px, -40px) scale(1.06); }
  50% { transform: translate(-30px, -80px) scale(0.94); }
  75% { transform: translate(25px, -50px) scale(1.07); }
}
@keyframes float7 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-35px, 50px) scale(0.94); }
  50% { transform: translate(45px, 40px) scale(1.1); }
  75% { transform: translate(25px, -25px) scale(1.02); }
}

/* Header mini-blobs — pure CSS, no JS overhead */
.header-blob {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.3) 0%, rgba(221,214,254,0.15) 100%);
  pointer-events: none;
  will-change: transform;
}

.header-blob-1 { width: 12px; height: 12px; top: 20%; left: 8%; animation: hblob1 6s ease-in-out infinite; }
.header-blob-2 { width: 16px; height: 16px; top: 60%; left: 25%; animation: hblob2 8s ease-in-out infinite; }
.header-blob-3 { width: 10px; height: 10px; top: 30%; left: 50%; animation: hblob3 5s ease-in-out infinite; }
.header-blob-4 { width: 14px; height: 14px; top: 70%; left: 72%; animation: hblob4 7s ease-in-out infinite; }
.header-blob-5 { width: 9px; height: 9px; top: 40%; left: 90%; animation: hblob5 6.5s ease-in-out infinite; }

@keyframes hblob1 { 0%,100%{transform:translate(0,0)} 33%{transform:translate(25px,8px)} 66%{transform:translate(-15px,-6px)} }
@keyframes hblob2 { 0%,100%{transform:translate(0,0)} 33%{transform:translate(-20px,-10px)} 66%{transform:translate(18px,5px)} }
@keyframes hblob3 { 0%,100%{transform:translate(0,0)} 33%{transform:translate(15px,12px)} 66%{transform:translate(-22px,-4px)} }
@keyframes hblob4 { 0%,100%{transform:translate(0,0)} 33%{transform:translate(-18px,7px)} 66%{transform:translate(12px,-10px)} }
@keyframes hblob5 { 0%,100%{transform:translate(0,0)} 33%{transform:translate(20px,-8px)} 66%{transform:translate(-10px,12px)} }

/* Purple Banner */
.purple-banner {
  background: linear-gradient(90deg, #EDE9FE 0%, #DDD6FE 50%, #EDE9FE 100%);
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  position: relative;
  overflow: hidden;
}

/* Mahogany Shelf Ledge — realistic wood with grain */
.shelf {
  background:
    /* Wood grain streaks */
    repeating-linear-gradient(92deg,
      transparent 0px, transparent 18px,
      rgba(0,0,0,0.06) 18px, rgba(0,0,0,0.06) 19px,
      transparent 19px, transparent 34px,
      rgba(0,0,0,0.04) 34px, rgba(0,0,0,0.04) 35px
    ),
    /* Knot hint */
    radial-gradient(ellipse 8px 12px at 30% 50%, rgba(74,44,42,0.4) 0%, transparent 100%),
    /* Base wood */
    linear-gradient(180deg, #9B8365 0%, #7A5B3A 20%, #6B4423 40%, #4A2C2A 55%, #6B4423 75%, #9B8365 100%);
  box-shadow:
    0 4px 12px rgba(0,0,0,0.35),
    0 1px 3px rgba(0,0,0,0.2),
    inset 0 1px 2px rgba(255,255,255,0.15),
    inset 0 -1px 1px rgba(0,0,0,0.2);
}

/* Mahogany Shelf Quadrant Background — realistic wood panel */
.shelf-quadrant {
  background:
    /* Horizontal wood grain lines */
    repeating-linear-gradient(178deg,
      transparent 0px, transparent 6px,
      rgba(0,0,0,0.03) 6px, rgba(0,0,0,0.03) 7px,
      transparent 7px, transparent 14px,
      rgba(0,0,0,0.02) 14px, rgba(0,0,0,0.02) 15px,
      transparent 15px, transparent 24px,
      rgba(0,0,0,0.04) 24px, rgba(0,0,0,0.04) 25px
    ),
    /* Vertical grain variation */
    repeating-linear-gradient(88deg,
      transparent 0px, transparent 40px,
      rgba(0,0,0,0.025) 40px, rgba(0,0,0,0.025) 41px,
      transparent 41px, transparent 80px,
      rgba(255,255,255,0.02) 80px, rgba(255,255,255,0.02) 81px
    ),
    /* Wood knot 1 */
    radial-gradient(ellipse 16px 22px at 25% 35%, rgba(74,44,42,0.25) 0%, transparent 100%),
    /* Wood knot 2 */
    radial-gradient(ellipse 12px 18px at 75% 65%, rgba(74,44,42,0.2) 0%, transparent 100%),
    /* Ambient lighting from top */
    linear-gradient(180deg,
      rgba(255,255,255,0.06) 0%,
      transparent 15%,
      transparent 85%,
      rgba(0,0,0,0.08) 100%
    ),
    /* Base wood color with realistic tonal variation */
    linear-gradient(180deg,
      #5C3A1E 0%,
      #6B4423 6%,
      #7A5533 15%,
      #755030 30%,
      #6B4423 50%,
      #634020 65%,
      #5C3A1E 82%,
      #4A2C2A 100%
    );
  box-shadow:
    inset 0 3px 10px rgba(0,0,0,0.5),
    inset 0 -2px 8px rgba(0,0,0,0.35),
    inset 4px 0 10px rgba(0,0,0,0.15),
    inset -4px 0 10px rgba(0,0,0,0.15),
    0 2px 8px rgba(0,0,0,0.15);
  border: 1px solid rgba(90,55,25,0.5);
}

/* Placeholder Ghost Books */
.ghost-book {
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 2px 4px 4px 2px;
  background: linear-gradient(to bottom,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.02) 50%,
    rgba(255,255,255,0.04) 100%
  );
  position: relative;
  flex-shrink: 0;
}

.ghost-book::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(90deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  border-radius: 2px 0 0 2px;
}

.ghost-book::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 4px;
  right: 4px;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.08), transparent);
}

/* 3D Book Spine */
.book-spine {
  transform-style: preserve-3d;
  perspective: 800px;
}

.book-spine-inner {
  transform: rotateY(-4deg);
  box-shadow: 4px 4px 10px rgba(0,0,0,0.35), -2px 0 4px rgba(0,0,0,0.15), inset -4px 0 8px rgba(0,0,0,0.25), inset 2px 0 4px rgba(255,255,255,0.1);
  border-radius: 2px 4px 4px 2px;
}

/* Left edge shadow (binding) */
.book-spine-inner::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(90deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.05) 100%);
  border-radius: 2px 0 0 2px;
}

/* Top edge highlight (page edges from top) */
.book-spine-inner::after {
  content: '';
  position: absolute;
  top: 0;
  left: 3px;
  right: 0;
  height: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.05) 60%, transparent 100%);
  border-radius: 0 4px 0 0;
}

/* Vertical Text for Book Spines */
.vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  overflow: hidden;
}

/* Page Flicker Animation */
@keyframes pageFlicker {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  25% { transform: scaleX(0.96); opacity: 0.9; }
  50% { transform: scaleX(1.02); opacity: 1; }
  75% { transform: scaleX(0.98); opacity: 0.92; }
}

.page-flicker {
  animation: pageFlicker 0.5s ease-in-out;
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  height: 4px;
  width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(139, 92, 246, 0.1);
  border-radius: 2px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #8B5CF6;
  border-radius: 2px;
}

/* Modal Backdrop — simple overlay, no blur */
.modal-backdrop {
  background: rgba(0,0,0,0.4);
}

/* Book Back Cover Modal — hardback proportions */
.book-cover {
  position: relative;
  border-radius: 3px 6px 6px 3px;
  overflow: hidden;
  aspect-ratio: 5 / 7.5;
  max-height: 85vh;
}
.book-cover::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 14px;
  background: linear-gradient(90deg,
    rgba(0,0,0,0.45) 0%,
    rgba(0,0,0,0.2) 30%,
    rgba(255,255,255,0.06) 55%,
    rgba(0,0,0,0.03) 70%,
    transparent 100%);
  z-index: 2;
  pointer-events: none;
}
.book-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px 6px 6px 3px;
  box-shadow:
    inset 0 1px 3px rgba(255,255,255,0.12),
    inset 0 -1px 3px rgba(0,0,0,0.18),
    inset -1px 0 2px rgba(0,0,0,0.08),
    0 0 0 1px rgba(0,0,0,0.1);
  pointer-events: none;
  z-index: 2;
}
.book-blurb {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-style: italic;
  line-height: 1.65;
  color: rgba(255,255,255,0.85);
}
.book-blurb strong { font-style: normal; font-weight: 700; color: rgba(255,255,255,0.95); }
.book-blurb em { font-style: normal; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.3); }
.book-blurb p { margin-bottom: 0.5rem; }
.book-blurb code {
  background: rgba(255,255,255,0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: monospace;
  font-style: normal;
  font-size: 0.8rem;
}

/* Focus States */
input:focus, button:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

/* Markdown Styles */
.markdown-content strong { font-weight: 600; }
.markdown-content em { font-style: italic; }
.markdown-content p { margin-bottom: 0.5rem; }
.markdown-content code {
  background: rgba(139, 92, 246, 0.1);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
}

/* Attribution Button */
.attribution-btn {
  border: 1.5px solid rgba(139, 92, 246, 0.25);
  transition: all 0.2s ease;
}
.attribution-btn:hover {
  border-color: #8B5CF6;
  background: rgba(139, 92, 246, 0.08);
}

/* RIMICO Home Button — lilac highlight */
.rimico-home-btn {
  background: rgba(139, 92, 246, 0.1);
  border: 1.5px solid rgba(139, 92, 246, 0.25);
  text-decoration: none;
  transition: all 0.2s ease;
}
.rimico-home-btn:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: #8B5CF6;
  transform: scale(1.03);
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.15);
}

/* Title Click Effect */
.title-link {
  cursor: pointer;
  transition: all 0.2s ease;
}
.title-link:hover {
  transform: scale(1.02);
  text-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}
