:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-alt: #efece6;
  --text: #141821;
  --muted: #666c78;
  --border: rgba(20, 24, 33, 0.08);
  --purple: #6d4aff;
  --dark-bar: #141821;
  --radius: 16px;
}

body.theme-sepia {
  --bg: #f5ede0;
  --surface: #fbf7ef;
  --surface-alt: #ebe0ce;
  --text: #2c241b;
  --muted: #6e5f4f;
  --border: rgba(44, 36, 27, 0.1);
}

body.theme-dark {
  --bg: #0c0f15;
  --surface: #151923;
  --surface-alt: #1f2433;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 84px;
}

a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.wrap {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 28px;
}

/* Full-bleed photographic Hero Zone (exact match to design reference) */
.hero-backdrop-zone {
  background-color: var(--bg);
  background-size: cover;
  background-position: right center;
  background-repeat: no-repeat;
  padding-bottom: 26px;
}

/* Top Bar */
.top-bar {
  position: relative;
  z-index: 45;
  background: transparent;
}

body.reader-page .top-bar {
  position: sticky;
  top: 0;
  background: rgba(247, 245, 240, 0.88);
  backdrop-filter: blur(18px);
}

body.theme-dark.reader-page .top-bar { background: rgba(12, 15, 21, 0.88); }

