/* ePaper Portal — reader site */
:root {
  --brand: #c8102e;
  --hbg: #ffffff;
  --hink: #1a1d23;
  --fbg: #111827;
  --fink: #e5e7eb;
  --canvas: #eceef1;
  --surface: #ffffff;
  --ink: #1a1d23;
  --muted: #5e6571;
  --rule: #d8dce2;
  --shelf: #c9ced6;
  --stage: #dfe2e7;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Telugu", "Noto Sans Devanagari", "Nirmala UI", sans-serif;
  color-scheme: light;
}
html[data-theme="dark"] {
  --hbg: #1d2025;
  --hink: #e6e8eb;
  --canvas: #14161a;
  --surface: #1d2025;
  --ink: #e6e8eb;
  --muted: #a1a7b1;
  --rule: #30343b;
  --shelf: #3a3f47;
  --stage: #0f1114;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--ink); background: var(--canvas); }
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }
.ic { width: 22px; height: 22px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------- header */
.site-head { background: var(--hbg); color: var(--hink); border-bottom: 3px solid var(--brand); position: relative; z-index: 30; }
:root { --logo-h: 62px; --logo-hv: 44px; --logo-hm: 46px; --logo-hvm: 38px; } /* B · Medium (default) */
body.logo-large { --logo-h: 80px; --logo-hv: 52px; --logo-hm: 56px; --logo-hvm: 44px; }
body.logo-small { --logo-h: 44px; --logo-hv: 34px; --logo-hm: 34px; --logo-hvm: 30px; }
.head-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; min-height: max(64px, calc(var(--logo-h) + 16px)); }
.head-left, .head-right { display: flex; align-items: center; gap: 6px; }
.head-right { justify-content: flex-end; }
.logo { display: flex; justify-content: center; text-decoration: none; }
.logo { padding: 8px 0; }
.logo img { max-height: var(--logo-h); max-width: min(480px, 60vw); width: auto; display: block; }
.logo .logo-dark { display: none; }
html[data-theme="dark"] .logo.has-dark .logo-light { display: none; }
html[data-theme="dark"] .logo.has-dark .logo-dark { display: block; }
.logo-text { font-size: clamp(20px, 4vw, 30px); font-weight: 800; letter-spacing: -.01em; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 42px; height: 42px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 9%, transparent); }
.date-chip { font-size: 14px; color: color-mix(in srgb, var(--hink) 75%, transparent); white-space: nowrap; }
.date-pick { position: relative; }
.date-pick input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

/* section menu (desktop) */
.nav { border-top: 1px solid color-mix(in srgb, var(--hink) 12%, transparent); }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; flex-wrap: wrap; }
.nav li { position: relative; }
.nav-btn { display: flex; align-items: center; gap: 4px; padding: 11px 16px; background: none; border: 0; cursor: pointer; font-size: 15px; font-weight: 600; color: var(--hink); }
.nav-btn:hover, .nav li.open .nav-btn { color: var(--brand); }
.nav-btn svg { width: 14px; height: 14px; transition: transform .15s; }
.nav li.open .nav-btn svg { transform: rotate(180deg); }
.nav-menu {
  position: absolute; left: 50%; top: 100%; transform: translateX(-50%); min-width: 220px; max-height: 70vh; overflow-y: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(15, 20, 30, .16); padding: 6px; display: none; z-index: 40;
}
.nav li.open .nav-menu { display: block; }
.nav-menu a { display: block; padding: 9px 12px; border-radius: 6px; text-decoration: none; font-size: 15px; }
.nav-menu a:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand); }

/* drawer (mobile + "all sections") */
.drawer { position: fixed; inset: 0; z-index: 100; display: none; }
.drawer.open { display: block; }
.drawer-bg { position: absolute; inset: 0; background: rgba(10, 12, 16, .5); }
.drawer-panel {
  position: absolute; left: 0; top: 0; bottom: 0; width: min(330px, 88vw); background: var(--surface); color: var(--ink);
  display: flex; flex-direction: column; box-shadow: 8px 0 30px rgba(0, 0, 0, .25); animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--rule); }
