:root {
  --bg: #ffffff;
  --ink: #202124;
  --muted: #74777f;
  --soft: #f4f6ff;
  --soft-2: #f7f8fc;
  --line: #e3e6ef;
  --brand: #3157e7;
  --brand-2: #23d5df;
  --orange: #ff8a24;
  --danger: #f04452;
  --success: #16835f;
  --footer: #242437;
  --shadow: 0 18px 46px rgba(29, 36, 64, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  direction: rtl;
}

#app {
  direction: rtl;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Tajawal", "IBM Plex Sans Arabic", "Noto Sans Arabic", system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  direction: rtl;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.app-navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr minmax(220px, 360px) auto;
  align-items: center;
  gap: 22px;
  min-height: 74px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  direction: rtl;
  backdrop-filter: blur(14px);
  width: 100%;
  max-width: 100vw;
}

.app-navbar > *,
.home-hero > *,
.browse-layout > *,
.two-column > *,
.workspace-layout > *,
.book-card-body,
.book-list-item > *,
.library-card > *,
.site-map-card,
.auth-page > * {
  min-width: 0;
}

.brand,
.nav-links,
.search-pill,
.user-menu summary,
.meta-line,
.hero-meta,
.action-row,
.tabs,
.sort-tabs,
.rating-stars,
.tags-list,
.review-actions,
.reader-toolbar,
.reader-footer,
.form-actions,
.section-heading,
.library-tabs,
.site-footer-inner,
.download-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: #111827;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e8f3;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.08);
  flex: 0 0 auto;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-links {
  gap: 22px;
  color: #62656d;
  font-size: 14px;
  font-weight: 600;
  direction: rtl;
}

.nav-links a {
  white-space: nowrap;
}

.nav-links a.is-active,
.nav-links a:hover {
  color: var(--brand);
}

.search-pill {
  gap: 8px;
  justify-self: stretch;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 0 14px;
  direction: rtl;
  max-width: 100%;
}

.search-pill input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.search-pill button {
  width: 28px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 18px;
  font-weight: 600;
}

.user-menu {
  justify-self: end;
  position: relative;
  direction: rtl;
}

.user-menu summary {
  gap: 9px;
  border: 0;
  background: transparent;
  padding: 0;
  list-style: none;
  color: #5e626b;
  font-weight: 600;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #eef1ff;
  color: var(--brand);
  font-weight: 600;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-large {
  width: 86px;
  height: 86px;
  font-size: 30px;
}

.cover-image {
  display: block;
  object-fit: cover;
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 16px);
  left: 0;
  display: grid;
  min-width: 260px;
  overflow: hidden;
  border-radius: 8px;
  background: #252632;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.24);
}

.user-menu:not([open]) .user-menu-panel {
  display: none;
}

.user-menu-panel a,
.user-menu-panel button,
.menu-status {
  padding: 12px 16px;
  color: #f5f6ff;
  font-weight: 600;
  text-align: inherit;
}

.user-menu-panel button {
  border: 0;
  background: transparent;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover {
  background: var(--brand);
}

.menu-status {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 13px;
}

.notification-badge {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: #ec135b;
  color: white;
  padding: 0 6px;
  font-size: 11px;
}

.notification-list {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
  color: white;
}

.notification-list small {
  color: #b9bdcf;
  line-height: 1.45;
}

.app-main {
  max-width: 1240px;
  min-height: calc(100vh - 74px);
  margin: 0 auto;
  padding: 28px 24px 96px;
  direction: rtl;
}

.publish-invite {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin: 0 auto 28px;
  border: 1px solid #d8deec;
  border-radius: 8px;
  background: #f7f9ff;
  padding: 22px 58px 22px 24px;
  box-shadow: 0 14px 34px rgba(49, 87, 231, 0.09);
}

.publish-invite h2 {
  margin: 2px 0 6px;
  font-size: 28px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.publish-invite p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
}

.publish-invite-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #d8deec;
  border-radius: 50%;
  background: white;
  color: #6b7280;
  font-size: 20px;
  line-height: 1;
}

.mobile-nav {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 22px;
  background: white;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}

.btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.btn.secondary {
  border-color: var(--brand);
  color: var(--brand);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
}

.btn:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-weight: 600;
}

.page-title {
  max-width: 900px;
  margin: 8px 0 28px;
  text-align: right;
}

