/* ——— Design system : édition littéraire premium ——— */
:root {
  --bg: #070605;
  --bg-elevated: #100e0c;
  --surface: #161412;
  --surface-2: #1e1b18;
  --border: rgba(212, 175, 55, 0.14);
  --border-strong: rgba(212, 175, 55, 0.28);
  --gold: #e4c76b;
  --gold-mid: #c9a227;
  --gold-dim: #8a7028;
  --gold-glow: rgba(228, 199, 107, 0.22);
  --text: #f6f1e8;
  --text-muted: rgba(246, 241, 232, 0.58);
  --danger: #f07167;
  --success: #7fd8a8;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-logo: "Italiana", var(--font-display);
  --font-ui: "Outfit", system-ui, sans-serif;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-soft: 0 20px 60px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 28px 90px rgba(0, 0, 0, 0.55);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

.site-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.site-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: var(--noise);
  opacity: 1;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 900px 520px at 15% -8%, rgba(228, 199, 107, 0.09), transparent 55%),
    radial-gradient(ellipse 700px 480px at 92% 8%, rgba(120, 80, 40, 0.2), transparent 50%),
    radial-gradient(ellipse 600px 400px at 50% 100%, rgba(40, 32, 24, 0.5), transparent 45%);
  animation: ambient-drift 16s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    filter: hue-rotate(0deg);
  }
  100% {
    transform: translate3d(0, -10px, 0) scale(1.02);
    filter: hue-rotate(-4deg);
  }
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}
a:hover {
  color: #f0dc98;
}

:focus-visible {
  outline: 2px solid var(--gold-mid);
  outline-offset: 3px;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(1180px, 92vw);
  margin-inline: auto;
}

.main-public {
  position: relative;
  z-index: 1;
  padding-block: 0 4.5rem;
}

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(7, 6, 5, 0.92) 0%, rgba(7, 6, 5, 0.78) 100%);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-logo);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}
.logo:hover {
  color: var(--gold);
  text-decoration: none;
}

.logo-img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(228, 199, 107, 0.18), 0 10px 30px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.02);
}

.logo-text {
  background: linear-gradient(100deg, #fff 0%, var(--gold) 45%, #c9a227 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-main {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.nav-toggle:hover {
  border-color: var(--border-strong);
  background: rgba(228, 199, 107, 0.06);
  transform: translateY(-1px);
}
.nav-toggle__bar {
  display: block;
  width: 18px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-mid));
  border-radius: 2px;
  box-shadow: 0 0 18px rgba(228, 199, 107, 0.22);
}
.nav-toggle__bar + .nav-toggle__bar {
  margin-top: 6px;
}

/* Mobile menu */
@media (max-width: 720px) {
  .header-inner {
    padding: 0.85rem 0;
  }
  .nav-toggle {
    display: inline-flex;
  }
  .nav-main {
    position: fixed;
    left: 0;
    right: 0;
    top: 70px;
    margin: 0;
    padding: 0.9rem 0.9rem 1.1rem;
    display: grid;
    gap: 0.55rem;
    background: rgba(7, 6, 5, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    transform: translateY(-14px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
    z-index: 60;
  }
  .nav-link {
    width: min(520px, 92vw);
    margin-inline: auto;
    justify-content: center;
    padding: 0.85rem 1rem;
    font-size: 0.8rem;
  }
  .header-social {
    width: min(520px, 92vw);
    margin: 0.35rem auto 0.1rem;
    padding: 0.7rem 0.8rem 0.1rem;
    border-left: none;
    justify-content: center;
    border-top: 1px solid rgba(228, 199, 107, 0.12);
  }
  html.nav-open .nav-main,
  body.nav-open .nav-main,
  .site-header:focus-within .nav-main {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}

.nav-link {
  position: relative;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.25s var(--ease-out), border-color 0.25s, background 0.25s;
}
.nav-link span {
  position: relative;
  z-index: 1;
}

.nav-ico {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.55rem;
  color: rgba(246, 241, 232, 0.7);
}
.nav-ico svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
}
.nav-link:hover .nav-ico {
  color: var(--gold);
}
.nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(228, 199, 107, 0.12), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
}
.nav-link:hover {
  color: var(--text);
  border-color: var(--border);
  text-decoration: none;
}
.nav-link:hover::before {
  opacity: 1;
}
/* admin link removed from public header */

/* Social icons (header) */
.header-social {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.3rem;
  padding-left: 0.55rem;
  border-left: 1px solid rgba(228, 199, 107, 0.12);
}

.header-social__icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  transition: transform 0.25s var(--ease-out), border-color 0.25s, background 0.25s, color 0.25s;
}
.header-social__icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  display: block;
}
.header-social__icon:hover {
  transform: translateY(-1px);
  border-color: rgba(228, 199, 107, 0.18);
  background: rgba(228, 199, 107, 0.06);
  color: var(--gold);
  text-decoration: none;
}

/* ——— Reveal (scroll) ——— */
.reveal {
  opacity: 1;
  transform: none;
}
.js-ready .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.85s var(--ease-out), transform 0.85s var(--ease-out);
}
.js-ready .reveal.is-visible {
  opacity: 1;
  transform: none;
}
.reveal-delay-1 {
  transition-delay: 0.12s;
}
.reveal-delay-2 {
  transition-delay: 0.22s;
}

/* ——— Hero ——— */
.hero-block {
  position: relative;
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 4vw, 3.5rem);
  margin-bottom: 0;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-bg__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}
.hero-bg__glow--1 {
  width: min(520px, 70vw);
  height: min(520px, 70vw);
  top: -180px;
  left: -120px;
  background: rgba(228, 199, 107, 0.12);
}
.hero-bg__glow--2 {
  width: min(400px, 55vw);
  height: min(400px, 55vw);
  bottom: -100px;
  right: -80px;
  background: rgba(90, 60, 35, 0.35);
}

