* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(245, 248, 255, 0.98), rgba(238, 246, 242, 0.96) 48%, rgba(255, 247, 232, 0.98)),
    linear-gradient(90deg, rgba(129, 191, 255, 0.18), rgba(22, 201, 91, 0.1), rgba(245, 155, 74, 0.14));
  color: #0b1220;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.38;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.42) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.12;
  background-image:
    repeating-linear-gradient(0deg, rgba(11, 18, 32, 0.38) 0, rgba(11, 18, 32, 0.38) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: multiply;
}

button {
  font: inherit;
}

img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.app {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 18px 14px 46px;
}

.app-header {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px 0 22px;
  backdrop-filter: blur(18px);
}

.hero-shell {
  position: relative;
  min-height: 188px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 34px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.46)),
    linear-gradient(120deg, rgba(238, 246, 242, 0.86), rgba(255, 247, 232, 0.78));
  box-shadow:
    0 26px 70px rgba(33, 48, 76, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.hero-shell::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.9), transparent 22%),
    radial-gradient(circle at 88% 20%, rgba(245, 155, 74, 0.18), transparent 30%),
    linear-gradient(120deg, rgba(48, 113, 255, 0.08), transparent 46%);
}

.hero-shell::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 155px;
  height: 82px;
  pointer-events: none;
  opacity: 0.32;
  background:
    linear-gradient(rgba(11, 18, 32, 0.16), rgba(11, 18, 32, 0.16)) 0 0 / 112px 1px no-repeat,
    linear-gradient(rgba(11, 18, 32, 0.12), rgba(11, 18, 32, 0.12)) 22px 18px / 130px 1px no-repeat,
    linear-gradient(rgba(11, 18, 32, 0.1), rgba(11, 18, 32, 0.1)) 6px 36px / 118px 1px no-repeat,
    linear-gradient(rgba(11, 18, 32, 0.08), rgba(11, 18, 32, 0.08)) 38px 54px / 92px 1px no-repeat;
}

.hero-copy,
.hero-side {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.section-kicker,
.book-eyebrow,
.chapter-card-body span,
.viewer-heading p {
  color: #607086;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin-top: 8px;
  color: #071326;
  font-size: clamp(2.45rem, 9vw, 5.2rem);
  font-weight: 950;
  line-height: 0.92;
}

.hero-copy p:last-child {
  max-width: 560px;
  margin-top: 16px;
  color: #607086;
  font-size: clamp(1rem, 2.4vw, 1.22rem);
  font-weight: 650;
  line-height: 1.45;
}

.hero-side {
  position: absolute;
  top: 22px;
  right: 22px;
  display: grid;
  justify-items: end;
  gap: 14px;
}

.hero-pill {
  min-height: 34px;
  border: 1px solid rgba(7, 19, 38, 0.08);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.68);
  color: #071326;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow:
    0 12px 32px rgba(16, 24, 39, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.hero-icon {
  display: grid;
  gap: 5px;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 15px 14px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow:
    0 18px 40px rgba(16, 24, 39, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.hero-icon span {
  display: block;
  height: 3px;
  border-radius: 999px;
  background: #071326;
}

.hero-icon span:nth-child(2) {
  width: 72%;
}

.hero-icon span:nth-child(3) {
  width: 44%;
}

.nav-btn {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: #071326;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 16px 32px rgba(7, 19, 38, 0.24);
}

.hidden {
  display: none !important;
}

.screen {
  display: none;
  animation: screenIn 220ms ease-out;
}

.screen.active {
  display: block;
}

body[data-screen="login"] {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.92), transparent 22%),
    radial-gradient(circle at 84% 18%, rgba(111, 77, 255, 0.22), transparent 30%),
    linear-gradient(135deg, #f8fafc 0%, #eef3ff 42%, #f9f6ff 100%);
}

body[data-screen="login"]::before {
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.07) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 76%);
}

body[data-screen="login"]::after {
  opacity: 0.32;
  background:
    linear-gradient(115deg, transparent 0 42%, rgba(255, 255, 255, 0.52) 42% 45%, transparent 45%),
    radial-gradient(circle at 50% 92%, rgba(7, 19, 38, 0.1), transparent 28%);
  mix-blend-mode: normal;
}

body[data-screen="login"] .app {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

body[data-screen="login"] .app-header {
  display: none;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-title {
  position: relative;
  display: grid;
  gap: 8px;
  max-width: 790px;
  margin: 12px 0 24px;
  padding-top: 8px;
}

.with-session {
  width: 100%;
  max-width: none;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}

.login-panel {
  width: min(100%, 560px);
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 28px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow:
    0 24px 64px rgba(31, 45, 73, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.login-panel .section-title {
  margin-top: 0;
}

.login-screen {
  width: min(100%, 1120px);
}

.login-experience {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: clamp(18px, 4vw, 46px);
  align-items: center;
  width: 100%;
  min-height: min(760px, calc(100vh - 44px));
}

.login-experience::before {
  content: "";
  position: absolute;
  inset: 7% 8%;
  z-index: -1;
  border-radius: 46px;
  background: rgba(255, 255, 255, 0.34);
  filter: blur(28px);
}

.login-art {
  position: relative;
  min-height: 620px;
  border-radius: 44px;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.22)),
    radial-gradient(circle at 50% 46%, rgba(37, 99, 235, 0.12), transparent 32%),
    linear-gradient(145deg, rgba(7, 19, 38, 0.08), transparent 52%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 30px 90px rgba(15, 23, 42, 0.12);
  animation: loginFloat 6s ease-in-out infinite;
}

.login-art::before,
.login-art::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.login-art::before {
  width: 220px;
  height: 220px;
  left: 8%;
  top: 10%;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.48);
  filter: blur(1px);
}

.login-art::after {
  width: 290px;
  height: 290px;
  right: -80px;
  bottom: -70px;
  background: rgba(23, 37, 84, 0.08);
}

.login-orbit {
  position: absolute;
  inset: 58px;
  display: grid;
  place-items: center;
  animation: orbitSpin 18s linear infinite;
}

.login-orbit span {
  position: absolute;
  width: min(86%, 460px);
  aspect-ratio: 1;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 42% 58% 50% 50%;
}

.login-orbit span:nth-child(2) {
  width: min(68%, 360px);
  border-color: rgba(124, 58, 237, 0.15);
  transform: rotate(42deg);
}

.login-orbit span:nth-child(3) {
  width: min(48%, 260px);
  border-color: rgba(37, 99, 235, 0.16);
  transform: rotate(-24deg);
}

.mind-mark {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(62vw, 330px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 28px 42px rgba(15, 23, 42, 0.18));
}

.mind-core {
  position: absolute;
  inset: 18%;
  border-radius: 45% 55% 50% 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.18) 22%, transparent 23%),
    linear-gradient(145deg, #f8fafc, #cbd5e1 54%, #334155);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset -22px -24px 38px rgba(15, 23, 42, 0.18),
    0 18px 60px rgba(15, 23, 42, 0.16);
  animation: mindPulse 4.8s ease-in-out infinite;
}

.mind-line {
  position: absolute;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.14);
  transform-origin: center;
}

.line-a {
  left: 33%;
  top: 38%;
  width: 34%;
  height: 9px;
  transform: rotate(18deg);
}

.line-b {
  left: 28%;
  top: 51%;
  width: 42%;
  height: 8px;
  transform: rotate(-8deg);
}

.line-c {
  left: 42%;
  top: 62%;
  width: 24%;
  height: 7px;
  transform: rotate(28deg);
}

.floating-book {
  position: absolute;
  display: grid;
  align-content: space-between;
  width: 142px;
  height: 170px;
  border: 10px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  padding: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.36)),
    #eef2ff;
  color: #0f172a;
  box-shadow:
    0 26px 42px rgba(15, 23, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  animation: cardDrift 5.5s ease-in-out infinite;
}