.page-title h1,
.home-hero h1,
.novel-hero h1,
.reader-content h1,
.auth-page h1,
.profile-page h1 {
  margin: 0;
  color: #111827;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.page-title h1 {
  font-size: clamp(30px, 4vw, 44px);
}

.page-title p,
.section-heading p,
.book-card p,
.book-list-item p,
.novel-hero p,
.profile-page p,
.auth-page p,
.empty-state p {
  color: var(--muted);
}

.eyebrow {
  display: inline-flex;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 36px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 24px 0 44px;
}

.home-hero h1 {
  max-width: 760px;
  font-size: clamp(38px, 5.8vw, 56px);
}

.action-row {
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
}

.section {
  border-top: 1px solid var(--line);
  padding: 32px 0;
}

.section-heading {
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 2px 0 4px;
  font-size: 24px;
  line-height: 1.2;
}

.section-heading p {
  margin: 0;
}

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

.book-card,
.book-list-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  background: transparent;
}

.book-card .book-cover,
.book-list-item .book-cover,
.library-card .book-cover,
.admin-row .book-cover {
  width: 96px;
  height: 128px;
  border-radius: 5px;
  box-shadow: 0 7px 18px rgba(22, 28, 46, 0.16);
}

.book-cover {
  display: grid;
  place-items: end start;
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(135deg, #171a2a, #3157e7);
  color: white;
  padding: 10px;
  font-size: 12px;
  font-weight: 900;
}

.cover-fantasy {
  background: linear-gradient(140deg, #10213a, #7c43d8);
}

.cover-romance {
  background: linear-gradient(140deg, #631d52, #f0789f);
}

.cover-thriller {
  background: linear-gradient(140deg, #101827, #d94e2d);
}

.cover-history {
  background: linear-gradient(140deg, #2d1d13, #be8a42);
}

.cover-sci-fi {
  background: linear-gradient(140deg, #07131f, #23d5df);
}

.cover-drama {
  background: linear-gradient(140deg, #1d2436, #7a8ea8);
}

.book-card-body {
  min-width: 0;
}

.book-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.book-card-actions .btn,
.list-side .btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.book-card h3,
.book-list-item h3,
.library-card h3,
.admin-row h3 {
  margin: 5px 0 5px;
  color: #202124;
  font-size: 18px;
  line-height: 1.22;
}

.book-card p,
.book-list-item p {
  display: -webkit-box;
  margin: 0 0 7px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.meta-line,
.hero-meta {
  flex-wrap: wrap;
  gap: 12px;
  color: #636873;
  font-size: 13px;
  font-weight: 800;
}

.meta-line span:first-child,
.tags-list span {
  color: var(--brand);
  font-weight: 600;
}

.rating-stars {
  gap: 2px;
  color: var(--orange);
  font-size: 17px;
  line-height: 1;
}

.rating-stars.is-empty {
  color: #b9bfcc;
}

.rating-stars b {
  margin-inline-start: 8px;
  color: #1f2430;
  font-size: 14px;
}

.tags-list {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.tags-list span {
  border-radius: 999px;
  background: #eef2ff;
  padding: 3px 8px;
  font-size: 11px;
}

.list-stack {
  display: grid;
  gap: 18px;
}

.book-list-item,
.library-card,
.admin-row,
.review-card,
.chapter-row,
.academy-card {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.book-list-item {
  grid-template-columns: 82px minmax(0, 1fr) auto;
}

.book-list-item .book-cover {
  width: 82px;
  height: 112px;
}

.list-side {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.genre-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.genre-cloud a {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  color: #343844;
  font-weight: 900;
}

.genre-cloud small {
  color: var(--brand);
}

.site-map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.site-map-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 20px;
}

.site-map-card h3 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
}

.site-map-card p {
  min-height: 52px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.site-map-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-map-card a {
  border: 1px solid #d7dbe7;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.site-map-card a:hover {
  border-color: var(--brand);
  background: #eef2ff;
}

.browse-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}

.genre-sidebar {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 0;
  direction: rtl;
}

.side-title,
.genre-sidebar a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  color: #202124;
  font-size: 18px;
  font-weight: 900;
}

.genre-sidebar a {
  border-bottom: 0;
  padding: 9px 12px;
  color: #31343b;
  font-size: 15px;
  font-weight: 800;
}

.genre-sidebar a.is-active,
.genre-sidebar a:hover {
  border-radius: 5px;
  background: var(--brand);
  color: white;
}

.genre-sidebar small {
  color: inherit;
  opacity: 0.74;
}

.browse-results .page-title {
  margin-top: 0;
}

.tabs,
.sort-tabs {
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 18px 0 6px;
}

.sort-tabs {
  margin-bottom: 24px;
}

.tabs::before {
  content: "فلترة";
}

.sort-tabs::before {
  content: "ترتيب";
}

.tabs::before,
.sort-tabs::before {
  flex-basis: 100%;
  color: #6d7078;
  font-size: 22px;
  font-weight: 700;
}

.tabs button,
.tabs a,
.sort-tabs button,
.sort-tabs a {
  min-height: 34px;
  border: 1px solid #d7dbe7;
  border-radius: 999px;
  background: white;
  color: #333843;
  padding: 0 16px;
  font-weight: 600;
}

.tabs button.is-active,
.tabs a.is-active,
.sort-tabs button.is-active,
.sort-tabs a.is-active {
  border-color: #dfe5ff;
  background: #e9edff;
  color: var(--brand);
}

.novel-hero {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 42px;
  align-items: center;
  margin: -28px calc(50% - 50vw) 0;
  padding: 56px max(24px, calc((100vw - 1240px) / 2));
  background: var(--soft);
  direction: ltr;
}

.novel-hero .book-cover {
  width: 320px;
  height: 456px;
  border-radius: 4px;
  box-shadow: 0 14px 32px rgba(19, 24, 40, 0.24);
}

.novel-hero-copy {
  direction: rtl;
  text-align: right;
}

.novel-hero h1 {
  max-width: 760px;
  font-size: clamp(36px, 5vw, 54px);
}

.novel-hero p {
  max-width: 760px;
  margin: 16px 0;
  font-size: 16px;
}

.novel-hero .hero-meta {
  justify-content: flex-start;
  margin: 12px 0;
}

.social-panel {
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 48px;
}

.chapter-list {
  display: grid;
}

.chapter-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
}

.chapter-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--brand);
  font-weight: 900;
}

.chapter-row small,
.status {
  color: var(--muted);
}

.review-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
}

.review-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.review-card p {
  margin: 7px 0;
  color: #4b4f5a;
}

.review-card small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 800;
}

.review-actions {
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.review-actions button {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 900;
}

.author-summary-card,
.author-profile-hero {
  display: grid;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(17, 24, 39, 0.06);
}

.author-summary-card {
  grid-template-columns: 64px minmax(0, 1fr);
  padding: 18px;
}

.author-profile-hero {
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  margin-bottom: 34px;
  padding: 30px;
}

.author-profile-hero h1 {
  margin: 2px 0 8px;
  color: #151925;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.author-summary-card h3 {
  margin: 4px 0 6px;
  color: #151925;
  font-size: 22px;
}

.author-summary-card h3 a,
.hero-meta a {
  color: inherit;
  text-decoration: none;
}

.author-summary-card p,
.author-profile-hero p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.8;
}

.author-avatar {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--brand);
  font-size: 24px;
  font-weight: 900;
  object-fit: cover;
}

.author-profile-hero > .author-avatar {
  width: 120px;
  height: 120px;
  font-size: 42px;
}

.author-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.author-metrics article {
  border: 1px solid #dfe4f1;
  border-radius: 8px;
  background: #f8faff;
  padding: 10px;
}

.author-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.author-metrics b {
  color: #151925;
  font-size: 18px;
  font-weight: 900;
}

.library-tabs {
  justify-content: center;
  gap: 34px;
  margin: -6px 0 24px;
  border-bottom: 1px solid var(--line);
}

.library-tabs a {
  padding: 0 0 10px;
  color: #777b85;
  font-size: 18px;
  font-weight: 900;
}

.library-tabs a.is-active {
  border-bottom: 3px solid var(--brand);
  color: #1f2430;
}

.library-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.library-card p,
.admin-row p {
  margin: 0;
  color: var(--muted);
}

.progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebf4;
  margin-top: 10px;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.reader-page {
  max-width: 900px;
  margin: 0 auto;
}

.reader-toolbar,
.reader-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.reader-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reader-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.reader-content {
  padding: 36px 0;
  color: #23262f;
}

.reader-book-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.reader-book-head .book-cover {
  width: 70px;
  height: 100px;
  flex: 0 0 auto;
}

.reader-book-head h2 {
  margin: 2px 0 4px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.reader-book-head small {
  color: var(--muted);
  font-weight: 700;
}

.reader-content h1 {
  font-size: clamp(32px, 5vw, 46px);
}

.reader-chapter-cover {
  width: min(100%, 760px);
  aspect-ratio: 16 / 9;
  display: block;
  margin: 26px 0;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e4e7ef;
}

.reader-content p {
  margin: 22px 0;
  font-size: 20px;
  line-height: 2;
}

.reader-pdf-panel {
  display: grid;
  gap: 16px;
  margin: 28px 0;
  padding: 18px;
  border: 1px solid #dce4f4;
  border-radius: 8px;
  background: #f8fbff;
  color: #1d2330;
}

.reader-pdf-panel > div {
  display: grid;
  gap: 6px;
}

.reader-pdf-panel b {
  font-size: 18px;
}

.reader-pdf-panel span {
  color: var(--muted);
  font-weight: 700;
}

.reader-pdf-panel.is-error {
  border-color: #fecaca;
  background: #fff5f5;
}

.reader-pdf-badge {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 6px;
  background: #e53935;
  color: #fff !important;
  font-size: 12px;
  letter-spacing: 0;
}

.reader-pdf-frame {
  width: 100%;
  min-height: 720px;
  border: 1px solid #dce4f4;
  border-radius: 8px;
  background: #fff;
}

.auth-page {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 42px;
  align-items: start;
  max-width: 1120px;
  margin: 20px auto 80px;
  direction: ltr;
}

.auth-intro,
.auth-form {
  direction: rtl;
}

.auth-intro {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 28px;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 42px;
  box-shadow: var(--shadow);
}

.auth-page h1 {
  font-size: clamp(36px, 5vw, 56px);
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-form label,
.editor-form label {
  display: grid;
  gap: 7px;
  color: #666b76;
  font-weight: 900;
}

.auth-form input,
.auth-form select,
.auth-form textarea,
.editor-form input,
.editor-form select,
.editor-form textarea,
.search-page-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bfc4cf;
  border-radius: 3px;
  background: white;
  padding: 9px 12px;
  color: #111827;
  outline: 0;
}

.auth-form input:focus,
.editor-form input:focus,
.editor-form select:focus,
.editor-form textarea:focus,
.search-page-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(49, 87, 231, 0.12);
}

.editor-form small {
  color: #7c8290;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
}

.form-divider {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: #111827;
  font-size: 18px;
  font-weight: 900;
}

.publish-readiness {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  border: 1px solid #d8deec;
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fbff, #eef2ff);
  padding: 18px;
}

.publish-readiness h3 {
  margin: 6px 0 8px;
  color: #111827;
  font-size: 22px;
  line-height: 1.2;
}

.publish-readiness p {
  margin: 0;
  color: #626977;
  font-weight: 700;
  line-height: 1.7;
}

.publish-readiness ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: publish-step;
}

.publish-readiness li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  counter-increment: publish-step;
}

