:root {
  --accent: #04B430;
  --accent-dark: #00E62E;
  --bg: #f6faf7;
  --fg: #161a16;
  --muted: #5c6b5f;
  --suggest-fg: #161a16;
  --card: #ffffff; /* search pill + shortcuts solid white in day mode */
  --card-solid: #ffffff; /* dropdowns are solid white in day mode — no transparency */
  --border: rgba(18, 60, 32, 0.14);
  --shadow: 0 12px 32px -16px rgba(20, 60, 35, 0.35);
}

html[data-theme="dark"] {
  --bg: color-mix(in srgb, var(--accent) 4%, #0d120f);
  --fg: #edf5ee;
  --muted: #9fb5a4;
  --suggest-fg: #ffffff;
  --card: color-mix(in srgb, var(--accent) 11%, #101610);
  --card-solid: color-mix(in srgb, var(--accent) 7%, #0a0f0b);
  --border: rgba(90, 200, 120, 0.18);
  --shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.6);
}

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

/* Minimal Opera-Air style scrollbars (slim) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(128, 140, 132, 0.32);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(128, 140, 132, 0.52); }

body {
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

body.art {
  background-size: cover;
  background-position: center;
  /* No fixed attachment — Chromium can skip painting fixed body backgrounds. */
  /* White text over any wallpaper; the modal re-scopes to readable dark below. */
  --fg: #ffffff;
  --muted: rgba(255, 255, 255, 0.78);
  --suggest-fg: #161a16; /* dropdown card is solid white over a wallpaper → dark text */
  --border: rgba(255, 255, 255, 0.28);
  --card: rgba(255, 255, 255, 0.12);
  --card-solid: #ffffff; /* day + wallpaper: solid white dropdowns */
  color: #ffffff;
}
/* Dark + wallpaper: dropdowns are solid, darker accent hue (never transparent). */
html[data-theme="dark"] body.art {
  --card: color-mix(in srgb, var(--accent) 11%, #0c110d);
  --card-solid: color-mix(in srgb, var(--accent) 7%, #070a08);
  --suggest-fg: #ffffff; /* dark accent card → white text */
}
/* Wallpaper dropdowns (light mode) sit on the solid white card — dark text, icons and headers. */
html:not([data-theme="dark"]) body.art .suggest,
html:not([data-theme="dark"]) body.art .history {
  --muted: #5c6b5f;
}
/* Wallpaper light-mode account/services menus stay dark text over the solid white card. */
html:not([data-theme="dark"]) body.art .acc-menu,
html:not([data-theme="dark"]) body.art .acc-svc-menu,
html:not([data-theme="dark"]) body.art .acc-btn {
  color: #161a16;
}
/* Wallpaper light mode: shortcut remove button keeps its white circle but the ✕
   turns black so it's visible — the white-on-white it'd otherwise be. */
html:not([data-theme="dark"]) body.art .sc-del {
  color: #161a16;
  border-color: rgba(18, 60, 32, 0.22);
}
/* Wallpaper light mode: Latest News scroll arrows sit on the solid white circle —
   accent icon so they're visible (plain --fg would be white-on-white). */
html:not([data-theme="dark"]) body.art .news-arrow {
  color: var(--accent);
  border-color: rgba(18, 60, 32, 0.14);
}
/* Update-available toast: small floating pill, bottom-center, above everything. */
.upd-toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: var(--card-solid); color: var(--suggest-fg, var(--fg));
  border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 14px; box-shadow: var(--shadow); z-index: 1000;
  font-size: 12.5px; animation: updIn .25s ease;
}
@keyframes updIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.upd-toast.hidden { display: none; }
.upd-text b { color: var(--accent); }
.upd-link {
  background: transparent; border: 0; color: var(--accent); font-size: 12.5px;
  font-weight: 600; cursor: pointer; font-family: inherit; padding: 2px 2px;
}
.upd-btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit;
  padding: 6px 14px;
}
.upd-x {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 2px 4px; line-height: 1;
}
html:not([data-theme="dark"]) body.art .acc-svc-c {
  background: color-mix(in srgb, #04B430 13%, transparent);
  color: #04B430;
}
/* The modal stays light + dark text even over a wallpaper. */
body.art .modal, body.art .modal-card {
  --fg: #161a16;
  --muted: #5c6b5f;
  --border: rgba(18, 60, 32, 0.14);
  --card: rgba(255, 255, 255, 0.86);
  --card-solid: rgba(255, 255, 255, 0.97);
  color: #161a16;
}

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 8vh 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Gentle entrance, staggered across the sections */
.page > * {
  animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.page > *:nth-child(2) { animation-delay: 0.05s; }
.page > *:nth-child(3) { animation-delay: 0.1s; }
.page > *:nth-child(4) { animation-delay: 0.15s; }
.page > *:nth-child(5) { animation-delay: 0.2s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.brand { margin-bottom: 30px; }
.logo { height: 44px; width: auto; display: block; }

.search-wrap { width: 100%; max-width: 560px; position: relative; z-index: 160; }

/* Shortcuts row + quick-link pills can never paint above the search dropdown. */
.row, .quicklinks { position: relative; z-index: 1; }

/* Search pill — solid, borderless (no border in any mode) */
.search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 999px;
  padding: 18px 28px;
  box-shadow: var(--shadow);
}
.search-icon { color: var(--muted); flex-shrink: 0; width: 20px; height: 20px; }
/* No accent border when the search form is focused — the pill border never changes. */
.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: 17px;
}
.search input::placeholder { color: var(--muted); opacity: 0.8; }
.clear-q {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-size: 15px; padding: 4px 6px;
}

/* Suggestions dropdown — sits just below the search form, above every widget below it.
   Solid surface (white day / darker accent night), no blur, no shadow. */
.suggest {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--card-solid); border-radius: 14px;
  overflow: hidden; z-index: 150;
}
.suggest-item {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px; font-size: 16px; cursor: pointer;
  transition: background 0.08s;
}
/* Hover + active (arrow-selected): no background — only accent text colour +
   bold on the active row, matching the address-bar dropdown. */
.suggest-item:hover .s-text { color: var(--accent); }
.suggest-item.active .s-text { color: var(--accent); font-weight: 600; }
.suggest-item .s-text { color: var(--suggest-fg); }
.suggest-item .s-icon { color: var(--muted); font-size: 15px; width: 20px; text-align: center; }
.suggest-item .s-caret { margin-left: auto; color: var(--muted); font-size: 13px; }
.suggest-item .s-caret { opacity: 0; }
.suggest-item:hover .s-caret, .suggest-item.active .s-caret { opacity: 1; color: var(--accent); }

/* Recent searches + trending (same solid surface as suggestions) */
.history {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--card-solid); border-radius: 14px;
  overflow: hidden; z-index: 150;
}
.history-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px 4px; font-size: 12.5px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.history-head.sub { border-top: 1px solid var(--border); margin-top: 4px; }
.trend-item .trend-ico { color: var(--accent); }
.clear-history { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 11.5px; text-transform: none; letter-spacing: 0; }
.clear-history:hover { color: var(--accent); }
.history-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 22px; font-size: 16px; cursor: pointer;
  transition: background 0.08s;
}
.history-item .h-text { color: var(--suggest-fg); }
/* Hover + active (arrow-selected): no background — only accent text colour +
   bold on the active row, matching the address-bar dropdown. */
