:root {
  --bg: #fff6ee;
  --bg-2: #ffffff;
  --bg-3: #ffe8d4;
  --ink: #1c1917;
  --muted: #6b635c;
  --gold: #ff5a1f;
  --gold-2: #ff7a45;
  --line: rgba(28, 25, 23, 0.12);
  --danger: #e11d48;
  --like: #e11d48;
  --fav: #f59e0b;
  --shadow: 0 18px 40px rgba(255, 90, 31, 0.12);
  --serif: "Outfit", "Segoe UI", sans-serif;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --radius: 18px;
  --top: 72px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; width: 100%; max-width: 100%; }

html { background: var(--bg); overflow-x: clip; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0.01em;
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 12px;
  width: 100%;
  background: rgba(255, 246, 238, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: block;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-name {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav a {
  padding: 8px 14px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.nav a:hover { color: var(--ink); }

.nav-cta {
  color: #fff !important;
  background: var(--gold);
  border-radius: 999px;
}

.who {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: var(--bg-3);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.who img { width: 100%; height: 100%; object-fit: cover; }

.wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 20px 12px 72px;
}
.page-album .wrap { padding-top: 24px; padding-bottom: 72px; }

.foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

.foot-inner {
  width: 100%;
  padding: 28px 16px 32px;
}

.foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.foot-brand .brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.foot-jsoft {
  display: inline-flex;
  align-items: center;
}

.foot-jsoft img {
  height: 28px;
  width: auto;
  border-radius: 4px;
}

.foot-copy {
  margin: 20px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.sep { opacity: 0.5; }

h1, h2 {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
}

h1 { font-size: clamp(26px, 2.8vw, 36px); font-weight: 700; }
h2 { font-size: 22px; margin-bottom: 16px; font-weight: 700; }
h1 em { font-style: normal; color: var(--gold); }

.eyebrow {
  margin: 0 0 12px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
}

.lede {
  max-width: 560px;
  color: var(--muted);
  font-size: 17px;
}

.lede.tight { margin-top: 10px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 40px;
}

.hero {
  display: block;
  max-width: 640px;
  padding: 12px 0 40px;
}
.hero .lede { max-width: none; }
.hero h1 { font-size: clamp(32px, 4vw, 48px); font-weight: 700; line-height: 1.15; }

.hero-actions, .form-actions, .uploader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
}

.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-2); }
.btn-ghost { border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-block { width: 100%; }
.btn[aria-pressed="true"] { color: var(--like); border-color: var(--like); background: #fff; }
.btn[data-fav][aria-pressed="true"] { color: var(--fav); border-color: var(--fav); }

.toast {
  width: calc(100% - 56px);
  margin: 16px 28px 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 12px;
}

.toast-error { border-color: rgba(225, 29, 72, 0.35); color: var(--danger); }
.toast-ok { border-color: rgba(255, 90, 31, 0.35); color: var(--gold); }

.empty {
  border: 2px dashed var(--line);
  padding: 72px 24px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border-radius: 16px;
}

.sq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 12px;
  width: 100%;
}

.sq {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-2);
  isolation: isolate;
  display: block;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(28, 25, 23, 0.08);
}

.sq img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.04);
  transition: transform 0.8s ease;
}

.sq:hover img { transform: scale(1.12); }

.sq-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 42%, rgba(28, 25, 23, 0.78) 100%);
}

.sq-n {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
}

.sq-body {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #fff;
}

.sq-title {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
}

.sq-meta, .sq-loc {
  font-size: 12px;
  color: rgba(255,255,255,0.82);
  letter-spacing: 0.02em;
}

.sq-stats {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.sq-flags {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  gap: 6px;
}

.pill {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  border-radius: 999px;
  font-weight: 700;
}

.sq-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
}

.sq-new {
  display: grid;
  place-items: center;
  border: 2px dashed var(--line);
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  gap: 8px;
  background: #fff;
  box-shadow: none;
}

.sq-new:hover { border-color: var(--gold); color: var(--gold); }
.sq-plus { font-size: 42px; font-family: var(--serif); line-height: 1; }

