/* ==========================================================================
   KundaliLens routed explorer (v20261201L)
   Each tab is its own page; long tabs are split into sub-pages with a pager.
   Desktop: content sits in a left column over a dark veil, the 3D subject is
   framed in the open area to its right, and nothing inside the column scrolls.
   Phones: compact header, bottom tab bar, the scene in a band at the top and
   the page flowing below it (one page scroll, no nested scrollers).
   ========================================================================== */

:root {
  --hdr-h: clamp(60px, 8.4vh, 76px);
  --gutter: clamp(24px, 2.6vw, 40px);
  --card-w: clamp(470px, 43vw, 660px);
  --card-gap: clamp(14px, 2.4vh, 24px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Explorer shell (overrides the old stacked layout) ---------- */

#explorer.screen--explorer {
  display: block;
  padding: 0;
  overflow: hidden;
}

#explorer.screen--explorer[hidden] {
  display: none;
}

#explorer .explorer-veil {
  background:
    linear-gradient(90deg, rgba(3, 3, 5, 0.9) 0, rgba(3, 3, 5, 0.82) calc(var(--gutter) + var(--card-w) - 40px), rgba(3, 3, 5, 0.38) calc(var(--gutter) + var(--card-w) + 120px), rgba(3, 3, 5, 0) calc(var(--gutter) + var(--card-w) + 320px)),
    linear-gradient(180deg, rgba(3, 3, 5, 0.6) 0, rgba(3, 3, 5, 0) calc(var(--hdr-h) + 40px));
}

#explorer[data-hud="sky"] .explorer-veil,
#explorer[data-hud="match"] .explorer-veil {
  background:
    linear-gradient(90deg, rgba(3, 3, 5, 0.9) 0, rgba(3, 3, 5, 0.82) calc(var(--gutter) + var(--card-w) - 40px), rgba(3, 3, 5, 0.38) calc(var(--gutter) + var(--card-w) + 120px), rgba(3, 3, 5, 0) calc(var(--gutter) + var(--card-w) + 320px)),
    linear-gradient(180deg, rgba(3, 3, 5, 0.6) 0, rgba(3, 3, 5, 0) calc(var(--hdr-h) + 40px)),
    linear-gradient(0deg, rgba(3, 3, 5, 0.78) 0, rgba(3, 3, 5, 0) 30%);
}

/* ---------- Header ---------- */

.kl-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--hdr-h);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
}

/* Glass lives on a pseudo-element so the fixed bottom tab bar (phones) is not
   trapped by a backdrop-filter containing block. */
.kl-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 4, 6, 0.78), rgba(5, 4, 6, 0.5));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}

.kl-header .brand-back-btn {
  justify-self: start;
  gap: 12px;
  padding: 8px 6px 8px 0;
  border-radius: 8px;
}

.kl-header .brand-back-btn:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 4px;
}

.kl-header .brand-wordmark {
  font-size: 13px;
  letter-spacing: 0.24em;
}

.kl-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.4vw, 40px);
  height: 100%;
}

#explorer .mode-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 2px;
  border: 0;
  color: rgba(245, 239, 233, 0.6);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 200ms ease;
}

#explorer .mode-btn:hover {
  color: var(--text);
}

#explorer .mode-btn.is-active {
  color: #fff;
  border: 0;
}

#explorer .mode-btn:focus-visible {
  outline: none;
  color: #fff;
}

#explorer .mode-btn:focus-visible .mode-btn__long {
  outline: 2px solid var(--saffron);
  outline-offset: 6px;
  border-radius: 3px;
}

.mode-btn__ico,
.mode-btn__short {
  display: none;
}

.kl-nav__ink {
  position: absolute;
  left: 0;
  bottom: calc(50% - 17px);
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--mars-bright), var(--saffron));
  box-shadow: 0 0 12px rgba(245, 154, 74, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: transform 520ms var(--ease-out), width 520ms var(--ease-out), opacity 200ms ease;
}

