/* ==========================================================
   Кітап оқу байқауы — ортақ стиль
   Қаріп: тек Inter. Негізгі өлшем 18px. Батырма биіктігі 60px.
   ========================================================== */

:root {
  /* Түстер логотиптен алынған: қою көк және алтын */
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #E9EDF4;
  --ink: #0B1E3E;
  --ink-2: #26344F;
  --muted: #4A5670;
  --line: #D9DEE8;
  --line-strong: #77839A;

  --accent: #0B1E3E;
  --accent-hover: #1A3566;
  --accent-soft: #E6ECF7;
  --accent-bright: #C9A84C;
  --gold: #C9A84C;
  --gold-hover: #B8963A;
  --gold-ink: #7A5F14;
  --hero-1: #0B1E3E;
  --hero-2: #1B3A70;

  --ok: #11703A;
  --ok-soft: #E1F4E8;
  --err: #B3261E;
  --err-soft: #FDE9E7;
  --warn: #7A5200;
  --warn-soft: #FFF3D1;
  --info: #1D4F91;
  --info-soft: #E4EEFB;

  --r-lg: 16px;
  --r: 12px;
  --r-sm: 10px;
  --sh-1: 0 1px 2px rgba(11, 30, 62, .06), 0 4px 16px rgba(11, 30, 62, .06);
  --sh-2: 0 2px 4px rgba(11, 30, 62, .10), 0 16px 36px rgba(11, 30, 62, .18);
  --font: 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.7rem; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 1.3rem; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 1.1rem; line-height: 1.3; font-weight: 700; }
a { color: var(--accent); }
[hidden] { display: none !important; }

.lead { font-size: 1.1rem; color: var(--ink-2); margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.eyebrow { font-weight: 700; color: var(--accent-hover); font-size: .95rem; margin-bottom: 6px; }
.ic { width: 24px; height: 24px; flex: none; }
.stack { display: grid; gap: 14px; }
.mt { margin-top: 20px; }
.mt-lg { margin-top: 28px; }

/* ---------- Беттің қаңқасы ---------- */
.app {
  min-height: 100vh;
  padding: 16px 16px calc(104px + env(safe-area-inset-bottom));
}
body.guest .app { padding-bottom: 32px; }
.main { min-width: 0; width: 100%; max-width: 720px; margin: 0 auto; }
.sidebar, .extras { display: none; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--ink);
  font-weight: 800; font-size: 1.05rem; line-height: 1.2;
}
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
}

.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.05rem;
}

/* Төменгі навигация (телефон) */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(11, 30, 62, .10);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 64px; padding: 6px 2px; border-radius: 14px;
  color: var(--ink-2); text-decoration: none; text-align: center;
  font-size: 14px; font-weight: 600; line-height: 1.15;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav a .ic { width: 28px; height: 28px; }
.bottom-nav a.active { color: var(--accent-hover); background: var(--accent-soft); font-weight: 700; }
body.guest .bottom-nav { display: none; }

/* Бүйір мәзірі (компьютер) */
.side-inner { display: flex; flex-direction: column; gap: 20px; height: 100%; }
.profile-card {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border-radius: var(--r); background: linear-gradient(160deg, #F2F5FB, #E3EAF6);
}
.profile-name { font-weight: 800; font-size: 1.1rem; line-height: 1.2; overflow-wrap: anywhere; }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-nav a, .side-nav button {
  font: inherit; font-weight: 600;
  display: flex; align-items: center; gap: 14px;
  min-height: 56px; padding: 0 14px; width: 100%;
  border: 0; border-radius: 14px; background: none; cursor: pointer;
  color: var(--ink-2); text-decoration: none; text-align: left;
  transition: background-color .15s ease;
}
.side-nav a:hover, .side-nav button:hover { background: var(--surface-2); }
.side-nav a.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 700; }
.side-foot { margin-top: auto; }

@media (min-width: 900px) {
  .app {
    display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start;
    max-width: 1380px; margin: 0 auto; padding: 24px;
  }
  body.guest .app { padding-bottom: 24px; }
  .sidebar {
    display: block; position: sticky; top: 24px; height: calc(100vh - 48px);
    background: #fff; border-radius: var(--r-lg); padding: 22px 16px; box-shadow: var(--sh-1);
    overflow-y: auto;
  }
  .bottom-nav, .topbar { display: none; }
  .main { max-width: 820px; }
  h1 { font-size: 2rem; }
}
@media (min-width: 1200px) {
  .app { grid-template-columns: 260px minmax(0, 1fr) 310px; }
  .extras { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 24px; }
}

