:root {
  --blue: #2b6cb0;
  --blue-dk: #1a365d;
  --blue-lt: #ebf5ff;
  --sky: #d6ebf8;
  --gold: #d4a017;
  --gold-lt: #f6e7b2;
  --gold-btn: #e8b923;
  --green: #2f855a;
  --purple: #6b46c1;
  --white: #ffffff;
  --ink: #1a202c;
  --muted: #4a5568;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 8px 28px rgba(26, 54, 93, .08);
  --font: 'Manrope', system-ui, sans-serif;
  --hand: 'Caveat', cursive;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  background: linear-gradient(180deg, #f0f7fc 0%, #ffffff 40%, #eaf4fb 100%);
  min-height: 100vh; line-height: 1.55;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; }
.wrap { width: min(1120px, 100% - 2rem); margin-inline: auto; }
.hand { font-family: var(--hand); font-weight: 700; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid #d9e8f5; box-shadow: 0 2px 12px rgba(43,108,176,.06);
}
.header-in { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; }
.brand { display: flex; align-items: center; gap: .65rem; color: inherit; min-width: 0; }
.brand-logo { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,.1); background: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 1.55rem; color: var(--blue-dk); }
.brand-text small { color: var(--muted); font-size: .78rem; }
.burger { display: none; border: 0; background: var(--blue-lt); color: var(--blue-dk); font-size: 1.3rem; width: 42px; height: 42px; border-radius: 12px; cursor: pointer; margin-left: auto; }
.nav { display: flex; align-items: center; gap: .35rem; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.nav a {
  padding: .45rem .75rem; border-radius: 999px; color: var(--blue-dk); font-weight: 600; font-size: .9rem;
  white-space: nowrap;
}
.nav a.active, .nav a:hover { background: var(--sky); }
.login-btn { background: var(--blue) !important; color: #fff !important; }
.login-btn:hover { filter: brightness(1.05); }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 1.5rem; align-items: center;
  margin: 1.25rem 0 1.75rem; padding: 1.25rem; background: #fff; border-radius: 28px;
  box-shadow: var(--shadow); border: 1px solid #e2eef8; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: auto -40px -40px auto; width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(232,185,35,.25), transparent 70%); pointer-events: none;
}
.hero-copy h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); color: var(--blue-dk); margin: 0 0 .4rem; line-height: 1.05; }
.hero-copy .heart { color: var(--gold); }
.hero-copy .lead { font-size: 1.15rem; font-weight: 700; color: var(--blue); margin: 0 0 .6rem; }
.hero-copy p { margin: 0 0 1.1rem; color: var(--muted); }
.hero-photo {
  border-radius: 22px; overflow: hidden; position: relative; min-height: 240px;
  box-shadow: 0 10px 30px rgba(26,54,93,.12);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; min-height: 240px; }
.hero-photo .caption {
  position: absolute; right: .75rem; bottom: .75rem; color: #fff; font-family: var(--hand);
  font-size: 1.35rem; text-shadow: 0 2px 8px rgba(0,0,0,.45); line-height: 1.15; text-align: right;
}