.kl-header__right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.kl-tonight {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 300px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  transition: border-color 200ms ease, background-color 200ms ease;
}

.kl-tonight:hover {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.06);
}

.kl-tonight:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 2px;
}

.kl-tonight .live-dot {
  flex: none;
}

.kl-tonight__k {
  flex: none;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--green);
}

.kl-tonight__v {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(245, 239, 233, 0.86);
}

#explorer .plans-pill--bar {
  min-height: 32px;
  padding: 6px 16px;
  font-size: 10.5px;
}

/* ---------- Page column ---------- */

#explorer #explorerPanel {
  position: fixed;
  top: calc(var(--hdr-h) + var(--card-gap));
  bottom: clamp(16px, 2.6vh, 28px);
  left: var(--gutter);
  width: var(--card-w);
  max-width: none;
  max-height: none;
  z-index: 18;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.pg-head {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 clamp(12px, 2.2vh, 22px);
}

.pg-head__main {
  min-width: 0;
}

.pg-head__aside {
  flex: none;
  display: flex;
  justify-content: flex-end;
}

/* City pickers for My Day and Tonight's Moon live in the page head. */
.pg-head__aside .day-ctx {
  display: none;
}

#explorer[data-section="day"] .pg-head__aside .day-ctx[data-for="day"],
#explorer[data-section="moon"] .pg-head__aside .day-ctx[data-for="panchang"] {
  display: flex;
}

.pg-kicker {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--mars-soft);
}

.pg-title {
  margin: 0;
  font-family: "Space Grotesk", var(--font-sans);
  font-weight: 500;
  font-size: clamp(24px, min(2.3vw, 4.2vh), 36px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: #fff;
}

.pg-title:focus {
  outline: none;
}

/* The heading only receives focus programmatically on page change. */
.pg-title:focus-visible {
  outline: none;
}

.pg-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#explorer .tab-panel {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#explorer .tab-panel[hidden],
#explorer [data-sub][hidden] {
  display: none !important;
}

.pg-sub {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.pg-lede {
  margin: 0;
  max-width: 52ch;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.pg-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 14px;
}

.pg-empty[hidden] {
  display: none;
}

.pg-empty p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.pg-empty .btn-mars-primary {
  flex: none;
  text-decoration: none;
  text-align: center;
  padding: 11px 18px;
}

/* ---------- Pager ---------- */

.pg-pager {
  flex: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: clamp(8px, 1.4vh, 14px);
  padding-top: clamp(8px, 1.4vh, 12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pg-pager[hidden] {
  display: none;
}

.pg-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  max-width: 100%;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.pg-btn svg {
  flex: none;
}

.pg-btn__txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-btn:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.07);
}

.pg-btn--prev {
  grid-column: 1;
  justify-self: start;
}

.pg-btn--next {
  grid-column: 3;
  justify-self: end;
}

.pg-btn--next:hover svg {
  transform: translateX(2px);
}

.pg-btn--prev:hover svg {
  transform: translateX(-2px);
}

.pg-btn svg {
  transition: transform 180ms ease;
}

.pg-btn.is-cta {
  border-color: var(--mars-bright);
  background: var(--mars);
  color: #fff;
}

.pg-btn.is-cta:hover {
  background: var(--mars-bright);
}

.pg-btn[hidden] {
  display: none;
}

.pg-btn:focus-visible,
.pg-dot:focus-visible,
.pg-mini:focus-visible,
.pg-sheet__close:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 2px;
}

.pg-steps {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.pg-dots {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pg-dot {
  appearance: none;
  position: relative;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.pg-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  transition: width 320ms var(--ease-out), margin 320ms var(--ease-out), background-color 200ms ease;
}

.pg-dot:hover::after {
  background: rgba(255, 255, 255, 0.6);
}

.pg-dot[aria-current="step"] {
  width: 30px;
}

.pg-dot[aria-current="step"]::after {
  width: 22px;
  margin-left: -11px;
  background: var(--saffron);
}

.pg-count {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--dim);
  white-space: nowrap;
}

/* ---------- Drawer sheet (an opened <details> inside the column) ---------- */

.pg-sheet {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 8, 10, 0.97);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: pgSheetIn 320ms var(--ease-out);
}

