/* Shubhdin web — the app's design system in CSS. Kesari · kumkum · haldi on Banaras
   sandstone, never white; dark mode is the aarti hour. One shape system, one spacing scale,
   one motion tempo. Devanagari: no letter-spacing (it breaks the shirorekha), more leading
   than Latin, tabular numerals on every time. Budget: this file under 24 KB. */

@font-face {
  font-family: "Noto Devanagari";
  src: url("/noto-devanagari.woff2") format("woff2");
  font-weight: 400 700; font-display: swap;
  unicode-range: U+0900-097F, U+A8E0-A8FF, U+1CD0-1CFF, U+200C-200D, U+20B9;
}

:root {
  --kesari: #C2461A; --kesari-tint: #FFDCC3; --kumkum: #9B1B30; --haldi: #C48F1E;
  --ground: #F7EAD7; --surface: #FFF7E8; --sand: #F0DEC2;
  --fg1: #2B1810; --fg2: #6B4E3D; --fg3: #957A68; --line: #DFC39E;
  --good: #1B7A4A; --good-bg: #D9EFDD; --mid: #9A6300; --mid-bg: #FBE8C4; --bad: #A5282E; --bad-bg: #F9DCD6;
  --brass: linear-gradient(180deg, #D7A94A, #B5851E); --on-mark: #FFF7E8;
  --r-sm: 12px; --r: 18px; --quick: 180ms; --std: 280ms;
  --ease: cubic-bezier(.2, 0, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --kesari: #F0A36E; --kesari-tint: #3A1F17; --kumkum: #E36A78; --haldi: #E8C46E;
    --ground: #1B0B0A; --surface: #2A1411; --sand: #3A1F17;
    --fg1: #F7E8D0; --fg2: #CDB397; --fg3: #A88D74; --line: #4A2C22;
    --good: #7FDCA8; --good-bg: #123E2B; --mid: #F2C46A; --mid-bg: #45300A; --bad: #FF9E96; --bad-bg: #4E1714;
    --on-mark: #2B1810;
  }
}
@media (prefers-reduced-motion: reduce) { :root { --quick: 0ms; --std: 0ms; } }

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body {
  font-family: "Noto Devanagari", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Devanagari", Arial, sans-serif;
  font-size: 16px; line-height: 1.65; color: var(--fg1); background: var(--ground);
  -webkit-font-smoothing: antialiased; padding-bottom: 72px;
  background-image: radial-gradient(circle, rgba(155, 27, 48, .07) 1px, transparent 1.2px); background-size: 22px 22px;
}
:lang(en) { line-height: 1.45; }
a { color: var(--kesari); text-decoration: none; }
button { font: inherit; color: inherit; }
main { max-width: 640px; margin: 0 auto; padding: 12px 16px 24px; }
h1 { font-size: 24px; line-height: 1.5; font-weight: 700; margin: 6px 0 2px; }
h1.tagline { font-size: 14px; font-weight: 500; color: var(--fg2); margin: 4px 0 8px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--fg3); margin: 10px 0 4px; }
:lang(en) .eyebrow { letter-spacing: .06em; text-transform: uppercase; }
.eyebrow.section { font-size: 15px; color: var(--fg1); margin: 22px 0 8px; padding-left: 10px; border-left: 3px solid var(--kumkum); line-height: 1.3; }
:lang(en) .eyebrow.section { text-transform: none; letter-spacing: 0; }
.meta { color: var(--fg2); font-size: 14px; margin: 0 2px 10px; }
.lede { color: var(--fg2); font-size: 16px; margin-bottom: 14px; }
.lede.bad { color: var(--bad); }
.quiet { font-size: 13px; color: var(--fg3); margin: 4px 0 8px; }
.legend { font-size: 12.5px; color: var(--fg3); margin-top: 8px; }
.method { font-size: 13.5px; color: var(--fg2); margin: 18px 0 12px; }
.share { text-align: center; margin: 12px 0 0; font-size: 14px; }
.share a { font-weight: 600; }
footer { text-align: center; font-size: 13px; color: var(--fg3); padding: 6px 16px 20px; }
.tnum, .time, .h-time, .t, .kv dd, .week td { font-variant-numeric: tabular-nums; }

