/* A lábléc mottójának betűje (EB Garamond, dőlt) */
@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@1,400;1,500&display=swap");

/* ===== Fejléc, kereső és műveleti gombok ===== */

.lib-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 18px -14px rgba(0, 0, 0, .35);
}

.lib-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--text);
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 18%, transparent), var(--shadow-sm);
}

.brand .icon {
  width: 26px;
  height: 26px;
  color: var(--accent);
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin-left: auto;
  padding: 0 12px;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search .icon {
  width: 18px;
  height: 18px;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

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

.header-divider {
  width: 1px;
  height: 22px;
  flex: 0 0 1px;
  background: var(--border);
}

/* Közös fejléc (lib/site-header.php): főmenü ikonokkal a kereső mellett. */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.site-nav .icon-btn[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Mobil fejléc: 1. sor márkajel + gombok, 2. sor kereső.
   Görgetéskor az első sor felcsúszik, a kereső és a szerzősáv látható marad. */
@media (max-width: 640px) {
  .lib-header {
    top: -58px;
  }

  .lib-header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 44px auto;
    grid-template-areas: "brand actions" "search search";
    gap: 6px 10px;
    padding: 8px 14px 10px;
  }

  .brand {
    grid-area: brand;
    gap: 9px;
    font-size: 17px;
    line-height: 1.08;
    white-space: normal;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 18%, transparent);
  }

  .search {
    grid-area: search;
    max-width: none;
    margin: 0;
    height: 40px;
  }

  .header-actions {
    grid-area: actions;
    gap: 2px;
  }

  .header-actions .header-divider {
    display: none;
  }

  .header-actions .icon-btn {
    width: 38px;
    height: 38px;
  }

  /* A közös fejlécben a főmenü a kereső mellé kerül (a 2. sorba, amely görgetéskor is látszik). */
  .site-header .lib-header-inner {
    grid-template-areas: "brand actions" "search nav";
  }

  .site-nav {
    grid-area: nav;
    justify-self: end;
  }

  .site-nav .icon-btn {
    width: 38px;
    height: 40px;
  }

  .header-actions .theme-switch {
    margin-right: 4px;
  }

  .header-actions .theme-switch button {
    width: 30px;
    height: 28px;
  }
}

@media (max-width: 360px) {
  /* Nagyon keskeny kijelzőn csak a logó marad (a link neve megmarad). */
  .brand {
    font-size: 0;
    gap: 0;
  }

  .header-actions .icon-btn {
    width: 34px;
  }

  .header-actions .theme-switch button {
    width: 27px;
  }
}

/* ===== Szerzői navigáció ===== */

.author-index {
  max-width: 1240px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.author-index::-webkit-scrollbar {
  display: none;
}

.author-index a {
  flex: none;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}

.author-index a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.author-navigation {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 10px;
}

.author-navigation .author-index {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 3px 0;
  overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10px, #000 calc(100% - 14px), transparent);
  padding-left: 6px;
  padding-right: 10px;
}

.author-scroll, .authors-toggle {
  flex: none;
  min-height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}

.author-scroll {
  width: 32px;
  padding: 0;
  font: 0/1 system-ui, sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
}

.author-scroll:disabled, .authors-toggle:disabled {
  opacity: .4;
  cursor: default;
}

.authors-toggle {
  padding: 6px 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.authors-toggle[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.author-scroll:not(:disabled):hover, .authors-toggle:not(:disabled):hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.author-navigation :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.authors-panel {
  position: absolute;
  right: 20px;
  top: 100%;
  z-index: 11;
  width: min(360px, calc(100vw - 28px));
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  max-height: min(480px, 70vh);
  max-height: min(480px, 70dvh);
  overflow: auto;
  overscroll-behavior: contain;
}

.authors-panel label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.authors-panel input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.authors-panel input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.authors-list {
  margin-top: 10px;
}

.authors-list a {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.authors-list a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

#authors-empty {
  font-size: 13px;
  color: var(--muted);
}

.author-scroll::before {
  content: "";
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

#authors-prev::before {
  transform: translateX(2px) rotate(-135deg);
}

#authors-next::before {
  transform: translateX(-2px) rotate(45deg);
}

@media (max-width: 600px) {
  .author-navigation {
    padding-right: 14px;
    padding-left: 14px;
    gap: 4px;
  }

  .authors-panel {
    right: 14px;
  }

  .authors-toggle {
    padding-right: 8px;
    padding-left: 8px;
    font-size: 12px;
  }
}

/* ===== Oldalváz és szerzői csoportok ===== */

.lib-main {
  max-width: 1240px;
  min-height: 42vh;
  margin: 0 auto;
  padding: 8px 20px 60px;
}

.status:not(:empty) {
  margin: 16px 0;
}

.author {
  margin-top: 32px;
  scroll-margin-top: 120px;
}

.author-name {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 26px;
  font-weight: 600;
}

.author-name .count {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font: 600 12px/1.6 system-ui, sans-serif;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr));
  gap: 18px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.author-heading {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.author-heading::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 64px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.author-heading .author-name {
  margin: 0;
  padding: 0;
  border: 0;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .lib-main {
    padding: 4px 12px 40px;
  }

  .author-name {
    font-size: 22px;
  }

  .author {
    scroll-margin-top: 110px;
  }
}

/* ===== Könyvkártyák és leírások ===== */

.card {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px 20px;
  padding: 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  transition: border-color .2s, box-shadow .2s;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.card-cover {
  align-self: start;
  min-width: 0;
}

.cover-link {
  display: block;
  position: relative;
  border-radius: 3px 6px 6px 3px;
  transition: transform .2s ease;
}

/* Gerincárnyék és fényél a borítón, hogy könyvként hasson */
.cover-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .28), rgba(0, 0, 0, .05) 3%, rgba(255, 255, 255, .16) 5%, transparent 10%),
    linear-gradient(160deg, rgba(255, 255, 255, .14), transparent 40%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  pointer-events: none;
  z-index: 1;
}

.card .cover.cover-ph {
  display: flex;
}

.card .cover {
  display: block;
  width: 128px;
  aspect-ratio: 2 / 3;
  height: auto;
  object-fit: cover;
  border-radius: 3px 6px 6px 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .18), 0 12px 22px -6px rgba(0, 0, 0, .35);
  font-size: 16px;
}

.cover-link:hover {
  transform: translateY(-3px) rotate(-.4deg);
}

.card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card .title {
  margin: 0 0 3px;
  font-size: 21px;
  line-height: 1.25;
  font-weight: 600;
}

.card .title a {
  color: var(--text);
  text-decoration: none;
}

.card .title a:hover {
  color: var(--accent);
}

.card .meta {
  color: var(--muted);
  font-size: 14px;
}

.card .meta.warn {
  color: var(--danger);
  font-size: 13px;
}

.desc {
  margin: 10px 0 0;
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-line;
  color: var(--text);
}

.desc.muted {
  color: var(--muted);
  font-style: italic;
}

.desc.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.more {
  align-self: flex-start;
  margin-top: 4px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.more:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: .2em;
}

.reading {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.reading .progress {
  flex: 1;
  max-width: 220px;
}

.card[data-status="new"] {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
}

.card[data-status="modified"] {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
}

@media (max-width: 640px) {
  .card {
    grid-template-columns: 88px 1fr;
    gap: 14px;
    padding: 13px;
    border-radius: 14px;
  }

  .card .cover {
    width: 88px;
    font-size: 11px;
  }

  .card .title {
    font-size: 18px;
  }

  .card-cover {
    grid-row: 1;
  }

  .desc {
    font-size: 14px;
  }
}

/* ===== Könyvműveletek menüje ===== */

.card:has(.card-menu[open]) {
  z-index: 2;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.card-title-row .title {
  flex: 1;
  min-width: 0;
}

.card-menu {
  position: relative;
  flex: none;
}

.card-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  list-style: none;
  transition: background-color .15s, color .15s, border-color .15s;
}

.card-menu-toggle::-webkit-details-marker {
  display: none;
}

.card-menu-toggle:hover, .card-menu[open] > .card-menu-toggle {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
}

.card-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 3;
  width: 210px;
  max-width: calc(100vw - 40px);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: menu-pop .14s ease-out;
}

@keyframes menu-pop { from { opacity: 0; transform: translateY(-4px); } }

.card-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.card-menu-item:hover, .card-menu-item:focus-visible {
  background: var(--accent-soft);
  color: var(--text);
}

.card-menu-item:hover .icon {
  color: var(--accent);
}

.card-menu-item[aria-disabled="true"] {
  opacity: .45;
  cursor: default;
  background: transparent;
}

.card-menu-item .icon, .card-menu-icon-space {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--muted);
}

