/* ============================================================
   LUMEN — handmade neocities-style cozy library
   Tiled gingham, lacy borders, pixel stickers, marquee strips.
   Pink palette preserved.
   ============================================================ */

:root {
  --bg: #fff4f7;
  --bg-2: #ffeaf1;
  --card: #fffafd;
  --card-2: #fff0f5;
  --ink: #43222d;
  --ink-soft: #6b4555;
  --ink-mute: #9a7484;
  --rose: #d05f87;
  --rose-bright: #e8729a;
  --rose-soft: #f9c5d4;
  --rose-bg: #ffeaf1;
  --rose-deep: #a93f6a;
  --purple: #b08bd6;
  --purple-bg: #f1eaff;
  --blue: #88b9e0;
  --blue-bg: #e6f1fb;
  --amber: #d99a3a;
  --amber-bg: #fff4dc;
  --green: #6fa97c;
  --green-bg: #e7f6ea;
  --indigo: #8e9cd0;
  --indigo-bg: #ecefff;
  --tape: #ffe79e;
  --gingham: #f8b9cc;
  --border: #e8a8bc;
  --border-strong: #c87a99;
  --shadow: 4px 4px 0 rgba(168, 70, 110, 0.18), 0 8px 24px rgba(232, 114, 154, 0.12);
  --shadow-soft: 2px 2px 0 rgba(168, 70, 110, 0.14);
  --radius: 8px;
  --radius-lg: 14px;
  --font-sans: "Quicksand", system-ui, sans-serif;
  --font-serif: "EB Garamond", Georgia, serif;
  --font-cute: "Caveat", "Quicksand", cursive;
  --font-pixel: "DotGothic16", "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'><path d='M11 2 L13 8 L19 8 L14 12 L16 18 L11 14 L6 18 L8 12 L3 8 L9 8 Z' fill='%23ffb3cc' stroke='%23d05f87' stroke-width='1.2'/></svg>") 11 11, auto;

  /* Tiled pink gingham background — hand-stitched feel */
  background-color: var(--bg);
  background-image:
    /* gingham stripes */
    linear-gradient(0deg, transparent 50%, rgba(248, 185, 204, 0.35) 50%),
    linear-gradient(90deg, transparent 50%, rgba(248, 185, 204, 0.35) 50%),
    /* tiny hearts overlay */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><g fill='%23ffc8d8' opacity='0.45'><path d='M12 18 l-4 -4 a3 3 0 1 1 4 -4 a3 3 0 1 1 4 4 z'/><path d='M62 58 l-4 -4 a3 3 0 1 1 4 -4 a3 3 0 1 1 4 4 z'/></g></svg>"),
    radial-gradient(circle at 10% 0%, var(--bg-2) 0%, transparent 40%);
  background-size: 28px 28px, 28px 28px, 80px 80px, 100% 100%;
  background-attachment: fixed;
}

img { max-width: 100%; display: block; }
a { color: var(--rose); text-decoration: none; }
button { font-family: inherit; cursor: inherit; border: none; background: none; }

/* ============================================================
   Lacy scalloped strip — used at top of page
   ============================================================ */

.lace-strip {
  height: 26px;
  background:
    /* Lace scallops as repeated SVG circles */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='26' viewBox='0 0 40 26'><circle cx='10' cy='4' r='9' fill='white' stroke='%23e8a8bc' stroke-width='1.2'/><circle cx='30' cy='4' r='9' fill='white' stroke='%23e8a8bc' stroke-width='1.2'/><circle cx='10' cy='4' r='3' fill='%23ffeaf1'/><circle cx='30' cy='4' r='3' fill='%23ffeaf1'/></svg>") repeat-x;
  background-size: 40px 26px;
  pointer-events: none;
  filter: drop-shadow(0 2px 0 rgba(208, 95, 135, 0.12));
}
.lace-strip.bottom {
  transform: scaleY(-1);
}

/* ============================================================
   Container & layout
   ============================================================ */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px;
  position: relative;
}
@media (min-width: 720px) {
  .container { padding: 20px 24px; }
}