.hero-bg__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero-visual--mobile {
  display: none;
}

@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-text .eyebrow,
  .hero-cta {
    justify-content: center;
  }
  .hero-text .eyebrow-line {
    display: none;
  }
  .hero-visual--desktop {
    display: none;
  }
  .hero-visual--mobile {
    display: block;
    margin: 1rem auto 0.6rem;
    max-width: 260px;
  }
  .hero-visual--mobile .author-frame {
    max-width: 260px;
    margin-inline: auto;
  }
  .hero-visual--mobile .author-photo {
    width: 170px;
    max-width: 170px;
    height: auto;
    margin-inline: auto;
    aspect-ratio: 4 / 5;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--gold-dim);
  margin: 0 0 1rem;
}

.eyebrow-line {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-mid), transparent);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.75rem, 6.5vw, 4.25rem);
  line-height: 1.02;
  margin: 0 0 0.6rem;
  letter-spacing: -0.02em;
  background: linear-gradient(118deg, #fffef8 0%, var(--gold) 42%, #a67c1a 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 80px rgba(228, 199, 107, 0.15);
}

.hero-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  color: var(--text-muted);
  margin: 0 0 1.35rem;
  max-width: 36ch;
}

@media (max-width: 960px) {
  .hero-tagline {
    margin-inline: auto;
  }
}

.hero-bio {
  font-size: 1.06rem;
  color: var(--text-muted);
  max-width: 46ch;
  line-height: 1.75;
}

@media (max-width: 960px) {
  .hero-bio {
    margin-inline: auto;
  }
}

.hero-cta {
  margin: 2rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Author frame */
.author-frame {
  position: relative;
  margin: 0;
  max-width: 440px;
  margin-inline: auto;
}

.author-frame__ring {
  position: absolute;
  inset: -12px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(228, 199, 107, 0.35), transparent 40%, rgba(228, 199, 107, 0.08) 100%);
  opacity: 0.9;
  z-index: 0;
  animation: ring-pulse 8s ease-in-out infinite;
}

@keyframes ring-pulse {
  0%,
  100% {
    opacity: 0.75;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.01);
  }
}

.author-photo {
  position: relative;
  z-index: 1;
  width: 100%;
  display: block;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift), 0 0 0 1px var(--border-strong);
  object-fit: cover;
  aspect-ratio: 4 / 5;
  transform: rotate(-1.5deg);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s;
}

@media (max-width: 960px) {
  .author-photo {
    transform: none;
    max-width: 360px;
  }
}

.is-home .hero-visual:hover .author-photo {
  transform: rotate(0deg) scale(1.02);
  box-shadow: var(--shadow-lift), 0 0 60px rgba(228, 199, 107, 0.12);
}

.author-photo.placeholder {
  min-height: 400px;
  background:
    linear-gradient(160deg, rgba(228, 199, 107, 0.06), transparent),
    linear-gradient(145deg, var(--surface-2), #0a0908);
}

/* Section divider */
.section-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 2.5rem 0 1.5rem;
  position: relative;
  z-index: 1;
}

