:root {
  --bg0: #1a1714;
  --bg1: #241f1a;
  --bg2: #2e2822;
  --ink: #f2e8d8;
  --muted: #a89884;
  --accent: #c4a35a;
  --accent2: #d4b56a;
  --danger: #c45c4a;
  --line: rgba(242, 232, 216, 0.12);
  --font-display: "Syne", sans-serif;
  --font-body: "Literata", Georgia, serif;
  --pad: clamp(1rem, 4vw, 2rem);
  --max: 38rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 10% -10%, #3a2f22 0%, transparent 55%),
    radial-gradient(90% 60% at 100% 0%, #1e2a24 0%, transparent 50%),
    linear-gradient(180deg, var(--bg0), #12100e 120%);
  background-attachment: fixed;
  line-height: 1.65;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: #e0c57a; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem var(--pad);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(18, 16, 14, 0.72);
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(0.95rem, 2.8vw, 1.15rem);
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  flex: 0 1 auto;
  min-width: 0;
}

.nav-panel {
  position: relative;
  flex: 0 0 auto;
  margin: 0;
}

.nav-panel-toggle {
  list-style: none;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.22);
  user-select: none;
  appearance: none;
  -webkit-appearance: none;
}
.nav-panel-toggle::-webkit-details-marker { display: none; }

.nav-burger {
  display: grid;
  gap: 3px;
  width: 1.05rem;
}
.nav-burger span {
  display: block;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.top-nav a { color: var(--muted); text-decoration: none; }
.top-nav a:hover { color: var(--ink); }

.nav-drop {
  position: relative;
}
.nav-drop-toggle {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  user-select: none;
}
.nav-drop-toggle::-webkit-details-marker { display: none; }
.nav-drop-toggle::after {
  content: "";
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-left: 0.35rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
  vertical-align: middle;
  opacity: 0.75;
}
.nav-drop[open] > .nav-drop-toggle,
.nav-drop.is-on > .nav-drop-toggle,
.nav-drop-toggle:hover {
  color: var(--ink);
}
.nav-drop[open] > .nav-drop-toggle::after {
  transform: translateY(0.05rem) rotate(225deg);
}
.nav-drop-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  min-width: 12.5rem;
  margin: 0;
  padding: 0.4rem 0;
  list-style: none;
  background: #1c1915;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  box-shadow: 0 0.6rem 1.4rem rgba(0, 0, 0, 0.45);
  z-index: 40;
}
.nav-drop-menu a {
  display: block;
  padding: 0.45rem 0.9rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.nav-drop-menu a:hover,
.nav-drop-menu a.is-active {
  color: var(--ink);
  background: rgba(196, 163, 90, 0.12);
}
.nav-drop-sep {
  height: 1px;
  margin: 0.35rem 0;
  background: var(--line);
}

.btn-nav {
  border: 1px solid var(--line);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}

.user-chip {
  color: var(--accent2);
  font-size: 0.8rem;
}

.linkish {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.main {
  padding: 0 var(--pad) 3rem;
}

.main:has(.hero-bleed) {
  padding-left: 0;
  padding-right: 0;
}

.hero {
  min-height: calc(100vh - 4.5rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 40rem;
  padding: 2rem 0 3rem;
}

.hero-bleed {
  position: relative;
  max-width: none;
  width: 100%;
  min-height: calc(100vh - 3.6rem);
  padding: 0;
  justify-content: flex-end;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(10, 8, 6, 0.15) 0%, rgba(10, 8, 6, 0.82) 62%, #12100e 100%),
    var(--hero-img) center 28% / cover no-repeat;
  animation: hero-settle 1.4s ease-out both;
}

.hero-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 55% at 70% 35%, rgba(196, 163, 90, 0.18), transparent 60%),
    linear-gradient(90deg, rgba(12, 10, 8, 0.55) 0%, transparent 55%);
  pointer-events: none;
  animation: veil-breathe 8s ease-in-out infinite alternate;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 38rem;
  padding: clamp(2rem, 8vh, 4rem) var(--pad) clamp(2.5rem, 9vh, 4.5rem);
}

@keyframes hero-settle {
  from { opacity: 0.55; transform: scale(1.03); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes veil-breathe {
  from { opacity: 0.85; }
  to { opacity: 1; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(0.8rem); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-bleed .hero-kicker { animation: fade-up 0.7s 0.15s ease both; }
.hero-bleed .hero-brand { animation: fade-up 0.8s 0.28s ease both; }
.hero-bleed .hero-lead { animation: fade-up 0.8s 0.4s ease both; }
.hero-bleed .cta { animation: fade-up 0.75s 0.55s ease both; }

.hero-kicker {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.hero-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 9vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0 0 1rem;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.hero-lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 28rem;
  margin: 0 0 1.25rem;
}

.hero-book { margin: 0 0 1.5rem; color: var(--ink); }

.books-shelf, .book-hero, .ladder, .toc, .auth, .chapter {
  max-width: var(--max);
  margin: 0 auto 2.5rem;
}
.books-shelf { max-width: 42rem; }
.main:has(.hero-bleed) .books-shelf,
.main:has(.hero-bleed) .ladder {
  padding-left: var(--pad);
  padding-right: var(--pad);
}
.books-shelf h2, .ladder h2, .toc h2, .branches h2, .continuations h2, .actions h2, .scoreboard h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

.book-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
.book-link {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.9rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 0.35rem 0;
  transition: transform 0.25s ease;
}
.book-link:hover { transform: translateX(0.25rem); color: inherit; }
.book-thumb {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 0.25rem;
  background: center / cover no-repeat #1a1510;
  box-shadow: inset 0 0 0 1px var(--line);
}
.book-thumb-plain {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--accent);
  background: linear-gradient(145deg, #2a231c, #16120e);
}
.book-meta { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.book-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}
.book-sub { color: var(--muted); font-size: 0.92rem; }
.book-count { color: var(--accent2); font-size: 0.8rem; }
.book-row.is-featured .book-title { color: var(--accent); }
.book-row {
  display: grid;
  gap: 0.35rem;
}
.book-bm {
  font-size: 0.82rem;
  color: var(--accent);
  margin-top: 0.15rem;
}
.book-resume {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  margin-left: 5.4rem;
}
.book-resume:hover { color: #e0c57a; }

.bm-mark {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-left: 0.4rem;
}
.toc-list li.is-bookmark > a { color: var(--accent); }
.resume-alt { margin: 0.75rem 0 0; }
.bm-saved {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  align-self: center;
}

.bookmarks-page {
  max-width: var(--max);
  margin: 0 auto 2.5rem;
  padding-top: 1.5rem;
}
.bookmarks-page h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0 0 0.75rem;
}
.bm-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.bm-link {
  display: grid;
  gap: 0.15rem;
  text-decoration: none;
  color: inherit;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.18);
  transition: border-color 0.2s ease;
}
.bm-link:hover {
  border-color: rgba(196, 163, 90, 0.45);
  color: inherit;
}
.bm-book {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-display);
}
.bm-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.bm-card {
  display: grid;
  gap: 0;
}
.bm-card.has-new .bm-link {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.bm-author {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--accent);
}
.bm-pts {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-style: italic;
}
/* „Itt jársz”: a jelenlegi rész szerzője nem arany — az Új sornál más a logika */
.bm-now .bm-author,
.bm-now .bm-pts {
  font-style: normal;
  color: var(--muted);
}
.bm-new {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  padding: 0.55rem 0.95rem 0.7rem;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid rgba(196, 163, 90, 0.45);
  border-top: none;
  border-radius: 0 0 0.35rem 0.35rem;
  background: rgba(196, 163, 90, 0.08);
}
.bm-new:hover { background: rgba(196, 163, 90, 0.14); }
.bm-new-badge {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a140c;
  background: var(--accent);
  padding: 0.12rem 0.4rem;
  border-radius: 0.2rem;
}
.bm-new-title { font-weight: 600; }
.bm-new-author {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--accent);
  width: 100%;
}
.bm-new-author .bm-pts {
  font-style: italic;
  color: var(--accent);
}
.bm-when { font-size: 0.8rem; }
.bm-list.compact { margin-top: 0.5rem; }
.bm-now { margin-bottom: 2rem; }
.bm-now h2, .bm-explorer h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.65rem;
}

.bm-explorer { margin-top: 0.5rem; }
.ex-root {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.18);
}
.ex-root-sum { font-size: 1.05rem; font-weight: 700; }
.ex-main-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0.55rem 0 0.25rem 0.35rem;
}
.ex-children {
  list-style: none;
  margin: 0.15rem 0 0.25rem;
  padding: 0 0 0 0.85rem;
  border-left: 1px solid var(--line);
}
.ex-node { margin: 0.1rem 0; }
.ex-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  cursor: pointer;
  list-style: none;
  padding: 0.28rem 0.2rem;
  border-radius: 0.25rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}
