/* Ram Naam Sadhana - shared styles. Each screen adds its own file (css/<screen>.css). */
:root {
  --bg: #FFF7F0; --card: #FFFFFF; --ink: #2B1A10; --muted: #7A6555; --line: #EEDCCB;
  --saffron: #E0701B; --saffron2: #C2410C; --maroon: #8A2A12; --gold: #C9962B; --soft: #FDE7D6; --soft2: #FFF0E3;
  --good: #2E7D4F; --goodbg: #E1F2E7; --warn: #B3261E; --warnbg: #FBE3E0; --info: #1F5FA8; --infobg: #E3EEFA; --amber: #8A5A00; --amberbg: #FFF1CC;
  --tab: #FFFDF8; --shadow: 0 1px 3px rgba(80, 40, 10, .10), 0 4px 14px rgba(80, 40, 10, .06);
  --fs: 18px; --r: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17110D; --card: #231A14; --ink: #F5E9DC; --muted: #B9A594; --line: #3A2C22; --soft: #33241A; --soft2: #2A1E16; --tab: #1D1611;
    --maroon: #F0A060; --goodbg: #173A26; --warnbg: #4A1E1A; --infobg: #142A44; --amberbg: #3D2E0A; --good: #6CC495; --warn: #F08A80; --info: #8AB8F0; --amber: #E8C060; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #17110D; --card: #231A14; --ink: #F5E9DC; --muted: #B9A594; --line: #3A2C22; --soft: #33241A; --soft2: #2A1E16; --tab: #1D1611;
  --maroon: #F0A060; --goodbg: #173A26; --warnbg: #4A1E1A; --infobg: #142A44; --amberbg: #3D2E0A; --good: #6CC495; --warn: #F08A80; --info: #8AB8F0; --amber: #E8C060; --shadow: none;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: var(--fs)/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif; padding-bottom: calc(78px + env(safe-area-inset-bottom)); overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--saffron2); }
img, video, iframe { max-width: 100%; }

/* header */
#top { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top));
  background: linear-gradient(90deg, #7A2410, #B4481C); color: #FFF4E6; }
.brand { display: flex; gap: 10px; align-items: center; background: none; border: 0; color: inherit; font-weight: 700; font-size: 1.05em; padding: 0; cursor: pointer; min-width: 0; min-height: 44px; }
.brand #appname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seal { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #FFE2B8; color: #8A2A12; font-weight: 800; font-size: .82em; box-shadow: inset 0 0 0 2px #E0A040; flex: none; }
.seal.big { width: 84px; height: 84px; font-size: 1.6em; margin: 6px auto 10px; }
#top .chip { background: rgba(255, 255, 255, .18); color: #fff; border: 0; padding: 6px 10px; min-width: 44px; min-height: 44px; }
#top > .row { flex-wrap: nowrap; flex: none; }
#top .chip.live { background: #D92D20; font-weight: 700; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .65; } }

main { padding: 10px 14px 24px; max-width: 760px; margin: 0 auto; }
h1 { font-size: 1.35em; margin: 8px 2px 4px; line-height: 1.25; } h2 { font-size: 1.13em; margin: 0 0 8px; line-height: 1.3; } h3 { font-size: 1em; margin: 12px 0 4px; }
p { margin: 6px 0; }
.sub { color: var(--muted); font-size: .9em; margin: 0 2px 10px; }
.card { background: var(--card); border-radius: var(--r); padding: 14px 16px; margin: 12px 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.hero { background: linear-gradient(135deg, var(--soft), var(--soft2)); border: 0; }
.card.flat { box-shadow: none; }
.card.warn { background: var(--warnbg); border-color: transparent; }
.card.info { background: var(--infobg); border-color: transparent; }
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.995); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.card-h h2 { margin: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; } .row.between { justify-content: space-between; } .row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
/* minmax(0, 1fr): a column may shrink below its content's width (a date field is ~180px wide on its
   own), so a grid never pushes the page wider than the phone. */
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid2 > *, .grid3 > * { min-width: 0; }
/* Two date fields side by side do not fit a 360px phone: one per row there. */
@media (max-width: 420px) { .grid2:has(input[type=date]) { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 8px; }
.kv { background: var(--soft); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.kv b { display: block; font-size: .76em; color: var(--muted); font-weight: 600; }
.kv span { font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

/* buttons, chips, pills */
.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 650; background: var(--soft); color: var(--ink); min-height: 48px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn.primary { background: var(--saffron); color: #fff; }
.btn.maroon { background: #8A2A12; color: #fff; }
.btn.good { background: var(--good); color: #fff; } .btn.danger { background: var(--warn); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { padding: 6px 12px; min-height: 44px; font-size: .88em; border-radius: 10px; }
/* Elders' floor: a later "<container> .btn" rule in a screen's own file must not shrink a small button below 44px. */
button.btn.small { min-height: 44px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn:active:not(:disabled) { transform: scale(.98); }
.iconbtn { border: 0; background: var(--soft); width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 1.1em; cursor: pointer; flex: none; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-size: .9em; cursor: pointer; white-space: nowrap; min-height: 44px; }
button.chip { min-height: 44px; }   /* every tappable chip, sub-navigation included, is at least 44px high */
.chip.on { background: var(--saffron); color: #fff; border-color: var(--saffron); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.subnav { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.pill { display: inline-block; background: var(--soft); color: var(--maroon); border-radius: 999px; padding: 2px 10px; font-size: .78em; font-weight: 650; white-space: nowrap; }
.pill.good { background: var(--goodbg); color: var(--good); } .pill.warn { background: var(--warnbg); color: var(--warn); }
.pill.info { background: var(--infobg); color: var(--info); } .pill.amber { background: var(--amberbg); color: var(--amber); }
.pill.live { background: #D92D20; color: #fff; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 11px 2px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.list > li:last-child { border-bottom: 0; }
.list > li.tap { cursor: pointer; }
.list .t { font-weight: 650; } .list .d { font-size: .86em; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .87em; } .tiny { font-size: .76em; } .center { text-align: center; } .right { text-align: right; } .bold { font-weight: 700; }
.ic { display: inline-block; line-height: 1; }
.big-ic { font-size: 1.6em; width: 44px; height: 44px; display: grid; place-items: center; background: var(--soft); border-radius: 12px; flex: none; }

/* forms */
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=search], input[type=url], input:not([type]), select, textarea {
  width: 100%; min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card); min-height: 48px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--saffron); outline-offset: 0; border-color: transparent; }
label.f, .f { display: block; font-size: .85em; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: .92em; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--saffron); }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 8px 6px; font-weight: 650; min-height: 44px; cursor: pointer; }
.seg button.on { background: var(--card); box-shadow: var(--shadow); color: var(--saffron2); }
.hint { font-size: .82em; color: var(--muted); margin-top: 4px; }
.err { color: var(--warn); font-size: .88em; margin-top: 6px; }

/* progress */
.bar { height: 10px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--saffron), var(--gold)); border-radius: 99px; transition: width .3s; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--saffron) calc(var(--p) * 1%), var(--soft) 0); }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--card); display: grid; place-items: center; text-align: center; line-height: 1.15; font-weight: 750; }
.ring small { display: block; font-weight: 600; color: var(--muted); font-size: .7em; }