.more-link { margin-top: 16px; }
.more-link a { color: var(--gold); font-weight: 600; }

.block { margin-top: 72px; }

.form {
  display: grid;
  gap: 18px;
  max-width: 420px;
}

.form-wide { max-width: 640px; }

.form label, .form fieldset {
  display: grid;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.form input, .form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  outline: none;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  color: var(--ink);
}

.form input:focus, .form textarea:focus { border-color: var(--gold); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error { color: var(--danger); }

.vis { border: 1px solid var(--line); padding: 16px; display: grid; gap: 12px; }
.choice {
  display: grid !important;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--ink) !important;
  font-size: 14px !important;
}
.choice strong { display: block; font-size: 15px; }
.choice span { color: var(--muted); }

.auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  min-height: calc(100vh - 220px);
}

.auth-aside {
  min-height: 380px;
  display: grid;
  place-items: center;
  padding: 48px;
  background: var(--gold);
  color: #fff;
  border-radius: 24px;
}

.auth-aside blockquote {
  font-family: var(--sans);
  font-size: 32px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  max-width: 16ch;
}

.auth-switch { color: var(--muted); }
.auth-switch a { color: var(--gold); text-decoration: underline; }

.page-album h1 { font-size: clamp(26px, 3vw, 38px); font-weight: 700; }
.album-hero { margin-bottom: 24px; }
.album-range {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 600;
  margin: 8px 0 0;
  color: var(--gold);
}
.album-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  font-weight: 600;
  color: var(--muted);
}
.album-loc { margin: 6px 0 0; }
.album-loc a { color: var(--muted); border-bottom: 1px solid var(--line); }
.album-desc { max-width: 640px; color: var(--muted); margin-top: 16px; }
.album-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.album-owner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.album-owner a {
  color: var(--ink);
}

.album-owner .btn-follow {
  min-height: 32px;
  padding: 0 14px;
  font-size: 11px;
}

.profile-head .btn-follow {
  margin-top: 12px;
}

.modes {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.mode {
  padding: 10px 18px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.mode.is-on { background: var(--ink); color: var(--bg); }

.uploader.compact { margin: 48px 0 0; }
.uploader.compact .drop { padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; text-align: left; }
.uploader.compact .drop p { margin: 0; }
.uploader.compact .uploader-actions { margin-top: 0; }
.drop {
  border: 2px dashed var(--line);
  padding: 28px;
  text-align: center;
  background: #fff;
  border-radius: 16px;
}
.drop.is-over { border-color: var(--gold); background: var(--bg-3); }
.drop p { margin: 0 0 16px; color: var(--muted); }
.progress {
  margin-top: 18px;
  height: 8px;
  background: var(--bg-3);
  position: relative;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  min-width: 0;
  background: var(--gold);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.progress em {
  position: absolute;
  right: 0;
  top: 12px;
  font-size: 11px;
  color: var(--muted);
  font-style: normal;
}

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(28, 25, 23, 0.5);
  display: grid;
  place-items: center;
  padding: 24px;
}
.upload-overlay[hidden] { display: none; }
.upload-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.upload-spin {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  box-sizing: border-box;
  border: 4px solid var(--bg-3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: upload-spin 0.8s linear infinite;
}
@keyframes upload-spin { to { transform: rotate(360deg); } }
.upload-title {
  margin: 0;
  font-weight: 700;
  font-size: 16px;
}
.upload-card .progress { margin-top: 18px; }
.upload-count {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.matrix {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.cell {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: var(--bg-2);
  overflow: hidden;
  border-radius: 10px;
}

.cell-open {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.cell:hover img { transform: scale(1.06); }

.cell-like {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cell-like:hover { transform: scale(1.06); }
.cell-like[aria-pressed="true"] { color: var(--like); }

.cell-del,
.page-del {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--danger);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.cell-del:hover,
.page-del:hover {
  background: var(--danger);
  color: #fff;
}

.cell-stats {
  position: absolute;
  left: 10px;
  bottom: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.45);
  pointer-events: none;
}

.book-stage {
  position: relative;
  min-height: 0;
  margin: 8px 0 40px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.book-row {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 8px;
}

.book {
  width: min(920px, 100%);
  margin: 0 auto;
  max-height: min(52vh, calc(100dvh - 280px));
  aspect-ratio: 1.55 / 1;
  background: #1a1612;
  border-radius: 6px 14px 14px 6px;
  box-shadow:
    0 0 0 10px #2a241c,
    0 0 0 11px rgba(196, 165, 116, 0.35),
    var(--shadow);
  position: relative;
  overflow: hidden;
  perspective: 2200px;
  transform-style: preserve-3d;
}

.book.is-turning { pointer-events: none; }

.book::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 28px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.45), transparent);
  z-index: 4;
  pointer-events: none;
}

.book-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
}

.page {
  position: relative;
  overflow: hidden;
  background: #100e0c;
  height: 100%;
}

.page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 28px 14px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.62));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  z-index: 2;
  pointer-events: none;
}

