
:root {
  --bg: #0c1613;
  --surface: #121f1b;
  --surface-2: #172722;
  --ink: #f0f5f2;
  --muted: #93a8a0;
  --emerald: #17342c;
  --emerald-dark: #0a1310;
  --emerald-accent: #1f5143;
  --gold: #c89b3c;
  --gold-bright: #e2b653;
  --gold-soft: rgba(200, 155, 60, 0.16);
  --border: #213730;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
}
html[data-theme="light"] body, body.light-theme {
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #f0f5f2;
  --ink: #14221d;
  --muted: #586b64;
  --emerald: #1f5143;
  --emerald-dark: #13352c;
  --emerald-accent: #1f5143;
  --gold: #c89b3c;
  --gold-bright: #d4a644;
  --gold-soft: #f7eed8;
  --border: #dce4e0;
  --shadow: 0 10px 28px rgba(19, 53, 44, 0.08);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Pyidaungsu", "Noto Sans Myanmar", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
a { color: var(--gold-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }

/* Header Bar matching sarphatkhan-reader.pages.dev */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #142b24;
  color: #fff;
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.top-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 11px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.top .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--gold-bright);
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.top .mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--gold);
  color: #10201b;
  font-size: 0.95rem;
  font-weight: 900;
}
.top nav.default-top-links,
.top [data-appearance-menu] {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.top [data-appearance-menu] ~ nav.default-top-links { display: none; }
.top a {
  color: #e7efec;
  font-weight: 600;
  font-size: 0.94rem;
}
.top a:hover { color: var(--gold-bright); text-decoration: none; }
.top #theme {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}
.sfk-pro-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(31, 81, 67, 0.65);
  color: #e7efec;
  border: 1px solid rgba(200, 155, 60, 0.4);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.8rem;
  font-weight: 600;
}
.sfk-pro-pill:hover { border-color: var(--gold); color: var(--gold-bright); }

/* Main Container & 2-Column Top Hero + Continue Split */
.wrap, main#shelf {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 22px 64px;
}
main#shelf {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: stretch;
}
main#shelf > *:not([data-home-section="hero"]):not([data-home-section="continue"]) {
  grid-column: 1 / -1;
}

/* Featured Hero Banner (Left Column) */
.hero-carousel {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 75% 40%, #245749 0%, #122620 55%, #0b1512 100%);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 290px;
}
.book-heroes { flex: 1; display: flex; }
.book-hero {
  width: 100%;
  padding: 34px 32px;
  display: flex;
  align-items: center;
  background-image: linear-gradient(90deg, rgba(10, 20, 17, 0.92) 0%, rgba(16, 34, 28, 0.72) 55%, rgba(16, 34, 28, 0.28) 100%), var(--design-hero, none);
  background-size: cover;
  background-position: center;
}
.hero-content { max-width: 440px; }
.book-hero h2 {
  color: #ffffff;
  font-size: 1.85rem;
  line-height: 1.35;
  font-weight: 800;
  margin: 0 0 18px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
.book-highlight {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold);
  color: #10201b;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 8px 18px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(200, 155, 60, 0.35);
}
.book-highlight:hover { background: var(--gold-bright); text-decoration: none; }
.hero-carousel-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 0 14px;
}
.hero-carousel-controls button {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
}
.hero-carousel-controls button[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
}

/* Panels & Section Bars */
.panel, .section-card-shelf, .collections, .continue-reading, .portal-trending {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
[data-home-section="continue"] .continue-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}
.home-section-header, .portal-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.home-section-header h2, .portal-section-bar h2, .gold-bar-heading {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
  border-left: 3px solid var(--gold);
  padding-left: 10px;
  line-height: 1.3;
}
.portal-bar-actions { display: flex; align-items: center; gap: 10px; }
.portal-more-link { font-size: 0.88rem; font-weight: 600; color: var(--gold-bright); }
.continue-empty { color: var(--muted); font-size: 0.9rem; margin: 10px 0; }

button {
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  padding: 5px 13px;
  font-size: 0.84rem;
}
button:hover { border-color: var(--gold); }
.primary-action, .btn-primary {
  background: var(--emerald-accent);
  color: #fff;
  border-color: var(--emerald-accent);
}
.danger-btn {
  background: #991b1b;
  color: #fff;
  border-color: #7f1d1d;
}

/* Cards & Trending Grid */
.continue-grid, .section-preview-grid, .section-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 16px;
}
.portal-trending-grid {
  display: grid;
  grid-template-columns: repeat(var(--portal-trend-cols, 5), minmax(0, 1fr));
  gap: 14px;
}
.portal-trend-card, .continue-card, .section-group-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.portal-trend-card:hover, .continue-card:hover, .section-group-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  text-decoration: none;
}
.portal-trend-thumb, .continue-cover-frame, .section-group-thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  background: #0e1915;
  overflow: hidden;
}
.portal-trend-thumb img, .continue-cover, .section-group-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.portal-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(16, 34, 28, 0.88);
  color: var(--gold-bright);
  border: 1px solid rgba(200, 155, 60, 0.45);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}
.portal-trend-title {
  padding: 9px 10px 2px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}
.portal-trend-meta {
  padding: 0 10px 10px;
  font-size: 0.78rem;
  color: var(--muted);
}
.continue-copy, .section-group-copy {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.continue-copy strong, .section-group-copy strong { font-size: 0.92rem; color: var(--ink); }
.continue-copy small, .section-group-copy small { font-size: 0.78rem; color: var(--muted); }

.view-switch, .icon-view-switch { display: inline-flex; gap: 6px; }
.icon-view-switch button { padding: 5px 8px; border-radius: 8px; }
.view-switch button[aria-pressed="true"], .icon-view-switch button[aria-pressed="true"] {
  background: var(--emerald-accent);
  color: #fff;
  border-color: var(--gold);
}

.is-list-view .continue-grid,
.is-list-view .section-preview-grid { grid-template-columns: 1fr; }
.is-list-view .continue-card { flex-direction: row; align-items: center; }
.is-list-view .continue-cover-frame { width: 56px; height: 74px; aspect-ratio: auto; flex-shrink: 0; }

/* Slide-out Drawer (Hidden by default until .is-open!) */
.portal-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  z-index: 90;
}
.portal-drawer-backdrop.is-open { display: block; }
.portal-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(290px, 84vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 100;
  padding: 18px;
  box-shadow: var(--shadow);
  overflow-y: auto;
}
.portal-drawer.is-open { display: block; }
.portal-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--gold-bright);
}
.portal-drawer-nav { display: flex; flex-direction: column; gap: 6px; }
.portal-drawer-nav a {
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--ink);
  font-weight: 600;
}
.portal-drawer-nav a[aria-current="page"], .portal-drawer-nav a:hover {
  background: var(--gold-soft);
  color: var(--gold-bright);
  text-decoration: none;
}

@media (max-width: 960px) {
  main#shelf { grid-template-columns: 1fr; }
  .top nav.default-top-links, .top [data-appearance-menu] { display: none; }
  .portal-trending-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .top-inner { padding: 10px 14px; }
  .book-hero { padding: 24px 18px; }
  .book-hero h2 { font-size: 1.35rem; }
  .continue-grid, .section-preview-grid, .section-groups-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
