/* Nepali Calendar — Dark + Gold theme with Light Mode support */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Dark theme (default) ───────────────────────────── */
:root {
  --bg:         #0d1117;
  --surface:    #161b27;
  --surface-2:  #1e2535;
  --surface-3:  #252d40;
  --border:     #2a3145;
  --border-2:   #3a4460;
  --gold:       #f59e0b;
  --gold-bright:#fbbf24;
  --gold-dim:   #92400e;
  --gold-bg:    rgba(245, 158, 11, .10);
  --gold-bg-2:  rgba(245, 158, 11, .18);
  --red:        #ef4444;
  --red-bg:     rgba(239, 68, 68, .12);
  --red-border: rgba(239, 68, 68, .30);
  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-dim:   #94a3b8;
  --sat:        #f87171;
  --shadow:     0 4px 24px rgba(0, 0, 0, .5);
  --shadow-sm:  0 2px 8px  rgba(0, 0, 0, .35);
  --radius:     12px;
  --radius-sm:  8px;
}

/* ─── Light theme (system preference) ───────────────── */
@media (prefers-color-scheme: light) {
  :root {
    --bg:         #f1f5f9;
    --surface:    #ffffff;
    --surface-2:  #f8fafc;
    --surface-3:  #f1f5f9;
    --border:     #e2e8f0;
    --border-2:   #cbd5e1;
    --gold:       #b45309;
    --gold-bright:#d97706;
    --gold-dim:   #fef3c7;
    --gold-bg:    rgba(180, 83, 9, .08);
    --gold-bg-2:  rgba(180, 83, 9, .15);
    --red:        #dc2626;
    --red-bg:     rgba(220, 38, 38, .08);
    --red-border: rgba(220, 38, 38, .22);
    --text:       #0f172a;
    --text-muted: #64748b;
    --text-dim:   #334155;
    --sat:        #dc2626;
    --shadow:     0 4px 24px rgba(0, 0, 0, .10);
    --shadow-sm:  0 2px 8px  rgba(0, 0, 0, .07);
  }
}

html { background: var(--bg); }

body {
  font-family: 'Inter', sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(245, 158, 11, .08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(100, 116, 139, .12), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Site brand bar ─────────────────────────────────── */
.cal-site-bar {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  max-width: 1060px;
  margin: 0 auto;
  padding: 1rem 1.25rem 0;
  font-size: .85rem;
}
.cal-brand {
  font-family: 'Mukta', sans-serif;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: .01em;
}
.cal-brand:hover { color: var(--gold-bright); }
.cal-brand-sep { color: var(--text-muted); opacity: .6; }
.cal-brand-page {
  font-family: 'Mukta', system-ui, sans-serif;
  color: var(--text-dim);
  font-weight: 500;
  font-size: inherit;
  line-height: inherit;
  margin: 0;
}

/* ─── Preloader ──────────────────────────────────────── */
#cal-preloader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .4s ease, transform .4s ease;
}

#cal-preloader.pl-done {
  opacity: 0;
  transform: scale(.98);
  pointer-events: none;
}

.pl-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  width: 260px;
}

.pl-icon {
  font-size: 2.8rem;
  line-height: 1;
  animation: pl-pulse 1.8s ease-in-out infinite;
}
@keyframes pl-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: .65; transform: scale(.93); }
}

.pl-title {
  font-family: 'Mukta', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
}

.pl-bar-wrap {
  width: 100%;
  height: 4px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}

#pl-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  border-radius: 99px;
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}

.pl-msg {
  font-family: 'Mukta', sans-serif;
  font-size: 1rem;
  color: var(--text-dim);
  text-align: center;
  min-height: 1.4em;
  transition: opacity .2s;
}

.pl-sub {
  font-size: .72rem;
  color: var(--text-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ─── Root Layout ────────────────────────────────────── */
#nep-cal-root {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-areas:
    "sidebar main"
    "holidays main";
  gap: 1.25rem;
  max-width: 1060px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  align-items: start;
}

/* ─── Sidebar ─────────────────────────────────────────── */
#cal-sidebar {
  grid-area: sidebar;
  position: sticky;
  top: 1.25rem;
}