.page-cover {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 36px;
  background: var(--gold);
  color: #fff;
}

.page-cover h3 {
  font-family: var(--sans);
  font-size: clamp(22px, 3vw, 36px);
  margin: 0 0 8px;
  font-weight: 700;
}

.page-cover p { margin: 0; color: rgba(255,255,255,0.85); }
.page-blank {
  display: grid;
  place-items: center;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 11px;
}

.leaf {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  z-index: 5;
  transform-style: preserve-3d;
  will-change: transform;
  pointer-events: none;
}

.leaf-next {
  right: 0;
  transform-origin: left center;
}

.leaf-prev {
  left: 0;
  transform-origin: right center;
}

.leaf-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #100e0c;
}

.leaf-back { transform: rotateY(180deg); }

.leaf-face .page { width: 100%; height: 100%; }

.leaf-next.is-turning {
  animation: book-turn-next 0.78s cubic-bezier(0.37, 0.02, 0.22, 1) forwards;
}

.leaf-prev.is-turning {
  animation: book-turn-prev 0.78s cubic-bezier(0.37, 0.02, 0.22, 1) forwards;
}

.leaf-face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.leaf-next .leaf-front::after {
  background: linear-gradient(90deg, rgba(0,0,0,0.28), transparent 24%);
}

.leaf-next .leaf-back::after {
  background: linear-gradient(270deg, rgba(0,0,0,0.28), transparent 24%);
}

.leaf-prev .leaf-front::after {
  background: linear-gradient(270deg, rgba(0,0,0,0.28), transparent 24%);
}

.leaf-prev .leaf-back::after {
  background: linear-gradient(90deg, rgba(0,0,0,0.28), transparent 24%);
}

@keyframes book-turn-next {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-180deg); }
}

@keyframes book-turn-prev {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(180deg); }
}

.book-nav {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.book-nav:hover { border-color: var(--gold); color: var(--gold); }
.book-nav:disabled { opacity: 0.35; cursor: default; }

.book-counter {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 8px 20px;
  text-align: center;
  color: var(--muted);
  letter-spacing: 0.18em;
  font-size: 12px;
  line-height: 1.6;
  text-transform: uppercase;
  scroll-margin-bottom: 28px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100dvh;
  box-sizing: border-box;
  background: rgba(20, 16, 14, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 12px 20px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pan-y;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox:fullscreen,
.lightbox:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-height: 100%;
  padding: 48px 20px 24px;
}

.lightbox:fullscreen img,
.lightbox:-webkit-full-screen img {
  max-height: calc(100dvh - 180px);
  max-width: 100%;
}

.lightbox figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  max-width: min(1100px, 100%);
  max-height: 100%;
}

.lightbox img {
  display: block;
  max-height: calc(100dvh - 220px);
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: var(--shadow);
}

.lightbox figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 16px;
  max-width: 100%;
  width: 100%;
  padding: 0 8px;
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.lb-cap-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
}