.section-divider__line {
  flex: 1;
  max-width: 180px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.section-divider__ornament {
  font-size: 0.75rem;
  color: var(--gold-dim);
  letter-spacing: 0.2em;
  opacity: 0.85;
}

/* ——— Books ——— */
.section-books {
  position: relative;
  z-index: 1;
  padding-block: 0 4rem;
}

.section-head {
  margin-bottom: 2.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.section-head__text {
  max-width: 52ch;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.section-lead {
  color: var(--text-muted);
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.6;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

@media (max-width: 520px) {
  .book-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .book-card-link {
    padding: 0.9rem;
    display: block;
    text-align: center;
  }
  .book-cover-wrap {
    width: 100%;
    max-width: clamp(160px, 62vw, 240px);
    margin: 0.2rem auto 0.9rem;
    border-radius: 0;
    box-shadow: none;
  }
  .badge {
    transform: scale(0.92);
    transform-origin: top right;
  }
  .book-title {
    font-size: 1.15rem;
    margin-top: 0.15rem;
  }
  .book-excerpt {
    -webkit-line-clamp: 2;
  }
}

.book-card {
  margin: 0;
}

.book-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, transparent 45%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition: transform 0.45s var(--ease-out), border-color 0.35s, box-shadow 0.45s, background 0.35s;
  position: relative;
  overflow: hidden;
}

.book-card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, transparent 40%, rgba(255, 255, 255, 0.04) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.7s var(--ease-out);
  pointer-events: none;
}

.book-card-link:hover {
  transform: translateY(-8px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lift), 0 0 0 1px rgba(228, 199, 107, 0.06);
  text-decoration: none;
}

.book-card-link:hover::after {
  transform: translateX(100%);
}

.book-cover-wrap {
  position: relative;
  border-radius: 0;
  overflow: visible;
  margin-bottom: 1rem;
  aspect-ratio: 2 / 3;
  background: transparent;
  box-shadow: none;
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 14px;
  transition: transform 0.55s var(--ease-out);
}

.book-card-link:hover .book-cover {
  transform: scale(1.05);
}

.book-cover.placeholder {
  position: relative;
  background: linear-gradient(165deg, #2a2622 0%, #12100e 100%);
  border-radius: 14px;
}

.book-cover.placeholder::after {
  content: "◇";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: rgba(228, 199, 107, 0.12);
}

.book-grid .book-card.reveal:nth-child(1) {
  transition-delay: 0.04s;
}
.book-grid .book-card.reveal:nth-child(2) {
  transition-delay: 0.08s;
}
.book-grid .book-card.reveal:nth-child(3) {
  transition-delay: 0.12s;
}
.book-grid .book-card.reveal:nth-child(4) {
  transition-delay: 0.16s;
}
.book-grid .book-card.reveal:nth-child(5) {
  transition-delay: 0.2s;
}
.book-grid .book-card.reveal:nth-child(6) {
  transition-delay: 0.24s;
}
.book-grid .book-card.reveal:nth-child(n + 7) {
  transition-delay: 0.28s;
}

.badge {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  z-index: 2;
}
.badge-free {
  background: rgba(127, 216, 168, 0.18);
  color: var(--success);
  border: 1px solid rgba(127, 216, 168, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.badge-paid {
  background: rgba(20, 18, 16, 0.75);
  color: var(--gold);
  border: 1px solid var(--border-strong);
}

.book-title {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  line-height: 1.22;
  color: var(--text);
  transition: color 0.25s;
}

.book-card-link:hover .book-title {
  color: var(--gold);
}

.book-date {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.book-excerpt {
  margin: 0.35rem 0 0;
  color: rgba(246, 241, 232, 0.52);
  font-size: 0.86rem;
  line-height: 1.5;
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
}

/* ——— Book detail ——— */
.book-detail {
  padding-block: 1.5rem 4rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.4rem 0;
  transition: color 0.2s, transform 0.2s;
}
.back-link:hover {
  color: var(--gold);
  transform: translateX(-3px);
  text-decoration: none;
}
.back-link__icon {
  font-size: 1.1rem;
  opacity: 0.85;
}

.book-detail-grid {
  display: grid;
  grid-template-columns: minmax(220px, 340px) 1fr;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}

@media (max-width: 860px) {
  .book-detail-grid {
    grid-template-columns: 1fr;
  }
}

.book-detail-cover {
  position: sticky;
  top: 5.5rem;
}

@media (max-width: 860px) {
  .book-detail-cover {
    position: relative;
    top: auto;
    max-width: 280px;
    margin-inline: auto;
  }
}

.book-cover.large {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lift);
  transform: none;
}

.book-cover.large.placeholder {
  position: relative;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.book-cover.large.placeholder::before {
  content: "◇";
  font-size: 3rem;
  color: rgba(228, 199, 107, 0.1);
}

.book-detail-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 600;
  margin: 0 0 0.65rem;
  letter-spacing: -0.02em;
  line-height: 1.08;
  background: linear-gradient(100deg, #fff 0%, var(--gold-mid) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.book-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.92rem;
}

.prose {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.75;
}

.read-actions {
  margin-top: 2.25rem;
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.9rem 1.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease-out), box-shadow 0.35s, filter 0.25s;
}

.btn-primary {
  background: linear-gradient(135deg, #f0dc98 0%, var(--gold-mid) 45%, #8a6a1a 100%);
  color: #1a1408;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 24px rgba(228, 199, 107, 0.25);
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s var(--ease-out);
}

.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 8px 36px rgba(228, 199, 107, 0.35);
  text-decoration: none;
  transform: translateY(-2px);
}

.btn-primary:hover::before {
  transform: translateX(120%);
}

.btn-glow {
  box-shadow: 0 4px 28px rgba(228, 199, 107, 0.35), 0 0 0 1px rgba(228, 199, 107, 0.15);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover {
  border-color: var(--gold-dim);
  color: var(--text);
  text-decoration: none;
  background: rgba(228, 199, 107, 0.06);
}

.btn-block {
  width: 100%;
  max-width: 360px;
}

/* ——— Unlock ——— */
.unlock-panel {
  margin-top: 2.5rem;
  padding: 2rem 2rem 2.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(228, 199, 107, 0.06) 0%, var(--bg-elevated) 45%);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
  overflow: hidden;
}

.unlock-panel::before {
  content: "◇";
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 2.5rem;
  color: rgba(228, 199, 107, 0.08);
  pointer-events: none;
}

.unlock-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.unlock-text {
  color: var(--text-muted);
  margin: 0 0 1.5rem;
  font-size: 0.98rem;
  max-width: 42ch;
}

.unlock-form label {
  display: block;
  margin-bottom: 1.1rem;
}
.unlock-form span {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.45rem;
}
.unlock-form input {
  width: 100%;
  max-width: 400px;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.unlock-form input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(228, 199, 107, 0.12);
}

.unlock-form .btn-primary {
  margin-top: 0.5rem;
}

body.is-book .book-payment-panel {
  margin-top: 2rem;
  padding: 1.15rem 1.2rem;
  border-radius: 20px;
  border: 1px solid rgba(228, 199, 107, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.12));
  box-shadow: var(--shadow-soft);
}

body.is-book .book-card-surface {
  position: relative;
  overflow: visible;
}

/* Ensure redeem form is visible inside payment card */
body.is-book .book-payment-panel .unlock-form {
  margin-top: 1.25rem;
  display: block !important;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(228, 199, 107, 0.14);
  position: relative;
  z-index: 2;
}

body.is-book .book-payment-panel .unlock-form label {
  display: block;
}

body.is-book .book-payment-panel .unlock-form input[type="text"] {
  max-width: none;
  width: 100%;
  min-height: 46px;
  background: #15120f;
  color: #f6f1e8;
  border: 1px solid rgba(228, 199, 107, 0.35);
}

body.is-book .book-payment-panel .unlock-form .btn-primary {
  width: 100%;
  min-height: 46px;
}

body.is-book .book-payment-panel__title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text);
}

body.is-book .book-payment-panel p {
  margin: 0.45rem 0;
  color: var(--text-muted);
}

body.is-book .book-payment-panel__receipt {
  margin-top: 0.9rem;
}

body.is-book .book-access-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 240;
}

body.is-book .book-access-modal.is-open {
  display: block;
}

body.is-book .book-access-modal:target {
  display: block;
}

body.is-book .book-access-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 4, 3, 0.75);
  backdrop-filter: blur(6px);
  display: block;
  text-decoration: none;
}

