/* ===== Top Page Styles (data.pokefuta.com/index.html) ===== */

/* Design tokens */
:root {
  --top-bg: #FAF6EC;
  --top-card-bg: #fff;
  --top-border: #ECE5D2;
  --top-border-light: #F0EAD9;
  --top-text: #2B2B30;
  --top-text-muted: #62626B;
  --top-text-faint: #8A8A93;
  --top-purple: #6C5CA6;
  --top-purple-dark: #4F4080;
  --top-purple-pale: #EEEAF7;
  --top-purple-light: #9A8FC0;
  --top-eyebrow: #A85B2E;
  --top-radius-card: 14px;
  --top-radius-card-lg: 18px;
  --top-radius-pill: 999px;
  --top-max-w: 480px;
  --top-pad: 16px;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }

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

body.pokefuta-top-page {
  margin: 0;
  padding: 0;
  background: var(--top-bg);
  font-family: 'Noto Sans JP', system-ui, -apple-system, sans-serif;
  color: var(--top-text);
  -webkit-font-smoothing: antialiased;
  /* Numbered-block counter. Auto-numbers only the *visible* .sec-num badges, so
     mobile (no header nav, separate map section) reads 1–5 and desktop (header
     nav = 1, map hero merged) also reads 1–5 — no manual renumbering, no gaps. */
  counter-reset: top-sec;
}

a { color: inherit; text-decoration: none; }

/* ── App bar ── */
.top-app-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 246, 236, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--top-border);
}

.top-app-bar-inner {
  max-width: var(--top-max-w);
  margin: 0 auto;
  padding: 10px var(--top-pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-name {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--top-purple-dark);
}

.brand-sub {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--top-purple-light);
  padding-bottom: 1px;
}

.top-count-badge {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--top-purple);
  background: var(--top-purple-pale);
  padding: 4px 10px;
  border-radius: var(--top-radius-pill);
  white-space: nowrap;
}

.top-count-badge b {
  font-weight: 700;
}

/* Right-side group: desktop nav links + count badge. */
.top-nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Horizontal nav. On mobile it becomes a compact second row. */
.top-nav {
  display: flex;
  align-items: center;
}

/* Header's "1" badge — desktop only (hidden on mobile so it isn't counted). */
.nav-num {
  display: none;
  align-self: center;
}

@media (max-width: 959px) {
  .top-app-bar-inner {
    gap: 8px;
    padding: 8px 10px;
  }

  .top-brand { flex: 0 0 auto; }
  .top-nav-right {
    display: block;
    min-width: 0;
    margin-left: auto;
  }

  .top-nav {
    display: flex;
    gap: 4px;
  }

  .top-nav-link {
    padding: 6px 5px;
    overflow: hidden;
    border-radius: 7px;
    background: var(--top-purple-pale);
    color: var(--top-purple-dark);
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ── Main layout ── */
.top-main {
  max-width: var(--top-max-w);
  margin: 0 auto;
  padding: 0 0 60px;
}

/* ── Sections ── */
.top-section {
  padding: 20px var(--top-pad) 0;
}

.sec-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.sec-num {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: var(--top-radius-pill);
  background: var(--top-purple);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  flex-shrink: 0;
  counter-increment: top-sec;
}

.sec-num::before { content: counter(top-sec); }

/* セクション番号バッジ（①〜⑤・ヘッダーの①）は意味がないため全て非表示。
   ブレークポイントごとに display を切り替える既存ルールを確実に上書きする。 */
.sec-num,
.nav-num { display: none !important; }

.sec-eyebrow-text {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--top-eyebrow);
  font-weight: 500;
  text-transform: uppercase;
}

.sec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sec-header .sec-eyebrow {
  margin-bottom: 0;
  min-width: 0;
  flex: 1;
}

.sec-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
}

.sec-file-label {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 10px;
  color: var(--top-purple-light);
  flex-shrink: 0;
}

/* ── Section 1: Intro ── */
.top-h1 {
  margin: 7px 0 10px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.32;
  letter-spacing: -0.01em;
  color: var(--top-text);
}

.top-intro-text {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.72;
  color: var(--top-text-muted);
}

.top-intro-text b {
  color: var(--top-text);
}

.top-stats-row {
  display: flex;
  background: var(--top-card-bg);
  border: 1px solid var(--top-border);
  border-radius: 13px;
  overflow: hidden;
}