.floating-book span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.floating-book strong {
  font-size: 2.8rem;
  font-weight: 950;
  line-height: 0.88;
}

.card-a {
  left: 8%;
  top: 49%;
  transform: rotate(-13deg);
}

.card-b {
  right: 12%;
  top: 18%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.36)),
    #fff7ed;
  animation-delay: -1.8s;
  transform: rotate(9deg);
}

.card-c {
  right: 8%;
  bottom: 12%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.36)),
    #f3e8ff;
  animation-delay: -3s;
  transform: rotate(-5deg);
}

.login-brand {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  width: min(180px, 42vw);
  opacity: 0.78;
}

.login-brand img {
  width: 100%;
  height: auto;
  display: block;
}

body[data-screen="login"] .login-panel {
  position: relative;
  width: min(100%, 490px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 34px;
  padding: clamp(22px, 4vw, 34px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.46)),
    rgba(255, 255, 255, 0.62);
  box-shadow:
    0 30px 86px rgba(15, 23, 42, 0.17),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(28px);
  animation: panelIn 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.login-title-block {
  display: grid;
  gap: 9px;
  margin-bottom: 22px;
}

.login-title-block h2 {
  color: #071326;
  font-size: clamp(2.35rem, 7vw, 4.2rem);
  font-weight: 950;
  line-height: 0.92;
}

.login-title-block p:last-child {
  color: #64748b;
  font-size: 1.02rem;
  font-weight: 720;
}

@keyframes loginFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes orbitSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes mindPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.035);
  }
}

@keyframes cardDrift {
  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -16px;
  }
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 2px 0 14px;
  border-radius: 18px;
  padding: 5px;
  background: rgba(7, 19, 38, 0.06);
}

.login-mode-btn {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #607086;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 950;
}

.login-mode-btn.active {
  background: #071326;
  color: #fff;
  box-shadow: 0 12px 24px rgba(7, 19, 38, 0.18);
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 900;
}

.field input,
.field select {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(7, 19, 38, 0.12);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #071326;
  font: inherit;
  font-weight: 750;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(22, 201, 91, 0.58);
  box-shadow: 0 0 0 4px rgba(22, 201, 91, 0.12);
}

.login-btn,
.logout-btn {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: #071326;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 950;
  box-shadow: 0 16px 32px rgba(7, 19, 38, 0.24);
}

.login-btn {
  width: 100%;
  margin-top: 18px;
}

.logout-btn {
  background: rgba(7, 19, 38, 0.08);
  color: #071326;
  box-shadow: none;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-entry-btn {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: #172554;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 950;
  box-shadow: 0 16px 32px rgba(23, 37, 84, 0.22);
}

.login-btn:disabled {
  cursor: wait;
  opacity: 0.62;
}

.form-message,
.access-message {
  min-height: 24px;
  margin-top: 12px;
  color: #b42318;
  font-size: 0.9rem;
  font-weight: 850;
}

.access-message {
  text-align: center;
}

.section-title::before {
  content: "";
  width: min(220px, 52vw);
  height: 1px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, rgba(7, 19, 38, 0.2), rgba(7, 19, 38, 0));
}

.section-title h2 {
  color: #071326;
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 950;
  line-height: 1;
}

.section-title p:last-child {
  color: #607086;
  font-size: clamp(0.98rem, 2vw, 1.1rem);
  font-weight: 560;
  line-height: 1.55;
}

.books-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.home-watermark {
  display: flex;
  justify-content: center;
  margin: 30px auto 0;
  opacity: 0.74;
}

.home-watermark img {
  width: min(190px, 46vw);
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 20px rgba(31, 45, 73, 0.12));
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.book-card,
.chapter-card {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.74);
  appearance: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.6)),
    rgba(255, 255, 255, 0.74);
  color: inherit;
  cursor: pointer;
  text-align: left;
  box-shadow:
    0 24px 64px rgba(31, 45, 73, 0.13),
    0 6px 18px rgba(31, 45, 73, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  -webkit-tap-highlight-color: transparent;
}

.book-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 17px;
  min-height: 212px;
  overflow: hidden;
  border-radius: 34px;
  padding: 18px;
}

.book-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.9;
}

.quiz-accent::before {
  background:
    linear-gradient(130deg, rgba(7, 19, 38, 0.08), transparent 44%),
    radial-gradient(circle at 92% 18%, rgba(180, 65, 62, 0.16), transparent 30%),
    radial-gradient(circle at 20% 86%, rgba(255, 247, 232, 0.86), transparent 35%);
}

.success-accent::before {
  background:
    linear-gradient(130deg, rgba(22, 201, 91, 0.12), transparent 46%),
    radial-gradient(circle at 90% 18%, rgba(245, 155, 74, 0.18), transparent 30%),
    radial-gradient(circle at 20% 86%, rgba(238, 246, 242, 0.9), transparent 35%);
}

.magic-accent::before {
  background:
    linear-gradient(130deg, rgba(48, 113, 255, 0.12), transparent 46%),
    linear-gradient(35deg, rgba(245, 155, 74, 0.12), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent);
}

.book-card::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 86px;
  height: 86px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.36);
  transform: rotate(12deg);
  pointer-events: none;
}

.book-card:active,
.chapter-card:active {
  transform: translateY(1px) scale(0.99);
}

.book-cover,
.book-copy {
  position: relative;
  z-index: 1;
}

.book-cover {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 166px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(238, 246, 242, 0.52)),
    #f5f8ff;
  box-shadow:
    0 18px 38px rgba(31, 45, 73, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  perspective: 900px;
}

.book-cover img {
  width: 88%;
  height: 92%;
  display: block;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  filter: drop-shadow(0 20px 18px rgba(7, 19, 38, 0.22));
  transform: rotateY(-10deg) rotateZ(-2deg) translateY(-4px);
  transition: transform 220ms ease, filter 220ms ease;
}

.success-accent .book-cover img {
  transform: rotateY(10deg) rotateZ(2deg) translateY(-4px);
}

.book-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 4px 0;
}

.book-copy h3 {
  margin-top: 8px;
  color: #071326;
  font-size: clamp(1.5rem, 7vw, 2.45rem);
  font-weight: 950;
  line-height: 0.98;
}

.book-copy p {
  margin-top: 10px;
  color: #607086;
  font-size: 0.96rem;
  font-weight: 560;
  line-height: 1.45;
}

.book-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  margin-top: 18px;
  border-radius: 999px;
  padding: 10px 39px 10px 16px;
  background: #071326;
  color: white;
  font-size: 0.88rem;
  font-weight: 950;
  box-shadow: 0 16px 28px rgba(7, 19, 38, 0.24);
}