/* ---------- top bar: the kesari-to-kumkum band; the city chip is the one control ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 12px; color: #fff;
  background: linear-gradient(100deg, var(--kesari) 0%, var(--kumkum) 100%);
}
@media (prefers-color-scheme: dark) { .topbar { background: linear-gradient(100deg, #7A2A10, #4E0E1A); } }
.brand { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 700; font-size: 19px; line-height: 1.3; flex: none; }
.brand img { border-radius: 50%; background: #fff; }
.brand span { font-size: 12px; font-weight: 500; opacity: .85; }
.citychip {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border: 1px solid rgba(255,255,255,.55); border-radius: 999px;
  background: rgba(255,255,255,.14); color: #fff; cursor: pointer;
}
.citychip .cc-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.citychip .cc-name::after { content: " ▾"; font-weight: 400; opacity: .8; }
.citychip .cc-hint { font-size: 11.5px; opacity: .85; white-space: nowrap; }
html:not([data-city]) .citychip { background: rgba(255,255,255,.28); }
html[data-city] .citychip .cc-hint { display: none; }
.langpill { flex: none; color: #fff; border: 1px solid rgba(255,255,255,.55); border-radius: 999px; padding: 4px 11px; font-size: 14px; line-height: 1.4; font-weight: 600; }

/* ---------- the city sheet ---------- */
.sheet { border: 0; padding: 0 16px 20px; width: 100%; max-width: 640px; margin: auto auto 0; border-radius: var(--r) var(--r) 0 0; background: var(--sand); color: var(--fg1); max-height: 85vh; overflow: auto; }
.sheet::backdrop { background: rgba(43, 24, 16, .45); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 8px 0 6px; position: relative; }
.sheet-head .handle { position: absolute; left: 50%; top: 4px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
.sheet-head h2 { font-size: 19px; margin-top: 10px; flex: 1; }
.sheet-head .close { margin-top: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface); font-size: 22px; line-height: 1; cursor: pointer; }
.search { width: 100%; font: inherit; font-size: 16px; padding: 11px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg1); outline: none; }
.search:focus { border-color: var(--kesari); }
.results { list-style: none; margin: 6px 0 0; }
.results li a { display: block; padding: 9px 6px; border-bottom: 1px solid var(--line); color: var(--fg1); }
.results li a small { color: var(--fg3); }
.results .none { padding: 8px 6px; color: var(--fg3); font-size: 14px; }
.chip.geo { border-color: var(--kesari); color: var(--kesari); font-weight: 600; margin-top: 10px; cursor: pointer; background: transparent; }

/* ---------- bottom nav ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; height: 58px;
  background: var(--surface); border-top: 3px solid; border-image: linear-gradient(90deg, var(--kesari), var(--haldi)) 1;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; color: var(--fg2); line-height: 1.3; }
.bottomnav a[aria-current] { color: var(--kesari); font-weight: 600; }
.nv { width: 22px; height: 22px; border-radius: 50%; background: var(--sand); display: block; }
.bottomnav a[aria-current] .nv { background: var(--kesari); box-shadow: inset 0 0 0 3px var(--kesari-tint); }
@media (min-width: 720px) { .bottomnav { display: none; } body { padding-bottom: 24px; } }

/* ---------- date strip ---------- */
.datestrip { display: flex; gap: 6px; margin: 4px 0 12px; }
.datestrip button { flex: 1; height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; color: var(--fg2); cursor: pointer; font-size: 14px; }
.datestrip button[aria-current] { background: var(--kesari); border-color: var(--kesari); color: #fff; font-weight: 600; }
.datestrip .pick { position: relative; flex: none; width: 44px; height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; display: flex; align-items: center; justify-content: center; }
.datestrip .pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }

/* ---------- card (L1, threshold stripe) ---------- */
.card { background: var(--surface); border-radius: var(--r); padding: 12px 12px 14px; border-top: 4px solid; border-image: linear-gradient(90deg, var(--kesari), var(--haldi)) 1; box-shadow: 0 2px 10px rgba(43, 24, 16, .06); }
.card + .card, section.day + .card, .hero + .card, .card + .hero, .timeline + .card { margin-top: 12px; }
a.card { display: block; color: inherit; }
.card .eyebrow:first-child { margin-top: 0; }

/* ---------- the answer line ---------- */
.hero { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--kesari-tint); border-radius: var(--r-sm); padding: 10px 14px; margin: 0 0 12px; font-size: 18px; font-weight: 600; min-height: 51px; }
.hero.brand { color: var(--fg1); }
.hero.brand .h-name { color: var(--kesari); }
.h-now { color: var(--kesari); font-size: 12.5px; }
:lang(en) .h-now { text-transform: uppercase; letter-spacing: .05em; }
.h-time { font-weight: 400; color: var(--fg2); font-size: 15px; }
.h-q { margin-left: auto; }
.h-q.good, .q.good { color: var(--good); } .h-q.mid, .q.mid { color: var(--mid); } .h-q.bad, .q.bad { color: var(--bad); }
.hero.past { opacity: .72; }

/* ---------- timetable: time column, filled mark, label, quality word ---------- */
.slots { width: 100%; border-collapse: collapse; table-layout: fixed; }
.slot td { padding: 8px 3px; border-bottom: 1px solid var(--line); vertical-align: middle; height: 46px; }
.slot:last-child td { border-bottom: 0; }
.time { width: 10.6em; font-size: 13px; white-space: nowrap; }
.markcell { width: 26px; padding: 0 !important; }
.mark { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 700; color: var(--on-mark); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line); }
.mark.good { background: var(--good); } .mark.mid { background: var(--mid); } .mark.bad { background: var(--bad); }
.h-mark, .kv .mark, .rahu .mark, .reasons .mark { box-shadow: none; }
.name { padding-left: 8px !important; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name small { display: block; font-size: 12px; color: var(--fg3); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; }
.q { width: 4.5em; font-size: 13px; text-align: right; font-weight: 600; white-space: nowrap; }
.ov { color: var(--bad); font-size: 12px; margin-left: 3px; }
.slot.running td { background: var(--kesari-tint); }
.slot.running td:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.slot.running td:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.slot.running .time::after { display: block; font-size: 11px; font-weight: 700; color: var(--kesari); line-height: 1.2; }
html[lang=hi] .slot.running .time::after { content: "अभी"; }
html[lang=en] .slot.running .time::after { content: "NOW"; }
.slot.past { opacity: .55; }
.rahu { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.rahu .mark { width: 16px; height: 16px; font-size: 9px; }
.slots.hora .name { white-space: normal; }

/* the home's "now" card: the running slot and the three after it, then Rahu Kal */
.card.now { padding-bottom: 12px; }
.collapse:not(.picked) tr:nth-child(n+5) { display: none; }
.collapse.picked tr:not(.show) { display: none; }
.collapse tr.show:last-child td, .collapse tr:nth-child(4) td { border-bottom: 0; }
.rahurow { margin-top: 8px; border-top: 1px solid var(--line); }
.rahurow td { border-bottom: 0 !important; }
.card.now .more { display: block; margin-top: 10px; text-align: center; padding: 9px; border-radius: 999px; background: var(--kesari-tint); color: var(--kesari); font-weight: 600; font-size: 14px; }

/* ---------- the day as one bar ---------- */
.timeline { margin: 6px 0 4px; touch-action: pan-y; }
.timeline .bar { position: relative; display: flex; height: 34px; border-radius: 8px; overflow: hidden; gap: 1px; background: var(--line); }
.timeline .cell { flex: 1 1 0; height: 100%; transition: transform var(--quick) var(--ease); }
.timeline .cell.good { background: var(--good); } .timeline .cell.mid { background: var(--mid); } .timeline .cell.bad { background: var(--bad); }
.timeline .cell.hatch { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.35) 0 3px, transparent 3px 7px); }
.timeline .cell.lift { transform: scaleY(1.18); box-shadow: 0 0 0 2px var(--fg1); z-index: 1; border-radius: 3px; }
.timeline .tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--haldi); z-index: 2; }
.timeline .pin { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1px; background: var(--fg1); z-index: 3; border-radius: 2px; }
.timeline .axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--fg3); margin-top: 4px; }
.timeline .scrub { font-size: 13.5px; color: var(--fg2); margin-top: 6px; min-height: 22px; }