.card-menu-item[aria-pressed="true"] {
  color: var(--success);
  font-weight: 600;
}

.card-menu-item[aria-pressed="true"] .icon {
  color: var(--success);
}

.card-menu-divider {
  margin: 5px 4px;
  border: 0;
  border-top: 1px solid var(--border);
}

/* ===== Borítók jelölései ===== */

.cover-tag {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2.5px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--on-status);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  pointer-events: none;
}

.cover-tag .icon {
  width: 12px;
  height: 12px;
}

.cover-tag.tag-new {
  background: linear-gradient(135deg, var(--success), color-mix(in srgb, var(--success) 72%, #000));
}

.cover-tag.tag-mod {
  background: linear-gradient(135deg, var(--warning), color-mix(in srgb, var(--warning) 72%, #000));
}

.cover-completed-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--on-status);
  background: var(--success);
  box-shadow: 0 0 0 2px var(--surface), 0 2px 8px rgba(0, 0, 0, .45);
}

.cover-completed-badge .icon {
  width: 15px;
  height: 15px;
}

@media (max-width: 640px) {
  .cover-tag {
    font-size: 9.5px;
    padding: 2px 5px;
    left: 6px;
  }
}

/* ===== Új és módosított könyvek jelvényei ===== */

.card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
}

.badge .icon {
  width: 13px;
  height: 13px;
}

.badge-new {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
}

.badge-mod {
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
}

/* ===== Könyvtárállapot gombja ===== */

/* A könyvtár állapota a szerzősáv végén, a fiók ikonja alatt. */
.sync-slot { flex: none; display: flex; }
.sync-slot .sync-btn { width: 36px; height: 36px; border: 1px solid var(--border-strong); background: var(--surface); }

.sync-btn {
  position: relative;
}

.sync-btn .sync-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid var(--surface);
  transition: all .2s ease;
}