.pg-sheet[hidden] {
  display: none;
}

.pg-sheet__head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.pg-sheet__title {
  margin: 0;
  font-family: "Space Grotesk", var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
}

.pg-sheet__close {
  appearance: none;
  flex: none;
  min-height: 34px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.pg-sheet__close:hover {
  border-color: rgba(255, 255, 255, 0.36);
}

.pg-sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.pg-sheet__body > * {
  margin-top: 0 !important;
}

.pg-sheet__body .planet-table {
  font-size: 12.5px;
}

.pg-sheet__body .planet-table th,
.pg-sheet__body .planet-table td {
  padding: 7px 8px;
}

.pg-sheet__body .day-fine,
.pg-sheet__body .science-footnote {
  font-size: 12.5px;
  line-height: 1.6;
}

@keyframes pgSheetIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Summaries of drawers read as buttons that open the sheet. */
#pgBody details > summary {
  list-style: none;
}

#pgBody details > summary::-webkit-details-marker {
  display: none;
}

#pgBody .tech-drawer,
#pgBody .day-more {
  padding: 0;
  border: 0;
}

#pgBody .tech-drawer > summary,
#pgBody .day-more > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease;
}

#pgBody .tech-drawer > summary::after,
#pgBody .day-more > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.7;
}

#pgBody .tech-drawer > summary:hover,
#pgBody .day-more > summary:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.3);
}

#pgBody .tech-drawer > summary:focus-visible,
#pgBody .day-more > summary:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 2px;
}

/* ---------- Forms: roomier controls in the wide column ---------- */

#explorer .compact-form {
  gap: 14px;
}

#explorer .form-row {
  gap: 12px;
}

#explorer .field {
  gap: 6px;
}

#explorer .field label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#explorer .form-actions {
  gap: 10px;
  margin-top: 6px;
}

#explorer .form-actions .btn-mars-primary {
  min-height: 46px;
  font-size: 12.5px;
  letter-spacing: 0.14em;
}

#explorer .form-actions .btn-ghost-sm {
  min-height: 46px;
  padding: 8px 18px;
}

#panelChart > [data-sub="form"] {
  flex: 1 1 auto;
}

.sky-promise {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: auto 0 0;
  padding: 16px 0 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.sky-promise li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sky-promise b {
  font-family: "Space Grotesk", var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.sky-promise span {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- My Sky results ---------- */

#explorer #chartResults.res-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 18px 22px;
  align-items: start;
  margin: 0;
  padding: 0;
  border: 0;
}

#explorer #chartResults.res-grid.is-hidden {
  display: none !important;
}

.res-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.res-col:empty {
  display: none;
}

.res-col .insight-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.res-col .insight-card__val {
  font-size: 13.5px;
  line-height: 1.35;
}

.res-col .chapter-callout__text {
  font-size: 13px;
}

/* ---------- My Day ---------- */

.day-ctx {
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.day-ctx__txt {
  display: none;
}

.day-ctx__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.day-where--inline {
  display: flex;
  flex-direction: column !important;
  align-items: stretch;
  gap: 5px !important;
  margin: 0 !important;
  min-width: 0;
}

.day-where--inline > label {
  font-size: 9.5px !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase;
  color: var(--dim) !important;
  white-space: nowrap;
}

.day-where--inline .kl-combo,
.day-where--inline select {
  width: clamp(170px, 15vw, 220px);
}

.day-ctx__row .panel-tag {
  align-self: flex-end;
  margin-bottom: 10px;
}

/* A routed day page is the card itself: drop the inner card chrome. */
#explorer #dayContent > .day-card,
#explorer #tonightContent > .day-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  gap: 14px;
}

#explorer #dayContent .day-card__kicker,
#explorer #tonightContent .day-card__kicker {
  display: none;
}