body.is-book .book-access-modal__dialog {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

body.is-book .book-access-modal__content {
  width: min(660px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: linear-gradient(180deg, rgba(16, 14, 12, 0.98), rgba(7, 6, 5, 0.96));
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  color: var(--text);
  box-shadow: var(--shadow-lift);
}

body.is-book .book-access-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(228, 199, 107, 0.12);
  padding: 1.4rem 1.4rem 1rem;
}

body.is-book .book-access-modal__body {
  padding: 1.2rem 1.4rem 1.4rem;
}

body.is-book .book-access-modal .unlock-form {
  display: grid !important;
  gap: 0.85rem;
}

body.is-book .book-access-modal .unlock-form input[type="hidden"] {
  display: none !important;
}

body.is-book .book-access-modal .unlock-form label {
  margin: 0;
}

body.is-book .book-access-modal .unlock-form input[type="text"] {
  max-width: none;
  width: 100%;
  min-height: 46px;
  background: #15120f;
  color: #f6f1e8;
  border: 1px solid rgba(228, 199, 107, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

body.is-book .book-access-modal .unlock-form input[type="text"]::placeholder {
  color: rgba(246, 241, 232, 0.55);
}

body.is-book .book-access-modal .unlock-form .btn-primary {
  width: 100%;
  min-height: 46px;
}

body.is-book .book-access-modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--text);
}

body.is-book .book-access-modal__eyebrow {
  margin-bottom: 0.35rem;
  color: var(--gold-dim);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

body.is-book .book-access-modal__close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
  text-decoration: none;
}

body.is-book .book-access-modal__close:hover {
  opacity: 1;
  background: rgba(228, 199, 107, 0.08);
}

body.is-book .book-access-modal__payments {
  margin-bottom: 1.2rem;
  padding: 1rem 1rem 0.35rem;
  border-radius: 18px;
  border: 1px solid rgba(228, 199, 107, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

body.is-book .book-access-modal__payments p {
  margin: 0.45rem 0;
  color: var(--text-muted);
}

body.is-book .book-access-modal__receipt,
body.is-book .book-access-modal__direct {
  margin-top: 1rem;
}

body.book-modal-open {
  overflow: hidden;
}

/* Book detail must never hide the mobile header menu or access form */
body.is-book .site-header {
  z-index: 120;
}

body.is-book .main-public,
body.is-book .book-detail,
body.is-book .book-detail-grid,
body.is-book .book-detail-body {
  overflow: visible !important;
}

body.is-book .main-public {
  display: block;
  position: relative;
  z-index: 1;
}

body.is-book .nav-main {
  z-index: 130;
}

body.is-book .book-detail-grid,
body.is-book .book-detail-body,
body.is-book .unlock-panel {
  position: relative;
  z-index: 1;
}

body.is-book .book-detail-cover {
  position: relative;
  top: auto;
  z-index: 1;
}

body.is-book .book-detail-body {
  display: block !important;
  min-width: 0;
}

body.is-book .unlock-panel,
body.is-book .unlock-form,
body.is-book .unlock-form label,
body.is-book .unlock-form input,
body.is-book .unlock-form .btn-primary {
  visibility: visible;
  opacity: 1;
}

body.is-book .unlock-panel {
  display: block !important;
}

body.is-book .unlock-form {
  display: block !important;
}

body.is-book .unlock-form .btn-primary {
  display: inline-flex !important;
}

body.is-book .unlock-form input {
  display: block !important;
}

body.is-book .site-footer {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative;
  z-index: 1;
}

.error,
.flash.error {
  color: var(--danger);
  margin-top: 1rem;
  font-size: 0.95rem;
}

/* ——— Reader ——— */
body.is-reader .site-footer {
  display: none;
}

body.is-reader .main-public {
  padding: 0;
  max-width: none;
}

body.is-reader .site-header {
  border-bottom-color: rgba(228, 199, 107, 0.1);
}

/* Reader page: isolate global visual effects (can interfere with 3D/page-flip GPUs) */
body.is-reader.site-body::before,
body.is-reader .ambient {
  display: none !important;
}

body.is-reader {
  background: #0a0908;
}

body.is-reader .main-public {
  /* Premium page background (outside the flipbook itself) */
  background:
    radial-gradient(900px 520px at 18% 0%, rgba(228, 199, 107, 0.06), transparent 55%),
    radial-gradient(700px 480px at 92% 10%, rgba(120, 80, 40, 0.14), transparent 50%),
    linear-gradient(180deg, #070605 0%, #0a0908 100%);
  min-height: calc(100vh - 72px);
}

@media (prefers-reduced-motion: reduce) {
  body.is-reader .main-public {
    background: #070605;
  }
}

/* PDF.js reader (dark, premium) */
.reader-shell {
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #050504 0%, #0a0908 100%);
}

.reader-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid rgba(228, 199, 107, 0.12);
  background: rgba(12, 11, 10, 0.92);
  backdrop-filter: blur(14px);
}

.reader-head {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.reader-back {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.reader-back:hover {
  color: var(--gold);
  text-decoration: none;
}

.reader-book-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

.reader-toolbar {
  position: sticky;
  top: 72px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid rgba(228, 199, 107, 0.12);
  background: rgba(7, 6, 5, 0.92);
  backdrop-filter: blur(14px);
}

.rt-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(228, 199, 107, 0.14);
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), border-color 0.2s, background 0.2s;
}
.rt-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(228, 199, 107, 0.25);
  background: rgba(228, 199, 107, 0.06);
}

.rt-page {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.rt-page__input {
  width: 70px;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(228, 199, 107, 0.14);
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
}
.rt-page__sep,
.rt-page__total {
  color: var(--text-muted);
}

.rt-divider {
  width: 1px;
  height: 26px;
  background: rgba(228, 199, 107, 0.12);
  margin: 0 0.25rem;
}

.rt-zoom {
  min-width: 56px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.rt-spacer {
  flex: 1;
}

.rt-search {
  display: inline-flex;
  align-items: center;
}
.rt-search__input {
  width: min(240px, 36vw);
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(228, 199, 107, 0.14);
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.reader-badge {
  font-size: 0.76rem;
  color: var(--text-muted);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(228, 199, 107, 0.1), transparent);
}
.reader-badge strong {
  color: var(--gold);
  font-weight: 600;
}

.pdf-viewer {
  flex: 1;
  overflow: auto;
  padding: 1.5rem;
  text-align: center;
}

@media (max-width: 520px) {
  .pdf-viewer {
    padding: 1rem 0.75rem;
  }
  .reader-top {
    padding: 0.75rem 0.9rem;
  }
  .reader-toolbar {
    top: 64px;
    padding: 0.6rem 0.9rem;
    gap: 0.35rem;
    flex-wrap: wrap;
  }
  .rt-search__input {
    width: 100%;
    min-width: 180px;
  }
}

.pdf-viewer--modern {
  padding: 1rem 1.25rem 2.25rem;
}
body.is-reader .book-loading-percent {
  display: inline-block;
  min-width: 3ch;
}
@keyframes book-spin {
  to {
    transform: rotate(360deg);
  }
}

body.is-reader .flipbook-shell {
  display: flex;
  align-items: center;
  justify-content: center;
}
body.is-reader .flipbook {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  display: inline-block;
}
body.is-reader .flip-page {
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
}
body.is-reader .flip-page canvas {
  backface-visibility: hidden;
}
body.is-reader .flip-page canvas {
  width: 100%;
  height: 100%;
  display: block;
  max-height: none;
}

/* Fullscreen mobile: keep "contain" to avoid variable zoom */
@media (max-width: 768px) {
  body.is-reader .book-viewer.is-fullscreen .flip-page {
    align-items: stretch;
    justify-content: stretch;
  }
  body.is-reader .book-viewer.is-fullscreen .flip-page canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: none;
  }
}

body.is-reader .flip-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(229, 231, 235, 0.75);
}
body.is-reader .book-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: min(900px, 100%);
  margin: 0 auto;
  color: #e5e7eb;
  font-size: 0.9rem;
}
body.is-reader .book-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #1e293b;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}
body.is-reader .book-nav-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
body.is-reader .book-page-indicator {
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  color: #9ca3af;
}
body.is-reader .book-fullscreen-btn,
body.is-reader .book-sound-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
}

