/* StaRay tokens (DESIGN.md). */
@font-face { font-family: 'Noto Sans Sinhala'; src: url(fonts/NotoSansSinhala-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Noto Sans Sinhala'; src: url(fonts/NotoSansSinhala-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'StaRay Ink'; src: url(fonts/NotoSerifSinhala-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
	color-scheme: light dark;
	--bg: #eef1f5;
	--surface: #ffffff;
	--ink: #141a22;
	--ink-2: #5b6676;
	--sep: rgb(20 26 34 / 0.12);
	--fill: rgb(20 26 34 / 0.06);
	--accent: #2f6fb3;
	--line: #2a3442;
	--tint: rgb(47 111 179 / 0.1);
	--accent-ink: #1f4f85;
	--on-accent: #ffffff;
	--t-title: 28px;
	--t-body: 17px;
	--t-meta: 14px;
	--r-card: 16px;
	--warn: #b42318;
	--good: #1f7a4a;
	--mixed: #8a5a00;
	--max: 560px;
	--seg-on: #ffffff;
	--night-tint: #e3e8ef;
	--material: rgb(238 241 245 / 0.82);
	--bar: rgb(255 255 255 / 0.9);
	--bar-on: rgb(47 111 179 / 0.12);
	--spring: linear(
		0,
		0.038,
		0.127,
		0.241,
		0.362,
		0.479,
		0.584,
		0.677,
		0.754,
		0.818,
		0.868,
		0.908,
		0.938,
		0.96,
		0.976,
		0.987,
		0.995,
		1,
		1.003,
		1.004,
		1.005,
		1.005,
		1.005,
		1.004,
		1.004,
		1.003,
		1.002,
		1.002,
		1.001,
		1.001,
		1.001,
		1.001,
		1
	);
	--spring-ms: 533ms;
	--spring-bounce: linear(
		0,
		0.043,
		0.147,
		0.281,
		0.424,
		0.561,
		0.682,
		0.785,
		0.867,
		0.93,
		0.975,
		1.006,
		1.025,
		1.035,
		1.038,
		1.037,
		1.034,
		1.029,
		1.024,
		1.018,
		1.013,
		1.009,
		1.006,
		1.003,
		1.001,
		1,
		0.999,
		0.999,
		0.999,
		0.999,
		0.999,
		0.999,
		1
	);
	--spring-bounce-ms: 808ms;
	--spring-smooth: linear(
		0,
		0.036,
		0.118,
		0.222,
		0.329,
		0.433,
		0.527,
		0.61,
		0.682,
		0.742,
		0.793,
		0.834,
		0.868,
		0.895,
		0.917,
		0.935,
		0.949,
		0.96,
		0.969,
		0.976,
		0.981,
		0.985,
		0.989,
		0.991,
		0.993,
		0.995,
		0.996,
		0.997,
		0.998,
		0.998,
		0.999,
		0.999,
		1
	);
	--spring-smooth-ms: 750ms;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) {
		--bg: #0f141c;
		--surface: #1a212c;
		--ink: #eef2f7;
		--ink-2: #9aa6b5;
		--sep: rgb(238 242 247 / 0.12);
		--fill: rgb(238 242 247 / 0.07);
		--accent: #6cb6ff;
		--line: #c3cbd6;
		--tint: rgb(108 140 180 / 0.2);
		--accent-ink: #cfe6ff;
		--on-accent: #0f141c;
		--warn: #ff8a80;
		--good: #6fd39a;
		--mixed: #f2c46b;
		--material: rgb(15 20 28 / 0.82);
		--seg-on: #2b3646;
		--night-tint: #1d2532;
		--bar: rgb(26 33 44 / 0.94);
		--bar-on: rgb(108 140 180 / 0.26);
	}
}
/* Chosen theme (තව → පෙනුම) wins over the system setting. */
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] {
	color-scheme: dark;
	--bg: #0f141c;
	--surface: #1a212c;
	--ink: #eef2f7;
	--ink-2: #9aa6b5;
	--sep: rgb(238 242 247 / 0.12);
	--fill: rgb(238 242 247 / 0.07);
	--accent: #6cb6ff;
	--line: #c3cbd6;
	--tint: rgb(108 140 180 / 0.2);
	--accent-ink: #cfe6ff;
	--on-accent: #0f141c;
	--warn: #ff8a80;
	--good: #6fd39a;
	--mixed: #f2c46b;
	--material: rgb(15 20 28 / 0.82);
	--seg-on: #2b3646;
	--night-tint: #1d2532;
	--bar: rgb(26 33 44 / 0.94);
	--bar-on: rgb(108 140 180 / 0.26);
}

/* StaRay: quiet HIG layout, three type sizes only (28 / 17 / 14). Tokens in DESIGN.md. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
	margin: 0;
	min-height: 100dvh;
	background: var(--bg);
	color: var(--ink);
	font: 400 var(--t-body) / 1.45 'Noto Sans Sinhala', system-ui, -apple-system, sans-serif;
	-webkit-tap-highlight-color: transparent;
	padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
button, input, a { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.ic { width: 20px; height: 20px; flex: none; stroke-width: 2; }
.dim { color: var(--ink-2); }
.v .dim, .k .dim { margin-left: 6px; }
.tag {
	display: inline-block;
	margin-left: 8px;
	padding: 0 8px;
	border-radius: 8px;
	background: var(--tint);
	color: var(--accent);
	font-size: var(--t-meta);
	font-weight: 700;
	line-height: 22px;
	vertical-align: 1px;
}
.tag.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }

/* Header: the screen's subject, and one profile button. */
.top {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	max-width: var(--max);
	margin: 0 auto;
	padding: calc(14px + env(safe-area-inset-top)) 20px 12px;
	background: var(--bg);
	transition: box-shadow var(--spring-ms) var(--spring);
}
body.scrolled .top {
	background: var(--material);
	-webkit-backdrop-filter: blur(20px) saturate(180%);
	backdrop-filter: blur(20px) saturate(180%);
	box-shadow: 0 0.5px 0 var(--sep);
}
.ttl { flex: 1; min-width: 0; }
.top h1 { font-size: var(--t-title); line-height: 1.25; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top p { color: var(--ink-2); }
.who {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: var(--fill);
	color: var(--accent);
	transition: transform var(--spring-bounce-ms) var(--spring-bounce);
}
.who:active { transform: scale(0.92); transition-duration: 120ms; }

main { max-width: var(--max); margin: 0 auto; padding: 4px 16px 32px; }
main.enter { animation: rise var(--spring-ms) var(--spring); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Tab bar */
/* Classic docked tab bar: five equal columns, the selected tab in the accent colour. */
.tabs {
	position: fixed;
	inset: auto 0 0;
	z-index: 5;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	padding: 6px max(4px, calc((100vw - var(--max)) / 2)) calc(6px + env(safe-area-inset-bottom));
	background: var(--bar);
	-webkit-backdrop-filter: blur(20px) saturate(160%);
	backdrop-filter: blur(20px) saturate(160%);
	box-shadow: 0 -0.5px 0 var(--sep);
}
.tabs button {
	display: grid;
	justify-items: center;
	gap: 2px;
	min-width: 0;
	min-height: 52px;
	padding: 4px 0;
	border: 0;
	background: none;
	color: var(--ink-2);
	font-size: 12px;
	line-height: 1.3;
	white-space: nowrap;
	transition: color var(--spring-ms) var(--spring);
}
.tabs .ic { width: 24px; height: 24px; transition: transform var(--spring-bounce-ms) var(--spring-bounce); }
.tabs button[aria-current] { color: var(--accent); font-weight: 700; }
.tabs button:active .ic { transform: scale(0.86); transition-duration: 120ms; }

/* Cards and key–value rows */
.card { margin: 0; padding: 0 16px; list-style: none; background: var(--surface); border-radius: var(--r-card); }
.label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 4px 8px; }
.label h2 { font-size: var(--t-meta); font-weight: 700; color: var(--ink-2); }
.hint { font-size: var(--t-meta); color: var(--ink-2); }
.note { margin: 8px 4px 0; font-size: var(--t-meta); color: var(--ink-2); }
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; min-height: 50px; padding: 13px 0; text-decoration: none; }
.kv + .kv { box-shadow: 0 -0.5px 0 var(--sep); }
.kv .k { color: var(--ink-2); }
.kv .v { text-align: right; font-variant-numeric: tabular-nums; }
.kv.rahu .v { color: var(--warn); font-weight: 700; }
.kv.link .v { color: var(--accent); }

/* Segmented control */
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 2px; border-radius: 10px; background: var(--fill); }
.seg button { min-height: 40px; border: 0; border-radius: 8px; background: none; transition: background-color var(--spring-ms) var(--spring), box-shadow var(--spring-ms) var(--spring); }
.seg button[aria-checked='true'] { background: var(--seg-on); font-weight: 700; box-shadow: 0 3px 8px rgb(0 0 0 / 0.12), 0 0 0 0.5px rgb(0 0 0 / 0.04); }

/* The kendaraya: sized so its letters render at the body and meta sizes. */
.chart { margin: 0; padding: 14px; border-radius: var(--r-card); background: var(--surface); }
.kendara { display: block; width: 100%; max-width: 334px; height: auto; margin: 0 auto; overflow: visible; }
.kendara .grid { fill: none; stroke: var(--line); stroke-width: 1.2; stroke-linejoin: round; }
.kendara .lag { fill: var(--tint); }
.kendara text { fill: var(--ink); font: 700 16px/1 'StaRay Ink', 'Noto Serif Sinhala', serif; text-anchor: middle; dominant-baseline: central; }
.kendara tspan.o { fill: var(--ink-2); font-weight: 400; }
.kendara text.n { fill: var(--ink-2); font: 400 10px 'Noto Sans Sinhala', sans-serif; opacity: 0.6; }
.kendara text.s { font-size: 13px; }
.kendara text.hn { fill: var(--ink-2); font: 400 16px 'Noto Sans Sinhala', sans-serif; }
.kendara .c2 { fill: var(--ink-2); font: 400 13px 'Noto Sans Sinhala', sans-serif; }