.book-action::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.success-accent .book-action {
  background: #0b2d1b;
  box-shadow: 0 16px 28px rgba(11, 45, 27, 0.22);
}

.magic-accent .book-action {
  background: #172554;
  box-shadow: 0 16px 28px rgba(23, 37, 84, 0.22);
}

.book-card.locked {
  cursor: not-allowed;
  opacity: 0.66;
  filter: grayscale(0.22);
}

.book-card.locked .book-action {
  background: #64748b;
  box-shadow: none;
}

.book-card.locked::after {
  content: "LOCK";
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  color: rgba(7, 19, 38, 0.56);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.magic-cover {
  display: grid;
  place-items: center;
  width: 88%;
  height: 92%;
  border-radius: 18px;
  background:
    linear-gradient(145deg, #172554, #2563eb 52%, #f59b4a);
  color: #fff;
  font-size: clamp(1.25rem, 5vw, 2rem);
  font-weight: 950;
  letter-spacing: 0.02em;
  text-shadow: 0 8px 18px rgba(7, 19, 38, 0.24);
  box-shadow: 0 20px 18px rgba(7, 19, 38, 0.22);
  transform: rotateY(-10deg) rotateZ(-2deg) translateY(-4px);
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chapter-card {
  min-height: 218px;
  overflow: hidden;
  border-radius: 22px;
  background: #071326;
  isolation: isolate;
}

.chapter-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 19, 38, 0.08) 0%, rgba(7, 19, 38, 0.15) 42%, rgba(7, 19, 38, 0.82) 100%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.18), transparent 34%);
  opacity: 1;
}

.chapter-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: inherit;
  pointer-events: none;
}

.chapter-visual {
  position: absolute;
  inset: 0;
  z-index: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(245, 248, 255, 0.9), rgba(255, 247, 232, 0.72));
}

.success-accent .chapter-visual {
  background:
    linear-gradient(135deg, rgba(238, 246, 242, 0.95), rgba(255, 247, 232, 0.74));
}

.chapter-visual img {
  width: 100%;
  display: block;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #eef3fb;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transform: scale(1.01);
  transition: transform 260ms ease, filter 260ms ease;
}

.chapter-card-index {
  position: absolute;
  top: 13px;
  left: 13px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  padding: 6px 11px;
  background: rgba(255, 255, 255, 0.78);
  color: #071326;
  font-size: 0.76rem;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(7, 19, 38, 0.2);
  backdrop-filter: blur(16px);
}

.chapter-number {
  color: rgba(255, 255, 255, 0.86);
  font-size: 3rem;
  font-weight: 950;
  text-shadow: 0 12px 30px rgba(7, 19, 38, 0.28);
}

.chapter-card-body {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 3;
  display: grid;
  gap: 8px;
  padding: 56px 15px 16px;
  background: linear-gradient(180deg, transparent, rgba(7, 19, 38, 0.86) 58%, rgba(7, 19, 38, 0.94));
}

.chapter-card-body strong {
  display: block;
  color: #fff;
  font-size: 0.98rem;
  font-weight: 900;
  line-height: 1.18;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

.chapter-card-body span {
  color: rgba(255, 255, 255, 0.72);
}

.bangla-card .chapter-card-body strong {
  font-family: "Noto Sans Bengali", "Hind Siliguri", system-ui, sans-serif;
  font-size: 1.05rem;
}

.magic-accent .chapter-visual {
  background:
    linear-gradient(145deg, #172554, #2563eb 58%, #f59b4a);
}

.viewer-toolbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 44px rgba(31, 45, 73, 0.11);
  backdrop-filter: blur(18px);
}

body[data-screen="chapters"] .app-header {
  padding-bottom: 10px;
}

body[data-screen="chapters"] .hero-shell {
  min-height: auto;
  border-radius: 24px;
  padding: 16px 18px;
}

body[data-screen="chapters"] .hero-shell::after,
body[data-screen="chapters"] .hero-side {
  display: none;
}

body[data-screen="chapters"] .hero-copy h1 {
  margin-top: 4px;
  font-size: clamp(1.55rem, 7vw, 2.25rem);
  line-height: 1;
}

body[data-screen="chapters"] .hero-copy p:last-child {
  margin-top: 7px;
  font-size: 0.92rem;
}

body[data-screen="viewer"] {
  background: #eef2f7;
}

body[data-screen="viewer"]::before,
body[data-screen="viewer"]::after,
body[data-screen="viewer"] .app-header {
  display: none;
}

body[data-screen="viewer"] .app {
  width: 100%;
  max-width: none;
  padding: 0 0 24px;
}

body[data-screen="viewer"] .viewer-toolbar {
  margin: 6px 6px 8px;
  border-radius: 16px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 26px rgba(31, 45, 73, 0.1);
}

body[data-screen="viewer"] .viewer-toolbar .nav-btn {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

#backToChaptersBtn::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 7px;
  background: url("icons/right-arrow.png") center / contain no-repeat;
  filter: invert(1);
  transform: rotate(180deg);
  vertical-align: -1px;
}

body[data-screen="viewer"] .viewer-heading h2 {
  font-size: 0.88rem;
}

body[data-screen="viewer"] .viewer-heading p {
  display: none;
}

body[data-screen="viewer"] .viewer-heading span {
  font-size: 0.76rem;
}

body[data-screen="viewer"] .loader {
  margin: 8px 6px;
  border-radius: 14px;
  padding: 12px 10px;
  font-size: 0.88rem;
}

body[data-screen="viewer"] .page-list {
  gap: 8px;
  padding-bottom: 18px;
}

body[data-screen="viewer"] .page-wrap {
  width: 100%;
  max-width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.viewer-heading {
  min-width: 0;
  flex: 1 1 auto;
  text-align: right;
}

.viewer-heading h2 {
  margin-top: 3px;
  overflow: hidden;
  color: #071326;
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-heading span {
  display: block;
  margin-top: 3px;
  color: #607086;
  font-size: 0.82rem;
  font-weight: 750;
}

.loader {
  margin: 10px 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 22px;
  padding: 18px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: #607086;
  font-weight: 900;
  text-align: center;
  box-shadow:
    0 16px 38px rgba(31, 45, 73, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.page-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding-bottom: 36px;
}

.page-wrap {
  width: min(100%, 990px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 22px 54px rgba(31, 45, 73, 0.17);
}

.page-wrap img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.pdf-page-wrap canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.reader-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100% - 12px, 520px);
  margin: 16px auto 22px;
  padding: 0 6px;
}

.reader-nav.hidden {
  display: none;
}

.reader-nav-btn {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #071326;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(31, 45, 73, 0.13);
}

.reader-nav-btn.primary {
  background: #071326;
  color: white;
}

.reader-nav-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  box-shadow: none;
}

body[data-screen="admin"] {
  background: #f4f5f7;
}

body[data-screen="admin"]::before,
body[data-screen="admin"]::after,
body[data-screen="admin"] .app-header {
  display: none;
}

.admin-screen {
  padding-top: 8px;
}

.admin-topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.admin-topbar h2 {
  color: #071326;
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 950;
  line-height: 1;
}

.admin-topbar p:last-child {
  margin-top: 8px;
  color: #64748b;
  font-weight: 760;
}

.admin-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  gap: 5px;
  margin-bottom: 24px;
  border-radius: 999px;
  padding: 5px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.07);
}