.top-stat {
  flex: 1;
  padding: 11px 6px;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 18px;
  font-weight: 900;
  color: var(--top-purple-dark);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  letter-spacing: -0.02em;
}

.stat-label {
  display: block;
  font-size: 10px;
  color: var(--top-text-faint);
  margin-top: 1px;
}

.stat-divider {
  width: 1px;
  background: var(--top-border-light);
  align-self: stretch;
}

.top-stats-note {
  margin-top: 7px;
  font-size: 11px;
  color: var(--top-text-faint);
  text-align: center;
}

/* ── Section 2: Hero ── */
.hero-update-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--top-purple);
  flex-shrink: 0;
}

.hero-featured-card {
  display: block;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--top-border);
  box-shadow: 0 4px 14px rgba(79, 64, 128, 0.08);
  text-decoration: none;
  color: inherit;
}

.hero-featured-media {
  height: 148px;
  background: linear-gradient(140deg, #9DB6C7 0%, #7E9DB2 55%, #5E7C8A 100%);
  position: relative;
  overflow: hidden;
}

.hero-featured-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 0;
}

.hero-featured-media::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.06) 0 11px, transparent 11px 22px);
  z-index: 1;
}

.hero-featured-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 2;
}

.hero-badge {
  position: absolute;
  top: 11px;
  left: 11px;
  background: #fff;
  color: var(--top-eyebrow);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--top-radius-pill);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.hero-media-label {
  position: absolute;
  top: 13px;
  right: 13px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  color: rgba(255,255,255,.85);
}

.hero-featured-copy {
  position: relative;
  width: 100%;
  padding: 13px 14px;
  background: linear-gradient(to top, rgba(20,28,34,.78), transparent);
}

.hero-featured-title {
  color: #fff;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.32;
  text-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.hero-featured-place {
  color: rgba(255,255,255,.92);
  font-size: 11.5px;
  margin-top: 3px;
}

.hero-featured-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: var(--top-card-bg);
}

.hero-footer-text {
  font-size: 12px;
  color: var(--top-text-muted);
}

.hero-footer-name-link {
  position: relative;
  z-index: 3; /* above .hero-featured-overlay (z-index: 2), which can visually extend over the footer */
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.hero-footer-name-link:hover,
.hero-footer-name-link:focus-visible {
  text-decoration: underline;
}

.hero-footer-cta {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--top-purple);
}

/* Small hero cards */
.hero-small-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.hero-small-card {
  display: block;
  background: var(--top-card-bg);
  border: 1px solid var(--top-border);
  border-radius: 13px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.hero-small-media {
  height: 62px;
  background: linear-gradient(140deg, #E3D6B6, #CDB98C);
  position: relative;
  overflow: hidden;
}

.hero-small-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-small-badge {
  position: absolute;
  bottom: 6px;
  left: 8px;
  background: rgba(255,255,255,.92);
  color: var(--top-eyebrow);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--top-radius-pill);
}

.hero-small-body {
  padding: 8px 10px 10px;
}

.hero-small-title {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
}

.hero-small-place {
  font-size: 10px;
  color: var(--top-text-faint);
  margin-top: 3px;
}

/* ── Section 0: New releases (topmost; revealed by JS only when recent) ── */
#sec-newrelease[hidden] { display: none; }
#sec-events[hidden] { display: none; }

.newrel-update-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--top-eyebrow);
  background: #FCEFE3;
  padding: 3px 10px;
  border-radius: var(--top-radius-pill);
  white-space: nowrap;
}

.newrel-scroller {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.newrel-scroller::-webkit-scrollbar { height: 6px; }
.newrel-scroller::-webkit-scrollbar-thumb {
  background: var(--top-border);
  border-radius: 3px;
}

.newrel-card {
  flex: 0 0 auto;
  width: 150px;
  scroll-snap-align: start;
  background: var(--top-card-bg);
  border: 1px solid var(--top-border);
  border-radius: 13px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.newrel-media {
  height: 96px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(140deg, #F3D9C2, #E7B894);
}

.newrel-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.newrel-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--top-eyebrow);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--top-radius-pill);
}

.newrel-body { padding: 8px 10px 10px; }