/* ─── Today Card ─────────────────────────────────────── */
#today-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.tc-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .85rem;
  align-items: start;
}

.tc-right {
  border-left: 1px solid var(--border);
  padding-left: .85rem;
}

.tc-date {
  font-family: 'Mukta', sans-serif;
  font-size: 4.5rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  letter-spacing: -.02em;
}

.tc-month-year {
  font-family: 'Mukta', sans-serif;
  font-size: 1rem;
  color: var(--text-dim);
  margin-top: .1rem;
}

.tc-day {
  font-family: 'Mukta', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-top: .6rem;
}

.tc-ad {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.tc-rows {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.tc-row {
  display: flex;
  flex-direction: column;
  gap: .05rem;
}

.tc-label {
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 600;
}

.tc-val {
  font-family: 'Mukta', sans-serif;
  font-size: .9rem;
  color: var(--text-dim);
  line-height: 1.3;
}

.tc-sun-row {
  display: flex;
  gap: .75rem;
  margin-top: .3rem;
}

.tc-sun-item {
  display: flex;
  align-items: center;
  gap: .3rem;
}

.tc-sun-icon { font-size: .9rem; }

.tc-sun-time {
  font-family: 'Mukta', sans-serif;
  font-size: .85rem;
  color: var(--text-dim);
}

.tc-ritu-badge {
  display: inline-block;
  font-family: 'Mukta', sans-serif;
  font-size: .7rem;
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid rgba(180, 83, 9, .2);
  border-radius: 99px;
  padding: .12rem .5rem;
  margin-top: .5rem;
}

/* Today card festival photo */
.tc-wiki {
  margin-bottom: .85rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.tc-wiki-link { display: block; line-height: 0; }
.tc-wiki-img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  display: block;
}
.tc-wiki-extract {
  font-family: 'Mukta', sans-serif;
  font-size: .78rem;
  color: var(--text-dim);
  line-height: 1.35;
  padding: .5rem .65rem 0;
  margin: 0;
}
.tc-wiki .wiki-credit {
  display: block;
  padding: .35rem .65rem .55rem;
  font-size: .62rem;
  color: var(--text-muted);
}
.tc-wiki .wiki-credit a { color: var(--text-dim); }

/* ─── Date Converter ─────────────────────────────────── */
#date-converter {
  margin-top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem .95rem 1.05rem;
  box-shadow: var(--shadow-sm);
}

.cv-heading {
  font-family: 'Mukta', sans-serif;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .75rem;
}
.cv-heading .en {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: .68rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: .15rem;
}

.cv-panels {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.cv-panel {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .7rem .65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.cv-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.cv-row {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr .7fr;
  gap: .35rem;
}

.cv-row select,
.cv-row input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  height: 32px;
  padding: 0 .4rem;
  font-size: .75rem;
  font-family: 'Mukta', sans-serif;
  min-width: 0;
  width: 100%;
}
.cv-row select:focus,
.cv-row input:focus {
  outline: 2px solid var(--gold-bg-2);
  outline-offset: 1px;
  border-color: rgba(180, 83, 9, .4);
}

.cv-btn {
  align-self: flex-start;
  background: transparent;
  border: 1px solid rgba(180, 83, 9, .35);
  border-radius: 99px;
  color: var(--gold);
  padding: .25rem .75rem;
  height: 30px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Mukta', sans-serif;
  transition: background .15s, border-color .15s;
}
.cv-btn:hover { background: var(--gold-bg); border-color: rgba(180, 83, 9, .6); }

.cv-result {
  margin-top: .75rem;
  padding: .65rem .7rem;
  border-radius: var(--radius-sm);
  background: var(--gold-bg);
  border: 1px solid rgba(180, 83, 9, .22);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.cv-result-main {
  font-family: 'Mukta', sans-serif;
  font-size: .9rem;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: baseline;
  line-height: 1.35;
}
.cv-jump {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 99px;
  color: var(--text-dim);
  padding: .2rem .7rem;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Mukta', sans-serif;
}
.cv-jump:hover { border-color: var(--gold); color: var(--gold); }
.cv-error {
  font-size: .82rem;
  color: var(--red);
  font-family: 'Mukta', sans-serif;
}

/* ─── Incomplete-year notice ─────────────────────────── */
#cal-data-notice {
  font-family: 'Mukta', sans-serif;
  font-size: .82rem;
  line-height: 1.4;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
}
#cal-data-notice .en {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: .2rem;
}
#cal-data-notice[hidden] { display: none; }

/* ─── Upcoming Holidays ─────────────────────────────── */
#upcoming-holidays {
  grid-area: holidays;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.uh-empty {
  font-family: 'Mukta', sans-serif;
  font-size: .85rem;
  color: var(--text-muted);
  padding: .35rem .25rem;
}

.uh-heading {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 .25rem;
}

.uh-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: .6rem .85rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .65rem;
  transition: background .15s;
  text-align: left;
  width: 100%;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.uh-item:hover { background: var(--surface-2); }
.uh-item:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.uh-thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.uh-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.uh-thumb-loaded { border-color: var(--border-2); }

.uh-body {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
  flex: 1;
}

.uh-name {
  font-family: 'Mukta', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: block;
}

.uh-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.uh-item.uh-today { border-left-color: var(--gold-bright); }
.uh-item.uh-soon  { border-left-color: var(--red); }

.uh-date {
  font-size: .72rem;
  color: var(--text-muted);
  flex: 1;
}

.uh-badge {
  font-size: .68rem;
  font-weight: 600;
  padding: .1rem .45rem;
  border-radius: 99px;
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid rgba(180, 83, 9, .2);
  white-space: nowrap;
  flex-shrink: 0;
}
.uh-badge.badge-today { background: var(--gold-bg-2); color: var(--gold-bright); }
.uh-badge.badge-soon  { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }

/* ─── Main Column ─────────────────────────────────────── */
#cal-main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-width: 0;
}

