/* ===== Embedded Pyidaungsu 2.5.3 WOFF2 (Non-overlapping unicode-range) ===== */
@font-face {
  font-family: 'Pyidaungsu';
  src: url('./fonts/Pyidaungsu-2.5.3-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-002F, U+003A-103F, U+104A-10FFFF;
}

@font-face {
  font-family: 'Pyidaungsu';
  src: url('./fonts/Pyidaungsu-2.5.3-Numbers.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0030-0039, U+1040-1049;
}

@font-face {
  font-family: 'Pyidaungsu';
  src: url('./fonts/Pyidaungsu-2.5.3-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ===== Royal Indigo & Warm Amber Theme Variables (Distinct from DhammaBooks Green) ===== */
:root,
html[data-theme="light"] {
  --bg-page: #f6f8fc;
  --bg-surface: #ffffff;
  --bg-elevated: #eaedf6;
  --bg-pali: #eef2fb;
  --bg-highlight: #fde68a;
  --text-main: #1b2234;
  --text-muted: #56607a;
  --accent: #243b6b;
  --accent-hover: #192b52;
  --accent-soft: rgba(36, 59, 107, 0.1);
  --gold: #b87d2c;
  --gold-soft: rgba(184, 125, 44, 0.14);
  --border: #dce2f0;
  --shadow: 0 6px 24px rgba(36, 59, 107, 0.08);
}

html[data-theme="sepia"] {
  --bg-page: #f4ede0;
  --bg-surface: #fcf7ed;
  --bg-elevated: #eae0ce;
  --bg-pali: #efe6d6;
  --bg-highlight: #ffe699;
  --text-main: #39281d;
  --text-muted: #6d5849;
  --accent: #6e361c;
  --accent-hover: #542814;
  --accent-soft: rgba(110, 54, 28, 0.1);
  --gold: #a97124;
  --gold-soft: rgba(169, 113, 36, 0.15);
  --border: #dfd2bc;
  --shadow: 0 6px 24px rgba(60, 35, 15, 0.08);
}

html[data-theme="dark"] {
  --bg-page: #0f141e;
  --bg-surface: #171e2d;
  --bg-elevated: #212b40;
  --bg-pali: #1c253a;
  --bg-highlight: #5a4614;
  --text-main: #e6ebf5;
  --text-muted: #98a6c2;
  --accent: #7da7f0;
  --accent-hover: #9bbcf5;
  --accent-soft: rgba(125, 167, 240, 0.15);
  --gold: #e6b35c;
  --gold-soft: rgba(230, 179, 92, 0.16);
  --border: #2a354e;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.38);
}

html[data-font="serif"] {
  --font-family: 'Pyidaungsu', Georgia, serif;
}

html[data-font="sans"] {
  --font-family: 'Noto Sans Myanmar', 'Padauk', system-ui, -apple-system, sans-serif;
}

:root {
  --reader-scale: 1;
  --reader-lh: 1.95;
  --topbar-h: 60px;
  --sidebar-w: 310px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-family);
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

.hidden { display: none !important; }

.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  z-index: 1200;
  transition: width 0.15s ease;
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  max-width: 1360px;
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
  min-width: 0;
}

.brand-emblem {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 0.98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.offline-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.offline-badge.ready {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.offline-badge.ready .dot { background: #16a34a; }

.nav-pill, .icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  border-radius: 10px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s, border-color 0.15s;
}

.nav-pill:hover, .icon-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--gold);
}

/* ===== Hero (Royal Indigo Gradient) ===== */
.hero {
  background: linear-gradient(135deg, #162447 0%, #243b6b 58%, #34528d 100%);
  color: #fff;
  padding: 44px 16px 38px;
  text-align: center;
}

.hero-inner {
  max-width: 840px;
  margin: 0 auto;
}

.pali-motto {
  display: inline-block;
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(230, 179, 92, 0.55);
  color: #f9dea3;
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.55rem, 3.5vw, 2.25rem);
  line-height: 1.35;
}

.hero-desc {
  margin: 0 auto 22px;
  max-width: 680px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.98rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
}

/* ===== Container & Cards ===== */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.continue-card {
  background: var(--bg-surface);
  border: 1px solid var(--gold);
  border-left: 5px solid var(--gold);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}

.continue-meta small {
  color: var(--gold);
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.continue-meta strong { font-size: 1.04rem; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.btn-secondary:hover { border-color: var(--accent); }

/* ===== Search & Filter ===== */
.library-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.home-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 12px;
  box-shadow: var(--shadow);
}

.home-search-box:focus-within { border-color: var(--accent); }

.home-search-box input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.96rem;
  padding: 10px 8px;
  outline: none;
}

.clear-btn {
  border: none;
  background: var(--bg-elevated);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.search-results-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.search-result-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
}

.search-result-item:hover { border-color: var(--accent); }

.search-result-meta {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 4px;
}

.search-result-title { font-weight: 700; font-size: 0.98rem; margin-bottom: 4px; }
.search-result-snippet { font-size: 0.88rem; color: var(--text-muted); line-height: 1.65; }

mark {
  background: var(--bg-highlight);
  color: inherit;
  padding: 0 3px;
  border-radius: 4px;
}

/* ===== Books Grid ===== */
.books-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.book-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.book-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.book-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
}

.book-icon { font-size: 1.5rem; }
.book-card h2 { margin: 0; font-size: 1.25rem; color: var(--accent); }
.book-author { font-size: 0.88rem; color: var(--text-muted); margin: -4px 0 0; }

.book-highlights {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 4px 0;
  list-style: none;
}

.book-highlights li { font-size: 0.88rem; padding: 3px 0; }
.book-highlights li::before { content: '❖ '; color: var(--gold); }

.book-progress-wrap { margin-top: auto; }
.book-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.book-card-actions { display: flex; gap: 10px; margin-top: 6px; }
.book-card-actions .btn-primary { flex: 1; }

/* ===== Study Section ===== */
.study-section {
  margin-top: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.study-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.study-section h3 { margin: 0; }

.study-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-page);
  margin-top: 8px;
}

.study-item-link {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  flex: 1;
}

.study-item-link strong { color: var(--accent); display: block; }
.study-item-link small { color: var(--text-muted); display: block; margin-top: 2px; }

/* ===== Reader Layout ===== */
.view-reader {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

.reader-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

.reader-sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-w)); }

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-book-switch { display: flex; gap: 6px; }
.sidebar-book-switch button {
  flex: 1;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.sidebar-book-switch button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.sidebar-search-wrap input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
}