.ex-summary::-webkit-details-marker { display: none; }
.ex-summary:hover { background: rgba(196, 163, 90, 0.08); }
.ex-twist {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
}
details[open] > .ex-summary .ex-twist {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}
.ex-icon {
  width: 0.95rem;
  height: 0.85rem;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 0.12rem;
  background: rgba(196, 163, 90, 0.12);
}
.ex-icon-book { background: rgba(196, 163, 90, 0.28); }
.ex-icon-folder { background: rgba(196, 163, 90, 0.2); }
.ex-icon-file {
  height: 0.95rem;
  border-radius: 0.1rem;
  background: transparent;
  border-color: var(--muted);
  opacity: 0.7;
}
.ex-label { color: var(--ink); }
.ex-inline-link {
  color: inherit;
  text-decoration: none;
}
.ex-inline-link:hover .ex-label { color: var(--accent); }
.ex-node.is-new > .ex-file-link .ex-label,
.ex-node.is-new > details > .ex-summary .ex-label {
  color: var(--accent);
}
.ex-path {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  flex: 0 0 auto;
  min-width: 2.4rem;
}
.ex-kind, .ex-here {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.ex-here { color: var(--accent); }
.ex-author {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.ex-pts { color: var(--accent); font-style: italic; }
/* „itt jársz”: a jelzés arany, a szerző ne versenyezzen vele */
.ex-node.is-here .ex-author,
.ex-node.is-here .ex-pts {
  font-style: normal;
  color: var(--muted);
}
.ex-new {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1a140c;
  background: var(--accent);
  padding: 0.08rem 0.35rem;
  border-radius: 0.2rem;
}
.ex-file-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  text-decoration: none;
  color: var(--ink);
  padding: 0.28rem 0.2rem 0.28rem 1.1rem;
  border-radius: 0.25rem;
  font-size: 0.95rem;
}
.ex-file-link:hover {
  background: rgba(196, 163, 90, 0.08);
  color: var(--ink);
}
.ex-node.is-here > .ex-file-link .ex-label,
.ex-node.is-here > details > .ex-summary .ex-label {
  color: var(--accent);
}

.book-hero {
  display: grid;
  gap: 1.25rem;
  padding-top: 1.5rem;
  max-width: 42rem;
}
.book-hero.has-cover {
  grid-template-columns: minmax(0, 11rem) 1fr;
  align-items: end;
}
.book-hero-art {
  aspect-ratio: 1;
  border-radius: 0.3rem;
  background: var(--cover) center / cover no-repeat;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  animation: fade-up 0.8s ease both;
}
.book-hero-copy .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}
.book-hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.05;
  margin: 0 0 0.75rem;
}
@media (max-width: 640px) {
  .book-hero.has-cover { grid-template-columns: 1fr; }
  .book-hero-art { max-width: 12rem; }
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  background: var(--accent);
  color: #1a140c;
  text-decoration: none;
  padding: 0.85rem 1.35rem;
  border: none;
  border-radius: 0.35rem;
  cursor: pointer;
  width: fit-content;
  transition: transform 0.2s ease, background 0.2s ease;
}
.cta:hover { background: #e0c57a; transform: translateY(-1px); color: #1a140c; }
.cta.compact { padding: 0.65rem 1.1rem; font-size: 0.95rem; }

.toc-list {
  padding-left: 1.2rem;
  margin: 0;
}
.toc-list li { margin: 0.4rem 0; }

.story-map { margin-top: 1rem; }
.map-branches-title { margin-top: 2rem; }
.branch-map {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}
.branch-card {
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 1rem 1.1rem;
  background: rgba(0,0,0,0.2);
}
.branch-card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
}
.branch-from { font-size: 0.9rem; color: var(--muted); margin: 0 0 0.65rem; }
.toc-count {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.35rem;
}
.toc-ellipsis { list-style: none; margin-left: -1.2rem; }
.toc-all {
  margin: 0.75rem 0 0;
}
.toc-all > summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.92rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.branch-start {
  margin: 0 0 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.branch-toc > summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.nav-btn.compact {
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
}
.toc-list.compact { margin: 0; }
.toc-list .src {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-left: 0.35rem;
}
.gate-steps {
  padding-left: 1.2rem;
  color: var(--muted);
}
.gate-steps li { margin: 0.45rem 0; }
.gate-steps strong { color: var(--ink); }

.fork-banner {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--accent2);
  background: rgba(107, 143, 113, 0.12);
  font-size: 0.95rem;
}
.src-tag {
  color: var(--accent);
  font-weight: 600;
}
.branches {
  margin: 1.5rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.branches.empty .hint { margin: 0.35rem 0 0; }
.branch-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.branch-list li {
  margin: 0.55rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
}
.branch-link {
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  border-bottom: 1px solid rgba(196, 163, 90, 0.35);
}
.branch-link:hover { color: #e0c57a; }

.continuations {
  margin: 0.5rem 0 2rem;
  padding: 1.1rem 0 0;
  border-top: 1px solid var(--line);
}
.continue-list {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.continue-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem 0.75rem;
  align-items: baseline;
  text-decoration: none;
  color: var(--ink);
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.18);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.continue-link.is-solo {
  grid-template-columns: 1fr;
}
.continue-link:hover {
  border-color: rgba(196, 163, 90, 0.45);
  background: rgba(196, 163, 90, 0.08);
  color: var(--ink);
}
.continue-kind {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.continue-link.is-main .continue-kind { color: var(--accent2); }
.continue-link.is-branch .continue-kind { color: var(--accent); }
.continue-title {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.02rem;
}
.continue-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.chapter-head { margin: 1.5rem 0 1.25rem; }
.eyebrow {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.4rem;
}
.chapter-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.03em;
}

.prose {
  font-size: 1.08rem;
  max-width: var(--max);
}
.prose p { margin: 0 0 1em; }

.cast-panel {
  margin: 2rem 0;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.18);
}
.cast-panel summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
}
.cast-grid {
  display: grid;
  gap: 1rem;
  margin-top: 0.85rem;
}
@media (min-width: 640px) {
  .cast-grid { grid-template-columns: 1fr 1fr; }
}
.cast-grid h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
}
.cast-grid ul { margin: 0; padding-left: 1.1rem; }

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
  flex-wrap: wrap;
}
.nav-btn {
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.65rem 0.95rem;
  border-radius: 0.35rem;
  background: var(--bg2);
}
.nav-btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #1a140c;
}
.nav-btn.muted { color: var(--muted); }