/* ─── Controls ───────────────────────────────────────── */
#cal-controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem .85rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.cal-nav-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
  line-height: 1;
}
.cal-nav-btn:hover {
  background: var(--gold-bg);
  border-color: rgba(180, 83, 9, .35);
  color: var(--gold);
}

.cal-month-label {
  flex: 1;
  text-align: center;
  font-family: 'Mukta', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .01em;
  min-width: 0;
}
.cal-month-label .en {
  font-family: 'Inter', sans-serif;
  font-size: .72rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: .4rem;
}

.cal-dropdowns {
  display: flex;
  gap: .4rem;
}

.cal-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: 0 .55rem;
  height: 32px;
  font-size: .78rem;
  cursor: pointer;
  font-family: 'Mukta', sans-serif;
  transition: border-color .15s;
}
.cal-select:hover { border-color: var(--border-2); }
.cal-select:focus { outline: 2px solid var(--gold-bg-2); outline-offset: 1px; }
.cal-select option { background: var(--surface-2); color: var(--text); }

.cal-today-btn {
  background: transparent;
  border: 1px solid rgba(180, 83, 9, .35);
  border-radius: 99px;
  color: var(--gold);
  padding: 0 .8rem;
  height: 32px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
  font-family: 'Mukta', sans-serif;
}
.cal-today-btn:hover { background: var(--gold-bg); border-color: rgba(180, 83, 9, .6); }

/* ─── Week Header ────────────────────────────────────── */
.cal-week-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 1px;
}

.cal-week-header div {
  text-align: center;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  padding: .4rem 0;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  align-items: center;
}
.cal-week-header .wd-np {
  font-family: 'Mukta', sans-serif;
  font-size: .68rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
}
.cal-week-header div:last-child,
.cal-week-header div:last-child .wd-np { color: var(--sat); }