/* Decorative scattered stickers across the page bg */
.bg-stickers {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-stickers .stk {
  position: absolute;
  font-size: 22px;
  opacity: 0.35;
  animation: float-slow 8s ease-in-out infinite;
}
.bg-stickers .stk:nth-child(1) { top: 6%;  left: 3%;  animation-delay: 0s;   color: var(--rose-soft); font-size: 28px; }
.bg-stickers .stk:nth-child(2) { top: 22%; right: 4%; animation-delay: 2s;   color: var(--purple);    font-size: 24px; }
.bg-stickers .stk:nth-child(3) { top: 50%; left: 2%;  animation-delay: 4s;   color: var(--amber);     font-size: 20px; }
.bg-stickers .stk:nth-child(4) { top: 70%; right: 3%; animation-delay: 1s;   color: var(--rose-bright);font-size: 26px; }
.bg-stickers .stk:nth-child(5) { top: 88%; left: 8%;  animation-delay: 3s;   color: var(--rose-soft); font-size: 22px; }
.bg-stickers .stk:nth-child(6) { top: 38%; right: 8%; animation-delay: 5s;   color: var(--rose);      font-size: 18px; }

@keyframes float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-12px) rotate(8deg); }
}

/* ============================================================
   Reusable handmade frame
   ============================================================ */

.frame {
  position: relative;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius-lg) - 2px);
  pointer-events: none;
}

/* Corner ribbons / bows for frames */
.frame-bow-tl, .frame-bow-tr {
  position: absolute;
  width: 36px;
  height: 24px;
  pointer-events: none;
  z-index: 3;
}
.frame-bow-tl { top: -10px; left: -10px; transform: rotate(-15deg); }
.frame-bow-tr { top: -10px; right: -10px; transform: rotate(15deg); }

/* ============================================================
   Marquee strip — scrolling welcome text
   ============================================================ */

.marquee {
  margin: 14px 0 16px;
  background: linear-gradient(90deg, var(--rose), var(--rose-bright), var(--rose));
  border: 2px solid var(--rose-deep);
  border-radius: 999px;
  padding: 6px 0;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-soft);
}
.marquee::before, .marquee::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 24px;
  z-index: 2;
}
.marquee::before { left: 0;  background: linear-gradient(90deg, var(--rose), transparent); }
.marquee::after  { right: 0; background: linear-gradient(-90deg, var(--rose), transparent); }

.marquee-track {
  display: flex;
  white-space: nowrap;
  animation: marquee-scroll 30s linear infinite;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: white;
  text-shadow: 1px 1px 0 var(--rose-deep);
  letter-spacing: 0.5px;
}
.marquee-track span {
  padding: 0 22px;
}

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============================================================
   Header banner (logo bar)
   ============================================================ */

.banner {
  position: relative;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.banner::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius-lg) - 2px);
  pointer-events: none;
  z-index: 1;
}

.banner-stripes {
  height: 86px;
  background:
    /* checker overlay */
    repeating-conic-gradient(var(--rose-bg) 0% 25%, #ffd6e3 0% 50%) 50% / 18px 18px,
    /* base diagonal stripes */
    repeating-linear-gradient(135deg, var(--rose-bg) 0 14px, #ffd9e6 14px 28px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 2px dashed var(--border);
}
@media (min-width: 720px) { .banner-stripes { height: 120px; } }

.banner-title-pill {
  background: var(--card);
  background-image: radial-gradient(circle, #ffd6e3 1.5px, transparent 1.5px);
  background-size: 14px 14px;
  border: 2.5px solid var(--rose-bright);
  border-radius: 18px;
  padding: 8px 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  position: relative;
  z-index: 2;
}
.banner-title-pill h1 {
  font-family: var(--font-pixel);
  font-size: clamp(28px, 6vw, 44px);
  color: var(--rose);
  margin: 0;
  line-height: 1;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 var(--rose-soft);
}
.banner-title-pill p {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--rose);
  margin: 4px 0 0;
}

.banner-welcome {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 16px;
  position: relative;
  z-index: 2;
}
@media (min-width: 720px) {
  .banner-welcome { gap: 22px; padding: 14px 26px 20px; }
}

.welcome-text { flex: 1; min-width: 0; }
.welcome-text h2 {
  font-family: var(--font-cute);
  font-size: clamp(22px, 5vw, 30px);
  color: var(--rose);
  margin: 0;
  line-height: 1.1;
}
.welcome-text p {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--ink-soft);
  margin: 4px 0 0;
  line-height: 1.5;
}

/* ============================================================
   Avatar — animated reading girl (PNG + CSS)
   ============================================================ */

.avatar {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  margin-top: -36px;
  filter: drop-shadow(2px 4px 0 rgba(168, 70, 110, 0.25));
}
@media (min-width: 720px) {
  .avatar { width: 120px; height: 120px; margin-top: -50px; }
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 90%;
  animation: avatar-bob 4.5s ease-in-out infinite, avatar-blink-fx 5.5s ease-in-out infinite;
}
.avatar::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 215, 0.5), transparent 70%);
  animation: glow 4s ease-in-out infinite alternate;
  z-index: -1;
}
.avatar .sparkle {
  position: absolute;
  font-size: 14px;
  pointer-events: none;
  animation: float 3s ease-in-out infinite;
}
.avatar .sparkle.s1 { top: 4%;  right: -6%;  color: var(--amber);  animation-delay: 0s; }
.avatar .sparkle.s2 { bottom: 18%; left: -10%; color: var(--purple); animation-delay: 1.5s; }
.avatar .sparkle.s3 { top: 50%;  right: -8%;  color: var(--rose-bright); animation-delay: 0.8s; font-size: 11px; }

