/* Vellum — A personal reading journal
   © אופיר ברנס (Ofir Baranes) 2026 — כל הזכויות שמורות
*/

:root {
  --bg-0: #110d08;
  --bg-1: #15110a;
  --bg-2: #1b160e;
  --surface: rgba(245, 236, 217, 0.045);
  --surface-2: rgba(245, 236, 217, 0.07);
  --line: rgba(245, 236, 217, 0.10);
  --line-strong: rgba(245, 236, 217, 0.18);
  --bone: #f5ecd9;
  --bone-soft: #e6dcc4;
  --bone-mute: rgba(245, 236, 217, 0.62);
  --bone-dim: rgba(245, 236, 217, 0.40);
  --ink: #1b2438;
  --acc: #c0584d;
  --acc-2: #a14545;
  --gold: #c9a96e;
  --rose: #c08a8a;
  --jade: #7a9a7e;
  --navy-acc: #5f7aa1;
  --good: #8fa37a;
  --warn: #c9a96e;
  --bad: #b35453;
  --shadow-lg: 0 28px 64px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.35);
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

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

html, body {
  background: var(--bg-0);
  color: var(--bone);
  font-family: 'Heebo', system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'kern';
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(193, 169, 110, 0.10), transparent 60%),
    radial-gradient(ellipse 70% 60% at 0% 100%, rgba(161, 69, 69, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 50%, var(--bg-0));
  min-height: 100vh;
  padding-bottom: 120px;
  position: relative;
}

button { font-family: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }

/* AMBIENT BG */
.ambient-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
.orb-blur {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.45;
  mix-blend-mode: screen;
  animation: drift 32s ease-in-out infinite;
}
.orb-blur.o1 { width: 480px; height: 480px; top: -100px; right: -120px; background: radial-gradient(circle, rgba(193, 169, 110, 0.55), transparent 70%); }
.orb-blur.o2 { width: 420px; height: 420px; bottom: -120px; left: -80px; background: radial-gradient(circle, rgba(161, 69, 69, 0.45), transparent 70%); animation-delay: -10s; }
.orb-blur.o3 { width: 320px; height: 320px; top: 40%; left: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(95, 122, 161, 0.30), transparent 70%); animation-delay: -20s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -30px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.grain {
  position: absolute; inset: 0; opacity: 0.10; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.96  0 0 0 0 0.92  0 0 0 0 0.85  0 0 0 0.35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.motes {
  position: absolute; inset: 0; overflow: hidden;
}
.mote {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: rgba(245, 236, 217, 0.6);
  filter: blur(0.5px);
  animation: float 18s linear infinite;
}

@keyframes float {
  0% { transform: translateY(110vh) translateX(0); opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-10vh) translateX(40px); opacity: 0; }
}

/* TOPBAR */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(17, 13, 8, 0.92), rgba(17, 13, 8, 0.55) 60%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.brand {
  display: flex; align-items: center; gap: 11px;
  font-family: 'Frank Ruhl Libre', serif;
  font-weight: 700; font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--bone);
}
.brand .mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(160deg, rgba(193, 169, 110, 0.20), rgba(161, 69, 69, 0.12));
  border: 1px solid var(--line);
  color: var(--gold);
}
.brand .mark svg { width: 24px; height: 24px; }

.header-actions { display: flex; gap: 6px; align-items: center; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: var(--bone-mute);
  transition: all 0.25s var(--ease);
  border: 1px solid transparent;
  font-size: 22px;
}
.icon-btn:hover {
  background: var(--surface);
  border-color: var(--line);
  color: var(--bone);
  transform: translateY(-1px);
}
.icon-btn svg { width: 20px; height: 20px; }

.install-btn {
  padding: 9px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  color: var(--bone);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(161, 69, 69, 0.35);
  transition: transform 0.25s var(--spring);
}
.install-btn:hover { transform: translateY(-2px) scale(1.02); }
.install-btn.hidden { display: none; }

/* MAIN */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 18px 0;
  position: relative;
  z-index: 1;
}

/* HERO */
.hero {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  margin: 14px 0 22px;
  min-height: 320px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transform: scale(1.05);
  transition: transform 14s var(--ease);
  z-index: -2;
}
.hero:hover .hero-bg { transform: scale(1.10); }
.hero-veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(110deg, rgba(17, 13, 8, 0.85) 30%, rgba(17, 13, 8, 0.55) 60%, rgba(17, 13, 8, 0.25)),
    radial-gradient(circle at 80% 30%, rgba(193, 169, 110, 0.18), transparent 50%);
  z-index: -1;
}
.hero-inner {
  padding: 38px 32px;
  display: flex; flex-direction: column; gap: 18px;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold);
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.hero-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--bone);
}
.hero-title .serif { display: inline-block; }
.hero-title .block { display: block; }
.hero-title em {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-weight: 500;
  color: var(--gold);
}