/* ─── Grid ───────────────────────────────────────────── */
#cal-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.cal-grid-inner {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
}

.cal-cell {
  background: var(--surface);
  min-height: 80px;
  padding: .5rem .55rem .4rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: background .12s;
}
.cal-cell:hover { background: var(--surface-2); }

.cal-cell.empty {
  background: var(--bg);
  cursor: default;
  pointer-events: none;
}

.cal-cell-bs {
  font-family: 'Mukta', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.cal-cell-ad {
  font-size: .6rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.cal-cell-event {
  margin-top: auto;
  font-family: 'Mukta', sans-serif;
  font-size: .65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  padding-top: .2rem;
}
.cal-cell-event.ev-holiday { color: var(--red); opacity: .85; }
.cal-cell-event.ev-more    { opacity: .55; }

.cal-cell-dots {
  display: none;
  gap: 3px;
  margin-top: auto;
  padding-top: .15rem;
  justify-content: flex-start;
}
.cal-cell-dots .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}
.cal-cell-dots .dot.holiday { background: var(--red); }

.cal-cell:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
  z-index: 1;
}

.cal-cell.highlight {
  box-shadow: inset 0 0 0 1.5px rgba(245, 158, 11, .55);
}

/* ── Today ── */
.cal-cell.today {
  background: var(--gold-bg);
  outline: 1.5px solid rgba(180, 83, 9, .35);
  outline-offset: -1.5px;
}
.cal-cell.today:hover { background: var(--gold-bg-2); }
.cal-cell.today .cal-cell-bs    { color: var(--gold-bright); }
.cal-cell.today .cal-cell-ad    { color: rgba(180, 83, 9, .5); }
.cal-cell.today .cal-cell-event { color: rgba(180, 83, 9, .65); }

/* ── Holiday ── */
.cal-cell.holiday .cal-cell-bs          { color: var(--red); }
.cal-cell.today.holiday .cal-cell-bs    { color: var(--gold-bright); }

/* ── Saturday ── */
.cal-cell.saturday .cal-cell-bs          { color: var(--sat); }
.cal-cell.today.saturday .cal-cell-bs   { color: var(--gold-bright); }

/* ─── Day Popup ──────────────────────────────────────── */
#day-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#day-popup {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
  animation: slideUp .22s cubic-bezier(.22, 1, .36, 1);
  box-shadow: var(--shadow);
}

.dp-wiki {
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.dp-wiki-link { display: block; line-height: 0; }
.dp-wiki-img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}
.dp-wiki-extract {
  font-family: 'Mukta', sans-serif;
  font-size: .82rem;
  color: var(--text-dim);
  line-height: 1.4;
  padding: .65rem 1rem 0;
  margin: 0;
}
.dp-wiki .wiki-credit {
  display: block;
  padding: .4rem 1rem .65rem;
  font-size: .65rem;
  color: var(--text-muted);
}
.dp-wiki .wiki-credit a { color: var(--text-dim); }

.wiki-loading-text {
  display: block;
  padding: .75rem 1rem;
  font-size: .78rem;
  color: var(--text-muted);
  font-family: 'Mukta', sans-serif;
}
.wiki-credit a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wiki-credit a:hover { color: var(--gold); }

