/* =============================================================
   Olivia's Bookshelf — glossy y2k ✨
   White-space-forward layout (pinterest energy) with gel buttons,
   chrome-gradient headings, and sparkle accents.
   ============================================================= */
:root {
  --bg: #fdfafd;
  --card: #ffffff;
  --ink: #2b2135;
  --muted: #94879f;
  --faint: #b9aec3;
  --pink: #ff5eb8;
  --pink-deep: #ef3fa5;
  --lilac: #a78bfa;
  --blue: #7cc8ff;
  --gold: #ffb547;
  --danger: #e8617e;
  --border: #f2e7f2;
  --border-strong: #e9d8ea;
  --grad: linear-gradient(135deg, #ff8ad1, #ff5eb8 52%, #b98aff);
  --grad-soft: linear-gradient(135deg, #ffe3f3, #efe4ff);
  --chrome: linear-gradient(178deg, #c39bf5 0%, #ff6cc0 55%, #ff90cf 100%);
  --radius: 18px;
  --shadow-card: 0 1px 2px rgba(72, 42, 92, 0.06), 0 10px 30px -12px rgba(150, 90, 170, 0.18);
  --shadow-pop: 0 18px 40px -14px rgba(210, 70, 160, 0.35);
  --font-display: "Unbounded", "Outfit", sans-serif;
  font-family: Outfit, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

::selection { background: #ffd3ec; color: var(--ink); }

body {
  margin: 0;
  background:
    radial-gradient(700px 340px at 92% -6%, rgba(255, 188, 228, 0.35) 0%, rgba(255, 188, 228, 0) 60%),
    radial-gradient(640px 320px at 4% 4%, rgba(196, 178, 255, 0.28) 0%, rgba(196, 178, 255, 0) 58%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.6;
  font-weight: 400;
}

a { color: var(--pink-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 2px; }

h1, h2 { font-family: var(--font-display); letter-spacing: -0.01em; }

/* ---- Header ---- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 2.2rem);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 700;
  background: var(--chrome);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.01em;
}
.brand:hover { text-decoration: none; filter: brightness(1.06); }

.site-header nav { display: flex; align-items: center; gap: 0.15rem; }

.site-header nav a {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  transition: background 0.15s ease;
}
.site-header nav a:hover { background: #f7ecf7; text-decoration: none; }

.nav-user { margin-left: 0.6rem; color: var(--faint); font-size: 0.85rem; }
.logout-form { display: inline; margin-left: 0.2rem; }

.linklike {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
}
.linklike:hover { background: #f7ecf7; color: var(--ink); }

/* ---- Layout ---- */
.content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.2rem) 3.5rem;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 700;
  background: linear-gradient(120deg, var(--ink) 30%, #7d5aa6 75%, var(--pink-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hint { color: var(--muted); margin-top: -0.6rem; font-size: 0.95rem; }
.empty-state { color: var(--muted); text-align: center; padding: 3rem 0; font-size: 1rem; }
.empty-state::before { content: "✦"; display: block; font-size: 1.4rem; color: #eccfe9; margin-bottom: 0.4rem; }

/* ---- Buttons (gel / glossy) ---- */
.button {
  position: relative;
  display: inline-block;
  background: var(--grad);
  color: #fff;
  padding: 0.62rem 1.35rem;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  isolation: isolate;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -6px 12px rgba(160, 30, 120, 0.25),
    0 6px 18px -6px rgba(230, 70, 160, 0.55);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.button::before {
  /* y2k gel gloss cap */
  content: "";
  position: absolute;
  inset: 2px 8% auto 8%;
  height: 42%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.05));
  pointer-events: none;
}
.button:hover {
  transform: translateY(-1px);
  filter: saturate(1.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -6px 12px rgba(160, 30, 120, 0.25),
    0 10px 24px -8px rgba(230, 70, 160, 0.65);
  text-decoration: none;
}
.button.secondary {
  background: #fff;
  color: var(--pink-deep);
  border: 1.5px solid var(--border-strong);
  box-shadow: 0 2px 8px -2px rgba(150, 90, 170, 0.12);
}
.button.secondary::before { display: none; }
.button.secondary:hover { border-color: #f3b9e0; background: #fff7fc; filter: none; }
.button.danger { background: linear-gradient(135deg, #ff8fa8, var(--danger)); }
.button:disabled {
  background: #eee3ee;
  color: var(--faint);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.button:disabled::before { display: none; }

input[type="search"], input[type="text"], input[type="password"],
input[type="number"], input[type="date"], input[type="file"], textarea, select {
  font-family: inherit;
  font-size: 0.97rem;
  font-weight: 500;
  padding: 0.66rem 1rem;
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea, input[type="file"] { border-radius: 16px; }
input:focus, textarea:focus, select:focus {
  border-color: #ff9ed3;
  box-shadow: 0 0 0 3px rgba(255, 94, 184, 0.14);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

/* ---- Toolbar / filters ---- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

#search-input { flex: 1; min-width: 220px; }

.filter-group { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.filter-btn, .tag-chip {
  background: var(--card);
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s ease;
}
.filter-btn:hover, .tag-chip:hover { border-color: #f3b9e0; color: var(--pink-deep); }
.filter-btn.active, .tag-chip.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px -4px rgba(230, 70, 160, 0.5);
}

.search-form { display: flex; gap: 0.6rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.search-form input { flex: 1; min-width: 200px; }

/* ---- Book grid (the shelf) ---- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 1.6rem 1.15rem;
}

.book-card { display: block; text-decoration: none; color: inherit; }
.book-card:hover { text-decoration: none; }

/* ---- Spine view ---- */
.shelf-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}
.shelf-controls .tag-filters { margin-bottom: 0; flex: 1; }
.view-toggle { flex-shrink: 0; }

.spine-shelf {
  --slot-h: 196px;
  --shelf-gap: 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  column-gap: 5px;
  padding: 0 10px;
  /* One soft shelf line per row, drawn under the spines' baseline. */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent var(--slot-h),
    #e7d6e9 var(--slot-h),
    #dcc7de calc(var(--slot-h) + 3px),
    rgba(160, 120, 170, 0.14) calc(var(--slot-h) + 3px),
    rgba(160, 120, 170, 0) calc(var(--slot-h) + 10px),
    transparent calc(var(--slot-h) + var(--shelf-gap))
  );
}

.spine {
  width: var(--spine-w, 44px);
  height: var(--slot-h);
  margin-bottom: var(--shelf-gap);
  display: flex;
  align-items: flex-end;
  text-decoration: none;
}
.spine:hover { text-decoration: none; }

.spine-body {
  position: relative;
  width: 100%;
  height: var(--spine-h, 170px);
  border-radius: 4px 4px 2px 2px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--spine-bg, var(--grad));
  box-shadow: 1px 2px 7px rgba(120, 80, 140, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.spine:hover .spine-body {
  transform: translateY(-8px);
  box-shadow: 2px 10px 18px rgba(120, 80, 140, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

/* Blurred cover art gives each spine the book's own palette. */
.spine-art {
  position: absolute;
  inset: -25%;
  background-size: cover;
  background-position: center;
  filter: blur(7px) saturate(1.25);
}
/* Scrim so the title stays readable over any artwork. */
.spine-body::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg, rgba(35, 15, 45, 0.42), rgba(35, 15, 45, 0.12) 45%, rgba(35, 15, 45, 0.5)
  );
}

.spine-label {
  position: relative;
  z-index: 2;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  max-height: 84%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spine-mark {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(40, 20, 50, 0.35);
}
.spine-mark.finished {
  width: auto;
  height: auto;
  background: none;
  box-shadow: none;
  font-size: 0.62rem;
  line-height: 1;
}

.book-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 16px;
  overflow: hidden;
  background: #f4ebf5;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.book-card:hover .book-cover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-pop);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Pastel title card shown wherever a cover is missing or fails to load. */
.book-cover.placeholder,
.poster-img.placeholder,
.cover-large.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem;
  background: var(--ph-bg, var(--grad-soft));
}
.ph-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ph-fg, #7d5aa6);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--pink-deep);
  box-shadow: 0 2px 8px rgba(80, 40, 90, 0.18);
  backdrop-filter: blur(4px);
}

.book-meta { padding: 0.55rem 0.2rem 0; }
.book-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-author {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Poster browse (Find Books) ---- */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.4rem 1.1rem;
  padding: 4px 0;
}

.poster {
  position: relative;
  border: none;
  padding: 0;
  background: #f4ebf5;
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.poster:hover,
.poster:focus-visible {
  transform: translateY(-4px);
  box-shadow: var(--shadow-pop);
  outline: none;
}
.poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.poster-img.placeholder { aspect-ratio: 2 / 3; }
.poster-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.4rem 0.6rem 0.55rem;
  background: linear-gradient(to top, rgba(43, 20, 55, 0.85), rgba(43, 20, 55, 0));
  color: #fff;
  opacity: 0;
  transition: opacity 0.18s ease;
  text-align: left;
}
.poster:hover .poster-overlay,
.poster:focus-visible .poster-overlay { opacity: 1; }
.poster-title {
  font-size: 0.8rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(46, 24, 60, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
}
.modal {
  position: relative;
  background: var(--card);
  border: 1px solid #fff;
  border-radius: 24px;
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  display: flex;
  gap: 1.4rem;
  padding: 1.7rem;
  box-shadow: 0 30px 80px -20px rgba(60, 25, 80, 0.5);
}
.modal .cover-large { width: 170px; border-radius: 14px; }
.modal-body { flex: 1; min-width: 220px; }
.modal-body h2 { margin: 0 0 0.15rem; font-size: 1.25rem; }
.modal-body .author { color: var(--muted); font-weight: 500; }
.modal-body .meta { color: var(--faint); font-size: 0.83rem; margin: 0.2rem 0 0.6rem; }
.modal-body .description {
  font-size: 0.9rem;
  margin: 0.6rem 0 0;
  max-height: 40vh;
  overflow: auto;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: #f6ecf6;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
}
.modal-close:hover { background: #efdff0; color: var(--ink); }

/* ---- Book detail ---- */
.back-link { display: inline-block; margin-bottom: 1.1rem; font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.back-link:hover { color: var(--pink-deep); text-decoration: none; }

.book-detail {
  display: flex;
  gap: 1.9rem;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.8rem;
  box-shadow: var(--shadow-card);
}

.cover-large {
  width: 180px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 14px 30px -10px rgba(120, 60, 140, 0.35);
}
.cover-large.placeholder { aspect-ratio: 2 / 3; }
.cover-large.placeholder .ph-title { font-size: 1.05rem; -webkit-line-clamp: 6; }

.cover-wrap { flex-shrink: 0; display: flex; flex-direction: column; gap: 0.6rem; align-items: center; }
.cover-change-btn {
  background: #fff;
  color: var(--pink-deep);
  border: 1.5px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cover-change-btn:hover { border-color: #f3b9e0; background: #fff7fc; }

.cover-picker { max-width: 560px; }
.cover-picker-body { flex: 1; }
.cover-picker-body h2 { margin: 0 0 0.15rem; font-size: 1.2rem; }
.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}
.cover-option {
  position: relative;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f4ebf5;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.cover-option:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.cover-option.current { border-color: var(--pink); }
.cover-option img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-current-tag {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--pink);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 0.15rem;
  text-align: center;
}

.book-detail-main { flex: 1; min-width: 240px; }
.book-detail-main h2 { margin: 0 0 0.15rem; font-size: 1.35rem; }
.book-detail-main .author { color: var(--muted); margin-bottom: 0.75rem; font-weight: 500; }
.book-detail-main .description { font-size: 0.92rem; margin-bottom: 1.25rem; color: #554962; }

.field-row { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1rem; }

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.star-picker { display: inline-flex; gap: 0.2rem; font-size: 1.5rem; cursor: pointer; }
.star-picker .star { color: #eadcea; transition: transform 0.12s ease, color 0.12s ease; }
.star-picker .star:hover { transform: scale(1.2); }
.star-picker .star.filled { color: var(--gold); }

.stars { color: var(--gold); font-size: 0.95rem; letter-spacing: 1px; }

textarea { width: 100%; min-height: 90px; resize: vertical; }

.actions-row { display: flex; gap: 0.6rem; margin-top: 1.25rem; flex-wrap: wrap; }

.extension-point {
  margin-top: 1.6rem;
  padding: 1.1rem 1.2rem;
  border: 1.5px dashed var(--border-strong);
  border-radius: 16px;
  color: var(--muted);
  font-size: 0.9rem;
  background: #fdf8fd;
}
.extension-point strong { color: var(--ink); }

/* ---- Auth ---- */
.auth-card {
  position: relative;
  max-width: 390px;
  margin: 3.2rem auto;
  background: var(--card);
  border: 1px solid #fff;
  border-radius: 26px;
  padding: 2.2rem 2rem;
  box-shadow: 0 1px 2px rgba(72, 42, 92, 0.05), 0 24px 60px -20px rgba(160, 80, 180, 0.3);
}
.auth-card::before {
  /* soft y2k glow behind the card */
  content: "";
  position: absolute;
  inset: -40px -60px auto;
  height: 180px;
  background:
    radial-gradient(200px 120px at 20% 40%, rgba(255, 138, 209, 0.25), transparent 70%),
    radial-gradient(220px 130px at 80% 30%, rgba(167, 139, 250, 0.22), transparent 70%);
  z-index: -1;
  pointer-events: none;
}
.auth-card h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }

.auth-form { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1.4rem; }
.auth-form label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.auth-form input { margin-bottom: 0.8rem; }
.auth-form .button { margin-top: 0.5rem; }

/* The "make an account" / "sign in" line under the form needs breathing
   room from the button (base .hint pulls itself up under headings). */
.auth-form + .hint { margin-top: 1.2rem; margin-bottom: 0; }

.auth-error {
  background: #fdeaef;
  color: #c2456a;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0.6rem 0 0;
}

/* ---- Account page ---- */
.account-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 1.6rem 1.7rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-card);
  max-width: 620px;
}
.account-card h2 { margin: 0 0 0.3rem; font-size: 1.1rem; }
.account-card .auth-form { max-width: 340px; }

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}
.user-row:first-child { border-top: none; }
.user-info { display: flex; flex-direction: column; }
.user-meta { color: var(--muted); font-size: 0.82rem; }

.temp-password {
  flex-basis: 100%;
  background: var(--grad-soft);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  margin: 0.2rem 0 0;
  font-size: 0.92rem;
}
.temp-password code {
  font-size: 1.02rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.75);
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
  user-select: all;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(40, 20, 55, 0.35);
  z-index: 60;
}
.toast.error { background: var(--danger); }

/* ---- Reading goal card + progress ring ---- */
.goal-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}
.goal-text { display: flex; flex-direction: column; gap: 0.15rem; }
.goal-text strong { font-size: 1rem; }
.goal-text span { color: var(--muted); font-size: 0.9rem; }
.goal-text a { font-weight: 600; font-size: 0.87rem; margin-top: 0.15rem; }
.goal-set { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.goal-set input { width: 110px; }

.ring { flex-shrink: 0; }
.ring-track { fill: none; stroke: #f3e8f3; stroke-width: 8; }
.ring-fill {
  fill: none;
  stroke: var(--pink);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease;
}
.ring-text {
  fill: var(--ink);
  font-size: 19px;
  font-weight: 600;
  text-anchor: middle;
  font-family: Outfit, sans-serif;
}

/* ---- Recap / stats page ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.6rem;
}
.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.2rem 1rem 1.05rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}
.stat-label { color: var(--muted); font-size: 0.82rem; margin-top: 0.3rem; }
.recap-goal { max-width: 440px; }
.recap-subhead { font-size: 1.05rem; margin: 1.4rem 0 0.75rem; }
.top-list { list-style: none; padding: 0; margin: 0; }
.top-list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.65rem 1rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(72, 42, 92, 0.04);
}
.top-stars { color: var(--gold); }
.top-author { color: var(--muted); font-size: 0.86rem; }

/* ---- Tags / shelves ---- */
.find-covers-btn { margin-bottom: 1.4rem; font-size: 0.86rem; padding: 0.45rem 1rem; }

.tag-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.4rem; }
.tag-chip { padding: 0.32rem 0.85rem; }
.tag-count { opacity: 0.65; font-size: 0.76rem; }

.tag-editor { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.tag-chip.solid {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--grad-soft);
  color: #7d5aa6;
  border: none;
  cursor: default;
}
.tag-remove {
  border: none;
  background: rgba(125, 90, 166, 0.14);
  color: #7d5aa6;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.68rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.tag-remove:hover { background: rgba(125, 90, 166, 0.28); }
.tag-add { display: flex; gap: 0.5rem; }
.tag-add input { flex: 1; }

/* ---- Barcode scanner ---- */
.scanner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.scanner-inner {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: #241a30;
  aspect-ratio: 4 / 3;
}
#scanner-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-reticle {
  position: absolute;
  inset: 25% 12%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  box-shadow: 0 0 0 2000px rgba(30, 18, 45, 0.3);
}
.scanner-manual {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 0.8rem 0;
  flex-wrap: wrap;
}
.scanner-manual input { max-width: 220px; }

@media (max-width: 560px) {
  .site-header { flex-wrap: wrap; justify-content: center; gap: 0.3rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .modal { flex-direction: column; }
  .modal .cover-large { width: 130px; align-self: center; }
  .goal-card { flex-direction: column; text-align: center; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 1.2rem 0.85rem; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); }
}