@keyframes avatar-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-4px) rotate(0.6deg); }
}
@keyframes avatar-blink-fx {
  0%, 90%, 100% { filter: none; }
  93%, 97%      { filter: brightness(1.06) saturate(1.05); }
}
@keyframes glow {
  from { opacity: 0.5; transform: scale(1); }
  to   { opacity: 0.8; transform: scale(1.05); }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.7; }
  50%      { transform: translateY(-6px) rotate(15deg); opacity: 1; }
}

/* ============================================================
   Page layout grid (single centred column)
   ============================================================ */

.page {
  margin-top: 14px;
}


/* ============================================================
   Search + filter bar
   ============================================================ */

.toolbar {
  margin-top: 8px;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.toolbar::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius-lg) - 2px);
  pointer-events: none;
}
@media (min-width: 720px) {
  .toolbar { flex-direction: row; align-items: center; padding: 14px 18px; }
}

.search { position: relative; width: 100%; }
@media (min-width: 720px) { .search { width: 240px; flex-shrink: 0; } }
.search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: #fff5f9;
  color: var(--ink);
  font-size: 13px;
  font-family: var(--font-pixel);
  outline: none;
  transition: border-color 0.15s ease;
  position: relative;
  z-index: 1;
}
.search input:focus { border-color: var(--rose); }
.search input::placeholder { color: var(--ink-mute); }
.search::before {
  content: "✿";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rose);
  font-size: 13px;
  z-index: 2;
  pointer-events: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 1;
  position: relative;
  z-index: 1;
}
.chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--rose-soft);
  background: var(--rose-bg);
  color: var(--rose);
  font-family: var(--font-pixel);
  font-size: 10px;
  transition: all 0.15s ease;
}
.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.chip.active {
  background: var(--rose) !important;
  color: white !important;
  border-color: var(--rose-deep) !important;
  box-shadow: 1px 1px 0 var(--rose-deep);
}
.chip[data-cat="Philosophy"]    { background: var(--purple-bg); color: var(--purple); border-color: var(--purple); }
.chip[data-cat="Self-Help"]     { background: var(--rose-bg);   color: var(--rose);   border-color: var(--rose-soft); }
.chip[data-cat="Psychology"]    { background: var(--blue-bg);   color: var(--blue);   border-color: var(--blue); }
.chip[data-cat="Business"]      { background: var(--amber-bg);  color: var(--amber);  border-color: var(--amber); }
.chip[data-cat="Science"]       { background: var(--green-bg);  color: var(--green);  border-color: var(--green); }
.chip[data-cat="Spirituality"]  { background: var(--indigo-bg); color: var(--indigo); border-color: var(--indigo); }

/* ============================================================
   Section heading & decorative dividers
   ============================================================ */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 22px 4px 12px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--font-cute);
  font-size: clamp(22px, 4vw, 28px);
  color: var(--rose);
  margin: 0;
  text-shadow: 1px 1px 0 var(--rose-soft);
}
.section-head .count {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--ink-mute);
}

.divider {
  height: 14px;
  margin: 12px 0;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='14' viewBox='0 0 30 14'><g fill='%23d05f87'><path d='M15 4 l-3 -3 a2.2 2.2 0 1 1 3 -3 a2.2 2.2 0 1 1 3 3 z' transform='translate(0 4)'/><circle cx='3' cy='7' r='1.4' fill='%23ffb3cc'/><circle cx='27' cy='7' r='1.4' fill='%23ffb3cc'/></g></svg>") repeat-x;
  background-size: 30px 14px;
  background-position: center;
  opacity: 0.85;
}