@keyframes slideUp {
  from { transform: translateY(32px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.dp-handle {
  width: 36px; height: 3px;
  background: var(--border-2);
  border-radius: 99px;
  margin: .65rem auto .1rem;
}

/* Two-column inner layout: date | panchanga | close */
.dp-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  padding: .75rem 1.25rem 1.5rem;
  align-items: start;
}

.dp-left { /* auto-sized to date content */ }

.dp-right {
  border-left: 1px solid var(--border);
  padding-left: 1rem;
  min-width: 0;
}

.dp-bs-date {
  font-family: 'Mukta', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.dp-month-year {
  font-family: 'Mukta', sans-serif;
  font-size: .85rem;
  color: var(--text-dim);
  margin-top: .1rem;
}
.dp-day {
  font-family: 'Mukta', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-top: .4rem;
}
.dp-ad {
  font-size: .68rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.dp-close {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.dp-close:hover { background: var(--red-bg); color: var(--red); }

.dp-events {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: .75rem;
}

.dp-event-chip {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .7rem;
  border-radius: var(--radius-sm);
  font-family: 'Mukta', sans-serif;
  font-size: .9rem;
  font-weight: 500;
}
.dp-event-chip.ev-holiday {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
}
.dp-event-chip.ev-general {
  background: var(--gold-bg);
  border: 1px solid rgba(180, 83, 9, .2);
  color: var(--gold);
}

.dp-pancha-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem .75rem;
}
.dp-pancha-row { display: flex; flex-direction: column; gap: .1rem; }
.dp-pancha-label {
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  font-weight: 700;
}
.dp-pancha-val {
  font-family: 'Mukta', sans-serif;
  font-size: .9rem;
  color: var(--text-dim);
  line-height: 1.3;
}

/* ─── Loading / Error ────────────────────────────────── */
.cal-loading {
  padding: 3.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
}
.cal-error {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--red);
  font-size: .85rem;
}

/* ─── Extras below month (weather / forex / ICS) ─────── */
#cal-extras {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* Festival spotlight (Wikimedia) */
.fest-spotlight {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.fest-spotlight-media {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-height: 120px;
}
.fest-spotlight-link { display: block; line-height: 0; }
.fest-spotlight-img {
  width: 100%;
  height: 100%;
  min-height: 160px;
  max-height: 220px;
  object-fit: cover;
  display: block;
}
.fest-spotlight-extract {
  font-family: 'Mukta', sans-serif;
  font-size: .78rem;
  color: var(--text-dim);
  line-height: 1.35;
  padding: .55rem .65rem 0;
  margin: 0;
}
.fest-spotlight-media .wiki-credit {
  display: block;
  padding: .35rem .65rem .5rem;
  font-size: .62rem;
  color: var(--text-muted);
}
.fest-spotlight-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .35rem;
  min-width: 0;
}
.fest-spotlight-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.fest-spotlight-label .en {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: .62rem;
  font-weight: 500;
  margin-top: .08rem;
}
.fest-spotlight-name {
  font-family: 'Mukta', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.fest-spotlight-meta {
  font-size: .78rem;
  color: var(--text-muted);
  font-family: 'Mukta', sans-serif;
}

.extras-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: .75rem;
}

.extras-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.extras-label {
  font-family: 'Mukta', sans-serif;
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .55rem;
}
.extras-label .en {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: .65rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: .1rem;
}

.extras-body { min-height: 4.5rem; }
.extras-loading {
  color: var(--text-muted);
  font-size: .82rem;
  font-family: 'Mukta', sans-serif;
}
.extras-error {
  color: var(--red);
  font-size: .82rem;
  font-family: 'Mukta', sans-serif;
}

.wx-main {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}
.wx-temp {
  font-family: 'Mukta', sans-serif;
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.wx-meta { min-width: 0; padding-top: .15rem; }
.wx-cond {
  font-family: 'Mukta', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}
.wx-cond .en {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: .68rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: .1rem;
}
.wx-range {
  font-size: .78rem;
  color: var(--text-dim);
  margin-top: .2rem;
}
.wx-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .7rem;
  margin-top: .65rem;
  font-size: .72rem;
  color: var(--text-muted);
  font-family: 'Mukta', sans-serif;
}

.fx-head,
.fx-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: .35rem;
  align-items: center;
}
.fx-head {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .25rem;
}
.fx-row {
  font-family: 'Mukta', sans-serif;
  font-size: .88rem;
  padding: .22rem 0;
  border-top: 1px solid var(--border);
}
.fx-iso { font-weight: 700; color: var(--text); }
.fx-buy, .fx-sell { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.fx-date {
  margin-top: .45rem;
  font-size: .68rem;
  color: var(--text-muted);
}

.extras-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.extras-btn,
.dp-ics-btn {
  background: transparent;
  border: 1px solid rgba(180, 83, 9, .35);
  border-radius: 99px;
  color: var(--gold);
  padding: .35rem .85rem;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Mukta', sans-serif;
  transition: background .15s, border-color .15s;
}
.extras-btn:hover,
.dp-ics-btn:hover {
  background: var(--gold-bg);
  border-color: rgba(180, 83, 9, .6);
}
.dp-ics-btn { margin-top: .85rem; }

.extras-attr {
  font-size: .68rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.extras-attr a {
  color: var(--text-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.extras-attr a:hover { color: var(--gold); }

/* ─── Responsive: Tablet (600–900px) ────────────────── */
@media (max-width: 900px) {
  #nep-cal-root {
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar"
      "main"
      "holidays";
    gap: 1rem;
  }

  #cal-sidebar { position: static; }
  #today-card { padding: 1.1rem 1.25rem; }
  .tc-date { font-size: 3.6rem; }
}

/* ─── Responsive: Mobile (<600px) ───────────────────── */
@media (max-width: 600px) {
  #nep-cal-root {
    padding: .85rem .75rem 2.5rem;
    gap: .85rem;
  }

  /* Today card: compact date, tighter padding */
  #today-card { padding: .85rem 1rem; }
  .tc-date { font-size: 3rem; }
  .tc-month-year { font-size: .9rem; }
  .tc-day { font-size: 1.05rem; margin-top: .4rem; }
  .tc-divider { margin: .6rem 0; }

  /* Controls: label stacked above buttons */
  #cal-controls {
    padding: .55rem .7rem;
    gap: .45rem;
  }

  .cal-month-label {
    order: -1;
    width: 100%;
    font-size: 1rem;
    text-align: center;
    padding-bottom: .25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: .1rem;
  }
  /* Hide English subtitle inside label on mobile — prevents text wrap */
  .cal-month-label .en { display: none; }

  .cal-nav-btn { width: 32px; height: 32px; font-size: 1rem; }

  .cal-dropdowns { flex: 1; }
  .cal-select { height: 30px; font-size: .75rem; flex: 1; }
  .cal-today-btn { height: 30px; font-size: .72rem; padding: 0 .65rem; }

  /* Grid cells */
  .cal-cell { min-height: 54px; padding: .35rem .35rem .3rem; }
  .cal-cell-bs { font-size: .95rem; }
  .cal-cell-ad { font-size: .56rem; }
  .cal-cell-event { display: none; }
  .cal-cell-dots { display: flex; }
  .cal-week-header .wd-en { display: none; }
  .cal-site-bar { padding: .85rem .75rem 0; }

  #date-converter { margin-top: .85rem; }
  .cv-row { grid-template-columns: 1fr 1.2fr .65fr; }
  .extras-grid { grid-template-columns: 1fr; }
  .fest-spotlight { grid-template-columns: 1fr; }
  .fest-spotlight-img { min-height: 140px; max-height: 180px; }
  .wx-temp { font-size: 2.1rem; }

  /* Popup: full centered card on mobile */
  #day-popup-overlay {
    align-items: center;
    padding: .75rem;
  }
  #day-popup {
    border-radius: var(--radius);
    max-height: 90vh;
  }
  .dp-handle { display: none; }
  .dp-pancha-grid { grid-template-columns: 1fr; gap: .4rem; }
  .dp-bs-date { font-size: 2.5rem; }
}

/* ─── Responsive: Very small (<380px) ───────────────── */
@media (max-width: 380px) {
  .tc-date { font-size: 2.6rem; }
  .cal-cell { min-height: 46px; }
  .cal-cell-bs { font-size: .85rem; }
  .cal-cell-ad { display: none; }
  .pl-inner { width: 220px; }
  .pl-icon { font-size: 2.2rem; }
  .pl-title { font-size: 1.1rem; }
}