#explorer .day-card__title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
}

#explorer #dayContent,
#explorer #tonightContent {
  gap: 14px;
  margin: 0;
}

#explorer .day-foot {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 0;
}

#explorer .day-foot .btn-mars-outline {
  width: auto;
  padding: 8px 16px;
}

/* Glance: hero + chips on the left, lucky cells on the right. */
#explorer #dayGlance {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 22px;
  align-items: start;
}

#explorer #dayGlance > .day-card__head,
#explorer #dayGlance > .glance,
#explorer #dayGlance > .chip-row {
  grid-column: 1 / -1;
}

#explorer #dayGlance > .lucky {
  grid-column: 2;
  grid-row: 4 / span 4;
  grid-template-columns: 1fr;
}

#explorer #dayGlance > .glance__guide,
#explorer #dayGlance > .day-more,
#explorer #dayGlance > .day-share,
#explorer #dayGlance > .day-fine {
  grid-column: 1;
}

#explorer #dayGlance > .lucky .lucky__cell--colours,
#explorer #dayGlance > .lucky .lucky__cell--dir {
  grid-column: 1 / -1;
}

#explorer .glance__label {
  font-size: 24px;
}

/* Good times: the two window lists side by side. */
#explorer #dayTimes .win-cols,
#explorer #tonightTimes .win-cols {
  grid-template-columns: 1fr 1fr;
}

/* Calendar: grid on the left, the chosen day on the right. */
#explorer #dayCalendar {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px 22px;
  align-items: start;
}

#explorer #dayCalendar > .day-card__head {
  grid-column: 1 / -1;
  grid-row: 1;
}

#explorer #dayCalendar > .cal-legend:not(.cal-legend--mk) {
  grid-column: 1;
  grid-row: 2;
}

#explorer #dayCalendar > .cal-legend--mk {
  grid-column: 2;
  grid-row: 2;
}

#explorer #dayCalendar > .cal-grid {
  grid-column: 1;
  grid-row: 3;
}

#explorer #dayCalendar > .cal-detail {
  grid-column: 2;
  grid-row: 3;
}

#explorer #dayCalendar > .cal-upsell {
  grid-column: 1;
  grid-row: 4;
}

#explorer #dayCalendar > .day-more {
  grid-column: 2;
  grid-row: 4;
}

/* Doshas: four cards in a 2 x 2 grid. */
#explorer #dayDoshas .dosha-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Transits: slow and fast movers side by side, highlights below. */
#explorer #dayTransits {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px 18px;
  align-items: start;
}

#explorer #dayTransits > * {
  grid-column: 1 / -1;
}

#explorer #dayTransits > .tr-col--slow {
  grid-column: 1;
}

#explorer #dayTransits > .tr-col--fast {
  grid-column: 2;
}

.tr-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#explorer #dayTransits .hl-grid {
  grid-template-columns: 1fr 1fr;
}

/* Numerology: four tiles per row. */
#explorer #dayNumbers .num-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Remedies: two cards per row. */
#explorer #dayRemedies .rem-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- Ask Jyotish ---------- */

#panelChat .chat-top {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

#panelChat .quick-hooks {
  margin: 0;
}

#panelChat .lang-toggle {
  flex: none;
}

#explorer #chatMessages.chat-feed {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: none;
  overflow: hidden;
  margin: 0;
  display: block;
}