.act.is-done {
  border-color: rgba(107, 143, 113, 0.55);
  color: var(--accent2);
  opacity: 1;
  cursor: default;
}

.branches ul { padding-left: 1.1rem; }

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.act {
  font-family: var(--font-display);
  font-weight: 600;
  background: var(--bg2);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.55rem 0.9rem;
  border-radius: 0.35rem;
  cursor: pointer;
}
.act:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.act.is-locked {
  opacity: 0.45;
  cursor: pointer;
  border-style: dashed;
}
.act.is-locked:hover {
  opacity: 0.7;
  border-color: var(--accent);
}
.act:not(:disabled):not(.is-locked):hover { border-color: var(--accent); }

.gate-dialog {
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  padding: 0;
  background: var(--bg1);
  color: var(--ink);
  max-width: min(22rem, calc(100vw - 2rem));
}
.gate-dialog::backdrop {
  background: rgba(10, 8, 6, 0.65);
}
.gate-dialog-inner {
  padding: 1.1rem 1.15rem 1rem;
  display: grid;
  gap: 0.75rem;
}
.gate-dialog-inner h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}
.gate-dialog-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}
.gate-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.gate-dialog-actions a.act,
.gate-dialog-actions a.cta {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.gate-dialog-close {
  justify-self: start;
}
.hint { color: var(--muted); font-size: 0.92rem; }
.hint.locked { border-left: 3px solid var(--accent); padding-left: 0.75rem; }
.muted { color: var(--muted); }
.err { color: var(--danger); }

.contribute, .auth form {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}
.contribute input, .contribute textarea,
.auth input {
  width: 100%;
  font: inherit;
  padding: 0.7rem 0.8rem;
  border-radius: 0.35rem;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.28);
  color: var(--ink);
}
.share-panel {
  margin: 0.85rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: rgba(0,0,0,0.18);
}
.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}
.share-row a.act {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.check { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.92rem; }
.branch-choice {
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.65rem 0.85rem;
  margin: 0;
}
.branch-choice legend {
  font-family: var(--font-display);
  font-size: 0.85rem;
  padding: 0 0.35rem;
  color: var(--ink);
}
.branch-choice .check { margin: 0.35rem 0; }

.form-msg { color: var(--accent2); margin: 0; }
.form-msg.err { color: var(--danger); }

.auth { padding-top: 2rem; }
.auth h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0 0 0.5rem;
}
.auth .lead { color: var(--muted); }