/* sheet, toast, tabs */
.sheet { position: fixed; inset: 0; background: rgba(20, 10, 4, .5); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-card { background: var(--bg); width: 100%; max-width: 760px; max-height: 94vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 16px calc(26px + env(safe-area-inset-bottom)); position: relative; animation: up .25s ease-out; }
.sheet[data-kind="player"] .sheet-card { max-height: 98vh; }
.sheet-x { position: absolute; right: 10px; top: 8px; border: 0; background: var(--soft); width: 44px; height: 44px; border-radius: 50%; font-size: 1em; cursor: pointer; z-index: 2; }
/* The wake-up alarm card fills the whole screen (it opens over the lock screen), with two big choices. */
.sheet[data-kind="wake"] { align-items: stretch; background: var(--bg); }
.sheet[data-kind="wake"] .sheet-card { max-width: none; max-height: none; border-radius: 0; display: flex; flex-direction: column; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom)); animation: none; }
.sheet[data-kind="wake"] .sheet-x { display: none; }
.wake { width: 100%; max-width: 520px; margin: 0 auto; text-align: center; }
.wake-t { font-size: 1.45em; margin: 4px 0 0; }
.wake-time { font-size: 2.6em; font-weight: 800; line-height: 1.15; color: var(--maroon); margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.wake-what { margin: 0 0 18px; }
.wake .wake-btn { min-height: 76px; font-size: 1.3em; border-radius: 18px; margin-top: 14px; white-space: normal; }
.wake-then { margin: 6px 0 0; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #2B1A10; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 40; font-size: .92em; max-width: 92vw; text-align: center; }
#toast[hidden] { display: none; }
nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--tab); border-top: 1px solid var(--line); z-index: 9; padding-bottom: env(safe-area-inset-bottom); }
nav#tabs button { flex: 1; border: 0; background: none; padding: 7px 2px 8px; font-size: .74em; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 62px; cursor: pointer; }
nav#tabs button .ic { font-size: 1.5em; }
nav#tabs button.on { color: var(--saffron2); font-weight: 750; }

/* player */
.ptitle { margin: 0 46px 2px 0; }
.ytbox { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; margin-top: 8px; }
.ytbox > div, .ytbox iframe, iframe.yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.audiobox { background: linear-gradient(135deg, var(--soft), var(--soft2)); border-radius: 12px; padding: 14px; text-align: center; margin-top: 8px; }
.audiobox audio { width: 100%; margin-top: 6px; }
.ytbox video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.pctl { margin-top: 10px; } .pmore { margin-top: 8px; justify-content: center; }
.vthumb { position: relative; width: 112px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #2b1a10 center / cover no-repeat; flex: none; }
.vthumb::after { content: '▶'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 1.3em; background: rgba(0, 0, 0, .25); }

/* maps, empty, spinner */
iframe.map { width: 100%; border: 0; border-radius: 12px; display: block; background: var(--soft); }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty .om { font-size: 2em; color: var(--saffron); font-weight: 800; opacity: .6; }
.spin { width: 30px; height: 30px; border: 3px solid var(--soft); border-top-color: var(--saffron); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 10px; }
.spin.small { width: 18px; height: 18px; border-width: 2px; margin: 0; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tables (console, nutrition) */
.tbl { width: 100%; border-collapse: collapse; font-size: .9em; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 650; font-size: .85em; }
.scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* text blocks */
.quote { font-size: 1.08em; line-height: 1.6; border-left: 4px solid var(--gold); padding: 4px 0 4px 12px; margin: 6px 0; }
.quote cite { display: block; font-style: normal; font-size: .8em; color: var(--muted); margin-top: 4px; }
.devanagari { font-family: "Noto Sans Devanagari", "Mangal", system-ui, sans-serif; }
.steps { padding-left: 1.3em; margin: 6px 0; } .steps li { margin: 6px 0; }
.note { font-size: .84em; color: var(--muted); background: var(--soft2); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }

@media (min-width: 700px) {
  .grid-wide { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid-wide > .card { margin: 0; }
}
@media (max-width: 360px) { :root { --fs: 16px; } .grid3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