@media (max-width: 768px) {
  body.is-reader .ebook-read-header {
    flex-direction: column;
    align-items: flex-start;
  }
  body.is-reader .ebook-read-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

body.is-reader .book-viewer.is-fullscreen {
  position: fixed;
  inset: 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  z-index: 9999;
  padding: 0;
}
body.is-reader .book-viewer.is-fullscreen .book-viewer-inner {
  height: 100vh;
  min-height: 100vh;
  gap: 10px;
}
body.is-reader .book-viewer.is-fullscreen .book-controls {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: none;
  width: auto;
  background: rgba(15, 23, 42, 0.78);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  z-index: 10002;
}
body.is-reader .book-viewer.is-fullscreen .book-controls .book-nav-btn {
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
body.is-reader .book-viewer.is-fullscreen .book-controls .book-nav-btn:active {
  transform: scale(0.96);
}
body.is-reader .book-viewer.is-fullscreen .flip-hint {
  display: none;
}
body.is-reader .book-viewer.is-fullscreen .book-fs-title {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10002;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(1100px, calc(100vw - 28px));
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
  color: rgba(226, 232, 240, 0.95);
  font-weight: 900;
  letter-spacing: -0.01em;
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
body.is-reader .book-viewer.is-fullscreen .book-fs-title::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(226, 232, 240, 0.18);
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.55);
  flex: 0 0 auto;
}
body.is-reader .book-viewer.is-fullscreen .book-fs-title span {
  overflow: hidden;
  text-overflow: ellipsis;
}
body.is-reader .book-viewer.is-fullscreen .book-flip-wrapper {
  max-width: 100%;
  width: 100%;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  align-items: center;
}
@media (min-width: 769px) {
  body.is-reader .book-viewer.is-fullscreen .book-flip-wrapper {
    height: 100vh;
    max-height: 100vh;
    padding-bottom: 0;
    overflow: hidden;
  }
}
body.is-reader .book-viewer.is-fullscreen .flipbook-shell {
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}
body.is-reader .book-viewer.is-fullscreen .flipbook {
  width: auto;
  max-width: min(1200px, 100%);
  margin: 0 auto;
  transform-origin: center center;
}

@media (min-width: 769px) {
  body.is-reader .book-viewer.is-fullscreen .flipbook {
    /* JS handles fullscreen sizing to keep PageFlip stable */
    transform: none;
  }
}

/* Mobile fullscreen size is handled by JS (avoid CSS transforms) */

@media (max-width: 768px) {
  body.is-reader .ebook-read-container {
    margin: 24px auto 30px;
    padding: 0 8px;
  }
  body.is-reader .book-controls {
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  body.is-reader .book-viewer.is-fullscreen .book-controls {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 10px 12px;
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    box-shadow: 0 -12px 30px rgba(15, 23, 42, 0.35);
    justify-content: space-between;
    gap: 10px;
  }
  body.is-reader .book-viewer.is-fullscreen .book-page-indicator {
    flex: 1;
    order: 2;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(229, 231, 235, 0.78);
    padding: 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.is-reader .book-viewer.is-fullscreen #book-prev-btn {
    order: 1;
  }
  body.is-reader .book-viewer.is-fullscreen #book-next-btn {
    order: 3;
  }
  body.is-reader .book-viewer.is-fullscreen #book-sound-btn {
    order: 4;
  }
  body.is-reader .book-viewer.is-fullscreen #book-fullscreen-btn {
    order: 5;
  }
  body.is-reader .book-viewer.is-fullscreen .book-nav-btn {
    min-width: 46px;
    height: 46px;
    padding: 0 14px;
    border-radius: 14px;
    border-color: rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.55);
    font-size: 1rem;
    font-weight: 700;
  }
  body.is-reader .book-viewer.is-fullscreen .book-nav-btn:hover {
    background: rgba(15, 23, 42, 0.7);
    border-color: rgba(250, 204, 21, 0.4);
  }
  body.is-reader .book-viewer.is-fullscreen .book-nav-btn[disabled] {
    opacity: 0.35;
  }
  body.is-reader .book-viewer.is-fullscreen .book-flip-wrapper {
    height: 100vh;
    max-height: 100vh;
    padding: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  body.is-reader .book-viewer.is-fullscreen .flipbook-shell {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  body.is-reader .book-viewer.is-fullscreen .flipbook {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
  }
}

body.is-reader .book-error-message {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #f87171;
  text-align: center;
}

/* Bookmark ribbon: anchored to bookmarked PDF page corner */
body.is-reader .flip-page {
  position: relative;
}

body.is-reader .flip-page.is-bookmarked::before {
  content: 'Marque Page';
  position: absolute;
  top: -14px;
  right: 18px;
  width: 16px;
  height: 52%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.62), rgba(2, 6, 23, 0.38));
  border: 1px solid rgba(228, 199, 107, 0.12);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 18px 34px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg) translateZ(0);
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(228, 199, 107, 0.75);
}