.moderator { max-width: 42rem; margin: 1.5rem auto 2.5rem; }
.moderator h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0 0 0.5rem;
}
.mod-list { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 1rem; }
.mod-card {
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  padding: 1rem;
  background: rgba(0,0,0,0.2);
}
.mod-meta { margin-bottom: 0.65rem; }
.mod-body {
  font-size: 0.98rem;
  max-height: 14rem;
  overflow: auto;
  margin-bottom: 0.85rem;
  padding-right: 0.35rem;
}
.mod-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.45rem;
  border-radius: 0.25rem;
  margin-right: 0.35rem;
}
.badge-branch { background: var(--accent); color: #1a140c; }
.badge-add { background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }
.read-award {
  margin: 0.5rem 0 0;
  color: var(--accent2);
  font-family: var(--font-display);
  font-size: 0.9rem;
}

.foot {
  padding: 1.5rem var(--pad) 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.foot p { margin: 0; max-width: var(--max); }

/* QR: asztali = jobb alsó fix; mobil = a láblécben, nem takar */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  margin: 0 0 1.25rem;
  padding: 0.45rem 0.45rem 0.55rem;
  background: rgba(242, 232, 216, 0.94);
  border: 1px solid rgba(26, 23, 20, 0.12);
  border-radius: 0.35rem;
  color: #1a1714;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.qr-link {
  display: block;
  line-height: 0;
  text-decoration: none;
}
.qr-img {
  display: block;
  width: 104px;
  height: 104px;
  border-radius: 0.15rem;
}
.qr-caption {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5c5348;
}
@media (min-width: 721px) {
  .qr-box {
    position: fixed;
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    left: auto;
    z-index: 50;
    margin: 0;
  }
  .foot p {
    /* ne ütközzön a fix QR-rel széles képernyőn */
    padding-right: 7.5rem;
    padding-left: 0;
  }
}
@media (max-width: 720px) {
  .qr-box {
    position: static;
    margin: 0 auto 1.25rem;
    box-shadow: none;
  }
  .qr-img {
    width: 88px;
    height: 88px;
  }
}

.scoreboard {
  max-width: var(--max);
  margin: 0 auto 2.5rem;
  padding-top: 1.5rem;
}
.scoreboard h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
}
.score-you {
  margin: 0 0 1.5rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.18);
}
.score-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 2rem;
  font-size: 0.95rem;
}
.score-table th,
.score-table td {
  text-align: left;
  padding: 0.55rem 0.35rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.score-table th {
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.score-pts {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.score-note {
  color: var(--muted);
  font-size: 0.85rem;
}
.gate-board, .rank-board {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.gate-board li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem 0.75rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.gate-name { font-family: var(--font-display); font-weight: 600; }
.gate-need { color: var(--muted); font-size: 0.88rem; }
.gate-state {
  font-size: 0.75rem;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.gate-board .is-open .gate-state { color: var(--accent2); }
.gate-board .is-locked .gate-state { color: var(--muted); }
.rank-board li {
  padding: 0.35rem 0;
  color: var(--muted);
}
.rank-board strong { color: var(--ink); }
.badges-soon { margin-top: 0.5rem; }
.badge-slots {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.75rem;
}
.badge-slot {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: 1px dashed var(--line);
  background: rgba(0, 0, 0, 0.15);
  opacity: 0.7;
}
@media (max-width: 560px) {
  .gate-board li {
    grid-template-columns: 1fr auto;
  }
  .gate-need { grid-column: 1 / -1; }
}

.guide {
  max-width: var(--max);
  margin: 0 auto 2.5rem;
  padding-top: 1.5rem;
}
.guide h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
}
.guide h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 2rem 0 0.65rem;
  letter-spacing: -0.02em;
}
.guide > p,
.guide section > p {
  margin: 0 0 0.85rem;
  line-height: 1.65;
  color: var(--ink);
}
.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin: 1.25rem 0 1.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.guide-toc a {
  color: var(--accent);
  text-decoration: none;
}
.guide-toc a:hover { text-decoration: underline; }
.guide-steps {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  line-height: 1.65;
}
.guide-steps li { margin: 0.55rem 0; }
.guide-list {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  line-height: 1.65;
}
.guide-list li { margin: 0.4rem 0; }
.guide-faq {
  margin: 0 0 1.5rem;
}
.guide-faq dt {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 1rem 0 0.3rem;
}
.guide-faq dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.guide-foot {
  margin-top: 2rem !important;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-page {
  max-width: min(72rem, calc(100% - 1.5rem));
  margin: 0 auto 2.5rem;
  padding-top: 1.5rem;
}
.admin-page h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  margin: 0 0 0.75rem;
}
.admin-page .hero-lead {
  max-width: 48rem;
}
.admin-page .admin-create-form {
  max-width: none;
}
.admin-dash {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}
.admin-dash a {
  display: grid;
  gap: 0.2rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.18);
  color: var(--ink);
  text-decoration: none;
}
.admin-dash a:hover {
  border-color: rgba(196, 163, 90, 0.45);
  background: rgba(196, 163, 90, 0.08);
}
.admin-dash .muted { color: var(--muted); font-size: 0.9rem; }
.admin-links { margin: 0 0 1.5rem; color: var(--muted); }
.admin-book-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}
.admin-book-card {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: rgba(0, 0, 0, 0.18);
}
.admin-book-preview img {
  width: 8rem;
  height: 8rem;
  object-fit: cover;
  border-radius: 0.3rem;
  display: block;
}
.admin-book-empty {
  width: 8rem;
  height: 8rem;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 0.3rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.5rem;
}
.admin-book-body h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
}
.admin-cover-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
  margin-top: 0.85rem;
}
.file-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1 1 12rem;
}
.file-label input[type="file"] {
  font: inherit;
  color: var(--ink);
}
.admin-clear-form { margin-top: 0.65rem; }
.admin-ai {
  margin: 0 0 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.admin-ai-toolbar { margin: 0.75rem 0 1.25rem; }
.admin-grow-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}
.admin-grow-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.admin-grow-form input {
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  padding: 0.55rem 0.7rem;
  width: 10rem;
}
.admin-ai-create { margin-bottom: 1.5rem; }
.admin-ai-create h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
}
.admin-ai-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}
.admin-ai-card {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.18);
}
.admin-ai-card.is-plot-resting {
  opacity: 0.72;
  border-style: dashed;
  background: rgba(0, 0, 0, 0.1);
}
.plot-badge {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 0.2rem;
  border: 1px solid var(--line);
}
.plot-badge-on {
  color: var(--accent2);
  border-color: color-mix(in srgb, var(--accent2) 45%, transparent);
}
.plot-badge-tension {
  color: #e08a4a;
  border-color: color-mix(in srgb, #e08a4a 45%, transparent);
}
.plot-badge-soft {
  color: #8aa4c8;
  border-color: color-mix(in srgb, #8aa4c8 45%, transparent);
}
.plot-badge-react {
  color: #c9a227;
  border-color: color-mix(in srgb, #c9a227 45%, transparent);
}
.plot-badge-bg {
  color: #7a9e8a;
  border-color: color-mix(in srgb, #7a9e8a 45%, transparent);
}
.plot-badge-used,
.plot-badge-off {
  color: var(--muted);
}
.plot-status-select {
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  padding: 0.25rem 0.45rem;
  max-width: 16rem;
}
.admin-ai-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  align-items: baseline;
  margin-bottom: 0.65rem;
  font-family: var(--font-display);
}
.admin-ai-threads label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.admin-ai-threads textarea {
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  padding: 0.55rem 0.7rem;
  width: 100%;
  resize: vertical;
}
.admin-ai-threads button { margin-top: 0.55rem; }

.admin-new-book {
  margin: 0 0 2rem;
  padding: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
}
.admin-create-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.85rem;
  max-width: 28rem;
}
.admin-create-form label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.admin-create-form input,
.admin-create-form textarea {
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  padding: 0.55rem 0.7rem;
  width: 100%;
}
.admin-chapter-form {
  max-width: 42rem;
}
.admin-chapter-form textarea[name="body"] {
  min-height: 22rem;
  line-height: 1.55;
}
.admin-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.35rem;
}
.cta.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.admin-subh {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 2rem 0 0.75rem;
}
.admin-create-form select,
.admin-grow-form select {
  font: inherit;
  color: var(--ink);
  background: #2e2822;
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  padding: 0.55rem 0.7rem;
  width: 100%;
  max-width: 100%;
}
.admin-create-form select option,
.admin-grow-form select option {
  /* OS natív lista: világos háttér + sötét szöveg = olvasható */
  color: #1a1714;
  background: #f2e8d8;
}
.admin-inline-delete {
  display: inline;
  margin: 0;
}
.nav-btn.danger-btn,
.danger-btn {
  color: #f2e8d8;
  background: var(--danger);
  border-color: var(--danger);
  cursor: pointer;
  font: inherit;
}
.admin-delete-check {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0.75rem 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.admin-delete-form {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  max-width: 42rem;
}
.admin-delete-form h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.4rem;
  color: var(--danger);
}
.cta.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
@media (max-width: 560px) {
  .admin-book-card { grid-template-columns: 1fr; }
}

/* ——— Mobil / keskeny nézet ———
   max-width: keskeny PC-ablak (zoomra kevésbé érzékeny, 700px)
   max-device-width: valódi telefon/tablet — akkor is, ha „asztali oldal” módban ~980px a viewport
   pointer/hover: érintős telefonok tartalék feltétele
*/
@media (max-width: 700px), (max-device-width: 1024px), ((hover: none) and (pointer: coarse)) {
  html {
    overflow-x: clip;
  }

  body {
    background-attachment: scroll;
    font-size: 1.2rem;
    line-height: 1.75;
  }

  .top {
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding-top: max(0.65rem, env(safe-area-inset-top));
    overflow: visible;
  }

  .brand {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100vw - 6.75rem);
    font-size: 1.15rem;
  }

  .nav-panel-toggle {
    display: inline-flex;
    min-height: 3rem;
    padding: 0.55rem 0.85rem;
    font-size: 1.05rem;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-burger {
    width: 1.25rem;
    gap: 4px;
  }
  .nav-burger span {
    height: 2.5px;
  }

  /* Teljes szélességű drawer — nem vágja le overflow / sticky */
  .top-nav {
    display: none;
    position: fixed;
    left: max(0.65rem, env(safe-area-inset-left));
    right: max(0.65rem, env(safe-area-inset-right));
    top: calc(env(safe-area-inset-top, 0px) + 3.75rem);
    width: auto;
    min-width: 0;
    max-height: calc(100dvh - 4.5rem);
    max-height: calc(100svh - 4.5rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.35rem 0;
    background: #1c1915;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    box-shadow: 0 0.85rem 2rem rgba(0, 0, 0, 0.55);
    z-index: 60;
    font-size: 1.15rem;
  }

  .nav-panel.is-open > .top-nav {
    display: flex;
  }

  .nav-panel.is-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(8, 6, 4, 0.55);
    z-index: 55;
    pointer-events: none;
  }

  .top-nav > a,
  .top-nav > .linkish,
  .top-nav > .user-chip {
    display: block;
    width: 100%;
    padding: 0.95rem 1.15rem;
    border: 0;
    border-radius: 0;
    text-align: left;
    box-sizing: border-box;
    min-height: 3rem;
    font-size: 1.15rem;
  }

  .top-nav > .nav-drop {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    position: relative !important;
    padding: 0;
    margin: 0;
    border: 0;
    min-height: 0;
    height: auto !important;
    flex: 0 0 auto;
  }

  .top-nav details.nav-admin::details-content {
    display: block;
    position: static !important;
    height: auto !important;
    overflow: visible !important;
  }

  .top-nav > a:hover,
  .top-nav > .linkish:hover {
    background: rgba(196, 163, 90, 0.12);
    color: var(--ink);
  }

  .top-nav > .btn-nav {
    margin: 0.35rem 0.75rem 0.55rem;
    width: calc(100% - 1.5rem);
    text-align: center;
    justify-content: center;
    font-size: 1.1rem;
  }

  .top-nav > .user-chip {
    color: var(--accent2);
    font-size: 1rem;
    border-top: 1px solid var(--line);
    margin-top: 0.25rem;
  }

  /* Admin: felül, feltűnő, mindig kibontva — NEM absolute (különben egymásba csúszik) */
  .top-nav > .nav-admin {
    order: 0;
    position: relative !important;
    display: flex !important;
    flex-direction: column;
    flex: 0 0 auto;
    width: 100%;
    border-bottom: 1px solid var(--line);
    margin: 0 0 0.25rem;
    padding: 0;
    min-height: 0;
    height: auto !important;
    overflow: visible;
    z-index: auto;
  }

  .top-nav .nav-admin > .nav-drop-toggle {
    display: block;
    position: relative !important;
    width: 100%;
    padding: 0.95rem 1.15rem;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent) !important;
    background: rgba(196, 163, 90, 0.14);
    box-sizing: border-box;
  }

  /* Drawerben a dropdown soha ne lebegjen a kötetek fölött */
  .top-nav details.nav-drop,
  .top-nav details.nav-drop[open],
  .top-nav .nav-drop-menu,
  .top-nav .nav-drop-menu li,
  .top-nav .nav-drop-menu a {
    position: static !important;
    float: none !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    height: auto !important;
    max-height: none !important;
  }

  .top-nav .nav-drop-menu {
    display: flex !important;
    flex-direction: column;
    min-width: 0 !important;
    width: 100%;
    margin: 0;
    padding: 0.15rem 0 0.4rem;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    background: rgba(0, 0, 0, 0.28);
    z-index: auto !important;
    list-style: none;
  }

  .top-nav .nav-drop-menu li {
    display: block;
    width: 100%;
    flex: 0 0 auto;
  }

  .top-nav .nav-drop-menu a {
    display: block;
    padding: 0.85rem 1.15rem 0.85rem 1.5rem;
    font-size: 1.08rem;
    min-height: 2.85rem;
    white-space: normal;
    line-height: 1.35;
  }

  .top-nav > a.nav-book-link,
  .top-nav > a,
  .top-nav > .linkish,
  .top-nav > .user-chip,
  .top-nav > .btn-nav {
    position: relative !important;
    flex: 0 0 auto;
    z-index: auto;
  }

  /* Hero: CTA férjen az első képernyőre */
  .hero-bleed {
    min-height: 0;
    min-height: min(72svh, 34rem);
  }

  .hero-brand {
    font-size: clamp(1.75rem, 9vw, 2.55rem);
    line-height: 1.05;
  }

  .hero-lead {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .hero-copy {
    padding: 1.35rem var(--pad) max(1.35rem, env(safe-area-inset-bottom));
  }

  .hero-copy .cta {
    display: inline-flex;
    align-items: center;
    min-height: 2.85rem;
    padding: 0.7rem 1.15rem;
  }

  .book-resume {
    margin-left: 0;
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.35rem 0;
  }

  .book-title,
  .chapter-head h1,
  .continue-title {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Olvasás: szélesebb sáv (~98%), nagyobb betű */
  :root {
    --max: 98%;
  }

  .main {
    padding-left: max(1%, env(safe-area-inset-left));
    padding-right: max(1%, env(safe-area-inset-right));
  }

  .top {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
  }

  .hero-copy {
    padding-left: max(1rem, 3vw);
    padding-right: max(1rem, 3vw);
  }

  .books-shelf,
  .book-hero,
  .ladder,
  .toc,
  .auth,
  .chapter,
  .prose,
  .bookmarks-page,
  .scoreboard,
  .guide,
  .continuations,
  .branches,
  .actions,
  .contribute,
  .moderator {
    max-width: none;
    width: 100%;
  }

  .main:has(.hero-bleed) .books-shelf,
  .main:has(.hero-bleed) .ladder {
    padding-left: 0;
    padding-right: 0;
  }

  body {
    font-size: 1.2rem;
    line-height: 1.75;
  }

  .prose {
    font-size: 1.4rem;
    line-height: 1.9;
    max-width: none;
  }

  .prose p {
    margin: 0 0 1.2em;
  }

  .chapter-head {
    margin: 1.1rem 0 1.35rem;
  }

  .chapter-head h1 {
    font-size: clamp(2rem, 8vw, 2.6rem);
    line-height: 1.2;
  }

  .chapter-head .eyebrow {
    font-size: 0.95rem;
  }

  .chapter {
    padding-top: 0.75rem;
  }

  .continue-title {
    font-size: 1.2rem;
  }

  .toc-list,
  .toc-list a {
    font-size: 1.15rem;
  }

  .book-title {
    font-size: 1.3rem;
  }

  .book-sub,
  .hint {
    font-size: 1.05rem;
  }

  .nav-btn {
    font-size: 1.1rem;
  }

  .chapter-nav {
    flex-direction: column;
  }

  .chapter-nav .nav-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    min-height: 2.85rem;
    display: inline-flex;
    align-items: center;
  }

  .continue-link {
    grid-template-columns: 1fr;
    gap: 0.25rem 0.5rem;
    padding: 0.85rem 0.9rem;
  }

  .continue-meta {
    justify-self: start;
  }

  .action-row,
  .share-row {
    gap: 0.5rem;
  }

  .act,
  .share-row a.act,
  .cta.compact {
    min-height: 2.75rem;
    flex: 1 1 calc(50% - 0.5rem);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .main {
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  }

  .foot {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  .score-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .contribute input,
  .contribute textarea,
  .auth input,
  .admin-create-form input,
  .admin-create-form textarea,
  .admin-ai-threads textarea {
    font-size: 16px; /* iOS zoom elkerülés */
  }
}

@media (max-width: 420px) {
  .nav-panel-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .nav-panel-toggle {
    padding: 0.55rem 0.7rem;
  }

  .brand {
    max-width: calc(100vw - 4.5rem);
  }
}

@media (min-width: 701px) and (min-device-width: 1025px) and (hover: hover) and (pointer: fine) {
  .nav-panel-toggle {
    display: none !important;
  }
  .nav-panel .top-nav {
    display: flex !important;
    position: static;
    left: auto;
    right: auto;
    top: auto;
    width: auto;
    flex-direction: row;
    max-height: none;
    overflow: visible;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .nav-panel.is-open::after {
    content: none;
  }

  .top-nav {
    font-size: 0.9rem;
  }

  .top-nav > .nav-admin {
    order: 0;
    border-bottom: 0;
    margin-bottom: 0;
    padding: 0;
    display: block !important;
  }

  .top-nav .nav-admin > .nav-drop-toggle {
    display: list-item;
    width: auto;
    padding: 0;
    font-size: inherit;
    font-weight: inherit;
    color: var(--muted);
    background: transparent;
  }

  .top-nav .nav-drop-menu {
    display: revert;
    position: absolute;
    right: 0;
    top: calc(100% + 0.45rem);
    min-width: 12.5rem;
    margin: 0;
    padding: 0.4rem 0;
    border: 1px solid var(--line);
    border-radius: 0.35rem;
    box-shadow: 0 0.6rem 1.4rem rgba(0, 0, 0, 0.45);
    background: #1c1915;
  }

  .top-nav .nav-drop-menu a {
    padding: 0.45rem 0.9rem;
    font-size: inherit;
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cta { transition: none; }
  .hero-bleed,
  .hero-veil,
  .hero-bleed .hero-kicker,
  .hero-bleed .hero-brand,
  .hero-bleed .hero-lead,
  .hero-bleed .cta,
  .book-hero-art { animation: none; }
}

/* ——— cron-job.org admin ——— */
.cjo-page .hero-lead { max-width: 48rem; }
.cjo-page .cjo-url { max-width: none; }
.cjo-page .cjo-sched { max-width: none; }
.cjo-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1rem 0 1.25rem;
}
.cjo-stat {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.16);
  display: grid;
  gap: 0.15rem;
}
.cjo-stat-n {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.1;
}
.cjo-stat-l {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.cjo-stat.is-warn .cjo-stat-n { color: #e08a4a; }
.cjo-pill {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.45rem;
  border-radius: 0.2rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.cjo-pill-ok {
  color: var(--accent2, #6b8f71);
  border-color: color-mix(in srgb, var(--accent2, #6b8f71) 45%, transparent);
}
.cjo-pill-err {
  color: #c97868;
  border-color: color-mix(in srgb, #c97868 45%, transparent);
}
.cjo-pill-idle { color: var(--muted); }
.cjo-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 1rem;
}
.cjo-folders {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.cjo-folder {
  font-size: 0.86rem;
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  color: var(--ink);
  text-decoration: none;
  background: rgba(0, 0, 0, 0.12);
}
.cjo-folder.is-active {
  border-color: color-mix(in srgb, var(--accent2, #6b8f71) 55%, transparent);
  color: var(--accent2, #6b8f71);
}
.cjo-inline-form {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.cjo-inline-form input {
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  padding: 0.4rem 0.55rem;
  min-width: 10rem;
}
.cjo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.cjo-span2 { grid-column: 1 / -1; }
.cjo-check {
  display: flex !important;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.cjo-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  margin: 1rem 0;
  background: rgba(0, 0, 0, 0.14);
}
.cjo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.cjo-table th,
.cjo-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
.cjo-table th {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.cjo-table tr.is-off { opacity: 0.62; }
.cjo-title { font-weight: 600; margin-bottom: 0.15rem; }
.cjo-url {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cjo-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.cjo-sched { font-size: 0.84rem; }
.cjo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 9rem;
}
.cjo-btn {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.cjo-btn-danger { color: #c97868; border-color: color-mix(in srgb, #c97868 40%, transparent); }
.cjo-empty { color: var(--muted); text-align: center !important; padding: 1.4rem !important; }
.cjo-hist-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.cjo-hist-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.cjo-folder-mgmt {
  margin: 1.25rem 0 0.5rem;
  color: var(--muted);
}
.cjo-folder-mgmt summary { cursor: pointer; }
@media (max-width: 760px) {
  .cjo-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cjo-grid { grid-template-columns: 1fr; }
  .cjo-span2 { grid-column: auto; }
}

