/* Universal Reader V02 — one canonical item; Contents is navigation. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body.ur-page {
  margin: 0;
  overflow-x: hidden;
  max-width: 100%;
}

.ur-page {
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background: linear-gradient(168deg, #faf8f2 0%, #f0ebe0 42%, #e6dfd0 100%);
  color: #1a2438;
}

.ur-hero {
  padding: 1.25rem 1rem 1.1rem;
  text-align: center;
  background: radial-gradient(ellipse 120% 85% at 50% 0%, #1e4a7a 0%, #153a62 48%, #0c2848 100%);
  color: #faf8f2;
  border-bottom: 4px solid #c9a227;
}

.ur-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.88;
}

.ur-hero h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.5rem, 3.8vw, 2.2rem);
  font-weight: 600;
}

.ur-subtitle {
  margin: 0 auto 0.85rem;
  max-width: 40rem;
  font-size: 1.02rem;
  line-height: 1.45;
  opacity: 0.93;
}

.ur-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  justify-content: center;
  font-size: 0.92rem;
}

.ur-hero-links a {
  color: #e8d4a0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ur-hero-links a:hover,
.ur-hero-links a:focus {
  color: #fff;
}

.ur-hero-links__sep {
  opacity: 0.5;
}

.ur-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.85rem 0.85rem 2.75rem;
  width: 100%;
}

.ur-loading,
.ur-error,
.ur-empty {
  text-align: center;
  padding: 1.5rem 1rem;
}

.ur-error {
  color: #7a1e2e;
}

.ur-toolbar {
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.ur-contents-btn,
.ur-nav-close {
  min-height: 2.7rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid #c9b896;
  border-radius: 10px;
  background: #fffef9;
  color: #0c2848;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.ur-search-label {
  flex: 1;
  min-width: 0;
}

.ur-search-label__text {
  display: block;
  font-size: 0.82rem;
  font-weight: 650;
  margin-bottom: 0.3rem;
}

.ur-search {
  width: 100%;
  min-height: 2.7rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid #c9b896;
  border-radius: 10px;
  font-size: 1rem;
  background: #fffef9;
}

.ur-shell {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.ur-nav-panel {
  position: sticky;
  top: 0.5rem;
  max-height: calc(100vh - 1rem);
  overflow: auto;
  padding: 0.85rem 0.8rem 1rem;
  border: 1px solid #e6ddd0;
  border-radius: 16px;
  background: #fffef9;
}

.ur-nav-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.ur-nav-panel__title {
  margin: 0;
  font-size: 1rem;
}

.ur-nav-close {
  display: none;
}

.ur-count {
  margin: 0.35rem 0 0.55rem;
  font-size: 0.82rem;
  color: #4a5a6c;
}

.ur-theme-bar,
.ur-mode-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.45rem;
}

.ur-chip {
  min-height: 2rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid #c9b896;
  border-radius: 999px;
  background: #fffef9;
  color: #0c2848;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.ur-chip.is-active {
  background: #1e4a7a;
  color: #faf8f2;
  border-color: #1e4a7a;
}

.ur-results {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.ur-result {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.7rem;
  border: 1px solid #e6ddd0;
  border-radius: 10px;
  background: #faf8f2;
  color: inherit;
  cursor: pointer;
}

.ur-result.is-active,
.ur-tree__item.is-active {
  outline: 2px solid #1e4a7a;
  outline-offset: 1px;
}

.ur-result__ref,
.ur-tree__item {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e4a7a;
}

.ur-result__preview {
  margin: 0.15rem 0 0;
  font-size: 0.86rem;
  line-height: 1.4;
  color: #3a4a5c;
}

.ur-tree details {
  margin: 0 0 0.35rem;
}

.ur-tree summary {
  cursor: pointer;
  font-weight: 700;
  color: #0c2848;
  padding: 0.2rem 0;
}

.ur-tree__list {
  list-style: none;
  margin: 0.2rem 0 0.35rem;
  padding: 0 0 0 0.4rem;
}

.ur-tree__item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0.28rem 0.2rem;
  cursor: pointer;
  font-weight: 600;
}

.ur-reader {
  min-width: 0;
  width: 100%;
  padding: 1.1rem 1rem 1rem;
  border: 1px solid #e6ddd0;
  border-radius: 16px;
  background: #fffef9;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ur-reader__corpus,
.ur-reader__meta {
  margin: 0;
  font-size: 0.88rem;
  color: #4a5a6c;
}

.ur-reader__title {
  margin: 0.15rem 0 0;
  font-size: 1.18rem;
  color: #0c2848;
}

.ur-verse {
  font-size: 1.32rem;
  line-height: 1.75;
  color: #0c2848;
}

.ur-verse p {
  margin: 0 0 0.35rem;
}

.ur-speaker {
  font-size: 0.95rem;
  font-style: italic;
  color: #4a5a6c;
}

.ur-verse .is-active,
.ur-speaker.is-active {
  background: #f4efe3;
}

.ur-translit,
.ur-meaning,
.ur-aid,
.ur-expert {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.55;
}

.ur-field-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a6a58;
  margin-bottom: 0.2rem;
}

.ur-reader .llm-card-actions-mount {
  margin-top: 0.85rem;
}

.ur-listen-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.ur-listen-row > :only-child {
  grid-column: 1 / -1;
}

.ur-media-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
  margin-top: 0.35rem;
}

.ur-media-controls > :only-child {
  grid-column: 1 / -1;
}

.ur-speed,
.ur-voice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: 0.4rem 0 0;
  min-height: 2.75rem;
}

.ur-media-controls .ur-voice,
.ur-media-controls .ur-speed {
  margin-top: 0;
}

.ur-speed-label,
.ur-voice-label {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 650;
  color: #5a4a3a;
}

.ur-speed-select,
.ur-voice-select {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 2.75rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid #c9b896;
  border-radius: 8px;
  background: #fffef9;
  color: #0c2848;
  font-size: 1rem;
  -webkit-appearance: auto;
  appearance: auto;
}

.ur-reader__listen .ur-audio-note,
.ur-reader__listen .ur-expert {
  grid-column: 1 / -1;
  margin-top: 0.35rem;
}

.ur-reader__listen .ur-expert {
  font-size: 0.9rem;
  color: #5a4a3a;
}

.ur-listen-btn,
.ur-practice-link,
.ur-nav-btn {
  box-sizing: border-box;
  min-width: 0;
  min-height: 2.6rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

.ur-listen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid #c9b896;
  background: #f4efe3;
  color: #0c2848;
}

.ur-practice-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #1e4a7a;
  background: #1e4a7a;
  color: #faf8f2;
  text-decoration: none;
}

.ur-reader__nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid #e6ddd0;
}

.ur-nav-btn {
  border: 1px solid #c9b896;
  border-radius: 8px;
  background: transparent;
  color: #3a4a5c;
}

.ur-nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.ur-audio-note {
  margin: 0;
  font-size: 0.58rem;
  color: #b0a090;
}

.ur-expert a {
  color: #1e4a7a;
}

.ur-nav-backdrop {
  display: none;
}

@media (min-width: 901px) {
  .ur-contents-btn {
    display: none;
  }

  .ur-nav-panel[hidden] {
    display: block !important;
  }
}

@media (max-width: 900px) {
  .ur-main {
    max-width: none;
    padding: 0.75rem 0.7rem 2.4rem;
  }

  .ur-shell {
    display: block;
  }

  .ur-nav-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(12, 40, 72, 0.38);
    z-index: 20;
  }

  .ur-nav-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: min(22rem, 92vw);
    height: 100vh;
    max-height: none;
    z-index: 21;
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .ur-nav-panel.is-open {
    transform: translateX(0);
  }

  .ur-nav-close {
    display: inline-flex;
    align-items: center;
  }

  .ur-reader {
    width: 100%;
  }

  .ur-verse {
    font-size: 1.2rem;
    line-height: 1.7;
  }
}

@media (max-width: 430px) {
  .ur-hero {
    padding: 1rem 0.75rem 0.9rem;
  }

  .ur-toolbar {
    flex-wrap: wrap;
  }

  .ur-contents-btn {
    width: 100%;
  }
}
