﻿/* Event map */
  #section-map {
    position: relative;
    z-index: 0;
    width: min(1040px, 100%);
  }

  .map-shell {
    position: relative;
    z-index: 0;
    width: 100%;
    height: min(720px, calc(100dvh - 120px));
    min-height: 560px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #082523;
    box-shadow: 0 20px 70px rgba(0,0,0,0.28);
  }

  #octoMap {
    position: relative;
    z-index: 0;
    width: 100%;
    height: 100%;
    background: #dfeee7;
  }

  #section-map .leaflet-container,
  #section-map .leaflet-pane,
  #section-map .leaflet-top,
  #section-map .leaflet-bottom {
    z-index: 1;
  }

  #section-map .leaflet-control {
    z-index: 10;
  }

  #menuOverlay {
    z-index: 9000 !important;
  }

  #sideMenu {
    z-index: 9100 !important;
  }

  #menuToggle {
    z-index: 9200 !important;
  }

  .map-topbar {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 66px;
    z-index: 1300;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
  }

  .map-title-pill,
  .map-action-btn {
    pointer-events: auto;
    border: 1px solid rgba(255,177,0,0.55);
    background: rgba(7,31,30,0.94);
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0,0,0,0.22);
    backdrop-filter: blur(10px);
  }

  .map-title-pill {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-radius: 10px;
    padding: 9px 12px;
  }

  .map-title-pill strong {
    font-family: 'Karma', serif;
    color: var(--amber);
    font-size: 1rem;
    line-height: 1;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .map-title-pill span {
    color: var(--teal-light);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-action-btn {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s, border-color 0.2s, color 0.2s;
    flex-shrink: 0;
  }

  .map-action-btn svg,
  .map-star svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .map-action-btn:active { transform: scale(0.96); }
  .map-action-btn.active {
    color: var(--amber);
    border-color: var(--amber);
  }

  .map-panel {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 1250;
    width: min(340px, calc(100% - 24px));
    max-height: min(58%, 430px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(26,74,69,0.9);
    border-radius: 12px;
    background: rgba(7,31,30,0.95);
    box-shadow: 0 18px 50px rgba(0,0,0,0.35);
    backdrop-filter: blur(14px);
  }

  .map-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--border);
  }

  .map-panel-title {
    color: var(--amber);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
  }

  .map-count {
    color: var(--teal-light);
    font-size: 0.62rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .map-event-list {
    overflow-y: auto;
    padding: 8px;
  }

  .map-day-group {
    margin: 0;
    list-style: none;
  }

  .map-day-group + .map-day-group {
    margin-top: 8px;
  }

  .map-day-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    cursor: pointer;
    list-style: none;
    border-radius: 10px;
    border: 1px solid rgba(255,177,0,0.22);
    background: rgba(255,177,0,0.06);
  }
  .map-day-summary::-webkit-details-marker { display: none; }
  .map-day-summary::after {
    content: '▾';
    margin-left: auto;
    color: var(--amber);
    transition: transform 0.2s;
  }
  .map-day-group[open] .map-day-summary::after {
    transform: rotate(180deg);
  }

  .map-day-label {
    color: var(--amber);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .map-day-count {
    color: var(--teal-light);
    font-size: 0.58rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .map-day-events {
    padding-top: 6px;
    margin: 0;
    list-style: none;
  }

  .map-event-item {
    width: 100%;
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
  }

  .map-event-item + .map-event-item { margin-top: 6px; }
  .map-event-item.active,
  .map-event-item:hover {
    border-color: var(--amber);
    background: rgba(255,177,0,0.08);
  }

  .map-date-chip {
    width: 42px;
    height: 42px;
    border-radius: 9px;
    border: 1px solid var(--amber-dim);
    background: rgba(255,177,0,0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--amber);
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
  }

  .map-date-chip span:first-child { font-size: 0.55rem; }
  .map-date-chip span:last-child { font-size: 1rem; }

  .map-event-name {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 3px;
  }

  .map-event-meta {
    display: block;
    color: var(--teal-light);
    font-size: 0.7rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .map-star {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(10,42,39,0.92);
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
  }

  .map-star.active {
    color: var(--amber);
    border-color: var(--amber);
  }

  .map-empty {
    padding: 24px 14px;
    text-align: center;
    color: var(--muted);
    font-size: 0.75rem;
    line-height: 1.5;
  }

  .map-filter-sheet,
  .map-detail-sheet {
    position: absolute;
    z-index: 1350;
    right: 12px;
    bottom: 12px;
    width: min(360px, calc(100% - 24px));
    max-height: calc(100% - 76px);
    overflow-y: auto;
    border: 1px solid rgba(255,177,0,0.45);
    border-radius: 12px;
    background: rgba(7,31,30,0.97);
    box-shadow: 0 22px 60px rgba(0,0,0,0.42);
    backdrop-filter: blur(16px);
    display: none;
  }

  .map-filter-sheet.open,
  .map-detail-sheet.open { display: block; }

  .map-sheet-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(7,31,30,0.98);
  }

  .map-sheet-title {
    color: var(--amber);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
  }

  .map-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--teal-light);
    cursor: pointer;
    font-size: 1.1rem;
  }

  .map-filters {
    display: grid;
    gap: 12px;
    padding: 14px;
  }

  .map-filters label {
    display: grid;
    gap: 6px;
    color: var(--teal-light);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }

  .map-filters select,
  .map-filters input[type="date"] {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    padding: 8px 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.82rem;
  }

  .map-filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 14px 14px;
  }

  .map-filter-actions .btn {
    margin: 0;
    padding: 10px 8px;
    font-size: 0.62rem;
  }

  .map-detail-body {
    padding: 14px;
  }

  .map-detail-kicker {
    color: var(--teal-light);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 8px;
  }

  .map-detail-name {
    font-family: 'Karma', serif;
    color: var(--amber);
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.05;
    margin-bottom: 10px;
  }

  .map-detail-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 0;
    border-top: 1px solid rgba(26,74,69,0.75);
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .map-detail-label {
    width: 78px;
    flex-shrink: 0;
    color: var(--teal-light);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .map-detail-value a {
    color: var(--amber);
    text-decoration: none;
  }

  .map-detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
  }

  .map-detail-actions .btn {
    margin: 0;
    padding: 10px 8px;
    text-align: center;
    text-decoration: none;
    font-size: 0.62rem;
  }

  .map-loading {
    position: absolute;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(7,31,30,0.86);
    color: var(--teal-light);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
  }

  .leaflet-popup-content-wrapper,
  .leaflet-popup-tip {
    background: #071f1e;
    color: var(--text);
    border: 1px solid var(--border);
  }

  .leaflet-popup-content {
    margin: 12px;
    font-family: 'Montserrat', sans-serif;
  }

  .leaflet-container a { color: var(--amber); }

  @media (max-width: 720px) {
    body {
      padding-left: 16px;
      padding-right: 16px;
    }

    #section-map {
      width: calc(100% + 32px);
      margin-left: -16px;
      margin-right: -16px;
    }

    .map-shell {
      height: calc(100dvh - 40px);
      min-height: 620px;
      border-left: none;
      border-right: none;
      border-radius: 0;
    }

    .map-panel {
      left: 8px;
      right: 8px;
      bottom: 8px;
      width: auto;
      max-height: 34%;
      border-radius: 14px;
    }

    .map-filter-sheet,
    .map-detail-sheet {
      left: 8px;
      right: 8px;
      bottom: 8px;
      width: auto;
      max-height: 72%;
      border-radius: 16px 16px 12px 12px;
    }

    .map-topbar {
      top: max(10px, env(safe-area-inset-top));
      left: 8px;
      right: 58px;
    }

    .map-title-pill strong { font-size: 0.9rem; }
    .map-title-pill span { font-size: 0.52rem; }
    .map-action-btn { width: 40px; height: 40px; }

    .map-event-list {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      overflow-y: hidden;
      scroll-snap-type: x mandatory;
      padding-bottom: 10px;
    }

    .map-event-item {
      min-width: min(290px, 86vw);
      scroll-snap-align: start;
    }

    .map-event-item + .map-event-item { margin-top: 0; }
  }
