/* ═══════════════════════════════════════════════════════════════
   සබැඳි (Sabandi) — the cultural map of Sri Lanka
   The button at the end of the search row, and the full-screen
   window it opens. On a desktop screen everything is side by side
   and fits without scrolling:
       [ the note + topics ] [   colour map   ] [ districts / one district ]
   Narrower screens: map | one column.  Phones: map on top, text below.
   ═══════════════════════════════════════════════════════════════ */

.sabandi-tab,
.sb-overlay {
  --sb-ink:      #F4EFE6;
  --sb-soft:     #B9B2B2;
  --sb-dim:      #8A8282;
  --sb-panel:    #0E0203;
  --sb-line:     rgba(255, 255, 255, 0.07);
  --sb-gold:     #C9A84C;
  --sb-gold-hi:  #E8CC72;
  --sb-red:      #CC0000;
  --sb-sinhala:  'Noto Sans Sinhala', 'Iskoola Pota', 'Nirmala UI', var(--font, sans-serif);
}

/* ── The button at the end of the search row, above the categories ── */
.sabandi-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.25rem 0.62rem 1rem;
  border-radius: 100px;
  border: 1px solid rgba(201, 168, 76, 0.55);
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.18), rgba(204, 0, 0, 0.14));
  color: var(--sb-gold-hi);
  font-family: var(--sb-sinhala);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(201, 168, 76, 0.12);
  transition: var(--transition, 0.3s ease);
}
.sabandi-tab small { font-family: var(--font); font-size: 0.72rem; font-weight: 600; opacity: 0.85; }
.sabandi-tab i { font-size: 0.85rem; }
.sabandi-tab-hint {
  margin-left: 0.25rem;
  padding-left: 0.6rem;
  border-left: 1px solid rgba(201, 168, 76, 0.35);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--sb-soft);
}
/* a slow sheen, so the new item is noticed */
.sabandi-tab::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: skewX(-20deg);
  animation: sb-sheen 4.5s ease-in-out infinite;
}
.sabandi-tab:hover { border-color: var(--sb-gold); color: #fff; box-shadow: 0 4px 18px rgba(201, 168, 76, 0.25); }
@media (max-width: 600px) {
  .sabandi-tab { width: 100%; justify-content: center; margin-top: 0.6rem; }
}
@keyframes sb-sheen {
  0%, 60% { left: -60%; }
  100%    { left: 130%; }
}

/* ── The window: the whole browser ────────────────────────────── */
.sb-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #050001;
  font-family: var(--font, 'Poppins', sans-serif);
  color: var(--sb-ink);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.sb-overlay.is-open { opacity: 1; }
.sb-overlay[hidden] { display: none; }

.sb-dialog {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--sb-panel);
  overflow: hidden;
}
/* thin gold-to-red line across the top edge */
.sb-dialog::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 2;
  background: linear-gradient(90deg, transparent, var(--sb-gold), var(--sb-red), transparent);
}

