:root { --header-h: auto; --days-h: 34px; }
html, body {
	height: 100dvh;
	min-height: 100dvh;
	max-height: 100dvh;
	margin: 0;
	overflow: hidden;
	touch-action: manipulation;
	background: #0f172a;
	font-family: 'Inter', sans-serif;
}
.app-shell {
	display: flex;
	flex-direction: column;
	height: 100dvh;
	width: 100vw;
}

header {
	background: #1e293b;
	border-bottom: 2px solid #334155;
	padding: 12px 16px;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	z-index: 50;
}

.nav-group {
	display: flex;
	align-items: center;
	gap: 4px;
	background: #334155;
	padding: 4px;
	border-radius: 12px;
}

.ui-btn {
	background: #4f46e5;
	color: white;
	border-radius: 8px;
	font-size: 11px;
	font-weight: 900;
	text-transform: uppercase;
	padding: 10px 16px;
	transition: all 0.2s;
	border: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}
.ui-btn:hover { background: #6366f1; }
.ui-btn:active { transform: translateY(1px); }
.ui-btn:disabled {
	opacity: 0.3;
	cursor: not-allowed;
	pointer-events: none;
}
.btn-side { background: #4338ca; }
.nav-arrow { width: 12px; height: 12px; }

.select-group { display: flex; gap: 10px; }
.select-ui {
	background: #312e81;
	color: white;
	font-weight: 900;
	font-size: 11px;
	text-transform: uppercase;
	padding: 8px 28px 8px 12px;
	border-radius: 8px;
	border: none;
	appearance: none;
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='4' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 12px;
	width: 22vw;
	min-width: 0;
	box-sizing: border-box;
	opacity: 0.9;
}
.select-gregorian {
	background: #14532d;
}
.select-hindu {
	background: #7f1d1d;
	opacity: 0.92;
}

.calendar-main { flex: 1; display: flex; flex-direction: column; background: linear-gradient(to bottom, #ffffff, #94a3b8); position: relative; }

.day-labels {
	height: var(--days-h);
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	background: #0f172a;
	color: #94a3b8;
	font-size: 10px;
	font-weight: 900;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	align-items: center;
	text-align: center;
}

#grid-viewport { flex: 1; position: relative; overflow: hidden; }
.grid-body { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 1px; }
.grid-body.slide-in-left  { animation: slideInLeft  250ms ease-out both; }
.grid-body.slide-in-right { animation: slideInRight 250ms ease-out both; }
.grid-body.slide-out-left  { animation: slideOutLeft  250ms ease-out both; pointer-events: none; }
.grid-body.slide-out-right { animation: slideOutRight 250ms ease-out both; pointer-events: none; }

@keyframes slideInLeft   { from { transform: translateX( 100%); } to { transform: translateX(0); } }
@keyframes slideInRight  { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes slideOutLeft  { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@keyframes slideOutRight { from { transform: translateX(0); } to { transform: translateX( 100%); } }

.day-cell {
	background: white;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}
.day-cell.clickable { cursor: pointer; }
.day-cell.today { background: #eff6ff; box-shadow: inset 0 0 0 2px #3b82f6; z-index: 10; }
.day-cell.other-month { background: #e2e8f0; opacity: 0.3; pointer-events: none; }

.num-stack { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.num-val { font-size: clamp(0.9rem, 2.5vh, 1.3rem); font-weight: 800; }
.val-ad { color: #1e293b; }
.val-bs { color: #dc2626; font-family: 'Mukta', sans-serif; font-size: 1em; }

.lunar-icon { position: absolute; top: 2px; right: 2px; font-size: 0.7rem; opacity: 0.7; }
.lunar-icon.full-moon { opacity: 1; font-size: 0.9rem; text-shadow: 0 0 4px #f59e0b, 0 0 8px #f59e0b, 0 0 14px rgba(245,158,11,0.5); }

.fest-badge {
	font-size: clamp(9px, 1.6vh, 13px);
	font-weight: 900;
	text-align: left;
	padding: 2px 4px;
	border-radius: 2px;
	text-transform: uppercase;
	white-space: nowrap;
	overflow: hidden;
	border-width: 1px;
	position: relative;
	width: 100%;
	box-sizing: border-box;
}

.fest-text {
	display: inline-block;
	white-space: nowrap;
}

.fest-text.scrolling {
	animation: marquee-scroll var(--marquee-duration, 4s) linear 1s infinite alternate;
}

@keyframes marquee-scroll {
	from { transform: translateX(0); }
	to   { transform: translateX(var(--marquee-dist, 0px)); }
}

.fest-container {
	position: absolute;
	bottom: 2px;
	left: 2px;
	right: 2px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.fest-hindu { background: #fff1f2; color: #b91c1c; border-color: #fecaca; }
.fest-western { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.fest-astro { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.lunar-icon.eclipse-icon { opacity: 1; width: 1rem; height: 1rem; }
.lunar-icon.eclipse-icon svg { width: 100%; height: 100%; display: block; }

/* Modal badge colours */
.modal-bs            { background: #fff1f2; color: #b91c1c; border-color: #fecaca; }
.eclipse-total-solar { background: #1c1917; color: #fafaf9; border-color: #57534e; }
.eclipse-total-lunar { background: #7f1d1d; color: #fef2f2; border-color: #fca5a5; }
.eclipse-other       { background: #e7e5e4; color: #44403c; border-color: #a8a29e; }

.modal-fest { display: inline-block; font-size: 10px; font-weight: 900; padding: 4px 8px; border-radius: 4px; text-transform: uppercase; border-width: 1px; margin-left: 6px; }

#modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 100; align-items: center; justify-content: center; padding: 10px; }
.modal-content { background: white; width: 100%; max-width: 500px; border-radius: 1rem; overflow: hidden; box-shadow: 0 25px 50px rgba(0,0,0,0.5); }
.modal-header { padding: 24px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
.modal-header h2 { font-size: 1.25rem; font-weight: 900; color: #0f172a; text-transform: uppercase; font-style: italic; margin: 0; }
.modal-badges { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.modal-body { padding: 24px; max-height: 60vh; overflow-y: auto; color: #334155; font-size: 0.875rem; line-height: 1.6; }
#m-content ul { list-style: disc; padding-left: 1.25rem; margin-top: 0.25rem; }
#m-content li { margin-bottom: 0.2rem; }
.modal-close { margin-top: 24px; width: 100%; justify-content: center; }

.bottom-bar {
	background: #1e293b;
	border-top: 2px solid #334155;
	padding: 10px 16px;
	display: flex;
	justify-content: center;
}

/* ---- Weather bar ---- */
#weather-bar {
	background: #0f172a;
	border-bottom: 1px solid #1e293b;
	padding: 4px 0;
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	flex-shrink: 0;
	touch-action: none;
	opacity: 0.85;
	max-height: 80px;
	overflow: hidden;
	transition: opacity 0.35s ease, max-height 0.35s ease, padding 0.35s ease, border-width 0.35s ease;
}

.wx-day {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1px;
	background: #1e293b;
	border-radius: 0;
	padding: 5px 2px;
	overflow: hidden;
}
.wx-day.wx-today { background: #1e293b; box-shadow: none; }
.wx-icon  { font-size: clamp(1rem, 3vw, 1.3rem); line-height: 1; }
.wx-hi    { font-size: clamp(9px, 2.5vw, 11px); font-weight: 900; color: #f8fafc; }
.wx-lo    { font-size: clamp(8px, 2vw, 9px); color: #64748b; }
.wx-loading { font-size: 10px; color: #475569; padding: 6px 12px; align-self: center; }

@media (max-width: 480px) {
	header { justify-content: center; }
	.fest-badge { font-size: 9px; }
}