.admin-tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 8px 15px;
  background: transparent;
  color: #42526a;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 900;
}

.admin-tab.active {
  background: #080b12;
  color: #fff;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.admin-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  border: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 999px;
  padding: 0 14px;
  background: #fff;
  color: #94a3b8;
}

.admin-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #071326;
  font: inherit;
  font-weight: 820;
}

.admin-primary-btn,
.admin-submit-btn,
.admin-secondary-btn,
.admin-danger-btn {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 950;
}

.admin-primary-btn,
.admin-submit-btn {
  background: #1f2937;
  color: #fff;
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.18);
}

.admin-secondary-btn {
  background: #eef2f7;
  color: #0f172a;
}

.admin-danger-btn {
  background: #ef4444;
  color: #fff;
}

.admin-message {
  min-height: 24px;
  margin: 6px 0 10px;
  color: #b42318;
  font-weight: 850;
}

.admin-message[data-type="success"] {
  color: #027a48;
}

.admin-user-list {
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.04);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.06);
}

.admin-user-header,
.admin-user-row {
  display: grid;
  grid-template-columns: minmax(132px, 0.85fr) minmax(190px, 1.05fr) minmax(190px, 1.2fr) minmax(112px, 0.62fr) minmax(72px, 0.45fr) minmax(132px, auto);
  gap: 14px;
  align-items: center;
}

.admin-user-header {
  padding: 14px 18px;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-user-row {
  min-height: 58px;
  border-top: 1px solid #edf0f4;
  padding: 12px 18px;
}

.admin-phone {
  color: #071326;
  font-size: 0.93rem;
  font-weight: 850;
  word-break: break-word;
}

.admin-send-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.book-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.book-badge,
.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
}

.book-1 {
  background: #eaf2ff;
  color: #0065ff;
}

.book-2 {
  background: #fff1df;
  color: #f97316;
}

.book-3 {
  background: #f4e8ff;
  color: #a855f7;
}

.book-unknown {
  background: #f1f5f9;
  color: #475569;
}

.role-badge {
  width: fit-content;
  background: #f1f3f5;
  color: #101828;
}

.admin-date {
  color: #64748b;
  font-weight: 850;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.admin-action-btn,
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: #f8fafc;
  color: #111827;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 950;
}

.admin-action-btn.send {
  background: #e8fff1;
  color: #078930;
}

.admin-action-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-action-btn.danger {
  color: #ef4444;
}

.admin-empty {
  border-radius: 18px;
  padding: 24px;
  background: #fff;
  color: #64748b;
  font-weight: 760;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.06);
}

.admin-empty.compact {
  box-shadow: none;
}

.admin-empty h3 {
  margin-bottom: 8px;
  color: #071326;
  font-size: 1.2rem;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 14px;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 20, 0.42);
  backdrop-filter: blur(4px);
}

.admin-modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 448px);
  max-height: min(92vh, 760px);
  overflow: auto;
  border-radius: 24px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(7, 12, 20, 0.26);
}

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

.modal-head.compact {
  margin-bottom: 10px;
}

.modal-head h3 {
  color: #071326;
  font-size: 1.2rem;
  font-weight: 950;
}

.admin-field {
  margin-top: 14px;
}

.name-modal-card {
  width: min(100%, 390px);
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  border: 0;
}