.sb-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.3rem 1.1rem;
  border-bottom: 1px solid var(--sb-line);
  background:
    radial-gradient(ellipse 340px 140% at 90px 50%, rgba(201, 168, 76, 0.16), transparent 70%),
    linear-gradient(90deg, #2A0406, #0B0102 42%);
}
.sb-brand { flex: 1; display: flex; align-items: center; gap: 0.8rem; min-width: 0; }
/* The Sabandi logo: its file has wide empty margins, so only the lettering is shown */
.sb-logo {
  flex-shrink: 0;
  display: block;
  width: clamp(130px, 8vw, 152px);
  aspect-ratio: 1125 / 450;
  overflow: hidden;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
}
.sb-logo img { width: 100%; height: 100%; object-fit: cover; object-position: center 48.5%; }
.sb-brand-text { min-width: 0; padding-left: 0.9rem; border-left: 1px solid rgba(201, 168, 76, 0.3); }
.sb-eyebrow { font-size: 0.62rem; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; color: var(--sb-gold); }
.sb-head h2 {
  margin-top: 0.1rem;
  font-family: var(--sb-sinhala);
  font-size: clamp(0.9rem, 1.4vw, 1.08rem);
  font-weight: 700;
  line-height: 1.35;
  color: #fff;
}
.sb-headstats { display: flex; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.sb-headstats li {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--sb-line);
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--sb-sinhala);
  font-size: 0.72rem;
  color: var(--sb-soft);
  white-space: nowrap;
}
.sb-headstats b { font-family: var(--font); font-size: 0.92rem; color: #fff; }
.sb-head-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.sb-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 0, 1, 0.8);
  color: #E6E0E0;
  font-family: var(--sb-sinhala);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: 0.25s ease;
}
.sb-btn:hover { border-color: var(--sb-gold); color: var(--sb-gold-hi); }
.sb-btn.gold { background: linear-gradient(135deg, #D4B45C, #A8852E); border-color: transparent; color: #1A0A00; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3); }
.sb-btn.gold:hover { color: #000; box-shadow: 0 8px 24px rgba(201, 168, 76, 0.45); }

.sb-icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #E6E0E0;
  cursor: pointer;
  transition: 0.25s ease;
}
.sb-icon:hover { background: var(--sb-red); border-color: var(--sb-red); color: #fff; transform: rotate(90deg); }

/* Share menu (when the device has no share sheet of its own) */
.sb-share { position: relative; }
.sb-sharemenu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 20;
  min-width: 13rem;
  padding: 0.4rem;
  border-radius: 14px;
  border: 1px solid rgba(201, 168, 76, 0.3);
  background: #170506;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: sb-rise 0.2s ease both;
}
.sb-sharemenu[hidden] { display: none; }
.sb-sharemenu p { padding: 0.5rem 0.7rem 0.35rem; font-family: var(--sb-sinhala); font-size: 0.72rem; color: var(--sb-dim); }
.sb-sharemenu a,
.sb-sharemenu button {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: #EEE;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}
.sb-sharemenu a:hover,
.sb-sharemenu button:hover { background: rgba(201, 168, 76, 0.1); color: var(--sb-gold-hi); }
.sb-sharemenu i { width: 1.1rem; text-align: center; color: var(--sb-gold); }

/* ── Body: [note] [map] [districts] ───────────────────────────── */
.sb-body {
  display: grid;
  grid-template-columns: minmax(300px, 24%) minmax(0, 1fr) minmax(360px, 26%);
  grid-template-areas: "side map panel";
  min-height: 0;
}
/* On wide screens the note and the panel are columns of their own */
.sb-info { display: contents; }
.sb-mapwrap { grid-area: map; position: relative; min-height: 0; background: #12090A; isolation: isolate; }
.sb-side,
.sb-panel {
  min-height: 0;
  overflow-y: auto;
  background: linear-gradient(180deg, #100203, #0B0102);
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 168, 76, 0.3) transparent;
}
.sb-side  { grid-area: side;  border-right: 1px solid var(--sb-line); }
.sb-panel { grid-area: panel; border-left: 1px solid var(--sb-line); }

.sb-map { position: absolute; inset: 0; }
.sb-map-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  color: #4A4040;
  font-size: 0.85rem;
}

.sb-chips {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  right: 0.8rem;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.sb-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.36rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(14, 2, 3, 0.86);
  color: #E2DCDC;
  font-family: var(--sb-sinhala);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: 0.2s ease;
}
.sb-chip i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--c, var(--sb-gold)); }
.sb-chip:hover { border-color: var(--c, var(--sb-gold)); color: #fff; }
.sb-chip.is-active { background: var(--c, var(--sb-gold)); border-color: var(--c, var(--sb-gold)); color: #120203; }
.sb-chip.is-active i { background: #120203; }

.sb-map-bottom {
  position: absolute;
  left: 0.8rem;
  right: 3.6rem;
  bottom: 0.8rem;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  pointer-events: none;
}
.sb-map-bottom > * { pointer-events: auto; }
.sb-tourbar {
  flex: 1 1 140px;
  height: 5px;
  border-radius: 999px;
  background: rgba(14, 2, 3, 0.35);
  overflow: hidden;
}
.sb-tourbar[hidden] { display: none; }
.sb-tourbar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sb-gold), var(--sb-red)); }

/* The map: OpenStreetMap toned to the blog's maroon and gold */
.sb-map.leaflet-container {
  background: radial-gradient(ellipse at 50% 45%, #2A0A0C, #12090A 70%);
  font-family: var(--font, sans-serif);
}
.sb-tiles {
  filter: invert(1) grayscale(1) sepia(1) hue-rotate(-28deg) saturate(1.8) brightness(0.55) contrast(1.2);
  opacity: 0.85;
}
/* soft dark edges, like an old map */
.sb-mapwrap::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 450;
  pointer-events: none;
  box-shadow: inset 0 0 120px rgba(8, 1, 2, 0.85);
}
.sb-map .leaflet-control-attribution { background: rgba(14, 2, 3, 0.75) !important; color: var(--sb-dim) !important; font-size: 0.58rem !important; }
.sb-map .leaflet-control-attribution a { color: var(--sb-gold) !important; }

/* The districts: province colours, gold borders, a gold glow round the island */
.sb-map .leaflet-overlay-pane svg { filter: drop-shadow(0 0 10px rgba(201, 168, 76, 0.28)); }
.sb-shape {
  cursor: pointer;
  stroke-linejoin: round;
  transition: fill-opacity 0.35s ease, stroke-opacity 0.35s ease, stroke-width 0.35s ease;
  fill-opacity: 0.3;
  stroke-opacity: 0.65;
}
.sb-shape:hover { fill-opacity: 0.5; stroke-opacity: 1; }
.sb-shape.is-dim { fill-opacity: 0.08; stroke-opacity: 0.25; }
.sb-shape.is-active {
  fill-opacity: 0.55;
  stroke: #E8CC72;
  stroke-opacity: 1;
  stroke-width: 2.5px;
  animation: sb-shape-glow 2.2s ease-in-out infinite;
}
@keyframes sb-shape-glow { 50% { fill-opacity: 0.38; } }
.sb-map .leaflet-bar { border: 0; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.sb-map .leaflet-bar a { background: rgba(14, 2, 3, 0.9); color: #E8E2E2; border-color: rgba(255, 255, 255, 0.1); }
.sb-map .leaflet-bar a:hover { background: #2A0A0B; color: var(--sb-gold-hi); }

/* District pins */
.sb-pin-wrap { background: none !important; border: 0 !important; }
.sb-pin {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c);
  border: 2.5px solid #F3E2A9;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 6px 14px rgba(0, 0, 0, 0.5);
  color: #120203;
  font-size: 0.66rem;
  font-weight: 800;
  cursor: pointer;
  transform: scale(0);
  animation: sb-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
  animation-delay: var(--d, 0ms);
  transition: transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
}
.sb-pin:hover { filter: brightness(1.1); }
.sb-pin.is-dim { opacity: 0.3; filter: grayscale(0.7); }
.sb-pin.is-active {
  animation: none;
  transform: scale(1.4);
  background: #fff;
  border-color: var(--c);
  color: #120203;
  box-shadow: 0 0 0 3px var(--c), 0 0 24px var(--c);
  z-index: 5;
}
/* pulsing rings round the chosen district */
.sb-pin.is-active::before,
.sb-pin.is-active::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2.5px solid var(--c);
  animation: sb-ring 2.2s ease-out infinite;
}
.sb-pin.is-active::after { animation-delay: 1.1s; }

@keyframes sb-pop  { to { transform: scale(1); } }
@keyframes sb-ring { from { transform: scale(1); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } }

/* Pins for the places the note names */
.sb-place {
  width: 16px;
  height: 16px;
  transform: rotate(45deg) scale(0);
  border-radius: 4px 50% 50% 50%;
  background: #E0B33A;
  border: 2px solid #120203;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  animation: sb-drop 0.55s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes sb-drop { from { transform: rotate(45deg) translate(-14px, -14px) scale(0); } to { transform: rotate(45deg) scale(1); } }

.sb-map .leaflet-tooltip.sb-label {
  padding: 0.25rem 0.55rem;
  border: 1px solid rgba(201, 168, 76, 0.55);
  border-radius: 8px;
  background: rgba(14, 2, 3, 0.92);
  color: #fff;
  font-family: var(--sb-sinhala);
  font-size: 0.72rem;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.sb-map .leaflet-tooltip.sb-label small { display: block; font-family: var(--font); font-size: 0.6rem; font-weight: 500; color: var(--sb-soft); }
.sb-map .leaflet-tooltip.sb-label::before { display: none; }

/* The line drawn from the last district to the new one */
.sb-trail { stroke-dasharray: 6000; stroke-dashoffset: 6000; animation: sb-draw 1.4s ease-out forwards; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.35)); }
.sb-trail.is-fading { transition: opacity 1s ease; opacity: 0; }
@keyframes sb-draw { to { stroke-dashoffset: 0; } }

/* ── The two text columns ─────────────────────────────────────── */
.sb-view { padding: 1.25rem 1.3rem 1.4rem; animation: sb-rise 0.45s ease both; }
@keyframes sb-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.sb-side p,
.sb-panel p,
.sb-panel li { font-family: var(--sb-sinhala); }

.sb-subtitle { font-family: var(--sb-sinhala); font-size: 0.8rem; font-weight: 700; color: var(--sb-gold-hi); }
.sb-lead { margin-top: 0.75rem; font-size: 0.81rem; line-height: 1.65; color: #CFC8C8; }

.sb-notebox {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.28);
  background: rgba(201, 168, 76, 0.07);
  font-size: 0.76rem;
  line-height: 1.6;
  color: #E4DEDE;
}
.sb-notebox i { margin-top: 0.3rem; color: var(--sb-gold); }
.sb-notebox b { color: var(--sb-gold-hi); }

.sb-h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.5rem 0 0.6rem;
  font-family: var(--sb-sinhala);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
}
.sb-h3.first { margin-top: 0; }
.sb-h3 small { font-size: 0.7rem; font-weight: 600; color: var(--sb-dim); }
.sb-h3::after { content: ''; flex: 1 0 1.5rem; height: 1px; background: linear-gradient(90deg, rgba(201, 168, 76, 0.4), transparent); }
.sb-muted { font-family: var(--sb-sinhala); font-size: 0.74rem; color: var(--sb-dim); line-height: 1.65; }

/* Special heritage topics, as a list */
.sb-topiclist { display: grid; gap: 0.55rem; margin-top: 0.75rem; }
.sb-topicrow {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.3rem 0.6rem 0.3rem 0.3rem;
  border-radius: 12px;
  border: 1px solid var(--sb-line);
  background: rgba(255, 255, 255, 0.025);
  color: #EEE;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
}
.sb-topicrow img { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; }
.sb-topicrow span { font-family: var(--sb-sinhala); font-size: 0.8rem; font-weight: 600; line-height: 1.35; }
.sb-topicrow i { font-size: 0.7rem; color: var(--sb-gold); }
.sb-topicrow:hover { border-color: rgba(201, 168, 76, 0.5); background: rgba(201, 168, 76, 0.06); }

.sb-source { margin-top: 1.1rem; font-size: 0.66rem; line-height: 1.6; color: #6E6666; }

/* Provinces and their districts */
.sb-province { margin-top: 0.8rem; }
.sb-province h4 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.4rem;
  font-family: var(--sb-sinhala);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--c);
}
.sb-province h4 i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.sb-province h4 small { font-family: var(--font); font-size: 0.64rem; font-weight: 500; color: var(--sb-dim); }
.sb-districts { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 0.35rem; }
.sb-district-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--sb-line);
  background: rgba(255, 255, 255, 0.025);
  color: #EEE;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
}
.sb-district-btn:hover { border-color: var(--c); background: rgba(255, 255, 255, 0.05); transform: translateY(-1px); }
.sb-district-btn b {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--c);
  color: #120203;
  font-size: 0.6rem;
  font-weight: 800;
}
.sb-district-btn span { min-width: 0; font-family: var(--sb-sinhala); font-size: 0.76rem; font-weight: 600; line-height: 1.25; }
.sb-district-btn small { display: block; font-family: var(--font); font-size: 0.6rem; font-weight: 500; color: var(--sb-dim); }

