:root {
  --bg: #f8f2e8;
  --paper: #fffdf8;
  --ink: #171513;
  --muted: #686059;
  --green: #184f33;
  --green-dark: #103722;
  --wine: #5b1217;
  --gold: #b9934d;
  --line: rgba(23, 21, 19, 0.12);
  --shadow: 0 24px 70px rgba(38, 31, 24, 0.12);
  --font-ui: "Vazirmatn", Tahoma, Arial, sans-serif;
  --font-title: "Noto Nastaliq Urdu", "Vazirmatn", Tahoma, Arial, sans-serif;
  --reader-zoom: 1;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(24, 79, 51, 0.08), transparent 34%),
    linear-gradient(225deg, rgba(91, 18, 23, 0.08), transparent 38%),
    var(--bg);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(100% - 32px, 760px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 48px 0;
}

.intro {
  width: 100%;
  padding: clamp(28px, 6vw, 58px);
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.kicker {
  margin: 0 0 14px;
  color: var(--wine);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(2.35rem, 8vw, 5rem);
  line-height: 1.7;
  letter-spacing: 0;
}

.author {
  margin: 16px 0 0;
  color: var(--green);
  font-size: 1.18rem;
  font-weight: 700;
}

.summary {
  max-width: 42rem;
  margin: 24px 0 30px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 2;
}

.password-box {
  display: grid;
  gap: 10px;
}

.password-box label {
  font-weight: 700;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input {
  min-height: 54px;
  width: 100%;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(24, 79, 51, 0.12);
}

button {
  min-height: 54px;
  border: 0;
  padding: 0 22px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--green-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.form-message {
  min-height: 28px;
  margin: 0;
  color: var(--wine);
  font-size: 0.94rem;
}

.small-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.9;
}

.admin-shell {
  width: min(100% - 32px, 820px);
}

.upload-progress {
  height: 12px;
  margin-top: 18px;
  background: rgba(24, 79, 51, 0.12);
  overflow: hidden;
}

.upload-progress div {
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 0.25s ease;
}

.guide h1 {
  font-family: var(--font-ui);
  font-size: clamp(2rem, 6vw, 3.3rem);
  line-height: 1.45;
}

.guide-list {
  margin: 0;
  padding: 0 26px 0 0;
  display: grid;
  gap: 14px;
  color: var(--ink);
  font-size: 1.04rem;
  line-height: 1.95;
}

.guide-list strong {
  direction: ltr;
  display: inline-block;
  color: var(--green);
}

.reader-body {
  background: #eee8de;
}

.reader-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 74px;
  padding: 12px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(248, 242, 232, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.reader-header p,
.reader-header h1 {
  margin: 0;
}

.reader-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

.reader-header h1 {
  font-family: var(--font-ui);
  font-size: clamp(1.1rem, 3vw, 1.55rem);
}

.reader-actions {
  display: flex;
  gap: 8px;
  direction: ltr;
}

.reader-actions button {
  min-width: 46px;
  min-height: 44px;
  padding: 0 14px;
}

.reader-main {
  width: min(100% - 24px, 1060px);
  margin: 0 auto;
  padding: 20px 0 44px;
}

.page-counter {
  margin: 0 0 18px;
  color: var(--muted);
  text-align: center;
}

.pages {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.book-page {
  width: min(100%, calc(760px * var(--reader-zoom)));
  margin: 0;
  background: var(--paper);
  border: 1px solid rgba(23, 21, 19, 0.08);
  box-shadow: 0 18px 50px rgba(23, 21, 19, 0.12);
}

.book-page img {
  display: block;
  width: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

.book-page figcaption {
  padding: 10px 14px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

@media (max-width: 640px) {
  .intro {
    padding: 24px;
  }

  .password-row,
  .reader-header {
    grid-template-columns: 1fr;
  }

  .password-row {
    display: grid;
  }

  .password-row button {
    width: 100%;
  }

  .reader-header {
    align-items: stretch;
  }

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

  .reader-actions button {
    flex: 1;
  }
}