.sync-btn.has-changes .sync-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  top: 0;
  right: 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  background: var(--warning);
  color: var(--on-status);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--warning) 45%, transparent);
}

/* ===== Változásértesítők és szűrők ===== */

.changes-container {
  margin: 12px 0 16px;
}

.changes-container:empty {
  display: none;
}

.changes-banner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px 16px 22px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: slideDownChanges .22s cubic-bezier(0.16, 1, 0.3, 1);
}

.changes-banner::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--success) 0%, var(--warning) 100%);
}

.changes-banner.only-new::before { background: var(--success); }
.changes-banner.only-mod::before { background: var(--warning); }
.changes-banner.welcome::before { background: var(--accent); }
.changes-banner.sync-success::before { background: var(--success); }
.changes-banner.cleared::before { background: var(--warning); }

.changes-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.changes-banner-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.changes-icon-badge {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.changes-icon-badge.has-new,
.changes-icon-badge.is-success {
  background: var(--success-soft);
  color: var(--success);
}

.changes-icon-badge.has-mod,
.changes-icon-badge.is-cleared {
  background: var(--warning-soft);
  color: var(--warning);
}

.changes-icon-badge .icon {
  width: 20px;
  height: 20px;
}

.changes-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.changes-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.35;
}

.changes-sub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.changes-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.changes-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 4px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}

.filter-pill .icon {
  width: 14px;
  height: 14px;
}

.filter-pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.filter-pill[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-sm);
}

.filter-pill.pill-new[aria-pressed="true"] {
  background: var(--success);
  border-color: var(--success);
  color: var(--on-status);
}

.filter-pill.pill-mod[aria-pressed="true"] {
  background: var(--warning);
  border-color: var(--warning);
  color: var(--on-status);
}