.drawer-head b { font-size: 18px; }
.drawer-body { overflow-y: auto; padding: 8px 0 24px; -webkit-overflow-scrolling: touch; }
.drawer details { border-bottom: 1px solid var(--rule); }
.drawer summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary svg { width: 16px; height: 16px; transition: transform .15s; color: var(--muted); }
.drawer details[open] summary svg { transform: rotate(90deg); }
.drawer details a { display: block; padding: 10px 18px 10px 30px; text-decoration: none; color: var(--ink); }
.drawer details a:hover, .drawer details a.current { color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, transparent); }
.drawer-links { padding: 14px 18px; display: grid; gap: 4px; }
.drawer-links a { text-decoration: none; color: var(--muted); padding: 6px 0; }

/* ---------------------------------------------------------------- home */
.home-intro { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 22px 0 4px; }
.home-intro h1 { font-size: clamp(20px, 3vw, 26px); margin: 0; font-weight: 750; letter-spacing: -.01em; }
.home-intro p { margin: 0; color: var(--muted); }
.home-intro a { color: var(--brand); font-weight: 600; }
.rack-section { margin: 26px 0 8px; }
.rack-section h2 { font-size: 20px; margin: 0 0 4px; font-weight: 750; display: flex; align-items: center; gap: 10px; }
.rack-section h2::before { content: ""; width: 5px; height: 22px; border-radius: 3px; background: var(--brand); }
.rack {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 0 22px;
  padding: 18px 0 0; list-style: none; margin: 0;
}
.rack li { display: flex; flex-direction: column; padding-bottom: 26px; position: relative; }
/* the shelf line every row of papers stands on */
.rack li::after { content: ""; position: absolute; left: -11px; right: -11px; bottom: 14px; height: 6px; border-radius: 3px; background: var(--shelf); box-shadow: 0 3px 6px rgba(0, 0, 0, .08); }
.paper { display: block; text-decoration: none; color: inherit; }
.paper-sheet {
  aspect-ratio: 5 / 8; background: var(--surface); overflow: hidden; border-radius: 2px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 0 6px 14px rgba(20, 25, 35, .14);
  transform-origin: bottom center; transition: transform .2s ease, box-shadow .2s ease; position: relative; z-index: 1;
}
.paper:hover .paper-sheet, .paper:focus-visible .paper-sheet { transform: translateY(-6px); box-shadow: 0 2px 2px rgba(0, 0, 0, .08), 0 16px 28px rgba(20, 25, 35, .22); }
.paper-sheet img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.paper-sheet.blank { display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 14px; padding: 12px; background: repeating-linear-gradient(180deg, var(--surface) 0 14px, color-mix(in srgb, var(--rule) 55%, var(--surface)) 14px 15px); }
.paper-name { margin-top: 12px; font-weight: 700; font-size: 16px; line-height: 1.3; position: relative; z-index: 2; }
.paper-date { color: var(--muted); font-size: 13px; position: relative; z-index: 2; }
.empty-state { background: var(--surface); border-radius: var(--radius); padding: 40px 20px; text-align: center; margin: 30px 0; }
.empty-state h2 { margin: 0 0 6px; }
.empty-state p { color: var(--muted); margin: 0 0 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 8px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer;
}
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---------------------------------------------------------------- content pages */
.article { background: var(--surface); border-radius: var(--radius); padding: clamp(18px, 4vw, 40px); margin: 26px auto; max-width: 820px; line-height: 1.7; }
.article h1 { margin-top: 0; line-height: 1.25; font-size: clamp(24px, 4vw, 34px); }
.article a { color: var(--brand); }
.article table { border-collapse: collapse; width: 100%; }
.article td, .article th { border: 1px solid var(--rule); padding: 8px; }