/* ============================================================
   Library grid + book cards
   ============================================================ */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 22px; } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1180px){ .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease;
}
.card:nth-child(odd)  { transform: rotate(-1deg); }
.card:nth-child(even) { transform: rotate(1deg); }
.card:hover { transform: rotate(0deg) translateY(-3px); }

.card-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 7px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-cover::after {
  /* corner star sticker */
  content: "✦";
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 14px;
  color: var(--amber);
  opacity: 0.85;
  text-shadow: 0 0 2px white;
  z-index: 2;
}
.card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 8px;
  transition: transform 0.4s ease;
}
.card:hover .card-cover img { transform: scale(1.04); }

.tape {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 64px;
  height: 16px;
  background:
    repeating-linear-gradient(45deg, var(--tape) 0 4px, #ffdb78 4px 8px);
  opacity: 0.9;
  border-radius: 2px;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.08);
  z-index: 2;
}

.card-meta h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 15px;
  margin: 0;
  line-height: 1.25;
  color: var(--ink);
  transition: color 0.2s ease;
}
.card:hover .card-meta h3 { color: var(--rose); }
.card-meta p {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--ink-mute);
  margin: 2px 0 0;
}

.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-pixel);
  font-size: 9px;
  border: 1px solid currentColor;
  margin-top: 4px;
}
.cat-badge[data-cat="Philosophy"]    { background: var(--purple-bg); color: var(--purple); }
.cat-badge[data-cat="Self-Help"]     { background: var(--rose-bg);   color: var(--rose); }
.cat-badge[data-cat="Psychology"]    { background: var(--blue-bg);   color: var(--blue); }
.cat-badge[data-cat="Business"]      { background: var(--amber-bg);  color: var(--amber); }
.cat-badge[data-cat="Science"]       { background: var(--green-bg);  color: var(--green); }
.cat-badge[data-cat="Spirituality"]  { background: var(--indigo-bg); color: var(--indigo); }

/* ============================================================
   Pills (small handmade buttons)
   ============================================================ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--rose);
  text-decoration: none;
  box-shadow: 1px 1px 0 var(--rose-deep);
  transition: transform 0.12s ease, background 0.12s ease;
}
.pill:hover { transform: translateY(-1px); background: var(--rose-bg); }

.pill.icon {
  padding: 4px 9px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
}

/* ============================================================
   Empty + footer note
   ============================================================ */

.empty {
  text-align: center;
  padding: 50px 20px;
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty h3 {
  font-family: var(--font-cute);
  font-size: 26px;
  color: var(--rose);
  margin: 0 0 6px;
}
.empty p { color: var(--ink-soft); margin: 0 0 14px; font-family: var(--font-pixel); font-size: 11px; }

.footer-note {
  margin: 40px 0 16px;
  text-align: center;
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
}
.footer-note p:first-child {
  font-family: var(--font-cute);
  font-size: 22px;
  color: var(--rose);
  margin: 0;
}
.footer-note p:last-child {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--ink-mute);
  margin: 4px 0 0;
}
.footer-note::before, .footer-note::after {
  content: "♡";
  position: absolute;
  top: -10px;
  font-size: 18px;
  color: var(--rose);
  background: var(--bg);
  padding: 0 6px;
}
.footer-note::before { left: 30%; }
.footer-note::after  { right: 30%; }

/* ============================================================
   BOOK DETAIL PAGE
   ============================================================ */

.detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: 16px;
}
@media (min-width: 760px) {
  .detail { grid-template-columns: 280px 1fr; gap: 32px; }
}

.detail-cover {
  position: relative;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 10px;
  box-shadow: var(--shadow);
  max-width: 280px;
  margin: 0 auto;
}
.detail-cover::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius-lg) - 2px);
  pointer-events: none;
}
@media (min-width: 760px) { .detail-cover { margin: 0; } }
.detail-cover .img-wrap {
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }

.detail-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.narrator-card {
  position: relative;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-soft);
}
.narrator-card .avatar {
  width: 56px; height: 56px;
  margin-top: 0;
}
.narrator-card .text p:first-child {
  font-family: var(--font-cute);
  font-size: 18px;
  color: var(--rose);
  margin: 0;
}
.narrator-card .text p:last-child {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--ink-mute);
  margin: 2px 0 0;
}