body.is-reader .flip-page.is-bookmarked::after {
  content: '';
  position: absolute;
  top: calc(52% - 1px);
  right: 18px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 16px solid rgba(2, 6, 23, 0.52);
  /* avoid filter() which can cause GPU mirror artifacts while flipping */
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  z-index: 6;
}

/* Disable bookmark ribbon visuals (bookmark still works in background) */
body.is-reader .flip-page.is-bookmarked::before,
body.is-reader .flip-page.is-bookmarked::after {
  display: none !important;
  content: none !important;
}

@media (prefers-reduced-motion: reduce) {
  body.is-reader .flip-page.is-bookmarked::before,
  body.is-reader .flip-page.is-bookmarked::after {
    box-shadow: none;
  }
}

.pdf-stage {
  width: min(1240px, 100%);
  margin: 0 auto;
}

.pdf-spread {
  display: grid;
  gap: 1.25rem;
  justify-content: center;
}

.pdf-spread--one {
  grid-template-columns: 1fr;
}

.pdf-spread--two {
  grid-template-columns: 1fr 1fr;
}

.pdf-sheet {
  display: flex;
  justify-content: center;
}

.pdf-sheet canvas.pdf-page {
  max-width: 100%;
  height: auto !important;
}

@media (max-width: 860px) {
  .pdf-spread--two {
    grid-template-columns: 1fr;
  }
}

canvas.pdf-page {
  max-width: 100%;
  height: auto !important;
  border-radius: 6px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pdf-error {
  color: var(--danger);
  padding: 2rem;
}

/* ——— Footer ——— */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 3rem;
  padding: 3rem 0 2.5rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.35));
  overflow: hidden;
}

.footer-glow {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, 90vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-mid), transparent);
  opacity: 0.5;
  box-shadow: 0 0 40px rgba(228, 199, 107, 0.25);
}

.footer-inner {
  text-align: center;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.footer-logo {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  box-shadow: 0 0 0 1px rgba(228, 199, 107, 0.16);
  background: rgba(255, 255, 255, 0.02);
}

.footer-name {
  font-family: var(--font-logo);
  font-size: 1.35rem;
  color: var(--text);
}

.footer-note {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0 auto 1rem;
  max-width: 480px;
  line-height: 1.55;
}

.footer-social {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 0 0 1rem;
}

.footer-social__icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(228, 199, 107, 0.16);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
  transition: transform 0.25s var(--ease-out), border-color 0.25s, background 0.25s, color 0.25s;
}
.footer-social__icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: 0.95;
  flex: none;
  display: block;
}
.footer-social__icon:hover {
  color: var(--gold);
  border-color: var(--border-strong);
  background: rgba(228, 199, 107, 0.07);
  transform: translateY(-2px);
  text-decoration: none;
}

@media (max-width: 520px) {
  .footer-social {
    gap: 0.6rem 0.75rem;
  }
  .footer-social__icon {
    width: 32px;
    height: 32px;
  }
  .footer-social__icon svg {
    width: 16px;
    height: 16px;
  }
}

.footer-meta {
  font-size: 0.8rem;
  margin: 0;
  letter-spacing: 0.06em;
}
.footer-meta a {
  color: var(--text-muted);
}
.footer-meta a:hover {
  color: var(--gold);
}
.footer-dot {
  margin: 0 0.65rem;
  opacity: 0.35;
}

/* ——— Login ——— */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: var(--bg);
  position: relative;
}
.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--noise);
  pointer-events: none;
  opacity: 0.8;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 2.5rem 2.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(228, 199, 107, 0.05), var(--bg-elevated));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lift);
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
  text-align: center;
  background: linear-gradient(100deg, #fff, var(--gold-mid));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
}

.login-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(228, 199, 107, 0.18), 0 18px 50px rgba(0, 0, 0, 0.45);
  background: rgba(255, 255, 255, 0.02);
  flex: none;
}