.top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 74px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo-wrap {
  width: 42px;
  height: 36px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(20, 24, 33, 0.08);
  box-shadow: 0 2px 8px rgba(36, 87, 198, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}

.brand-whale-img {
  width: 100%;
  height: auto;
  display: block;
}

.brand-stack { display: flex; flex-direction: column; line-height: 1.05; }
.brand-stack strong { font-size: 1.08rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-stack small { font-size: 0.7rem; color: var(--muted); font-weight: 500; }

.top-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.top-link {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.top-link-btn { background: none; border: none; cursor: pointer; font-family: inherit; }
.top-link:hover { color: var(--text); }
.top-link.active { background: rgba(255, 255, 255, 0.9); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }

.top-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.top-search {
  position: relative;
  width: 240px;
}

.top-search-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: inline-flex;
}

.top-search input {
  width: 100%;
  padding: 8px 14px 8px 34px;
  border-radius: 999px;
  border: 1px solid rgba(20, 24, 33, 0.08);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 0.84rem;
  outline: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

/* Compact Language Pill Dropdown (like PL pill on reference) */
.lang-dd { position: relative; }

.lang-dd-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(20, 24, 33, 0.08);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.lang-dd-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  min-width: 68px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
  z-index: 60;
}

.lang-dd-item {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.lang-dd-item:hover { background: var(--surface-alt); color: var(--text); }
.lang-dd-item.active { background: #141821; color: #fff; }

/* Hero Stage */
.hero-stage {
  padding: 28px 28px 34px;
  min-height: 290px;
  display: flex;
  align-items: center;
}

.hero-copy {
  max-width: 560px;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 10px;
}

.hero-copy h1 {
  font-size: clamp(2.2rem, 4.4vw, 3.45rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 800;
  margin: 0 0 14px;
  color: #141821;
}

.hero-copy p {
  color: #4f5562;
  font-size: 1.02rem;
  max-width: 470px;
  margin: 0 0 22px;
}

.hero-btns { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-full { width: 100%; }
.btn-dark { background: #141821; color: #fff; box-shadow: 0 4px 14px rgba(20, 24, 33, 0.18); }
.btn-dark:hover { opacity: 0.9; }
.btn-white { background: rgba(255, 255, 255, 0.94); color: #141821; border-color: rgba(20, 24, 33, 0.1); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }

/* Single Clean Row of 8 Categories */
.cats-strip {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0 28px;
}
.cats-strip::-webkit-scrollbar { display: none; }

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 17px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid rgba(20, 24, 33, 0.06);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.cat-pill.active {
  background: #141821;
  color: #fff;
  border-color: #141821;
}

/* Bestsellery & Nowości 6-column Grid */
.shelf-section { margin-bottom: 34px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.shelf-head h2 { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.see-all { font-size: 0.84rem; font-weight: 600; color: var(--muted); }

.tiles-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}

.tile-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tile-cover-wrap { position: relative; }

.tile-cover {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  padding: 15px 14px;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(20, 24, 33, 0.11);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.tile-cover.is-light {
  color: #141821;
  border: 1px solid rgba(20, 24, 33, 0.06);
}

.tile-cover:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(20, 24, 33, 0.16);
}

.tile-author-top {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  opacity: 0.82;
  text-align: center;
}

.tile-title-center {
  font-size: 1.12rem;
  line-height: 1.14;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.tile-cover.is-light .tile-title-center {
  text-shadow: none;
}

.tile-play-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.96);
  color: #141821;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tile-play-btn:hover { transform: scale(1.06); }

.tile-meta { display: flex; flex-direction: column; gap: 2px; }
.tile-name { font-size: 0.88rem; font-weight: 700; line-height: 1.25; }
.tile-author { font-size: 0.78rem; color: var(--muted); }
.tile-dur { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; color: var(--muted); margin-top: 2px; }

/* Weekly Digest Card */
.digest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 30px;
  margin: 14px 0 24px;
  box-shadow: 0 4px 18px rgba(20, 24, 33, 0.04);
}
.digest-copy h2 { margin: 0 0 6px; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.digest-copy p { margin: 0 0 18px; color: var(--muted); font-size: 0.94rem; max-width: 620px; }
.digest-fields {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.9fr auto;
  gap: 10px;
  margin-bottom: 10px;
}
.digest-fields input {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
}
.digest-fields input:focus { border-color: var(--purple); }
.digest-consent { margin-top: 4px; }

/* Promo Strip */
.promo-strip {
  background: #141821;
  color: #fff;
  border-radius: 18px;
  padding: 26px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin: 18px 0 32px;
}

.promo-strip h2 { margin: 0 0 4px; font-size: 1.2rem; }
.promo-strip p { margin: 0; opacity: 0.85; font-size: 0.9rem; max-width: 600px; }

/* Bottom Dark Audio Bar (rounded top corners like reference) */
.bottom-player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  background: var(--dark-bar);
  color: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.18);
  padding: 11px 24px;
}

.bp-inner {
  max-width: 1220px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1.25fr;
  align-items: center;
  gap: 18px;
}

.bp-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bp-thumb { width: 42px; height: 42px; border-radius: 8px; flex-shrink: 0; }
.bp-track { display: flex; flex-direction: column; min-width: 0; }
.bp-track strong { font-size: 0.84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bp-track span { font-size: 0.74rem; opacity: 0.7; }

.bp-ico-btn { background: none; border: none; color: #fff; opacity: 0.82; cursor: pointer; font-size: 0.95rem; padding: 6px; display: inline-flex; align-items: center; }
.bp-ico-btn:hover { opacity: 1; }

.bp-center { display: flex; align-items: center; gap: 10px; }
.bp-play-circle { width: 40px; height: 40px; border-radius: 50%; border: none; background: #fff; color: #141821; font-size: 0.9rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.bp-speed { background: rgba(255,255,255,0.14); border: none; color: #fff; border-radius: 6px; padding: 3px 8px; font-size: 0.72rem; font-weight: 700; cursor: pointer; }

.bp-right { display: flex; align-items: center; gap: 12px; }
.bp-time { font-size: 0.76rem; opacity: 0.82; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bp-seek { flex: 1; accent-color: #fff; cursor: pointer; }
.bp-epub-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.14);
  border: none;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

/* Reader Page */
.read-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0%; background: var(--purple); z-index: 70; }
.reader-wrap { max-width: 820px; padding-top: 24px; padding-bottom: 40px; }
.reader-top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.back-link { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.reader-settings-pill { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 4px 8px; border-radius: 999px; }
.theme-btn, .font-btn { border: none; background: transparent; color: var(--text); border-radius: 999px; padding: 4px 8px; cursor: pointer; font-weight: 700; font-size: 0.8rem; display: inline-flex; align-items: center; }

.reader-article { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 34px 40px; }
.article-hero { display: grid; grid-template-columns: 186px 1fr; gap: 26px; align-items: center; margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.article-cover-sq { width: 186px; }
.article-intro h1 { margin: 0 0 4px; font-size: 1.95rem; letter-spacing: -0.03em; line-height: 1.15; }
.article-author { margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.article-tagline { margin: 0 0 16px; font-size: 0.98rem; color: var(--muted); }
.insights-box, .checklist-box, .who-box, .faq-box, .reactions-box { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 20px 24px; margin-bottom: 22px; }
.reactions-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.reactions-head h2 { margin: 0; font-size: 1.15rem; }
.reactions-head span { font-size: 0.82rem; color: var(--muted); }
.reactions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.react-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.react-btn:hover { transform: translateY(-1px); border-color: rgba(20, 24, 33, 0.25); }
.react-btn.active { background: #141821; color: #fff; border-color: #141821; }
.react-emoji { font-size: 1.05rem; line-height: 1; }
.react-cnt {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.react-btn.active .react-cnt { background: rgba(255, 255, 255, 0.2); color: #fff; }
.faq-item { border-top: 1px solid var(--border); padding: 12px 0; }
.faq-item:first-of-type { border-top: none; padding-top: 4px; }
.faq-item summary { font-weight: 700; font-size: 0.95rem; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::after { content: "+"; font-size: 1.15rem; color: var(--muted); }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin: 8px 0 0; font-size: 0.92rem; color: var(--muted); line-height: 1.55; }
.book-serif-body { font-family: Georgia, "New York", "Times New Roman", serif; font-size: 1.1rem; line-height: 1.78; max-width: 650px; margin: 0 auto 30px; }
.chapter-block { margin-bottom: 32px; }
.chapter-num { text-align: center; font-size: 1.9rem; color: var(--purple); line-height: 1.1; margin-bottom: 4px; }
.chapter-sub { text-align: center; font-size: 1.15rem; font-style: italic; font-weight: 400; color: var(--purple); margin: 0 0 16px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.related-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.related-card span { font-size: 0.8rem; color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 98; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 24, 33, 0.55); backdrop-filter: blur(4px); }
.modal-card { position: relative; z-index: 2; width: 100%; max-width: 420px; background: var(--surface); color: var(--text); border-radius: 20px; padding: 24px; box-shadow: 0 24px 50px rgba(0,0,0,0.22); }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 1.4rem; color: var(--muted); cursor: pointer; }
#leadForm label { display: block; margin-bottom: 12px; font-size: 0.85rem; font-weight: 600; }
#leadForm label input[type="text"] { width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.checkbox-row { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 400 !important; font-size: 0.8rem !important; color: var(--muted); }
.lead-feedback { margin-top: 10px; font-size: 0.85rem; font-weight: 600; }

@media (max-width: 1080px) {
  .tiles-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .top-links { display: none; }
}

@media (max-width: 760px) {
  .digest-fields { grid-template-columns: 1fr; }
  .hero-backdrop-zone { background-image: none !important; }
  .top-search { width: 150px; }
  .tiles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bp-inner { grid-template-columns: 1fr auto; }
  .bp-right { display: none; }
  .reader-article { padding: 22px 16px; }
  .article-hero { grid-template-columns: 1fr; }
}