.publish-readiness li::before {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  content: counter(publish-step);
  font-size: 13px;
  font-weight: 900;
}

.publish-readiness b,
.publish-readiness span {
  display: block;
}

.publish-readiness b {
  color: #1f2430;
  font-size: 15px;
}

.publish-readiness li span {
  margin-top: 3px;
  color: #6f7685;
  font-size: 13px;
  line-height: 1.6;
}

.choice-field {
  display: grid;
  gap: 12px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.choice-field legend {
  padding: 0 8px;
  color: #111827;
  font-weight: 900;
}

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

.editor-form .choice-card {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  border: 1px solid #d8deec;
  border-radius: 8px;
  background: #fbfcff;
  padding: 10px 12px;
  color: #1f2430;
}

.editor-form .choice-card input {
  width: auto;
  min-height: auto;
  flex: 0 0 auto;
}

.content-panel {
  margin-top: 2px;
}

.cover-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #666b76;
  font-size: 13px;
  font-weight: 500;
}

.cover-preview .book-cover {
  width: 58px;
  height: 86px;
}

.chapter-cover-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #666b76;
  font-size: 13px;
  font-weight: 500;
}

.chapter-cover-preview img {
  width: 112px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #e4e7ef;
}

.auth-provider-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.auth-switch {
  text-align: left;
  color: #616673;
  font-weight: 800;
}