.chat-turn {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-turn[hidden],
.chat-para[hidden] {
  display: none;
}

.chat-bubble--bot {
  max-width: 100%;
}

.chat-para {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.6;
}

.chat-para:last-child {
  margin-bottom: 0;
}

.chat-para strong {
  color: #fff;
  font-weight: 600;
}

.chat-para em {
  color: var(--sand);
}

.chat-bubble--pending {
  color: var(--muted);
  font-style: italic;
}

.chat-nav {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.chat-nav[hidden] {
  display: none;
}

.chat-nav__label {
  min-width: 190px;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.pg-mini {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.pg-mini:disabled {
  opacity: 0.35;
  cursor: default;
}

#explorer .chat-input-row {
  flex: none;
}

#explorer .chat-input-row input {
  min-height: 46px;
  font-size: 14px;
}

#explorer .chat-input-row .btn-mars-primary {
  min-width: 84px;
}

#explorer #chatCitationsDrawer {
  flex: none;
}

/* ---------- Match ---------- */

#explorer .match-mode-switch {
  margin: 0;
}

#explorer .match-person {
  padding: 12px;
  gap: 8px;
}

#explorer #matchResults {
  margin: 0;
  padding: 0;
  border: 0;
  gap: 16px;
}

#explorer #matchResults.match-res {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(150px, 15vw, 224px);
  gap: 26px;
  align-items: start;
}

#explorer #matchResults.match-res.is-hidden {
  display: none !important;
}

.match-res__main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.match-res__card {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.match-res__card figcaption {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

.match-card-preview {
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  background: linear-gradient(180deg, #0a0f2e, #160d36);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.match-card-preview canvas {
  display: block;
  width: 100%;
  height: auto;
}

#explorer .match-score-num {
  font-size: clamp(56px, 7vh, 76px);
  font-weight: 200;
}

#explorer .match-score-num small {
  font-size: 22px;
}

#explorer .match-score-meta {
  gap: 6px;
  font-size: 15px;
}

#explorer #gunaBandBadge {
  font-family: "Space Grotesk", var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  color: var(--gold);
}

#explorer #matchSummaryHeadline {
  font-size: 14.5px;
  line-height: 1.6;
}

#explorer .share-row {
  flex-wrap: wrap;
  gap: 10px;
}

#explorer .share-row > * {
  flex: 1 1 auto;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.koota-page {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.koota-page__col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

#explorer .koota-mini-grid {
  grid-template-columns: 1fr;
  gap: 6px;
}

#explorer .koota-mini-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 38px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
}

.koota-mini-item__name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.koota-mini-item__name small {
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.koota-mini-item__bar {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.koota-mini-item__bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #c59bff, var(--gold));
}

#explorer .koota-mini-item strong {
  text-align: right;
}

#explorer #matchPromptsList {
  font-size: 13px;
  line-height: 1.55;
  gap: 8px;
}

/* ---------- Tonight's Moon ---------- */

.sleep-page {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sleep-page .chapter-callout .cite-list {
  font-size: 13px;
  line-height: 1.55;
  gap: 8px;
  color: var(--text);
}

.sleep-study {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sleep-study .science-footnote {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

#panelPanchang [data-sub="tonight"] .insight-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ---------- Bottom HUD: giant title + dasha bar (My Sky results, Match result) ---------- */

#explorer .hud-display-counter,
#explorer .dasha-scrubber {
  display: none;
}

#explorer[data-hud="sky"] .hud-display-counter,
#explorer[data-hud="match"] .hud-display-counter {
  display: block;
  left: calc(var(--gutter) + var(--card-w) + 48px);
}

#explorer[data-hud="match"] .hud-display-counter {
  bottom: clamp(16px, 2.6vh, 28px);
}

#explorer[data-hud="sky"] .dasha-scrubber {
  display: flex;
  left: calc(var(--gutter) + var(--card-w) + 48px);
  right: var(--gutter);
  bottom: clamp(16px, 2.6vh, 28px);
  height: 52px;
  padding: 6px 8px 6px 12px;
  gap: 10px;
  border-radius: 12px;
}

#explorer .dasha-track {
  overflow: hidden;
  gap: 4px;
  align-self: stretch;
}

#explorer .dasha-node {
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  padding: 3px 8px;
  font-size: 10px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
}