/* One district (or one topic) */
.sb-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
  border: 0;
  background: none;
  color: var(--sb-gold);
  font-family: var(--sb-sinhala);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}
.sb-back:hover { color: var(--sb-gold-hi); }
.sb-back.on-photo {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 2;
  margin: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(8, 0, 1, 0.7);
  backdrop-filter: blur(6px);
}

.sb-hero {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  overflow: hidden;
  background: #1A0506;
  border: 1px solid var(--sb-line);
}
.sb-hero img { width: 100%; height: 100%; object-fit: cover; animation: sb-kenburns 14s ease-out both; }
.sb-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 0, 1, 0.25) 0%, transparent 30%, transparent 40%, rgba(8, 0, 1, 0.92) 100%); }
.sb-no {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  z-index: 2;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
}
.sb-no small { font-size: 0.72rem; font-weight: 600; color: var(--sb-soft); }
.sb-hero-text { position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.7rem; z-index: 2; }
.sb-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(8, 0, 1, 0.75);
  border: 1px solid var(--c, var(--sb-gold));
  color: #fff;
  font-family: var(--sb-sinhala);
  font-size: 0.68rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
}
.sb-pill i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--c, var(--sb-gold)); }
@keyframes sb-kenburns { from { transform: scale(1.08); } to { transform: scale(1); } }