.auth-switch a {
  color: var(--brand);
  font-weight: 1000;
}

.auth-alert {
  border-radius: 6px;
  padding: 10px 12px;
  font-weight: 800;
}

.auth-alert.success {
  background: #eaf8f1;
  color: var(--success);
}

.auth-alert.error {
  background: #fff0f2;
  color: var(--danger);
}

.profile-page {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 28px;
  max-width: 980px;
  margin: 30px auto;
}

.profile-avatar-stack {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 12px;
}

.profile-avatar {
  overflow: hidden;
}

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

.profile-avatar-button {
  position: relative;
  width: 100%;
  min-height: 38px;
  justify-content: center;
  overflow: hidden;
  text-align: center;
}

.profile-avatar-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.metric-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 18px;
}

.metric-grid span {
  color: var(--muted);
  font-weight: 900;
}

.metric-grid b {
  display: block;
  margin-top: 4px;
  font-size: 30px;
}

.profile-author-books {
  margin-top: 28px;
}

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

.profile-book-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.profile-book-row h3 {
  margin: 0 0 4px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.profile-book-row p {
  margin: 0;
}

.profile-book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.search-page-form,
.editor-form {
  display: grid;
  gap: 16px;
}

.search-page-form {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 24px;
}

.editor-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-form .full,
.editor-form.full {
  grid-column: 1 / -1;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
}

.workspace-sidebar {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 8px;
  align-self: start;
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

.workspace-sidebar b {
  margin-bottom: 8px;
  font-size: 20px;
}

.workspace-sidebar a {
  border-radius: 6px;
  padding: 9px 12px;
  color: #5c606c;
  font-weight: 900;
}

.workspace-sidebar a.is-active,
.workspace-sidebar a:hover {
  background: #eef2ff;
  color: var(--brand);
}

.admin-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
}

.academy-card,
.empty-state,
.loading-state,
.toast {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 20px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.state-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--brand);
  font-weight: 900;
}

