[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
}

body {
  display: block;
  padding: 0 var(--inset) env(safe-area-inset-bottom);
}

.app-container {
  width: 100%;
  max-width: none;
  background-color: var(--panel);
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  border: none;
  position: relative;
}

.scene-col {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--page);
}

.scene-banner-container {
  width: 100%;
  position: relative;
  background-color: var(--page);
  border-bottom: 2px solid var(--gold);
}

.scene-banner-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: center top;
}

.scene-banner-next {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.65s ease;
}

.scene-banner-next.is-in {
  opacity: 1;
}

.scene-under {
  width: 100%;
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.app-copy {
  width: 100%;
}

.hero-section {
  width: 100%;
  background:
    radial-gradient(ellipse at center, var(--hero-a) 0%, var(--hero-b) 55%, var(--hero-c) 100%);
  border-bottom: 2px solid var(--gold);
}

.hero-overlay {
  padding: 28px var(--copy-pad) 24px;
  text-align: center;
  width: 100%;
  overflow: visible;
}

.verse-tag {
  display: inline-block;
  background-color: var(--shloka);
  color: #fff8dc;
  border: 1px solid var(--gold);
  padding: 5px 16px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.shloka-text {
  font-family: "Tiro Devanagari Sanskrit", serif;
  color: var(--shloka);
  font-size: clamp(1.45rem, 4.4vw, var(--type-shloka));
  font-weight: 400;
  line-height: 1.9;
  margin: 16px 0 0;
  white-space: pre-line;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

::spelling-error,
::grammar-error {
  text-decoration: none;
}

.content-section {
  padding: 22px var(--copy-pad) 28px;
}

.text-block {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.text-block h3 {
  color: var(--heading);
  font-family: "Cinzel", serif;
  font-size: 0.85rem;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 700;
}

.character-section h3 {
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 1.4px;
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 700;
}

.text-block p {
  color: var(--ink);
  font-size: var(--type-body);
  line-height: 1.7;
}

.devanagari-text {
  font-family: "Tiro Devanagari Sanskrit", serif;
  font-size: var(--type-deva);
  font-weight: 400;
  line-height: 1.75;
}

.character-section {
  margin-top: 8px;
}

.character-pills-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
  overflow: visible;
}

.character-pill-btn {
  font: inherit;
  background-color: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--gold);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  text-decoration: none;
}

.character-pill-btn:hover,
.character-pill-btn:focus-visible {
  background-color: var(--gold);
  color: var(--btn-on-ink);
  outline: none;
}

.pill-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  flex-shrink: 0;
  background: #000;
}

.pill-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pill-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.pill-sanskrit {
  font-family: "Tiro Devanagari Sanskrit", serif;
  font-size: 0.95rem;
  opacity: 0.92;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 999;
  display: none;
  backdrop-filter: blur(2px);
}

.modal-overlay.active {
  display: block;
}

.character-modal {
  position: fixed;
  top: 0;
  right: 0;
  width: min(100%, 440px);
  height: 100%;
  max-height: 100dvh;
  background-color: var(--card);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.85);
  z-index: 1000;
  transform: translateX(110%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  padding: 28px 18px 40px;
  border-left: 1px solid var(--line);
}

.character-modal.active {
  transform: translateX(0);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  background: none;
  border: none;
  color: #999;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  z-index: 2;
}

.char-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 16px;
  clear: both;
}

.char-card-avatar {
  width: 112px;
  height: 140px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--gold);
  flex-shrink: 0;
  background: #000;
}

.char-name {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
}

.char-sskrt {
  font-family: "Tiro Devanagari Sanskrit", serif;
  color: var(--gold);
  font-size: 1.05rem;
}

.char-role {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.modal-section {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.modal-section-title {
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 700;
}

.modal-text {
  color: var(--ink);
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.modal-list {
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.modal-list li {
  margin-bottom: 6px;
}

.traits-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.trait-tag {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.char-inline {
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hero-section .char-inline {
  color: var(--heading);
}

.char-inline:hover,
.char-inline:focus-visible {
  color: var(--ink);
}

@media (min-width: 640px) {
  :root {
    --gutter: 20px;
    --copy-pad: 28px;
    --inset: 24px;
  }

  .character-pills-container {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 900px) {
  :root {
    --gutter: 20px;
    --copy-pad: 32px;
    --inset: 28px;
  }

  .app-container {
    display: grid;
    grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
    min-height: calc(100vh - var(--bar-h));
    align-items: stretch;
  }

  .scene-col {
    position: sticky;
    top: var(--bar-h);
    align-self: start;
    width: var(--scene-col);
    max-width: 50vw;
    height: calc(100vh - var(--bar-h));
    max-height: calc(100vh - var(--bar-h));
    border-right: 2px solid var(--gold);
    overflow: hidden;
  }

  .scene-banner-container {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    border-bottom: none;
  }

  .scene-banner-img,
  .scene-banner-next {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: none;
    object-fit: contain;
    object-position: center top;
  }

  .scene-under {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    max-height: 46%;
    overflow: auto;
    border-top: 2px solid var(--gold);
    background: var(--panel);
  }

  .app-copy {
    min-width: 0;
    padding-right: var(--gutter);
  }

  .shloka-text {
    font-size: var(--type-shloka);
  }

  .character-modal {
    padding: 36px 24px;
  }
}