/* Planet table: one line each, opens for detail. */
.plist { margin: 0; padding: 0; list-style: none; }
.prow { box-shadow: 0 -0.5px 0 var(--sep); }
.ph { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; min-height: 50px; padding: 13px 0; border: 0; background: none; text-align: left; }
.prow:first-child .pn { font-weight: 700; }
.pv { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv b { font-weight: 700; margin-right: 6px; }
.prow.outer .pn, .prow.outer .pv { color: var(--ink-2); }
.pd, .fb, .dd { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--spring-ms) var(--spring); }
.pd > div, .fb > div, .dd > ul { min-height: 0; overflow: hidden; }
.open > .pd, .open > .fb, .open > .dd { grid-template-rows: 1fr; }
.pd p { padding: 0 0 13px; color: var(--ink-2); }

/* Folding cards */
.fold { margin-top: 28px; }
.fh { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 54px; padding: 0; border: 0; background: none; font-weight: 700; }
.fb .kv:first-child { box-shadow: 0 -0.5px 0 var(--sep); }
.chev { width: 18px; height: 18px; color: var(--ink-2); transition: transform var(--spring-ms) var(--spring); }
.open > .fh .chev, .open > .dhd .chev { transform: rotate(90deg); }

/* Hero: today's tithi, or the running dasha */
.hero { padding: 20px; border-radius: var(--r-card); background: var(--tint); }
.hero .ht { font-size: var(--t-title); line-height: 1.25; font-weight: 700; color: var(--accent-ink); }
.hero p + p { margin-top: 4px; }
.hero .sep { color: var(--ink-2); font-weight: 400; }
.bar { display: block; height: 4px; margin: 8px 0 12px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.bar:last-child { margin-bottom: 0; }
.bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }

/* Dasha list */
.dasha + .dasha { box-shadow: 0 -0.5px 0 var(--sep); }
.dhd { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 0; border: 0; background: none; text-align: left; }
.dhd .k { font-weight: 700; }
.dasha.cur .dhd .k { color: var(--accent); }
.dhd .v { display: inline-flex; align-items: center; gap: 8px; }
.dt { display: grid; text-align: right; font-variant-numeric: tabular-nums; }
.dhd .age { grid-column: 1 / -1; margin-top: -6px; text-wrap: balance; font-size: var(--t-meta); color: var(--ink-2); }
.dd ul { margin: 0; padding: 0 0 0 16px; list-style: none; }
.dasha.open .dd ul { padding-bottom: 8px; }
.dd li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 26px 9px 0; font-variant-numeric: tabular-nums; }
.dd li span:last-child { color: var(--ink-2); }
.dd li.cur span { color: var(--accent); font-weight: 700; }

