:root {
  --bg: #0b0a09;
  --panel: #161310;
  --ink: #f3e6d0;
  --muted: #b9a789;
  --accent: #c45c26;
  --accent2: #e0a45a;
  --line: rgba(243,230,208,.12);
  --card: #1c1712;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 16px;
  --max: 920px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: "Noto Sans SC", "Segoe UI", system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; }
.wrap { width: min(100% - 1.5rem, var(--max)); margin: 0 auto; }
.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(11,10,9,.82);
  border-bottom: 1px solid var(--line);
}
.site-header .inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; }
.brand { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.brand strong { font-size: 1.05rem; letter-spacing: .04em; }
.brand span { color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-switch { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: .2rem; }
.lang-switch button { padding: .45rem .85rem; border-radius: 999px; color: var(--muted); }
.lang-switch button[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent), #9a3d16); color: #fff; }
.hero { padding: 1.6rem 0 1rem; }
.hero h1 { margin: 0 0 .4rem; font-size: clamp(1.5rem, 4vw, 2.2rem); line-height: 1.2; }
.hero p { margin: 0; color: var(--muted); line-height: 1.6; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 1rem; padding: 0 0 3rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.card:hover, .card:focus-within { transform: translateY(-2px); border-color: rgba(224,164,90,.45); }
.card .thumb { aspect-ratio: 2 / 3; background: #000; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .meta { padding: .85rem .9rem 1rem; }
.card .meta .num { color: var(--accent2); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.card .meta h2 { margin: .25rem 0 0; font-size: .98rem; line-height: 1.35; font-weight: 650; }
.progress-chip { margin-top: .55rem; color: var(--muted); font-size: .75rem; }
.reader-top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .6rem;
  padding: .7rem .9rem; background: rgba(11,10,9,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px);
}
.reader-top .back, .reader-top .navbtn {
  min-width: 2.4rem; height: 2.4rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  display: inline-flex; align-items: center; justify-content: center;
}
.reader-top .titles { flex: 1; min-width: 0; }
.reader-top .titles strong { display: block; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-top .titles span { display: block; color: var(--muted); font-size: .75rem; }
.reader-pages { display: flex; flex-direction: column; gap: .55rem; padding: .55rem .35rem calc(4.5rem + var(--safe-bottom)); }
.reader-pages figure { margin: 0; background: #000; }
.reader-pages img {
  width: 100%; height: auto; margin: 0 auto;
  background: #111; content-visibility: auto;
}
.reader-pages .placeholder {
  width: 100%; aspect-ratio: 2 / 3; background: linear-gradient(180deg, #1a1510, #0d0b09);
}
.reader-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: .65rem .9rem calc(.65rem + var(--safe-bottom));
  background: rgba(11,10,9,.94); border-top: 1px solid var(--line); backdrop-filter: blur(12px);
  display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center;
}
.reader-bar .page-label { color: var(--muted); font-size: .85rem; min-width: 4.5rem; }
.reader-bar input[type=range] { width: 100%; accent-color: var(--accent); }
.toast {
  position: fixed; left: 50%; bottom: calc(4.8rem + var(--safe-bottom)); transform: translateX(-50%);
  background: rgba(28,23,18,.95); border: 1px solid var(--line); color: var(--ink);
  padding: .55rem .9rem; border-radius: 999px; font-size: .82rem; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
@media (min-width: 800px) {
  .reader-pages { width: min(100%, 820px); margin: 0 auto; padding-left: 0; padding-right: 0; }
}

/* —— Comments —— */
.comments {
  width: min(100% - 1.5rem, 820px);
  margin: 1.5rem auto 0;
  padding: 1.25rem 1rem calc(5.5rem + var(--safe-bottom));
  border-top: 1px solid var(--line);
}
.comments h2 {
  margin: 0 0 .35rem;
  font-size: 1.15rem;
  letter-spacing: .02em;
}
.comments .sub {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: .85rem;
}
.comment-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.comment-form label {
  display: grid;
  gap: .35rem;
  font-size: .82rem;
  color: var(--muted);
}
.comment-form input[type=text],
.comment-form textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: .65rem .75rem;
  font: inherit;
  resize: vertical;
}
.comment-form textarea { min-height: 5.5rem; }
.comment-form .hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.comment-form .actions {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.comment-form .submit {
  background: linear-gradient(135deg, var(--accent), #9a3d16);
  color: #fff;
  border-radius: 999px;
  padding: .55rem 1.15rem;
  font-weight: 600;
}
.comment-form .submit:disabled { opacity: .55; cursor: not-allowed; }
.comment-form .status { font-size: .82rem; color: var(--muted); }
.comment-form .status.err { color: #e07070; }
.comment-form .status.ok { color: #7ecf8a; }
.cf-turnstile { margin-top: .15rem; }
.comment-list { display: grid; gap: .85rem; }
.comment-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .85rem 1rem;
}
.comment-item .head {
  display: flex; justify-content: space-between; gap: .75rem;
  align-items: baseline; margin-bottom: .35rem;
}
.comment-item .nick { font-weight: 650; color: var(--accent2); }
.comment-item .when { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.comment-item .body {
  white-space: pre-wrap; word-break: break-word; line-height: 1.55; font-size: .95rem;
}
.comment-empty { color: var(--muted); font-size: .9rem; padding: .5rem 0; }

/* Admin */
.admin-wrap { width: min(100% - 1.5rem, 920px); margin: 0 auto; padding: 1.5rem 0 3rem; }
.admin-wrap h1 { margin: 0 0 .75rem; font-size: 1.4rem; }
.admin-login, .admin-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}
.admin-login input {
  width: min(100%, 28rem); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); padding: .65rem .75rem; font: inherit;
}
.admin-row {
  display: grid; gap: .35rem; padding: .85rem 0; border-bottom: 1px solid var(--line);
}
.admin-row .meta { color: var(--muted); font-size: .78rem; }
.admin-row .del {
  justify-self: start; margin-top: .35rem;
  background: #5a1e1e; color: #ffd0d0; border-radius: 999px; padding: .35rem .9rem; font-size: .8rem;
}

/* —— Zoom lightbox —— */
.reader-pages figure.zoomable { position: relative; }
.zoom-trigger {
  position: absolute; right: .55rem; top: .55rem; z-index: 5;
  width: 2.35rem; height: 2.35rem; border-radius: 999px;
  border: 1px solid rgba(243,230,208,.28);
  background: rgba(11,10,9,.72); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.zoom-trigger:hover, .zoom-trigger:focus-visible {
  border-color: rgba(224,164,90,.7); color: #fff;
  background: rgba(196,92,38,.85); outline: none;
}
.zoom-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.94);
  display: grid;
  grid-template-rows: auto 1fr;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.zoom-top {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .65rem .85rem; background: rgba(11,10,9,.9);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(10px);
}
.zoom-page { color: var(--muted); font-size: .9rem; }
.zoom-actions { display: inline-flex; gap: .4rem; }
.zoom-btn {
  min-width: 2.4rem; height: 2.4rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem; line-height: 1;
}
.zoom-btn:hover, .zoom-btn:focus-visible { border-color: rgba(224,164,90,.55); outline: none; }
.zoom-close { font-size: 1.4rem; }
.zoom-stage {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  cursor: grab; touch-action: none;
}
.zoom-stage:active { cursor: grabbing; }
.zoom-img {
  max-width: 100%; max-height: calc(100vh - 4.5rem);
  width: auto; height: auto;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
  transition: none;
}
.zoom-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 5; width: 2.6rem; height: 2.6rem; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(22,19,16,.85); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.zoom-nav:disabled { opacity: .3; pointer-events: none; }
.zoom-prev { left: .55rem; }
.zoom-next { right: .55rem; }
.zoom-hint {
  position: absolute; left: 50%; bottom: 1.1rem; transform: translateX(-50%);
  color: var(--muted); font-size: .8rem; pointer-events: none;
  background: rgba(11,10,9,.65); padding: .25rem .65rem; border-radius: 999px;
  border: 1px solid var(--line);
}
.zoom-hint:empty { display: none; }
@media (max-width: 640px) {
  .zoom-nav { width: 2.2rem; height: 2.2rem; font-size: 1.25rem; }
  .zoom-prev { left: .25rem; }
  .zoom-next { right: .25rem; }
}
