:root {
  --ink: #f7fbf8;
  --muted: #a9b9b2;
  --bg: #071412;
  --panel: rgba(7, 20, 18, .88);
  --line: rgba(245, 214, 142, .18);
  --sea: #7fc7bc;
  --gold: #e3b354;
  --sand: #f4dca6;
  --coral: #ffb26b;
  --violet: #b8a7ff;
  --shadow: 0 18px 58px rgba(0,0,0,.38);
  --radius: 20px;
  --max: 1120px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(127,199,188,.14), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(244,220,166,.08), transparent 24%),
    linear-gradient(180deg, #061412, #0b221f 46%, var(--bg));
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.appbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(5, 16, 15, .84);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 900; letter-spacing: -.02em; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #061412; background: linear-gradient(135deg, var(--sea), var(--sand)); box-shadow: 0 0 30px rgba(121,201,189,.28); }
.appbar-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; min-width: 0; }
.pill { border: 1px solid var(--line); background: rgba(255,255,255,.075); color: var(--ink); border-radius: 999px; padding: 8px 11px; font-size: 13px; font-weight: 760; cursor: pointer; display: inline-block; }
.pill.primary { color: #061412; background: linear-gradient(135deg, var(--sea), var(--sand)); border: 0; }
.view-toggle { white-space: nowrap; }

/* YouTube link and header CTA */
.yt-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  background: linear-gradient(135deg, #ff0033, #d80027);
  border-color: rgba(255, 255, 255, .16);
  box-shadow: 0 0 18px rgba(255, 0, 51, .34);
}

.yt-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px rgba(255, 0, 51, .52);
}

.yt-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 12px;
  line-height: 1;
  transform: translateX(1px);
}

.yt-text {
  font-weight: 900;
  letter-spacing: .02em;
}