.detail-content {
  position: relative;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow);
}
.detail-content::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius-lg) - 2px);
  pointer-events: none;
}
@media (min-width: 720px) { .detail-content { padding: 30px 34px; } }

.detail-content > * { position: relative; z-index: 1; }

.detail-content h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(24px, 4.5vw, 38px);
  margin: 12px 0 6px;
  line-height: 1.15;
}
.detail-content .author {
  font-family: var(--font-cute);
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 0 16px;
}
.detail-content .lede {
  font-size: 15px;
  color: var(--ink);
  line-height: 1.65;
  margin: 0 0 22px;
}

.takeaways-title {
  font-family: var(--font-cute);
  font-size: 22px;
  color: var(--rose);
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 2px dashed var(--border);
}

.takeaways {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.takeaways li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.takeaways .num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--rose-bg);
  border: 1.5px solid var(--border-strong);
  color: var(--rose);
  font-family: var(--font-pixel);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.takeaways .text { font-size: 14px; line-height: 1.6; color: var(--ink); }

/* ============================================================
   Action buttons (Read / Listen)
   ============================================================ */

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-strong);
  font-family: var(--font-cute);
  font-size: 22px;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform 0.15s ease, background 0.15s ease;
}
.action-btn:hover { transform: translateY(-2px); }
.action-btn .ico { font-size: 16px; }
.action-btn.read   { background: var(--rose-bg); color: var(--rose); }
.action-btn.read:hover { background: #ffd9e6; }
.action-btn.listen { background: var(--rose); color: #fff; border-color: var(--rose-deep); }
.action-btn.listen:hover { background: var(--rose-deep); }

/* ============================================================
   READ MODE PAGE
   ============================================================ */

.read-page { min-height: 100vh; padding-bottom: 60px; }

.read-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--rose);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 100;
  transition: transform 0.1s linear;
}

.read-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 244, 247, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 2px dashed var(--border);
}
.read-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-cute);
  font-size: 18px;
  color: var(--rose);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}
@media (min-width: 720px) { .read-title { display: block; } }
.font-controls { display: flex; gap: 6px; }

.read-article {
  max-width: 68ch;
  margin: 0 auto;
  padding: 24px 18px;
}

.read-titlecard {
  position: relative;
  text-align: center;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px 22px 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.read-titlecard::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius-lg) - 2px);
  pointer-events: none;
}
.read-titlecard > * { position: relative; z-index: 1; }
.read-titlecard h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(24px, 5vw, 40px);
  margin: 8px 0 6px;
  line-height: 1.15;
}
.read-titlecard .author {
  font-family: var(--font-cute);
  font-size: 18px;
  color: var(--rose);
  margin: 0 0 12px;
}
.read-meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.read-body {
  position: relative;
  background: var(--card);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow);
}
.read-body::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius-lg) - 2px);
  pointer-events: none;
}
.read-body > * { position: relative; z-index: 1; }
@media (min-width: 720px) { .read-body { padding: 32px 36px; } }

.read-body section { margin-bottom: 24px; }
.read-body h2 {
  font-family: var(--font-cute);
  font-size: clamp(20px, 4vw, 28px);
  color: var(--rose);
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.read-body h2::before { content: "✿"; color: var(--amber); }
.read-body p {
  font-family: var(--font-serif);
  line-height: 1.85;
  color: var(--ink);
  margin: 0 0 14px;
}
.read-body section.first p:first-child::first-letter {
  font-family: var(--font-cute);
  font-weight: 700;
  font-size: 3.6em;
  color: var(--rose);
  float: left;
  line-height: 0.85;
  margin: 6px 8px 0 0;
}

.read-footer {
  text-align: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 2px dashed var(--border);
}
.read-footer p {
  font-family: var(--font-cute);
  font-size: 22px;
  color: var(--rose);
  margin: 0 0 12px;
}

.stat-pill {
  font-family: var(--font-pixel);
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--rose-bg);
  color: var(--rose);
}
.stat-pill.purple {
  background: var(--purple-bg);
  color: var(--purple);
  border-color: var(--purple);
}

/* ============================================================
   LISTEN MODE PAGE
   ============================================================ */