.avatar-picker legend {
  flex: 0 0 100%;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.avatar-picker legend span {
  color: #94a3b8;
  letter-spacing: 0;
  text-transform: none;
}

.avatar-picker label {
  cursor: pointer;
}

.avatar-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-option {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid transparent;
  border-radius: 50%;
  padding: 3px;
  background: #f3f4f6;
  overflow: hidden;
}

.avatar-option img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-picker input:checked + .avatar-option {
  border-color: #1d1d22;
  box-shadow: 0 0 0 4px rgba(29, 29, 34, 0.08);
}

.admin-field small,
.admin-field em {
  color: #64748b;
  font-style: normal;
  font-weight: 750;
}

.books-picker {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border: 0;
}

.books-picker legend {
  margin-bottom: 6px;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.books-picker label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  border-radius: 14px;
  padding: 8px 12px;
  background: #f4f5f7;
  color: #071326;
  font-weight: 900;
}

.books-picker input {
  width: 18px;
  height: 18px;
  accent-color: #111827;
}

.books-picker span {
  color: #64748b;
  font-size: 0.82rem;
}

.admin-submit-btn {
  width: 100%;
  margin-top: 18px;
}

.confirm-card p {
  color: #475569;
  font-weight: 760;
  line-height: 1.5;
}

.confirm-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.nav-btn:focus-visible,
.book-card:focus-visible,
.chapter-card:focus-visible,
.login-btn:focus-visible,
.logout-btn:focus-visible,
.reader-nav-btn:focus-visible,
.admin-entry-btn:focus-visible,
.admin-primary-btn:focus-visible,
.admin-submit-btn:focus-visible,
.admin-action-btn:focus-visible,
.admin-tab:focus-visible {
  outline: 3px solid rgba(22, 201, 91, 0.42);
  outline-offset: 4px;
}

@media (hover: hover) {
  .book-card:hover,
  .chapter-card:hover {
    border-color: rgba(255, 255, 255, 0.94);
    transform: translateY(-6px);
    box-shadow:
      0 34px 86px rgba(31, 45, 73, 0.18),
      0 9px 24px rgba(31, 45, 73, 0.09),
      inset 0 1px 0 rgba(255, 255, 255, 0.96);
  }

  .book-card:hover .book-cover img {
    filter: drop-shadow(0 26px 22px rgba(7, 19, 38, 0.26));
    transform: rotateY(-13deg) rotateZ(-3deg) translateY(-8px) scale(1.025);
  }

  .success-accent:hover .book-cover img {
    transform: rotateY(13deg) rotateZ(3deg) translateY(-8px) scale(1.025);
  }

  .chapter-card:hover .chapter-visual img {
    filter: saturate(1.08) contrast(1.03);
    transform: scale(1.08);
  }

  .book-card:hover .book-action,
  .nav-btn:hover {
    box-shadow: 0 20px 38px rgba(7, 19, 38, 0.3);
  }
}

@media (min-width: 720px) {
  .app {
    padding: 28px 24px 58px;
  }

  .hero-shell {
    min-height: 246px;
    padding: 34px;
  }

  .books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px;
  }

  .book-card {
    grid-template-columns: 1fr;
    min-height: 390px;
    padding: 26px;
  }

  .book-cover {
    height: 250px;
  }

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

@media (min-width: 1080px) {
  .app {
    padding-top: 34px;
  }

  .hero-shell {
    min-height: 286px;
    padding: 42px;
  }

  .section-title {
    margin-top: 24px;
  }

  .books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .book-card {
    grid-template-columns: 1fr;
    min-height: 420px;
    padding: 32px;
  }

  .book-cover {
    height: 292px;
    border-radius: 30px;
  }

  .chapters-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body[data-screen="login"] .app {
    padding: 12px;
    place-items: start center;
  }

  .login-experience {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 14px;
  }

  .login-art {
    min-height: 300px;
    border-radius: 32px;
  }

  .mind-mark {
    width: min(68vw, 230px);
    top: 48%;
  }

  .floating-book {
    width: 104px;
    height: 126px;
    border-width: 8px;
    border-radius: 22px;
    padding: 12px;
  }

  .floating-book strong {
    font-size: 2rem;
  }

  .card-a {
    left: 7%;
    top: 46%;
  }

  .card-b {
    right: 7%;
    top: 13%;
  }

  .card-c {
    right: 10%;
    bottom: 8%;
  }

  .login-brand {
    display: none;
  }
}

@media (max-width: 520px) {
  .app {
    padding-inline: 10px;
  }

  .app-header {
    grid-template-columns: 1fr;
  }

  body[data-screen="login"] .app {
    padding: 10px;
  }

  .login-art {
    min-height: 238px;
    border-radius: 28px;
  }

  body[data-screen="login"] .login-panel {
    border-radius: 28px;
    padding: 20px;
  }

  .login-title-block h2 {
    font-size: 2.4rem;
  }

  .login-title-block p:last-child {
    font-size: 0.96rem;
  }

  .login-mode {
    margin-bottom: 10px;
  }

  .card-c {
    display: none;
  }

  .hero-shell {
    min-height: 218px;
    border-radius: 30px;
    padding: 22px;
  }

  .hero-side {
    top: 18px;
    right: 18px;
  }

  .hero-pill {
    display: none;
  }

  .hero-copy {
    padding-top: 48px;
  }

  .book-card {
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 13px;
    min-height: 184px;
    border-radius: 28px;
    padding: 14px;
  }

  .with-session {
    grid-template-columns: 1fr;
  }

  .logout-btn {
    width: fit-content;
  }

  .session-actions {
    justify-content: flex-start;
  }

  .admin-entry-btn,
  .logout-btn {
    flex: 1 1 150px;
  }

  .book-cover {
    height: 154px;
    border-radius: 22px;
  }

  .book-copy h3 {
    margin-top: 6px;
  }

  .book-copy p {
    font-size: 0.82rem;
  }

  .book-action {
    min-height: 38px;
    margin-top: 12px;
    padding: 9px 35px 9px 14px;
    font-size: 0.82rem;
  }

  .chapters-grid {
    gap: 10px;
  }

  .chapter-card {
    min-height: 190px;
    border-radius: 20px;
  }

  .chapter-card-body {
    padding: 48px 11px 12px;
  }

  .chapter-card-body strong {
    font-size: 0.8rem;
    line-height: 1.16;
  }

  .chapter-card-index {
    top: 10px;
    left: 10px;
    min-width: 36px;
    min-height: 28px;
    padding: 5px 9px;
    font-size: 0.7rem;
  }

  .admin-topbar {
    grid-template-columns: 1fr;
  }

  .admin-topbar .nav-btn {
    width: fit-content;
  }

  .admin-tabs {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-tab {
    padding-inline: 8px;
  }

  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-primary-btn {
    width: 100%;
  }

  .admin-user-list {
    display: grid;
    gap: 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .admin-user-header {
    display: none;
  }

  .admin-user-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 18px;
    padding: 14px;
    background: #fff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.07);
  }

  .admin-send-cell .admin-action-btn {
    width: 100%;
    min-height: 42px;
  }

  .admin-actions {
    justify-content: stretch;
  }

  .admin-action-btn {
    flex: 1 1 0;
    width: auto;
    min-height: 42px;
  }

  .admin-modal {
    align-items: end;
    padding: 0;
  }

  .admin-modal-card {
    width: 100%;
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
    padding: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-art,
  .login-orbit,
  .mind-core,
  .floating-book,
  body[data-screen="login"] .login-panel {
    animation: none;
  }
}

body[data-screen="admin"] {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 248, 251, 0.98)),
    #f4f5f7;
}

body[data-screen="admin"] .app {
  width: min(100%, 1020px);
}

.admin-screen {
  max-width: 980px;
  margin: 0 auto;
  padding-top: 18px;
}

.admin-topbar {
  align-items: center;
  margin-bottom: 28px;
}

.admin-topbar .nav-btn {
  width: 58px;
  min-height: 58px;
  padding: 0;
  border-radius: 999px;
  font-size: 0;
}

.admin-topbar .nav-btn::before {
  content: "";
  width: 28px;
  height: 28px;
  display: block;
  margin: auto;
  background: currentColor;
  clip-path: polygon(50% 5%, 95% 43%, 83% 43%, 83% 95%, 60% 95%, 60% 64%, 40% 64%, 40% 95%, 17% 95%, 17% 43%, 5% 43%);
}

.admin-topbar h2 {
  color: #0b1628;
  font-size: clamp(2.35rem, 8vw, 4rem);
  text-transform: uppercase;
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 18px);
  margin-bottom: 36px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
}

.admin-tab {
  min-height: 68px;
  padding: 12px 18px;
  color: #fff;
  font-size: clamp(0.88rem, 2.6vw, 1.7rem);
  font-weight: 950;
  text-transform: uppercase;
}

.admin-tab.users-tab {
  background: #08c976;
}

.admin-tab.pending-tab {
  background: #ffd35a;
}

.admin-tab.expired-tab {
  background: #ff7074;
}

.admin-tab.active {
  filter: saturate(1.08);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.13);
}

.admin-toolbar {
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 72px;
}

.admin-search {
  min-height: 88px;
  padding: 0 clamp(18px, 4vw, 34px);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.06);
}

.admin-search input {
  font-size: clamp(1rem, 4vw, 2rem);
  font-weight: 900;
}

.admin-primary-btn,
.admin-submit-btn {
  min-height: 78px;
  background: #1f2937;
}