.filter-pill .pill-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.filter-pill[aria-pressed="true"] .pill-badge {
  background: color-mix(in srgb, currentColor 22%, transparent);
}

@keyframes slideDownChanges {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .changes-banner {
    padding: 14px 14px 14px 18px;
  }

  .changes-banner-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .changes-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .changes-actions .btn {
    flex: 1 1 auto;
    min-height: 42px;
    white-space: normal;
  }
}

/* ===== Könyvtárállapot párbeszédablaka ===== */

.sync-dialog {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: 480px;
  width: 92vw;
  box-shadow: var(--shadow-lg);
}

.sync-dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sync-dialog-content {
  padding: 18px 22px 22px;
}

.sync-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sync-dialog-header h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
}

.sync-dialog-header .icon-btn {
  color: var(--muted);
  flex-shrink: 0;
}

.sync-stat-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.sync-stat-item {
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.sync-stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 3px;
}

.sync-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.sync-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-dialog-actions .btn {
  min-height: 44px;
  white-space: normal;
}

@media (max-width: 640px) {
  .sync-stat-list {
    grid-template-columns: 1fr;
  }
}

/* ===== Olvasás folytatása ===== */

.recent-reading {
  position: relative;
  margin: 26px 0 34px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(ellipse 60% 90% at 0% 0%, var(--accent-soft), transparent 70%),
    var(--surface-2);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--surface) 60%, transparent);
  overflow: hidden;
}

.recent-heading h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
}