.history-item:hover .h-text { color: var(--accent); }
.history-item.active .h-text { color: var(--accent); font-weight: 600; }
.history-item .h-icon { color: var(--muted); font-size: 14px; width: 20px; text-align: center; }
/* Per-row delete (recent searches only): appears on hover, pushes to the right. */
.history-item .h-del {
  margin-left: auto;
  background: none; border: 0; padding: 2px 4px; cursor: pointer;
  color: var(--muted); opacity: 0; transition: opacity 0.15s, color 0.15s;
  font-size: 12px; line-height: 1;
}
.history-item:hover .h-del { opacity: 1; }
.history-item .h-del:hover { color: var(--accent); }

.row { width: 100%; max-width: 560px; display: flex; justify-content: center; margin-top: 36px; margin-bottom: 42px; }

.shortcuts {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 18px 10px;
  width: 100%;
}
.shortcut {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--fg);
  cursor: pointer;
}
.shortcut { position: relative; }
.shortcut .icon {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 21px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.15s;
}
.shortcut:hover .icon { transform: translateY(-2px); }
.shortcut .label { font-size: 11.5px; color: var(--muted); }

/* Real site favicon shown for user-added shortcuts (Bhitta-style) */
.shortcut .sc-fav {
  width: 26px; height: 26px; border-radius: 8px; object-fit: contain;
  background: rgba(255, 255, 255, 0.85);
}
html[data-theme="dark"] .shortcut .sc-fav { background: rgba(255, 255, 255, 0.10); }

