/* Shared by several pages. Loaded before each page's own stylesheet. */

.logo span { color: var(--accent); }

.btn-ghost:hover { color: var(--fg); }

.footer-support a { color: var(--accent); text-decoration: none; }

.footer-support a:hover { text-decoration: underline; }

[hidden] { display: none !important; }

.nav-spacer { flex: 1; }

.nav-user { font-size: 13px; color: var(--fg-muted); }

.layout { display: flex; padding-top: var(--nav-h); min-height: 100vh; }

.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--fg); color: var(--bg);
  padding: 12px 20px; border-radius: 8px;
  font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 9999; white-space: nowrap;
}

.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

.nav-logo span { color: var(--accent); }

.btn-donate:hover { background: var(--green-bg); border-color: var(--green); }

.stat-value.accent { color: var(--accent); }

.stat-value.green { color: var(--green); }

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.time-filters {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.time-btn {
  background: none;
  border: none;
  color: var(--muted, var(--fg-muted));
  font: 600 11px var(--body, var(--font-body));
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.time-btn:hover:not(.active) {
  color: var(--fg);
}

.time-btn.active {
  background: var(--surface, var(--bg-card));
  color: var(--fg);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), inset 0 0 0 1px var(--border);
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.modal-close:hover { color: var(--fg); }

.donate-options {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.donate-chip:hover, .donate-chip.active {
  border-color: var(--green);
  color: var(--green);
}

.donate-btn-main:hover { opacity: .88; }

.btn-primary:hover { opacity: .88; }

.btn-ext {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  font-family: var(--body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}

.btn-ext:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 580px) {
  .btn-ext .ext-label { display: none; }
}

/* ── Shared components added with book pages / PWA / a11y ─────────────────── */

/* Status tags: Out of Stock / Pre-order / All-Time Low (same shape everywhere) */
.br-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700; line-height: 1.4;
  padding: 2px 6px; border-radius: 4px; white-space: nowrap; vertical-align: middle;
}
.br-badge + .br-badge { margin-left: 4px; }
.br-badge--oos      { background: var(--accent-bg); color: var(--accent); }
.br-badge--preorder { background: rgba(99,102,241,0.14); color: #6366f1; }
.br-badge--atl      { background: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .br-badge--preorder { color: #a5b4fc; } }
:root[data-theme="dark"] .br-badge--preorder { color: #a5b4fc; }

/* "Good time to buy?" verdict */
.br-verdict {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface, transparent);
}
.br-verdict-icon { font-size: 1.3rem; line-height: 1.2; }
.br-verdict-label { font-weight: 700; font-size: 0.95rem; }
.br-verdict-detail { font-size: 0.82rem; color: var(--muted, var(--fg-muted)); margin-top: 2px; }
.br-verdict--great, .br-verdict--good { border-color: var(--green); background: var(--green-bg); }
.br-verdict--great .br-verdict-label, .br-verdict--good .br-verdict-label { color: var(--green); }
.br-verdict--wait { border-color: var(--accent); background: var(--accent-bg); }
.br-verdict--wait .br-verdict-label { color: var(--accent); }

/* Install-app button (shown only when the browser offers installation) */
.btn-install {
  display: inline-flex; align-items: center; gap: 6px; background: none; cursor: pointer;
  border: 1px solid var(--border); color: inherit; border-radius: 8px; padding: 6px 12px;
  font: inherit; font-size: 13px; font-weight: 500;
}
.btn-install:hover { border-color: var(--accent); color: var(--accent); }

/* Accessibility */
.br-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.br-skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 10000; padding: 8px 14px; border-radius: 6px;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none;
}
.br-skip-link:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.price-chart:focus-visible { outline-offset: 4px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
                           transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ── Phone navbars: never wider than the screen ─────────────────────────── */
nav button, nav a, nav .btn-ghost, nav .btn-primary { white-space: nowrap; }
.btn-install[hidden] { display: none; }
@media (max-width: 720px) {
  nav .nav-label { display: none; }
  nav .btn-install { display: none !important; }       /* phones: the install bar below instead */
  nav .nav-actions .btn-install:not([hidden]) { display: inline-flex !important; }   /* dashboard ☰ menu keeps it */
  .btn-ext-store { display: none !important; }       /* Chrome extensions don't run on phones */
}
@media (max-width: 480px) {
  nav { gap: 8px !important; padding-left: 14px !important; padding-right: 14px !important; }
  nav .btn-ghost, nav .btn-primary { padding-left: 10px !important; padding-right: 10px !important; }
}

/* Notification bell (shared by Explore and the dashboard; own fallbacks for colour names) */
.br-bell { position: relative; display: inline-flex; }
.br-bell-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; cursor: pointer;
  background: none; border: 1px solid var(--border); color: var(--fg); transition: border-color .15s, color .15s;
}
.br-bell-btn:hover, .br-bell-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.br-bell-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font: 700 11px/18px var(--body, var(--font-body, system-ui, sans-serif)); text-align: center;
}
.br-bell-panel {
  position: absolute; z-index: 1000; top: calc(100% + 8px); right: 0; width: 380px; max-width: calc(100vw - 24px);
  background: var(--surface, var(--bg-card, #fff)); color: var(--fg); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 44px rgba(0,0,0,.25); overflow: hidden; text-align: left;
  font-family: var(--body, var(--font-body, system-ui, sans-serif));
}
.br-bell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.br-bell-tabs { display: flex; gap: 4px; }
.br-bell-tabs button {
  background: none; border: 0; border-radius: 8px; padding: 6px 10px; cursor: pointer; font: 600 13px var(--body, var(--font-body, system-ui, sans-serif));
  color: var(--muted, var(--fg-muted, #6b6560));
}
.br-bell-tabs button[aria-selected="true"] { background: var(--accent-bg); color: var(--accent); }
.br-bell-tabs .n { font-size: 11px; background: var(--accent); color: #fff; border-radius: 8px; padding: 0 6px; margin-left: 2px; }
.br-bell-tabs .n:empty { display: none; }
.br-bell-mark { background: none; border: 0; cursor: pointer; font: 600 12px var(--body, var(--font-body, system-ui, sans-serif)); color: var(--accent); padding: 4px 6px; }
.br-bell-mark:disabled { opacity: .4; cursor: default; }
.br-bell-list { max-height: min(60vh, 420px); overflow-y: auto; }
.br-bell-item { display: flex; gap: 10px; padding: 10px 14px; text-decoration: none; color: var(--fg); border-bottom: 1px solid var(--border); position: relative; }
.br-bell-item:hover, .br-bell-item:focus-visible { background: var(--accent-bg); }
.br-bell-item.unread::before { content: ''; position: absolute; left: 5px; top: 18px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.br-bell-ico { flex: none; width: 24px; text-align: center; font-size: 16px; }
.br-bell-txt { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.br-bell-title { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.br-bell-msg { font-size: 12.5px; color: var(--fg); }
.br-bell-time { font-size: 11.5px; color: var(--muted, var(--fg-muted, #6b6560)); }
.br-bell-empty { padding: 28px 18px; text-align: center; font-size: 13px; color: var(--muted, var(--fg-muted, #6b6560)); line-height: 1.5; }
.br-bell-foot { padding: 8px 14px; font-size: 11.5px; color: var(--muted, var(--fg-muted, #6b6560)); border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .br-bell { position: static; }
  .br-bell-panel { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; max-width: none; }
}

/* "More in this series" panel (shared; own fallbacks because pages name their colours differently) */
.br-series { margin-top: 4px; }
.br-series-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.br-series-h { margin: 0; font: 700 1rem var(--display, var(--font-display, Georgia, serif)); color: var(--fg); }
.br-series-all { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.br-series-all:hover { text-decoration: underline; }
.br-series-row { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.br-series-card {
  flex: none; width: 118px; display: flex; flex-direction: column; gap: 4px; scroll-snap-align: start;
  text-decoration: none; color: var(--fg); padding: 8px; border-radius: 10px;
  background: var(--surface, var(--bg-card, #fff)); border: 1px solid var(--border);
  transition: border-color .15s, transform .15s;
}
.br-series-card:hover, .br-series-card:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.br-series-cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 6px; background: var(--border); display: block; }
.br-series-cover-placeholder { width: 100%; aspect-ratio: 2 / 3; border-radius: 6px; background: var(--border); display: grid; place-items: center; }
.br-series-title { font-size: 12px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.br-series-price { font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--muted, var(--fg-muted, #6b6560)); }
.br-series-price b { color: var(--accent); font-size: 13px; }
.br-series-oos { color: var(--muted, var(--fg-muted, #6b6560)); }

/* Install bar (phones only; created by js/common.js when the browser offers install) */
.br-install-bar { display: none; }
@media (max-width: 720px) {
  .br-install-bar {
    display: flex; align-items: center; gap: 12px; position: fixed; z-index: 900;
    left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 12px 12px 12px 14px; border-radius: 14px;
    background: var(--surface, var(--bg-card, #1c1a17)); color: var(--fg, #f0ede6);
    border: 1px solid var(--border, rgba(255,255,255,.08)); box-shadow: 0 10px 30px rgba(0,0,0,.3);
    font-family: var(--body, var(--font-body, system-ui, sans-serif));
  }
  .br-install-bar img { border-radius: 8px; flex: none; }
  .br-install-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
  .br-install-text strong { font-size: 15px; }
  .br-install-text span { font-size: 12.5px; color: var(--muted, var(--fg-muted, #9e9890)); }
  .br-install-go {
    flex: none; background: var(--accent, #e06b3a); color: #fff; border: 0; border-radius: 8px;
    padding: 10px 18px; font: 600 14px var(--body, var(--font-body, system-ui, sans-serif)); cursor: pointer;
  }
  .br-install-x {
    flex: none; background: none; border: 0; color: var(--muted, var(--fg-muted, #9e9890));
    font-size: 16px; padding: 8px; cursor: pointer; line-height: 1;
  }
  /* don't cover the compare tray or open dialogs */
  body:has(.compare-tray:not([hidden])) .br-install-bar,
  body:has(.modal-backdrop:not([hidden]), .modal-overlay:not([hidden]), .detail-overlay:not([hidden])) .br-install-bar { display: none; }
}

/* "How to install" dialog (when the browser hasn't offered install) */
.br-install-help { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
.br-install-help-box { position: relative; max-width: 400px; width: 100%; padding: 28px 24px 22px; border-radius: 14px; text-align: center;
  background: var(--surface, var(--bg-card, #1c1a17)); color: var(--fg, #f0ede6); border: 1px solid var(--border, rgba(255,255,255,.08));
  font-family: var(--body, var(--font-body, system-ui, sans-serif)); }
.br-install-help-box img { border-radius: 10px; margin-bottom: 10px; }
.br-install-help-box h2 { font: 700 1.3rem var(--display, var(--font-display, Georgia, serif)); margin: 0 0 10px; }
.br-install-help-box p { font-size: 14px; line-height: 1.6; margin: 0 0 10px; color: var(--fg, #f0ede6); }
.br-install-help-box .br-install-help-note { font-size: 12.5px; color: var(--muted, var(--fg-muted, #9e9890)); margin: 0; }
.br-install-help-box .br-install-x { position: absolute; top: 10px; right: 12px; background: none; border: 0; cursor: pointer;
  color: var(--muted, var(--fg-muted, #9e9890)); font-size: 16px; padding: 6px; }

/* Chart legend (one line per retailer) */
.br-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; font-size: 12.5px; color: var(--muted, var(--fg-muted)); }
.br-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.br-legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.br-multi { width: 100%; height: auto; display: block; }

/* Price comparison across shops (book page, Explore panel, dashboard) */
.shops { display: flex; flex-direction: column; gap: 12px; }
.best-price { padding: 12px 16px; border: 1px solid var(--green); background: var(--green-bg); border-radius: 10px; font-size: 0.95rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.best-price strong { font-size: 1.5rem; color: var(--green); }
.best-price-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green); width: 100%; }
.best-price--none { border-color: var(--border); background: var(--bg-card, var(--surface)); color: var(--muted, var(--fg-muted)); }
.all-time-low { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 16px; border: 1px solid var(--border); border-radius: 10px; font-size: 0.9rem; color: var(--muted, var(--fg-muted)); }
.all-time-low strong { font-size: 1.35rem; color: var(--green); }
.shop-table-wrap { position: relative; overflow-x: auto; min-width: 0; max-width: 100%; }   /* relative: so the sr-only text inside can not widen the page */
.shop-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.shop-table th, .shop-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.shop-table thead th { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted, var(--fg-muted)); }
.shop-table tbody th { font-weight: 600; }
.shop-table .br-legend-dot { margin-right: 8px; }
.shop-table tr.is-best td, .shop-table tr.is-best th { background: var(--green-bg); }
.shop-table .shop-low { color: var(--green); font-weight: 700; font-size: 1rem; }
.shop-table a { color: var(--accent); text-decoration: none; }
.shop-table a:hover { text-decoration: underline; }
.shop-table tr.shop-missing th, .shop-table tr.shop-missing td { color: var(--muted, var(--fg-muted)); font-weight: 400; font-size: 0.85rem; }
.best-tag { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--green); color: #fff; margin-left: 6px; vertical-align: middle; }
.shop-disc { font-size: 11px; color: var(--green); font-weight: 600; }
/* multi-shop chart tooltip */
.br-multi-wrap { position: relative; }
.br-mtip { position: absolute; z-index: 5; pointer-events: none; padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.5;
           background: var(--surface, var(--bg-card)); color: var(--fg); border: 1px solid var(--border); box-shadow: 0 4px 14px rgba(0,0,0,.25); white-space: nowrap; }
.br-mtip-date { font-size: 11px; color: var(--muted, var(--fg-muted)); margin-bottom: 2px; }
.br-mtip .br-legend-dot { margin-right: 6px; }