.sb-title { margin-top: 0.35rem; font-family: var(--sb-sinhala); font-size: 1.3rem; font-weight: 800; line-height: 1.25; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6); }
.sb-title-en { margin-top: 0.1rem; font-family: var(--font) !important; font-size: 0.72rem; color: #D6D0D0; }

.sb-items { display: grid; gap: 0.55rem; margin-top: 1rem; list-style: none; padding: 0; }
.sb-items li {
  display: flex;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--sb-line);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #E4DEDE;
  opacity: 0;
  animation: sb-rise 0.45s ease forwards;
  animation-delay: calc(0.12s + var(--i, 0) * 0.07s);
}
.sb-items li::before {
  content: '';
  flex-shrink: 0;
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.55rem;
  transform: rotate(45deg);
  border-radius: 2px;
  background: var(--c, var(--sb-gold));
}

.sb-places { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1rem; }
.sb-place-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 168, 76, 0.3);
  background: rgba(201, 168, 76, 0.06);
  color: #EEE;
  font-family: var(--sb-sinhala);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}
.sb-place-btn i { color: var(--sb-gold); font-size: 0.66rem; }
.sb-place-btn:hover { background: rgba(201, 168, 76, 0.16); color: var(--sb-gold-hi); }
.sb-place-btn.topic { border-color: rgba(204, 0, 0, 0.4); background: rgba(204, 0, 0, 0.08); }
.sb-place-btn.topic i { color: #FF7A7A; }

.sb-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr); gap: 0.5rem; margin-top: 1.25rem; }
.sb-nav button {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--sb-line);
  background: rgba(255, 255, 255, 0.025);
  color: #EEE;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
}
.sb-nav button:last-child { text-align: right; align-items: flex-end; }
.sb-nav button:hover { border-color: rgba(201, 168, 76, 0.45); }
.sb-nav small { font-family: var(--sb-sinhala); font-size: 0.62rem; letter-spacing: 0.5px; color: var(--sb-gold); }
.sb-nav span { font-family: var(--sb-sinhala); font-size: 0.8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-nav .sb-nav-share {
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.9rem;
  background: linear-gradient(135deg, #E21212, #A00000);
  border-color: transparent;
  color: #fff;
}
.sb-nav .sb-nav-share i { font-size: 0.85rem; }
.sb-nav .sb-nav-share small { color: #FFD9D9; }
.sb-nav .sb-nav-card {
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.9rem;
  background: linear-gradient(135deg, #D4B45C, #A8852E);
  border-color: transparent;
  color: #1A0A00;
}
.sb-nav .sb-nav-card i { font-size: 0.85rem; }
.sb-nav .sb-nav-card small { color: #2A1500; }


/* ── Tools on the map's right edge ────────────────────────────── */
.sb-rail {
  position: absolute;
  top: 50%;
  right: 0.8rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transform: translateY(-50%);
}
.sb-railbtn {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.5);
  background: radial-gradient(circle, #3A0508, #140203);
  color: var(--sb-gold-hi);
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: 0.2s ease;
}
.sb-railbtn:hover,
.sb-railbtn:focus-visible { border-color: var(--sb-gold-hi); box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2), 0 6px 18px rgba(0, 0, 0, 0.45); outline: none; }
.sb-railbtn.is-active { background: linear-gradient(135deg, #D4B45C, #A8852E); border-color: transparent; color: #1A0A00; }
/* the name slides out to the left on hover */
.sb-railbtn span {
  position: absolute;
  right: calc(100% + 0.55rem);
  top: 50%;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(201, 168, 76, 0.45);
  background: rgba(14, 2, 3, 0.94);
  color: #fff;
  font-family: var(--sb-sinhala);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(6px, -50%);
  transition: 0.2s ease;
}
.sb-railbtn:hover span,
.sb-railbtn:focus-visible span { opacity: 1; transform: translate(0, -50%); }
.sb-railcount {
  position: absolute;
  top: -0.3rem;
  right: -0.35rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--sb-red);
  border: 2px solid #12090A;
  color: #fff;
  font-family: var(--font);
  font-size: 0.6rem;
  font-weight: 800;
}
.sb-railcount.is-full { background: linear-gradient(135deg, #E8CC72, #B8913A); color: #1A0A00; }

/* Hover preview of a district */
.sb-map .leaflet-tooltip.sb-label.sb-peek { width: 13.5rem; padding: 0.4rem; white-space: normal; }
.sb-map .leaflet-tooltip.sb-peek img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; margin-bottom: 0.35rem; }
.sb-map .leaflet-tooltip.sb-peek span,
.sb-map .leaflet-tooltip.sb-peek small { padding: 0 0.2rem; }
.sb-map .leaflet-tooltip.sb-peek em { display: block; margin-top: 0.3rem; padding: 0.3rem 0.2rem 0; border-top: 1px solid rgba(201, 168, 76, 0.25); font-style: normal; font-size: 0.66rem; font-weight: 500; line-height: 1.5; color: #E4DEDE; }
/* no names on the map while a quiz runs */
.sb-overlay.is-quiz .sb-map .leaflet-tooltip { display: none; }

/* A stamped district: a small gold tick beside its pin */
.sb-pin-wrap { position: relative; }
.sb-pin.is-stamped { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(232, 204, 114, 0.35), 0 6px 14px rgba(0, 0, 0, 0.5); }
.sb-overlay.is-quiz .sb-pin.is-stamped { box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 6px 14px rgba(0, 0, 0, 0.5); }

/* Quiz answers on the map */
.sb-shape.is-right { fill: #2BB673; fill-opacity: 0.6; stroke: #7CF2B4; stroke-width: 2.5px; stroke-opacity: 1; animation: none; }
.sb-shape.is-wrong { fill: #E21212; fill-opacity: 0.55; stroke: #FF9A9A; stroke-width: 2px; stroke-opacity: 1; animation: sb-shape-shake 0.5s ease 2; }
@keyframes sb-shape-shake { 50% { fill-opacity: 0.25; } }
.sb-pin.is-wrong { background: #E21212; color: #fff; }

/* A trail's line: gold, marching from north to south */
.sb-route { stroke-dasharray: 2 10; stroke-linecap: round; animation: sb-march 1.2s linear infinite; }
.sb-route-glow { stroke-linecap: round; }
@keyframes sb-march { to { stroke-dashoffset: -24; } }

/* ── The tools' panels ────────────────────────────────────────── */
.sb-view.is-still { animation: none; }
.sb-wide { width: 100%; justify-content: center; margin-top: 0.9rem; }
.sb-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
.sb-panel mark { background: rgba(232, 204, 114, 0.25); color: var(--sb-gold-hi); border-radius: 3px; padding: 0 0.1rem; }

/* Search */
.sb-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sb-gold);
}
.sb-search:focus-within { border-color: var(--sb-gold-hi); box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15); }
.sb-search input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0;
  border: 0;
  outline: none;
  background: none;
  color: #fff;
  font-family: var(--sb-sinhala);
  font-size: 0.86rem;
}
.sb-search input::placeholder { color: var(--sb-dim); }
.sb-ideas { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.7rem 0 0.9rem; }
.sb-results { display: grid; gap: 0.4rem; }
.sb-result,
.sb-stops button {
  display: flex;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--sb-line);
  background: rgba(255, 255, 255, 0.025);
  color: #EEE;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
}
.sb-result:hover,
.sb-stops button:hover { border-color: var(--c); background: rgba(255, 255, 255, 0.05); }
.sb-result b,
.sb-stops b {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: var(--c);
  color: #120203;
  font-size: 0.62rem;
  font-weight: 800;
}
.sb-result span,
.sb-stops span { min-width: 0; font-family: var(--sb-sinhala); font-size: 0.8rem; font-weight: 700; line-height: 1.4; }
.sb-result small { font-family: var(--font); font-size: 0.64rem; font-weight: 500; color: var(--sb-dim); }
.sb-result em,
.sb-stops em { display: block; margin-top: 0.15rem; font-style: normal; font-size: 0.72rem; font-weight: 500; color: #CFC8C8; }
.sb-empty { display: flex; gap: 0.5rem; align-items: center; font-family: var(--sb-sinhala); font-size: 0.78rem; color: var(--sb-soft); }
.sb-empty i { color: var(--sb-gold); }

/* Trails */
.sb-trails { display: grid; gap: 0.5rem; margin-top: 0.9rem; }
.sb-trailcard {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(201, 168, 76, 0.25);
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.09), rgba(255, 255, 255, 0.015));
  color: #EEE;
  text-align: left;
  cursor: pointer;
  opacity: 0;
  animation: sb-rise 0.4s ease forwards;
  animation-delay: calc(var(--i) * 0.06s);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.sb-trailcard:hover { border-color: var(--sb-gold); transform: translateX(3px); }
.sb-trailcard > i:first-child {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.5);
  background: radial-gradient(circle, #3A0508, #140203);
  color: var(--sb-gold-hi);
}
.sb-trailcard span { flex: 1; min-width: 0; font-family: var(--sb-sinhala); font-size: 0.86rem; font-weight: 700; }
.sb-trailcard small { display: block; font-size: 0.68rem; font-weight: 500; color: var(--sb-dim); }
.sb-trailcard > i:last-child { color: var(--sb-gold); font-size: 0.7rem; }
.sb-trailhead { display: flex; gap: 0.85rem; align-items: center; }
.sb-trailhead > i {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  border: 1px solid var(--sb-gold);
  background: radial-gradient(circle, #4A070B, #140203);
  color: var(--sb-gold-hi);
  font-size: 1.2rem;
  box-shadow: 0 0 18px rgba(201, 168, 76, 0.3);
}
.sb-trailhead .sb-title { text-shadow: none; }
.sb-stops { display: grid; gap: 0.25rem; margin-top: 0.7rem; padding: 0; list-style: none; }
.sb-stops button { padding: 0.35rem 0.6rem; }
.sb-stops em { margin-top: 0; }
.sb-stops li { opacity: 0; animation: sb-rise 0.4s ease forwards; animation-delay: calc(0.1s + var(--i) * 0.05s); }

/* Quiz */
.sb-quiz-top { display: flex; align-items: center; gap: 0.6rem; }
.sb-quiz-top .sb-back { margin: 0 0 0 auto; }
.sb-quiz-score { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--font); font-size: 0.85rem; font-weight: 800; color: var(--sb-gold-hi); }
.sb-quiz-bar { height: 4px; margin: 0.8rem 0 1rem; border-radius: 999px; background: rgba(201, 168, 76, 0.15); overflow: hidden; }
.sb-quiz-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sb-gold), var(--sb-gold-hi)); transition: width 0.5s ease; }
.sb-quiz .sb-title { margin: 0 0 0.2rem; text-shadow: none; }
.sb-clues { display: grid; gap: 0.5rem; margin: 0.9rem 0 1rem; padding: 0; list-style: none; }
.sb-clues li {
  display: flex;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.35);
  background: rgba(201, 168, 76, 0.08);
  font-size: 0.84rem;
  line-height: 1.6;
  color: #F1ECEC;
  opacity: 0;
  animation: sb-rise 0.4s ease forwards;
  animation-delay: calc(0.15s + var(--i) * 0.12s);
}
.sb-quiz.is-still .sb-clues li { animation: none; opacity: 1; }
.sb-clues i { margin-top: 0.3rem; color: var(--sb-gold-hi); }
.sb-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.sb-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.035);
  color: #fff;
  font-family: var(--sb-sinhala);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: 0.2s ease;
}
.sb-option small { font-family: var(--font); font-size: 0.62rem; font-weight: 500; color: var(--sb-dim); }
.sb-option:not(:disabled):hover { border-color: var(--sb-gold); background: rgba(201, 168, 76, 0.1); transform: translateY(-1px); }
.sb-option:disabled { cursor: default; }
.sb-option.is-right { border-color: #2BB673; background: rgba(43, 182, 115, 0.18); }
.sb-option.is-wrong { border-color: #E21212; background: rgba(226, 18, 18, 0.18); animation: sb-shake 0.4s ease; }
.sb-option.is-off { opacity: 0.45; }
@keyframes sb-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.sb-quiz-result { display: flex; gap: 0.65rem; align-items: flex-start; margin-top: 0.9rem; padding: 0.7rem 0.85rem; border-radius: 12px; font-size: 0.82rem; line-height: 1.6; animation: sb-rise 0.35s ease both; }
.sb-quiz-result i { margin-top: 0.25rem; font-size: 1rem; }
.sb-quiz-result.is-right { border: 1px solid rgba(43, 182, 115, 0.5); background: rgba(43, 182, 115, 0.12); color: #CFF5E0; }
.sb-quiz-result.is-right i { color: #4CD68F; }
.sb-quiz-result.is-wrong { border: 1px solid rgba(226, 18, 18, 0.45); background: rgba(226, 18, 18, 0.1); color: #FFDADA; }
.sb-quiz-result.is-wrong i { color: #FF6B6B; }
.sb-quiz-result small { color: var(--sb-soft); }
.sb-quiz-end { text-align: center; }
.sb-trophy {
  display: grid;
  place-items: center;
  width: 4.6rem;
  height: 4.6rem;
  margin: 0.4rem auto 0.8rem;
  border-radius: 50%;
  background: radial-gradient(circle, #4A070B, #140203);
  border: 1px solid var(--sb-gold);
  color: var(--sb-gold-hi);
  font-size: 1.8rem;
  box-shadow: 0 0 30px rgba(201, 168, 76, 0.35);
  animation: sb-trophy 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes sb-trophy { from { transform: scale(0.3) rotate(-20deg); opacity: 0; } }
.sb-bigscore { margin: 0.2rem 0 0.3rem; font-family: var(--font) !important; line-height: 1; }
.sb-bigscore b { font-size: 3.6rem; font-weight: 800; background: linear-gradient(180deg, #F3E2A9, #B8913A); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sb-bigscore small { margin-left: 0.3rem; font-size: 1.3rem; font-weight: 700; color: var(--sb-soft); }
.sb-review { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; margin-top: 1rem; }
.sb-review button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-family: var(--sb-sinhala);
  font-size: 0.7rem;
  font-weight: 600;
  color: #EEE;
  cursor: pointer;
}
.sb-review .is-right { border: 1px solid rgba(43, 182, 115, 0.5); background: rgba(43, 182, 115, 0.1); }
.sb-review .is-right i { color: #4CD68F; }
.sb-review .is-wrong { border: 1px solid rgba(226, 18, 18, 0.4); background: rgba(226, 18, 18, 0.08); }
.sb-review .is-wrong i { color: #FF6B6B; }
.sb-quiz-end .sb-actions { justify-content: center; }

/* Passport */
.sb-pass-head { display: flex; gap: 1rem; align-items: center; }
.sb-pass-head .sb-title { margin-top: 0.3rem; text-shadow: none; }
.sb-pass-head .sb-muted { margin-top: 0.2rem; }
.sb-pass-ring {
  --p: 0;
  flex-shrink: 0;
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  width: 5.2rem;
  height: 5.2rem;
  border-radius: 50%;
  background: conic-gradient(var(--sb-gold-hi) calc(var(--p) * 1%), rgba(201, 168, 76, 0.14) 0);
  font-family: var(--font);
}
.sb-pass-ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: #120304; }
.sb-pass-ring b,
.sb-pass-ring small { position: relative; line-height: 1; }
.sb-pass-ring b { font-size: 1.5rem; font-weight: 800; color: #fff; }
.sb-pass-ring small { font-size: 0.68rem; color: var(--sb-dim); }
.sb-stamps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.6rem 0.3rem; margin-top: 1.2rem; }
.sb-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  background: none;
  color: var(--sb-dim);
  cursor: pointer;
}
.sb-stamp b {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.18);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  transition: 0.2s ease;
}
.sb-stamp span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--sb-sinhala); font-size: 0.62rem; font-weight: 600; }
.sb-stamp:hover b { border-color: var(--c); color: #fff; }
/* a stamped one: like ink from a rubber stamp, a little crooked */
.sb-stamp.is-got { color: #EEE; }
.sb-stamp.is-got b {
  border: 2px solid var(--c);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 70%);
  box-shadow: inset 0 0 0 3px rgba(18, 3, 4, 0.9), inset 0 0 0 4.5px var(--c), 0 0 12px rgba(0, 0, 0, 0.4);
  color: var(--c);
  font-size: 0.9rem;
  transform: rotate(var(--r));
}
.sb-badge {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-top: 1.1rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--sb-gold);
  background: linear-gradient(135deg, rgba(232, 204, 114, 0.18), rgba(201, 168, 76, 0.04));
  animation: sb-trophy 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.sb-badge > i { font-size: 1.8rem; color: var(--sb-gold-hi); }
.sb-badge b { display: block; font-family: var(--sb-sinhala); font-size: 0.95rem; color: var(--sb-gold-hi); }
.sb-badge small { font-size: 0.68rem; color: var(--sb-soft); }

/* The stamp that lands on a district's photo the first time it is opened */
.sb-stamp-pop {
  position: absolute;
  top: 42%;
  left: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  border: 2.5px solid #E8CC72;
  background: rgba(18, 3, 4, 0.82);
  color: #E8CC72;
  font-family: var(--sb-sinhala);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: inset 0 0 0 2px rgba(18, 3, 4, 0.9), inset 0 0 0 3.5px rgba(232, 204, 114, 0.6);
  pointer-events: none;
  animation: sb-stamp-in 3.2s ease forwards;
}
.sb-stamp-pop b { font-family: var(--font); }
@keyframes sb-stamp-in {
  0%   { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(2.2); }
  12%  { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(0.95); }
  18%  { transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  80%  { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-8deg) scale(1); }
}

/* ── The story card preview ───────────────────────────────────── */
.sb-cardmodal {
  position: absolute;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 0, 1, 0.82);
  backdrop-filter: blur(6px);
  animation: sb-rise 0.3s ease both;
}
.sb-cardmodal[hidden] { display: none; }
.sb-cardbox {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  max-height: 100%;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(201, 168, 76, 0.35);
  background: #120304;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.sb-cardclose { position: absolute; top: -0.9rem; right: -0.9rem; background: #1A0506; }
.sb-cardimg { display: grid; place-items: center; min-width: min(300px, 70vw); min-height: 200px; }
.sb-cardimg img { display: block; max-width: min(460px, 82vw); max-height: calc(100vh - 13rem); border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.sb-cardimg img[hidden],
.sb-cardwait[hidden] { display: none; }
.sb-cardwait { display: flex; gap: 0.6rem; align-items: center; font-family: var(--sb-sinhala); font-size: 0.85rem; color: var(--sb-gold-hi); }
.sb-cardactions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.sb-cardactions a { text-decoration: none; }
.sb-cardactions [hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .sb-route { animation: none; }
}

/* ── Wide but short screens (most laptops): the same, packed closer ── */
@media (min-width: 1200px) and (max-height: 900px) {
  .sb-logo { width: 128px; }
  .sb-stops { margin-top: 0.6rem; }
  .sb-stops button { padding: 0.3rem 0.55rem; }
  .sb-trailhead + .sb-wide { margin-top: 0.6rem; }
  .sb-view { padding: 0.9rem 1.1rem 1rem; }
  .sb-h3 { margin: 1rem 0 0.45rem; }
  .sb-lead { margin-top: 0.5rem; }
  .sb-notebox { margin-top: 0.75rem; }
  .sb-topiclist { gap: 0.35rem; margin-top: 0.5rem; }
  .sb-source { margin-top: 0.7rem; }
  .sb-province { margin-top: 0.55rem; }
  .sb-items { gap: 0.4rem; margin-top: 0.8rem; }
  .sb-items li { padding: 0.45rem 0.7rem; }
  .sb-places { margin-top: 0.75rem; }
  .sb-nav { margin-top: 0.9rem; }
}

/* ── Narrower screens: the map, and one column beside it ─────── */
@media (max-width: 1199px) {
  .sb-body { grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); grid-template-areas: "map info"; }
  .sb-info {
    display: block;
    grid-area: info;
    min-height: 0;
    overflow-y: auto;
    border-left: 1px solid var(--sb-line);
    background: linear-gradient(180deg, #100203, #0B0102);
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 168, 76, 0.3) transparent;
  }
  .sb-side,
  .sb-panel { overflow: visible; border: 0; background: none; }
  .sb-side { border-top: 1px solid var(--sb-line); }
  .sb-headstats { display: none; }
}

/* ── Phones: the map on top, the text below ───────────────────── */
@media (max-width: 900px) {
  .sb-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 44vh minmax(0, 1fr); grid-template-areas: "map" "info"; }
  .sb-info { border-left: 0; border-top: 1px solid var(--sb-line); }
  .sb-head { padding: 0.6rem 0.8rem; }
  .sb-logo { width: 120px; }
  .sb-brand-text { padding-left: 0.6rem; }
  .sb-head h2 { font-size: 0.8rem; }
  .sb-head-actions .sb-btn span { display: none; }
  .sb-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .sb-chips::-webkit-scrollbar { display: none; }
  .sb-chip { flex-shrink: 0; }
  .sb-map-bottom { right: 0.8rem; }
  /* pinch to zoom instead: the buttons would cover the place names */
  .sb-map .leaflet-control-zoom { display: none; }
  .sb-rail { top: auto; bottom: 3.6rem; transform: none; gap: 0.35rem; }
  .sb-railbtn { width: 2.4rem; height: 2.4rem; font-size: 0.85rem; }
  .sb-railbtn span { display: none; }
}

@media (max-width: 480px) {
  .sb-eyebrow { display: none; }
  /* too narrow for the long title: the logo carries the name on its own */
  .sb-brand-text { display: none; }
  .sb-logo { width: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .sabandi-tab::after,
  .sb-pin.is-active::before,
  .sb-pin.is-active::after { animation: none; }
  .sb-pin, .sb-place { animation-duration: 0.01ms; }
  .sb-hero img { animation: none; }
}

/* ── The opening screen ───────────────────────────────────────── */
.sb-splash {
  position: absolute;
  inset: 0;
  z-index: 2000; /* above the Leaflet panes (400–1000) */
  overflow: hidden;
  pointer-events: none;
}
.sb-splash[hidden] { display: none; }
.sb-splash.is-playing { pointer-events: auto; cursor: pointer; }
.sb-splash.is-leaving { pointer-events: none; }
.sb-splash-skip {
  position: absolute;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 4vh, 2rem);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  font-family: var(--sb-sinhala);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--sb-gold-hi);
  background: rgba(11, 1, 2, 0.55);
  border: 1px solid rgba(201, 168, 76, 0.45);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.sb-splash-skip small { font-family: var(--font); font-size: 0.7rem; font-weight: 600; opacity: 0.8; }
.sb-splash-skip i { font-size: 0.7rem; }
.sb-splash-skip:hover,
.sb-splash-skip:focus-visible { background: rgba(201, 168, 76, 0.18); border-color: var(--sb-gold-hi); outline: none; }
.sb-splash.is-playing .sb-splash-skip { animation: sb-rise 0.5s ease 1.2s forwards; }
.sb-splash.is-leaving .sb-splash-skip { transition: opacity 0.3s ease; opacity: 0 !important; }
/* One maroon background with a gold glow; the whole screen fades away when the map is ready */
.sb-splash-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(201, 168, 76, 0.2), transparent 38%),
    radial-gradient(ellipse 75% 85% at 50% 50%, #4A070B, #1C0204 62%, #0B0102);
}
/* a faint gold lotus pattern over the maroon */
.sb-splash-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64' fill='none' stroke='%23E8CC72' stroke-width='1.2'%3E%3Cpath d='M32 14c5 6 5 14 0 20-5-6-5-14 0-20z'/%3E%3Cpath d='M32 34c-3-7-10-11-17-10 2 7 9 11 17 10zM32 34c3-7 10-11 17-10-2 7-9 11-17 10z'/%3E%3Ccircle cx='0' cy='0' r='3'/%3E%3Ccircle cx='64' cy='0' r='3'/%3E%3Ccircle cx='0' cy='64' r='3'/%3E%3Ccircle cx='64' cy='64' r='3'/%3E%3C/svg%3E") 0 0 / 64px 64px;
}
.sb-splash.is-playing .sb-splash-bg { animation: sb-breathe 6s ease-in-out infinite alternate; }
@keyframes sb-breathe { to { transform: scale(1.06); } }
.sb-splash.is-leaving { animation: sb-shade-out 1.1s ease forwards; }
.sb-splash.is-leaving .sb-splash-bg { animation: sb-bg-out 1.1s ease forwards; }
@keyframes sb-shade-out { 0% { opacity: 1; } 35% { opacity: 1; } 100% { opacity: 0; } }
@keyframes sb-bg-out { to { transform: scale(1.12); filter: blur(8px); } }

/* A ring of cultural icons turning slowly round the name */
.sb-splash-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(700px, 84vw);
  aspect-ratio: 1;
  margin: calc(min(700px, 84vw) / -2) 0 0 calc(min(700px, 84vw) / -2);
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.22);
  opacity: 0;
}
.sb-splash-orbit::before {
  content: '';
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border: 1px dashed rgba(201, 168, 76, 0.18);
}
.sb-splash-orbit span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform: rotate(calc(var(--i) * 36deg)) translateY(calc(min(700px, 84vw) / -2));
}
.sb-splash-orbit i {
  position: absolute;
  width: 2.6em;
  height: 2.6em;
  margin: -1.3em 0 0 -1.3em;
  display: grid;
  place-items: center;
  font-size: clamp(13px, 1.5vw, 18px);
  color: var(--sb-gold-hi);
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.45);
  background: radial-gradient(circle, #3A0508, #140203);
  box-shadow: 0 0 14px rgba(201, 168, 76, 0.25);
  /* keep each icon upright while the ring turns */
  transform: rotate(calc(var(--i) * -36deg));
  opacity: 0;
}
.sb-splash.is-playing .sb-splash-orbit { animation: sb-orbit-in 0.8s ease forwards, sb-spin 60s linear infinite; }
.sb-splash.is-playing .sb-splash-orbit i { animation: sb-icon-in 0.5s ease calc(0.25s + var(--i) * 0.09s) forwards, sb-spin-back 60s linear infinite; }
.sb-splash.is-leaving .sb-splash-orbit { transition: opacity 0.5s ease, scale 0.6s ease; opacity: 0 !important; scale: 1.25; }
@keyframes sb-orbit-in  { from { opacity: 0; scale: 0.85; } to { opacity: 1; scale: 1; } }
@keyframes sb-spin      { to { rotate: 360deg; } }
@keyframes sb-spin-back { to { rotate: -360deg; } }
@keyframes sb-icon-in   { from { opacity: 0; scale: 0.4; } to { opacity: 1; scale: 1; } }

.sb-splash-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem;
}
.sb-splash-logo {
  width: min(520px, 76vw);
  aspect-ratio: 1125 / 520;
  object-fit: cover;
  object-position: center 48.5%;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.6));
  opacity: 0;
  transform: scale(0.82);
}
.sb-splash.is-playing .sb-splash-logo { animation: sb-logo-in 1.1s cubic-bezier(0.2, 1.2, 0.3, 1) 0.15s forwards, sb-logo-glow 2.4s ease-in-out 1.2s infinite; }
.sb-splash.is-leaving .sb-splash-logo { animation: sb-logo-out 0.6s ease-in forwards; }
@keyframes sb-logo-in   { to { opacity: 1; transform: none; } }
@keyframes sb-logo-glow { 50% { filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 20px rgba(232, 204, 114, 0.55)); } }
@keyframes sb-logo-out  { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(1.12) translateY(-12px); } }

