/* Shabdah universal overlay -- ALL rules in this file are scoped under
   body.overlay-mode, so this stylesheet can never affect normal "/" or
   "/reader.html" rendering regardless of load order or caching. */

body.overlay-mode {
  margin: 0;
  background: #F4FBFC;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Hide every piece of normal-site chrome: both SPA page containers (home
   + app/category browsing), the mobile bottom nav, every modal overlay
   (auth/review/notes/account), and the OLD Quick Lookup modal -- its own
   JS may still technically run (harmless if so), but it must never be
   visible or interactable while the new overlay is active. */
body.overlay-mode .page,
body.overlay-mode #shabdah-mobile-nav,
body.overlay-mode #auth-overlay,
body.overlay-mode #review-overlay,
body.overlay-mode #notes-overlay,
body.overlay-mode #account-overlay,
body.overlay-mode #quick-lookup-overlay,
body.overlay-mode #ptw-toast {
  display: none !important;
}

#overlay-root {
  display: none;
}

body.overlay-mode #overlay-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #0C3846;
}

body.overlay-mode #overlay-root[aria-hidden="true"] {
  display: none;
}

/* ── Sticky top bar: Close + Open Full Shabdah ─────────────────────── */
.overlay-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #0C3846;
  color: #fff;
}

.overlay-topbar-spacer { flex: 1 1 auto; }

.overlay-icon-btn {
  appearance: none;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.overlay-icon-btn:hover { background: rgba(255, 255, 255, 0.22); }
.overlay-icon-btn:focus-visible { outline: 2px solid #64DFDF; outline-offset: 2px; }

.overlay-text-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.overlay-text-btn:hover { background: rgba(255, 255, 255, 0.12); }
.overlay-text-btn:focus-visible { outline: 2px solid #64DFDF; outline-offset: 2px; }

/* ── Compact inline lookup bar ────────────────────────────────────── */
.overlay-searchbar {
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid #E3EEF0;
}

#overlay-q-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px; /* 16px avoids iOS Safari zoom-on-focus */
  padding: 10px 12px;
  border: 1px solid #C9DDE0;
  border-radius: 10px;
  margin-bottom: 6px;
}
#overlay-q-input:focus { outline: none; border-color: #249E9F; }

.overlay-searchbar .overlay-text-btn {
  border-color: #C9DDE0;
  color: #0C3846;
  font-weight: 500;
}
.overlay-searchbar .overlay-text-btn:hover { background: #EEF7F7; }

.overlay-ctx-row { margin-top: 6px; }
.overlay-ctx-row[hidden] { display: none; }

#overlay-ctx-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
  padding: 9px 12px;
  border: 1px solid #C9DDE0;
  border-radius: 10px;
}
#overlay-ctx-input:focus { outline: none; border-color: #249E9F; }

/* ── Result body ──────────────────────────────────────────────────── */
.overlay-body {
  flex: 1 1 auto;
  padding: 12px;
  overflow-y: auto;
}

.overlay-empty {
  margin-top: 24px;
  text-align: center;
  color: #4C6E74;
  font-size: 15px;
  padding: 0 16px;
}

.overlay-status-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.overlay-status-badge.context-matched { background: #DFF4E8; color: #1A5C33; }
.overlay-status-badge.ambiguous { background: #FDEFD9; color: #8A5A00; }

/* ── Flashcard ─────────────────────────────────────────────────────── */
.overlay-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(12, 56, 70, 0.08);
  overflow: hidden;
}

.overlay-card-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #EEF7F7;
}

.overlay-card-body { padding: 14px 16px 16px; }

.overlay-card-headword {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 2px;
}
.overlay-card-reading { font-size: 14px; color: #4C6E74; margin: 0 0 6px; }
.overlay-card-meaning { font-size: 15px; color: #0C3846; margin: 0 0 10px; }
.overlay-card-category {
  display: inline-block;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #EEF7F7;
  color: #249E9F;
  margin-bottom: 10px;
}

.overlay-audio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.overlay-audio-btn {
  appearance: none;
  border: 1px solid #C9DDE0;
  background: #fff;
  color: #0C3846;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.overlay-audio-btn:hover { background: #EEF7F7; }
.overlay-audio-btn:focus-visible { outline: 2px solid #249E9F; outline-offset: 2px; }

.overlay-example {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #EEF7F7;
  font-size: 14px;
}
.overlay-example-gloss { color: #4C6E74; font-size: 13px; margin-top: 2px; }

/* ── Sense switcher ───────────────────────────────────────────────── */
.overlay-sense-switcher {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 2px 14px;
  -webkit-overflow-scrolling: touch;
}

.overlay-sense-pill {
  appearance: none;
  flex: 0 0 auto;
  border: 1.5px solid #C9DDE0;
  background: #fff;
  color: #0C3846;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.overlay-sense-pill[aria-pressed="true"] {
  background: #0C3846;
  border-color: #0C3846;
  color: #fff;
}
.overlay-sense-pill:focus-visible { outline: 2px solid #249E9F; outline-offset: 2px; }

/* ── Scanned sentence / clickable chips ───────────────────────────── */
.overlay-sentence {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 17px;
  line-height: 1.7;
  box-shadow: 0 2px 10px rgba(12, 56, 70, 0.06);
}

.overlay-chip {
  appearance: none;
  border: none;
  background: #DFF4E8;
  color: #0C3846;
  border-radius: 6px;
  padding: 1px 3px;
  font: inherit;
  cursor: pointer;
}
.overlay-chip:hover { background: #C6ECD6; }
.overlay-chip:focus-visible { outline: 2px solid #249E9F; outline-offset: 1px; }

.overlay-back-to-sentence {
  margin-bottom: 10px;
}

/* ── Responsive: 360px mobile width and 420x600 desktop popup ─────── */
@media (max-width: 400px) {
  .overlay-card-headword { font-size: 20px; }
  .overlay-topbar { padding: 8px 10px; }
}

@media (min-width: 401px) {
  body.overlay-mode #overlay-root {
    border-left: 1px solid #E3EEF0;
    border-right: 1px solid #E3EEF0;
  }
}

/* ── Dark mode / theme-neutral: this page is always served light, a
     deliberate choice matching the rest of the static site, which never
     reads prefers-color-scheme. ───────────────────────────────────── */