#explorer .dasha-node b {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  color: inherit;
}

#explorer .dasha-node span {
  font-family: var(--font-mono);
  font-size: 9px;
  opacity: 0.75;
}

@media (max-width: 1400px) {
  #explorer .dasha-scrubber__label {
    display: none;
  }

  #explorer .dasha-node {
    padding: 3px 6px;
  }
}

#explorer .dasha-scrubber__label {
  width: 64px;
  white-space: normal;
  font-size: 9px;
  line-height: 1.3;
  letter-spacing: 0.14em;
}

#explorer[data-hud="sky"] .hud-display-counter {
  bottom: calc(clamp(16px, 2.6vh, 28px) + 52px + 14px);
}

#explorer .hud-display-counter__big {
  font-size: clamp(2.4rem, min(5vw, 8vh), 4.4rem);
}

/* ---------- Medium desktop widths ---------- */

.kl-tonight__v {
  max-width: 190px;
}

/* Below this the Moon tab carries tonight's sky; the header stays uncluttered. */
@media (max-width: 1360px) {
  .kl-tonight {
    display: none;
  }
}

@media (max-width: 1080px) {
  .kl-tonight {
    display: none;
  }

  .kl-header .brand-wordmark {
    display: none;
  }
}

/* ---------- Regional calendars (v20261201L) ---------- */

.native {
  margin-left: 0.5em;
  color: var(--sand);
  font-weight: 500;
}

#panelPanchang > .pg-sub { flex-shrink: 0; }

.reg {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 8px 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(245, 154, 74, 0.22);
  background: linear-gradient(90deg, rgba(245, 154, 74, 0.08), rgba(245, 154, 74, 0.01));
}