.login-brand__name {
  font-family: var(--font-logo);
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  background: linear-gradient(100deg, #fff 0%, var(--gold) 45%, #c9a227 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-subtitle {
  margin: -1rem 0 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.login-hint {
  margin-top: 1.5rem;
  font-size: 0.88rem;
  text-align: center;
}

.stack-form label {
  display: block;
  margin-bottom: 1rem;
}

/* Login form labels should match subtitle tone */
.login-page .stack-form label {
  color: var(--text-muted);
}
.stack-form input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

/* ——— Admin ——— */
.admin-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  position: relative;
}
.admin-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--noise);
  pointer-events: none;
  opacity: 0.6;
  z-index: 0;
}

.admin-shell {
  position: relative;
  /* Must sit above the mobile backdrop layer so nav stays clickable */
  z-index: 75;
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Admin backdrop for mobile menu */
.admin-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease-out);
  z-index: 70;
}

@media (max-width: 800px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-side {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

.admin-side {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg));
  border-right: 1px solid var(--border);
  padding: 1.5rem 1.1rem;
}

.admin-menu-toggle {
  display: none;
}

.admin-menu-toggle__bar {
  display: block;
  width: 18px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-mid));
  border-radius: 2px;
  box-shadow: 0 0 18px rgba(228, 199, 107, 0.18);
}
.admin-menu-toggle__bar + .admin-menu-toggle__bar {
  margin-top: 6px;
}

@media (max-width: 800px) {
  .admin-side {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0.95rem;
    position: sticky;
    top: 0;
    z-index: 80;
  }
  .admin-logo {
    margin-bottom: 0;
  }
  .admin-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(228, 199, 107, 0.16);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: transform 0.2s var(--ease-out), border-color 0.2s, background 0.2s;
  }
  .admin-menu-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(228, 199, 107, 0.28);
    background: rgba(228, 199, 107, 0.06);
  }
  .admin-nav {
    position: fixed;
    left: 0.9rem;
    right: 0.9rem;
    top: 74px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    border-radius: 18px;
    border: 1px solid rgba(228, 199, 107, 0.18);
    background: rgba(7, 6, 5, 0.92);
    backdrop-filter: blur(16px);
    transform: translateY(-10px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
    z-index: 90;
  }
  html.admin-nav-open .admin-nav {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }
  html.admin-nav-open .admin-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-logo);
  font-weight: 400;
  font-size: 1.35rem;
  color: var(--text);
  margin-bottom: 1.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 14px;
  text-decoration: none;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  background: linear-gradient(145deg, rgba(228, 199, 107, 0.06), transparent 60%);
}
.admin-logo:hover {
  color: var(--gold);
  text-decoration: none;
  border-color: rgba(228, 199, 107, 0.18);
}

.admin-logo__img {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(228, 199, 107, 0.18), 0 10px 30px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.02);
  flex: none;
}

.admin-logo__text {
  background: linear-gradient(100deg, #fff 0%, var(--gold) 45%, #c9a227 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-nav a,
.admin-nav__logout {
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.admin-nav__logout-form {
  margin: 0;
}

.admin-nav a:hover,
.admin-nav__logout:hover {
  background: rgba(228, 199, 107, 0.08);
  color: #ffffff;
  border-color: var(--border);
}
.admin-nav a.is-active {
  background: rgba(228, 199, 107, 0.12);
  border-color: rgba(228, 199, 107, 0.22);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.25);
}

.admin-nav__logout {
  width: 100%;
  background: transparent;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.admin-toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

/* Admin page containers */
.admin-page {
  display: grid;
  gap: 1rem;
}

.notice {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(228, 199, 107, 0.14);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow-soft);
  font-weight: 600;
}
.notice--success {
  border-color: rgba(127, 216, 168, 0.28);
  background: rgba(127, 216, 168, 0.08);
  color: #eafff2;
}
.notice--error {
  border-color: rgba(240, 113, 103, 0.35);
  background: rgba(240, 113, 103, 0.08);
  color: #ffeceb;
}

.admin-card {
  border-radius: 18px;
  border: 1px solid rgba(228, 199, 107, 0.14);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.1));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.admin-card__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid rgba(228, 199, 107, 0.12);
  background: rgba(0, 0, 0, 0.16);
}
.admin-card__kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.35rem;
}
.admin-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}
.admin-card__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.admin-card__body {
  padding: 1.1rem 1.2rem 1.2rem;
}

.admin-subcard {
  border: 1px solid rgba(228, 199, 107, 0.12);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.admin-subcard__head {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(228, 199, 107, 0.1);
  background: rgba(0, 0, 0, 0.12);
}
.admin-subcard__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}
.admin-subcard__body {
  padding: 1rem;
}

.admin-form--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}
.form-col {
  min-width: 0;
}
.form-col--full {
  grid-column: 1 / -1;
}

.admin-split {
  display: grid;
  grid-template-columns: 1fr 0.55fr;
  gap: 1rem 1.25rem;
  align-items: end;
  margin-bottom: 1rem;
}
.admin-split__right select {
  max-width: 100%;
}

.admin-form .form-actions {
  margin-top: 0.25rem;
}

.data-table .cell-actions a,
.list-row__action {
  color: var(--gold);
}
.data-table .cell-actions a:hover,
.list-row__action:hover {
  color: #f0dc98;
}

@media (max-width: 980px) {
  .admin-form--grid {
    grid-template-columns: 1fr;
  }
  .admin-split {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: rgba(7, 6, 5, 0.4);
}

.admin-top {
  padding: 1.35rem 2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(228, 199, 107, 0.04), transparent);
}

.admin-page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
}

.admin-content {
  padding: 2rem;
  flex: 1;
}

.admin-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.admin-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.25rem;
  align-items: stretch;
  padding: 1.25rem;
  border-radius: 18px;
  border: 1px solid rgba(228, 199, 107, 0.16);
  background: linear-gradient(165deg, rgba(228, 199, 107, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.5rem;
}

.admin-hero__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 2.1rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #fff, var(--gold-mid));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.admin-hero__lead {
  margin: 0;
  color: var(--text-muted);
  max-width: 62ch;
}