/* ---------- Карточка ---------- */
.card {
  background: var(--surface); border-radius: var(--r-lg); padding: 22px;
  box-shadow: var(--sh-1); border: 1px solid rgba(229, 218, 205, .7);
}
.card-soft { background: linear-gradient(160deg, #F2F5FB, #E6ECF7); border: 0; }
.card h3 { margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.card h3 .ic { color: var(--accent); }
.page-head { margin-bottom: 20px; }
.section-title { margin: 28px 0 14px; }

/* ---------- Батырмалар ---------- */
.btn {
  font: inherit; font-size: 1.1rem; font-weight: 700; line-height: 1.2;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 60px; padding: 14px 24px; width: 100%;
  border: 2px solid transparent; border-radius: 16px;
  text-decoration: none; text-align: center; cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn .ic { width: 26px; height: 26px; }
.btn:active { transform: scale(.98); }
.btn:focus-visible, .side-nav a:focus-visible, .side-nav button:focus-visible, .bottom-nav a:focus-visible, .back-link:focus-visible {
  outline: 3px solid var(--ink); outline-offset: 3px;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(11, 30, 62, .28); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #fff; color: var(--accent-hover); border-color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-success { background: var(--ok); color: #fff; box-shadow: 0 6px 18px rgba(17, 112, 58, .26); }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--err); color: #fff; }
.btn-light { background: #fff; color: var(--hero-1); }
.btn-light:hover { background: #FFF1E3; }
.btn-xl { min-height: 68px; font-size: 1.2rem; }
.btn-sm { min-height: 48px; padding: 10px 18px; font-size: 1rem; width: auto; }
.btn[disabled] { opacity: .7; cursor: not-allowed; transform: none; }

.back-link {
  font: inherit; font-weight: 700; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 16px 0 10px; margin: -8px 0 8px -10px;
  background: none; border: 0; border-radius: 14px; cursor: pointer; text-decoration: none;
}
.back-link:hover { background: var(--surface-2); }

.spin {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Қадам белгісі ---------- */
.step-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 6px; margin-bottom: 14px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-hover); font-weight: 700;
}
.step-pill b { background: var(--accent); color: #fff; border-radius: 999px; padding: 3px 12px; font-weight: 800; }

.steps { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.steps li {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px; border-radius: var(--r); background: #fff; border: 2px solid var(--line);
  text-align: center; font-weight: 700; color: var(--ink-2);
}
.step-dot {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); font-weight: 800;
}
.steps li.done { border-color: #A9D8BA; color: var(--ok); }
.steps li.done .step-dot { background: var(--ok); color: #fff; }
.steps li.current { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }
.steps li.current .step-dot { background: var(--accent); color: #fff; }
@media (min-width: 600px) { .steps li { flex-direction: row; justify-content: center; gap: 12px; } }

/* ---------- Пішін (форма) ---------- */
.form { max-width: 600px; margin: 0 auto; }
.form .lead { margin-bottom: 22px; }
.field { margin-bottom: 22px; }
.field > label { display: block; font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.hint { margin: 0 0 8px; color: var(--muted); }
.input {
  font: inherit; font-size: 1.15rem; color: var(--ink);
  display: block; width: 100%; min-height: 60px; padding: 12px 16px;
  background: #fff; border: 2px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none; appearance: none;
}
textarea.input { min-height: 120px; line-height: 1.45; resize: vertical; }
.input::placeholder { color: #6B768C; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(11, 30, 62, .18); }
.select {
  padding-right: 52px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B1E3E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 24px;
}
.input-num { font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 86px; }
.counter {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 700; pointer-events: none; font-variant-numeric: tabular-nums;
}
.counter.full { color: var(--ok); }

.error { display: none; margin-top: 8px; color: var(--err); font-weight: 600; }
.field.invalid .input { border-color: var(--err); background-color: var(--err-soft); }
.field.invalid .error { display: flex; gap: 8px; align-items: flex-start; }
.field.invalid .error .ic { margin-top: 2px; }
.form-error {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px; margin-bottom: 18px; border-radius: var(--r-sm);
  background: var(--err-soft); color: var(--err); font-weight: 600;
}

.field > label.check, .check {
  display: flex; gap: 14px; align-items: center; cursor: pointer;
  font-weight: 600; padding: 14px; margin: 0; min-height: 64px;
  border: 2px solid var(--line-strong); border-radius: var(--r-sm); background: #fff;
}
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check .box {
  flex: none; width: 34px; height: 34px; border-radius: 9px;
  border: 2px solid var(--line-strong); background: #fff; color: transparent;
  display: grid; place-items: center; transition: background-color .15s ease;
}
.check input:checked + .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.check input:focus-visible + .box { outline: 3px solid var(--ink); outline-offset: 2px; }
.field.invalid .check { border-color: var(--err); background: var(--err-soft); }

/* ---------- Хабарлама жолақтары ---------- */
.alert {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px; border-radius: var(--r); font-weight: 600;
}
.alert .ic { width: 28px; height: 28px; }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-err { background: var(--err-soft); color: var(--err); }

.state { text-align: center; padding: 34px 22px; }
.state h1, .state h2 { margin-bottom: 10px; }
.state p { color: var(--ink-2); font-size: 1.1rem; }
.state .btn { margin-top: 24px; }
.state-icon {
  width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 20px;
  display: grid; place-items: center;
}
.state-icon .ic { width: 46px; height: 46px; }
.tone-accent { background: var(--accent-soft); color: var(--accent-hover); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-err { background: var(--err-soft); color: var(--err); }

/* ---------- Кітап мұқабасы (суретсіз, CSS арқылы) ---------- */
.cover {
  --c1: #8A3B12; --c2: #3F1A08;
  position: relative; width: 100%; aspect-ratio: 2 / 3; overflow: hidden;
  container-type: inline-size;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12% 10% 10% 16%;
  border-radius: 6px 14px 14px 6px; color: #fff;
  background: linear-gradient(155deg, var(--c1), var(--c2));
  box-shadow: 0 10px 24px rgba(40, 20, 5, .35), inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.cover::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8%;
  background: linear-gradient(90deg, rgba(0, 0, 0, .28), rgba(0, 0, 0, .05));
}
.cover::after {
  content: ""; position: absolute; right: -30%; bottom: -18%; width: 90%; aspect-ratio: 1;
  border-radius: 50%; background: rgba(255, 255, 255, .09);
}
.cover-author { position: relative; z-index: 1; font-size: 12px; font-size: 7.5cqw; font-weight: 600; opacity: .92; line-height: 1.2; }
.cover-title { position: relative; z-index: 1; font-size: 18px; font-size: 12.5cqw; font-weight: 800; line-height: 1.12; letter-spacing: -.01em; overflow-wrap: anywhere; }
.cover-line { position: relative; z-index: 1; width: 34%; height: 4px; border-radius: 4px; background: var(--accent-bright); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }

/* ---------- Басты бет ---------- */
.hero-book {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 18px; align-items: center;
  padding: 22px; border-radius: var(--r-lg); color: #fff;
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2));
  box-shadow: var(--sh-2);
}
.hero-book::after {
  content: ""; position: absolute; right: -70px; top: -70px; width: 220px; height: 220px;
  border-radius: 50%; background: rgba(255, 255, 255, .07); pointer-events: none;
}
.hero-label { font-weight: 700; color: #FFD9B5; font-size: .9rem; margin-bottom: 6px; }
.hero-book h2 { color: #fff; font-size: 1.35rem; overflow-wrap: anywhere; }
.hero-author { color: #F6E3D2; margin-top: 4px; }
.hero-status {
  grid-column: 1 / -1; display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-sm); background: rgba(255, 255, 255, .13); font-weight: 600;
}
.hero-book .btn { grid-column: 1 / -1; position: relative; z-index: 1; }
@media (min-width: 640px) {
  .hero-book { grid-template-columns: 150px minmax(0, 1fr); padding: 28px; gap: 24px; }
  .hero-book h2 { font-size: 1.6rem; }
}

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px; }
.book-tile { text-decoration: none; color: var(--ink); display: block; transition: transform .2s ease; }
.book-tile:hover { transform: translateY(-4px); }
.book-tile-title { font-weight: 700; margin-top: 12px; line-height: 1.25; }
.book-tile-author { color: var(--muted); font-size: .9rem; }

/* Қонаққа арналған бастапқы бет */
.welcome { max-width: 600px; margin: 0 auto; }
.logo-card {
  aspect-ratio: 2.3 / 1; max-width: 420px; margin: 0 auto 24px; overflow: hidden;
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.logo-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.welcome-art { display: flex; justify-content: center; align-items: flex-end; height: 190px; margin-bottom: 26px; }
.welcome-art .cover { width: 104px; flex: none; }
.welcome-art .cover:nth-child(1) { transform: rotate(-9deg) translate(22px, 10px); }
.welcome-art .cover:nth-child(2) { width: 122px; z-index: 2; }
.welcome-art .cover:nth-child(3) { transform: rotate(9deg) translate(-22px, 10px); }
.howto { list-style: none; margin: 22px 0 26px; padding: 0; display: grid; gap: 12px; }
.howto li {
  display: flex; gap: 16px; align-items: center;
  padding: 16px; border-radius: var(--r); background: #fff; box-shadow: var(--sh-1);
}
.howto .num {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; font-size: 1.2rem;
}
.howto b { display: block; font-size: 1.1rem; }
.howto span.txt { color: var(--ink-2); }

/* ---------- Кітап беті ---------- */
.book-detail { display: grid; gap: 22px; }
.book-cover-wrap { width: 190px; margin: 0 auto; }
.book-author { color: var(--ink-2); font-weight: 600; margin-top: 6px; font-size: 1.1rem; }
.book-desc { margin-top: 14px; color: var(--ink-2); white-space: pre-line; }
.actions { display: grid; gap: 14px; margin-top: 22px; }
@media (min-width: 700px) {
  .book-detail { grid-template-columns: 230px minmax(0, 1fr); gap: 30px; align-items: start; padding: 30px; }
  .book-cover-wrap { width: 100%; }
}

/* ---------- Нәтиже және рейтинг ---------- */
.score-card {
  text-align: center; color: #fff; padding: 30px 22px; border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); box-shadow: var(--sh-2);
}
.score-big { font-size: 4.2rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.score-cheer { font-size: 1.15rem; font-weight: 700; margin-top: 14px; }
.score-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 20px; }
.score-meta div { background: rgba(255, 255, 255, .14); border-radius: var(--r-sm); padding: 14px 8px; }
.score-meta b { display: block; font-size: 1.5rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 12px 0; align-items: center; }
.timeline li + li { border-top: 1px solid var(--line); }
.tl-dot {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted);
}
.timeline li.done .tl-dot { background: var(--ok); color: #fff; }
.tl-title { font-weight: 700; }
.tl-date { color: var(--muted); }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank-item {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: var(--r); background: #fff; box-shadow: var(--sh-1);
}
.rank-pos {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2); font-weight: 800;
}
.rank-item.top1 .rank-pos { background: #F2B417; color: #3A2A00; }
.rank-item.top2 .rank-pos { background: #C5CBD3; color: #23282E; }
.rank-item.top3 .rank-pos { background: #DB955C; color: #3A1E05; }
.rank-name { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.rank-wp { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.rank-score { font-weight: 800; font-size: 1.35rem; color: var(--accent-hover); white-space: nowrap; }

.mini-rank { list-style: none; margin: 0; padding: 0; }
.mini-rank li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; }
.mini-rank li + li { border-top: 1px solid var(--line); }
.mini-rank .pos { font-weight: 800; color: var(--accent-hover); }
.mini-rank .nm { font-weight: 600; font-size: .9rem; line-height: 1.25; overflow-wrap: anywhere; }
.mini-rank .sc { font-weight: 800; }

.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; }
.kv li + li { border-top: 1px solid var(--line); }
.kv b { text-align: right; }

/* ---------- Сұрау терезесі, хабарламалар ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; padding: 0;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(28, 23, 20, .6); animation: fade .18s ease both;
}
.modal {
  width: 100%; max-width: 520px; text-align: center;
  padding: 28px 22px calc(22px + env(safe-area-inset-bottom));
  background: #fff; border-radius: 26px 26px 0 0; box-shadow: var(--sh-2);
  animation: sheet .28s cubic-bezier(.2, .8, .2, 1) both;
}
.modal h2 { font-size: 1.45rem; }
.modal p { margin-top: 10px; color: var(--ink-2); font-size: 1.1rem; }
.modal-icon { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; }
.modal-icon .ic { width: 38px; height: 38px; }
.modal-actions { display: grid; gap: 12px; margin-top: 24px; }
.modal-backdrop.closing { opacity: 0; transition: opacity .18s ease; }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal { border-radius: 26px; padding: 32px; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast-box {
  position: fixed; top: 14px; left: 14px; right: 14px; z-index: 120;
  display: grid; gap: 10px; justify-items: center; pointer-events: none;
}
.toast {
  display: flex; gap: 12px; align-items: center; max-width: 520px;
  padding: 16px 20px; border-radius: 16px; font-weight: 700; color: #fff;
  background: var(--ok); box-shadow: var(--sh-2);
  animation: rise .3s ease both; transition: opacity .3s ease;
}
.toast.tone-err { background: var(--err); }
.toast.hide { opacity: 0; }

.net-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 110;
  display: flex; gap: 12px; align-items: center; justify-content: center;
  padding: 14px 16px; font-weight: 700; text-align: left;
  background: #FFE08A; color: #3D2A00; box-shadow: 0 4px 16px rgba(11, 30, 62, .2);
  transform: translateY(-110%); transition: transform .25s ease;
}
.net-banner.show { transform: none; }

/* ---------- Анимация ---------- */
.reveal { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.reveal:nth-child(2) { animation-delay: .06s; }
.reveal:nth-child(3) { animation-delay: .12s; }
.reveal:nth-child(4) { animation-delay: .18s; }
.reveal:nth-child(5) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.skeleton {
  border-radius: var(--r-lg); min-height: 180px;
  background: linear-gradient(100deg, #E6EAF1 30%, #F3F5F9 50%, #E6EAF1 70%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ==========================================================
   Әкімші панелі
   ========================================================== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 460px; }
.login-card .brand { margin-bottom: 22px; }

body.admin .main { max-width: none; }
@media (min-width: 900px) { body.admin .app { grid-template-columns: 260px minmax(0, 1fr); max-width: 1500px; } }

.admin-tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 12px;
  scrollbar-width: thin;
}
@media (min-width: 900px) { .admin-tabs { display: none; } }
.chip {
  font: inherit; font-weight: 700; font-size: .95rem; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 48px; padding: 0 16px; border-radius: 999px;
  background: #fff; color: var(--ink-2); border: 2px solid var(--line-strong); cursor: pointer;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.control-strip { display: grid; gap: 14px; margin-bottom: 24px; }
@media (min-width: 760px) { .control-strip { grid-template-columns: 1fr 1fr; } }
.toggle-card {
  display: flex; align-items: center; gap: 18px; padding: 20px;
  border-radius: var(--r-lg); border: 3px solid var(--line); background: #fff; box-shadow: var(--sh-1);
}
.toggle-card.on { border-color: var(--ok); background: var(--ok-soft); }
.toggle-card.off { border-color: #E3A9A3; background: #FFF6F5; }
.toggle-label { font-weight: 600; color: var(--ink-2); }
.toggle-state { font-size: 1.45rem; font-weight: 800; line-height: 1.15; }
.toggle-card.on .toggle-state { color: var(--ok); }
.toggle-card.off .toggle-state { color: var(--err); }
.toggle-note { font-size: .9rem; color: var(--warn); font-weight: 600; margin-top: 4px; }
.switch {
  position: relative; flex: none; width: 96px; height: 54px; padding: 0;
  border: 0; border-radius: 999px; background: #94887E; cursor: pointer; transition: background-color .2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 6px; left: 6px; width: 42px; height: 42px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .2s ease;
}
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { transform: translateX(42px); }
.switch:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.switch[disabled] { opacity: .6; cursor: wait; }

.head-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.kpi { background: #fff; border-radius: var(--r); padding: 18px; box-shadow: var(--sh-1); }
.kpi-value { font-size: 2.1rem; font-weight: 800; line-height: 1.1; color: var(--accent-hover); font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--ink-2); font-weight: 600; font-size: .95rem; margin-top: 4px; }
.kpi-sub { color: var(--muted); font-size: .85rem; }

.panel-grid { display: grid; gap: 18px; }
@media (min-width: 1100px) { .panel-grid { grid-template-columns: 1fr 1fr; } }
.funnel-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin: 14px 0; }
.funnel-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.funnel-head b { font-variant-numeric: tabular-nums; }
.bar { height: 26px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; min-width: 4px; border-radius: 8px; background: var(--accent); transition: width .5s ease; }
.bar.thin { height: 12px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--font); font-size: 12px; fill: #4A5670; }
.chart-svg .val { font-weight: 700; fill: #0B1E3E; }

.filters { display: grid; gap: 12px; margin-bottom: 14px; }
@media (min-width: 900px) { .filters { grid-template-columns: 2fr 1fr 1fr; } }
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--r); box-shadow: var(--sh-1); }
table.data { width: 100%; border-collapse: collapse; font-size: 16px; }
table.data th {
  background: #0B1E3E; color: #fff; text-align: left; padding: 12px 14px;
  font-weight: 700; white-space: nowrap;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:nth-child(even) td { background: #F8F9FC; }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.st-registered { background: #E4E8EF; color: #26344F; }
.st-reading { background: var(--info-soft); color: var(--info); }
.st-read { background: var(--warn-soft); color: var(--warn); }
.st-tested { background: var(--ok-soft); color: var(--ok); }

.book-edit { display: grid; gap: 4px; margin-bottom: 18px; }
.book-edit .field { margin-bottom: 14px; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
input[type="color"].input { padding: 6px; }

.qr-layout { display: grid; gap: 22px; }
@media (min-width: 900px) { .qr-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.qr-box { background: #fff; padding: 20px; border-radius: var(--r); border: 2px solid var(--line); display: grid; place-items: center; }
.qr-box img, .qr-box canvas { display: block; width: 100%; max-width: 280px; height: auto; }

/* ===== Кәсіби тақырып: қою көк + алтын, жоғарғы тақырып жолағы ===== */

body { background: var(--bg); }
h1 { letter-spacing: -.015em; }
.eyebrow {
  color: var(--gold-ink); text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700;
}
.section-title { display: flex; align-items: center; gap: 12px; }
.section-title::before { content: ""; width: 28px; height: 4px; border-radius: 2px; background: var(--gold); flex: none; }

/* ---------- Жоғарғы жолақ: логотиптер, мәзір ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: #fff; border-bottom: 3px solid var(--gold);
  box-shadow: 0 2px 12px rgba(11, 30, 62, .08);
}
.header-inner {
  display: flex; align-items: center; gap: 16px;
  max-width: 1240px; margin: 0 auto; padding: 8px 16px; min-height: 64px;
}
.logos { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.logo-kitap { position: relative; overflow: hidden; height: 38px; aspect-ratio: 810 / 330; flex: none; }
.logo-kitap img { position: absolute; width: 148%; height: auto; max-width: none; left: -23.5%; top: -79%; }
.logo-emg { height: 34px; width: auto; display: block; flex: none; }
.logo-sep { width: 1px; height: 34px; background: var(--line); flex: none; }

.top-nav { display: none; }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-name { display: none; font-weight: 700; }
.header-logout {
  display: none; font: inherit; font-weight: 600; font-size: .9rem; color: var(--ink-2);
  align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  background: #fff; border: 1.5px solid var(--line-strong); border-radius: 8px; cursor: pointer;
}
.header-logout:hover { background: var(--surface-2); }
.avatar { width: 42px; height: 42px; font-size: .95rem; background: var(--accent); }

@media (max-width: 420px) {
  .header-inner { gap: 10px; padding: 8px 12px; }
  .logos { gap: 9px; }
  .logo-kitap { height: 36px; }
  .logo-emg, .logo-sep { height: 32px; }
  .avatar { width: 38px; height: 38px; }
}

/* ---------- Қаңқа: мәзір жоғарыда, мазмұн ортада, қосымша карточкалар оң жақта ---------- */
.app { padding-top: 20px; }
@media (min-width: 900px) {
  .app { display: block; max-width: 1240px; padding: 28px 24px 40px; }
  .main { max-width: 760px; }
  .logo-kitap { height: 46px; }
  .logo-emg, .logo-sep { height: 40px; }
  .header-inner { min-height: 76px; padding: 10px 24px; gap: 24px; }
  .top-nav { display: flex; align-items: center; gap: 4px; margin-left: 12px; }
  .top-nav a {
    display: inline-flex; align-items: center; min-height: 48px; padding: 0 14px;
    color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem;
    border-bottom: 3px solid transparent; border-top: 3px solid transparent;
  }
  .top-nav a:hover { color: var(--accent); border-bottom-color: var(--line); }
  .top-nav a.active { color: var(--accent); font-weight: 700; border-bottom-color: var(--gold); }
  .top-nav a:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
  .header-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
  .header-logout { display: inline-flex; }
}
@media (min-width: 1100px) {
  .app { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
  .main { max-width: none; margin: 0; }
  .extras { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 108px; }
}
@media (min-width: 900px) and (max-width: 1199px) { .extras { display: none; } }
@media (min-width: 1100px) and (max-width: 1199px) { .extras { display: flex; } }

/* Төменгі мәзір (телефон) */
.bottom-nav { border-top: 1px solid var(--line); }
.bottom-nav a { border-radius: 10px; color: var(--muted); }
.bottom-nav a.active { color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 3px 0 var(--gold); }

/* ---------- Батырмалар ---------- */
.btn { border-radius: 10px; }
.btn-primary { box-shadow: 0 4px 14px rgba(11, 30, 62, .24); }
.btn-secondary { color: var(--accent); border-color: var(--accent); }
.btn-gold, .btn-light { background: var(--gold); color: var(--ink); border-color: var(--gold); box-shadow: 0 4px 14px rgba(0, 0, 0, .22); }
.btn-gold:hover, .btn-light:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .85); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .12); }
.hero .btn:focus-visible, .hero-book .btn:focus-visible { outline-color: #fff; }

/* ---------- Карточкалар ---------- */
.card { border: 1px solid var(--line); box-shadow: var(--sh-1); }
.card-soft { border: 1px solid #D5DDEC; }
.card h3 .ic { color: var(--gold-ink); }
.step-pill { border-radius: 8px; padding: 5px 14px 5px 5px; background: var(--accent-soft); color: var(--accent); }
.step-pill b { border-radius: 6px; background: var(--accent); }
.steps li { border-width: 1.5px; border-radius: var(--r); }
.steps li.current { border-color: var(--accent); background: #fff; color: var(--accent); box-shadow: inset 0 -4px 0 var(--gold); }
.steps li.current .step-dot { background: var(--accent); }

/* ---------- Бастапқы беттегі баннер ---------- */
.welcome { max-width: none; }
.hero {
  position: relative; overflow: hidden; color: #fff;
  padding: 30px 22px; border-radius: var(--r-lg);
  background:
    radial-gradient(520px 260px at 100% 0%, rgba(201, 168, 76, .28), transparent 62%),
    radial-gradient(420px 300px at 0% 100%, rgba(58, 104, 180, .38), transparent 60%),
    linear-gradient(135deg, var(--hero-1), var(--hero-2));
  box-shadow: var(--sh-2);
}
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
  background: linear-gradient(90deg, var(--gold), #E7D08C, var(--gold));
}
.hero-eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 700; margin-bottom: 10px; }
.hero h1 { color: #fff; font-size: 1.75rem; line-height: 1.18; }
.hero h1 span { color: var(--gold); display: block; }
.hero-lead { color: #DCE4F2; font-size: 1.1rem; margin-top: 12px; }
.hero-actions { display: grid; gap: 12px; margin-top: 24px; }
.hero .alert { margin-top: 18px; }
@media (min-width: 700px) {
  .hero { padding: 48px 44px; }
  .hero h1 { font-size: 2.5rem; }
  .hero-actions { grid-template-columns: repeat(2, minmax(0, 280px)); }
}
.howto { grid-template-columns: 1fr; }
.howto li { border: 1px solid var(--line); border-radius: var(--r); }
.howto .num { border-radius: 10px; background: var(--accent); color: var(--gold); }
@media (min-width: 900px) {
  .howto { grid-template-columns: repeat(3, 1fr); }
  .howto li { flex-direction: column; align-items: flex-start; padding: 22px; }
}

/* ---------- Қатысушының кітап карточкасы, нәтиже ---------- */
.hero-book, .score-card {
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(201, 168, 76, .26), transparent 62%),
    linear-gradient(135deg, var(--hero-1), var(--hero-2));
  border-bottom: 5px solid var(--gold);
}
.hero-book::after { display: none; }
.hero-label { color: var(--gold); text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.hero-author { color: #DCE4F2; }
.hero-status { border-radius: var(--r-sm); background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16); }
.score-big { color: var(--gold); }
.cover { border-radius: 4px 10px 10px 4px; }
.rank-score { color: var(--accent); }
.mini-rank .pos { color: var(--gold-ink); }
.rank-item { border: 1px solid var(--line); }
.modal { border-radius: 20px 20px 0 0; }
@media (min-width: 640px) { .modal { border-radius: 16px; } }
.toast { border-radius: 10px; }
.input { border-radius: 10px; }
.check { border-radius: 10px; }

/* ---------- Әкімші панелі ---------- */
body.admin .sidebar { background: var(--hero-1); color: #fff; border-radius: var(--r-lg); }
body.admin .sidebar .brand { color: #fff; }
body.admin .sidebar .brand-mark { background: var(--gold); color: var(--ink); }
body.admin .side-nav a, body.admin .side-nav button { color: #D5DDEC; }
body.admin .side-nav a:hover, body.admin .side-nav button:hover { background: rgba(255, 255, 255, .10); color: #fff; }
body.admin .side-nav a.active { background: rgba(201, 168, 76, .18); color: #fff; box-shadow: inset 4px 0 0 var(--gold); }
body.admin .side-nav a:focus-visible, body.admin .side-nav button:focus-visible { outline-color: #fff; }
@media (min-width: 900px) {
  body.admin .app { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; max-width: 1500px; padding: 24px; }
  body.admin .main { max-width: none; }
}
.kpi { border: 1px solid var(--line); border-top: 4px solid var(--gold); }
.kpi-value { color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); }
.login-logos { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.brand-mark { border-radius: 10px; }

/* ---------- Кітаптар жинағы (мұқабалар желпуіш сияқты) ---------- */
.collection {
  padding: 18px 18px 22px; border-radius: var(--r-lg); text-align: center;
  background: linear-gradient(180deg, #EEF1F7, #E4E9F2); border: 1px solid var(--line);
}
.collection-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .85rem; font-weight: 600; }
.collection-meta span { display: inline-flex; align-items: center; gap: 6px; }
.collection-meta .ic { width: 18px; height: 18px; color: var(--gold-ink); }
.collection h2 { margin-top: 10px; font-size: 1.3rem; }
.collection-sub { color: var(--muted); margin-top: 2px; }
.fan { position: relative; height: 230px; margin: 20px auto 22px; max-width: 360px; }
.fan-item {
  position: absolute; bottom: 0; left: 50%; width: 118px; margin-left: -59px;
  transition: transform .25s ease; display: block; text-decoration: none;
}
.fan-0 { transform: translateX(-74px) rotate(-9deg); transform-origin: bottom center; z-index: 1; }
.fan-1 { width: 136px; margin-left: -68px; z-index: 3; }
.fan-2 { transform: translateX(74px) rotate(9deg); transform-origin: bottom center; z-index: 2; }
a.fan-0:hover { transform: translateX(-80px) translateY(-8px) rotate(-11deg); }
a.fan-1:hover { transform: translateY(-10px); }
a.fan-2:hover { transform: translateX(80px) translateY(-8px) rotate(11deg); }
a.fan-item:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 8px; }
.fan-ghost .cover { box-shadow: 0 6px 16px rgba(11, 30, 62, .2); }
.fan-ghost .cover::after { background: rgba(255, 255, 255, .14); }
@media (min-width: 640px) {
  .fan { height: 270px; max-width: 420px; }
  .fan-item { width: 140px; margin-left: -70px; }
  .fan-1 { width: 160px; margin-left: -80px; }
  .fan-0 { transform: translateX(-92px) rotate(-9deg); }
  .fan-2 { transform: translateX(92px) rotate(9deg); }
  .collection .btn { width: auto; min-width: 280px; }
}
.collection-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; text-align: left; }
.collection-list a {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) 24px; gap: 14px; align-items: center;
  padding: 10px 14px; border-radius: var(--r); background: #fff; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; min-height: 72px;
}
.collection-list a:hover { border-color: var(--accent); }
.collection-list b { display: block; line-height: 1.25; }
.collection-list span span { color: var(--muted); font-size: .9rem; }
.cl-cover .cover { padding: 0; }
.cl-cover .cover > :not(img) { display: none; }

/* ---------- «Жоба туралы» блогы (Жарлық) ---------- */
.decree {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 16px; align-items: start;
  margin-top: 22px; padding: 22px 20px 22px 22px;
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--gold);
  border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.decree::after {
  content: "\201C"; position: absolute; right: 14px; top: -18px;
  font-family: Georgia, serif; font-size: 140px; line-height: 1; color: rgba(201, 168, 76, .16); pointer-events: none;
}
.decree-mark {
  width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent); color: var(--gold);
}
.decree-mark .ic { width: 28px; height: 28px; }
.decree-eyebrow { color: var(--gold-ink); text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; margin-bottom: 6px; }
.decree-text { position: relative; z-index: 1; color: var(--ink-2); line-height: 1.6; }
.decree-text b { color: var(--ink); font-weight: 700; }
@media (max-width: 420px) {
  .decree { grid-template-columns: 1fr; gap: 12px; padding: 20px 18px; }
}
@media (min-width: 700px) {
  .decree { padding: 26px 30px; gap: 22px; grid-template-columns: 60px minmax(0, 1fr); }
  .decree-mark { width: 60px; height: 60px; }
  .decree-text { font-size: 1.08rem; }
}

/* ---------- Беттің төменгі бөлігі: қосымша карточкалар және логотиптер ---------- */
.extras {
  display: grid !important; grid-template-columns: 1fr; gap: 16px;
  position: static !important; top: auto !important;
  margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--line);
}
.extras .card { margin: 0; }
.site-copy {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem;
}
.site-copy-logos { display: inline-flex; align-items: center; gap: 12px; }
.site-copy .logo-kitap { height: 32px; }
.site-copy .logo-emg, .site-copy .logo-sep { height: 28px; }
@media (min-width: 700px) { .extras { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) {
  body:not(.admin) .app { display: block; max-width: 1180px; }
  body:not(.admin) .main { max-width: none; margin: 0; }
}

/* ---------- Баннер: компьютерде мәтін сол жақта, мұқабалар оң жақта ---------- */
.hero-art { display: none; }
@media (min-width: 900px) {
  .hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center; padding: 52px 56px; }
  .hero h1 { font-size: 2.6rem; line-height: 1.12; }
  .hero h1 span { font-size: 2.1rem; margin-top: 8px; }
  .hero-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; }
  .hero-art { display: block; }
  .hero-art .fan { height: 290px; max-width: 420px; margin: 0 auto; }
  .hero-art .fan-item { width: 150px; margin-left: -75px; }
  .hero-art .fan-1 { width: 172px; margin-left: -86px; }
  .hero-art .fan-0 { transform: translateX(-100px) rotate(-10deg); }
  .hero-art .fan-2 { transform: translateX(100px) rotate(10deg); }
  .hero-art .cover { box-shadow: 0 18px 40px rgba(0, 0, 0, .45); }
}
@media (min-width: 1100px) { .hero h1 { font-size: 2.9rem; } .hero h1 span { font-size: 2.3rem; } }

/* ==========================================================
   EPUB оқу беті (read.html)
   ========================================================== */
body.reader-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: #E9EDF4; }
.reader-top {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top));
  background: #fff; border-bottom: 3px solid var(--gold); box-shadow: 0 2px 10px rgba(11, 30, 62, .08);
}
.reader-icon-btn {
  font: inherit; font-weight: 800; font-size: 1.05rem; color: var(--ink);
  flex: none; min-width: 52px; height: 52px; padding: 0 10px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 0; cursor: pointer; text-decoration: none;
}
.reader-icon-btn:hover { background: var(--accent-soft); }
.reader-icon-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.reader-icon-btn[disabled] { opacity: .45; cursor: not-allowed; }
.reader-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.reader-title b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-title span { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-font { display: flex; gap: 6px; }

.reader-main { flex: 1; min-height: 0; position: relative; padding: 10px 14px 10px 10px; perspective: 1800px; overflow: hidden; }
/* Кітап: астында бірнеше парақ жиегі көрінеді, сол жақта түптеменің көлеңкесі */
.reader-book { position: relative; height: 100%; max-width: 760px; margin: 0 auto; transform-style: preserve-3d; }
/* Аударылып жатқан беттің астындағы келесі парақ (қағаз түсі, жоларалық сызықтарсыз) */
.reader-book::before {
  content: ""; position: absolute; inset: 0; border-radius: 4px 12px 12px 4px;
  background: linear-gradient(90deg, #E9E4DA 0%, #FBF9F5 6%, #FBF9F5 100%);
  box-shadow: 3px 0 0 #DCD7CE, 6px 0 0 #D2CCC1, 9px 0 0 #C9C2B5, 0 8px 22px rgba(11, 30, 62, .14);
}
.reader-sheet {
  position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d;
  will-change: transform; border-radius: 4px 12px 12px 4px;
  box-shadow: 2px 0 0 #fff, 3px 0 0 #DCD7CE, 5px 0 0 #fff, 6px 0 0 #D2CCC1, 8px 0 0 #fff, 9px 0 0 #C9C2B5, 0 8px 22px rgba(11, 30, 62, .14);
}
.reader-viewer {
  position: relative; height: 100%; background: #fff;
  border-radius: 4px 12px 12px 4px; padding: 14px 10px 14px 16px; overflow: hidden;
}
.reader-viewer::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 14px; z-index: 2; pointer-events: none;
  background: linear-gradient(90deg, rgba(11, 30, 62, .14), rgba(11, 30, 62, 0));
}
.page-shade {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; border-radius: 4px 12px 12px 4px;
  background: linear-gradient(90deg, rgba(11, 30, 62, 0) 0%, rgba(11, 30, 62, .25) 55%, rgba(11, 30, 62, .55) 100%);
}
/* Аударылып жатқан беттің арқа жағы (қағаз түсі) */
.page-back {
  --shade: 0;
  display: none; position: absolute; inset: 0; transform-origin: left center; pointer-events: none;
  border-radius: 4px 12px 12px 4px; backface-visibility: visible;
  background:
    linear-gradient(90deg, rgba(11, 30, 62, calc(var(--shade) * 1)) 0%, rgba(11, 30, 62, 0) 70%),
    linear-gradient(90deg, #EFEAE1 0%, #FBF9F5 35%, #F4F0E8 100%);
  box-shadow: 0 8px 26px rgba(11, 30, 62, .22);
}
.reader-status {
  position: absolute; inset: 10px; z-index: 5; max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; text-align: center; background: #fff; border-radius: 12px; color: var(--ink-2); font-weight: 600;
}
.reader-status .spin { width: 34px; height: 34px; color: var(--accent); }
.reader-status.is-error .ic { width: 40px; height: 40px; color: var(--warn); }
.reader-status .btn { width: auto; min-width: 240px; }

.reader-bottom {
  flex: none; display: grid; gap: 10px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line);
}
.reader-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; font-weight: 700; color: var(--muted); font-size: .9rem; }
.reader-progress .bar > span { background: var(--gold); }
.reader-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reader-nav .btn { min-height: 56px; }
@media (min-width: 900px) {
  .reader-main { padding: 20px; }
  .reader-viewer { padding: 28px 36px 28px 42px; }
  .reader-bottom, .reader-top { padding-left: max(16px, calc(50% - 380px)); padding-right: max(16px, calc(50% - 380px)); }
}

/* ---------- Оқу беті: тек кітап (таза режим) ---------- */
.reader-mini-progress { display: none; position: fixed; left: 0; right: 0; bottom: 0; height: 4px; z-index: 20; background: rgba(11, 30, 62, .10); }
.reader-mini-progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s ease; }
/* Батырмалар әрқашан көрінеді: жоғарғы және төменгі жолақ мәтінді жаппайды */
#r-full .ic { width: 24px; height: 24px; }

/* ---------- Басты экранға қосу карточкасы ---------- */
.install-card .btn { width: 100%; margin-top: 14px; }
.install-steps { margin: 12px 0 0; padding-left: 22px; text-align: left; }
.install-steps li { margin: 6px 0; }

/* ---------- Оқу беті: көшіруден қорғау ---------- */
body.reader-page { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.watermark {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  border-radius: 4px 12px 12px 4px; background-repeat: repeat; background-position: 0 0;
}
.privacy-shield {
  display: none; position: absolute; inset: 10px; z-index: 6; max-width: 760px; margin: 0 auto;
  flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--hero-1); color: #fff; border-radius: 12px; font-weight: 700;
}
.privacy-shield .ic { width: 44px; height: 44px; color: var(--gold); }
body.shielded .reader-book { filter: blur(22px); }
body.shielded .privacy-shield { display: flex; }
@media print {
  body.reader-page > * { display: none !important; }
  body.reader-page::after { content: "Кітапты басып шығаруға болмайды."; display: block; padding: 40px; font: 700 20px/1.4 sans-serif; }
}

/* ---------- Бір кітаптың бірнеше мұқабасы ---------- */
.cover-pick-title { margin-top: 26px; font-size: 1.1rem; }
.cover-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px; margin-top: 14px; text-align: left; }
.cover-pick-item { display: block; border-radius: 8px; transition: transform .2s ease; }
.cover-pick-item:hover { transform: translateY(-4px); }
.cover-pick-item:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.cover-pick-item.is-current { outline: 3px solid var(--gold); outline-offset: 3px; }
@media (min-width: 640px) { .cover-pick { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 18px; } }

/* ---------- Әкімші панелі: ықшам, стандартты өлшемдер ---------- */
html:has(body.admin) { font-size: 14px; }
body.admin { line-height: 1.45; }
body.admin h1 { font-size: 1.55rem; }
body.admin h2 { font-size: 1.2rem; }
body.admin h3 { font-size: 1.05rem; }
body.admin .ic { width: 18px; height: 18px; }
body.admin .btn { min-height: 38px; padding: 7px 16px; font-size: .95rem; gap: 8px; border-radius: 8px; }
body.admin .btn .ic { width: 18px; height: 18px; }
body.admin .btn-xl { min-height: 44px; font-size: 1rem; }
body.admin .btn-sm { min-height: 34px; padding: 5px 12px; font-size: .9rem; }
body.admin .btn-primary { box-shadow: none; }
body.admin .input { min-height: 38px; padding: 7px 12px; font-size: 1rem; border-width: 1px; border-radius: 8px; }
body.admin textarea.input { min-height: 76px; }
body.admin .select { padding-right: 34px; background-position: right 10px center; background-size: 16px; }
body.admin .input:focus { box-shadow: 0 0 0 3px rgba(11, 30, 62, .15); }
body.admin .field { margin-bottom: 14px; }
body.admin .field > label { font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
body.admin .hint { font-size: .85rem; margin-bottom: 6px; }
body.admin .card { padding: 16px 18px; border-radius: 12px; }
body.admin .alert { padding: 10px 14px; gap: 10px; font-size: .95rem; font-weight: 500; border-radius: 10px; }
body.admin .alert .ic { width: 20px; height: 20px; }
body.admin .head-row { margin-bottom: 12px; }
body.admin .mt { margin-top: 14px; }
body.admin .chip { min-height: 34px; padding: 4px 12px; font-size: .9rem; }

body.admin .control-strip { gap: 10px; margin-bottom: 16px; }
body.admin .toggle-card { gap: 12px; padding: 10px 14px; border-width: 1px; border-radius: 12px; box-shadow: none; }
body.admin .toggle-label { font-size: .85rem; }
body.admin .toggle-state { font-size: 1.05rem; }
body.admin .toggle-note { font-size: .8rem; }
body.admin .switch { width: 48px; height: 28px; }
body.admin .switch::after { top: 3px; left: 3px; width: 22px; height: 22px; }
body.admin .switch[aria-checked="true"]::after { transform: translateX(20px); }

body.admin .kpis { gap: 10px; margin-bottom: 14px; }
body.admin .kpi { padding: 12px 14px; border-radius: 10px; border-top-width: 3px; }
body.admin .kpi-value { font-size: 1.6rem; }
body.admin .kpi-label { font-size: .85rem; }

body.admin .filters { gap: 10px; margin-bottom: 10px; }
body.admin .table-wrap { border-radius: 10px; border: 1px solid var(--line); box-shadow: none; }
body.admin table.data { font-size: 13.5px; }
body.admin table.data th { padding: 8px 10px; font-size: 12.5px; font-weight: 600; }
body.admin table.data td { padding: 7px 10px; vertical-align: middle; }
body.admin table.data tbody tr:hover td { background: #EEF2F8; }
body.admin .badge { padding: 2px 8px; font-size: 12px; }
body.admin .book-edit { margin-bottom: 12px; }
body.admin .book-edit .field { margin-bottom: 10px; }
body.admin .grid-2 { gap: 12px; }

body.admin .brand { font-size: .95rem; gap: 10px; }
body.admin .brand-mark { width: 34px; height: 34px; }
body.admin .side-inner { gap: 14px; }
body.admin .side-nav { gap: 2px; }
body.admin .side-nav a, body.admin .side-nav button { min-height: 38px; padding: 0 12px; gap: 10px; font-size: .95rem; font-weight: 500; border-radius: 8px; }
@media (min-width: 900px) {
  body.admin .app { grid-template-columns: 220px minmax(0, 1fr); gap: 20px; padding: 16px; }
  body.admin .sidebar { top: 16px; height: calc(100vh - 32px); padding: 16px 10px; border-radius: 14px; }
}

/* Қатысушылар тізімін жаю / жию */
.list-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.list-toggle .muted { font-size: .9rem; }
body.admin .check { padding: 8px 12px; gap: 10px; min-height: 0; border-width: 1px; border-radius: 8px; font-size: .95rem; width: auto; display: inline-flex; }
body.admin .check .box { width: 20px; height: 20px; border-radius: 5px; border-width: 1px; }
body.admin .check .box .ic { width: 14px; height: 14px; }
body.admin table.data td { white-space: nowrap; }

/* ---------- Негізгі платформа: стандартты өлшемдер ---------- */
body:not(.admin) .ic { width: 20px; height: 20px; }
body:not(.admin) .btn { min-height: 48px; padding: 10px 20px; font-size: 1rem; gap: 10px; }
body:not(.admin) .btn .ic { width: 20px; height: 20px; }
body:not(.admin) .btn-xl { min-height: 52px; font-size: 1.05rem; }
body:not(.admin) .btn-sm { min-height: 40px; padding: 8px 14px; font-size: .95rem; }
body:not(.admin) .input { min-height: 48px; padding: 10px 14px; font-size: 1rem; border-width: 1.5px; }
body:not(.admin) textarea.input { min-height: 100px; }
body:not(.admin) .select { padding-right: 42px; background-position: right 12px center; background-size: 18px; }
body:not(.admin) .field { margin-bottom: 18px; }
body:not(.admin) .field > label { font-size: .95rem; font-weight: 600; }
body:not(.admin) .hint { font-size: .9rem; }
body:not(.admin) .check { min-height: 52px; padding: 12px 14px; font-size: .95rem; }
body:not(.admin) .check .box { width: 24px; height: 24px; border-radius: 6px; }
body:not(.admin) .check .box .ic { width: 16px; height: 16px; }
body:not(.admin) .card { padding: 20px; }
body:not(.admin) .alert { padding: 12px 16px; gap: 12px; font-weight: 500; }
body:not(.admin) .alert .ic { width: 22px; height: 22px; }
body:not(.admin) .back-link { min-height: 44px; }
body:not(.admin) .side-nav a, body:not(.admin) .side-nav button { min-height: 44px; gap: 12px; }
body:not(.admin) .bottom-nav a { min-height: 58px; font-size: .8rem; }
body:not(.admin) .bottom-nav a .ic { width: 22px; height: 22px; }
body:not(.admin) .state-icon { width: 72px; height: 72px; }
body:not(.admin) .state-icon .ic { width: 36px; height: 36px; }
body:not(.admin) .modal-icon { width: 60px; height: 60px; }
body:not(.admin) .modal-icon .ic { width: 30px; height: 30px; }
body:not(.admin) .score-big { font-size: 3.4rem; }
body:not(.admin) .reader-nav .btn { min-height: 48px; }
body:not(.admin) .collection-list a { min-height: 60px; }
@media (min-width: 760px) { body:not(.admin) .hero .btn { white-space: nowrap; } }

/* ---------- «Кітап оқитын мұнайшы» марафон ережесі (ашылып-жиналатын) ---------- */
.rules { margin-top: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; }
.rules summary { list-style: none; cursor: pointer; }
.rules summary::-webkit-details-marker { display: none; }
.rules-head { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: start; padding: 18px; }
.rules-head:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; border-radius: var(--r-lg); }
.rules-mark { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--gold); }
.rules-mark .ic { width: 24px; height: 24px; }
.rules-titles { display: grid; gap: 4px; min-width: 0; }
.rules-eyebrow { color: var(--gold-ink); text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; }
.rules-title { font-size: 1.2rem; line-height: 1.25; color: var(--ink); }
.rules-sub { color: var(--ink-2); font-size: .92rem; line-height: 1.45; }
.rules-toggle {
  grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1.5px solid var(--accent);
  color: var(--accent); font-weight: 700; font-size: .95rem; background: #fff;
}
.rules-head:hover .rules-toggle { background: var(--accent-soft); }
.rules-toggle .ic { width: 18px; height: 18px; transition: transform .2s ease; }
.rules-main[open] .rules-toggle .ic { transform: rotate(180deg); }
.rules-main .when-open, .rules-main[open] .when-closed { display: none; }
.rules-main[open] .when-open { display: inline; }
.rules-content { border-top: 1px solid var(--line); padding: 8px 12px 14px; display: grid; gap: 8px; background: #FAFBFD; }

.rules-sec { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.rules-sec > summary { display: grid; grid-template-columns: 30px minmax(0, 1fr) 20px; gap: 10px; align-items: center; padding: 12px 14px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.rules-sec > summary:focus-visible { outline: 3px solid var(--ink); outline-offset: -2px; border-radius: 12px; }
.rules-sec > summary .ic { width: 18px; height: 18px; color: var(--muted); transition: transform .2s ease; }
.rules-sec[open] > summary .ic { transform: rotate(180deg); }
.rules-sec[open] > summary { border-bottom: 1px solid var(--line); }
.rules-num { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: .9rem; font-weight: 800; }
.rules-body { padding: 12px 16px 16px; display: grid; gap: 10px; color: var(--ink-2); font-size: .95rem; line-height: 1.6; }
.rules-body p, .rules-body ul { margin: 0; }
.rules-body h4 { margin: 6px 0 0; font-size: 1rem; color: var(--ink); }
.rules-pt { color: var(--accent); font-weight: 700; }
.rules-body ul { padding-left: 20px; display: grid; gap: 4px; }
.rules-body li::marker { color: var(--gold-ink); }
.rules-nom { font-weight: 700; color: var(--ink); margin-top: 4px !important; }
@media (min-width: 760px) {
  .rules-head { grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; padding: 22px 26px; gap: 18px; }
  .rules-mark { width: 56px; height: 56px; }
  .rules-toggle { grid-column: auto; justify-self: end; }
  .rules-content { padding: 12px 20px 20px; }
  .rules-title { font-size: 1.3rem; }
}
@media (max-width: 759px) {
  .rules-head { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 12px; }
  .rules-mark { display: none; }
}