.newrel-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.newrel-place {
  font-size: 10px;
  color: var(--top-text-faint);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Section 3: Map gateway (Leaflet mini-map card) ── */
.map-gateway-card {
  display: block;
  position: relative;
  height: 380px;
  border-radius: var(--top-radius-card-lg);
  overflow: hidden;
  border: 1px solid #C5D8E1;
  background: linear-gradient(160deg, #D4E3EC, #B7CFDB);
  text-decoration: none;
  box-shadow: 0 7px 20px rgba(60, 90, 110, 0.18);
}

.map-gateway-minimap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* top-left live count badge */
.map-gateway-badge {
  position: absolute;
  top: 11px;
  left: 11px;
  z-index: 2;
  pointer-events: none;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  color: var(--top-purple-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: var(--top-radius-pill);
  box-shadow: 0 1px 4px rgba(0,0,0,.14);
  white-space: nowrap;
}

/* OSM/CARTO attribution — bottom-right of gateway card */
.map-gateway-attr {
  position: absolute;
  bottom: 4px;
  right: 6px;
  z-index: 3;
  font-size: 9px;
  color: rgba(255,255,255,.5);
  pointer-events: none;
  white-space: nowrap;
}

.map-gateway-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 26px 13px 13px;
  background: linear-gradient(to top, rgba(26,38,46,.9) 40%, rgba(26,38,46,0));
}

.map-gateway-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  text-shadow: 0 1px 4px rgba(0,0,0,.35);
}

.map-gateway-sub {
  font-size: 10.5px;
  color: rgba(255,255,255,.82);
  margin-top: 2px;
}

.map-gateway-cta {
  display: block;
  margin-top: 11px;
  background: var(--top-purple);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  padding: 13px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 5px 14px rgba(108,92,166,.5);
}

/* Per-prefecture count pins — map.html の .prefecture-overview-marker をベースに、
   都道府県名と件数を明確に2行で表示（円を少し大きめに）。 */
.prefecture-overview-marker {
  /* leaflet.css が top-page.css より後に読まれるため display を !important で確実に上書き */
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 46px !important;
  height: 46px !important;
  margin: -23px 0 0 -23px !important;
  border: 2px solid rgba(255, 255, 255, .94);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9374c8, #624095 76%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(67, 38, 111, .32);
  white-space: nowrap;
}

.prefecture-overview-name {
  display: block;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
}

.prefecture-overview-count {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  font-family: 'IBM Plex Mono', monospace;
}

/* Prefecture text links */
.top-pref-card {
  margin-top: 11px;
  background: var(--top-card-bg);
  border: 1px solid var(--top-border);
  border-radius: 13px;
  padding: 12px 14px;
}

.pref-card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--top-text-faint);
  margin-bottom: 9px;
}

.top-pref-links {
  display: flex;
  flex-direction: column;
}

.pref-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--top-border-light);
  text-decoration: none;
}

.pref-link-item--last {
  border-bottom: none;
}

.pref-link-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--top-purple-dark);
}

.pref-link-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--top-text-faint);
  flex-shrink: 0;
}

.pref-link-loading {
  font-size: 12px;
  color: var(--top-text-faint);
  padding: 4px 0;
}

.pref-show-all-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 0;
  background: none;
  border: 1px solid var(--top-border);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--top-purple);
  cursor: pointer;
  font-family: inherit;
}

/* ── Section 5: Hub ── */
.hub-card {
  background: var(--top-card-bg);
  border: 1px solid var(--top-border);
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
}

.hub-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13.5px;
  font-weight: 700;
}

.hub-card-more {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--top-purple);
  text-decoration: none;
}

.hub-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.hub-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #E2DCC9;
  background: #FBF8EF;
  border-radius: var(--top-radius-pill);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  color: var(--top-purple-dark);
  text-decoration: none;
}

.chip-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--top-purple-light);
  font-weight: 400;
}

.hub-chips--plain .hub-chip--plain {
  background: transparent;
  color: #5B5B63;
}

.hub-chips--plain .hub-chip--plain .chip-count {
  color: #A4A4AC;
  font-weight: 400;
}

/* ── Map page back-link ── */
.map-back-to-top {
  display: inline-block;
  margin: 8px 12px 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--top-purple);
  background: var(--top-purple-pale);
  border-radius: var(--top-radius-pill);
  text-decoration: none;
}