.admin-user-list {
  display: grid;
  gap: 20px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.admin-user-row {
  min-height: 118px;
  border: 2px dashed #0b0f18;
  border-radius: 18px;
  padding: 14px 18px;
  background: #fff;
}

.admin-phone {
  width: fit-content;
  border-radius: 10px;
  padding: 4px 8px;
  background: #ebedf0;
  font-size: 0.98rem;
}

.book-badge,
.role-badge {
  border-radius: 8px;
  padding: 6px 12px;
}

.book-1 {
  background: #0b0f18;
  color: #fff;
}

.book-2 {
  background: #ffd35a;
  color: #141414;
}

.book-3 {
  background: #08c976;
  color: #fff;
}

.admin-date {
  color: #05070d;
  font-size: clamp(1.15rem, 3vw, 1.55rem);
  font-weight: 950;
}

.admin-action-btn,
.icon-btn {
  border-radius: 999px;
  background: #080b12;
  color: #fff;
}

.admin-actions .admin-action-btn {
  font-size: 0;
}

.admin-actions .admin-action-btn::before {
  display: block;
  font-size: 1.2rem;
  line-height: 1;
}

.admin-actions .admin-action-btn[aria-label="Modifica utente"]::before {
  content: "✎";
}

.admin-actions .admin-action-btn[aria-label="Reset dispositivi"]::before {
  content: "↻";
}

.admin-actions .admin-action-btn[aria-label="Elimina utente"]::before {
  content: "⌫";
}

.admin-action-btn.send {
  width: 58px;
  height: 58px;
  background: transparent;
  color: #61d89b;
}

.admin-action-btn.danger {
  background: #fff;
  color: #ef4444;
  outline: 1px dashed #ef4444;
}

.field input:focus,
.field select:focus,
.admin-search:focus-within {
  border-color: rgba(8, 201, 118, 0.58);
  box-shadow: 0 0 0 4px rgba(8, 201, 118, 0.12), 0 18px 34px rgba(15, 23, 42, 0.06);
}

.login-btn,
.nav-btn,
.book-action,
.reader-nav-btn.primary {
  background: #1f2937;
}

.success-accent .book-action,
.admin-entry-btn {
  background: #08c976;
}

.magic-accent .book-action {
  background: #ff7074;
}

@media (max-width: 520px) {
  .admin-screen {
    padding-top: 10px;
  }

  .admin-tabs {
    gap: 8px;
    padding: 8px;
  }

  .admin-tab {
    min-height: 58px;
    padding: 10px 8px;
  }

  .admin-toolbar {
    margin-bottom: 54px;
  }

  .admin-search {
    min-height: 74px;
  }

  .admin-primary-btn {
    min-height: 66px;
  }

  .admin-user-row {
    border: 2px dashed #0b0f18;
  }
}

.admin-action-btn img {
  width: 22px;
  height: 22px;
  display: block;
  object-fit: contain;
}

.admin-actions .admin-action-btn.has-image::before,
.admin-actions .admin-action-btn:has(img)::before {
  content: none;
}

.admin-action-btn.renew {
  background: #fff;
  color: #0b0f18;
  outline: 1px dashed rgba(8, 201, 118, 0.9);
}

.admin-action-btn.renew img {
  width: 26px;
  height: 26px;
}

.admin-user-row.expired-user {
  border-color: #ff7074;
}

.admin-user-row.expired-user .admin-date {
  color: #ef4444;
}

@media (max-width: 620px) {
  body[data-screen="admin"] .app {
    padding: 0 24px 42px;
  }

  .admin-topbar {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    margin-bottom: 28px;
  }

  .admin-topbar .nav-btn {
    width: 68px;
    min-height: 68px;
  }

  .admin-tabs {
    gap: 10px;
    margin-bottom: 34px;
    padding: 8px;
  }

  .admin-tab {
    min-height: 58px;
    padding: 10px 8px;
    font-size: 0.72rem;
  }

  .admin-toolbar {
    margin-bottom: 78px;
  }

  .admin-search {
    min-height: 72px;
    padding-inline: 22px;
  }

  .admin-search input {
    font-size: 1.05rem;
  }

  .admin-primary-btn {
    min-height: 62px;
    width: 100%;
  }

  .admin-user-list {
    gap: 18px;
  }

  .admin-user-row {
    grid-template-columns: 1fr;
    gap: 14px;
    min-height: 260px;
    align-items: start;
    border: 2px dashed #0b0f18;
    border-radius: 18px;
    padding: 18px;
    box-shadow: none;
  }

  .admin-phone {
    font-size: 1rem;
  }

  .admin-send-cell {
    justify-content: center;
    min-height: 50px;
  }

  .admin-send-cell .admin-action-btn.send {
    width: 44px;
    min-height: 44px;
    height: 44px;
  }

  .book-badges {
    gap: 8px;
  }

  .book-badge {
    min-height: 28px;
    padding: 7px 12px;
  }

  .admin-date {
    font-size: 1.25rem;
  }

  .role-badge {
    min-height: 28px;
  }

  .admin-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .expired-user .admin-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-action-btn {
    width: 100%;
    min-height: 48px;
    height: 48px;
    border-radius: 999px;
  }
}

/* Admin users: compact mobile-first app layout */
body[data-screen="admin"] {
  background: #f6f7f9;
}

body[data-screen="admin"] .app {
  width: min(100%, 1180px);
  padding: 14px 12px 42px;
}

.admin-screen {
  max-width: 1120px;
  padding-top: 6px;
}

.admin-topbar {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.admin-title-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.admin-title-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  object-fit: contain;
}

.admin-topbar h2 {
  font-size: clamp(1.45rem, 6vw, 2.35rem);
  line-height: 1.02;
  text-transform: none;
}

.admin-topbar p:last-child {
  margin-top: 3px;
  font-size: 0.82rem;
}

.admin-home-btn,
.admin-refresh-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: transparent;
  color: #111827;
  box-shadow: none;
  cursor: pointer;
}

.admin-home-btn::before {
  display: none;
}

.admin-home-btn img,
.admin-refresh-btn img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.admin-tabs {
  gap: 8px;
  margin-bottom: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.admin-tab {
  min-height: 42px;
  border-radius: 12px;
  padding: 8px 10px;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: none;
}

.admin-tab.users-tab,
.admin-tab.pending-tab,
.admin-tab.expired-tab {
  background: transparent;
}

.admin-tab.users-tab.active {
  background: #e8f8ef;
  color: #087443;
}

.admin-tab.pending-tab.active {
  background: #fff7df;
  color: #a16207;
}

.admin-tab.expired-tab.active {
  background: #fff0f0;
  color: #d92d20;
}

.admin-tab.active {
  box-shadow: none;
}

.admin-toolbar {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.admin-search {
  min-height: 48px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 0 13px;
  background: #fff;
  box-shadow: none;
}

.admin-search input {
  font-size: 0.96rem;
  font-weight: 760;
}

.admin-search > span {
  width: 18px;
  font-size: 0;
}

.admin-search > span::before {
  content: "⌕";
  font-size: 1rem;
}

.admin-primary-btn {
  min-height: 46px;
  border-radius: 14px;
  background: #111827;
  font-size: 0.9rem;
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.14);
}

.admin-message {
  min-height: 20px;
  margin: 4px 0 8px;
  font-size: 0.82rem;
}

.admin-user-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.admin-user-card {
  display: grid;
  gap: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
}

.admin-user-card.expired-user {
  border-color: #fecaca;
}

.admin-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.admin-card-identity {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.admin-phone {
  width: auto;
  max-width: 100%;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #111827;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.15;
  word-break: break-word;
}

.book-badges {
  gap: 5px;
}

.book-badge,
.role-badge,
.admin-status-badge {
  min-height: 22px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
}

.book-1 {
  background: #eef4ff;
  color: #1d4ed8;
}

.book-2 {
  background: #fff7df;
  color: #a16207;
}

.book-3 {
  background: #e8f8ef;
  color: #087443;
}

.admin-status-badge.active {
  background: #ecfdf3;
  color: #027a48;
}

.admin-status-badge.expired {
  background: #fff0f0;
  color: #d92d20;
}

.admin-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: #64748b;
}

.admin-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 800;
}

.admin-meta-item svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-meta-item.success {
  color: #087443;
}

.admin-meta-item.danger {
  color: #d92d20;
}

.admin-actions {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  border-top: 1px solid #f1f5f9;
  padding-top: 6px;
}

.admin-action-btn,
.admin-action-btn.send,
.admin-action-btn.renew,
.admin-action-btn.danger {
  display: inline-grid;
  place-items: center;
  gap: 2px;
  width: 44px;
  min-width: 40px;
  height: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 4px 2px;
  background: transparent;
  color: #334155;
  outline: 0;
  box-shadow: none;
}