/* ---------- tiles: one height, a well, a title of at most two lines, today's value ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: grid; grid-template-rows: auto 1fr auto; height: 128px; padding: 12px; border-radius: var(--r); background: var(--surface); color: var(--fg1); border-top: 3px solid; border-image: linear-gradient(90deg, var(--kesari), var(--haldi)) 1; box-shadow: 0 2px 10px rgba(43,24,16,.05); }
.tile .well { width: 36px; height: 36px; border-radius: 50%; background: var(--kesari-tint); color: var(--kesari); display: flex; align-items: center; justify-content: center; font-size: 17px; box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3px var(--kesari-tint); }
.tile b { align-self: end; font-size: 15px; line-height: 1.4; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .val { display: block; font-size: 12.5px; color: var(--kesari); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.5em; }
.rail { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.rail .chip { flex: none; }

/* ---------- chips, nav ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip { display: inline-block; padding: 5px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg2); font-size: 14px; line-height: 1.5; }
.chip.on { background: var(--kesari); border-color: var(--kesari); color: #fff; font-weight: 600; }
.citynav { margin-top: 16px; }
.app { display: block; text-align: center; padding: 12px; border-radius: 999px; font-weight: 600; color: #fff; background: var(--brass); margin-top: 10px; border: 0; width: 100%; cursor: pointer; }

/* ---------- key–value, lists, tables ---------- */
dl { margin: 0 0 6px; }
.kv { display: grid; grid-template-columns: 7.5em 1fr; gap: 0 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
:lang(en) .kv { grid-template-columns: 8.5em 1fr; }
dl .kv:last-child { border-bottom: 0; }
.kv dt { color: var(--fg2); display: flex; align-items: center; gap: 6px; }
.kv dt .mark { width: 14px; height: 14px; font-size: 8px; flex: none; }
.week, .fest { width: 100%; border-collapse: collapse; font-size: 15px; }
.week td, .fest td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.week tr:last-child td, .fest tr:last-child td { border-bottom: 0; }
.week .t, .fest .t { text-align: right; white-space: nowrap; }
.fest .d { width: 5.2em; white-space: nowrap; }
.fest .w { width: 4.6em; color: var(--fg3); font-size: 13px; padding-top: 9px; }
.fest .kind { text-align: right; color: var(--fg3); font-size: 12px; white-space: nowrap; padding-top: 10px; }
.fest small { display: block; font-size: 12px; color: var(--fg3); line-height: 1.5; }
.fest.vrat .d { width: 6em; }
.fest tr.gauna td { background: var(--sand); }
.fest tr.k-major td:nth-child(3) { font-weight: 600; }
.fest .head th { text-align: left; font-size: 12px; color: var(--fg3); font-weight: 600; padding: 4px; border-bottom: 1px solid var(--line); }
.fest tr.on td { background: var(--kesari-tint); }
.fest.sub { margin: 4px 0 4px 12px; font-size: 13px; }
.pos td { font-size: 14px; }
.more { display: inline-block; margin-top: 10px; font-weight: 600; }
.why { padding-left: 1.2em; font-size: 14.5px; color: var(--fg2); }
.why li + li { margin-top: 6px; }
.reasons { list-style: none; }
.reasons li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.reasons li:last-child { border-bottom: 0; }
.reasons li:has(> .mark) { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: start; }
.reasons li .mark { width: 12px; height: 12px; font-size: 0; margin-top: 6px; }
.reasons li b { display: block; }
.reasons li:has(> .mark) small { grid-column: 2; }
.reasons small { display: block; font-size: 12px; color: var(--fg3); }
.rate { font-size: 12px; color: var(--fg3); margin: 0 0 4px; }
.prose h2 { font-size: 17px; margin: 14px 0 4px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 15px; margin: 10px 0 2px; }
.prose p, .prose li { font-size: 15px; color: var(--fg2); margin-bottom: 6px; }
.prose ul { padding-left: 1.2em; }
.prose a { text-decoration: underline; }
.quote { border-left: 3px solid var(--haldi); padding: 6px 10px; margin: 8px 0; background: var(--ground); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.points { padding-left: 1.3em; font-size: 15px; }
.points li { margin: 6px 0; }
.points li b { display: block; }
.sankalp { font-size: 17px; line-height: 1.9; }

/* ---------- calendar ---------- */
.months { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.wd { text-align: center; font-size: 11px; color: var(--fg3); padding: 2px 0 4px; }
.grid .cell { display: block; min-height: 52px; border-radius: 8px; background: var(--ground); padding: 4px 3px 3px; text-align: center; color: var(--fg1); }
.grid .cell.blank { background: transparent; }
.grid .cell.krishna b { color: var(--fg2); }
.grid .cell b { display: block; font-size: 15px; line-height: 1.3; }
.grid .cell small { display: block; font-size: 10px; color: var(--fg3); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: block; height: 8px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin: 0 1px; vertical-align: middle; }
.dot.major { background: var(--kumkum); } .dot.ekadashi { background: var(--kesari); } .dot.monthly, .dot.vrat { background: var(--haldi); } .dot.sankranti { background: var(--good); }
a.cell:hover { outline: 1px solid var(--kesari); }

/* ---------- tools ---------- */
form.tool fieldset { border: 0; padding: 0; margin: 0 0 14px; }
form.tool legend { font-size: 12px; font-weight: 600; color: var(--fg3); margin-bottom: 6px; }
.field { display: block; margin: 8px 0; font-size: 13px; color: var(--fg2); }
.field small { color: var(--fg3); font-weight: 400; }
.field input, .field select { display: block; width: 100%; margin-top: 4px; font: inherit; font-size: 16px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--fg1); }
.field input.search { border-radius: 999px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.seg label { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--fg2); cursor: pointer; }
.seg label:has(input:checked) { background: var(--kesari); border-color: var(--kesari); color: #fff; font-weight: 600; }
.seg input { display: none; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row .field { flex: 1 1 140px; }
.inline { font-size: 13px; color: var(--fg2); }
.inline select { font: inherit; font-size: 14px; padding: 5px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg1); }
.placefield .results li a { padding: 6px; }
.coords { margin: 2px 0 4px; }
.tiles.cats { grid-template-columns: repeat(3, 1fr); }
.tile-opt { display: block; }
.tile-opt input { display: none; }
.tile-opt span { display: block; text-align: center; padding: 10px 6px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.tile-opt:has(input:checked) span { background: var(--kesari); border-color: var(--kesari); color: #fff; font-weight: 600; }
#result { margin-top: 18px; min-height: 40px; }
#result .card + .card, #result .hero + .card, #result .card + .hero, #result .card + p.hero { margin-top: 12px; }
.charts { display: flex; gap: 10px; flex-wrap: wrap; }
.chart { flex: 1 1 260px; max-width: 320px; height: auto; color: var(--fg1); }
.yoga { padding: 10px 0; border-bottom: 1px solid var(--line); }
.yoga:last-child { border-bottom: 0; }
.yoga h3 { font-size: 17px; line-height: 1.5; }
.yoga p { font-size: 14px; margin: 2px 0; }
.dial { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto; }
.kh { display: flex; gap: 12px; align-items: center; }
.kh h3 { font-size: 17px; line-height: 1.4; }
.kh h3 small { font-weight: 400; color: var(--fg3); font-size: 13px; }
.kh p { font-size: 14px; color: var(--fg2); }
.ring { flex: none; display: inline-flex; align-items: baseline; justify-content: center; min-width: 52px; height: 52px; padding: 0 8px; border-radius: 999px; border: 3px solid var(--line); font-weight: 700; font-size: 18px; line-height: 46px; }
.ring small { font-size: 11px; color: var(--fg3); font-weight: 400; }
.ring.good { border-color: var(--good); color: var(--good); } .ring.mid { border-color: var(--mid); color: var(--mid); } .ring.bad { border-color: var(--bad); color: var(--bad); }
.koota.dosha { background: var(--bad-bg); }
.mid-tint { background: var(--mid-bg); }

/* ---------- motion: momentary, meaningful ---------- */
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tile { animation: arrive var(--std) var(--ease) both; }
.tiles .tile:nth-child(2n) { animation-delay: 45ms; }

/* ---------- print ---------- */
@media print {
  .topbar, .bottomnav, footer, form.tool, .app, .citynav, .chips, .method, .share, .datestrip, .sheet { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
@media (max-width: 360px) { .time { font-size: 12px; } .name { font-size: 14px; } .q { font-size: 12px; } .tile { height: 120px; } }

/* =====================================================================================
   Desktop. Under 1024px the page is the phone layout above; from 1024px the rail, the
   answer and the context column share the width, and every timetable that is two lists
   sits as two columns. Same markup at every width -- only the grid changes. */
.sidenav, .topsearch, .aside, .printhead, .as-actions, .obs, .pane-head { display: none; }
kbd { font: 600 11px/1 ui-monospace, Menlo, monospace; padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--fg2); }
.keys table td { padding: 6px 4px; }
.keys td:first-child { width: 4em; }
.sheet .results li a.active { background: var(--kesari-tint); border-radius: var(--r-sm); }
.scrub.on { color: var(--fg1); font-weight: 600; }
.grid .cell.picked { outline: 2px solid var(--kesari); }
.grid .cell.today b { color: var(--kesari); }
.tile-row + .tile-row { margin-top: 10px; }

@media (min-width: 1024px) {
  body { padding-bottom: 24px; }
  .bottomnav { display: none; }
  .frame { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 0 24px; max-width: 1360px; margin: 0 auto; padding: 0 24px; align-items: start; }
  main { max-width: none; padding: 16px 0 24px; min-width: 0; }
  h1 { font-size: 30px; line-height: 1.45; margin: 8px 0 6px; }
  h1.tagline { font-size: 15px; }
  .hero { font-size: 21px; }
  .hero .h-time { font-size: 16px; }

  /* top bar: brand, chip at its own width, the search box in the middle, language right */
  .topbar { height: 56px; padding: 0 24px; gap: 14px; }
  .citychip { flex: 0 1 auto; max-width: 320px; }
  .topsearch { display: flex; flex: 1 1 auto; align-items: center; gap: 8px; height: 36px; max-width: 520px; margin: 0 auto; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.12); color: rgba(255,255,255,.92); font-size: 14px; cursor: text; text-align: left; }
  .topsearch .ts-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topsearch kbd { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); color: #fff; }
  .topsearch:hover { background: rgba(255,255,255,.2); }

  /* the rail */
  .sidenav { display: block; position: sticky; top: 72px; padding-top: 12px; }
  .sidenav .sn-group { display: flex; flex-direction: column; gap: 2px; }
  .sidenav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 999px; color: var(--fg2); font-size: 15px; line-height: 1.4; }
  .sidenav a:hover { background: var(--surface); color: var(--fg1); }
  .sidenav a[aria-current] { background: var(--kesari-tint); color: var(--kesari); font-weight: 600; }
  .sidenav .nv { width: 18px; height: 18px; flex: none; }
  .sidenav a[aria-current] .nv { background: var(--kesari); box-shadow: inset 0 0 0 3px var(--kesari-tint); }
  .sidenav .eyebrow { margin: 14px 10px 4px; }
  .sidenav .sn-keys { margin: 16px 10px 0; }
  .sidenav .sn-keys button { background: none; border: 0; color: var(--fg3); font-size: 12.5px; cursor: pointer; display: flex; gap: 6px; align-items: center; }

  /* the sheet is a centred palette, not a bottom sheet */
  .sheet { margin: 12vh auto auto; max-width: 560px; border-radius: var(--r); max-height: 72vh; }
  .sheet .handle { display: none; }
  .sheet[data-mode="search"] .recents, .sheet[data-mode="search"] #citygeo, .sheet[data-mode="search"] #citygeo + .quiet { display: none; }

  /* density: the timetable rows fit a screen */
  .slot td { height: 38px; padding: 5px 3px; }
  .time { font-size: 13.5px; }
  .name { font-size: 14.5px; }
  .name small { font-size: 11.5px; line-height: 1.3; }
  .q { font-size: 12.5px; }
  .kv { padding: 5px 0; }
  .fest td, .week td { padding: 5px 4px; font-size: 14.5px; }

  /* two lists side by side */
  .card.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .half, .home-main, .home-side { min-width: 0; }
  main > .tiles { grid-template-columns: repeat(4, 1fr); }
  .card.split > .rahu, .card.split > .legend { grid-column: 1 / -1; }
  .cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .cols > .card { margin-top: 0; }
  .home { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 24px; align-items: start; }
  .home-side .eyebrow.section { margin-top: 0; }
  .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .pane-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; font-size: 16px; }
  .pane-head .chip { padding: 2px 10px; cursor: pointer; }
  .pane .card.split { grid-template-columns: 1fr; }
  .pane .h1, .pane .hero { font-size: 18px; }

  /* the timeline: the label is a tooltip that follows the pointer; the bar is taller */
  .timeline { position: relative; padding-top: 30px; }
  .timeline .bar { height: 40px; cursor: crosshair; outline: none; }
  .timeline .bar:focus-visible { box-shadow: 0 0 0 2px var(--kesari); }
  .timeline .scrub { position: absolute; top: 0; left: var(--x, 0%); transform: translateX(-50%); margin: 0; padding: 3px 10px; border-radius: 999px; background: var(--fg1); color: var(--ground); font-size: 12.5px; white-space: nowrap; min-height: 0; opacity: 0; transition: opacity var(--quick) var(--ease); pointer-events: none; }
  .timeline .scrub.on { opacity: 1; }

  /* the calendar grows into real cells */
  .grid { gap: 4px; }
  .grid .cell { min-height: 78px; padding: 6px 6px 4px; text-align: left; cursor: pointer; }
  .grid .cell b { font-size: 16px; }
  .grid .cell small { font-size: 11.5px; }
  .grid .cell .obs { display: block; font-size: 11.5px; line-height: 1.3; color: var(--kumkum); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
  .grid .cell .obs.k-ekadashi { color: var(--kesari); } .grid .cell .obs.k-monthly { color: var(--haldi); } .grid .cell .obs.k-sankranti { color: var(--good); }
  .grid .cell .dots { display: none; }
  .grid .cell:focus-visible { outline: 2px solid var(--kesari); }
  .daypanel dl { margin-top: 6px; }
  .daypanel .kv { grid-template-columns: 6.5em 1fr; font-size: 14px; }
  .daypanel .hero { font-size: 17px; padding: 8px 12px; }

  /* tools: the form in a fixed left pane, the result beside it, live */
  .tool-page { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; }
  .tool-page form.tool { position: sticky; top: 72px; max-height: calc(100vh - 96px); overflow: auto; padding-right: 4px; }
  .tool-page #result { margin-top: 0; }
  .tool-milan { grid-template-columns: 1fr; }
  .tool-milan form.tool { position: static; max-height: none; overflow: visible; display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .tool-milan form.tool > .app { grid-column: 1 / -1; max-width: 400px; margin: 4px auto 0; }
  #result[data-tool="milan"] .koota { break-inside: avoid; }

  /* sticky month chips on the long lists */
  .chips.sticky { position: sticky; top: 60px; z-index: 5; background: var(--ground); padding: 8px 0; margin: 0 0 8px; }

  /* hover: the mouse gets an answer everywhere */
  .slot:hover td { background: var(--sand); }
  .slot.running:hover td { background: var(--kesari-tint); }
  .tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(43,24,16,.10); }
  .tile { transition: transform var(--quick) var(--ease), box-shadow var(--quick) var(--ease); }
  .chip:hover { border-color: var(--kesari); color: var(--kesari); }
  .grid a.cell:hover, .grid div.cell:hover { background: var(--sand); outline: 0; }
  .fest tr:hover td, .week tr:hover td { background: var(--sand); }
  .ov { position: relative; cursor: help; }
  .ov::after { content: attr(data-tip); position: absolute; right: 0; bottom: 130%; padding: 4px 9px; border-radius: 999px; background: var(--fg1); color: var(--ground); font-size: 12px; font-weight: 500; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--quick) var(--ease); z-index: 4; }
  .ov:hover::after { opacity: 1; }
  .tiles .tile:nth-child(2n) { animation-delay: 0ms; }
  .printhead { display: none; }
}

@media (min-width: 1280px) {
  .frame { grid-template-columns: 208px minmax(0, 1fr) 300px; }
  .frame.noaside, .frame:has(main.comparing) { grid-template-columns: 208px minmax(0, 1fr); }
  .frame:has(main.comparing) .aside { display: none; }
  .aside { display: block; position: sticky; top: 72px; padding-top: 16px; max-height: calc(100vh - 80px); overflow: auto; }
  .aside .card + .card, .aside .card + .app { margin-top: 12px; }
  .aside .card { padding: 10px 12px 12px; }
  .aside .eyebrow { margin-top: 0; }
  .aside .as-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  .aside .as-actions .chip { cursor: pointer; font-weight: 600; color: var(--kesari); border-color: var(--kesari); }
  .aside .week.mini { font-size: 13px; }
  .aside .week.mini td { padding: 4px 2px; }
  .aside .week.mini td.d { white-space: nowrap; }
  .aside .week.mini td small { display: block; font-size: 11px; color: var(--fg3); line-height: 1.3; }
  .aside .week.mini .head th { text-align: left; font-size: 11px; color: var(--fg3); font-weight: 600; padding: 2px; }
  .aside .app { font-size: 14px; padding: 10px; }
  .kolam-off { background-image: none; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .home .tiles { grid-template-columns: 1fr 1fr; }
  .tiles.cats { grid-template-columns: repeat(4, 1fr); }
  /* the kundali result: the two charts side by side, the tables full width beneath */
  #result[data-tool="kundali"] .charts { flex-wrap: nowrap; }
  .charts { justify-content: center; gap: 24px; }
  .chart { max-width: 360px; }
}

/* print: an A4 panchang with the brand line, single column, no chrome */
@media print {
  .frame { display: block; }
  .sidenav, .aside, .topsearch, .citychip, .langpill, .pane-head .chip { display: none !important; }
  .printhead { display: block; font-size: 12px; color: #444; border-bottom: 1px solid #999; padding-bottom: 4px; margin-bottom: 10px; }
  main { max-width: none; padding: 0; }
  h1 { font-size: 20px; }
  .hero { background: #eee; }
  .timeline .scrub { display: none; }
  .card.split { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .grid .cell { min-height: 60px; border: 1px solid #ccc; }
  .grid .cell .obs { display: block; }
  .tile, .app, .more, .datestrip { display: none !important; }
  @page { margin: 12mm; }
}