/* ---------------------------------------------------------------- footer */
.site-foot { background: var(--fbg); color: var(--fink); margin-top: 40px; font-size: 14px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; padding-top: 32px; padding-bottom: 20px; }
.foot-grid img { max-height: 46px; width: auto; margin-bottom: 10px; }
.foot-name { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.foot-about { opacity: .8; max-width: 60ch; margin: 0; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; align-content: flex-start; justify-content: flex-end; }
.foot-links a { color: var(--fink); text-decoration: none; opacity: .9; }
.foot-links a:hover { text-decoration: underline; opacity: 1; }
.social { display: flex; gap: 8px; margin-top: 14px; }
.social a { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--fink) 12%, transparent); color: var(--fink); }
.social a:hover { background: var(--brand); color: #fff; }
.social svg { width: 18px; height: 18px; }
.foot-bottom { border-top: 1px solid color-mix(in srgb, var(--fink) 15%, transparent); padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); opacity: .8; text-align: center; }
.foot-bottom a { color: var(--fink); }

/* ---------------------------------------------------------------- viewer */
/* The viewer fills the screen exactly: header + toolbar + page area (no window scrolling). */
body.viewer-page { background: var(--stage); height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.viewer-page .site-foot { display: none; }
body.viewer-page .site-head, body.viewer-page .toolbar, body.viewer-page .draft-bar { flex: none; }
.viewer-head .head-row { min-height: max(56px, calc(var(--logo-hv) + 12px)); }
.viewer-head .logo { padding: 6px 0; }
.viewer-head .logo img { max-height: var(--logo-hv); }
.v-title { display: flex; flex-direction: column; line-height: 1.2; text-align: right; font-size: 13px; color: color-mix(in srgb, var(--hink) 75%, transparent); }
.v-title b { color: var(--hink); font-size: 14px; }

.toolbar {
  position: sticky; top: 0; z-index: 25; background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--rule);
  box-shadow: 0 2px 8px rgba(10, 15, 25, .06);
}
.toolbar-in { display: flex; align-items: center; gap: 2px; height: 52px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.toolbar-in::-webkit-scrollbar { display: none; }
.tb { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; min-width: 40px; padding: 0 9px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--ink); text-decoration: none; white-space: nowrap; flex: none; font-size: 14px; font-weight: 600; }
.tb:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.tb[disabled] { opacity: .35; cursor: default; background: none; }
.tb.on { color: var(--brand); }
.tb-crop { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.tb-crop:hover { background: color-mix(in srgb, var(--brand) 20%, transparent); }
.tb-crop.on { background: var(--brand); color: #fff; }
.tb .ic { width: 20px; height: 20px; }
.tb-sep { width: 1px; height: 26px; background: var(--rule); margin: 0 4px; flex: none; }
.tb-grow { flex: 1; min-width: 4px; }
.tb-select { position: relative; display: inline-flex; align-items: center; flex: none; }
.tb-select select { appearance: none; -webkit-appearance: none; height: 40px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; padding: 0 30px 0 12px; cursor: pointer; max-width: 210px; }
.tb-select svg { position: absolute; right: 9px; width: 14px; height: 14px; pointer-events: none; color: var(--muted); }
.zoom-val { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); min-width: 44px; text-align: center; flex: none; }

.v-body { display: flex; align-items: stretch; flex: 1; min-height: 0; }
.thumbs-side {
  width: 150px; flex: none; background: var(--surface); border-right: 1px solid var(--rule); overflow-y: auto;
  height: 100%; padding: 10px; scrollbar-width: thin;
}
.thumbs-side.closed { display: none; }
.th-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.th { display: block; border: 2px solid transparent; border-radius: 4px; padding: 3px; text-decoration: none; color: var(--muted); text-align: center; font-size: 12px; cursor: pointer; background: none; width: 100%; }
.th img { width: 100%; aspect-ratio: 5 / 8; object-fit: cover; object-position: top; background: var(--canvas); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.th span { display: block; margin-top: 4px; font-weight: 600; }
.th.active { border-color: var(--brand); color: var(--brand); }

.stage-wrap { flex: 1; min-width: 0; min-height: 0; position: relative; }
.stage {
  height: 100%; overflow: auto; position: relative;
  touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: thin;
}
.stage-inner { margin: 0 auto; padding: 16px; display: flex; justify-content: center; min-width: min-content; }
.sheet { position: relative; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 10px 30px rgba(0, 0, 0, .18); flex: none; }
.sheet img { width: 100%; height: 100%; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.sheet .lowres { position: absolute; inset: 0; filter: blur(2px); }
.sheet .hires { position: relative; opacity: 0; transition: opacity .2s; }
.sheet .hires.ready { opacity: 1; }
.loading { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, .65); color: #fff; padding: 8px 14px; border-radius: 99px; font-size: 13px; z-index: 3; pointer-events: none; }
.nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; width: 46px; height: 76px; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); display: grid; place-items: center;
}
.nav-arrow.prev { left: 0; border-radius: 0 10px 10px 0; }
.nav-arrow.next { right: 0; border-radius: 10px 0 0 10px; }
.nav-arrow[disabled] { display: none; }
.page-pill { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(15, 18, 24, .78); color: #fff; padding: 6px 14px; border-radius: 99px; font-size: 13px; z-index: 6; pointer-events: none; transition: opacity .3s; }
.draft-bar { background: #fffaeb; color: #93370d; text-align: center; padding: 8px 12px; font-size: 14px; font-weight: 600; }

/* popovers: calendar, share, download */
.pop { position: fixed; z-index: 120; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 18px 50px rgba(10, 15, 25, .25); padding: 12px; width: min(320px, calc(100vw - 24px)); }
.pop-title { font-weight: 700; margin: 2px 4px 10px; display: flex; justify-content: space-between; align-items: center; }
.pop-list { display: grid; gap: 2px; }
.pop-list a, .pop-list button { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 8px; text-decoration: none; border: 0; background: none; cursor: pointer; text-align: left; width: 100%; font-size: 15px; color: var(--ink); }
.pop-list a:hover, .pop-list button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pop-list svg { width: 22px; height: 22px; flex: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head b { font-size: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.cal-grid .dow { font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-grid button, .cal-grid span.day { height: 38px; border-radius: 8px; border: 0; background: none; font-size: 14px; display: grid; place-items: center; }
.cal-grid span.day { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.cal-grid button { cursor: pointer; font-weight: 700; color: var(--ink); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.cal-grid button:hover { background: color-mix(in srgb, var(--brand) 25%, transparent); }
.cal-grid button.sel { background: var(--brand); color: #fff; }
.cal-note { font-size: 12px; color: var(--muted); margin: 10px 4px 0; }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #111; color: #fff; padding: 10px 18px; border-radius: 99px; z-index: 200; font-size: 14px; }

/* fullscreen */
.viewer-page.is-fs .site-head, .viewer-page.is-fs .site-foot, .viewer-page.is-fs .thumbs-side { display: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .nav { display: none; }
  .thumbs-side { display: none; }
  .thumbs-side.mobile-open {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: auto !important; z-index: 60;
    border-right: 0; border-top: 1px solid var(--rule); box-shadow: 0 -8px 24px rgba(0, 0, 0, .2); padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }
  .thumbs-side.mobile-open .th-list { grid-auto-flow: column; grid-auto-columns: 74px; overflow-x: auto; gap: 8px; }
  .nav-arrow { width: 34px; height: 60px; opacity: .85; }
  .foot-grid { grid-template-columns: 1fr; }
  .foot-links { justify-content: flex-start; }
}
@media (max-width: 600px) {
  .head-row { grid-template-columns: auto 1fr auto; min-height: max(56px, calc(var(--logo-hm) + 16px)); gap: 4px; }
  .logo img { max-height: var(--logo-hm); max-width: 64vw; }
  body.logo-large .logo img { max-width: 72vw; }
  body.logo-small .logo img { max-width: 52vw; }
  .viewer-head .head-row { min-height: max(52px, calc(var(--logo-hvm) + 12px)); }
  .viewer-head .logo img { max-height: var(--logo-hvm); }
  .date-chip { display: none; }
  .rack { grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
  .rack li::after { left: -9px; right: -9px; }
  .stage-inner { padding: 8px; }
  .v-title { display: none; }
  .hide-sm { display: none !important; }
  .tb { min-width: 38px; padding: 0 7px; }
  .tb-select select { max-width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .site-head, .toolbar, .thumbs-side, .nav-arrow, .site-foot, .page-pill { display: none !important; }
  .stage { height: auto; overflow: visible; }
}

/* ---------------------------------------------------------------- crop mode (Prabha style) */
.head-crop {
  width: 46px; height: 46px; border-radius: 10px; border: 0; background: var(--brand); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; margin-left: 12px; flex: none;
}
.head-crop .ic { width: 24px; height: 24px; }
.head-crop.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
.crop-layer { position: absolute; inset: 0; z-index: 4; touch-action: none; cursor: crosshair; overflow: hidden; }
.crop-box { position: absolute; border: 2px solid #2563eb; box-shadow: 0 0 0 9999px rgba(15, 18, 25, .45); cursor: move; touch-action: none; }
.crop-box .h { position: absolute; width: 14px; height: 14px; background: #2563eb; border: 2px solid #fff; border-radius: 2px; touch-action: none; }
.crop-box .h::after { content: ""; position: absolute; inset: -14px; } /* bigger finger target */
.crop-box .h.nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-box .h.ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-box .h.sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-box .h.se { right: -8px; bottom: -8px; cursor: nwse-resize; width: 22px; height: 22px; right: -11px; bottom: -11px; }
.crop-box .h.n { left: calc(50% - 7px); top: -8px; cursor: ns-resize; }
.crop-box .h.s { left: calc(50% - 7px); bottom: -8px; cursor: ns-resize; }
.crop-box .h.w { top: calc(50% - 7px); left: -8px; cursor: ew-resize; }
.crop-box .h.e { top: calc(50% - 7px); right: -8px; cursor: ew-resize; }
.crop-layer.dragging .crop-bar { opacity: 0; pointer-events: none; }
.crop-bar { position: absolute; z-index: 2; display: flex; gap: 8px; padding: 5px; background: #fff; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.28); transition: opacity .12s; cursor: default; }
.crop-bar button { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 20px; border: 0; border-radius: 999px; color: #fff; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.crop-bar button svg { width: 18px; height: 18px; }
.cb-share { background: #16a34a; }
.cb-cancel { background: #dc2626; }
.crop-bar.busy .cb-share { opacity: .6; pointer-events: none; }
.crop-bar.busy .cb-share span::after { content: "…"; }

/* Clip preview: image + [Download Image] [Share] */
.clip-modal { position: fixed; inset: 0; z-index: 95; display: flex; align-items: center; justify-content: center; padding: 16px; }
.cm-bg { position: absolute; inset: 0; background: rgba(10, 12, 16, .6); }
.cm-box { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; gap: 14px; background: #fff; color: #1a1d23; border-radius: 14px; padding: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.cm-card { position: relative; border: 1px solid #d8dce2; border-radius: 8px; padding: 10px; min-height: 0; overflow: auto; flex: 1 1 auto; }
.cm-img img { display: block; width: 100%; height: auto; }
.cm-close { position: absolute; top: -12px; right: -12px; z-index: 1; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); color: #1a1d23; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.cm-close svg { width: 20px; height: 20px; }
.cm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-top: 1px solid #e5e7eb; padding-top: 14px; flex: none; }
.cm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 8px 14px; border: 0; border-radius: 8px; color: #fff; font: inherit; font-size: 17px; font-weight: 700; text-decoration: none; cursor: pointer; }
.cm-btn svg { width: 22px; height: 22px; flex: none; }
.cm-dl { background: #2563eb; }
.cm-share { background: #15803d; }
.cm-more { display: flex; justify-content: center; gap: 12px; flex: none; }
.cm-more a, .cm-more button { width: 46px; height: 46px; border-radius: 50%; border: 1px solid #d8dce2; background: #fff; color: #1a1d23; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cm-more svg { width: 24px; height: 24px; }
body.modal-open { overflow: hidden; }
body.cropping .nav-arrow, body.cropping .page-pill { display: none; }
@media (max-width: 600px) {
  .crop-bar button { height: 42px; padding: 0 16px; font-size: 15px; }
  .cm-btn { font-size: 16px; }
  .head-crop { width: 42px; height: 42px; margin-left: 0; }
}

/* ---------------------------------------------------------------- ads */
.ad-slot { margin: 22px 0; text-align: center; overflow: hidden; }
.ad-slot:empty { display: none; }
.ad-viewer { flex: none; position: relative; background: var(--surface); border-top: 1px solid var(--rule); text-align: center; padding: 6px 34px calc(6px + env(safe-area-inset-bottom)); max-height: 120px; overflow: hidden; }
.ad-viewer-in { display: flex; justify-content: center; }
.ad-close { position: absolute; top: 4px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; z-index: 2; }
body.is-fs .ad-viewer { display: none; }

/* ------------------------------------------------------------ Editor's picks */
.picks { margin: 18px 0 22px; }
.picks-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.picks-head h2 { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: 19px; }
.picks-head h2 .ic { width: 20px; height: 20px; color: var(--brand); }
.picks-head p { margin: 0; color: var(--muted); font-size: 14px; }
.picks-row { list-style: none; margin: 0; padding: 2px 2px 10px; display: grid; grid-auto-flow: column; grid-auto-columns: 210px; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.picks-row li { scroll-snap-align: start; min-width: 0; }
.pick { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.pick:hover, .pick:focus-visible { box-shadow: 0 6px 18px rgba(0,0,0,.12); transform: translateY(-2px); outline: none; }
.pick:focus-visible { border-color: var(--brand); }
.pick-img { display: block; aspect-ratio: 4 / 3; background: #fff; overflow: hidden; border-bottom: 1px solid var(--rule); }
.pick-img img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.pick-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding: 9px 11px 0; font-weight: 700; font-size: 14.5px; line-height: 1.35; }
.pick-meta { display: block; padding: 6px 11px 10px; margin-top: auto; color: var(--muted); font-size: 12.5px; }
@media (max-width: 640px) {
  .picks-row { grid-auto-columns: 62%; gap: 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scroll-padding: 0 16px; }
}

/* Viewer toolbar button + panel */
.tb-picks { color: var(--brand); }
.tb-picks b { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.picks-panel { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.picks-panel[hidden] { display: none; }
.picks-panel-bg { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.picks-panel-box { position: relative; width: min(960px, 100%); max-height: 80dvh; overflow: auto; background: var(--surface); color: var(--ink); border-radius: 14px 14px 0 0; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
.picks-panel-box .picks { margin: 0; }
.picks-panel-box .picks-head h2 { display: none; }
@media (min-width: 900px) { .picks-panel { align-items: center; } .picks-panel-box { border-radius: 14px; } }

/* Lightbox */
.pick-box { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pick-box-bg { position: absolute; inset: 0; background: rgba(10,12,16,.78); }
.pick-box-in { position: relative; width: min(620px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); color: var(--ink); border-radius: 12px; padding: 18px 18px 16px; box-shadow: 0 20px 50px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 10px; }
.pick-box-in h3 { margin: 0 34px 0 0; font-size: 18px; line-height: 1.35; }
.pick-box-in .pick-meta { padding: 0; margin: 0; }
.pick-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pick-close .ic, .pick-close svg { width: 18px; height: 18px; }
.pick-image { background: #fff; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.pick-image img { display: block; width: 100%; height: auto; }
.pick-share { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pick-share a, .pick-share button { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.pick-share a:hover, .pick-share button:hover { border-color: var(--brand); }
.pick-share svg { width: 24px; height: 24px; }
.pick-read { align-self: center; }
@media (max-width: 640px) {
  .pick-box { padding: 0; align-items: flex-end; }
  .pick-box-in { border-radius: 14px 14px 0 0; max-height: 92dvh; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
html[data-theme="dark"] .pick:hover { box-shadow: 0 6px 18px rgba(0,0,0,.5); }