.admin-action-btn img,
.admin-action-btn svg {
  width: 18px;
  height: 18px;
}

.admin-action-btn span {
  display: block;
  color: currentColor;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1;
}

.admin-action-btn.edit {
  color: #1d4ed8;
}

.admin-action-btn.reset {
  color: #7c3aed;
}

.admin-action-btn.send,
.admin-action-btn.renew {
  color: #087443;
}

.admin-action-btn.danger {
  color: #dc2626;
}

.admin-actions .admin-action-btn::before {
  content: none !important;
}

@media (min-width: 720px) {
  .admin-toolbar {
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: center;
  }

  .admin-user-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (min-width: 1080px) {
  .admin-user-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.admin-topbar .admin-home-btn::before {
  content: none !important;
  display: none !important;
}

.admin-home-btn img,
.admin-refresh-btn img {
  display: block;
}

.admin-home-btn,
.admin-refresh-btn {
  position: relative;
}

.admin-status-dot {
  position: relative;
  display: inline-block;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.04);
}

.admin-status-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.18;
  animation: adminStatusPulse 2.2s ease-out infinite;
}

.admin-status-dot.active {
  background: #16a34a;
  color: #16a34a;
}

.admin-status-dot.expiring {
  background: #facc15;
  color: #ca8a04;
}

.admin-status-dot.expired {
  background: #ef4444;
  color: #ef4444;
}

@keyframes adminStatusPulse {
  0% {
    transform: scale(0.72);
    opacity: 0.26;
  }

  70% {
    transform: scale(1.85);
    opacity: 0;
  }

  100% {
    transform: scale(1.85);
    opacity: 0;
  }
}

.admin-user-card.expiring-user {
  border-color: #fde68a;
}

.admin-user-card.expired-user {
  border-color: #fecaca;
}

.book-badge {
  min-height: 21px;
  padding: 4px 7px;
  border-radius: 8px;
  letter-spacing: 0;
}

.admin-meta-item.active {
  color: #087443;
}

.admin-meta-item.expiring {
  color: #a16207;
}

.admin-meta-item.expired {
  color: #d92d20;
}

.admin-actions {
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.admin-actions .admin-action-btn.danger {
  margin-right: auto;
}

.admin-actions .admin-action-btn.send {
  margin-left: auto;
}

.admin-action-btn,
.admin-action-btn.send,
.admin-action-btn.renew,
.admin-action-btn.danger {
  position: relative;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
}

.admin-action-btn.send {
  color: #087443;
  border-color: rgba(8, 116, 67, 0.12);
}

.admin-action-btn.danger {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.12);
  outline: 0;
}

.admin-action-btn:disabled,
.admin-refresh-btn:disabled {
  cursor: progress;
  opacity: 0.72;
}

.admin-action-btn.is-loading img,
.admin-action-btn.is-loading svg,
.admin-action-btn.is-loading span,
.admin-refresh-btn.is-loading img {
  opacity: 0;
}

.admin-action-btn.is-loading::after,
.admin-refresh-btn.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: adminSpin 720ms linear infinite;
}

@keyframes adminSpin {
  to {
    transform: rotate(360deg);
  }
}

/* App-style reader shell */
body[data-screen="books"],
body[data-screen="profile"],
body[data-screen="chapters"] {
  background: #f4f4f6;
  color: #0a0d14;
}

body[data-screen="books"]::before,
body[data-screen="books"]::after,
body[data-screen="profile"]::before,
body[data-screen="profile"]::after,
body[data-screen="chapters"]::before,
body[data-screen="chapters"]::after,
body[data-screen="books"] .app-header,
body[data-screen="profile"] .app-header,
body[data-screen="chapters"] .app-header {
  display: none;
}

body[data-screen="books"] .app,
body[data-screen="profile"] .app,
body[data-screen="chapters"] .app {
  width: 100%;
  max-width: none;
  padding: 0 20px 46px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 62px;
  margin: 0 -20px;
  border-bottom: 1px solid #e8e9ee;
  padding: 6px 20px 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.brand-mark,
.logout-btn,
.profile-nav-btn,
.profile-logout-btn,
.app-tab,
.detail-back,
.favorite-btn,
.profile-book-pill,
.profile-row {
  border: 0;
  appearance: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  font-weight: 850;
}

.brand-mark img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.nav-actions {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  align-self: center;
  gap: 12px;
}

.profile-nav-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f3f4f6;
  overflow: hidden;
}

.profile-nav-btn.active {
  box-shadow: 0 0 0 3px rgba(29, 29, 34, 0.12);
}

.profile-nav-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-edit-btn {
  min-height: 32px;
  margin-top: 12px;
  border: 1px solid rgba(29, 29, 34, 0.12);
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  color: #1d1d22;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
}

.app-tabs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.app-tab {
  min-height: 34px;
  border-radius: 999px;
  padding: 8px 14px;
  color: #777b86;
  font-weight: 850;
}

.app-tab.active {
  background: #1d1d22;
  color: #fff;
}

.app-tab.admin-entry-btn {
  min-height: 34px;
  margin-left: 10px;
  padding: 8px 0;
  background: transparent;
  color: #ff7a00;
  box-shadow: none;
}

.app-tab.admin-entry-btn::before {
  content: "◇";
  margin-right: 6px;
}

.logout-btn {
  justify-self: end;
  min-height: 34px;
  border-radius: 999px;
  padding: 8px 14px;
  background: transparent;
  color: #d92d20;
  box-shadow: none;
  font-weight: 850;
}

.library-title,
.profile-head {
  margin: 48px 0;
}

.section-title.library-title::before {
  display: none;
}

.section-title.library-title h2,
.profile-head h2 {
  color: #070b13;
  font-size: clamp(2.35rem, 5vw, 3.05rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.section-title.library-title p:last-child,
.profile-head p {
  margin-top: 10px;
  color: #81858f;
  font-size: 1rem;
  font-weight: 750;
}

body[data-screen="books"] .books-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
}

body[data-screen="books"] .book-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 332px;
  overflow: hidden;
  border: 2px dashed rgba(29, 29, 34, 0.22);
  border-radius: 20px;
  padding: 0;
  background: transparent;
  box-shadow: 0 14px 30px rgba(14, 18, 27, 0.06);
}

body[data-screen="books"] .book-card::before,
body[data-screen="books"] .book-card::after {
  content: none;
}

body[data-screen="books"] .book-cover {
  width: 100%;
  height: 260px;
  border: 0;
  border-radius: 20px 20px 0 0;
  padding: 14px;
  background: transparent;
  box-shadow: none;
}

body[data-screen="books"] .book-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: none;
  transform: none;
}

body[data-screen="books"] .success-accent .book-cover img {
  transform: none;
}

