.lang-switch {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 900;
}

.hero,
.page-hero {
  background:
    linear-gradient(90deg, rgba(5, 10, 15, 0.9) 0%, rgba(5, 10, 15, 0.62) 52%, rgba(5, 10, 15, 0.24)),
    var(--hero-image, url("../images/hero-trading.png")) center right / cover no-repeat;
}

.menu-toggle {
  padding: 0;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.menu-toggle span {
  width: 20px;
  height: 2px;
  margin: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.menu-toggle {
  flex-direction: column;
  gap: 5px;
  flex: 0 0 46px;
}

body.menu-open .menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.menu-open .menu-toggle span:nth-child(2) {
  opacity: 0;
}

body.menu-open .menu-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.contact-panel {
  padding: 28px;
}

.nav-logout {
  margin: 0;
}

.nav-logout .lang-switch {
  border-radius: 999px;
}

.nav-actions > .button.ghost,
.nav-actions > .nav-logout {
  display: none;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  list-style: none;
}

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

.account-trigger {
  width: 54px;
  height: 54px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(0, 230, 184, 0.24);
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.22), transparent 36%),
    rgba(0, 230, 184, 0.08);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.account-trigger:hover,
.account-menu[open] .account-trigger {
  transform: translateY(-2px);
  border-color: rgba(0, 230, 184, 0.48);
  background: rgba(0, 230, 184, 0.14);
  box-shadow: 0 18px 45px rgba(0, 230, 184, 0.12);
}

.account-label {
  display: none;
}

.account-avatar,
.account-large-avatar {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-main), var(--accent-cyan));
  color: #04100d;
  font-weight: 950;
}

.account-avatar {
  width: 38px;
  height: 38px;
  font-size: 0.88rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 10px 26px rgba(0, 183, 255, 0.18);
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 260px;
  padding: 10px;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025)),
    rgba(7, 16, 22, 0.96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  animation: account-dropdown-in 0.18s ease both;
}

.rtl .account-dropdown {
  right: auto;
  left: 0;
}

.account-card-head {
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 4px;
}

.account-card-head strong,
.account-card-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card-head span {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.account-dropdown a,
.account-dropdown button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: rgba(244, 255, 249, 0.84);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.account-dropdown a:hover,
.account-dropdown button:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
}

.account-dropdown form {
  margin: 0;
}

@keyframes account-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

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

.auth-wrap {
  max-width: 620px;
}

.auth-card {
  padding: 30px;
}

.auth-card h2 {
  margin-top: 0;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-weight: 800;
}

.inline-check input {
  width: auto;
}

.error-note {
  border-color: rgba(255, 59, 74, 0.34);
  background: rgba(255, 59, 74, 0.1);
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: start;
}

.account-summary {
  position: sticky;
  top: 130px;
  padding: 26px;
}

.account-large-avatar {
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  font-size: 1.45rem;
}

.account-summary h2 {
  margin: 0 0 6px;
}