.lightbox figcaption [data-lb-cap] {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.lightbox figcaption [data-lb-cap].is-editable {
  cursor: pointer;
  border-bottom: 1px dotted rgba(255,255,255,0.45);
}

.lb-cap-btn {
  background: none;
  border: 0;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px 0;
}

.lb-cap-form {
  display: flex;
  gap: 8px;
  align-items: center;
  width: min(520px, 100%);
  min-width: 0;
}

.lb-cap-form[hidden] { display: none !important; }

.lb-cap-form input {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
}

.lb-cap-form input::placeholder { color: rgba(255,255,255,0.55); }

.lb-cap-save {
  flex-shrink: 0;
  background: var(--gold);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lightbox figcaption [data-lb-idx] {
  flex-shrink: 0;
  opacity: 0.8;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.lb-close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  z-index: 3;
  background: none;
  border: 0;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  padding: 8px;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(20, 16, 14, 0.45);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  touch-action: manipulation;
}

.lb-nav.prev { left: max(8px, env(safe-area-inset-left, 0px)); }
.lb-nav.next { right: max(8px, env(safe-area-inset-right, 0px)); }

.lb-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.lb-tools button {
  background: #fff;
  border: 0;
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
}

.lb-tools button.lb-del {
  background: var(--danger);
  color: #fff;
}

.lb-views { color: #fff; font-weight: 600; }

.social { margin-top: 64px; max-width: 640px; }
.comments { display: grid; gap: 18px; margin-bottom: 20px; }
.comment { display: grid; grid-template-columns: 40px 1fr; gap: 12px; }
.comment time { color: var(--muted); font-size: 12px; margin-left: 8px; }
.comment p { margin: 4px 0 0; }
.comment-form { display: grid; gap: 10px; }
.comment-form textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 12px;
  min-height: 72px;
}

.av, .av span {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-3);
  display: grid;
  place-items: center;
  font-size: 12px;
}

.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg, .av.lg span { width: 84px; height: 84px; font-size: 22px; }
.av.xl, .av.xl span { width: 112px; height: 112px; font-size: 28px; }

.profile-head {
  display: flex;
  gap: 28px;
  align-items: center;
  margin-bottom: 48px;
}

.avatar-edit { display: flex; align-items: center; gap: 16px; }
.muted { color: var(--muted); }
.danger { margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }
.dot { margin: 0 8px; opacity: 0.5; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(8, 7, 6, 0.72);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] { display: none; }

.modal-card {
  width: min(480px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 28px;
  position: relative;
}

.modal-x {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: 0;
  font-size: 28px;
  color: var(--muted);
}

.share-form { position: relative; margin: 16px 0; }
.share-form input {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.suggest {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg-3);
}

.suggest:empty { display: none; }
.suggest button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 12px;
}
.suggest button:hover { background: rgba(196,165,116,0.08); }

.share-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.share-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.share-list em { color: var(--muted); font-style: normal; }
.share-list button {
  background: none;
  border: 0;
  color: var(--danger);
  font-size: 12px;
}

@media (max-width: 900px) {
  .hero { padding-bottom: 28px; }
  .matrix { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { min-height: 220px; }
  .book { aspect-ratio: 0.72 / 1; }
  .book-spread { grid-template-columns: 1fr; }
  .book::before,
  .leaf { display: none; }
  .page:nth-child(2) { display: none; }
}

@media (max-width: 640px) {
  .top { padding: 0 16px; gap: 8px; }
  .nav a { padding: 8px 8px; font-size: 11px; }
  .brand-name { font-size: 15px; }
  .wrap { width: 100%; padding: 16px 10px 56px; }
  .matrix { grid-template-columns: repeat(2, 1fr); }
  .form-row, .profile-head, .page-head { grid-template-columns: 1fr; display: grid; }
  .book-row { grid-template-columns: 40px 1fr 40px; }
  .foot-row { justify-content: center; }
  .foot-copy { text-align: center; }
  .lightbox {
    padding: 48px 8px 12px;
    padding-left: max(8px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  .lightbox img {
    max-height: calc(100dvh - 210px);
    max-width: 100%;
  }
  .lb-nav {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  .lb-nav.prev { left: max(8px, env(safe-area-inset-left, 0px)); }
  .lb-nav.next { right: max(8px, env(safe-area-inset-right, 0px)); }
  .lb-tools { gap: 8px; padding: 0 4px; }
  .lb-tools button { padding: 8px 12px; }
  .lb-cap-form { width: 100%; }
}