.magic-cover {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(210, 156, 74, 0.8) 1px, transparent 1px) 22px 20px / 11px 11px,
    linear-gradient(#d6a858, #d6a858) 28px 28px / calc(100% - 56px) 2px no-repeat,
    linear-gradient(#d6a858, #d6a858) 28px calc(100% - 28px) / calc(100% - 56px) 2px no-repeat,
    linear-gradient(145deg, #17150f, #242115 52%, #090908);
  color: #d6a858;
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 850;
  letter-spacing: 0;
  text-shadow: none;
  box-shadow: none;
  transform: none;
}

body[data-screen="books"] .book-copy {
  min-height: 72px;
  padding: 18px 20px 22px;
  border-radius: 0 0 18px 18px;
  background: #fff;
  justify-content: center;
}

body[data-screen="books"] .book-eyebrow {
  color: #828691;
  font-size: 0.78rem;
  letter-spacing: 0;
}

body[data-screen="books"] .book-copy h3 {
  color: #020712;
  font-size: 1.38rem;
  font-weight: 850;
  line-height: 1.1;
}

body[data-screen="books"] .book-title-image {
  display: block;
  width: min(230px, 88%);
  max-height: 48px;
  object-fit: contain;
  object-position: left center;
}

body[data-screen="books"] .book-copy p {
  margin-top: 8px;
  color: #7c818d;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.38;
}

.favorite-btn {
  position: absolute;
  top: 14px;
  right: 13px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #1f232b;
  font-size: 1.35rem;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(14, 18, 27, 0.08);
}

.favorite-btn.active {
  color: #ff3b30;
}

body[data-screen="books"] .home-watermark {
  display: none;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 52px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-head img {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  box-shadow: 0 12px 28px rgba(14, 18, 27, 0.08);
}

.profile-stat {
  min-height: 88px;
  border: 1px solid #e9ebf0;
  border-radius: 14px;
  padding: 20px 22px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(14, 18, 27, 0.035);
}

.profile-stat p {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #868a95;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-icon {
  margin-right: 6px;
  color: #8c929d;
  font-size: 0.72rem;
  font-weight: 850;
}

.profile-stat strong {
  display: block;
  margin-top: 10px;
  color: #060b15;
  font-size: 1rem;
  font-weight: 800;
}

.renew-profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(8, 116, 67, 0.1);
  color: #087443;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
}

.renew-profile-btn img {
  width: 17px;
  height: 17px;
  object-fit: contain;
}

.profile-book-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.profile-book-pill {
  min-height: 25px;
  border-radius: 999px;
  padding: 5px 10px;
  background: #f4f5f7;
  color: #080d16;
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-block {
  margin-top: 0;
  margin-bottom: 48px;
}

.profile-block h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: #050a12;
  font-size: 1.28rem;
  font-weight: 850;
}

.profile-block h3 span {
  color: #ff3b30;
  font-size: 1.3rem;
}

.profile-logout-btn {
  min-height: 44px;
  border-radius: 999px;
  padding: 10px 18px;
  background: rgba(217, 45, 32, 0.08);
  color: #d92d20;
  font-weight: 900;
}

.profile-list {
  display: grid;
  gap: 10px;
}

.profile-empty {
  color: #7d828c;
  font-size: 0.94rem;
  font-weight: 750;
}

.profile-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 72px;
  border-radius: 14px;
  padding: 12px 18px;
  background: #fff;
  text-align: left;
}

.profile-row-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #f2f3f6;
  color: #111827;
  font-size: 1rem;
}

.profile-row-copy {
  min-width: 0;
}

.profile-row-copy strong,
.profile-row-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-row-copy strong {
  color: #050a12;
  font-weight: 850;
}

.profile-row-copy small,
.profile-row-side {
  color: #858a94;
  font-size: 0.78rem;
  font-weight: 750;
}

.detail-back {
  margin: 42px 0 28px;
  color: #858a94;
  font-weight: 850;
}

.detail-back::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 8px;
  background: url("icons/right-arrow.png") center / contain no-repeat;
  transform: rotate(180deg);
  vertical-align: -2px;
}

.book-detail {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  margin-bottom: 40px;
}

.book-detail-cover .book-cover {
  width: 174px;
  height: 234px;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  padding: 10px;
  background: #eff3f6;
  box-shadow: 0 18px 38px rgba(14, 18, 27, 0.08);
}

.book-detail-cover .book-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: none;
  transform: none;
}

.book-detail-copy p:first-child {
  color: #838894;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.book-detail-copy h2 {
  margin-top: 4px;
  color: #070b13;
  font-size: clamp(2.35rem, 6vw, 3.05rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.book-detail-copy p:nth-child(3) {
  margin-top: 10px;
  color: #828691;
  font-size: 1rem;
  font-weight: 750;
}

.book-detail-copy strong {
  display: block;
  margin-top: 16px;
  color: #838894;
  font-size: 0.94rem;
  font-weight: 850;
}

body[data-screen="chapters"] .chapters-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

body[data-screen="chapters"] .chapter-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  overflow: visible;
  border: 1px solid #eceef2;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  box-shadow: none;
}

body[data-screen="chapters"] .chapter-card::before,
body[data-screen="chapters"] .chapter-card::after,
body[data-screen="chapters"] .chapter-visual {
  display: none;
}

body[data-screen="chapters"] .chapter-card-index {
  position: static;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: #f4f5f8;
  color: #071326;
  box-shadow: none;
  font-size: 0.9rem;
  letter-spacing: 0;
}

body[data-screen="chapters"] .chapter-card-body {
  position: static;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 0;
  background: transparent;
}

body[data-screen="chapters"] .chapter-card-body::after {
  content: "";
  position: absolute;
  right: 18px;
  width: 16px;
  height: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: url("icons/right-arrow.png") center / contain no-repeat;
  opacity: 0.48;
}

body[data-screen="chapters"] .chapter-card-body strong {
  overflow: hidden;
  color: #030812;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: none;
}

body[data-screen="chapters"] .chapter-card-body span {
  color: #888d97;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}

@media (hover: hover) {
  body[data-screen="books"] .book-card:hover,
  body[data-screen="chapters"] .chapter-card:hover,
  .profile-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px rgba(14, 18, 27, 0.08);
  }

  body[data-screen="books"] .book-card:hover .book-cover img,
  body[data-screen="chapters"] .chapter-card:hover .chapter-visual img,
  .book-detail-cover .book-cover:hover img {
    filter: none;
    transform: none;
  }
}

@media (max-width: 900px) {
  .app-topbar {
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    min-height: 72px;
    padding-top: 14px;
  }

  .app-tabs {
    grid-column: auto;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 0;
  }

  body[data-screen="books"] .books-grid,
  body[data-screen="chapters"] .chapters-grid,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .book-detail {
    grid-template-columns: 136px minmax(0, 1fr);
    gap: 20px;
  }

  .book-detail-cover .book-cover {
    width: 136px;
    height: 184px;
  }
}

@media (max-width: 560px) {
  body[data-screen="books"] .app,
  body[data-screen="profile"] .app,
  body[data-screen="chapters"] .app {
    padding-inline: 14px;
  }

  .app-topbar {
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .brand-mark strong {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .library-title,
  .profile-head {
    margin: 34px 0;
  }

  body[data-screen="books"] .book-cover {
    height: 258px;
  }

  .book-detail {
    grid-template-columns: 1fr;
    margin-bottom: 28px;
  }

  .book-detail-cover .book-cover {
    width: min(174px, 58vw);
    height: auto;
    aspect-ratio: 174 / 234;
  }

  body[data-screen="chapters"] .chapters-grid {
    gap: 10px;
  }

  body[data-screen="chapters"] .chapter-card {
    min-height: 72px;
    padding: 14px;
  }
}