.recent-heading p {
  margin: 4px 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.recent-card {
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .2s, transform .2s;
  display: flex;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.recent-card .book3d {
  border-radius: 2px 5px 5px 2px;
}

.recent-cover {
  width: 72px;
  height: 108px;
  flex: 0 0 72px;
  object-fit: cover;
  border-radius: 2px 5px 5px 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .18), 0 8px 16px -6px rgba(0, 0, 0, .35);
  font-size: 11px;
}

.recent-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.recent-author {
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.recent-copy h3 {
  margin: 3px 0 6px;
  font-size: 19px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.recent-chapter {
  margin: 0 0 10px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12px;
}

.recent-progress {
  display: flex;
  width: 100%;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.recent-progress .progress {
  flex: 1;
}

.recent-card:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.recent-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 1000px) {
  .recent-grid {
    grid-template-columns: 1fr;
  }

  .recent-card {
    align-items: center;
  }
}

@media (max-width: 560px) {
  .recent-reading {
    margin: 18px 0 26px;
    padding: 16px;
    border-radius: 16px;
  }

  .recent-heading h2 {
    font-size: 23px;
  }

  .recent-card {
    padding: 12px;
  }
}

/* ===== Szerzői bemutatkozás ===== */

.bio-open {
  margin-left: auto;
  font-size: 13px;
}

.author-bio {
  width: calc(100% - 32px);
  max-width: 780px;
  max-height: 85vh;
  max-height: 85dvh;
  padding: 24px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  overflow: auto;
}

.author-bio::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.bio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.bio-header .icon-btn {
  color: var(--muted);
}

.bio-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--accent);
  font-weight: 600;
}

.bio-layout {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.bio-photo {
  width: 200px;
  max-width: 35%;
  height: auto;
  flex-shrink: 0;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.bio-copy {
  flex: 1;
  min-width: 0;
}

.bio-copy h2 {
  margin: 0 0 16px;
  font-size: 30px;
  line-height: 1.2;
}

.bio-html {
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.bio-html p {
  margin: 0 0 1em;
}

.bio-html img {
  max-width: 100%;
  height: auto;
}

@media (max-width: 560px) {
  .author-bio {
    padding: 20px;
  }

  .bio-layout {
    flex-direction: column;
    gap: 20px;
  }

  .bio-photo {
    width: 160px;
    max-width: 100%;
  }

  .bio-copy h2 {
    font-size: 26px;
  }

  .bio-open {
    margin-left: 0;
  }
}

/* ===== Kezdőlapi üzenetek (content/admin.html, l-Név.html, lektor.html, olvaso.html) ===== */

.msg-dialog {
  max-width: 680px;
  padding: 0;
  overflow: hidden;
}

.msg-dialog[open] {
  display: flex;
  flex-direction: column;
}

.msg-dialog .bio-header {
  margin: 0;
  padding: 14px 14px 6px 24px;
}

.msg-dialog .bio-eyebrow {
  font-size: 15px;
  letter-spacing: .1em;
}

.msg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 24px 22px;
}

.msg > :first-child,
.msg > :first-child > :first-child { margin-top: 0; }
.msg > :last-child { margin-bottom: 0; }
.msg h1, .msg h2, .msg h3 { font-family: "Noto Serif", "Times New Roman", serif; line-height: 1.25; margin: 1.1em 0 .5em; }
.msg h1 { font-size: 28px; }
.msg h2 { font-size: 23px; }
.msg ul, .msg ol { padding-left: 1.3em; }
.msg li { margin: .25em 0; }
.msg a { color: var(--accent); }

/* Idézet: mint a könyvismertetőkben (színes csík, halvány háttér), dőlt betűvel */
.msg blockquote {
  margin: 18px 0;
  padding: 10px 18px;
  font-style: italic;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent-soft);
}

.msg blockquote p { margin: 0 0 .6em; }
.msg blockquote p:last-child { margin-bottom: 0; }
.msg blockquote em { font-style: normal; } /* a dőlt idézetben a kiemelés álló betűs */

.msg-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
  padding: 12px 18px 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.msg-ack {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.msg-ack input {
  width: 20px;
  height: 20px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.msg-ack-hint { color: var(--muted); }
.msg-ack-hint::before { content: "– "; }
.msg-ack:has(input:disabled) { cursor: default; }

.msg-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.msg-nav .icon-btn:disabled { opacity: .35; cursor: default; }

.msg-status {
  margin: 0;
  padding: 0 22px 12px;
  background: var(--surface-2);
  font-size: 13px;
  color: var(--success);
}

.msg-status.is-error { color: var(--danger); }

@media (max-width: 560px) {
  .msg-dialog .bio-header { padding: 10px 10px 6px 18px; }
  .msg-body { padding: 0 18px 16px; }
  .msg-foot { padding: 10px 14px 12px 18px; }
  .msg-status { padding: 0 18px 10px; }
}

/* ===== Lábléc ===== */

.lib-footer {
  margin-top: 28px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lib-footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 32px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.lib-motto {
  margin: 0;
  color: var(--muted);
  font-family: "EB Garamond", Garamond, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(22px, 2.6vw, 33px);
  line-height: 1.25;
  letter-spacing: .015em;
  font-style: italic;
}

.lib-footer-contact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.lib-footer-contact a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
  font-size: 14px;
  transition: background-color .15s, color .15s, border-color .15s;
}

.lib-footer-contact a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}

.lib-footer-contact .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

@media (max-width: 640px) {
  .lib-footer-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 20px 28px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .lib-footer-contact {
    justify-content: flex-start;
  }
}

/* ===== Kártyáról megnyitható 3D borító ===== */
button.cover-link {
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
button.cover-link:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
  border-radius: 6px;
}
.book-preview {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, rgba(20, 26, 48, .78), rgba(4, 5, 16, .92));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
}
.book-preview::backdrop { background: transparent; }
.bv-scene {
  position: absolute;
  top: 50%; left: 50%;
  width: 724px; height: 1024px;
  perspective: 2500px;
  transform-origin: center;
  pointer-events: none;
}
.bv-book {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transform: rotateY(-30deg) rotateX(10deg);
  transition: transform 1s cubic-bezier(.25, 1, .5, 1);
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
}
.bv-book:focus-visible { outline: 3px solid #f4e4c1; outline-offset: 14px; }
.bv-face { position: absolute; backface-visibility: hidden; }
.bv-front, .bv-back, .bv-spine {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 50px;
  padding: 65px;
  background-color: #20324b;
  background-repeat: no-repeat;
  color: #f4e4c1;
  font-family: "Noto Serif", serif;
  text-align: center;
  overflow: hidden;
}
.bv-front strong, .bv-back strong { font-size: 60px; overflow-wrap: anywhere; }
.bv-front span, .bv-back span { font-size: 30px; }
.bv-front, .bv-back { width: 724px; height: 1024px; }
.bv-front { transform: translateZ(85px); border-radius: 0 10px 10px 0; }
.bv-back { transform: rotateY(180deg) translateZ(85px); border-radius: 10px 0 0 10px; }
.bv-back.bv-back-description {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  justify-content: stretch;
  align-items: start;
  gap: 24px;
  padding: 65px;
}
.bv-back-description strong, .bv-back-description span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
.bv-back-description strong { font-size: 48px; line-height: 1.2; -webkit-line-clamp: 4; }
.bv-back-description span { font-size: 30px; line-height: 1.4; -webkit-line-clamp: 2; }
.bv-blurb {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 12;
  align-self: stretch;
  min-height: 0;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: pre-line;
  font-size: 30px;
  line-height: 1.5;
  text-align: left;
}
/* A borítóból számolt hátlap és gerinc (nem kiemelt könyvek) */
.bv-back.bv-generated, .bv-spine.bv-generated {
  background-color: transparent;
  background-image: var(--bv-bg);
  color: var(--bv-ink);
  text-shadow: var(--bv-shadow);
}
.bv-back.bv-generated strong { color: var(--bv-ink); }
.bv-back.bv-generated span { color: var(--bv-accent-text); }
.bv-spine.bv-generated span { color: var(--bv-soft); }
.bv-back.bv-generated .bv-blurb {
  padding: 26px 30px 28px;
  border-top: 5px solid var(--bv-accent);
  border-radius: 4px 4px 16px 16px;
  background: var(--bv-panel);
  color: var(--bv-ink);
}
.bv-back.bv-generated:not(.bv-back-description)::before {
  content: "";
  width: 120px;
  height: 5px;
  border-radius: 3px;
  background: var(--bv-accent);
  order: 1;
}
.bv-front::after, .bv-back::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 40px;
  background: linear-gradient(90deg, rgba(0,0,0,.4), transparent);
  pointer-events: none;
}
.bv-back::after { left: auto; right: 0; transform: rotate(180deg); }
.bv-spine {
  top: 0; left: -86px;
  width: 172px; height: 1024px;
  transform: rotateY(-90deg);
  padding: 35px;
  writing-mode: vertical-rl;
  font-size: 38px;
}
.bv-spine strong { max-height: 90%; overflow-wrap: anywhere; }
.bv-spine span { font-size: 25px; }
.bv-pages {
  position: absolute;
  top: 10px; left: 10px;
  width: 700px; height: 994px;
  transform-style: preserve-3d;
}
.bv-right {
  top: 0; right: -80px; width: 160px; height: 100%;
  transform: rotateY(90deg);
  background: repeating-linear-gradient(90deg, #fdfbf7 0 2px, #e4e0d9 2px 3px);
  box-shadow: inset 20px 0 40px rgba(0,0,0,.15);
}
.bv-top, .bv-bottom { left: 0; width: 100%; height: 160px; background: #f5f2e9; }
.bv-top { top: -80px; transform: rotateX(90deg); }
.bv-bottom { bottom: -80px; transform: rotateX(-90deg); }
.bv-actions {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.bv-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 60px; height: 60px;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff; padding: 0; cursor: pointer;
}
.bv-action span { font-size: 10px; font-weight: bold; }
.bv-action:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.bv-action:disabled { opacity: .35; cursor: not-allowed; }
.bv-action:focus-visible { outline: 3px solid #f4e4c1; outline-offset: 4px; }
@media (max-width: 600px) {
  .bv-actions { gap: 12px; }
  .bv-action { width: 46px; height: 46px; gap: 2px; }
  .bv-action span { font-size: 8px; }
  .bv-action .icon { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .bv-book { transition-duration: .01s; }
}

/* Szerveroldali SEO-navigáció */
.book-seo-nav{max-width:960px;margin:35px auto 10px;padding:20px;border-top:1px solid var(--border);color:var(--muted)}.book-seo-nav h2{font-size:1.05rem}.book-seo-nav ul{display:flex;flex-wrap:wrap;gap:12px 24px;padding:0;list-style:none}.book-seo-nav a{color:var(--accent)}