.sb-splash-tag {
  font-family: var(--sb-sinhala);
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--sb-gold-hi);
  opacity: 0;
}
.sb-splash.is-playing .sb-splash-tag { animation: sb-rise 0.6s ease 0.8s forwards; }
.sb-splash.is-leaving .sb-splash-tag,
.sb-splash.is-leaving .sb-splash-bar,
.sb-splash.is-leaving .sb-splash-icons { transition: opacity 0.35s ease; opacity: 0 !important; }

.sb-splash-bar {
  width: min(220px, 56vw);
  height: 3px;
  border-radius: 999px;
  background: rgba(201, 168, 76, 0.18);
  overflow: hidden;
}
.sb-splash-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sb-gold), var(--sb-gold-hi)); }
.sb-splash.is-playing .sb-splash-bar span { animation: sb-load var(--hold, 2300ms) ease-in-out forwards; }
@keyframes sb-load { to { width: 100%; } }

/* Small gold icons drifting up behind everything */
.sb-splash-icons i {
  position: absolute;
  bottom: -40px;
  left: calc(6% + var(--i) * 9.4%);
  font-size: calc(12px + (var(--i) * 3px) % 12px);
  color: rgba(201, 168, 76, 0.22);
  opacity: 0;
}
.sb-splash.is-playing .sb-splash-icons i { animation: sb-float 4.2s ease-in calc(var(--i) * 0.22s) infinite; }
@keyframes sb-float {
  0%   { opacity: 0; transform: translateY(0) rotate(0); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-75vh) rotate(25deg); }
}

@media (prefers-reduced-motion: reduce) {
  .sb-splash-bg, .sb-splash-logo, .sb-splash-icons i,
  .sb-splash-orbit, .sb-splash-orbit i { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