.loading-state {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.loading-state span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  animation: pulse 0.9s infinite ease-in-out alternate;
}

.loading-state span:nth-child(2) {
  animation-delay: 0.16s;
}

.loading-state span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes pulse {
  from {
    opacity: 0.35;
    transform: translateY(0);
  }
  to {
    opacity: 1;
    transform: translateY(-5px);
  }
}

.toast {
  margin-bottom: 16px;
  color: var(--brand);
  font-weight: 900;
}

.site-footer {
  margin-top: 40px;
  background: var(--footer);
  color: #f5f6ff;
  padding: 54px 24px;
  direction: rtl;
}

.site-footer-inner {
  max-width: 1240px;
  justify-content: space-between;
  gap: 32px;
  margin: 0 auto;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 1000;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 36px;
  color: #aeb2c6;
}

.footer-links b {
  display: block;
  margin-bottom: 10px;
  color: white;
}

.footer-links small {
  display: block;
  margin: -4px 0 7px;
  color: #aeb2c3;
  font-size: 12px;
  font-weight: 700;
}

.footer-links a {
  display: block;
  margin-top: 7px;
}

.app-download-modal {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 25;
  width: 260px;
  border-radius: 18px;
  background: white;
  padding: 22px;
  text-align: center;
  box-shadow: 0 18px 48px rgba(29, 36, 64, 0.18);
}

.app-download-modal .brand-mark {
  width: 48px;
  height: 48px;
  margin: -46px auto 12px;
}

.app-download-modal button.close {
  position: absolute;
  top: 12px;
  left: 14px;
  border: 0;
  background: transparent;
  color: #7b7f8b;
  font-size: 24px;
}

.download-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.download-actions .btn {
  width: 100%;
  min-height: 42px;
}