/* ── Tap states ── */
@media (hover: hover) {
  .hub-chip:hover,
  .hero-featured-card:hover,
  .hero-small-card:hover {
    opacity: 0.88;
  }
  .pref-link-item:hover .pref-link-name {
    text-decoration: underline;
  }
}

@media (hover: none) {
  .hub-chip:active,
  .hero-featured-card:active,
  .hero-small-card:active {
    opacity: 0.8;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   PC / Desktop layout (PC版)
   Layers a wide, multi-column desktop experience over the SP-first design.
   Tablet ≥768px: roomier single column. Desktop ≥960px: 2-column grid.
   All HTML/JS is reused unchanged; this is a presentation-only enhancement.
   ════════════════════════════════════════════════════════════════════════ */

/* Small tablet: tighten the side gutters before the full tablet width kicks in. */
@media (min-width: 600px) {
  :root {
    --top-max-w: 560px;
    --top-pad: 20px;
  }
}

/* Tablet: widen the single column and ease the reading measure. */
@media (min-width: 768px) {
  :root {
    --top-max-w: 700px;
    --top-pad: 24px;
  }
  .top-h1 { font-size: 26px; }
}

/* Desktop: the PC design — single full-width column, each section owning its
   own internal grid (per 改善のポイント SP改善版 → PC展開). */
@media (min-width: 960px) {
  :root {
    --top-max-w: 1080px;
  }

  .top-app-bar-inner {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .brand-name { font-size: 20px; }

  /* ── 1. Header nav (horizontal links + count pill) ── */
  .nav-num { display: inline-flex; }
  .top-nav {
    display: flex;
    align-items: center;
    gap: 24px;
  }
  .top-nav-right { gap: 22px; }
  .top-nav-link {
    font-size: 14px;
    font-weight: 500;
    color: #4B4B53;
    white-space: nowrap;
    text-decoration: none;
  }
  .top-nav-link:hover { color: var(--top-purple); }
  .top-nav-link--active { font-weight: 700; color: var(--top-purple-dark); }

  /* Single full-width column. Intro + map share one "maphero" band so the map
     renders edge-to-edge with the H1 panel overlaid on its left. DOM order is
     (intro → map → hero → pref → hub) — intro leads so the H1 + stats sit on top
     on mobile, with the map directly below; on desktop grid-template-areas +
     z-index pin the layout regardless of order (intro panel paints above the map). */
  .top-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "maphero"
      "hero"
      "pref"
      "hub";
    row-gap: 8px;
  }
  #sec-intro { grid-area: maphero; }
  #sec-hero  { grid-area: hero; }
  #sec-map   { grid-area: maphero; }
  #sec-pref  { grid-area: pref; }
  #sec-hub   { grid-area: hub; }
  #sec-newrelease { grid-area: newrelease; }
  #sec-events { grid-area: events; }

  /* When new releases exist, prepend a topmost row so the band leads the page.
     Hidden (the common case) leaves the base 4-row layout untouched — no gap.
     Event notices slot between the map band and the hero the same way. */
  .top-main:has(> #sec-newrelease:not([hidden])) {
    grid-template-areas:
      "newrelease"
      "maphero"
      "hero"
      "pref"
      "hub";
  }
  .top-main:has(> #sec-events:not([hidden])) {
    grid-template-areas:
      "maphero"
      "events"
      "hero"
      "pref"
      "hub";
  }
  .top-main:has(> #sec-newrelease:not([hidden])):has(> #sec-events:not([hidden])) {
    grid-template-areas:
      "newrelease"
      "maphero"
      "events"
      "hero"
      "pref"
      "hub";
  }

  /* Roomier section headings to match the design. */
  .sec-title { font-size: 20px; }
  .sec-num { width: 24px; height: 24px; }

  /* ── 2. Map hero: full-bleed, tall; H1 panel overlay; CTA pill ── */
  #sec-map {
    position: relative;
    z-index: 1;
    padding: 0;
    align-self: stretch;
  }
  /* The map section's own "地図から探す" header is visually redundant with the
     H1 panel, so collapse it to screen-reader-only (keeps the heading in the
     a11y tree / document outline). Its .sec-num is removed from flow so it
     doesn't increment the counter — no visible number gap. */
  #sec-map .sec-header {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  #sec-map .sec-num { display: none; }
  .map-gateway-card {
    height: 100%;
    min-height: 470px;
    border-radius: var(--top-radius-card-lg);
  }
  /* The bottom dark overlay collapses to a single CTA pill (bottom-right);
     H1 / intro / stats now live in the overlaid left panel. */
  .map-gateway-overlay {
    inset: auto 0 0 auto;
    width: auto;
    padding: 18px;
    background: none;
  }
  .map-gateway-title,
  .map-gateway-sub { display: none; }
  .map-gateway-cta {
    display: inline-block;
    margin: 0;
    padding: 12px 22px;
  }
  /* Count badge clears the left panel. */
  .map-gateway-badge { left: auto; right: 11px; }

  /* Intro → overlaid left panel (cream → transparent fade), full hero height.
     pointer-events:none lets clicks fall through to the map link beneath. */
  #sec-intro {
    position: relative;
    z-index: 2;
    align-self: stretch;
    justify-self: start;
    width: min(486px, 52%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    pointer-events: none;
    border-radius: var(--top-radius-card-lg) 0 0 var(--top-radius-card-lg);
    background: linear-gradient(to right,
      rgba(250, 246, 236, 0.97) 0%,
      rgba(250, 246, 236, 0.95) 62%,
      rgba(250, 246, 236, 0) 100%);
  }
  .top-h1 { font-size: 36px; line-height: 1.28; }
  .top-intro-text { max-width: 400px; font-size: 13.5px; }
  .top-stats-row { max-width: 380px; }
  .stat-num { font-size: 22px; }

  /* ── 3. Today's hero: featured (1.55fr) + two stacked horizontal cards ── */
  #sec-hero {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    grid-template-areas:
      "hd   hd"
      "feat small";
    column-gap: 16px;
    row-gap: 14px;
  }
  #sec-hero .sec-header { grid-area: hd; margin-bottom: 0; }
  #sec-hero .hero-featured-card {
    grid-area: feat;
    display: flex;
    flex-direction: column;
  }
  #sec-hero .hero-featured-media { flex: 1; height: auto; min-height: 248px; }
  #sec-hero .hero-featured-title { font-size: 21px; }
  #sec-hero .hero-small-grid {
    grid-area: small;
    margin-top: 0;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
  }
  #sec-hero .hero-small-card { display: flex; }
  #sec-hero .hero-small-media { width: 128px; height: auto; flex-shrink: 0; }
  #sec-hero .hero-small-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 14px 16px;
  }
  #sec-hero .hero-small-title { font-size: 15px; }
  #sec-hero .hero-small-place { font-size: 12px; }

  /* ── 4. Prefectures: 4-column link grid ── */
  .top-pref-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 34px;
  }
  .pref-link-item { padding: 12px 0; }
  .pref-link-name { font-size: 14px; }
  /* In the 4-column grid, keep the last cell's separator for row consistency. */
  .pref-link-item--last { border-bottom: 1px solid var(--top-border-light); }
  .pref-show-all-btn { max-width: 320px; margin: 12px auto 0; }

  /* ── 5. Purpose hub: 2-column card grid ── */
  #sec-hub {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
    align-items: start;
  }
  #sec-hub .sec-eyebrow { grid-column: 1 / -1; }
  .hub-card { margin-bottom: 0; padding: 18px 20px; }
  .hub-card-header { font-size: 15px; }
}

/* ── Event notices: active stamp rallies (hidden when none) ── */
.event-notice-list {
  display: grid;
  gap: 10px;
}
.event-notice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--top-border);
  border-left: 5px solid #176F68;
  border-radius: var(--top-radius-card);
  background: var(--top-card-bg);
  color: var(--top-text);
  text-decoration: none;
}
.event-notice-badge {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: var(--top-radius-pill);
  background: #176F68;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.event-notice-badge.is-upcoming {
  background: var(--top-eyebrow);
}
.event-notice-copy {
  min-width: 0;
}
.event-notice-copy b {
  display: block;
  font-size: 14px;
  line-height: 1.45;
}
.event-notice-copy small {
  color: var(--top-text-muted);
  font-size: 12px;
}

/* Wide desktop: a touch more breathing room. */
@media (min-width: 1280px) {
  :root {
    --top-max-w: 1180px;
  }
}