/* සාරාංශය: rule-written overview. A gradient border sweeps once, then lines rise in on the spring. */
@property --sweep { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.insight {
	position: relative;
	margin: 4px 0 0;
	padding: 18px 18px 16px;
	border-radius: var(--r-card);
	background: var(--surface);
	isolation: isolate;
}
.insight::before {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	padding: 1.5px;
	border-radius: inherit;
	background: conic-gradient(from var(--sweep), var(--accent), #8f6bff, #3fb6c8, var(--accent));
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	opacity: 0.55;
}
.insight.play::before { animation: sweep 1600ms var(--spring-smooth) both; }
@keyframes sweep { from { --sweep: -120deg; opacity: 0; } 30% { opacity: 0.9; } to { --sweep: 240deg; opacity: 0.55; } }
.ih { display: flex; align-items: center; gap: 6px; font-size: var(--t-meta); font-weight: 700; color: var(--accent); }
.ih .ic { width: 16px; height: 16px; }
.insight .hl { margin-top: 6px; font-weight: 700; }
.insight ul { margin: 8px 0 0; padding: 0; list-style: none; }
.insight li { position: relative; padding: 4px 0 4px 16px; }
.insight li::before { content: ''; position: absolute; left: 2px; top: 0.9em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0.5; }
.insight.play .hl, .insight.play li { animation: rise var(--spring-ms) var(--spring) both; animation-delay: calc(var(--i) * 70ms + 180ms); }

/* Dasha: the running period carries its progress under the row */
.dhd .bar { grid-column: 1 / -1; margin: 0; }

/* Yogas */
.yoga { padding: 14px 0; }
.yoga + .yoga { box-shadow: 0 -0.5px 0 var(--sep); }
.yn { font-weight: 700; }
/* Kind: colour and word together (never colour alone). */
.yk { display: inline-flex; align-items: center; gap: 8px; }
.yk::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.yk.good, .yoga.good .yn { color: var(--good); }
.yk.mixed, .yoga.mixed .yn { color: var(--mixed); }
.yk.bad, .yoga.bad .yn { color: var(--warn); }

/* Dosha description lines and the small two-way segment in the form */
.dl { margin: 8px 0 0; padding: 0 0 0 18px; color: var(--ink-2); }
.dl li + li { margin-top: 2px; }
.seg.mini { display: inline-grid; grid-template-columns: auto auto; }
.seg.mini label { position: relative; }
.seg.mini input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg.mini span { display: block; min-height: 36px; padding: 6px 16px; border-radius: 8px; }
.seg.mini input:checked + span { background: var(--seg-on); font-weight: 700; box-shadow: 0 3px 8px rgb(0 0 0 / 0.12); }
.seg.mini input:focus-visible + span { outline: 3px solid var(--accent); }

/* පොරොන්දම් */
.pick2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pchip { position: relative; display: grid; gap: 0; min-height: 76px; padding: 12px 34px 12px 14px; border: 0; border-radius: var(--r-card); background: var(--surface); text-align: left; transition: transform var(--spring-bounce-ms) var(--spring-bounce); }
.pchip:active { transform: scale(0.97); transition-duration: 120ms; }
.pchip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip .dim { font-size: var(--t-meta); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip .sw { position: absolute; top: 14px; right: 10px; width: 18px; height: 18px; color: var(--ink-2); }
.score { display: grid; justify-items: center; margin-top: 12px; padding: 20px 16px 18px; border-radius: var(--r-card); background: var(--surface); text-align: center; }
.score svg { width: 148px; height: 148px; transform: rotate(-90deg); grid-area: 1 / 1; }
.score .num { grid-area: 1 / 1; align-self: center; display: flex; align-items: baseline; gap: 4px; }
.score .num b { font-size: var(--t-title); }
.score .num span { color: var(--ink-2); }
.score circle { fill: none; stroke-width: 10; }
.score .trk { stroke: var(--fill); }
.score .val { stroke: var(--good); stroke-linecap: round; stroke-dasharray: var(--c); stroke-dashoffset: var(--to); }
.score.play .val { animation: draw 1200ms var(--spring-smooth) both 120ms; }
.score.play .num { animation: rise var(--spring-bounce-ms) var(--spring-bounce) both 200ms; }
@keyframes draw { from { stroke-dashoffset: var(--c); } }
.score .vd { margin-top: 10px; font-weight: 700; }
.score .dim { font-size: var(--t-meta); margin-top: 2px; }
.score + .insight { margin-top: 12px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair > div { display: grid; padding: 12px 14px; border-radius: var(--r-card); background: var(--surface); }
.pair .dim { font-size: var(--t-meta); }
.badge { display: inline-block; flex: none; padding: 0 10px; border-radius: 999px; font-size: var(--t-meta); font-weight: 700; line-height: 26px; }
.badge.g2 { background: var(--good); color: var(--on-accent); }
.badge.g1 { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge.m0 { background: color-mix(in srgb, var(--mixed) 16%, transparent); color: var(--mixed); }
.badge.b1 { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.badge.b2 { background: var(--warn); color: var(--on-accent); }
.por .ph { align-items: center; }
.por .prow:first-child .pn { font-weight: 400; }
.por .no { display: inline-block; min-width: 26px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.por .pd p { padding-left: 26px; }
.prow.play { animation: rise var(--spring-ms) var(--spring) both; animation-delay: calc(var(--i) * 28ms + 300ms); }
.kv .v .badge { margin-left: 8px; }

/* පලාපල: four-way segment with a sliding pill, and prediction cards */
.seg.four { position: relative; grid-template-columns: repeat(4, 1fr); isolation: isolate; }
.seg.four::before { content: ''; position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / 4); border-radius: 8px; background: var(--seg-on); box-shadow: 0 3px 8px rgb(0 0 0 / 0.12), 0 0 0 0.5px rgb(0 0 0 / 0.04); transform: translateX(calc(var(--i) * 100%)); transition: transform var(--spring-ms) var(--spring); }
.seg.four button { position: relative; background: none !important; box-shadow: none !important; }
.seg.four button[aria-selected='true'] { font-weight: 700; }
.paltab { margin-top: 12px; animation: rise var(--spring-ms) var(--spring) both; }
.paltab > .label:first-child { margin-top: 4px; }
.pal + .pal { margin-top: 10px; }
.pal .fh { min-height: 64px; text-align: left; }
.pt { display: grid; }
.pt .dim { font-size: var(--t-meta); font-weight: 400; }
.pl { margin: 0; padding: 0 0 12px; list-style: none; box-shadow: 0 -0.5px 0 var(--sep); }
.pl li { position: relative; padding: 7px 0 7px 18px; }
.pl li::before { content: ''; position: absolute; left: 2px; top: 1em; width: 7px; height: 7px; border-radius: 50%; }
.pl li.up::before { background: var(--good); }
.pl li.dn::before { background: var(--mixed); }

/* Divisional charts: scrolling chips, chart cross-fades on change */
.vchips { display: flex; gap: 8px; margin: 0 -16px 10px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.vchips::-webkit-scrollbar { display: none; }
.vchip { flex: none; display: grid; justify-items: start; min-height: 48px; padding: 6px 14px; border: 0; border-radius: 14px; background: var(--surface); scroll-snap-align: start; transition: background-color var(--spring-ms) var(--spring), color var(--spring-ms) var(--spring), transform var(--spring-bounce-ms) var(--spring-bounce); }
.vchip span { font-size: var(--t-meta); color: var(--ink-2); }
.vchip[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.vchip[aria-pressed='true'] span { color: inherit; opacity: 0.8; }
.vchip:active { transform: scale(0.95); transition-duration: 120ms; }
.chart.swap .kendara { animation: fadeswap var(--spring-ms) var(--spring); }
@keyframes fadeswap { from { opacity: 0; transform: scale(0.97); } }

/* නැකත්: hora strip and found windows */
.horas { display: flex; gap: 8px; margin: 0 -16px; padding: 2px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.horas::-webkit-scrollbar { display: none; }
.hora { flex: none; display: grid; justify-items: center; min-width: 74px; padding: 10px 8px; border-radius: 14px; background: var(--surface); }
.hora span { font-size: var(--t-meta); color: var(--ink-2); }
.hora.night { background: color-mix(in srgb, var(--surface) 70%, var(--night-tint)); }
.hora.now { background: var(--accent); color: var(--on-accent); }
.hora.now span { color: inherit; opacity: 0.85; }
.wins { margin-top: 2px; }
.win { padding: 13px 0; animation: rise var(--spring-ms) var(--spring) both; animation-delay: calc(var(--i, 0) * 40ms); }
.win + .win { box-shadow: 0 -0.5px 0 var(--sep); }
.win .tm { font-weight: 700; color: var(--good); }
.win .dim { font-size: var(--t-meta); }
.win.sk p { height: 16px; margin: 6px 0; border-radius: 6px; background: linear-gradient(90deg, var(--fill) 0%, color-mix(in srgb, var(--fill) 40%, transparent) 50%, var(--fill) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.win.sk p:first-child { width: 60%; }
.win.sk p:last-child { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* නම් අකුරු */
.nm { padding-top: 14px; padding-bottom: 14px; }
.lchips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.lchip { display: grid; justify-items: center; min-height: 64px; padding: 8px 4px; border: 0; border-radius: 14px; background: var(--fill); font-size: var(--t-title); font-weight: 700; line-height: 1.2; transition: background-color var(--spring-ms) var(--spring), transform var(--spring-bounce-ms) var(--spring-bounce); }
.lchip span { font-size: var(--t-meta); font-weight: 400; color: var(--ink-2); }
.lchip.own span { color: var(--accent); font-weight: 700; }
.lchip[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); }
.lchip[aria-pressed='true'] span { color: inherit; }
.lchip:active { transform: scale(0.95); transition-duration: 120ms; }
.names { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.names span { padding: 4px 12px; border-radius: 999px; background: var(--tint); animation: rise var(--spring-ms) var(--spring) both; animation-delay: calc(var(--i) * 12ms); }

/* අෂ්ටකවර්ගය */
.kendara tspan.hi { fill: var(--good); }
.sav .kendara text:not(.n):not(.c1):not(.c2) { font-family: 'Noto Sans Sinhala', sans-serif; font-variant-numeric: tabular-nums; }
.atab { margin-top: 10px; padding: 10px 8px; overflow-x: auto; }
.atab table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; text-align: center; }
.atab th, .atab td { padding: 6px 2px; font-size: var(--t-meta); }
.atab th { color: var(--ink-2); font-weight: 400; }
.atab tr + tr { box-shadow: 0 -0.5px 0 var(--sep); }
.atab .tot td { font-weight: 700; }
.atab .tot td.hi { color: var(--good); }
.atab .tot th { white-space: nowrap; }

/* Nakath activity picker: grouped chips */
.ngrid { padding: 6px 16px 14px; }
.ngh { margin: 12px 0 8px; font-size: var(--t-meta); font-weight: 700; color: var(--ink-2); }
.nchips { display: flex; flex-wrap: wrap; gap: 8px; }
.nchip { min-height: 40px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--fill); transition: background-color var(--spring-ms) var(--spring), color var(--spring-ms) var(--spring), transform var(--spring-bounce-ms) var(--spring-bounce); }
.nchip[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.nchip:active { transform: scale(0.95); transition-duration: 120ms; }
#found { scroll-margin-top: 120px; }
#found .wins { margin-top: 12px; }
.adv { margin-top: 12px; padding: 4px 16px 12px; }
.adv summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; list-style: none; }
.adv summary::-webkit-details-marker { display: none; }
.adv p { color: var(--ink-2); }
.adv p + p { margin-top: 8px; }

.note.warnline { color: var(--warn); font-weight: 700; }

.kv.bl { align-items: center; }
.kv.bl .k { display: grid; color: var(--ink); }
.kv.bl .k .dim { margin: 0; font-size: var(--t-meta); }

.seg.four.five { grid-template-columns: repeat(5, 1fr); }
.seg.four.five::before { width: calc((100% - 4px) / 5); }

.ab { margin: 8px 0 0; padding: 0 0 0 16px; }
.ab li { padding: 2px 0; }
.more summary { display: inline-flex; min-height: 36px; align-items: center; color: var(--accent); font-weight: 700; cursor: pointer; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more[open] summary { display: none; }
.more[open] .ab { margin-top: 0; animation: rise var(--spring-ms) var(--spring) both; }

/* Today */
.place { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin: -12px 0; padding: 0 4px; border: 0; background: none; color: var(--accent); font-size: var(--t-meta); font-weight: 700; }
.place .ic { width: 16px; height: 16px; }

/* Profiles */
.plist { margin: 0 -16px; overflow: hidden; border-radius: inherit; }
.prof { position: relative; overflow: hidden; }
.prof + .prof { box-shadow: 0 -0.5px 0 var(--sep); }
.plist + .add { box-shadow: 0 -0.5px 0 var(--sep); }
.pick { position: relative; z-index: 1; display: flex; align-items: center; width: 100%; min-height: 64px; padding: 10px 16px; border: 0; background: var(--surface); text-align: left;
  touch-action: pan-y; -webkit-touch-callout: none; user-select: none; transition: transform var(--spring-ms) var(--spring); }
.prof.dragging .pick { transition: none; }
.pick .k { display: grid; gap: 2px; align-content: center; }
.pick .nm { display: flex; align-items: center; gap: 6px; }
.pick .k .dim { margin: 0; font-size: var(--t-meta); }
.prof.cur .pick { background: linear-gradient(var(--tint), var(--tint)), var(--surface); }
.prof.cur .nm { color: var(--accent); font-weight: 700; }
.prof .starred { width: 14px; height: 14px; color: var(--accent); fill: currentColor; }
.acts { position: absolute; inset: 0 0 0 auto; display: flex; }
.acts button { display: grid; place-content: center; justify-items: center; gap: 2px; width: 72px; border: 0; color: #fff; font-size: var(--t-meta); font-weight: 700; }
.acts svg { width: 20px; height: 20px; }
.act-star { background: #b45309; }
.act-edit { background: var(--accent); }
.acts-l { inset: 0 auto 0 0; }
.acts-l button { width: 88px; }
.act-del { background: #c62828; }
.prof:focus-within .pick:not(:focus) { transform: translateX(-144px); }
.add { box-shadow: 0 -0.5px 0 var(--sep); }
.ok { color: var(--accent); }
.add { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 54px; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 700; }

/* Empty state */
.empty { display: grid; justify-items: center; gap: 20px; margin: 64px 8px; text-align: center; color: var(--ink-2); }
.empty p { max-width: 28ch; }
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 50px;
	padding: 0 22px;
	border: 0;
	border-radius: 14px;
	background: var(--accent);
	color: var(--on-accent);
	font-weight: 700;
	transition: transform var(--spring-bounce-ms) var(--spring-bounce);
}
.btn:active { transform: scale(0.97); transition-duration: 120ms; }
.btn.wide { width: 100%; margin-top: 16px; }
.btn.danger { background: none; color: var(--warn); }

/* Sheets (ModalSheet moves them) */
.sheet {
	position: fixed;
	inset: auto 0 0;
	width: 100%;
	max-width: var(--max);
	max-height: 88dvh;
	margin: 0 auto;
	padding: 0 16px calc(16px + env(safe-area-inset-bottom));
	border: 0;
	border-radius: 28px 28px 0 0;
	corner-shape: superellipse(1.6);
	background: var(--bg);
	color: var(--ink);
	box-shadow: 0 -10px 40px -12px rgb(0 0 0 / 0.3);
	overflow-y: auto;
	overscroll-behavior: contain;
	will-change: transform;
}
.sheet.tall { height: 88dvh; }
.sheet::backdrop { background: rgb(0 0 0 / 0.4); transition: background-color var(--spring-smooth-ms) var(--spring-smooth); }
.sheet.closing::backdrop { background: rgb(0 0 0 / 0); transition: background-color var(--spring-ms) var(--spring); }
@starting-style { .sheet[open]::backdrop { background: rgb(0 0 0 / 0); } }
.sh {
	position: sticky;
	top: 0;
	z-index: 1;
	display: grid;
	grid-template-columns: 44px 1fr 44px;
	align-items: center;
	margin: 0 -16px;
	padding: 16px 8px 8px;
	background: var(--bg);
	touch-action: none;
	cursor: grab;
}
.grabber { position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 999px; background: var(--sep); }
.sh h2 { grid-column: 2; font-size: var(--t-body); font-weight: 700; text-align: center; }
.x { grid-column: 3; display: grid; place-items: center; width: 32px; height: 32px; margin: 6px; padding: 0; border: 0; border-radius: 50%; background: var(--fill); color: var(--ink-2); }
.x .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.body h3 { margin: 28px 4px 8px; font-size: var(--t-meta); font-weight: 700; color: var(--ink-2); }

.fields { margin-top: 8px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; }
.field + .field { box-shadow: 0 -0.5px 0 var(--sep); }
.field > span { flex: none; color: var(--ink-2); }
.field input:not([type=checkbox]) { flex: 1; min-width: 0; min-height: 44px; border: 0; background: none; text-align: right; outline: none; }
.field input::placeholder { color: var(--ink-2); opacity: 0.7; }
.field:focus-within > span { color: var(--accent); }
.switch input { appearance: none; position: relative; width: 51px; height: 31px; margin: 0; border-radius: 999px; background: var(--fill); transition: background-color var(--spring-ms) var(--spring); }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgb(0 0 0 / 0.15), 0 1px 1px rgb(0 0 0 / 0.16); transition: transform var(--spring-bounce-ms) var(--spring-bounce); }
.switch input:checked { background: #34c759; }
.switch input:checked::after { transform: translateX(20px); }
.sheet.abroad .lk, .sheet:not(.abroad) .ab { display: none; }
.chosen { display: flex; align-items: center; gap: 8px; min-height: 50px; margin: 0 0 8px; padding: 0 16px; border-radius: var(--r-card); background: var(--surface); font-weight: 700; }
.chosen .ic { color: var(--accent); }
.muted { color: var(--ink-2); font-weight: 400; }
.search { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px; background: var(--fill); color: var(--ink-2); }
.search input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: none; color: var(--ink); outline: none; }
.search:focus-within { box-shadow: inset 0 0 0 2px var(--accent); } /* inside the edge: never clipped by a sticky sheet header */
.search .ic { width: 18px; height: 18px; }
.results { margin-top: 10px; }
.results.short { max-height: 280px; overflow-y: auto; }
.results li + li { box-shadow: 0 -0.5px 0 var(--sep); }
.res { display: grid; width: 100%; min-height: 50px; padding: 10px 0; border: 0; background: none; text-align: left; }
.res .dim { font-size: var(--t-meta); }
.results .none { padding: 14px 0; color: var(--ink-2); }
.foot { margin: 8px 4px 0; font-size: var(--t-meta); color: var(--ink-2); }
.err { margin: 12px 4px 0; color: var(--warn); }
.err:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Redesign 2026-11-14: rows with icon tiles, fact tiles, one detail sheet. ------------------------------ */
.seg.slide { position: relative; grid-template-columns: repeat(var(--n), 1fr); isolation: isolate; }
.seg.slide.two { --n: 2; } .seg.slide.three { --n: 3; } .seg.slide.four { --n: 4; } .seg.slide.five { --n: 5; }
.seg.slide::before { content: ''; position: absolute; z-index: -1; top: 2px; bottom: 2px; left: 2px; width: calc((100% - 4px) / var(--n)); border-radius: 8px; background: var(--seg-on); box-shadow: 0 3px 8px rgb(0 0 0 / 0.12), 0 0 0 0.5px rgb(0 0 0 / 0.04); transform: translateX(calc(var(--i) * 100%)); transition: transform var(--spring-ms) var(--spring); }
.seg.slide button { position: relative; background: none !important; box-shadow: none !important; }
.seg.slide button[aria-selected='true'], .seg.slide button[aria-checked='true'] { font-weight: 700; }

.ib { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--c); color: #fff; }
.ib .ic { width: 18px; height: 18px; stroke-width: 2.2; }

.grp { padding: 0; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 16px; border: 0; background: none; text-align: start; position: relative; }
button.row { transition: background-color 160ms; }
button.row:active { background: var(--fill); }
.row + .row::before { content: ''; position: absolute; top: 0; right: 0; left: 58px; border-top: 0.5px solid var(--sep); }
.grp > .row:not(:has(.ib, .mk)) + .row::before { left: 16px; }
.rt { flex: 1; min-width: 0; display: grid; }
.rt b { font-weight: 700; }
.rt .dim { font-size: var(--t-meta); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rv { flex: none; display: grid; justify-items: end; text-align: end; }
.rv .dim { font-size: var(--t-meta); }
.row .chev { flex: none; width: 18px; height: 18px; color: var(--ink-2); opacity: 0.6; }
.row.cur .rt b { color: var(--accent); }
.row.night .rt b { color: var(--ink-2); font-weight: 400; }
.mk { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.mk::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.mk.good { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.mk.mixed { color: var(--mixed); background: color-mix(in srgb, var(--mixed) 14%, transparent); }
.mk.bad { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.ud { display: flex; gap: 10px; font-size: var(--t-meta); font-variant-numeric: tabular-nums; }
.ud span { display: inline-flex; align-items: center; gap: 3px; }
.ud .ic { width: 14px; height: 14px; }
.ud .up { color: var(--good); } .ud .dn { color: var(--warn); }
.rv .tag { margin-bottom: 2px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-content: center; min-height: 68px; padding: 12px 14px; border: 0; border-radius: var(--r-card); background: var(--surface); text-align: start; }
.tile .ib { grid-row: 1 / span 3; align-self: center; }
.tile > * { grid-column: 2; }
.tile > .ib { grid-column: 1; }
.tile > .dim { font-size: var(--t-meta); }
.tile b { font-weight: 700; }
button.tile:active { transform: scale(0.97); transition: transform 120ms; }
.tile.warn { box-shadow: inset 0 0 0 2px var(--warn); }
.tile.warn b { color: var(--warn); }

.panes { display: flex; margin: 12px -16px 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.panes::-webkit-scrollbar { display: none; }
.pane { flex: 0 0 100%; min-width: 0; margin: 0; padding: 0 16px; scroll-snap-align: center; scroll-snap-stop: always; }
.pane > .kendara, .pane > svg { display: block; padding: 14px; border-radius: var(--r-card); background: var(--surface); max-width: none; box-sizing: border-box; }
.panes + .vchips { margin: 10px -16px 0; }
.vchips:not([hidden]) { animation: rise var(--spring-ms) var(--spring); }

.now { display: grid; gap: 12px; width: 100%; margin-top: 12px; padding: 14px 16px; border: 0; text-align: start; }
.now:active { background: color-mix(in srgb, var(--fill) 60%, var(--surface)); }
.nowh { display: flex; align-items: center; gap: 12px; }
.nowh .chev { width: 18px; height: 18px; color: var(--ink-2); opacity: 0.6; }
/* Antar dashas: a sliding row, the running one centred and filled */
.strip { display: flex; gap: 6px; margin: 0 -16px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: 16px; }
.strip::-webkit-scrollbar { display: none; }
.strip i { flex: none; display: grid; justify-items: start; min-width: 64px; padding: 6px 10px; border-radius: 10px; background: var(--fill); font-style: normal; scroll-snap-align: start; }
.strip i b { font-weight: 700; }
.strip i span { font-size: var(--t-meta); color: var(--ink); font-variant-numeric: tabular-nums; }
.strip i.cur { background: var(--accent); color: var(--on-accent); }
.strip i.cur span { color: inherit; opacity: 0.85; }

.ins { margin-top: 12px; padding: 16px; display: grid; gap: 12px; }
.ins .hl { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; }
.ins .hl .ic { flex: none; width: 22px; height: 22px; margin-top: 2px; color: var(--accent); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; font-size: var(--t-meta); }
.pill .ic { width: 16px; height: 16px; }
.pill b { font-size: var(--t-body); }
.pill.good { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.pill.mixed { color: var(--mixed); background: color-mix(in srgb, var(--mixed) 12%, transparent); }
.pill.bad { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.link { justify-self: start; min-height: 44px; margin: -8px 0 -10px; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 700; }

.hero { position: relative; }
.hero .place { position: absolute; top: 14px; right: 10px; margin: 0; }
.hero + .tiles { margin-top: 10px; }

.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cat { display: grid; justify-items: start; gap: 2px; min-height: 104px; padding: 14px; border: 0; border-radius: var(--r-card); background: var(--surface); text-align: start; }
.cat .ib { margin-bottom: 8px; }
.cat .dim { font-size: var(--t-meta); }
.cat:active { transform: scale(0.97); transition: transform 120ms; }

.win { padding: 12px 16px; }
.win + .win { box-shadow: 0 -0.5px 0 var(--sep) inset; box-shadow: none; border-top: 0.5px solid var(--sep); }
.win.later:first-child, .win:not(.later) + .win.later { border-top: 6px solid var(--bg); }
.row.sk span { flex: 1; height: 16px; border-radius: 6px; background: var(--fill); animation: shimmer 1.2s linear infinite; }

.score { display: flex; align-items: center; gap: 18px; justify-items: initial; padding: 16px; text-align: start; }
.ringw { display: grid; flex: none; }
.ringw svg { width: 104px; height: 104px; transform: rotate(-90deg); grid-area: 1 / 1; }
.ringw .num { grid-area: 1 / 1; align-self: center; justify-self: center; display: flex; align-items: baseline; gap: 2px; }
.ringw .num b { font-size: var(--t-title); }
.ringw .num span { color: var(--ink-2); font-size: var(--t-meta); }
.score .sc { display: grid; gap: 4px; min-width: 0; }
.score .vd { margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--t-meta); }
.legend span::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: currentColor; }
.legend .g { color: var(--good); } .legend .m { color: var(--mixed); } .legend .b { color: var(--warn); }
.ptiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pt { display: grid; align-content: space-between; gap: 6px; min-height: 64px; padding: 8px 8px 9px; border: 0; border-radius: 12px; background: var(--surface); text-align: start; position: relative; overflow: hidden; }
.pt b { font-size: var(--t-meta); font-weight: 700; line-height: 1.3; }
.pt span { font-size: var(--t-meta); line-height: 1.2; }
.pt::before { content: ''; position: absolute; top: 0; right: 0; left: 0; height: 4px; background: currentColor; }
.pt.g2, .pt.g1 { color: var(--good); } .pt.m0 { color: var(--mixed); } .pt.b1, .pt.b2 { color: var(--warn); }
.pt b { color: var(--ink); }
.pt.g2 { background: color-mix(in srgb, var(--good) 10%, var(--surface)); }
.pt.b2 { background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.pt:active { transform: scale(0.95); transition: transform 120ms; }
.pt.play { animation: rise var(--spring-ms) var(--spring) both; animation-delay: calc(var(--i) * 18ms); }

/* Detail sheet pages */
.sh .back { grid-column: 1; }
.body.turn { animation: rise var(--spring-ms) var(--spring); }
.lead { display: flex; align-items: center; gap: 8px; margin: 4px 4px 0; font-weight: 700; }
.lead .ic { width: 20px; height: 20px; }
.lead.k-good { color: var(--good); } .lead.k-mixed { color: var(--mixed); } .lead.k-bad { color: var(--warn); }
.why { margin-top: 12px; padding: 14px 16px; border-radius: var(--r-card); background: var(--tint); }
.lines { display: grid; margin: 12px 0 0; padding: 4px 16px; list-style: none; border-radius: var(--r-card); background: var(--surface); }
.lines li { position: relative; padding: 11px 0 11px 20px; }
.lines li + li { border-top: 0.5px solid var(--sep); }
.lines li::before { content: ''; position: absolute; left: 2px; top: 21px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); opacity: 0.5; }
.lines li.up::before { background: var(--good); opacity: 1; }
.lines li.dn::before { background: var(--warn); opacity: 1; }
.dasha { padding: 14px 16px; }
.dasha + .dasha { border-top: 0.5px solid var(--sep); box-shadow: none; }
.dh { display: flex; justify-content: space-between; gap: 12px; }
.dasha .dim { font-size: var(--t-meta); }
.dasha.cur .dh b { color: var(--accent); }
.subs { display: grid; margin: 8px 0 0; padding: 0; list-style: none; }
.subs li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: var(--t-meta); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.subs li.cur { color: var(--accent); font-weight: 700; }
.dasha:not(.cur) .subs { display: none; }

/* Names */
.selrow { display: flex; align-items: center; gap: 12px; min-height: 52px; position: relative; }
.selrow select { flex: 1; min-height: 52px; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 700; text-align: end; appearance: none; padding-right: 26px; }
.selrow .ic { position: absolute; right: 14px; width: 18px; height: 18px; color: var(--ink-2); pointer-events: none; }
.selrow + .seg { margin-top: 12px; }
.lchip[aria-checked='true'] { background: var(--accent); color: var(--on-accent); }
.lchip[aria-checked='true'] span { color: inherit; }
.lchip { background: var(--surface); }
.lchip b { font-size: var(--t-title); }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0; padding: 0; overflow: hidden; }
.names button { min-height: 50px; padding: 0 16px; border: 0; background: none; text-align: start; border-top: 0.5px solid var(--sep); }
.names button:nth-child(-n + 2) { border-top: 0; }
.names button:nth-child(odd) { border-right: 0.5px solid var(--sep); }
.names button:active { background: var(--fill); }
.names.sk { height: 150px; animation: shimmer 1.2s linear infinite; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: var(--t-meta); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: transform var(--spring-ms) var(--spring), opacity 200ms; }
.toast.on { transform: translate(-50%, 0); opacity: 1; }
@media (prefers-reduced-motion: reduce) { .body.turn, .pt.play { animation: none; } .toast { transition: opacity 120ms; } }

/* Lagna rule choice in the birth form, and the note on the chart */
.rule .opt { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; cursor: pointer; }
.rule .opt + .opt { box-shadow: 0 -0.5px 0 var(--sep); }
.rule .opt input { flex: none; width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); }
.rule .opt > span { display: grid; gap: 2px; }
.rule .opt .dim { font-size: var(--t-meta); }
.fixnote { display: flex; gap: 8px; align-items: flex-start; margin: 12px 4px 0; font-size: var(--t-meta); color: var(--mixed); }
.fixnote .ic { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.vchips { scroll-padding-inline: 16px; }

/* Almanac identity (2026-11-14): black ink and almanac red on paper, as a පංචාංග ලිත is printed. ---------- */
.top h1, .hero .ht, .score .vd, .ins .hl span { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; font-weight: 700; }
.label { margin-top: 30px; }
.label h2 { color: var(--ink-2); }
/* One quiet mark for every row icon instead of a rainbow of tiles. */
.ib { background: var(--tint) !important; color: var(--accent); }
/* Kendaraya: the lita's red double frame; lagna house in red tint. */
.kendara .frame { fill: none; stroke: var(--accent); stroke-width: 2; }
.kendara .lag { fill: var(--tint); }
.kendara .grid { stroke: var(--line); stroke-width: 1.2; }
.kendara text.c1 { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; fill: var(--accent); }
/* Porondam score: an astrologer's red stamp. */
.ringw .trk { stroke: var(--fill); }
.ringw .val { stroke: var(--accent); }
.ringw .num b { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; color: var(--accent); }
/* Porondam tiles: plain paper with a status dot, colour only where it means something. */
.pt { background: var(--surface) !important; color: var(--ink-2); }
.pt::before { display: none; }
.pt span { display: flex; align-items: center; gap: 5px; }
.pt span::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pt.g2 span, .pt.g1 span { color: var(--good); } .pt.m0 span { color: var(--mixed); } .pt.b1 span, .pt.b2 span { color: var(--warn); }
.hero { background: var(--surface); }
.strip i.cur { background: var(--accent); }
.mk.good { color: var(--good); } .mk.bad { color: var(--warn); }
/* Names */
.gchip { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; font-weight: 700; font-size: var(--t-body); }
.gchip.good { color: var(--good); } .gchip.bad { color: var(--ink-2); }
.nmsearch { margin-bottom: 10px; }
.nmhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 16px; margin-bottom: 12px; }
.nmbig { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; font-size: var(--t-title); font-weight: 700; }
.gseal { display: grid; justify-items: end; flex: none; }
.gseal b { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; font-size: var(--t-title); line-height: 1; }
.gseal span { font-size: var(--t-meta); }
.gseal.good b { color: var(--good); } .gseal.bad b { color: var(--warn); }
.gseal span { color: var(--ink-2); }
.mk.mixed { color: var(--mixed); background: color-mix(in srgb, var(--mixed) 14%, transparent); }
.btn.wide { margin-top: 14px; }
/* Tables in tool pages */
.tbl { padding: 6px 10px; overflow-x: auto; }
.tbl table { width: 100%; border-collapse: collapse; font-size: var(--t-meta); font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 6px 4px; text-align: left; white-space: nowrap; }
.tbl thead th { color: var(--ink-2); font-weight: 400; }
.tbl tbody tr + tr th, .tbl tbody tr + tr td { border-top: 0.5px solid var(--sep); }
.tbl tr.cur th, .tbl tr.cur td { color: var(--accent); font-weight: 700; }
.selrow input[type=date], .selrow input[type=datetime-local], .selrow input[type=text] { flex: 1; min-width: 0; width: 100%; min-height: 52px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--ink); font: inherit; font-weight: 700; text-align: end; appearance: none; outline: none; }
.selrow input[type=text] { letter-spacing: 1px; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.selrow input::placeholder { color: var(--ink-2); font-weight: 400; opacity: 0.6; }
.selrow:has(input:focus-visible) { box-shadow: inset 0 0 0 2px var(--accent); }

#lock, #pairok { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; background: var(--bg); overflow-y: auto; }
#pairok { z-index: 1001; }
#lock .lockin, #pairok .lockin { width: min(320px, 100%); display: grid; justify-items: center; gap: 8px; text-align: center; }
#lock img { border-radius: 18px; margin-bottom: 8px; }
#lock h1, #pairok h1 { font-size: var(--t-title); }
#lock .btn, #pairok .btn { display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
#lock .btn svg, #pairok .btn svg { width: 20px; height: 20px; }
#lock .err, #pairok .err { min-height: 1.4em; color: var(--warn); font-size: var(--t-meta); }

/* Maraka timeline: one node per antar dasha, the 22nd drekkana lord's periods in the accent colour. */
.tlkey { display: flex; align-items: center; gap: 8px; margin: 0 4px 10px; color: var(--ink-2); font-size: var(--t-meta); }
.tlkey .k22 { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.tl { list-style: none; margin: 0 0 8px; padding: 4px 0 4px 0; position: relative; }
.tl::before { content: ''; position: absolute; left: 62px; top: 0; bottom: 0; width: 2px; background: var(--sep); }
.tlmd { margin: 14px 0 6px 80px; font-size: var(--t-meta); color: var(--ink-2); }
.tlmd:first-child { margin-top: 0; }
.tlmd.d22 b { color: var(--accent); }
.tli { position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 32px; padding: 6px 0; }
.tli::before { content: ''; position: absolute; left: 57px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); box-sizing: border-box; }
.tla { text-align: right; white-space: nowrap; font-size: var(--t-meta); font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 2px; }
.tlb { display: grid; gap: 2px; padding: 8px 12px; border-radius: 12px; background: var(--surface); }
.tlb .dim { font-size: var(--t-meta); }
.tlb em { justify-self: start; font-style: normal; font-size: var(--t-meta); font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--fill); }
.tlb em.tlest { background: var(--accent); color: var(--bg); }
.tli.tlpick::before { background: var(--accent); border-color: var(--accent); }
.tli.tlpick .tlb { background: var(--tint); box-shadow: inset 3px 0 0 var(--accent); }
.tli.tlpick .tla { color: var(--accent); }
.tli.tl-past { opacity: .55; }
.tli.tl-now::before { box-shadow: 0 0 0 4px var(--tint); }
.tlpast { margin-bottom: 8px; }
.tlpast summary { cursor: pointer; padding: 10px 4px; color: var(--accent); font-weight: 700; list-style-position: inside; }


/* In-app question (replaces browser confirm) */
dialog.ask { width: min(320px, calc(100% - 48px)); padding: 20px; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px -20px rgb(0 0 0 / .5); }
dialog.ask::backdrop { background: rgb(0 0 0 / .4); }
dialog.ask p { margin-bottom: 16px; line-height: 1.5; }
.askb { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.askb .btn { width: 100%; justify-content: center; padding-inline: 8px; white-space: nowrap; font-size: var(--t-meta); }
.btn.ghost { background: var(--fill); color: var(--ink); }
.btn.warn { background: var(--warn); color: #fff; }

/* විද්‍යාත්මක කේන්දරය wheel */
.wbox { position: relative; overflow: hidden; border-radius: var(--r-card); background: var(--surface); margin-bottom: 12px; aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; }
.wbox .wz { transform-origin: 0 0; }
.wbox.moving .wz { will-change: transform; } /* only during a gesture: see zoom.mjs */
.wbox .wheel { display: block; width: 100%; height: auto; }
.wheel .wc { fill: var(--bg); stroke: var(--line); stroke-width: .25; }
.wheel .ws { fill: var(--surface); stroke: var(--line); stroke-width: .25; }
.wheel .ws.g { fill: var(--fill); }
.wheel [data-wseg] { cursor: pointer; }
.wheel .ws.on { fill: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.wheel .ws.rel { fill: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.wheel .wb { stroke: var(--ink-2); stroke-width: .3; }
.wheel .wm { stroke: var(--line); stroke-width: .3; stroke-dasharray: 1 1; }
.wheel .wl { fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.wheel .wr { stroke-width: .25; stroke: var(--accent); opacity: .45; }
.wheel .wr.t { stroke: var(--mixed); }
.wheel .wp circle { fill: var(--accent); }
.wheel .wp.t circle { fill: var(--mixed); }
.wheel .wp.lag circle { fill: var(--surface); stroke: var(--ink); stroke-width: .4; }
.wheel .wp text { fill: var(--on-accent); text-anchor: middle; dominant-baseline: central; font-weight: 700; }
.wheel .wp.lag text { fill: var(--ink); }
.wkey i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 10px; vertical-align: -1px; }
.wkey .kn { background: var(--accent); margin-left: 0; }
.wkey .kt { background: var(--mixed); }
.segs { display: grid; gap: 8px; margin-bottom: 8px; }
.wheel .wp.t.lag circle { stroke: var(--mixed); stroke-width: .8; }

/* සුබ අකුරු */
.aks { display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: 6px; margin-top: 6px; } /* even columns: rows line up */
.ak { display: grid; place-items: center; height: 44px; padding: 0; border: 0; border-radius: 10px; background: var(--fill); color: var(--ink); font: inherit; cursor: pointer; transition: transform var(--spring-bounce-ms) var(--spring-bounce); }
.ak:active { transform: scale(0.92); transition-duration: 120ms; }
.akst .aks { flex: 1; margin-top: 0; }
.grp + .selrow { margin-top: 12px; }
.ak.hi { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.akrow { display: grid; gap: 6px; margin-top: 4px; }
.akst { display: flex; align-items: center; gap: 8px; }
.akst .dim { min-width: 64px; }
.akbest { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

.tlm { position: relative; margin: 10px 0 10px 80px; font-size: var(--t-meta); color: var(--mixed); }
.tlm::before { content: ''; position: absolute; left: -24px; top: 50%; width: 14px; height: 2px; background: var(--mixed); }
.tlm.past { opacity: .55; }
.tlb em { background: var(--fill); }

/* නැකත් as a sky (2026-11-16): Weather-style. Always the dark slate sky, whatever the theme. */
body.sky {
	--bg: #11161f; --surface: rgb(255 255 255 / 0.08); --ink: #f3f6fa; --ink-2: rgb(243 246 250 / 0.7);
	--sep: rgb(255 255 255 / 0.14); --fill: rgb(255 255 255 / 0.08); --tint: rgb(255 255 255 / 0.1);
	--accent: #6cb6ff; --material: rgb(17 22 31 / 0.8); --bar: rgb(36 44 56 / 0.94); --bar-on: rgb(108 140 180 / 0.26);
	background: linear-gradient(180deg, #11161f 0%, #1c2532 45%, #2c3a4c 100%) fixed;
	color: var(--ink);
}
body.sky .top { display: none; }
body.sky main { padding-top: calc(10px + env(safe-area-inset-top)); }
body.sky .card { background: var(--surface); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); }
.skyhero { display: grid; justify-items: center; text-align: center; margin: 4px 0 18px; }
.skyhero .loc { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 16px; background: none; font-weight: 700; }
.skyhero .loc .ic { width: 15px; height: 15px; fill: currentColor; }
.skyhero .loc:active { background: var(--fill); }
.bmoon { width: 124px; height: 124px; margin: 6px 0 10px; filter: drop-shadow(0 0 22px rgb(220 228 240 / 0.22)); }
.bmoon .mdk { fill: rgb(255 255 255 / 0.08); }
.bmoon .mlt { fill: #eef2f8; }
.skyhero .ht { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; font-size: var(--t-title); font-weight: 700; line-height: 1.25; }
.skyhero .hs { color: var(--ink-2); }
.glass {
	display: block; width: 100%; margin: 0 0 10px; padding: 12px 14px; border: 0; border-radius: 22px; text-align: start; color: var(--ink);
	background: linear-gradient(180deg, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0.05));
	-webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
	box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), inset 0 -1px 0 rgb(255 255 255 / 0.06), inset 1px 0 0 rgb(255 255 255 / 0.08), inset -1px 0 0 rgb(255 255 255 / 0.08);
	transition: transform var(--spring-bounce-ms) var(--spring-bounce);
}
button.glass:active { transform: scale(0.97); transition-duration: 120ms; }
.gh { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; border-bottom: 0.5px solid var(--sep); font-size: var(--t-meta); color: var(--ink-2); }
.gh .ic { width: 15px; height: 15px; }
.nowl { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-top: 10px; }
.nowl b { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; font-size: var(--t-title); line-height: 1.2; }
.nowl span { font-size: var(--t-meta); color: var(--ink-2); white-space: nowrap; }
.hours { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 12px; border-top: 0.5px solid var(--sep); }
.hr { display: grid; justify-items: center; gap: 6px; width: 40px; font-size: var(--t-meta); }
.hr:first-child span { font-weight: 700; }
.hr b { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; font-size: var(--t-body); }
.hr i { width: 6px; height: 6px; border-radius: 50%; }
.hr i.g { background: #30d158; } .hr i.b { background: rgb(255 255 255 / 0.25); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid2 .sq { margin: 0; min-height: 138px; display: flex; flex-direction: column; }
.v2 { font-family: 'StaRay Ink', 'Noto Serif Sinhala', serif; font-size: 22px; line-height: 1.2; margin-top: 12px; white-space: nowrap; }
.sq .s { margin-top: auto; padding-top: 8px; font-size: var(--t-meta); color: var(--ink-2); }
.arc { width: 100%; height: 44px; margin-top: 4px; }
.arc .ap { fill: none; stroke: rgb(255 255 255 / 0.35); stroke-width: 1.5; } .arc .hz { stroke: rgb(255 255 255 / 0.25); } .arc .sn { fill: #ffd60a; }
.pair2 { display: flex; justify-content: space-between; margin-top: auto; font-size: var(--t-meta); color: var(--ink-2); }
.pair2 b { display: block; font-size: var(--t-body); color: var(--ink); }
.rday { position: relative; height: 6px; margin-top: 12px; border-radius: 3px; background: rgb(255 255 255 / 0.2); }
.rday i { position: absolute; top: 0; height: 6px; border-radius: 3px; background: #ff6961; }
.rday b { position: absolute; top: -3px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff; }
.sq.warnc { box-shadow: inset 0 0 0 1px rgb(255 105 97 / 0.6); }

/* Two cards with no heading between them still get air. */
.card.grp + .card.grp { margin-top: 12px; }
/* Maha dasha page: each antar dasha with its palapala as written. */
.antar { margin: 0 0 12px; padding: 12px 16px; border-radius: var(--r-card); background: var(--surface); }
.antar .dh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.antar .dh .dim { width: 100%; font-size: var(--t-meta); }
.antar .lines { margin: 6px 0 0; padding: 0; background: none; border-radius: 0; }
.antar.cur { box-shadow: inset 3px 0 0 var(--accent); }
.antar.past { opacity: 0.6; }

/* Maha dasha cards on the chart tab: swipe for the next and previous; each snaps to the centre. */
.mdcar { display: flex; gap: 10px; margin: 12px -16px 0; padding: 0 16px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.mdcar::-webkit-scrollbar { display: none; }
.mdc { flex: 0 0 calc(100% - 24px); padding: 14px 16px 6px; scroll-snap-align: center; }
.mdh { display: flex; align-items: center; gap: 8px; }
.mdh b { font-size: var(--t-body); }
.mdc.cur .mdh b { color: var(--accent); }
.mdr { font-size: var(--t-meta); }
.mdc .bar { margin-top: 8px; }
.mds { margin-top: 8px; }
.mdsr { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; padding: 9px 0; border: 0; background: none; color: var(--ink); text-align: start; font-size: var(--t-meta); }
.mdsr + .mdsr { box-shadow: 0 -0.5px 0 var(--sep); }
.mdsr b { font-size: var(--t-body); font-weight: 400; }
.mdsr span { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mdsr.cur b { color: var(--accent); font-weight: 700; }
.mdsr.past { opacity: 0.55; }
.mdsr:active { background: var(--fill); }
.swipe { display: flex; align-items: center; gap: 6px; }
.swipe .ic { width: 15px; height: 15px; flex: none; }
.antar { scroll-margin: 120px 0; }
.antar.flash { animation: flash 1.6s var(--spring); }
@keyframes flash { 0%, 40% { box-shadow: inset 3px 0 0 var(--accent), 0 0 0 2px var(--accent); } }

/* ඵලාඵල → දශා: maha dashas as rows that open to their antar dashas. */
.mdx { margin: 0 0 10px; }
.mdx > summary { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-card); background: var(--surface); list-style: none; cursor: pointer; }
.mdx > summary::-webkit-details-marker { display: none; }
.mdx > summary .rt { flex: 1; display: grid; gap: 2px; }
.mdx > summary .rt .dim { font-size: var(--t-meta); }
.mdx > summary .chev { transition: transform var(--spring-ms) var(--spring); }
.mdx[open] > summary .chev { transform: rotate(90deg); }
.mdx.cur > summary b { color: var(--accent); }
.mdx > summary:active { background: color-mix(in srgb, var(--fill) 60%, var(--surface)); }
.mdx[open] > .antar { margin-left: 12px; animation: rise var(--spring-ms) var(--spring); }
.mdx[open] > .antar:first-of-type { margin-top: 8px; }

/* Antar dashas fold too: tap the period to read its palapala. */
details.antar > summary { list-style: none; cursor: pointer; }
details.antar > summary::-webkit-details-marker { display: none; }
details.antar > summary .chev { margin-left: auto; transition: transform var(--spring-ms) var(--spring); }
details.antar[open] > summary .chev { transform: rotate(90deg); }
details.antar > summary .dim { order: 3; }
/* Maha dasha cards: the neighbours peek in faintly at the screen edges. */
.mdcar { -webkit-mask-image: linear-gradient(90deg, rgb(0 0 0 / 0.15) 0, #000 18px, #000 calc(100% - 18px), rgb(0 0 0 / 0.15) 100%); mask-image: linear-gradient(90deg, rgb(0 0 0 / 0.15) 0, #000 18px, #000 calc(100% - 18px), rgb(0 0 0 / 0.15) 100%); }
.mdc { transition: opacity var(--spring-ms) var(--spring); }
.mdc.side { opacity: 0.35; }

/* කේන්දරයෙන් උපන් වේලාව: lagna grid, tappable kendaraya, graha chips (2026-11-16) */
.signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.signs .vchip { justify-items: center; min-height: 56px; }
.rvchart { margin-top: 8px; }
.kendara .hit { fill: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.kendara .hit:active { fill: var(--fill); }
.kendara .hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 2.5; }
.rvchart .kendara tspan.hi { fill: var(--accent); }
.gchips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 12px; }
.gchip { justify-items: center; min-height: 52px; padding: 6px 4px; font: 700 var(--t-body)/1.2 'StaRay Ink', 'Noto Serif Sinhala', serif; }
.gchip span { font-family: 'Noto Sans Sinhala', sans-serif; font-weight: 400; }
.gchip.done:not([aria-pressed='true']) { color: var(--ink-2); }
.card > .selrow + .selrow { border-top: 0.5px solid var(--sep); }
.btn.ghost { background: var(--fill); color: var(--ink); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* Wide screens (2026-11-17, owner: "pc view looks like shit"). Phones keep the layout above.
   ≥768: wider content, sheets become centred dialogs. ≥1024: Mac/iPad sidebar instead of the tab bar,
   and the chart tab in two columns. */
@media (min-width: 768px) {
	:root { --wide: 720px; }
	main, .top { max-width: var(--wide); padding-left: 32px; padding-right: 32px; }
	.tabs { padding-left: max(4px, calc((100vw - var(--wide)) / 2)); padding-right: max(4px, calc((100vw - var(--wide)) / 2)); }
	.sheet { inset: 0; width: min(560px, calc(100vw - 64px)); max-height: min(84dvh, 820px); margin: auto; padding-bottom: 20px; border-radius: 28px; }
	.sheet.tall { height: min(84dvh, 820px); }
	.sheet::backdrop { background: rgb(0 0 0 / 0.32); }
	.grabber { display: none; }
}
@media (min-width: 1024px) {
	:root { --side: 232px; --wide: 1000px; }
	body { padding-bottom: 32px; padding-left: var(--side); }
	.tabs {
		inset: 0 auto 0 0; width: var(--side);
		grid-template-columns: none; grid-auto-rows: min-content; align-content: start; gap: 2px;
		padding: calc(24px + env(safe-area-inset-top)) 12px 24px;
		box-shadow: 0.5px 0 0 var(--sep);
	}
	.tabs button { grid-template-columns: 24px 1fr; justify-items: start; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: var(--t-body); }
	.tabs button[aria-current] { background: var(--bar-on); color: var(--ink); }
	.tabs button[aria-current] .ic { color: var(--accent); }
	.top { padding-top: 28px; }
	.cols { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 32px; align-items: start; }
	.cols > .col:first-child { position: sticky; top: 96px; }
	.cols > .col > .label:first-child, .cols > .col > :first-child { margin-top: 0; }
}

/* PC (mouse or trackpad): no press-and-hold or swipe. Every such gesture gets a visible button (owner, 2026-11-17). */
.pc { display: none; }
@media (hover: hover) and (pointer: fine) {
	.touch { display: none; }
	.pc { display: flex; }
	/* Saved horoscopes: තරුව / වෙනස් always shown as buttons at the row's end. */
	.prof { display: flex; align-items: center; background: var(--surface); }
	.prof .pick, .prof:focus-within .pick:not(:focus) { flex: 1; min-width: 0; transform: none; background: none; }
	.prof.cur { background: linear-gradient(var(--tint), var(--tint)), var(--surface); }
	.mdcar { margin: 12px 0 0; padding: 0; }
	.mdc { flex-basis: 100%; }
	.acts { position: static; order: 2; gap: 6px; padding-right: 12px; }
	.acts button { width: auto; min-height: 40px; padding: 0 12px; grid-auto-flow: column; gap: 6px; border-radius: 10px; background: var(--fill); color: var(--ink); }
	.acts button:hover, .row:hover, .vchip:hover { background-color: var(--bar-on); }
	.acts-l { order: 3; padding-left: 0; }
	.acts-l button { width: auto; color: var(--warn); }
	/* Chips wrap instead of scrolling sideways. */
	.vchips { flex-wrap: wrap; overflow-x: visible; }
	/* Maha dashas and the wheel: arrows and + / − instead of swipe and pinch. */
	.mdnav { justify-content: space-between; gap: 8px; margin-top: 8px; }
	.zbtns { justify-content: center; gap: 12px; margin-top: 8px; }
	.mdnav .btn, .zbtns .btn { min-height: 40px; min-width: 56px; padding: 0 16px; }
	.mdnav .ic { width: 18px; height: 18px; }
	.row, .vchip, .acts button { cursor: pointer; }
}
/* භාව කේන්දරය pane (the wheel moved into the chart strip, 2026-11-17) */
.pane > .wbox { margin-bottom: 0; }
.wbox.wwait { display: grid; place-items: center; }
.whctl { margin-top: 12px; }

/* කේන්දර list search and the repeat message (2026-11-17) */
.pfind { margin: 4px 0 12px; }
.pnone { margin: 16px 4px; text-align: center; }
.linkbtn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* Sheets sit above the on-screen keyboard (--kb, set from visualViewport in main.mjs). */
.sheet { bottom: var(--kb, 0px); max-height: calc(88dvh - var(--kb, 0px)); transition: bottom 0.2s; }
.sheet.tall { height: calc(88dvh - var(--kb, 0px)); }
@media (min-width: 768px) {
	.sheet { max-height: calc(min(84dvh, 820px) - var(--kb, 0px)); }
	.sheet.tall { height: calc(min(84dvh, 820px) - var(--kb, 0px)); }
}
/* While searching the කේන්දර list the sheet sits at the top of the screen (main.mjs openProfiles). */
.sheet.lifted { top: calc(8px + env(safe-area-inset-top)); bottom: var(--kb, 0px); height: auto; max-height: none; border-radius: 28px; transition: none; } /* full height down to the keyboard: nothing shows under it (owner) */
@media (min-width: 768px) { .sheet.lifted { margin-top: 0; } }
/* නව කේන්දරයක් sits above the search in the කේන්දර sheet (2026-11-17). */
.add.addtop { width: 100%; margin: 4px 0 8px; padding: 0 16px; border-radius: var(--r-card); background: var(--surface); box-shadow: none; }

/* Approve a computer from the phone */
#lock .ghost, #pairok .ghost { background: var(--fill); color: var(--accent); }
#lock .pairin { width: min(380px, 100%); }
#lock .qr { width: 220px; padding: 10px; border-radius: var(--r-card); background: #fff; }
#lock .qr svg { display: block; width: 100%; height: auto; }
#lock .code b { font-size: var(--t-title); letter-spacing: 2px; font-variant-numeric: tabular-nums; }
#lock .left, #pairok .left { text-align: start; font-size: var(--t-meta); }
#pairok .big svg { width: 48px; height: 48px; color: var(--accent); }
#pairok .warnline { color: var(--warn); font-size: var(--t-meta); font-weight: 700; }

/* PDF exports: one tinted button below the content, not a list row */
.pdfbtn { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 24px; padding: 14px 16px; border: 1.5px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--r-card); background: var(--tint); color: var(--accent); text-align: start; transition: transform 120ms; }
.pdfbtn > .ic { flex: none; width: 26px; height: 26px; }
.pdfbtn .rt b { color: var(--accent); }
.pdfbtn .rt .dim { color: var(--ink-2); }
.pdftag { flex: none; padding: 0 10px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: var(--t-meta); font-weight: 700; line-height: 26px; }
.pdfbtn:active { transform: scale(0.98); }

/* ── Desktop v2 (2026-11-18, owner: "desktop view is so bad"). A Mac app, not a stretched phone. ──────────────
   ≥1024: a 264 px source-list sidebar (app name, sections, saved horoscopes), content up to 1180 px.
   ≥1200 with a mouse: #sheet-info docks at the right as an inspector (ModalSheet data-dock) and the page makes room.
   Lists, tiles and tools go to two columns when <main> is wide enough (container query, so the inspector narrows them). */
.brand, .sidelist, .wide-only { display: none; }
@media (min-width: 1024px) {
	:root { --side: 264px; --wide: 1180px; --insp: 420px; }
	.wide-only { display: block; }
	.narrow-only { display: none; }
	body { padding-left: var(--side); transition: padding-right var(--spring-ms) var(--spring); }
	main { container: main / inline-size; padding: 8px 40px 48px; }
	.top { padding: 32px 40px 16px; align-items: center; }
	.top h1 { line-height: 1.2; }
	#who { display: none; }

	/* Sidebar */
	.tabs {
		overflow-y: auto; width: var(--side); padding: 18px 12px 24px;
		background: var(--bar); box-shadow: 0.5px 0 0 var(--sep);
	}
	.brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 20px; font-size: var(--t-body); letter-spacing: 0.2px; }
	.brand img { border-radius: 8px; }
	.tabs > button { transition: background-color 160ms, color var(--spring-ms) var(--spring); }
	.tabs > button:hover:not([aria-current]) { background: var(--fill); }
	.sidelist { display: grid; gap: 2px; margin-top: 24px; padding-top: 16px; border-top: 0.5px solid var(--sep); }
	.sideh { padding: 0 12px 6px; font-size: var(--t-meta); font-weight: 700; color: var(--ink-2); }
	.sidelist button {
		display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 10px;
		background: none; color: var(--ink); text-align: start; font-size: var(--t-meta); transition: background-color 160ms;
	}
	.sidelist button:hover { background: var(--fill); }
	.sidelist button[aria-current] { background: var(--bar-on); }
	.sidelist button > span { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
	.sidelist b, .sidelist small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.sidelist small { font-size: var(--t-meta); color: var(--ink-2); font-variant-numeric: tabular-nums; }
	.av {
		flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
		background: var(--tint); color: var(--accent); font: 700 var(--t-body)/1 'StaRay Ink', 'Noto Serif Sinhala', serif; font-style: normal;
	}
	.sidelist button[aria-current] .av { background: var(--accent); color: var(--on-accent); }
	.sidelist .st { width: 14px; height: 14px; color: var(--ink-2); fill: currentColor; stroke-width: 0; }
	.sidelist .more { min-height: 40px; color: var(--accent); font-weight: 700; }
	.sidelist .more .ic { width: 18px; height: 18px; margin: 0 7px; }

	/* කේන්දරය: a bigger chart, its own column with the birth facts under it. */
	.cols { grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); gap: 40px; }
	.cols > .col:first-child { top: 104px; }
	.kendara { max-width: 400px; }
	.cols .wide-only .tiles { grid-template-columns: 1fr 1fr; }
}

/* Two columns once the content is wide enough (also inside the page beside the inspector). */
@container main (min-width: 720px) {
	/* Icon-row lists (not the chart strips or dasha folds): rows run left → right, then down. */
	.card.grp:has(> .row:nth-child(4)):not(:has(> :not(.row))) { display: grid; grid-template-columns: 1fr 1fr; }
	.card.grp:has(> .row:nth-child(4)):not(:has(> :not(.row))) > .row:nth-child(2)::before { display: none; }
	.card.grp:has(> .row:nth-child(4)):not(:has(> :not(.row))) > .row:nth-child(even) { box-shadow: inset 0.5px 0 0 var(--sep); }
	.cats { grid-template-columns: repeat(4, 1fr); }
	.ptiles { grid-template-columns: repeat(5, 1fr); }
	.tiles { grid-template-columns: repeat(3, 1fr); }
	.cols .tiles { grid-template-columns: 1fr 1fr; }
}
@container main (min-width: 960px) {
	.tiles { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
	.card.grp > button.row:hover { background: var(--fill); }
	.cat { transition: background-color 160ms, transform var(--spring-bounce-ms) var(--spring-bounce); }
	.cat:hover { background: color-mix(in srgb, var(--surface) 80%, var(--ink) 6%); }
}

/* නැකත් on PC: sky hero beside the hour and the four squares, the rest full width below. */
@media (min-width: 1100px) {
	body.sky main { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); column-gap: 28px; align-items: start; padding-top: 40px; }
	body.sky main > * { grid-column: 1 / -1; }
	body.sky main > .skyhero { grid-column: 1; grid-row: 1 / span 2; align-self: center; margin: 0; }
	body.sky main > .nowc { grid-column: 2; grid-row: 1; }
	body.sky main > .grid2 { grid-column: 2; grid-row: 2; margin-bottom: 0; }
	body.sky main > .label:first-of-type { margin-top: 40px; }
	body.sky .bmoon { width: 200px; height: 200px; margin: 18px 0 20px; }
}

/* තව on PC: the groups flow in two columns. */
@media (min-width: 1200px) {
	body[data-view='info'] main { columns: 2; column-gap: 28px; }
	body[data-view='info'] main > * { break-inside: avoid; }
	body[data-view='info'] main > .label { break-after: avoid; }
	body[data-view='info'] main > :first-child { margin-top: 0; }
	body[data-view='info'] main .card.grp { display: block !important; }
	body[data-view='info'] main .card.grp > .row { box-shadow: none !important; }
	body[data-view='info'] main .card.grp > .row:nth-child(2)::before { display: block !important; }
}
/* The row whose details show in the inspector stays marked. */
body.inspect #main .row.sel { background: var(--bar-on); }

/* Inspector: the detail sheet as a panel at the right edge (non-modal; the page stays usable). */
@media (min-width: 1200px) {
	body.inspect { padding-right: var(--insp); }
	body.inspect .top, body.inspect main { max-width: min(var(--wide), calc(100vw - var(--side) - var(--insp))); }
	.sheet.docked {
		inset: 0 0 0 auto; z-index: 6; width: var(--insp); height: 100dvh; max-height: none; margin: 0;
		padding: 0 20px 24px; border-radius: 0; corner-shape: round;
		background: var(--bg); box-shadow: -0.5px 0 0 var(--sep), -24px 0 48px -32px rgb(0 0 0 / 0.5);
	}
	.sheet.docked .sh { padding-top: 20px; }
	body.sky .sheet.docked { background: #151b25; }
}

/* Search (Ctrl+F / ⌘F), Spotlight-style: a frosted panel near the top, results grouped by where they live,
   the selected one filled with the accent like macOS. Sizes stay 17 / 14. */
.spot {
	position: fixed; inset: 14vh 0 auto; width: min(680px, calc(100vw - 32px)); max-height: 70vh; margin: 0 auto; padding: 0;
	border: 0; border-radius: 18px; color: var(--ink); overflow: hidden;
	background: color-mix(in srgb, color-mix(in srgb, var(--surface) 88%, #000) 96%, transparent); /* nearly solid: the page must not show through (owner) */
	-webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
	box-shadow: 0 0 0 0.5px var(--sep), 0 24px 80px -12px rgb(0 0 0 / 0.55);
}
.spot[open] { display: flex; flex-direction: column; animation: spotin var(--spring-ms) var(--spring); }
@keyframes spotin { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
.spot::backdrop { background: rgb(0 0 0 / 0.42); }
.spin { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.spot.has .spin { box-shadow: 0 0.5px 0 var(--sep); }
.spin .ic { width: 22px; height: 22px; color: var(--ink-2); }
.spin input { flex: 1; min-width: 0; min-height: 36px; border: 0; background: none; color: var(--ink); font-size: var(--t-body); font-weight: 700; outline: none; appearance: none; }
.spin input::-webkit-search-cancel-button { display: none; }
.spot kbd, .sfind kbd { padding: 0 6px; border-radius: 6px; background: var(--fill); color: var(--ink-2); font: 400 var(--t-meta)/22px system-ui, sans-serif; }
.spotl { overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 8px; }
.spot:not(.has) .spotl { display: none; }
.spr { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: start; }
.spr .rt b, .spr .rt .dim { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spr .rt .dim { font-size: var(--t-meta); }
.spr .ib:empty { width: 30px; height: 30px; border-radius: 8px; background: var(--fill); }
.spr .mk { margin: 0 8px; }
.spr .av { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--tint); color: var(--accent); font: 700 var(--t-meta)/1 'StaRay Ink', 'Noto Serif Sinhala', serif; font-style: normal; }
.spk { margin-left: auto; color: var(--on-accent); font-size: var(--t-meta); opacity: 0; }
.spr[aria-selected='true'] { background: var(--accent); color: var(--on-accent); }
.spr[aria-selected='true'] .dim { color: var(--on-accent); opacity: 0.8; }
.spr[aria-selected='true'] .spk { opacity: 0.9; }
.spr[aria-selected='true'] .av { background: var(--on-accent); color: var(--accent); }
.spn { padding: 18px; text-align: center; color: var(--ink-2); }
/* Sidebar search field (PC). */
.tabs .sfind { display: none; }
@media (min-width: 1024px) {
	.tabs .sfind { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; margin: 0 0 14px; padding: 0 8px 0 10px; border: 0; border-radius: 10px; background: var(--fill); color: var(--ink-2); font-size: var(--t-meta); text-align: start; cursor: pointer; }
	.tabs .sfind .ic { width: 16px; height: 16px; }
	.tabs .sfind span { flex: 1; }
	.tabs .sfind:hover { color: var(--ink); }
}
@media (prefers-reduced-motion: reduce) { .spot[open] { animation: none; } }
.spr[aria-selected='true'] .ib { background: rgb(255 255 255 / 0.28) !important; color: var(--on-accent); }
.spr[aria-selected='true'] .mk { box-shadow: 0 0 0 2px var(--on-accent); }

/* Sealed horoscopes (2026-11-19): recovery code, its entry and the "I saved it" check on the lock screen. */
#lock .big svg { width: 48px; height: 48px; color: var(--accent); }
#lock .warnline { color: var(--warn); font-size: var(--t-meta); font-weight: 700; }
#lock .reccode span { white-space: nowrap; }
#lock .lockin { width: min(360px, 100%); }
#lock .reccode { width: 100%; margin: 8px 0; padding: 14px 12px; border-radius: var(--r-card); background: var(--fill); font: 600 var(--t-body)/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; word-spacing: 2px; user-select: all; overflow-wrap: anywhere; }
#lock .reccode-in { width: 100%; padding: 12px; border-radius: var(--r-card); border: 1px solid var(--line); background: var(--fill); color: inherit; font: 600 var(--t-meta)/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; text-align: center; }
#lock .check { display: flex; gap: 8px; align-items: center; font-size: var(--t-meta); min-height: 44px; }
#lock .check input { width: 20px; height: 20px; accent-color: var(--accent); }