@media (max-width: 980px) {
  .app-navbar {
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    padding: 10px 16px;
  }

  .nav-links {
    display: none;
  }

  .search-pill {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .app-main {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 22px 16px 90px;
  }

  .publish-invite {
    grid-template-columns: 1fr;
    padding: 54px 18px 18px;
  }

  .publish-invite .btn {
    width: 100%;
  }

  .home-hero,
  .browse-layout,
  .novel-hero,
  .author-profile-hero,
  .two-column,
  .auth-page,
  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .home-hero {
    gap: 24px;
  }

  .browse-layout {
    gap: 26px;
  }

  .genre-sidebar,
  .workspace-sidebar {
    position: static;
  }

  .genre-sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 0 -16px;
    padding: 0 16px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .genre-sidebar::-webkit-scrollbar {
    display: none;
  }

  .genre-sidebar .side-title {
    display: none;
  }

  .genre-sidebar a {
    flex: 0 0 auto;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: white;
    font-size: 13px;
    line-height: 1.2;
  }

  .novel-hero {
    margin-top: -22px;
    padding-top: 30px;
  }

  .novel-hero .book-cover {
    width: min(300px, 100%);
    height: auto;
    aspect-ratio: 2 / 2.85;
    justify-self: center;
  }

  .book-grid {
    grid-template-columns: 1fr;
  }

  .site-map-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
    padding: 6px;
    box-shadow: var(--shadow);
  }

  .mobile-nav a {
    border-radius: 8px;
    padding: 8px 4px;
    color: #6b7280;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
  }

  .mobile-nav a.is-active {
    background: #eef2ff;
    color: var(--brand);
  }

  .site-footer,
  .app-download-modal {
    display: none;
  }
}

@media (max-width: 640px) {
  .brand-name {
    display: none;
  }

  .user-menu summary span:not(.avatar) {
    display: none;
  }

  .page-title h1,
  .auth-page h1,
  .novel-hero h1 {
    font-size: 30px;
  }

  .home-hero h1 {
    max-width: 100%;
    font-size: 30px;
    line-height: 1.25;
  }

  .home-hero {
    direction: ltr;
  }

  .home-hero > *,
  .home-hero .book-card {
    direction: rtl;
  }

  .home-hero p,
  .novel-hero p,
  .page-title p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .action-row {
    gap: 10px;
  }

  .action-row .btn {
    min-width: 0;
    min-height: 36px;
    white-space: normal;
    padding: 0 14px;
    font-size: 14px;
    line-height: 1.2;
  }

  .side-title,
  .genre-sidebar a {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .side-title {
    font-size: 16px;
  }

  .book-card,
  .book-list-item,
  .library-card,
  .author-summary-card,
  .admin-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .author-profile-hero {
    padding: 22px;
  }

  .author-profile-hero > .author-avatar {
    width: 86px;
    height: 86px;
    font-size: 30px;
  }

  .author-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-page {
    grid-template-columns: 1fr;
  }

  .profile-avatar-stack {
    justify-items: start;
  }

  .profile-avatar-button {
    width: auto;
  }

  .profile-book-row {
    grid-template-columns: 1fr;
  }

  .profile-book-actions {
    justify-content: stretch;
  }

  .profile-book-actions .btn {
    flex: 1 1 120px;
  }

  .book-card .book-cover,
  .book-list-item .book-cover,
  .library-card .book-cover,
  .admin-row .book-cover {
    width: 76px;
    height: 104px;
  }

  .library-card .btn,
  .admin-row .btn,
  .admin-row select,
  .list-side {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .metric-grid,
  .editor-form,
  .choice-grid,
  .publish-readiness,
  .auth-provider-row,
  .search-page-form {
    grid-template-columns: 1fr;
  }

  .auth-card,
  .auth-intro {
    padding: 22px;
  }

  .reader-content p {
    font-size: 18px;
  }

  .reader-pdf-frame {
    min-height: 520px;
  }

  .reader-toolbar,
  .reader-footer {
    flex-wrap: wrap;
  }

  .reader-book-head {
    align-items: flex-start;
  }
}

body,
button,
input,
select,
textarea {
  font-weight: 400;
}

.brand,
.nav-links,
.user-menu summary,
.btn,
.icon-button,
.side-title,
.genre-sidebar a,
.tabs button,
.tabs a,
.sort-tabs button,
.sort-tabs a,
.meta-line,
.tag,
.eyebrow,
.menu-status,
.user-menu-panel a,
.user-menu-panel button,
.book-cover,
.mobile-nav a,
.download-actions .btn {
  font-weight: 500;
}

.page-title h1,
.home-hero h1,
.novel-hero h1,
.reader-content h1,
.auth-page h1,
.profile-page h1,
.section-heading h2,
.book-card h3,
.book-list-item h3,
.library-card h3,
.admin-row h3,
.tabs::before,
.sort-tabs::before,
.brand-mark,
.avatar {
  font-weight: 500;
}

.brand,
.section-heading h2,
.book-card h3,
.book-list-item h3,
.library-card h3,
.admin-row h3 {
  font-weight: 600;
}