.map-hero { min-height: 100svh; padding-top: 52px; position: relative; overflow: hidden; }
#worldMap { position: absolute; inset: 52px 0 0 0; min-height: calc(100svh - 52px); background: #081923; z-index: 1; }
.leaflet-container { background: #081923; color: var(--ink); font: inherit; }
.leaflet-pane.leaflet-tile-pane { opacity: .25; filter: saturate(.55) brightness(.72) contrast(1.05); }
.leaflet-control-attribution { background: rgba(4,15,22,.68) !important; color: rgba(255,255,255,.64) !important; font-size: 10px !important; }
.leaflet-control-zoom a { background: rgba(4,15,22,.88) !important; color: var(--ink) !important; border-color: rgba(255,255,255,.2) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: rgba(5,18,26,.96); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.leaflet-popup-content { font-size: 13px; line-height: 1.45; }
.country-label { border: 0; background: transparent; }
.country-chip {
  min-width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
  border: 2px solid rgba(255,255,255,.92);
  background: radial-gradient(circle at 30% 24%, #fff2b8, var(--gold) 52%, #8b6827);
  color: #1c1205; font-weight: 950; font-size: 12px;
  box-shadow: 0 0 0 7px rgba(227,179,84,.16), 0 14px 34px rgba(0,0,0,.34);
}
.country-chip.new { background: radial-gradient(circle at 30% 24%, #ffe8c8, var(--coral) 52%, #9b4f1f); box-shadow: 0 0 0 8px rgba(255,178,107,.22), 0 16px 38px rgba(0,0,0,.38); }
.country-chip.mystery { background: radial-gradient(circle at 30% 24%, #eee9ff, var(--violet) 52%, #6d5ab4); box-shadow: 0 0 0 8px rgba(184,167,255,.18), 0 16px 38px rgba(0,0,0,.38); }
.guernsey-chip { width: 22px; height: 22px; border-radius: 50%; background: var(--coral); border: 4px solid #fff; box-shadow: 0 0 0 13px rgba(255,155,133,.18), 0 0 38px rgba(255,155,133,.85); }
.map-overlay { position: relative; z-index: 500; min-height: calc(100svh - 52px); display: grid; grid-template-rows: auto 1fr auto; pointer-events: none; }
.hero-copy { pointer-events: auto; width: min(560px, calc(100% - 24px)); margin: 8px auto 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(180deg, rgba(5,18,26,.86), rgba(5,18,26,.6)); backdrop-filter: blur(18px); box-shadow: var(--shadow); }
.kicker { color: var(--sea); text-transform: uppercase; letter-spacing: .16em; font-size: 10px; font-weight: 900; }
h1 { margin: 0 0 3px; font-size: clamp(24px, 6vw, 52px); line-height: .96; letter-spacing: -.068em; }
.hero-copy p { margin: 0; color: #d6eaf0; line-height: 1.3; font-size: clamp(12px, 2vw, 15px); }
.data-status { margin-top: 6px !important; color: var(--sea) !important; font-size: 11px !important; }
.map-tabs { pointer-events: auto; display: flex; gap: 7px; overflow-x: auto; padding: 8px 12px 0; scrollbar-width: none; }
.map-tabs::-webkit-scrollbar { display: none; }
.map-tabs button { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; background: rgba(5,18,26,.76); color: var(--muted); cursor: pointer; backdrop-filter: blur(12px); font-size: 13px; }
.map-tabs button.active { color: #061412; background: var(--sea); border-color: transparent; font-weight: 900; }
.bottom-sheet { pointer-events: auto; width: min(100%, 1080px); margin: 0 auto 8px; padding: 0 10px; }
.sheet-card { border: 1px solid var(--line); border-radius: 22px; background: rgba(5,18,26,.88); backdrop-filter: blur(22px); box-shadow: var(--shadow); overflow: hidden; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 1px; background: rgba(255,255,255,.1); }
.summary-stat { background: rgba(5,18,26,.78); padding: 10px 12px; }
.summary-stat small { display: block; color: var(--muted); font-size: 10px; margin-bottom: 2px; }
.summary-stat strong { font-size: clamp(21px, 4.8vw, 30px); letter-spacing: -.05em; }
.summary-stat span { display: block; color: var(--sea); font-size: 10px; margin-top: 1px; }
.headline-strip { display: grid; grid-template-columns: 1.2fr 1fr; gap: 8px; padding: 8px; }
.quick-panel { border: 1px solid var(--line); border-radius: 16px; padding: 10px; background: rgba(255,255,255,.075); min-height: 82px; cursor: pointer; }
.quick-panel h3 { margin: 0 0 3px; font-size: 14px; }
.quick-panel p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
.badge { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 7px; font-size: 10px; color: #dff7f4; background: rgba(255,255,255,.08); margin-top: 6px; }
.badge.gold { color: #ffecba; border-color: rgba(227,179,84,.46); }
.badge.mystery { color: #eee9ff; border-color: rgba(184,167,255,.5); }
.content { max-width: var(--max); margin: 0 auto; padding: 16px 10px 56px; }
.section { padding: 15px 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 10px; }
.section h2 { margin: 0; font-size: clamp(24px, 5.6vw, 40px); letter-spacing: -.055em; }
.section .sub, .sub { color: var(--muted); margin: 4px 0 0; line-height: 1.38; font-size: 14px; }
.card { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.052)); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-pad { padding: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bar-list { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 78px 1fr 34px; gap: 8px; align-items: center; font-size: 12px; cursor: pointer; border-radius: 10px; padding: 2px 4px; margin-left: -4px; margin-right: -4px; }
.bar-row:hover { background: rgba(255,255,255,.075); }
.track { height: 8px; background: rgba(255,255,255,.1); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--sea), var(--sand)); }
.type-card { cursor: pointer; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; color: var(--ink); width: 100%; }
.type-card:hover, .find-card:hover, .quick-panel:hover, .clean-card:hover, .find-row:hover { background: rgba(255,255,255,.11); }
.type-card h3 { margin: 0 0 6px; }
.type-meta { color: var(--muted); font-size: 12px; line-height: 1.35; }
.type-icon { font-size: 30px; margin-bottom: 8px; }
.mini-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.reset-button { border: 1px solid var(--line); }
.horizontal-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 28%); gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.horizontal-scroll > * { scroll-snap-align: start; }
.find-card { min-height: 176px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; }
.find-emoji { font-size: 34px; }
.find-card h3 { margin: 6px 0 3px; font-size: 18px; letter-spacing: -.025em; }
.find-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.story-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; }
.mini-story { display: grid; gap: 8px; }
.timeline { display: grid; gap: 9px; }
.clean-card { display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 11px; cursor: pointer; }
.date-tile { border-radius: 16px; background: rgba(227,179,84,.13); border: 1px solid rgba(227,179,84,.30); display: grid; place-items: center; text-align: center; min-height: 62px; color: #fff0c8; font-weight: 900; }
.date-tile span { display: block; font-size: 10px; color: var(--muted); font-weight: 700; }
.clean-card h3 { margin: 0 0 3px; font-size: 16px; }
.clean-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.34; }
.clean-details { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.mystery-card { display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 12px; }
.mystery-icon { width: 62px; height: 62px; border-radius: 17px; display: grid; place-items: center; font-size: 28px; background: rgba(184,167,255,.15); border: 1px solid rgba(184,167,255,.32); }
.mystery-card h3 { margin: 5px 0 3px; font-size: 17px; }
.mystery-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.find-list { display: grid; gap: 9px; margin-top: 10px; }
.find-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.065); cursor: pointer; }
.find-row .icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: rgba(227,179,84,.12); font-size: 22px; }
.find-row h4 { margin: 0 0 2px; font-size: 14px; }
.find-row p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.3; }
.image-link { color: var(--sea); font-weight: 800; font-size: 12px; white-space: nowrap; }
.image-link:hover { text-decoration: underline; }
.drawer-photo { aspect-ratio: 16 / 10; border-radius: 18px; border: 1px solid var(--line); background: linear-gradient(135deg, rgba(121,201,189,.14), rgba(227,179,84,.12)); display: grid; place-items: center; font-size: 44px; margin: 12px 0; }
.drawer { position: fixed; inset: auto 0 0 0; z-index: 1100; max-height: 75svh; transform: translateY(105%); transition: transform .24s ease; background: rgba(5,18,26,.97); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; box-shadow: 0 -22px 70px rgba(0,0,0,.45); padding: 8px 14px 18px; overflow: auto; }
.drawer.open { transform: translateY(0); }
.grabber { width: 42px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.24); margin: 0 auto 5px; }
.drawer-inner { max-width: 720px; margin: 0 auto; }
.drawer h2 { margin: 6px 0 4px; font-size: 32px; letter-spacing: -.05em; }
.close { float: right; margin-top: 3px; }
@media (max-width: 760px) {
  .brand span:last-child { max-width: 132px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .appbar-actions .pill:not(.primary):not(.view-toggle):not(.yt-link) { display: none; }
  .hero-copy { width: calc(100% - 16px); }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-stat { padding: 8px 7px; }
  .summary-stat small { font-size: 9px; }
  .summary-stat strong { font-size: 20px; }
  .summary-stat span { display: none; }
  .headline-strip { grid-template-columns: 1fr; gap: 7px; }
  .quick-panel { min-height: auto; }
  .section-head { display: block; }
  .grid-2, .grid-3, .story-grid { grid-template-columns: 1fr; }
  .horizontal-scroll { grid-auto-columns: 74%; }
  .content { padding-top: 10px; }
  .leaflet-control-zoom { display: none; }
}
@media (min-width: 980px) {
  .hero-copy { margin-left: max(18px, calc((100vw - var(--max)) / 2)); margin-right: auto; }
  .bottom-sheet { margin-bottom: 18px; }
  .drawer { inset: 52px 0 0 auto; width: 400px; height: calc(100svh - 52px); max-height: none; transform: translateX(105%); border-radius: 24px 0 0 24px; border-top: 0; border-left: 1px solid var(--line); }
  .drawer.open { transform: translateX(0); }
}


/* v2.2 mobile-first refinements */
.mini-link-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mini-link { border: 1px solid rgba(227,179,84,.42); background: rgba(227,179,84,.12); color: #ffe7a8; border-radius: 999px; padding: 6px 9px; font-size: 12px; font-weight: 850; cursor: pointer; }
.mini-link:hover { background: rgba(227,179,84,.2); }
.clean-drilldown { width: 100%; text-align: left; color: var(--ink); margin-top: 10px; cursor: pointer; }
.clean-drilldown h3 { margin: 0 0 4px; }
button.clean-drilldown { font: inherit; }

@media (max-width: 760px) {
  .appbar { height: 56px; padding: 7px 8px; }
  .brand { gap: 7px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand span:last-child { max-width: 106px; }
  .appbar-actions { gap: 4px; }
  .pill { padding: 7px 8px; font-size: 12px; }
  .view-toggle { display: inline-block !important; padding: 7px 8px; font-size: 11px; max-width: 86px; overflow: hidden; text-overflow: ellipsis; }
  .appbar-actions .pill.primary { display: inline-block; }
  .yt-link { display: inline-flex !important; padding: 7px 8px; }
  .yt-text { display: none; }
  .map-hero { padding-top: 56px; min-height: 104svh; }
  #worldMap { inset: 56px 0 0 0; min-height: calc(104svh - 56px); }
  .map-overlay { min-height: calc(104svh - 56px); grid-template-rows: auto 1fr auto; }
  .hero-copy { width: calc(100% - 14px); margin-top: 6px; padding: 8px 10px; border-radius: 16px; }
  .hero-copy h1 { font-size: clamp(23px, 7vw, 34px); }
  .hero-copy p:not(.data-status) { font-size: 12px; line-height: 1.25; }
  .data-status { margin-top: 4px !important; font-size: 10px !important; }
  .map-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; padding: 6px 7px 0; overflow: visible; }
  .map-tabs button { min-width: 0; white-space: normal; padding: 7px 4px; font-size: 10.5px; line-height: 1.05; text-align: center; }
  .bottom-sheet { margin-bottom: 6px; padding: 0 7px; }
  .sheet-card { border-radius: 18px; }
  .summary-stat { padding: 7px 6px; }
  .summary-stat strong { font-size: 18px; }
  .headline-strip { padding: 6px; }
  .quick-panel { padding: 8px; }
  .quick-panel h3 { font-size: 13px; }
  .quick-panel p { font-size: 11px; }
  .content { padding-left: 12px; padding-right: 12px; }
  .section { padding: 18px 0; }
  .card-pad { padding: 14px; }
  .clean-card { grid-template-columns: 56px 1fr; }
  .drawer { max-height: 84svh; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}

body.desktop-mode { --max: 1320px; }
body.desktop-mode .map-hero { min-height: 72svh; }
body.desktop-mode #worldMap { min-height: calc(72svh - 52px); }
body.desktop-mode .map-overlay { min-height: calc(72svh - 52px); }
body.desktop-mode .content { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
body.desktop-mode .section { padding: 10px 0; }
body.desktop-mode #timeline, body.desktop-mode #drilldown { grid-column: span 2; }
body.desktop-mode .horizontal-scroll { grid-auto-columns: minmax(260px, 24%); }
body.desktop-mode .drawer { inset: 52px 0 0 auto; width: 460px; height: calc(100svh - 52px); max-height: none; transform: translateX(105%); border-radius: 24px 0 0 24px; border-top: 0; border-left: 1px solid var(--line); }
body.desktop-mode .drawer.open { transform: translateX(0); }
body.desktop-mode .story-grid { grid-template-columns: .8fr 1.4fr; }


/* v2.3: keep desktop/mobile toggle reachable on phones and prevent header overflow */
@media (max-width: 760px) {
  body.desktop-mode .appbar { height: 56px; }
  body.desktop-mode .map-hero { min-height: 104svh; padding-top: 56px; }
  body.desktop-mode #worldMap { inset: 56px 0 0 0; min-height: calc(104svh - 56px); }
  body.desktop-mode .map-overlay { min-height: calc(104svh - 56px); }
  body.desktop-mode .content { display: block; max-width: 980px; }
  body.desktop-mode .view-toggle { display: inline-block !important; }
}


/* v2.4 layout tightening and mobile KPI fixes */
.summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#spread .section-head { margin-bottom: 6px; }
#spread .card-pad { padding: 10px 12px; }
#spread .card h3 { margin: 0 0 7px; font-size: 15px; }
#spread .bar-list { gap: 5px; }
#spread .bar-row { padding-top: 1px; padding-bottom: 1px; font-size: 11.5px; grid-template-columns: 86px 1fr 28px; }
#spread .track { height: 7px; }

@media (max-width: 760px) {
  .summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .summary-stat { padding: 6px 4px; min-width: 0; }
  .summary-stat small { font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .summary-stat strong { font-size: clamp(16px, 5vw, 20px); display: block; }
  #spread .section-head { margin-bottom: 6px; }
  #spread .section h2, #spread h2 { margin-top: 0; }
  #spread .section .sub, #spread .sub { font-size: 12px; margin-top: 2px; }
  #spread .grid-2 { gap: 8px; }
  #spread .card-pad { padding: 9px 10px; }
  #spread .bar-row { grid-template-columns: 78px 1fr 24px; gap: 6px; font-size: 11px; }
  #finds { padding-top: 8px; }
}

/* Desktop mode should widen sections without squashing unrelated sections side by side. */
body.desktop-mode .content { display: block !important; max-width: var(--max); }
body.desktop-mode .section { padding: 16px 0; }
body.desktop-mode .grid-2 { grid-template-columns: 1fr 1fr; }
body.desktop-mode .grid-3 { grid-template-columns: repeat(3, 1fr); }
body.desktop-mode #finds { grid-column: auto; }
body.desktop-mode .horizontal-scroll { grid-auto-columns: minmax(260px, 24%); }

/* v2.4.2: controlled mobile depth, expandable lists and explore tabs */
.compact-head { margin-bottom: 6px; }
.compact-data-grid { align-items: start; }
.expandable-card { display: flex; flex-direction: column; gap: 8px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.card-title-row h3 { margin: 0; }
.see-more { align-self: start; margin-top: 4px; padding: 7px 10px; font-size: 12px; }
.timeline-section { padding-top: 10px; }
.story-grid-tight { align-items: start; }
.timeline-wrap { display: grid; gap: 8px; }
.mini-story-compact { gap: 6px; padding: 12px; }
.mini-story-compact h3 { margin: 0; font-size: 16px; }
.mini-story-compact .sub { font-size: 12px; line-height: 1.32; margin-top: 0; }
.mini-story-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.mini-story-stats span { border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.06); padding: 7px 6px; color: var(--muted); font-size: 11px; line-height: 1.15; }
.mini-story-stats strong { display: block; color: var(--ink); font-size: 17px; letter-spacing: -.04em; }
.tab-shell { overflow: hidden; }
.tab-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: rgba(255,255,255,.10); border-bottom: 1px solid var(--line); }
.tab-buttons button { border: 0; color: var(--muted); background: rgba(5,18,26,.78); padding: 12px 8px; font-weight: 850; cursor: pointer; }
.tab-buttons button.active { color: #061412; background: linear-gradient(135deg, var(--sea), var(--sand)); }
.tab-panels { padding: 12px; }
.tab-panel[hidden] { display: none !important; }
.panel-head { margin-bottom: 10px; }
.panel-head h3 { margin: 0 0 3px; font-size: 18px; }
.explore-data-grid { grid-template-columns: repeat(3, 1fr); }
.empty-card { min-width: 220px; }

@media (max-width: 760px) {
  .compact-data-grid { gap: 8px; }
  .timeline-section { padding-top: 8px; }
  .story-grid-tight { gap: 8px; }
  .mini-story-compact { padding: 10px; }
  .mini-story-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mini-story-stats span { padding: 6px 4px; font-size: 10px; }
  .mini-story-stats strong { font-size: 15px; }
  .tab-buttons button { padding: 10px 5px; font-size: 12px; line-height: 1.1; }
  .tab-panels { padding: 9px; }
  .explore-data-grid { grid-template-columns: 1fr; gap: 8px; }
  .tabbed-section .type-card { min-height: 124px; }
  .horizontal-scroll { grid-auto-columns: 78%; }
}

body.desktop-mode #timeline,
body.desktop-mode #explore,
body.desktop-mode #mysteries { grid-column: auto; }
body.desktop-mode .tab-shell .grid-3 { grid-template-columns: repeat(3, 1fr); }

/* v2.4.7: approved explore tabs and limited mystery section */
#mysteries .see-more { margin-top: 10px; }
.compact-tab-buttons {
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
}
.compact-tab-buttons button,
.compact-tab-buttons .compact-tab {
  min-width: 0;
  padding: 10px 6px;
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.explore-list .bar-row {
  grid-template-columns: minmax(92px, 160px) 1fr 42px;
}
.compact-timeline {
  gap: 8px;
}
.compact-mystery-grid .mystery-card {
  min-height: 110px;
}

@media (max-width: 760px) {
  .compact-tab-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .compact-tab-buttons button,
  .compact-tab-buttons .compact-tab {
    padding: 9px 6px;
    font-size: 12px;
  }
  .explore-list .bar-row {
    grid-template-columns: 82px 1fr 30px;
  }
  #mysteries .grid-2,
  .compact-mystery-grid {
    grid-template-columns: 1fr;
  }
}

/* v2.4.9 mobile layout hotfix
   Error fixed: older max-width rules were overriding the approved compact mobile layout.
   These final overrides must stay at the bottom of the stylesheet. */
@media (max-width: 760px) {
  /* Keep Global spread compact on mobile without reverting to the earlier bulky stack spacing. */
  #spread .compact-data-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Keep Beach clean timeline readable but tight. */
  #timeline .story-grid-tight {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Mystery section: show cards as a controlled list, with the JS limiting to 3. */
  #mysteries .limited-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Approved Explore data mobile layout: two tab boxes side by side. */
  #explore .compact-tab-buttons,
  .tab-shell .compact-tab-buttons {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1px !important;
  }

  #explore .compact-tab-buttons button,
  #explore .compact-tab-buttons .compact-tab {
    min-width: 0 !important;
    width: 100% !important;
    padding: 9px 6px !important;
    font-size: 12px !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Stop earlier mobile grid rules from making Explore internals look like the old layout. */
  #explore .tab-panels .grid-2,
  #explore .tab-panels .grid-3,
  #explore .tab-panels .explore-data-grid,
  #explore .tab-panels .compact-mystery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  #explore .tab-panels .bar-list,
  #explore .tab-panels .timeline,
  #explore .tab-panels .horizontal-scroll {
    width: 100%;
  }

  #explore .tab-panels .horizontal-scroll {
    grid-auto-columns: minmax(210px, 78%);
  }

  #explore .panel-head h3 {
    font-size: 16px;
  }

  #explore .panel-head .sub {
    font-size: 12px;
  }
}

@media (min-width: 761px) {
  /* Approved desktop layout: all Explore tabs on a single compact row. */
  #explore .compact-tab-buttons,
  .tab-shell .compact-tab-buttons {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

/* v2.4.10 mobile sync hard override
   Purpose: ensure the live mobile viewport receives the approved layout even if older mobile rules remain above. */
html[data-sof-build="v2.4.11-clean-frontend"] #explore .compact-tab-buttons,
body[data-sof-build="v2.4.11-clean-frontend"] #explore .compact-tab-buttons {
  display: grid !important;
}

@media (max-width: 760px) {
  body[data-sof-build="v2.4.11-clean-frontend"] #explore .compact-tab-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body[data-sof-build="v2.4.11-clean-frontend"] #explore .compact-tab-buttons button {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 9px 6px !important;
    font-size: 12px !important;
    line-height: 1.1 !important;
  }

  body[data-sof-build="v2.4.11-clean-frontend"] #explore .tab-panel .bar-list,
  body[data-sof-build="v2.4.11-clean-frontend"] #explore .tab-panel .timeline,
  body[data-sof-build="v2.4.11-clean-frontend"] #explore .tab-panel .horizontal-scroll,
  body[data-sof-build="v2.4.11-clean-frontend"] #explore .tab-panel .compact-mystery-grid {
    display: grid !important;
  }

  body[data-sof-build="v2.4.11-clean-frontend"] #explore .tab-panel .grid-2,
  body[data-sof-build="v2.4.11-clean-frontend"] #explore .tab-panel .grid-3,
  body[data-sof-build="v2.4.11-clean-frontend"] #explore .tab-panel .compact-mystery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body[data-sof-build="v2.4.11-clean-frontend"] #spread .compact-data-grid,
  body[data-sof-build="v2.4.11-clean-frontend"] #timeline .story-grid-tight,
  body[data-sof-build="v2.4.11-clean-frontend"] #mysteries .limited-list {
    grid-template-columns: 1fr !important;
  }
}

@media (min-width: 761px) {
  body[data-sof-build="v2.4.11-clean-frontend"] #explore .compact-tab-buttons {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}
