:root {
  --page: #f6f0e7;
  --surface: #fffdf9;
  --surface-soft: #fbf6ee;
  --ink: #2d201c;
  --muted: #75645d;
  --line: #e3d5c8;
  --brand: #8b2f31;
  --brand-dark: #6f2226;
  --gold: #a76b17;
  --shadow: rgba(62, 38, 25, 0.1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Segoe UI", "Noto Sans Devanagari", Arial, sans-serif;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }

.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.verseTopbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.verseBrand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.verseBrand img {
  width: 43px;
  height: 43px;
  object-fit: contain;
}

.verseBrand span { display: grid; gap: 2px; }
.verseBrand strong { font-family: Georgia, "Noto Serif Devanagari", serif; font-size: 19px; font-weight: 600; }
.verseBrand small { color: var(--muted); }

.advisorLink {
  color: var(--brand);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.advisorLink:hover { text-decoration: underline; }

.versePage {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 50px 0 64px;
}

.verseHero { text-align: center; margin-bottom: 24px; }
.verseHero h1 { margin: 0 0 9px; font: 600 clamp(27px, 4vw, 39px)/1.2 Georgia, "Noto Serif Devanagari", serif; }
.verseHero p { max-width: 680px; margin: 0 auto; color: var(--muted); line-height: 1.55; }

.searchPanel {
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 12px 30px var(--shadow);
}

.queryRow { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

#verseQuery {
  min-width: 0;
  padding: 14px 15px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}

#searchButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 156px;
  padding: 0 18px;
  color: #fffaf4;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 10px;
  font-weight: 600;
}

#searchButton:hover { background: var(--brand-dark); }
#searchButton:disabled { cursor: wait; opacity: 0.7; }
.searchIcon { font-size: 21px; line-height: 1; }

#verseQuery:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(139, 47, 49, 0.25);
  outline-offset: 2px;
}

.filterRow { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 11px; }
.filterRow label { display: grid; gap: 5px; min-width: 190px; }
.filterRow label > span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

select {
  width: 100%;
  padding: 9px 34px 9px 11px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.examples { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.examples button {
  padding: 6px 9px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.examples button:hover { color: var(--brand); border-color: var(--brand); }

.searchStatus { min-height: 24px; margin: 22px 2px 0; color: var(--muted); }
.searchStatus.error { color: #9b2f2f; }

.resultsHeading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 8px 0 13px; }
.resultsHeading h2 { margin: 0; font-size: 18px; }
.resultsHeading span { color: var(--muted); font-size: 13px; }

.resultList { display: grid; gap: 12px; }

.verseResult {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.resultTop { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.verseResult h4 { margin: 0; font: 600 18px/1.4 Georgia, "Noto Serif Devanagari", serif; }
.reference { flex: 0 0 auto; color: var(--muted); font-size: 12px; text-align: right; }

.hindiVerse {
  margin: 15px 0 8px;
  padding-left: 14px;
  border-left: 3px solid var(--gold);
  font: 400 19px/1.7 Georgia, "Noto Serif Devanagari", serif;
  white-space: pre-line;
}

.openingLine { margin: 14px 0 7px; font: 400 18px/1.6 Georgia, "Noto Serif Devanagari", serif; }
.translation { margin: 8px 0 0; line-height: 1.58; }
.bhavarth { margin: 14px 0 0; padding-top: 14px; color: var(--muted); border-top: 1px solid var(--line); line-height: 1.65; white-space: pre-line; }

.resultActions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.resultActions button {
  padding: 7px 10px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}
.resultActions button:hover { border-color: var(--brand); color: var(--brand); }

.emptyResults { padding: 34px 20px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 13px; }
.emptyResults h3 { margin: 0 0 6px; }
.emptyResults p { margin: 0; color: var(--muted); }

@media (max-width: 620px) {
  .verseTopbar { padding: 12px 14px; }
  .verseBrand small, .advisorLink { display: none; }
  .versePage { width: min(100% - 24px, 920px); padding: 34px 0 45px; }
  .queryRow { grid-template-columns: 1fr; }
  #searchButton { min-height: 47px; }
  .filterRow label { flex: 1 1 145px; min-width: 0; }
  .resultTop { display: block; }
  .reference { margin-top: 5px; text-align: left; }
  .verseResult { padding: 16px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #15110f;
    --surface: #211b18;
    --surface-soft: #2a211d;
    --ink: #f8eee7;
    --muted: #c3b3aa;
    --line: #4b3b34;
    --brand: #c86f68;
    --brand-dark: #a95853;
    --gold: #efbc68;
    --shadow: rgba(0, 0, 0, 0.3);
  }
  #searchButton { color: #25100d; }
}