.listen-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.listen-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}
.listen-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px 14px;
  box-shadow: var(--shadow-soft);
}
.listen-title h2 {
  font-family: var(--font-cute);
  font-size: 18px;
  color: var(--rose);
  margin: 0;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listen-title p {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--ink-mute);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listen-stage {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 14px 200px;
  z-index: 2;
}

.stage-glow {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, 90vw);
  height: min(560px, 90vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 200, 215, 0.55), transparent 65%);
  filter: blur(40px);
  z-index: -1;
  animation: stage-pulse 5s ease-in-out infinite;
}
@keyframes stage-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: 0.7; }
  50%      { transform: translate(-50%, -50%) scale(1.08); opacity: 1; }
}

.stage-avatar { position: relative; z-index: 2; }
.stage-avatar .avatar {
  margin-top: 0;
  width: 420px !important; height: 420px !important;
}
.stage-avatar .avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}
@media (max-width: 600px) {
  .stage-avatar .avatar { width: 320px !important; height: 320px !important; }
}
.stage-avatar.speaking .avatar img {
  animation: avatar-bob 1.2s ease-in-out infinite, avatar-blink-fx 5.5s ease-in-out infinite !important;
}

.caption {
  margin-top: 22px;
  max-width: 640px;
  width: 100%;
  text-align: center;
  font-family: var(--font-serif);
  font-size: clamp(15px, 2.5vw, 18px);
  line-height: 1.65;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  min-height: 3.5em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.listen-controls {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(255, 244, 247, 0.96);
  backdrop-filter: blur(8px);
  border-top: 2px dashed var(--border);
  padding: 10px 14px 14px;
  z-index: 50;
}

.progress-bar {
  height: 6px;
  background: var(--rose-bg);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rose), var(--rose-bright));
  width: 0%;
  transition: width 0.3s ease;
}

.controls-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
@media (max-width: 600px) {
  .controls-row { grid-template-columns: 1fr; gap: 8px; }
  .ctrl-group.left  { justify-content: center; flex-wrap: wrap; }
  .ctrl-group.right { justify-content: center; }
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ctrl-group.center { justify-content: center; }
.ctrl-group.right  { justify-content: flex-end; }

.ctrl-label {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--ink-mute);
}

.ctrl-select {
  font-family: var(--font-pixel);
  font-size: 11px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 5px 9px;
  outline: none;
  cursor: inherit;
}
.ctrl-select:focus { border-color: var(--rose); }
.voice-select { max-width: 160px; text-overflow: ellipsis; }
@media (max-width: 600px) { .voice-select { max-width: 140px; } }

.ctrl-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--card);
  color: var(--rose);
  font-size: 15px;
  font-weight: 700;
  transition: transform 0.12s ease, background 0.12s ease;
  box-shadow: 1px 1px 0 var(--rose-deep);
}
.ctrl-icon:hover { background: var(--rose-bg); transform: translateY(-1px); }

.ctrl-play {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--rose);
  color: white;
  font-size: 20px;
  border: 2px solid var(--rose-deep);
  box-shadow: 2px 2px 0 var(--rose-deep);
  transition: transform 0.12s ease;
}
.ctrl-play:hover:not(:disabled) { transform: scale(1.05); }
.ctrl-play:active:not(:disabled) { transform: scale(0.96); }
.ctrl-play:disabled { opacity: 0.5; cursor: not-allowed; }

.progress-text {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--ink-mute);
}

/* ============================================================
   Cursor sparkle trail
   ============================================================ */
.cursor-spark {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  font-size: 14px;
  user-select: none;
  animation: spark-fade 0.7s ease-out forwards;
}
@keyframes spark-fade {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(180deg) translateY(20px); }
}

/* ============================================================
   Loading state + page-fade
   ============================================================ */
.loading {
  text-align: center;
  padding: 80px 20px;
  font-family: var(--font-cute);
  font-size: 22px;
  color: var(--rose);
}
.page-fade { animation: pageFade 0.45s ease both; }
@keyframes pageFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.back-link {
  margin-bottom: 8px;
}

/* ============================================================
   Cover fallback (shown when image is missing)
   ============================================================ */

.cover-fallback {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  text-align: center;
}
.cover-fallback-icon {
  font-size: 36px;
  opacity: 0.7;
  line-height: 1;
}
.cover-fallback-title {
  font-family: var(--font-cute);
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
}
.cover-fallback-author {
  font-family: var(--font-pixel);
  font-size: 10px;
  opacity: 0.7;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}