.admin-actions {
  margin-top: 1.1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.metric-card {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(228, 199, 107, 0.16);
  background: rgba(0, 0, 0, 0.18);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
}

.metric-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--gold);
  background: linear-gradient(145deg, rgba(228, 199, 107, 0.14), transparent 70%);
  border: 1px solid rgba(228, 199, 107, 0.14);
  flex: none;
}

.metric-value {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.65rem;
  line-height: 1;
  color: var(--text);
}

.metric-label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.15rem;
  align-items: start;
}

.panel {
  border-radius: 18px;
  border: 1px solid rgba(228, 199, 107, 0.14);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.1));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.2rem;
  border-bottom: 1px solid rgba(228, 199, 107, 0.12);
  background: rgba(0, 0, 0, 0.18);
}

.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.panel-link {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.panel-link:hover {
  color: var(--gold);
  text-decoration: none;
}

.panel-body {
  padding: 0.35rem 0.4rem;
}

.muted {
  color: var(--text-muted);
  padding: 1rem 1.2rem;
  margin: 0;
}

.list-rows {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0.9rem;
  border-radius: 14px;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  border: 1px solid transparent;
}

.list-row:hover {
  background: rgba(228, 199, 107, 0.04);
  border-color: rgba(228, 199, 107, 0.12);
  transform: translateY(-1px);
}

.list-row__title {
  font-weight: 600;
  color: var(--text);
}

.list-row__meta {
  margin-top: 0.2rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.list-row__action {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}
.list-row__action:hover {
  text-decoration: none;
  filter: brightness(1.06);
}

.dot {
  margin: 0 0.5rem;
  opacity: 0.35;
}

@media (max-width: 980px) {
  .admin-hero {
    grid-template-columns: 1fr;
  }
  .admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .admin-top {
    padding: 1.05rem 1.25rem;
  }
  .admin-content {
    padding: 1.25rem;
  }
  .admin-hero {
    padding: 1rem;
  }
  .admin-hero__title {
    font-size: 1.75rem;
  }
  .admin-actions .btn {
    width: 100%;
    justify-content: center;
  }
}
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.15rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem 1.35rem;
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), var(--surface));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.25s, transform 0.25s;
}
.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 2.35rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  letter-spacing: 0.04em;
}

.admin-help {
  color: var(--text-muted);
  max-width: 640px;
  line-height: 1.65;
}

.toolbar {
  margin-bottom: 1.25rem;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Table responsiveness (admin) */
@media (max-width: 760px) {
  .admin-content {
    padding: 1.25rem;
  }
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table th,
  .data-table td {
    white-space: nowrap;
  }
  .admin-toolbar .btn {
    width: 100%;
    justify-content: center;
  }
  .inline-generate {
    padding: 1rem;
  }
  .inline-generate .btn {
    width: 100%;
    justify-content: center;
  }
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.15s;
}
.data-table tbody tr:hover {
  background: rgba(228, 199, 107, 0.04);
}

.data-table th {
  color: var(--gold-dim);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(0, 0, 0, 0.25);
}

.cell-actions {
  text-align: right;
}

.stack-form textarea,
.stack-form select {
  width: 100%;
  max-width: 520px;
  margin-top: 0.35rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
}

.admin-fieldset {
  max-width: 520px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1rem 0.25rem;
  margin: 0 0 1rem;
  background: rgba(255, 255, 255, 0.02);
}
.admin-fieldset legend {
  padding: 0 0.5rem;
  color: var(--gold-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-form input[type="file"] {
  padding: 0.5rem 0;
  border: none;
  background: transparent;
}

/* Premium file upload fields */
.file-field {
  border: 1px solid rgba(228, 199, 107, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.file-field__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.file-field__ui {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
}

.file-field__left {
  min-width: 0;
}

.file-field__label {
  color: var(--gold-dim);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.file-field__name {
  color: rgba(246, 241, 232, 0.78);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.file-field__btn {
  flex: none;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(228, 199, 107, 0.18);
  background: rgba(228, 199, 107, 0.06);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.file-field__ui:hover .file-field__btn {
  background: rgba(228, 199, 107, 0.1);
  border-color: rgba(228, 199, 107, 0.28);
}

.file-field__preview {
  padding: 0 1rem 1rem;
}

.file-preview__img {
  width: 100%;
  max-width: 240px;
  border-radius: 14px;
  display: block;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

@media (max-width: 520px) {
  .file-field__ui {
    padding: 0.85rem 0.9rem;
  }
  .file-field__btn {
    padding: 0.5rem 0.75rem;
  }
  .file-preview__img {
    max-width: 100%;
  }
}

/* Forms: nicer spacing + mobile friendliness */
.admin-form .btn {
  align-self: flex-start;
}

@media (max-width: 520px) {
  .admin-form input,
  .admin-form textarea,
  .admin-form select {
    max-width: 100%;
  }
  .admin-form .btn {
    width: 100%;
    justify-content: center;
  }
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.checkbox-row input {
  width: auto;
  margin: 0;
}

.hint {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.25rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.inline-generate {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.inline-generate label {
  margin: 0;
}

.filter-form {
  margin-bottom: 1.25rem;
}

.filter-form select {
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.code-cell {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  font-family: ui-monospace, monospace;
  color: var(--gold-mid);
}

.tag-ok {
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 600;
}

.success {
  color: var(--success);
  padding: 0.65rem 1rem;
  border-radius: 10px;
  background: rgba(127, 216, 168, 0.1);
  border: 1px solid rgba(127, 216, 168, 0.25);
  display: inline-block;
  margin-bottom: 1rem;
}

.page-install label {
  display: block;
  margin-bottom: 0.75rem;
}
.page-install input {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ambient {
    animation: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