.hero-sub {
  font-size: 15px;
  line-height: 1.7;
  color: var(--bone-mute);
  max-width: 580px;
}

.hero-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.hero-stat {
  display: flex; flex-direction: column; gap: 2px;
}
.hero-stat-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 400;
  color: var(--bone);
  letter-spacing: -0.02em;
}
.hero-stat-lbl {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bone-dim);
}

/* PANEL */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 18px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-md);
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
}
.panel:hover {
  border-color: var(--line-strong);
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.panel-titles { display: flex; flex-direction: column; gap: 2px; }
.panel-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--acc);
}
.panel-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--bone);
}

/* TODAY PANEL */
.today-panel { padding: 28px; }
.today-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: stretch;
}
.today-current {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.today-current-label, .today-log-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.current-book {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.cb-empty {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  color: var(--bone-mute);
  font-size: 18px;
}
.cb-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--bone);
  line-height: 1.3;
}
.cb-author {
  font-size: 13px;
  color: var(--bone-mute);
}
.today-progress {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 6px;
}
.prog-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--bone-mute);
  margin-bottom: 8px;
}
.prog-page { font-size: 16px; color: var(--bone); font-weight: 500; }
.prog-bar {
  height: 6px; border-radius: 999px;
  background: rgba(245, 236, 217, 0.08);
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--acc));
  border-radius: 999px;
  transition: width 0.6s var(--ease);
}
.prog-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--bone-dim);
  font-family: 'IBM Plex Mono', monospace;
}

.today-log {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.today-counter {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 4px 0;
}
.counter-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 22px; font-weight: 300;
  color: var(--bone);
  transition: all 0.25s var(--spring);
}
.counter-btn:active { transform: scale(0.9); }
.counter-btn:hover { background: var(--surface-2); border-color: var(--gold); }
#counterValue {
  width: 100px;
  background: transparent;
  border: none;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 36px;
  font-weight: 300;
  color: var(--bone);
  outline: none;
}
#counterValue::-webkit-outer-spin-button,
#counterValue::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.counter-presets {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.preset {
  padding: 7px 0;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--bone-mute);
  transition: all 0.25s var(--ease);
}
.preset:hover { color: var(--bone); border-color: var(--gold); }
.preset:active { transform: scale(0.95); }

.primary-btn {
  width: 100%;
  padding: 12px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  color: var(--bone);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(161, 69, 69, 0.32);
  transition: transform 0.3s var(--spring), box-shadow 0.3s var(--ease);
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(161, 69, 69, 0.45); }
.primary-btn:active { transform: scale(0.98); }

.today-goal {
  font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--bone-dim);
  text-align: center;
  letter-spacing: 0.06em;
}

/* STREAK RING */
.streak-ring {
  position: relative;
  width: 64px; height: 64px;
  flex-shrink: 0;
}
.streak-ring svg {
  width: 64px; height: 64px;
  transform: rotate(-90deg);
}
.ring-track {
  fill: none; stroke: rgba(245, 236, 217, 0.10); stroke-width: 4;
}
.ring-fill {
  fill: none; stroke: var(--gold); stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 176;
  stroke-dashoffset: 176;
  transition: stroke-dashoffset 1.2s var(--ease);
}
.streak-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  line-height: 1;
}
.streak-inner span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 20px;
  color: var(--bone);
}
.streak-inner small {
  font-size: 9px; color: var(--bone-dim);
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-top: 2px;
}

/* HEATMAP */
.legend {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--bone-dim);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.06em;
}
.lg-cell {
  width: 12px; height: 12px; border-radius: 3px;
}
.lg-cell.l0 { background: rgba(245, 236, 217, 0.05); }
.lg-cell.l1 { background: rgba(193, 169, 110, 0.30); }
.lg-cell.l2 { background: rgba(193, 169, 110, 0.55); }
.lg-cell.l3 { background: rgba(193, 169, 110, 0.80); }
.lg-cell.l4 { background: var(--gold); }

.heatmap-wrap {
  overflow-x: auto;
  margin: 0 -8px;
  padding: 0 8px;
}
.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
  height: 130px;
  min-width: 100%;
  direction: ltr;
}
.hm-cell {
  width: 14px;
  border-radius: 3px;
  background: rgba(245, 236, 217, 0.05);
  transition: all 0.25s var(--ease);
  cursor: default;
}
.hm-cell:hover { transform: scale(1.4); z-index: 2; }
.hm-cell.l1 { background: rgba(193, 169, 110, 0.30); }
.hm-cell.l2 { background: rgba(193, 169, 110, 0.55); }
.hm-cell.l3 { background: rgba(193, 169, 110, 0.80); }
.hm-cell.l4 { background: var(--gold); box-shadow: 0 0 6px rgba(201, 169, 110, 0.5); }