.account-summary p {
  margin: 0 0 20px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.account-shortcuts,
.account-forms {
  display: grid;
  gap: 12px;
}

.account-shortcuts a {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(244, 255, 249, 0.84);
  font-weight: 850;
}

.account-shortcuts a:hover {
  border-color: rgba(0, 230, 184, 0.34);
  background: rgba(0, 230, 184, 0.08);
  color: var(--text-main);
}

.compact-card {
  margin-top: 20px;
}

.portrait-placeholder {
  overflow: hidden;
}

.portrait-placeholder .portrait-photo,
.book-cover .book-cover-image {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  filter: none;
}

.purchase-notes {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

.purchase-notes div {
  display: grid;
  grid-template-columns: minmax(120px, 0.36fr) 1fr;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
}

.purchase-notes span {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.purchase-notes strong {
  color: var(--text-main);
}

.book-cover {
  overflow: hidden;
}

.book-purchase-grid {
  align-items: stretch;
}

.purchase-panel {
  padding: clamp(24px, 4vw, 42px);
}

.purchase-panel form {
  margin-top: 22px;
}

.qr-panel {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  justify-items: center;
  gap: 18px;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  background: var(--glass-bg);
  box-shadow: var(--shadow-glass);
}

.qr-panel img {
  width: min(320px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 22px;
  background: #fff;
  padding: 12px;
}

.qr-placeholder {
  width: min(320px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 22px;
  color: var(--text-secondary);
  text-align: center;
  padding: 22px;
}

.compact-reader-hero {
  min-height: 52vh;
}

.reader-shell {
  padding: 18px;
}

.reader-top {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 0 16px;
}

.book-reader-frame {
  width: 100%;
  height: min(82vh, 980px);
  min-height: 620px;
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.book-cover .book-cover-image {
  width: min(420px, 86%);
  height: auto;
  min-height: 0;
  border-radius: 22px;
  box-shadow: 28px 32px 0 rgba(0, 0, 0, 0.28), 0 30px 80px rgba(0, 0, 0, 0.42);
}

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

.media-card {
  grid-column: span 4;
  min-height: 420px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  background: var(--glass-bg);
  box-shadow: var(--shadow-glass);
}

.media-card:nth-child(3n + 1) {
  grid-column: span 5;
}

.media-card:nth-child(3n + 2) {
  grid-column: span 3;
}

.media-card img {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
  opacity: 0.88;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.media-card:hover img {
  transform: scale(1.04);
  opacity: 1;
}

.media-card::after {
  content: "";
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(to bottom, transparent, rgba(5, 10, 15, 0.92));
}

.media-card > div {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 1;
}

.media-card .tag {
  margin-bottom: 10px;
}

.media-card h3 {
  margin-bottom: 8px;
}

.media-card p {
  margin: 0;
  color: rgba(244, 255, 249, 0.78);
  line-height: 1.55;
}

.floating-contact {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 94;
  width: 58px;
  height: 58px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(37, 211, 102, 0.55);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(37, 211, 102, 0.95), rgba(0, 180, 120, 0.82));
  color: #04100d;
  font-size: 0.86rem;
  font-weight: 900;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34), 0 0 28px rgba(37, 211, 102, 0.22);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: whatsapp-float 3.8s ease-in-out infinite;
}

.floating-contact::before {
  content: "";
  position: absolute;
  inset: -7px;
  z-index: -1;
  border: 1px solid rgba(37, 211, 102, 0.42);
  border-radius: inherit;
  opacity: 0;
  transform: scale(0.82);
  animation: whatsapp-ring 2.6s ease-out infinite;
}

.floating-contact:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.38), 0 0 34px rgba(37, 211, 102, 0.28);
}

.whatsapp-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  color: #04100d;
}

.whatsapp-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
  transform-origin: center;
  animation: whatsapp-glyph 3.8s ease-in-out infinite;
}

.floating-contact span:last-child {
  display: none;
}

@keyframes whatsapp-float {
  0%,
  100% {
    transform: translateY(0);
  }

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

@keyframes whatsapp-ring {
  0% {
    opacity: 0;
    transform: scale(0.84);
  }

  18% {
    opacity: 0.58;
  }

  78%,
  100% {
    opacity: 0;
    transform: scale(1.28);
  }
}

@keyframes whatsapp-glyph {
  0%,
  72%,
  100% {
    transform: rotate(0deg) scale(1);
  }

  78% {
    transform: rotate(-8deg) scale(1.08);
  }

  84% {
    transform: rotate(8deg) scale(1.08);
  }

  90% {
    transform: rotate(0deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .floating-contact,
  .floating-contact::before,
  .whatsapp-icon svg {
    animation: none;
  }
}

.rtl .floating-contact {
  right: auto;
  left: 22px;
}

.rtl {
  font-family: var(--font-arabic);
  text-rendering: optimizeLegibility;
}

.rtl h1 {
  font-size: clamp(2.75rem, 5vw, 4.9rem);
  font-weight: 650;
  line-height: 1.16;
}

.rtl .hero-content h1 {
  line-height: 1.22;
}

.rtl h2 {
  font-size: clamp(1.95rem, 3.35vw, 3.5rem);
  font-weight: 650;
  line-height: 1.2;
}

.rtl h3 {
  font-weight: 600;
  line-height: 1.5;
}

.rtl p,
.rtl .lead,
.rtl .hero-copy {
  font-weight: 350;
  line-height: 1.9;
}

.rtl .nav-links a,
.rtl .button,
.rtl .lang-switch,
.rtl .account-trigger,
.rtl .account-dropdown a,
.rtl .account-dropdown button {
  font-weight: 600;
}

.rtl .eyebrow,
.rtl .section-kicker,
.rtl .tag,
.rtl .dashboard-top,
.rtl .dashboard-badges,
.rtl .ticker-item {
  font-weight: 600;
}

.rtl .eyebrow::before {
  order: 2;
}

.rtl .nav-links a,
.rtl .field label,
.rtl p,
.rtl h1,
.rtl h2,
.rtl h3 {
  text-align: right;
}

.rtl .nav-links,
.rtl .nav-links a,
.rtl .account-dropdown {
  direction: rtl;
}

.rtl .section-head.center p,
.rtl .section-head.center h2,
.rtl .section-head.center .lead,
.rtl .final-cta p,
.rtl .final-cta h2 {
  text-align: center;
}

@media (min-width: 1041px) {
  .menu-toggle {
    display: none;
  }
}

@media (max-width: 1040px) {
  .menu-toggle {
    display: inline-flex;
  }

  .lang-switch {
    min-width: 42px;
    min-height: 42px;
  }

  .account-trigger {
    width: 44px;
    height: 44px;
  }

  .account-avatar {
    width: 32px;
    height: 32px;
  }

  .account-dropdown {
    right: -54px;
  }

  .rtl .account-dropdown {
    right: auto;
    left: -54px;
  }
}

@media (max-width: 640px) {
  .rtl h1,
  .rtl .page-hero h1 {
    font-size: clamp(2.2rem, 8.2vw, 3.05rem);
    line-height: 1.16;
  }

  .rtl .hero-content h1 {
    line-height: 1.2;
  }

  .rtl h2 {
    font-size: clamp(1.75rem, 7.6vw, 2.65rem);
  }

  .hero,
  .page-hero {
    background:
      linear-gradient(90deg, rgba(5, 10, 15, 0.82), rgba(5, 10, 15, 0.5)),
      var(--hero-image, url("../images/hero-trading.png")) center / cover no-repeat;
  }

  .media-gallery {
    grid-template-columns: 1fr;
  }

  .purchase-notes div {
    grid-template-columns: 1fr;
  }

  .media-card,
  .media-card:nth-child(3n + 1),
  .media-card:nth-child(3n + 2) {
    grid-column: span 1;
    min-height: 360px;
  }

  .media-card img {
    min-height: 360px;
  }

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

  .account-summary {
    position: static;
  }

  .account-dropdown {
    right: -92px;
    width: min(280px, calc(100vw - 28px));
  }

  .rtl .account-dropdown {
    right: auto;
    left: -92px;
  }

  .floating-contact {
    right: 16px;
    bottom: 84px;
  }

  .rtl .floating-contact {
    right: auto;
    left: 16px;
  }

  .book-reader-frame {
    min-height: 560px;
  }
}

/* Protected interactive book reader */
.book-reader-active {
  overflow: hidden;
}

.book-reader-active .site-footer,
.book-reader-active .floating-contact {
  display: none;
}

.book-reader-active main {
  min-height: 100vh;
}

.book-reader-page {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 720px;
  padding: 142px 14px 14px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 230, 184, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(125deg, #050a0f 0 48%, #071117 100%);
  background-size: 72px 72px, 72px 72px, auto;
}

.book-reader-page::before {
  content: "";
  position: absolute;
  inset: 110px 0 0;
  pointer-events: none;
  background:
    linear-gradient(118deg, transparent 18%, rgba(0, 230, 184, 0.055) 18.2%, transparent 18.5%),
    linear-gradient(68deg, transparent 72%, rgba(214, 168, 79, 0.04) 72.2%, transparent 72.5%);
}

.reader-app {
  --reader-border: rgba(255, 255, 255, 0.11);
  --reader-panel: rgba(10, 18, 24, 0.94);
  --reader-control: rgba(255, 255, 255, 0.055);
  position: relative;
  z-index: 1;
  width: min(1500px, 100%);
  height: 100%;
  min-height: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 3px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--reader-border);
  border-radius: 8px;
  background: rgba(7, 13, 18, 0.82);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.46), inset 0 1px rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(24px) saturate(120%);
  -webkit-backdrop-filter: blur(24px) saturate(120%);
  color: var(--text-main);
}

.reader-app:fullscreen {
  width: 100%;
  height: 100%;
  max-width: none;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #050a0f;
}

.reader-app button,
.reader-app input {
  font: inherit;
}

.reader-app button {
  color: inherit;
}

.reader-app-header {
  min-height: 66px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  background: rgba(8, 15, 20, 0.86);
}

.reader-app-title {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.reader-app-title strong {
  overflow: hidden;
  color: var(--text-main);
  font-size: 0.96rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-app-title > small {
  color: var(--accent-main);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reader-private-label {
  min-height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(214, 168, 79, 0.28);
  border-radius: 999px;
  background: rgba(214, 168, 79, 0.08);
  color: #e2bd72;
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.reader-private-label svg {
  width: 14px;
  height: 14px;
}

.reader-header-actions,
.reader-tool-group {
  display: flex;
  align-items: center;
}

.reader-header-actions {
  flex: 0 0 auto;
  gap: 7px;
}

.reader-icon-button,
.reader-tool-button,
.reader-mobile-navigation button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 6px;
  background: var(--reader-control);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.reader-icon-button:hover,
.reader-tool-button:hover,
.reader-mobile-navigation button:hover,
.reader-icon-button.is-active,
.reader-tool-button.is-active,
.reader-icon-button[aria-pressed="true"],
.reader-tool-button[aria-pressed="true"] {
  border-color: rgba(0, 230, 184, 0.45);
  background: rgba(0, 230, 184, 0.11);
  color: var(--accent-main);
}

.reader-icon-button:hover,
.reader-tool-button:hover {
  transform: translateY(-1px);
}

.reader-icon-button:focus-visible,
.reader-tool-button:focus-visible,
.reader-mobile-navigation button:focus-visible,
.reader-back-button:focus-visible,
.reader-page-field input:focus-visible,
.reader-sidebar-tabs button:focus-visible,
.reader-thumbnail:focus-visible {
  outline: 2px solid var(--accent-main);
  outline-offset: 2px;
}

.reader-icon-button svg,
.reader-tool-button svg,
.reader-mobile-navigation svg,
.reader-back-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.reader-icon-button:disabled,
.reader-tool-button:disabled,
.reader-mobile-navigation button:disabled {
  opacity: 0.32;
  cursor: default;
  transform: none;
}

.reader-back-button {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.065);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 800;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.reader-back-button:hover {
  border-color: rgba(214, 168, 79, 0.42);
  background: rgba(214, 168, 79, 0.1);
}

.reader-progress {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.035);
}

.reader-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-main), var(--accent-cyan), var(--vip-gold));
  transition: width 0.3s ease;
}

.reader-workspace {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 0 minmax(0, 1fr);
  overflow: hidden;
  transition: grid-template-columns 0.25s ease;
}

.reader-app.sidebar-open .reader-workspace {
  grid-template-columns: 252px minmax(0, 1fr);
}

.reader-sidebar {
  position: relative;
  z-index: 12;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border-inline-end: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(7, 14, 19, 0.98);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.reader-app.sidebar-open .reader-sidebar {
  opacity: 1;
  visibility: visible;
}

.reader-sidebar-head {
  min-width: 252px;
  min-height: 66px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.reader-sidebar-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.reader-sidebar-head span {
  color: var(--accent-main);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reader-sidebar-head strong {
  overflow: hidden;
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-sidebar-tabs {
  min-width: 252px;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.reader-sidebar-tabs button {
  min-width: 0;
  min-height: 36px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
}

.reader-sidebar-tabs button[aria-selected="true"] {
  border-color: rgba(0, 230, 184, 0.25);
  background: rgba(0, 230, 184, 0.09);
  color: var(--accent-main);
}

.reader-sidebar-tabs svg {
  width: 15px;
  height: 15px;
}

.reader-thumbnail-list {
  min-width: 252px;
  min-height: 0;
  padding: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(0, 230, 184, 0.35) transparent;
  scrollbar-width: thin;
}

.reader-thumbnail {
  position: relative;
  width: 100%;
  min-height: 150px;
  margin: 0 0 8px;
  padding: 9px;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  text-align: start;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.reader-thumbnail:hover,
.reader-thumbnail.is-current {
  border-color: rgba(0, 230, 184, 0.42);
  background: rgba(0, 230, 184, 0.07);
}

.reader-thumbnail-preview {
  width: 116px;
  min-height: 130px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.055);
}

.reader-thumbnail-preview canvas {
  display: block;
  max-width: 100%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.reader-thumbnail:not(.is-rendered) .reader-thumbnail-preview::before {
  content: "";
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent-main);
  border-radius: 50%;
  animation: reader-spin 0.8s linear infinite;
}

.reader-thumbnail-label {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.reader-thumbnail-label small {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.reader-thumbnail-label strong {
  font-size: 1.05rem;
}

.reader-thumbnail-marker {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-end: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
}

.reader-thumbnail.is-bookmarked .reader-thumbnail-marker {
  background: var(--vip-gold);
  box-shadow: 0 0 12px rgba(214, 168, 79, 0.55);
}

.reader-bookmark-empty {
  position: absolute;
  inset: 132px 12px auto;
  padding: 28px 16px;
  color: var(--text-secondary);
  text-align: center;
}

.reader-bookmark-empty svg {
  width: 25px;
  margin-bottom: 8px;
  color: var(--vip-gold);
}

.reader-bookmark-empty p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.6;
}

.reader-sidebar-scrim {
  display: none;
}

.reader-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.reader-toolbar {
  min-height: 56px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  background: rgba(12, 20, 26, 0.88);
  direction: ltr;
}

.reader-tool-group {
  gap: 5px;
}

.reader-tool-button {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
}

.reader-toolbar-separator {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.11);
}

.reader-page-field {
  height: 36px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 750;
}

.reader-page-field input {
  width: 42px;
  height: 27px;
  padding: 0 4px;
  border: 0;
  border-radius: 3px;
  outline: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  text-align: center;
  font-weight: 850;
  appearance: textfield;
}

.reader-page-field input::-webkit-inner-spin-button,
.reader-page-field input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.reader-zoom-value {
  width: 54px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 850;
  text-align: center;
}

.reader-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    #11171c;
  background-size: 44px 44px;
  direction: ltr;
  scrollbar-color: rgba(0, 230, 184, 0.36) rgba(0, 0, 0, 0.12);
  scrollbar-width: thin;
}

.reader-stage:focus-visible {
  outline: 1px solid rgba(0, 230, 184, 0.5);
  outline-offset: -1px;
}

.reader-page-wrap {
  position: relative;
  margin: 26px auto;
  overflow: hidden;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.54), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: opacity 0.16s ease;
}

.reader-page-wrap canvas {
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.reader-app.is-rendering .reader-page-wrap {
  opacity: 0.58;
}

.reader-loading,
.reader-error {
  position: absolute;
  inset: 0;
  z-index: 4;
  padding: 24px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  background: rgba(9, 15, 20, 0.86);
  color: var(--text-secondary);
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.reader-loading[hidden],
.reader-error[hidden] {
  display: none;
}

.reader-loading svg {
  width: 32px;
  height: 32px;
  color: var(--accent-main);
  animation: reader-spin 0.85s linear infinite;
}

.reader-loading strong,
.reader-error strong {
  color: var(--text-main);
  font-size: 1rem;
}

.reader-loading span,
.reader-error p {
  margin: 0;
  max-width: 440px;
  font-size: 0.78rem;
  line-height: 1.6;
}

.reader-error svg {
  width: 34px;
  height: 34px;
  color: var(--loss-red);
}

.reader-error .button {
  min-height: 40px;
  margin-top: 6px;
  border-radius: 6px;
}

.reader-statusbar {
  min-height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
  background: rgba(9, 16, 21, 0.95);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.reader-save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reader-save-status svg {
  width: 14px;
  color: var(--accent-main);
}

.reader-mobile-navigation {
  display: none;
}

.reader-toast {
  position: absolute;
  z-index: 40;
  inset-inline-start: 50%;
  bottom: 52px;
  max-width: min(360px, calc(100% - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(0, 230, 184, 0.3);
  border-radius: 6px;
  background: rgba(4, 20, 18, 0.96);
  color: var(--text-main);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.46);
  font-size: 0.75rem;
  font-weight: 750;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.rtl .reader-toast {
  transform: translate(50%, 10px);
}

.reader-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.rtl .reader-toast.is-visible {
  transform: translate(50%, 0);
}

.reader-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes reader-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .book-reader-page {
    min-height: 620px;
    padding: 120px 6px 7px;
  }

  .reader-app {
    min-height: 490px;
  }

  .reader-app-header {
    min-height: 58px;
    padding: 7px 8px;
    gap: 8px;
  }

  .reader-app-title {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
  }

  .reader-app-title > small {
    display: none;
  }

  .reader-app-title strong {
    font-size: 0.8rem;
  }

  .reader-private-label {
    min-height: 30px;
    padding: 0 8px;
    font-size: 0.62rem;
  }

  .reader-header-actions {
    gap: 5px;
  }

  .reader-icon-button,
  .reader-header-actions .reader-back-button {
    width: 36px;
    height: 36px;
    min-height: 36px;
    flex-basis: 36px;
  }

  .reader-header-actions .reader-back-button {
    padding: 0;
    display: inline-grid;
    place-items: center;
  }

  .reader-header-actions .reader-back-button span {
    display: none;
  }

  .reader-workspace,
  .reader-app.sidebar-open .reader-workspace {
    display: block;
  }

  .reader-main {
    width: 100%;
    height: 100%;
  }

  .reader-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 22;
    width: min(310px, 84vw);
    opacity: 1;
    visibility: visible;
    box-shadow: 26px 0 70px rgba(0, 0, 0, 0.5);
    transform: translateX(-105%);
    transition: transform 0.24s ease;
  }

  .rtl .reader-sidebar {
    inset: 0 0 0 auto;
    box-shadow: -26px 0 70px rgba(0, 0, 0, 0.5);
    transform: translateX(105%);
  }

  .reader-app.sidebar-open .reader-sidebar,
  .rtl .reader-app.sidebar-open .reader-sidebar {
    transform: translateX(0);
  }

  .reader-sidebar-head,
  .reader-sidebar-tabs,
  .reader-thumbnail-list {
    min-width: 0;
  }

  .reader-sidebar-scrim {
    position: absolute;
    inset: 0;
    z-index: 21;
    border: 0;
    background: rgba(0, 0, 0, 0.58);
  }

  .reader-app.sidebar-open .reader-sidebar-scrim {
    display: block;
  }

  .reader-toolbar {
    justify-content: space-between;
  }

  .reader-stage {
    touch-action: pan-x pan-y;
  }

  .reader-page-wrap {
    margin: 12px auto;
  }

  .reader-statusbar {
    min-height: 44px;
  }

  .reader-save-status {
    display: none;
  }

  .reader-mobile-navigation {
    display: flex;
    gap: 5px;
  }

  .reader-mobile-navigation button {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 5px;
  }

  .reader-toast {
    bottom: 54px;
  }
}

@media (max-width: 560px) {
  .reader-app-title strong {
    max-width: 34vw;
  }

  .reader-private-label {
    width: 30px;
    padding: 0;
    justify-content: center;
  }

  .reader-private-label:not(svg) {
    font-size: 0;
  }

  .reader-private-label svg {
    width: 15px;
    height: 15px;
  }

  .reader-toolbar {
    min-height: 92px;
    padding: 6px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 7px;
  }

  .reader-page-controls {
    justify-content: flex-start;
  }

  .reader-zoom-controls {
    justify-content: flex-end;
  }

  .reader-view-controls {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .reader-toolbar-separator {
    display: none;
  }

  .reader-tool-button {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .reader-page-field {
    height: 34px;
    padding: 0 6px;
  }

  .reader-zoom-value {
    width: 42px;
  }

  .reader-stage {
    background-size: 34px 34px;
  }
}

@media (max-height: 760px) and (min-width: 901px) {
  .book-reader-page {
    min-height: 640px;
    padding-top: 124px;
  }

  .reader-app-header {
    min-height: 58px;
  }

  .reader-toolbar {
    min-height: 50px;
    padding-block: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reader-app *,
  .reader-app *::before,
  .reader-app *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