.reg__txt {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.reg .trad-switch { flex: none; flex-wrap: nowrap; }

.reg__native {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.reg__label {
  font-size: 11.5px;
  color: var(--muted);
}

.reg__note {
  margin: 0;
  padding: 8px 12px;
  border-left: 2px solid var(--saffron);
  border-radius: 0 8px 8px 0;
  background: rgba(245, 154, 74, 0.08);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.reg__note--soft {
  border-left-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.trad-switch--sm {
  padding: 3px;
  gap: 2px;
}

.trad-switch--sm .trad-chip {
  min-height: 28px;
  line-height: 28px;
  padding: 0 9px;
  font-size: 11.5px;
}

.day-sub {
  margin: 4px 0 0;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--sand);
}

/* ---------- MY DAY: Today for you ---------- */

#explorer #dayGlance > .tfy { grid-column: 1 / -1; }

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

.tfy__cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.tfy__cell--good { border-top-color: var(--gold); }
.tfy__cell--mixed { border-top-color: var(--sand); }
.tfy__cell--caution { border-top-color: #e07a6c; background: rgba(214, 92, 80, 0.07); }

.tfy__k {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

.tfy__v {
  font-size: 15px;
  font-weight: 600;
}

.tfy__v em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
}

.tfy__cell--good .tfy__v { color: var(--gold); }
.tfy__cell--caution .tfy__v { color: #f1a195; }

.tfy__s {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.tfy__n {
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--dim);
}

/* ---------- Good times: for you + Nalla Neram strips ---------- */

.foryou,
.nalla {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(245, 199, 107, 0.28);
  background: linear-gradient(90deg, rgba(245, 199, 107, 0.09), rgba(245, 199, 107, 0.015));
}

.nalla {
  border-color: rgba(245, 154, 74, 0.28);
  background: linear-gradient(90deg, rgba(245, 154, 74, 0.09), rgba(245, 154, 74, 0.015));
}

.foryou__k,
.nalla__k {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.nalla__k { color: var(--saffron); }
.nalla__k .native { letter-spacing: 0; font-size: 11px; }

.nalla__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.nalla__more,
.foryou__more {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--dim);
}

.foryou__row,
.nalla__row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.foryou__w,
.nalla__w {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.foryou__w b,
.nalla__w b {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
}

.foryou__w span,
.nalla__w span {
  font-size: 10.5px;
  color: var(--muted);
}

.nalla__w .native { margin-left: 0.35em; font-size: 10.5px; }

.foryou__w.is-now,
.nalla__w.is-now { border-color: rgba(255, 255, 255, 0.55); }

.foryou__w.is-past,
.nalla__w.is-past { opacity: 0.45; }

.foryou__empty {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------- Festivals (#/moon/festivals) ---------- */

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

.fest__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fest__status:empty { display: none; }

.fest__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.fest__it {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.fest__it:first-child { border-top: 0; }

.fest__date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  height: 52px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.fest__date span { font-size: 8.5px; letter-spacing: 0.12em; color: var(--dim); }
.fest__date b { font-size: 18px; font-weight: 600; line-height: 1; }

.fest__it--festival .fest__date { border-color: rgba(245, 154, 74, 0.5); background: rgba(245, 154, 74, 0.1); }
.fest__it--ekadashi .fest__date { border-color: rgba(245, 199, 107, 0.4); }

.fest__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.fest__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.fest__name { font-size: 15px; font-weight: 600; }

.fest__cat,
.fest__in {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--dim);
}

.fest__in { color: var(--saffron); }

.fest__meta {
  font-size: 12px;
  color: var(--muted);
}

.fest__cmp {
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.fest__cmp.is-diff { color: var(--saffron); }

.fest__why { margin-left: auto; border-top: 0; padding-top: 0; }
.fest__why[open] { flex-basis: 100%; }
#explorer .fest__why > summary { font-size: 11.5px; padding: 3px 10px; }

.fest__filters .lang-btn {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
}

.fest__filters .lang-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); }

.fest__filters .lang-btn.is-active {
  background: var(--saffron);
  border-color: var(--saffron);
  color: #1a0e05;
}

.fest__whytxt { color: var(--text) !important; }

.fest__empty {
  padding: 14px 0;
  font-size: 13px;
  color: var(--muted);
}

.fest__nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fest__count {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--dim);
}

.fest__foot { margin-top: -4px; }

/* ==========================================================================
   Phones, portrait tablets and very short screens
   ========================================================================== */

@media (max-width: 767.98px), (max-width: 1023.98px) and (orientation: portrait), (max-height: 499.98px) {
  :root {
    --hdr-h: 56px;
    --gutter: 12px;
    --tabbar-h: 64px;
  }

  /* One page scroll; nothing nested scrolls. */
  #explorer.screen--explorer {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  #explorer .explorer-veil,
  #explorer[data-hud] .explorer-veil {
    background: linear-gradient(180deg, rgba(3, 3, 5, 0.55) 0, rgba(3, 3, 5, 0) 90px, rgba(3, 3, 5, 0) 30%, rgba(3, 3, 5, 0.7) 70%);
  }

  .kl-header {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 0 14px;
  }

  .kl-header .brand-wordmark {
    display: inline;
    font-size: 12px;
  }

  .kl-header__right {
    grid-column: 3;
  }

  .kl-tonight {
    display: none;
  }

  /* Bottom tab bar: all five pages, no clipping. */
  .kl-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    background: rgba(8, 6, 8, 0.94);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  #explorer .mode-btn {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    height: 100%;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 11px;
    letter-spacing: 0.02em;
    color: rgba(245, 239, 233, 0.62);
  }

  #explorer .mode-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 28%;
    right: 28%;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--saffron);
    transform: scaleX(0);
    transition: transform 320ms var(--ease-out);
  }

  #explorer .mode-btn.is-active {
    color: var(--saffron);
  }

  #explorer .mode-btn.is-active::before {
    transform: scaleX(1);
  }

  .mode-btn__ico {
    display: block;
    line-height: 0;
  }

  .mode-btn__short {
    display: block;
  }

  .mode-btn__long,
  .kl-nav__ink {
    display: none;
  }

  #explorer .mode-btn:focus-visible {
    outline: 2px solid var(--saffron);
    outline-offset: -4px;
    border-radius: 10px;
  }

  /* The page flows below a band that keeps the scene in view. */
  #explorer #explorerPanel {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    width: auto;
    margin: calc(var(--hdr-h) + 34vh) 10px calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom, 0px));
    padding: 22px 16px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(8, 6, 8, 0.9);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    overflow: visible;
  }

  .pg-title {
    font-size: 26px;
  }

  .pg-body,
  #explorer .tab-panel {
    height: auto;
    overflow: visible;
  }

  #explorer #chatMessages.chat-feed {
    min-height: 0;
  }

  .pg-pager {
    position: sticky;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    z-index: 4;
    margin: 16px -16px -16px;
    padding: 10px 12px;
    border-radius: 0 0 20px 20px;
    background: rgba(8, 6, 8, 0.96);
  }

  .pg-btn {
    min-height: 44px;
    padding: 8px 12px;
  }

  .pg-btn__txt {
    max-width: 168px;
  }

  .pg-btn--prev {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .pg-btn--prev .pg-btn__txt {
    display: none;
  }

  .pg-count {
    display: none;
  }

  .pg-dot {
    width: 14px;
    height: 24px;
  }

  .pg-dot[aria-current="step"] {
    width: 22px;
  }

  .pg-dot[aria-current="step"]::after {
    width: 16px;
    margin-left: -8px;
  }

  /* Single-column content on phones. */
  #explorer #chartResults.res-grid,
  #explorer #matchResults.match-res,
  #explorer #dayGlance,
  #explorer #dayCalendar,
  #explorer #dayTransits,
  .koota-page,
  .sleep-page {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .sky-promise {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 8px;
  }

  #explorer #dayDoshas .dosha-grid,
  #explorer #dayRemedies .rem-list,
  #explorer #dayTransits .hl-grid,
  #explorer #dayTimes .win-cols,
  #explorer #tonightTimes .win-cols {
    grid-template-columns: 1fr;
  }

  #panelPanchang [data-sub="tonight"] .insight-grid {
    grid-template-columns: 1fr 1fr;
  }

  .match-res__card {
    width: 62%;
    align-self: center;
  }

  .pg-head {
    flex-direction: column;
    align-items: stretch;
  }

  .pg-head__aside,
  .day-ctx,
  .day-ctx__row,
  .day-where--inline {
    width: 100%;
  }

  .day-ctx {
    align-items: stretch;
  }

  .day-where--inline {
    flex: 1 1 auto;
  }

  .day-where--inline .kl-combo,
  .day-where--inline select {
    width: auto;
  }

  #panelChat .chat-top {
    flex-direction: column-reverse;
  }

  #explorer .hud-display-counter,
  #explorer .dasha-scrubber,
  #explorer[data-hud] .hud-display-counter,
  #explorer[data-hud] .dasha-scrubber {
    display: none;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .kl-nav__ink,
  .pg-dot::after,
  .pg-btn,
  .pg-btn svg,
  #explorer .mode-btn::before {
    transition: none;
  }

  .pg-sheet {
    animation: none;
  }
}

/* Regional calendar + festivals on phones (v20261201L) */
@media (max-width: 767.98px), (max-width: 1023.98px) and (orientation: portrait), (max-height: 499.98px) {
  .reg { flex-wrap: wrap; }
  .reg .trad-switch { flex-wrap: wrap; }
  .tfy { grid-template-columns: 1fr; }
  .fest__it { grid-template-columns: 46px minmax(0, 1fr); gap: 12px; }
  .fest__date { height: 48px; }
}

/* Drawer buttons under the Good times lists share one row. */
.more-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.foryou__more {
  align-self: center;
  padding: 0 4px;
}

.glance__txt .chip-row { margin-top: 4px; }

.more-row > details[open] { flex-basis: 100%; }