.trend-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.trend-cell { display: flex; flex-direction: column; gap: 3px; }
.trend-lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--bone-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.trend-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  color: var(--bone);
  letter-spacing: -0.02em;
}

.sparkline-svg {
  width: 100%;
  height: 60px;
  margin-top: 4px;
}

/* LIBRARY */
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.seg-btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--bone-mute);
  transition: all 0.3s var(--ease);
  white-space: nowrap;
}
.seg-btn.active {
  background: var(--bone);
  color: var(--bg-1);
  font-weight: 600;
}
.seg-btn:not(.active):hover { color: var(--bone); }

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.book-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  cursor: pointer;
  transition: all 0.35s var(--spring);
  position: relative;
  overflow: hidden;
}
.book-card::before {
  content: '';
  position: absolute; right: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--gold), var(--acc));
  opacity: 0.6;
}
.book-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: rgba(245, 236, 217, 0.08);
}
.book-card.current::before { background: linear-gradient(180deg, var(--acc), var(--acc-2)); opacity: 1; box-shadow: 0 0 12px var(--acc); }
.book-card.finished::before { background: var(--jade); opacity: 0.8; }
.book-card.wishlist::before { background: var(--rose); opacity: 0.5; }

.bc-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--bone);
  line-height: 1.3;
}
.bc-author {
  font-size: 12px;
  color: var(--bone-mute);
}
.bc-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--bone-dim);
}
.bc-stars { color: var(--gold); letter-spacing: 1px; font-size: 12px; }
.bc-prog {
  height: 3px;
  background: rgba(245, 236, 217, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.bc-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--acc));
  border-radius: 999px;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-img {
  width: 140px; height: 140px;
  opacity: 0.85;
}
.empty-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 19px;
  color: var(--bone);
}
.empty-sub {
  font-size: 13px;
  color: var(--bone-mute);
}

/* INSIGHTS */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.insight-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
  overflow: hidden;
  min-height: 110px;
}
.insight-lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--bone-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.insight-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 30px;
  color: var(--bone);
  letter-spacing: -0.02em;
  margin-top: 4px;
}
.insight-sub {
  font-size: 11px;
  color: var(--bone-dim);
  margin-top: auto;
}

.insight-card.donut {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 14px;
}
.insight-card.donut svg {
  width: 64px; height: 64px;
  transform: rotate(-90deg);
}
.donut-track {
  fill: none; stroke: rgba(245, 236, 217, 0.08); stroke-width: 6;
}
.donut-fill {
  fill: none; stroke: var(--acc); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 201;
  stroke-dashoffset: 201;
  transition: stroke-dashoffset 1.2s var(--ease);
}
.donut-text { display: flex; flex-direction: column; gap: 1px; }
.donut-text span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 19px;
  color: var(--bone);
}
.donut-text small {
  font-size: 10px;
  color: var(--bone-dim);
  letter-spacing: 0.04em;
}

.prediction {
  margin-top: 14px;
  padding: 14px 18px;
  background: linear-gradient(110deg, rgba(193, 169, 110, 0.12), rgba(161, 69, 69, 0.08));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: 'Instrument Serif', serif;
  font-size: 15px;
  font-style: italic;
  line-height: 1.6;
  color: var(--bone);
  position: relative;
}
.prediction::before {
  content: '" ';
  position: absolute;
  top: 8px; right: 14px;
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 32px;
  color: var(--gold);
  opacity: 0.4;
  line-height: 1;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 28px; left: 28px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  display: grid; place-items: center;
  color: var(--bone);
  box-shadow: 0 12px 32px rgba(161, 69, 69, 0.50), 0 0 0 6px rgba(161, 69, 69, 0.08);
  z-index: 40;
  transition: transform 0.4s var(--spring);
}
.fab:hover { transform: translateY(-3px) rotate(90deg) scale(1.05); }
.fab:active { transform: scale(0.92); }
.fab svg { width: 26px; height: 26px; }