.btn {
  display: inline-flex; align-items: center; gap: .4rem; border: 0; cursor: pointer;
  padding: .75rem 1.25rem; border-radius: 999px; font-weight: 700; font-size: .95rem;
  font-family: inherit; transition: .15s transform, .15s filter;
}
.btn:active { transform: scale(.98); }
.btn-gold { background: linear-gradient(180deg, #f0c93a, var(--gold-btn)); color: var(--blue-dk); box-shadow: 0 6px 16px rgba(212,160,23,.35); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-outline { background: #fff; border: 2px solid var(--blue); color: var(--blue); }
.btn-sm { padding: .45rem .85rem; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Cards / sections */
.section { margin: 1.5rem 0 2rem; }
.section-h { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.section-h h2 { margin: 0; font-size: 1.45rem; color: var(--blue-dk); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow); border: 1px solid #e4eef7;
}
.card.blue { border-top: 5px solid var(--blue); }
.card.gold { border-top: 5px solid var(--gold); }
.card.green { border-top: 5px solid var(--green); }
.card.purple { border-top: 5px solid var(--purple); }
.card h3 { margin: 0 0 .6rem; display: flex; align-items: center; gap: .45rem; color: var(--blue-dk); }
.card ol { margin: 0; padding-left: 1.2rem; }
.card ol li { margin: .35rem 0; }

/* Quotes */
.quotes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.5rem 0;
  position: relative;
}
.quote {
  background: linear-gradient(135deg, #fff, var(--blue-lt));
  border-radius: var(--radius); padding: 1.25rem 1.4rem; border: 1px solid #d7e8f6;
  position: relative;
}
.quote::before { content: '“'; font-size: 3rem; color: #e8a317; line-height: 1; position: absolute; top: .4rem; left: .8rem; font-family: Georgia, serif; opacity: .85; }
.quote p { margin: .5rem 0 .4rem 1.4rem; font-size: 1.05rem; font-weight: 600; color: var(--blue-dk); }
.quote cite { display: block; text-align: right; color: var(--muted); font-style: normal; font-weight: 600; font-size: .9rem; }

/* Timeline */
.timeline {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; margin: 1rem 0;
}
.tl-item {
  background: #fff; border-radius: 16px; padding: 1rem; border: 1px solid #dceaf6;
  box-shadow: var(--shadow); position: relative;
}
.tl-item .n {
  width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: #fff;
  display: grid; place-items: center; font-weight: 800; margin-bottom: .5rem;
}
.tl-item b { display: block; color: var(--blue-dk); margin-bottom: .25rem; }
.tl-item span { color: var(--muted); font-size: .92rem; }

/* Criteria table */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid #d5e5f3; background: #fff; }
table.criteria { width: 100%; border-collapse: collapse; min-width: 560px; }
table.criteria th, table.criteria td { padding: .75rem .85rem; border-bottom: 1px solid #e2eef8; text-align: left; vertical-align: top; }
table.criteria th { background: var(--blue); color: #fff; font-weight: 700; }
table.criteria tr:last-child td { border-bottom: 0; }
table.criteria td.pts { text-align: center; font-weight: 800; color: var(--blue); width: 70px; }
table.criteria tfoot td { background: var(--gold-lt); font-weight: 800; }

/* Books */
.month-block { margin-bottom: 1rem; }
.month-block h3 {
  margin: 0 0 .6rem; padding: .4rem .8rem; display: inline-block;
  background: var(--sky); color: var(--blue-dk); border-radius: 999px; font-size: 1rem;
}
.book-list { display: grid; gap: .5rem; }
.book-item {
  display: flex; gap: .75rem; align-items: center; background: #fff; border: 1px solid #e2eef8;
  border-radius: 12px; padding: .7rem .9rem;
}
.book-item .ic { font-size: 1.4rem; }
.empty {
  text-align: center; padding: 2rem 1rem; background: #fff; border: 2px dashed #b7d4ea;
  border-radius: var(--radius); color: var(--muted);
}

/* Forms */
.form { display: grid; gap: .85rem; max-width: 420px; }
.form.wide { max-width: 640px; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; color: var(--blue-dk); }
input, select, textarea {
  font: inherit; padding: .7rem .85rem; border-radius: 12px; border: 1.5px solid #c5d9ea;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(43,108,176,.35); border-color: var(--blue); }
.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; }
.tabs button {
  flex: 1; border: 0; background: var(--blue-lt); color: var(--blue-dk); font-weight: 700;
  padding: .65rem; border-radius: 12px; cursor: pointer; font-family: inherit;
}
.tabs button.on { background: var(--blue); color: #fff; }
.auth-card { max-width: 440px; margin: 1.5rem auto; }

/* Upload */
.upload-box {
  border: 2px dashed var(--blue); border-radius: 18px; padding: 1.25rem; background: #f7fbff;
  text-align: center;
}
.upload-box input[type=file] { display: none; }
.progress {
  height: 12px; background: #dbeaf7; border-radius: 999px; overflow: hidden; margin-top: .75rem;
}
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), #48bb78); transition: width .2s; }
.hint { font-size: .88rem; color: var(--muted); text-align: left; margin-top: .75rem; }
.hint ul { margin: .3rem 0 0; padding-left: 1.1rem; }

/* Rating */
.rating-row {
  display: grid; grid-template-columns: 48px 1fr auto; gap: .75rem; align-items: center;
  background: #fff; border: 1px solid #e2eef8; border-radius: 14px; padding: .7rem .9rem; margin-bottom: .5rem;
}
.rating-row .rank {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-lt); color: var(--blue-dk); font-weight: 800;
}
.rating-row .rank.top { background: var(--gold); color: #fff; }
.score { font-weight: 800; color: var(--blue); font-size: 1.15rem; }

/* Expert / admin panels */
.video-card {
  display: grid; gap: .75rem; background: #fff; border: 1px solid #e2eef8;
  border-radius: 16px; padding: 1rem; margin-bottom: .75rem;
}
.score-grid { display: grid; grid-template-columns: 1fr 80px; gap: .5rem; align-items: center; }
.score-grid input[type=number] { width: 100%; }
.feedback {
  background: var(--blue-lt); border-radius: 12px; padding: .85rem; margin-top: .5rem;
}
.admin-grid { display: grid; gap: 1rem; }
.admin-grid .card h3 { margin-bottom: .85rem; }

/* Leaves decoration */
.leaves {
  display: flex; gap: .35rem; justify-content: center; margin: .5rem 0 0; opacity: .85;
}
.leaf {
  width: 14px; height: 28px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(180deg, #7ec8e3, #2b6cb0); transform: rotate(-25deg);
}
.leaf.g { background: linear-gradient(180deg, #f0d56a, #d4a017); transform: rotate(20deg); }

/* Footer */
.footer { margin-top: 3rem; background: linear-gradient(180deg, transparent, #d6ebf8); padding-top: 1rem; }
.footer-in { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem 0 1rem; flex-wrap: wrap; }
.skyline {
  height: 48px;
  background: linear-gradient(180deg, transparent, rgba(43,108,176,.15)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 60'%3E%3Cpath fill='%232b6cb0' opacity='.35' d='M0 60 V40 H40 V20 H60 V40 H100 V25 H120 V40 H160 V10 H175 V40 H220 V28 H250 V40 H300 V15 H320 V40 H380 V22 H420 V40 H480 V8 H500 V40 H560 V30 H600 V40 H650 V18 H670 V40 H720 V26 H760 V40 H800 V60Z'/%3E%3C/svg%3E")
    center bottom / cover no-repeat;
}

.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  background: var(--blue-dk); color: #fff; padding: .75rem 1.2rem; border-radius: 999px;
  z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: min(92vw, 420px); text-align: center;
}

@media (max-width: 860px) {
  .hero, .grid2, .grid3, .quotes, .timeline { grid-template-columns: 1fr; }
  .burger { display: inline-grid; place-items: center; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; border-bottom: 1px solid #d9e8f5; padding: .75rem 1rem 1rem;
    flex-direction: column; align-items: stretch; box-shadow: 0 12px 24px rgba(0,0,0,.08);
  }
  body.menu-open .nav { display: flex; }
  .nav a { padding: .7rem .85rem; }
}

/* Current month highlight */
.month-block.current {
  background: linear-gradient(180deg, #fff8e1, #ffffff);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(212,160,23,.2);
}
.month-block.current h3 {
  background: var(--gold);
  color: var(--blue-dk);
}
.month-block.current .badge-now {
  display: inline-block; margin-left: .4rem; font-size: .75rem;
  background: var(--blue); color: #fff; padding: .15rem .5rem; border-radius: 999px;
  font-weight: 700; font-family: var(--font);
}
.book-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-left: auto; }
.book-item { flex-wrap: wrap; }
.book-item .meta { flex: 1; min-width: 140px; }

.tip-box { border-left: 4px solid var(--gold, #c9a227); background: #fffbeb; }
.tip-kaz { margin: 0 0 .75rem; color: #744210; line-height: 1.45; }

.album-grid { display: grid; gap: 14px; margin-top: 12px; }
@media (min-width: 800px) { .album-grid { grid-template-columns: 1fr 1fr; } }
.album-card .vid-frame { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 12px; background: #111; margin-top: 8px; }
.album-card .vid-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.fb-list { margin: 8px 0 0; padding-left: 18px; }
.admin-album-tools { border: 1px dashed var(--accent, #c45c26); }
.chip.on { background: var(--accent, #c45c26); color: #fff; }

/* ---- In-site PDF reader ---- */
body.reader-mode { overflow: hidden; }
body.reader-mode .header,
body.reader-mode .footer { display: none !important; }
body.reader-mode #app.wrap { max-width: none; padding: 0; margin: 0; width: 100%; }
#readerRoot.reader-open {
  position: fixed; inset: 0; z-index: 2000; background: #1a1a1a; color: #f5f5f5;
  display: flex; flex-direction: column;
}
.reader-shell { display: flex; flex-direction: column; height: 100%; height: 100dvh; }
.reader-top, .reader-toolbar, .reader-bottom {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: #111; border-bottom: 1px solid #333; flex-shrink: 0;
}
.reader-bottom { border-bottom: 0; border-top: 1px solid #333; justify-content: space-between; font-size: .9rem; }
.reader-title { flex: 1; font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-btn {
  appearance: none; border: 0; background: #2a2a2a; color: #fff;
  width: 40px; height: 40px; border-radius: 10px; font-size: 1.25rem; cursor: pointer;
}
.reader-btn:active { background: #444; }
.reader-page-jump { display: flex; align-items: center; gap: 6px; font-size: .9rem; margin: 0 auto; }
.reader-page-jump input {
  width: 4.2rem; padding: 6px 8px; border-radius: 8px; border: 1px solid #444;
  background: #222; color: #fff; text-align: center;
}
.reader-status { padding: 4px 12px; font-size: .85rem; color: #bbb; min-height: 1.4em; }
.reader-status.done { color: #6dcea2; font-weight: 700; }
.reader-stage {
  flex: 1; overflow: auto; -webkit-overflow-scrolling: touch;
  padding: 8px; scroll-snap-type: y proximity; background: #1a1a1a;
}
.reader-page {
  position: relative; margin: 0 auto 12px; background: #2a2a2a;
  border-radius: 6px; overflow: hidden; min-height: 120px;
  display: flex; justify-content: center; scroll-snap-align: start;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.reader-page canvas { display: block; max-width: 100%; height: auto; background: #fff; }
.reader-page-num {
  position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.55);
  color: #fff; font-size: .75rem; padding: 2px 8px; border-radius: 999px;
}
.book-progress {
  margin-top: 6px; background: #e8e0d4; border-radius: 999px; height: 8px; overflow: hidden;
}
.book-progress > i { display: block; height: 100%; background: linear-gradient(90deg,#c45c26,#e8a87c); width: 0; }
.book-progress-label { font-size: .85rem; margin-top: 4px; color: #5a5248; }
.book-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill.done-read { background: #d8f3e4; color: #1f6b45; }
.admin-read-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-read-table th, .admin-read-table td { border-bottom: 1px solid #e5ddd0; padding: 6px 8px; text-align: left; }
.admin-read-table th { background: #f7f1e8; position: sticky; top: 0; }