.sidebar-toc-list { flex: 1; overflow-y: auto; padding: 10px; }

.toc-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  padding: 10px 8px 4px;
}

.toc-item-btn {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.toc-item-btn:hover { background: var(--bg-elevated); }
.toc-item-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.toc-read-mark { color: #16a34a; font-size: 0.78rem; flex-shrink: 0; }

/* ===== Reader Main Content ===== */
.reader-main { flex: 1; min-width: 0; padding: 28px 20px 64px; }
.reader-content { max-width: 780px; margin: 0 auto; }

.chapter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px clamp(18px, 4vw, 42px);
  box-shadow: var(--shadow);
}

.chapter-header {
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.chapter-num-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.chapter-header h1 {
  margin: 0 0 10px;
  font-size: calc(1.48rem * var(--reader-scale));
  color: var(--accent);
  line-height: 1.45;
}

.chapter-meta-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.84rem;
  margin-bottom: 14px;
}

.chapter-action-bar { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }

.chapter-body {
  font-size: calc(1.06rem * var(--reader-scale));
  line-height: var(--reader-lh);
}

.chapter-body p.reader-para {
  margin: 0 0 1.05em;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
  cursor: pointer;
}

.chapter-body p.reader-para:hover { background: var(--bg-elevated); }
.chapter-body p.reader-para.is-highlighted {
  background: var(--bg-highlight);
  border-left: 3px solid var(--gold);
}

.chapter-body p.text-center { text-align: center; }
.chapter-body p.text-bold { font-weight: 700; }

.chapter-body h2 {
  font-size: calc(1.22rem * var(--reader-scale));
  color: var(--accent);
  margin: 1.6em 0 0.7em;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border);
}

.chapter-body h3 {
  font-size: calc(1.08rem * var(--reader-scale));
  color: var(--gold);
  margin: 1.3em 0 0.5em;
}

.pali-box {
  background: var(--bg-pali);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: calc(1rem * var(--reader-scale));
  line-height: 1.85;
}

.pali-box p { margin: 4px 0; }

.reader-table-wrap { overflow-x: auto; margin: 18px 0; }
.reader-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.reader-table th, .reader-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.reader-table tr:first-child td { background: var(--bg-elevated); font-weight: 700; }

.para-note-badge {
  display: block;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--gold);
  font-size: 0.85rem;
  color: var(--text-main);
}

.chapter-nav-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
}

.ch-nav-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  color: var(--text-main);
  font-family: inherit;
}

.ch-nav-btn:hover { border-color: var(--accent); }
.ch-nav-btn.next { text-align: right; }
.ch-nav-btn small { color: var(--text-muted); display: block; font-size: 0.78rem; }
.ch-nav-btn strong { color: var(--accent); font-size: 0.94rem; }

.book-cover-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.book-cover-card h1 { color: var(--accent); margin: 10px 0 8px; }

.frontmatter-box {
  text-align: left;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 18px 0;
  font-size: 0.92rem;
}

.fab-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  z-index: 800;
}

.mobile-bottom-nav { display: none; }
.mobile-only { display: none; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 1000; }

.sheet-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 24px));
  max-height: 82vh;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  z-index: 1010;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.sheet-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sheet-header h2 { margin: 0; font-size: 1.05rem; }

.close-modal-btn {
  border: none;
  background: var(--bg-elevated);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

.sheet-body { padding: 16px 18px; overflow-y: auto; }
.modal-scope-chips { margin: 12px 0; }
.aa-group { margin-bottom: 18px; }
.aa-group label { display: block; font-size: 0.88rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.aa-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.aa-opt {
  flex: 1;
  min-width: 90px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.aa-opt.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.bm-top-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: #162038;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 1300;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

@media (max-width: 767px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-flex; }
  .offline-badge .badge-label { display: none; }
  .hide-xs { display: none; }
  .books-grid { grid-template-columns: 1fr; }
  .reader-sidebar { display: none; }
  .reader-main { padding: 14px 10px 36px; }
  .chapter-card { padding: 20px 14px; }
  .chapter-nav-footer { grid-template-columns: 1fr; }
  .fab-top { bottom: calc(76px + env(safe-area-inset-bottom)); right: 14px; }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 950;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }

  .mb-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
  }

  .mb-tab span { font-size: 1.05rem; }

  .sheet-modal {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-height: 85vh;
    border-radius: 18px 18px 0 0;
  }
}
