html, body {
      margin: 0;
      padding: 0;
      height: 100%;
      font-family: Arial, sans-serif;
      background: #f8fafc;
    }

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

    #app {
      display: flex;
      flex-direction: column;
      height: 100vh;
      width: 100%;
    }

    #timeline-shell {
      flex: 0 0 auto;
      background: white;
      border-bottom: 1px solid #dbe1e8;
      overflow: hidden;
    }

    #main-content {
      display: flex;
      flex: 1;
      min-height: 0;
      min-width: 0;
    }

    #trips-shell {
      width: 320px;
      max-width: 40vw;
      flex: 0 0 320px;
      min-height: 0;
      background: white;
      border-right: 1px solid #dbe1e8;
      overflow: hidden;
    }

    #trips-details {
      height: 100%;
      min-height: 0;
    }

    #trips-details[open] {
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
    }

    #trips-details > .section-body {
      min-height: 0;
      overflow: hidden;
      padding: 0;
    }

    #trips-panel {
      height: 100%;
      min-height: 0;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      overflow: hidden;
      padding: 16px;
    }

    #trip-list {
      overflow-y: auto;
      overflow-x: hidden;
      scrollbar-gutter: stable;
    }

    #trips-panel p {
      margin: 0 0 16px 0;
      color: #475569;
      font-size: 14px;
    }

    #timeline-panel {
      margin-bottom: 0;
      padding: 0;
      border: 0;
      border-radius: 0;
      background: transparent;
    }

    #timeline-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 10px;
      font-size: 14px;
      color: #334155;
    }

    #timeline-header strong {
      min-width: 0;
    }

    #slider-row {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 10px;
    }

    #year-min,
    #year-max {
      font-size: 13px;
      color: #475569;
      min-width: 36px;
      text-align: center;
    }

    #year-slider {
      flex: 1;
      margin: 0;
    }

    #show-all-btn {
      border: 1px solid #cbd5e1;
      background: white;
      border-radius: 8px;
      padding: 8px 10px;
      cursor: pointer;
      margin-left: 10px;
    }

    #show-all-btn:hover {
      background: #f1f5f9;
    }

    .legend-toggle {
      background: white;
      border: 1px solid #cbd5e1;
      border-radius: 6px;
      padding: 6px 10px;
      font-size: 13px;
      cursor: pointer;
      box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    }

    .legend-toggle:hover {
      background: #f8fafc;
    }

    .trip-button {
      display: block;
      width: 100%;
      text-align: left;
      margin-bottom: 12px;
      padding: 12px;
      border: 1px solid #dbe1e8;
      border-radius: 10px;
      background: #ffffff;
      cursor: pointer;
      transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    }

    .trip-button:hover {
      background: #f8fafc;
      border-color: #94a3b8;
    }

    .trip-button.active {
      border-color: #2563eb;
      background: #eff6ff;
    }

    .trip-title {
      font-weight: bold;
      font-size: 15px;
      margin-bottom: 6px;
      color: #0f172a;
    }

    .trip-meta {
      font-size: 13px;
      color: #475569;
      margin-bottom: 4px;
    }

    .trip-notes {
      font-size: 13px;
      color: #334155;
      margin-top: 6px;
    }

    #map {
      flex: 1;
      min-width: 0;
      min-height: 0;
      height: 100%;
      width: 100%;
      background: #dbeafe;
    }

    .legend {
      background: white;
      padding: 10px 12px;
      line-height: 1.5;
      border-radius: 8px;
      box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
    }

    .legend h4 {
      margin: 0 0 8px 0;
      font-size: 14px;
    }

    .legend-item {
      display: flex;
      align-items: center;
      margin-bottom: 6px;
      font-size: 13px;
    }

    .legend-triangle {
      width: 0;
      height: 0;
      margin-right: 8px;
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
      border-bottom: 10px solid var(--marker-color);
      filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5));
      flex: 0 0 auto;
    }

    .popup-title {
      font-weight: bold;
      font-size: 15px;
      margin-bottom: 6px;
    }

    .popup-subtitle {
      color: #444;
      margin-bottom: 8px;
    }

    .popup-notes {
      margin-top: 8px;
    }

    .route-highlight {
      filter: drop-shadow(0 0 4px rgba(0,0,0,0.35));
    }

    .triangle-marker div {
      width: 0;
      height: 0;
      border-left: 8px solid transparent;
      border-right: 8px solid transparent;
      border-bottom: 14px solid var(--marker-color);
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
    }

    .legend-lived-circle {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      margin-right: 8px;
      border: 2px solid #1d4ed8;
      background: rgba(96,165,250,0.35);
      flex: 0 0 auto;
    }

    .legend-lived {
      cursor: help;
    }

    #timeline-shell summary,
    #trips-details summary {
      list-style: none;
      cursor: pointer;
      user-select: none;
      padding: 12px 14px;
      font-weight: 600;
      font-size: 14px;
      color: #0f172a;
      background: #f8fafc;
      border-bottom: 1px solid #e2e8f0;
    }
    
    #timeline-shell summary::-webkit-details-marker,
    #trips-details summary::-webkit-details-marker {
      display: none;
    }

    #timeline-shell summary::after,
    #trips-details summary::after {
      content: "▾";
      float: right;
      transition: transform 0.2s ease;
    }

    #timeline-shell:not([open]) summary::after,
    #trips-details:not([open]) summary::after {
      transform: rotate(-90deg);
    }

    #timeline-shell > .section-body {
      padding: 12px;
    }

    @media (max-width: 800px) {
      #main-content {
        flex-direction: column;
      }

      #trips-shell {
        width: 100%;
        max-width: 100%;
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid #dbe1e8;
        min-height: 0;
      }

      #trips-panel {
        display: flex;
        flex-direction: column;
        max-height: 28vh;
        min-height: 0;
        padding: 12px;
      }

      #trip-list {
        flex: 1;
        min-height: 0;
      }
    }