/* Remove button on each shortcut (hover) */
.sc-del {
  position: absolute;
  top: -5px; right: -5px;
  width: 17px; height: 17px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-solid);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}
.shortcut:hover .sc-del { display: flex; }
.sc-del:hover { background: #d64545; color: #fff; border-color: #d64545; }

/* Add-shortcut dialog fields */
.sc-field { margin-bottom: 12px; }
.sc-field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.sc-field input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--fg); font-size: 13.5px; outline: none;
}
.sc-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.sc-actions .wall-none { width: auto; margin-top: 0; padding: 9px 16px; }

.add-shortcut .icon {
  border-style: dashed;
  color: var(--muted);
  cursor: pointer;
}

.quicklinks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 560px;
  margin-top: 0;
}
.quicklinks a {
  text-decoration: none;
  font-size: 12.5px;
  color: var(--fg);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.15s;
}
.quicklinks a:hover { border-color: var(--accent); }

/* Festival countdown chips (Dashain / Tihar / Teej), Bhitta-style */
.festi-row {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 8px; margin-top: 18px; min-height: 0;
}
.festi-row:empty { display: none; }
.festi-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font-size: 12px;
}
.festi-chip .d { color: var(--accent); font-weight: 700; }

.footer {
  margin-top: auto;
  padding-top: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.footer .dot { opacity: 0.5; }
.footer .accent { color: var(--accent); }
.footer button {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.footer button:hover { border-color: var(--accent); color: var(--accent); }

/* Date chip — clickable, opens the AD ↔ BS converter */
.date-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.date-chip:hover { border-color: var(--accent); color: var(--accent); }
.date-chip:hover .date-bs { color: var(--accent); }
.date-chip svg { flex-shrink: 0; opacity: 0.8; }
.date-bs { font-weight: 600; color: var(--accent); margin-left: 1px; }

/* News strip (bhitta-style feed, below the festival chips) */
.news-strip {
  width: 100%; max-width: 720px; margin: 30px auto 0;
}
.news-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.news-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 800; letter-spacing: -0.01em; color: var(--fg);
}
.news-kicker svg { color: var(--accent); }
.news-lang {
  display: flex; gap: 3px; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px; margin-left: auto;
}
.news-lang .pill {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  font-family: inherit; transition: background .15s, color .15s;
}
.news-lang .pill:hover { color: var(--fg); }
.news-lang .pill.on { background: var(--accent); color: #fff; }
.news-more {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  font-size: 12.5px; font-weight: 600; font-family: inherit; padding: 4px 6px;
}
.news-more:hover { color: var(--accent); }
.news-scroll-wrap {
  position: relative;
}
.news-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x proximity;
  /* No visible scrollbar — arrows on hover show which way you can scroll. */
  scrollbar-width: none;
}
.news-scroll::-webkit-scrollbar { display: none; height: 0; }
.news-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--card-solid); color: var(--fg); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); z-index: 5;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s, color .18s, border-color .18s;
}
.news-arrow.left { left: -6px; }
.news-arrow.right { right: -6px; }
.news-arrow.show { opacity: 1; pointer-events: auto; }
.news-arrow:hover { color: var(--accent); border-color: var(--accent); }
.news-strip:hover .news-arrow.show { opacity: 1; }
.news-card {
  flex: 0 0 220px; scroll-snap-align: start;
  border-radius: 12px; overflow: hidden; background: var(--card);
  border: 1px solid var(--border); text-decoration: none; color: var(--fg);
  transition: transform .15s, border-color .15s;
}
.news-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.news-card .n-media {
  aspect-ratio: 16 / 9; position: relative; overflow: hidden; background: var(--border);
}
.news-card .n-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card .n-media .n-ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 26px; color: #fff;
  background: linear-gradient(140deg, var(--accent), rgba(0,0,0,.45));
}
.news-card .n-body { padding: 10px 12px 12px; }
.news-card .n-src {
  display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--accent); margin-bottom: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.news-card .n-title {
  font-size: 13px; font-weight: 700; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* Wallpaper modal */
.modal {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 12, 9, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 300;
}
.modal-card {
  background: var(--card-solid); border-radius: 18px;
  padding: 20px; width: 460px; max-width: 92vw; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.5);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.modal-x { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.wall-section-title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 14px 0 8px; }
.wall-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.wall-tile {
  aspect-ratio: 16/10; border-radius: 10px; cursor: pointer; border: 2px solid transparent;
  background-size: cover; background-position: center;
}
.wall-tile:hover { border-color: var(--accent); }
.wall-tile.active { border-color: var(--accent); }
.wall-search-row { display: flex; gap: 8px; }
.wall-search-row input {
  flex: 1; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--fg); font-size: 13px; outline: none;
}
#wallSuggest { margin-top: 10px; }
.wall-url-row { display: flex; gap: 8px; }
.wall-url-row input {
  flex: 1; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--fg); font-size: 13px; outline: none;
}
.wall-apply {
  padding: 9px 16px; border-radius: 10px; border: 0; background: var(--accent); color: white;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.wall-none { margin-top: 12px; background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 8px 14px; font-size: 12.5px; cursor: pointer; width: 100%; }
.wall-none:hover { border-color: #d64545; color: #d64545; }

/* Customize modal — Background / Widgets tabs */
.cust-tabs {
  display: flex; gap: 4px; background: var(--border); border-radius: 11px;
  padding: 4px; margin-bottom: 14px;
}
.cust-tab {
  flex: 1; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13px; font-weight: 700; padding: 8px 0; border-radius: 8px;
  font-family: inherit; transition: background .15s, color .15s;
}
.cust-tab.on { background: var(--card-solid); color: var(--fg); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.cust-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 2px;
  border-bottom: 1px solid var(--border);
}
.cust-row:last-of-type { border-bottom: 0; }
.cust-info { flex: 1; min-width: 0; }
.cust-name { font-size: 13.5px; font-weight: 700; }
.cust-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.cust-toggle {
  width: 40px; height: 23px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--border); position: relative; transition: background .18s; flex-shrink: 0;
}
.cust-toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.cust-toggle.on { background: var(--accent); }
.cust-toggle.on::after { transform: translateX(17px); }
.cust-note { font-size: 11.5px; color: var(--muted); margin-top: 12px; line-height: 1.5; }

/* AD ↔ BS converter modal */
.cal-card { width: 400px; }
.cal-pane { padding: 2px 2px 6px; }
.cal-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 8px; }
.cal-pane input[type="date"],
.cal-pane select {
  width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--border);
  background: transparent; color: var(--fg); font-size: 13.5px; font-family: inherit; outline: none;
}
.cal-pane input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.55; }
.cal-bs-row { display: grid; grid-template-columns: 1fr 1.4fr 0.8fr; gap: 6px; }
.cal-sep { height: 1px; background: var(--border); margin: 14px 0 12px; }
.cal-result { margin-top: 10px; line-height: 1.5; }
.cal-result-big { font-size: 15px; font-weight: 700; color: var(--fg); }
.cal-result-sub { font-size: 12px; color: var(--muted); }
.cal-foot { margin-top: 6px; }
.cal-today { margin-top: 10px !important; }
.cal-today:hover { border-color: var(--accent) !important; color: var(--accent) !important; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .shortcuts { grid-template-columns: repeat(4, 1fr); }
  .page { padding-top: 6vh; }
}