/* MODAL */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 6, 4, 0.75);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s var(--ease);
}
.modal-card {
  position: relative;
  background: linear-gradient(160deg, #1e1810, #16110b);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: rise 0.4s var(--spring);
}
.modal-card.wide { max-width: 680px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--bone);
}
.modal-body {
  padding: 22px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.modal-foot {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--bone-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.field input, .field textarea {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--bone);
  font-size: 14px;
  transition: border-color 0.25s var(--ease);
  outline: none;
  width: 100%;
}
.field input:focus, .field textarea:focus { border-color: var(--gold); }
.field textarea { resize: vertical; min-height: 60px; font-family: 'Instrument Serif', serif; font-size: 16px; }

.stars {
  display: flex; gap: 4px;
}
.star {
  font-size: 26px;
  color: rgba(245, 236, 217, 0.18);
  transition: all 0.25s var(--spring);
  padding: 4px 6px;
  line-height: 1;
}
.star.active { color: var(--gold); text-shadow: 0 0 14px rgba(201, 169, 110, 0.5); }
.star:hover { transform: scale(1.2); }

.switch-row { flex-direction: row !important; justify-content: space-between; align-items: center; }
.switch {
  position: relative; width: 44px; height: 24px;
  display: inline-block;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: 0.3s var(--ease);
}
.switch span::before {
  content: ''; position: absolute;
  width: 18px; height: 18px;
  right: 3px; top: 2px;
  background: var(--bone-mute);
  border-radius: 50%;
  transition: 0.3s var(--spring);
}
.switch input:checked + span { background: rgba(193, 169, 110, 0.30); border-color: var(--gold); }
.switch input:checked + span::before { right: 23px; background: var(--gold); }

.accent-row {
  display: flex; gap: 10px;
}
.acc-pill {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--acc);
  border: 2px solid transparent;
  transition: all 0.25s var(--spring);
}
.acc-pill:hover { transform: scale(1.1); }
.acc-pill.active { border-color: var(--bone); box-shadow: 0 0 0 3px rgba(245, 236, 217, 0.15); }

.actions-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 8px;
}

.ghost-btn {
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--bone);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.25s var(--ease);
}
.ghost-btn:hover { border-color: var(--gold); background: var(--surface); }
.ghost-btn.danger { color: var(--bad); }
.ghost-btn.danger:hover { border-color: var(--bad); }

/* INSIGHTS MODAL */
.big-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.bs-card {
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.bs-card .lbl { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--bone-dim); letter-spacing: 0.1em; text-transform: uppercase; }
.bs-card .val { font-family: 'IBM Plex Mono', monospace; font-size: 26px; color: var(--bone); margin-top: 4px; }

.month-bars {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  align-items: end;
  height: 140px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.month-bar {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  height: 100%; justify-content: flex-end;
}
.month-bar .bar {
  width: 100%;
  background: linear-gradient(180deg, var(--gold), rgba(193, 169, 110, 0.30));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.6s var(--ease);
}
.month-bar .lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--bone-dim);
  letter-spacing: 0.05em;
}

.about-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--bone-mute);
}
.about-body p { margin-bottom: 8px; }
.about-body strong { color: var(--bone); font-weight: 700; }
.copyright {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--bone-dim);
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  letter-spacing: 0.05em;
  text-align: center;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 110px; right: 50%;
  transform: translateX(50%);
  background: linear-gradient(135deg, var(--ink), #2a3551);
  color: var(--bone);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  z-index: 200;
  animation: toastIn 0.4s var(--spring);
}
.toast[hidden] { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(50%) translateY(20px); }
  to { opacity: 1; transform: translateX(50%) translateY(0); }
}

/* RESPONSIVE */
@media (max-width: 720px) {
  .today-body { grid-template-columns: 1fr; }
  .hero-inner { padding: 28px 22px; }
  .trend-row { grid-template-columns: repeat(2, 1fr); }
  .insight-grid { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 18px; }
  .topbar { padding: 12px 14px; }
  .brand span { font-size: 18px; }
  .fab { left: 18px; bottom: 22px; width: 54px; height: 54px; }
}

@media (max-width: 540px) {
  .shelf { grid-template-columns: 1fr 1fr; gap: 8px; }
  .book-card { padding: 12px; }
  .bc-title { font-size: 15px; }
  .header-actions { gap: 2px; }
  .icon-btn { width: 34px; height: 34px; }
  .icon-btn svg { width: 18px; height: 18px; }
  .modal-card { max-width: 100%; }
  .modal-body { padding: 18px; }
  .actions-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .shelf { grid-template-columns: 1fr; }
  .hero-meta { grid-template-columns: 1fr; gap: 6px; padding-top: 12px; }
  .insight-grid { grid-template-columns: 1fr; }
}

/* ACCENT THEMES */
body[data-accent="gold"] { --acc: #d6b478; --acc-2: #c9a96e; }
body[data-accent="navy"] { --acc: #6b89b3; --acc-2: #5f7aa1; }
body[data-accent="rose"] { --acc: #c89494; --acc-2: #b07e7e; }
body[data-accent="jade"] { --acc: #88a98c; --acc-2: #7a9a7e; }
