/**
 * ============================================================================
 * ZIEBA.ART — Adventure Logbook
 * Frontend Stylesheet
 * ============================================================================
 *
 * Author:      Sebastian Zieba
 * Website:     zieba.art
 * Project:     Adventure Logbook
 * Component:   Logbook UI
 *
 * Description:
 *   Standalone frontend styles for the ZIEBA.ART Adventure Logbook.
 *   Covers map layout, journey navigation, journey details, live tracking UI,
 *   responsive/mobile layout and fullscreen mode.
 *
 * Notes:
 *   - Styling only; no functional values or selectors changed.
 *   - Desktop, fullscreen and mobile behavior are preserved 1:1.
 * ============================================================================
 */
/* ============================================================================
   01. LOGBOOK CONTAINER, INITIAL LOADER & BASE LAYOUT
   ============================================================================ */
.logbook-bleed {
    width: 100%;
    max-width: none;
  }
  .logbook-initial-loader {
    position: absolute;
    z-index: 20000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    overflow: hidden;
    border-radius: inherit;
    transform: translateZ(0);
    transition:
      opacity 0.48s ease,
      visibility 0s linear 0s;
  }
  .logbook-initial-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.48s ease,
      visibility 0s linear 0.48s;
  }
  .logbook-initial-spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgb(0 0 0 / 0.14);
    border-top-color: rgb(0 0 0 / 0.72);
    border-radius: 50%;
    animation: logbook-initial-spin 0.72s linear infinite;
  }
  @keyframes logbook-initial-spin {
    to {
      transform: rotate(360deg);
    }
  }
  .logbook-layout {
    position: relative;
    display: grid;
    grid-template-columns:
      minmax(0, 1fr)
      300px;
    min-height: 780px;
    overflow: hidden;
    border:
      1px solid
      rgb(0 0 0 / 0.08);
    border-radius: 0.8rem;
    background: #0b0b0b;
  }
  .dark .logbook-layout {
    border-color:
      rgb(255 255 255 / 0.25);
  }
  .map-area {
    position: relative;
    min-width: 0;
    overflow: hidden;
  }
  /* ============================================================================
   02. DEVELOPMENT / PLANNED-JOURNEY OVERLAYS
   ============================================================================ */
.logbook-dev-overlay {
    position: absolute;
    z-index: 1100;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgb(3 5 8 / 0.32);
    backdrop-filter: blur(4px) saturate(0.7);
    -webkit-backdrop-filter: blur(4px) saturate(0.7);
    opacity: 1;
    overflow: hidden;
    pointer-events: auto;
    transition: opacity 0.22s ease;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
  }
  .logbook-dev-overlay.is-hidden {
    opacity: 0;
    pointer-events: none;
  }
  .planned-journey-overlay {
    z-index: 1050;
    cursor: default;
    transition: none;
  }
  .planned-journey-overlay * {
    cursor: default;
  }
  .planned-journey-overlay .planned-journey-ok {
    cursor: pointer;
  }
  .logbook-dev-notice.planned-journey-notice {
    width: min(620px, 100%);
    max-width: 620px;
  }
  .logbook-dev-notice.planned-journey-notice p {
    max-width: 560px;
  }
  .planned-journey-start {
    display: block;
    margin-top: 1.1rem;
    color: rgb(255 255 255 / 0.94);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
  }
  /*
   * On desktop the details drawer is part of .map-area.
   * When it is open, center the development modal only over
   * the still-visible part of the map.
   */
  @media (min-width: 901px) {
    .logbook-bleed:not(.fullscreen-host) .logbook-dev-overlay {
      border-radius: 0.8rem 0 0 0.8rem;
    }
    .map-area.details-open .logbook-dev-overlay {
      right: min(420px, 92%);
    }
    .leaflet-bottom.leaflet-left .leaflet-control-attribution {
      margin-left: 13px !important;
    }
  }
  .logbook-dev-notice {
    position: relative;
    width: min(480px, 100%);
    padding: 1.75rem 1.8rem 1.55rem;
    border: 1px solid rgb(255 255 255 / 0.26);
    border-radius: 1rem;
    background:
      linear-gradient(
        160deg,
        rgb(29 29 29 / 0.985),
        rgb(11 11 11 / 0.995)
      );
    color: white;
    box-shadow:
      0 0 0 1px rgb(255 255 255 / 0.055),
      0 30px 90px rgb(0 0 0 / 0.72),
      0 8px 30px rgb(0 0 0 / 0.55);
    text-align: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  .logbook-dev-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.62rem;
    border: 1px solid rgb(255 255 255 / 0.12);
    border-radius: 999px;
    background: rgb(255 255 255 / 0.055);
    color: rgb(255 255 255 / 0.56);
    font-size: 0.58rem;
    font-weight: 750;
    line-height: 1;
    letter-spacing: 0.14em;
  }
  .logbook-dev-notice h2 {
    margin: 0.9rem 0 0;
    color: white;
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    font-weight: 650;
    letter-spacing: -0.025em;
    line-height: 1.2;
  }
  .logbook-dev-notice p {
    max-width: 410px;
    margin: 0.75rem auto 0;
    color: rgb(255 255 255 / 0.62);
    font-size: 0.82rem;
    line-height: 1.6;
  }
  .logbook-dev-notice strong {
    color: rgb(255 255 255 / 0.92);
    font-weight: 700;
  }
  .logbook-dev-ok {
    min-width: 96px;
    margin-top: 1.25rem;
    padding: 0.62rem 1.2rem;
    border: 1px solid rgb(255 255 255 / 0.88);
    border-radius: 0.65rem;
    background: rgb(255 255 255 / 0.96);
    color: #0b0b0b;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.26);
    transition:
      transform 0.16s ease,
      background 0.16s ease,
      box-shadow 0.16s ease;
  }
  .logbook-dev-ok:hover {
    background: white;
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.34);
    transform: translateY(-1px);
  }
  .logbook-dev-ok:active {
    transform: translateY(0);
  }
  .logbook-dev-ok:focus-visible {
    outline: 2px solid white;
    outline-offset: 3px;
  }
/* ============================================================================
   03. MAP, LOADING STATE & FULLSCREEN CONTROLS
   ============================================================================ */
  #logbook-map {
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    background: #fff;
  }
  #logbook-map:focus,
  #logbook-map .leaflet-interactive:focus {
    outline: none !important;
  }
  #logbook-map.leaflet-container,
  #logbook-map .leaflet-pane,
  #logbook-map .leaflet-tile-container {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
  #logbook-map .journey-track-hit-area {
    cursor: pointer;
  }
  .map-loading-overlay {
    position: absolute;
    z-index: 950;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(5 7 10 / 0.5);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.32s ease,
      visibility 0s linear 0.32s;
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
  }
  .map-loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    transition:
      opacity 0.32s ease,
      visibility 0s linear 0s;
  }
  /*
   * Used while entering/exiting fullscreen.
   * Keeping the overlay fixed to the viewport hides the map container's
   * instantaneous geometry change, so the transition reads as pure fade.
   */
  .map-loading-overlay.viewport-transition {
    position: fixed;
    z-index: 10050;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    background: #05070a;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: none;
  }
  .map-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgb(255 255 255 / 0.18);
    border-top-color: rgb(255 255 255 / 0.95);
    border-radius: 50%;
    animation: map-loading-spin 0.7s linear infinite;
    filter: drop-shadow(0 4px 14px rgb(0 0 0 / 0.4));
  }
  @keyframes map-loading-spin {
    to {
      transform: rotate(360deg);
    }
  }
  .fullscreen-toggle {
    position: absolute;
    z-index: 760;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 0.14);
    border-radius: 0.65rem;
    background: rgb(10 10 10 / 0.78);
    color: white;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition:
      right 0.32s cubic-bezier(0.22, 1, 0.36, 1),
      background 0.2s ease,
      border-color 0.2s ease;
  }
  .fullscreen-toggle:hover {
    background: rgb(26 26 26 / 0.92);
    border-color: rgb(255 255 255 / 0.24);
  }
  @media (min-width: 901px) {
    .map-area.details-open .fullscreen-toggle {
      right: calc(min(420px, 92%) + 1rem);
    }
  }
  .fullscreen-icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .fullscreen-icon-close { display: none; }
  .logbook-bleed.fullscreen-host {
    position: fixed;
    z-index: 9999;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    margin: 0;
    overflow: hidden;
    transform: none;
    background: #05070a;
    contain: layout paint;
  }
  .logbook-bleed.fullscreen-host .logbook-layout {
    width: 100%;
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) 320px;
    border: 0;
    border-radius: 0;
  }
  .logbook-bleed.fullscreen-host .map-area,
  .logbook-bleed.fullscreen-host #logbook-map,
  .logbook-bleed.fullscreen-host .journeys-panel {
    height: 100dvh;
  }
  .logbook-bleed.fullscreen-host #logbook-map {
    border: 0;
    border-radius: 0;
    outline: 0;
    box-shadow: none;
  }
  .logbook-bleed.fullscreen-host .fullscreen-icon-open { display: none; }
  .logbook-bleed.fullscreen-host .fullscreen-icon-close { display: block; }
  .logbook-bleed.fullscreen-host .logbook-dev-overlay {
    border-radius: 0;
    -webkit-mask-image: none;
  }
/* ============================================================================
   04. JOURNEY PANEL & JOURNEY CARDS
   ============================================================================ */
  .journeys-toggle { display: none; }
  .journeys-panel {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.1rem 0.65rem;
    border-left: 0;
    box-shadow: inset 1px 0 0 rgb(255 255 255 / 0.25);
    background:
      linear-gradient(
        180deg,
        #151515 0%,
        #0c0c0c 100%
      );
    color: white;
  }
  .panel-header {
    display: flex;
    align-items: flex-end;
    justify-content:
      space-between;
    padding:
      0 0.25rem 1.2rem;
  }
  .panel-eyebrow {
    color:
      rgb(255 255 255 / 0.4);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing:
      0.16em;
    text-transform:
      uppercase;
  }
  .panel-header h2 {
    margin:
      0.25rem 0 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing:
      -0.02em;
  }
  .journey-count {
    padding-bottom:
      0.15rem;
    color:
      rgb(255 255 255 / 0.34);
    font-size: 0.6rem;
  }
  .panel-header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }
  .journeys-close {
    display: none;
  }
  .journey-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-top: 3px;
    padding-right: 0.85rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgb(255 255 255 / 0.2) transparent;
  }
  .journey-list::-webkit-scrollbar,
  .drawer-entries::-webkit-scrollbar,
  .logbook-bleed.fullscreen-host::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  .journey-list::-webkit-scrollbar-track,
  .drawer-entries::-webkit-scrollbar-track,
  .logbook-bleed.fullscreen-host::-webkit-scrollbar-track {
    background: #0b0b0b;
  }
  .journey-list::-webkit-scrollbar-thumb,
  .drawer-entries::-webkit-scrollbar-thumb,
  .logbook-bleed.fullscreen-host::-webkit-scrollbar-thumb {
    border: 1px solid #0b0b0b;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.22);
  }
  .journey-list::-webkit-scrollbar-thumb:hover,
  .drawer-entries::-webkit-scrollbar-thumb:hover,
  .logbook-bleed.fullscreen-host::-webkit-scrollbar-thumb:hover {
    background: rgb(255 255 255 / 0.34);
  }
     .journey-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    min-height: 72px;
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 0.09);
    border-radius: 0.85rem;
    background: linear-gradient(145deg, rgb(255 255 255 / 0.055), rgb(255 255 255 / 0.018));
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  }
  .journey-card:hover {
    border-color: rgb(255 255 255 / 0.18);
    background: linear-gradient(145deg, rgb(255 255 255 / 0.085), rgb(255 255 255 / 0.028));
    transform: translateY(-1px);
  }
  .journey-card.active {
    border-color: var(--journey-color);
    background:
      linear-gradient(
        145deg,
        color-mix(in srgb, var(--journey-color) 14%, rgb(255 255 255 / 0.055)),
        color-mix(in srgb, var(--journey-color) 5%, rgb(255 255 255 / 0.018))
      );
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--journey-color) 18%, transparent),
      0 8px 24px color-mix(in srgb, var(--journey-color) 12%, transparent);
  }
  .journey-visibility-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-left: 1px solid rgb(255 255 255 / 0.07);
    background: rgb(255 255 255 / 0.018);
    cursor: pointer;
  }
  .journey-visibility-button:hover { background: rgb(255 255 255 / 0.05); }
  .journey-visibility-dot {
    width: 11px;
    height: 11px;
    border: 2px solid var(--journey-color);
    border-radius: 50%;
    background: transparent;
    opacity: 0.4;
    transition: opacity 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }
  .journey-visibility-button.active .journey-visibility-dot {
    background: var(--journey-color);
    opacity: 1;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--journey-color) 16%, transparent);
  }
  .journey-visibility-button:hover .journey-visibility-dot { transform: scale(1.15); }
  .journey-card-main {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    grid-template-areas: "chevron content";
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: 0.7rem;
    padding: 0.8rem 0.9rem 0.8rem 0.8rem;
    border: 0;
    background: transparent;
    color: white;
    text-align: left;
    cursor: pointer;
  }
  .journey-card-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.42rem;
  }
  .journey-name {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    color: rgb(255 255 255 / 0.96);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .journey-satellite {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    line-height: 1;
    opacity: 0.8;
    flex: 0 0 auto;
  }
  .journey-satellite svg {
    display: block;
    width: 15px;
    height: 15px;
  }
  .journey-meta {
    display: flex;
    align-items: center;
    color: rgb(255 255 255 / 0.38);
    font-size: 0.58rem;
    font-weight: 650;
    line-height: 1;
    letter-spacing: 0.09em;
  }
  .journey-meta > span {
    white-space: nowrap;
  }
  .journey-meta > .journey-date {
    line-height: 1.35;
    white-space: pre-line;
  }
  .journey-meta-separator {
    width: 1px;
    height: 11px;
    margin: 0 0.65rem;
    overflow: hidden;
    background: rgb(255 255 255 / 0.16);
    color: transparent;
  }
  .journey-chevron {
    grid-area: chevron;
    color: rgb(255 255 255 / 0.3);
    font-size: 1.2rem;
    font-weight: 300;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
  }
  .journey-card:hover .journey-chevron {
    color: rgb(255 255 255 / 0.75);
    transform: translateX(-2px);
  }
  .journey-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #ff4d4d;
    font-weight: 800;
    letter-spacing: 0.11em;
  }
  .drawer-live {
    color: #ff4d4d;
    font-weight: 800;
  }
  .journey-live-dot {
    position: relative;
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--journey-color);
  }
  .journey-live-dot::after {
    position: absolute;
    inset: -5px;
    border: 1px solid var(--journey-color);
    border-radius: 50%;
    content: "";
    animation: live-list-echo 2.8s ease-out infinite;
  }
  @keyframes live-list-echo {
    0% { transform: scale(0.45); opacity: 0; }
    10% { opacity: 0.32; }
    55% { opacity: 0.12; }
    70%, 100% { transform: scale(1); opacity: 0; }
  }
/* ============================================================================
   05. ROUTE MARKERS, LIVE POSITION & TRACK TOOLTIPS
   ============================================================================ */
  .route-flag-icon {
    background: transparent !important;
    border: 0 !important;
    overflow: visible !important;
  }
  .route-start-flag {
    width: 24px;
    height: 28px;
    overflow: visible;
    fill: none;
    stroke: var(--journey-color);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.45));
  }
  .route-finish-flag {
    width: 28px;
    height: 28px;
    overflow: visible;
    filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.5));
  }
  .route-finish-flag .finish-pole,
  .route-finish-flag .finish-outline {
    fill: none;
    stroke: var(--journey-color);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .route-finish-flag .finish-cloth {
    fill: var(--journey-color);
    stroke: none;
  }
  .live-location-icon {
    width: 58px !important;
    height: 58px !important;
    overflow: visible !important;
    background: transparent !important;
    border: 0 !important;
  }
  .live-point {
    position: absolute;
    top: 22px;
    left: 22px;
    z-index: 2;
    box-sizing: border-box;
    width: 14px;
    height: 14px;
    border: 2px solid rgb(255 255 255 / 0.96);
    border-radius: 50%;
    background: var(--journey-color);
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--journey-color) 28%, transparent),
      0 0 16px color-mix(in srgb, var(--journey-color) 72%, transparent);
  }
  .live-echo-ring {
    position: absolute;
    top: 2px;
    left: 2px;
    z-index: 1;
    box-sizing: border-box;
    width: 54px;
    height: 54px;
    border: 2px solid var(--journey-color);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.28);
    transform-origin: 50% 50%;
    box-shadow: 0 0 10px color-mix(in srgb, var(--journey-color) 45%, transparent);
    animation: live-map-echo 2.8s ease-out infinite;
    pointer-events: none;
  }
  @keyframes live-map-echo {
    0% { transform: scale(0.28); opacity: 0; }
    7% { opacity: 0.72; }
    38% { opacity: 0.42; }
    68% { transform: scale(1); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
  }
  .track-tooltip {
    min-width: 248px;
    padding: 0.15rem 0.1rem;
    color: rgb(255 255 255 / 0.94);
    font-variant-numeric: tabular-nums;
    text-align: left;
  }
  .track-tooltip-live {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    margin-bottom: 0.55rem;
    color: #ff4d4d;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.12em;
  }
  .track-tooltip-live > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
  }
  .track-tooltip-time {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.65rem;
  }
  .track-tooltip-time > span {
    color: rgb(255 255 255 / 0.5);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
  }
  .track-tooltip-time > b {
    color: rgb(255 255 255 / 0.94);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
  }
  .track-tooltip-divider {
    height: 1px;
    margin: 0.6rem 0 0.48rem;
    background: rgb(255 255 255 / 0.11);
  }
  .track-tooltip-row {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    align-items: start;
    gap: 0.7rem;
    margin-top: 0.33rem;
    text-align: left;
  }
  .track-tooltip-label {
    padding-top: 0.08rem;
    color: rgb(255 255 255 / 0.42);
    font-size: 0.58rem;
    font-weight: 750;
    line-height: 1.35;
    letter-spacing: 0.08em;
  }
  .track-tooltip-value {
    color: rgb(255 255 255 / 0.9);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.38;
    text-align: left;
  }
  .track-tooltip-position .track-tooltip-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: -0.01em;
  }
  @media (prefers-reduced-motion: reduce) {
    .journey-live-dot::after {
      animation: none;
    }
  }
/* ============================================================================
   06. JOURNEY DETAILS DRAWER
   ============================================================================ */
  .drawer-backdrop {
    position: absolute;
    z-index: 650;
    inset: 0;
    background:
      rgb(0 0 0 / 0.2);
    opacity: 0;
    pointer-events: none;
    transition:
      opacity 0.25s ease;
  }
  .drawer-backdrop.open {
    opacity: 0;
    pointer-events: none;
  }
  .details-drawer {
    position: absolute;
    z-index: 700;
    top: 0;
    right: 0;
    width:
      min(420px, 92%);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-left:
      1px solid
      rgb(255 255 255 / 0.25);
    background:
      linear-gradient(
        160deg,
        rgb(22 22 22 / 0.99),
        rgb(8 8 8 / 0.995)
      );
    color: white;
    box-shadow:
      -20px 0 50px
      rgb(0 0 0 / 0.32);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 0.34s ease,
      visibility 0s linear 0.34s;
    backdrop-filter:
      blur(18px);
  }
  .details-drawer.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
      opacity 0.34s ease,
      visibility 0s linear 0s;
  }
  .drawer-header {
    position: relative;
    flex: 0 0 auto;
    padding:
      2rem 1.6rem
      1.5rem;
    border-bottom:
      1px solid
      rgb(255 255 255 / 0.08);
  }
  .drawer-eyebrow {
    padding-right: 3rem;
    color:
      rgb(255 255 255 / 0.48);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing:
      0.12em;
    text-transform:
      uppercase;
  }
  .drawer-header h2 {
    max-width: 290px;
    margin:
      0.45rem 0 0;
    font-size: 1.65rem;
    font-weight: 600;
    letter-spacing:
      -0.025em;
    line-height: 1.15;
  }
  .drawer-route {
    margin-top: 0.75rem;
    color:
      rgb(255 255 255 / 0.58);
    font-size: 0.82rem;
    line-height: 1.4;
  }
  .drawer-close {
    position: absolute;
    z-index: 5;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border:
      1px solid
      rgb(255 255 255 / 0.14);
    border-radius: 50%;
    background:
      rgb(255 255 255 / 0.05);
    color:
      rgb(255 255 255 / 0.72);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
  }
  .drawer-close:hover {
    background:
      rgb(255 255 255 / 0.12);
    color: white;
  }
  .drawer-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 1.4rem 1.6rem 0.65rem;
  }
  .drawer-stats {
    display: grid;
    grid-template-columns:
      repeat(3, 1fr);
    gap: 0.55rem;
  }
  .drawer-stat {
    min-height: 78px;
    box-sizing: border-box;
    padding:
      0.8rem 0.65rem;
    border:
      1px solid
      rgb(255 255 255 / 0.08);
    border-radius:
      0.75rem;
    background:
      rgb(255 255 255 / 0.025);
  }
  .drawer-stats + .drawer-stats {
    margin-top: 0.65rem;
  }
  .drawer-stat strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 650;
    line-height: 1.2;
  }
  .drawer-stat strong .distance-primary {
    display: block;
  }
  .drawer-stat strong .distance-secondary {
    display: block;
    margin-top: 0.18rem;
    color: rgb(255 255 255 / 0.46);
    font-size: 0.66rem;
    font-weight: 550;
  }
  .drawer-stat > span {
    display: block;
    margin-bottom: 0.3rem;
    color:
      rgb(255 255 255 / 0.42);
    font-size: 0.62rem;
    line-height: 1.3;
  }
  .drawer-section {
    margin-top: 1.8rem;
  }
  .drawer-section:last-child {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
  }
  .drawer-section-label {
    color:
      rgb(255 255 255 / 0.48);
    font-size: 0.66rem;
    font-weight: 750;
    letter-spacing:
      0.12em;
    text-transform:
      uppercase;
  }
  .drawer-section p {
    margin:
      0.65rem 0 0;
    color:
      rgb(255 255 255 / 0.66);
    font-size: 0.84rem;
    line-height: 1.6;
  }
  .drawer-section-heading {
    display: flex;
    align-items: center;
    justify-content:
      space-between;
  }
  .drawer-section-heading > span {
    color:
      rgb(255 255 255 / 0.4);
    font-size: 0.65rem;
  }
  .drawer-entries {
    position: relative;
    flex: 1 1 auto;
    min-height: 110px;
    max-height: none;
    margin-top: 1rem;
    padding-right: 0.45rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    text-align: left;
    scrollbar-width: thin;
    scrollbar-color:
      rgb(255 255 255 / 0.18)
      transparent;
  }
  .entry-item {
    position: relative;
    display: grid;
    grid-template-columns:
      18px
      minmax(0, 1fr);
    width: 100%;
    padding:
      0 0 1.15rem;
    border: 0;
    background:
      transparent;
    color: white;
    text-align: left;
    cursor: default;
  }
  .entry-item.has-location {
    cursor: pointer;
  }
  .entry-item + .entry-item {
    padding-top: 0.15rem;
  }
  .entry-item:not(:last-child)::before {
    position: absolute;
    top: 0.55rem;
    bottom: 0;
    left: 6px;
    width: 1px;
    background:
      rgb(255 255 255 / 0.1);
    content: "";
  }
  .entry-marker {
    position: relative;
    z-index: 1;
    width: 9px;
    height: 9px;
    margin-top: 3px;
    border:
      2px solid
      rgb(255 255 255 / 0.7);
    border-radius: 50%;
    background: #111;
  }
  /* Journey Log entry type markers.
     Keep the existing 13px marker geometry and timeline axis unchanged. */

  .entry-marker-weather,
  .entry-marker-event {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .entry-marker-weather::after,
  .entry-marker-event::after {
    display: block;
    width: 7px;
    height: 7px;
    background: rgb(255 255 255 / 0.78);
    content: "";
  }

  /* Weather — cloud */
  .entry-marker-weather::after {
    -webkit-mask:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 18H6a4 4 0 0 1-.5-7.97A6 6 0 0 1 17.1 8.5 4.75 4.75 0 0 1 19 18Z'/%3E%3C/svg%3E")
      center / contain no-repeat;
    mask:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 18H6a4 4 0 0 1-.5-7.97A6 6 0 0 1 17.1 8.5 4.75 4.75 0 0 1 19 18Z'/%3E%3C/svg%3E")
      center / contain no-repeat;
  }

  /* Event — flag */
  .entry-marker-event::after {
    -webkit-mask:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 3h2v18H6V3Zm2 1h10l-2 4 2 4H8V4Z'/%3E%3C/svg%3E")
      center / contain no-repeat;
    mask:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 3h2v18H6V3Zm2 1h10l-2 4 2 4H8V4Z'/%3E%3C/svg%3E")
      center / contain no-repeat;
  }

  .entry-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-left:
      0.25rem;
    text-align: left;
  }
  .entry-date {
    display: block;
    color:
      rgb(255 255 255 / 0.46);
    font-size: 0.66rem;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: 0.025em;
    text-align: left;
    white-space: nowrap;
  }
  .entry-content strong {
    display: block;
    margin-top:
      0.3rem;
    color:
      rgb(255 255 255 / 0.94);
    font-size:
      0.86rem;
    font-weight:
      650;
    line-height:
      1.35;
    text-align: left;
  }
  .entry-text {
    display: block;
    margin-top:
      0.32rem;
    color:
      rgb(255 255 255 / 0.62);
    font-size:
      0.8rem;
    line-height:
      1.55;
    text-align: left;
  }
  .entry-item.has-location:hover
  .entry-content strong {
    text-decoration:
      underline;
  }
  .drawer-loading,
  .drawer-empty,
  .loading {
    color:
      rgb(255 255 255 / 0.35);
    font-size:
      0.65rem;
  }
  .drawer-loading,
  .loading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }
  .drawer-loading::before,
  .loading::before {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border: 2px solid rgb(255 255 255 / 0.16);
    border-top-color: rgb(255 255 255 / 0.72);
    border-radius: 50%;
    content: "";
    animation: logbook-spinner 0.75s linear infinite;
  }
  @keyframes logbook-spinner {
    to {
      transform: rotate(360deg);
    }
  }
/* ============================================================================
   07. LEAFLET TOOLTIPS & MAP CONTROLS
   ============================================================================ */
  .leaflet-tooltip {
    border:
      1px solid
      rgb(255 255 255 / 0.12) !important;
    border-radius:
      0.65rem !important;
    background:
      rgb(12 12 12 / 0.95) !important;
    color:
      white !important;
    box-shadow:
      0 10px 28px
      rgb(0 0 0 / 0.32) !important;
    font-size:
      0.68rem;
    white-space: normal !important;
    backdrop-filter:
      blur(10px);
  }
  .leaflet-tooltip-top::before {
    border-top-color: rgb(12 12 12 / 0.94) !important;
  }
  .leaflet-tooltip-bottom::before {
    border-bottom-color: rgb(12 12 12 / 0.94) !important;
  }
  .leaflet-tooltip-left::before {
    border-left-color: rgb(12 12 12 / 0.94) !important;
  }
  .leaflet-tooltip-right::before {
    border-right-color: rgb(12 12 12 / 0.94) !important;
  }
  .track-tooltip {
    min-width: 248px;
    line-height: 1.4;
    text-align: left;
  }
  .leaflet-control-zoom {
    border: 0 !important;
    box-shadow:
      0 8px 22px
      rgb(0 0 0 / 0.2)
      !important;
  }
  .leaflet-control-zoom a {
    background:
      rgb(12 12 12 / 0.88)
      !important;
    color:
      white
      !important;
    border-color:
      rgb(255 255 255 / 0.1)
      !important;
  }
  .leaflet-control-zoom a:hover {
    background:
      rgb(28 28 28 / 0.95)
      !important;
  }
  .leaflet-control-attribution {
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color:
      rgb(255 255 255 / 0.58)
      !important;
    box-shadow: none !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .leaflet-control-attribution a {
    color:
      rgb(255 255 255 / 0.7)
      !important;
  }
/* ============================================================================
   08. MOBILE / RESPONSIVE LAYOUT
   ============================================================================ */
  @media (max-width: 900px) {
    .logbook-dev-overlay {
      align-items: flex-start;
      justify-content: center;
      padding: 120px 1rem 1rem;
      border-radius: 0.8rem 0.8rem 0 0;
    }
    .logbook-dev-notice {
      width: min(430px, 100%);
      padding: 1.35rem 1.25rem 1.25rem;
    }
    .logbook-dev-notice p {
      font-size: 0.78rem;
    }
    .logbook-bleed {
      width: 100%;
      margin-left: 0;
      transform: none;
    }
    .logbook-layout {
      display: block;
      min-height: 0;
      overflow: visible;
      border: 0;
      border-radius: 0;
      background: transparent;
    }
    /* Initial boot: never expose unfinished Logbook UI */
    .logbook-layout {
      opacity: 0;
      visibility: hidden;
    }
    .logbook-bleed.is-ready .logbook-layout {
      opacity: 1;
      visibility: visible;
    }
    .map-area {
      height: auto;
      overflow: visible;
    }
    #logbook-map {
      height: 100dvh;
      min-height: 0;
      overflow: hidden;
      border-radius: 0.8rem;
    }
    .fullscreen-toggle {
      position: absolute;
      z-index: 760;
      top: 1rem;
      right: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 38px;
      height: 38px;
      padding: 0;
      border: 1px solid rgb(255 255 255 / 0.14);
      border-radius: 0.65rem;
      background: rgb(10 10 10 / 0.78);
      color: white;
      cursor: pointer;
      backdrop-filter: blur(12px);
      transition:
        background 0.2s ease,
        border-color 0.2s ease;
    }
    .logbook-bleed.mobile-details-open #logbook-map {
      height: 65dvh;
      min-height: 470px;
      border-radius: 0.8rem 0.8rem 0 0;
    }
    .logbook-bleed.fullscreen-host {
      overflow-y: auto;
      overscroll-behavior: contain;
    }
    .logbook-bleed.fullscreen-host .logbook-layout {
      display: block;
      width: 100%;
      height: auto;
      min-height: 100dvh;
      overflow: visible;
    }
    .logbook-bleed.fullscreen-host .map-area {
      height: auto;
      min-height: 0;
      overflow: visible;
    }
    .logbook-bleed.fullscreen-host .journeys-panel {
      height: 56px;
    }
    .logbook-bleed.fullscreen-host #logbook-map {
      height: 100dvh;
      min-height: 0;
      border-radius: 0;
    }
    .logbook-bleed.fullscreen-host.mobile-details-open #logbook-map {
      height: 68dvh;
      min-height: 0;
    }
    .journeys-panel {
      position: absolute;
      z-index: 620;
      right: 0;
      bottom: -2px;
      left: 0;
      height: 56px;
      min-height: 0;
      padding: 0;
      overflow: hidden;
      border-top: 1px solid rgb(255 255 255 / 0.1);
      border-left: 0;
      border-radius: 0 0 0.8rem 0.8rem;
      background: rgb(12 12 12 / 0.98);
      box-shadow: 0 -12px 35px rgb(0 0 0 / 0.22);
      backdrop-filter: blur(18px);
      transition: height 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .journeys-panel.mobile-open {
      height: min(42dvh, 420px);
    }
    .logbook-bleed.fullscreen-host .journeys-panel.mobile-open {
      height: min(42dvh, 420px);
    }
    .panel-header {
      display: none;
    }
    .journeys-toggle {
      display: flex;
      flex-direction: column;
      width: 100%;
      height: 56px;
      padding: 7px 1rem 9px;
      border: 0;
      background: transparent;
      color: white;
      cursor: pointer;
    }
    .journeys-toggle-handle {
      width: 34px;
      height: 4px;
      margin: 0 auto 6px;
      border-radius: 999px;
      background: rgb(255 255 255 / 0.22);
    }
    .journeys-toggle-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
    }
    .journeys-toggle-title {
      font-size: 0.78rem;
      font-weight: 600;
      letter-spacing: -0.01em;
    }
    .journeys-toggle-title span {
      color: rgb(255 255 255 / 0.42);
      font-size: 0.68rem;
      font-weight: 500;
    }
    .journeys-toggle-chevron {
      color: rgb(255 255 255 / 0.5);
      font-size: 1rem;
      transition: transform 0.25s ease;
    }
    .journeys-panel.mobile-open .journeys-toggle-chevron {
      transform: rotate(180deg);
    }
    .journey-list {
      height: calc(100% - 56px);
      padding: 0.55rem 1rem 1rem;
      overflow-y: auto;
      overscroll-behavior: contain;
    }
    .journey-card {
      min-height: 68px;
    }
    .drawer-backdrop {
      display: none;
    }
    .details-drawer {
      position: relative;
      z-index: 1;
      top: auto;
      right: auto;
      bottom: auto;
      display: none;
      width: 100%;
      height: auto;
      max-height: none;
      overflow: hidden;
      border-top: 1px solid rgb(255 255 255 / 0.1);
      border-left: 0;
      border-radius: 0 0 0.8rem 0.8rem;
      box-shadow: none;
      transform: none;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition:
        opacity 0.34s ease,
        visibility 0s linear 0.34s;
    }
    .details-drawer.mounted {
      display: block;
    }
    .details-drawer.open {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      transition:
        opacity 0.34s ease,
        visibility 0s linear 0s;
    }
    .drawer-body {
      display: block;
      min-height: 0;
      overflow: visible;
    }
    .drawer-section:last-child {
      display: block;
      min-height: 0;
    }
    .drawer-entries {
      min-height: 0;
      max-height: none;
      overflow: visible;
    }
    .logbook-bleed.mobile-details-open .journeys-panel {
      display: none;
    }
    .leaflet-bottom.leaflet-left {
      bottom: 56px;
    }
    .logbook-bleed.mobile-journeys-open .leaflet-bottom.leaflet-left {
      bottom: min(42dvh, 420px);
    }
    .logbook-bleed.mobile-details-open .leaflet-bottom.leaflet-left {
      bottom: 0;
    }
    .leaflet-control-attribution {
      margin: 0 0 0.3rem 0.35rem !important;
      font-size: 9px !important;
      line-height: 1.25 !important;
    }
  }
/* ============================================================================
   09. AUXILIARY UI, MOBILE HINTS & DETAIL METADATA
   ============================================================================ */
  .logbook-beta {
    font-size: 0.45em;
    font-weight: 500;
    opacity: 0.5;
    vertical-align: middle;
  }
  .logbook-project-link {
    margin-left: 0.35rem;
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
  }
  .logbook-project-link:hover {
    text-decoration: underline;
  }
  @media (max-width: 600px) {
    #logbook-map {
      height: calc(100dvh - 150px);
      min-height: 500px;
    }
    .logbook-bleed.mobile-details-open #logbook-map {
      height: 65dvh;
      min-height: 450px;
    }
    .logbook-bleed.fullscreen-host #logbook-map {
      height: 100dvh;
      min-height: 0;
    }
    .logbook-bleed.fullscreen-host.mobile-details-open #logbook-map {
      height: 68dvh;
    }
    .drawer-header { padding: 1.5rem 1.2rem 1.2rem; }
    .drawer-body { padding: 1.2rem 1.2rem calc(1.8rem + env(safe-area-inset-bottom)); }
    .drawer-stats { gap: 0.4rem; }
  }
  .logbook-test-locked {
    user-select: none;
  }
  .logbook-test-locked #logbook-map,
  .logbook-test-locked .journeys-panel,
  .logbook-test-locked .journey-details,
  .logbook-test-locked .journeys-toggle {
    pointer-events: none !important;
  }
  .logbook-test-locked #logbook-dev-overlay,
  .logbook-test-locked #logbook-dev-overlay * {
    pointer-events: auto !important;
  }
  .logbook-mobile-hint {
    display: none;
  }
  @media (max-width: 640px) {
    .logbook-mobile-hint {
      display: block;
      margin-top: 1rem;
      padding: 1rem 1.125rem;
      border: 1px solid #93c5fd;
      border-left: 4px solid #2563eb;
      border-radius: 0.75rem;
      background: #eff6ff;
      color: #1e3a8a;
      font-size: 0.9375rem;
      font-weight: 600;
      line-height: 1.5;
    }
  }
.drawer-track-meta {
  margin-top: 0.5rem;
  color: #64748b;
  font-size: 0.75rem;
  line-height: 1.4;
}
#drawer-date {
  display: block;
  white-space: pre-line;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
/* Compact dates in the journey stats card */
.drawer-stats .drawer-stat #drawer-date {
  display: block;
  white-space: pre;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0;
}
/* Track tooltip — wider desktop layout */
.track-tooltip {
  min-width: 400px;
}
.track-tooltip-row {
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 0.8rem;
}
.track-tooltip-label {
  white-space: nowrap;
}
.track-tooltip-value {
  white-space: nowrap;
}
/* Position intentionally remains two lines */
.track-tooltip-position .track-tooltip-value {
  white-space: normal;
}
/* ============================================================================
   10. JOURNEY STATUS / ACTIVITY PRESENTATION
   ============================================================================ */
/* ==========================================================
   Journey cards — two-row status/activity layout/* ==========================================================
   Journey cards — two-row status/activity layout
   ========================================================== */
.journey-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  grid-template-rows: auto auto auto;
  column-gap: 0.75rem;
  row-gap: 0.32rem;
  align-items: start;
  width: 100%;
}

.journey-status,
.journey-activity,
.journey-meta-time-top,
.journey-meta-time-bottom {
  display: block;
  min-width: 0;
  line-height: 1.15;
}

.journey-status {
  grid-column: 1 / -1;
  grid-row: 1;
  font-weight: 800;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.journey-activity {
  grid-column: 1;
  grid-row: 2;
  color: rgb(255 255 255 / 0.42);
  font-weight: 650;
  white-space: nowrap;
}

.journey-meta-time-top {
  grid-column: 2;
  grid-row: 2;
}

.journey-meta-time-bottom {
  grid-column: 2;
  grid-row: 3;
}

.journey-meta-time-top,
.journey-meta-time-bottom {
  color: rgb(255 255 255 / 0.42);
  font-weight: 650;
  white-space: nowrap;
}

/* LIVE */
.journey-status-live {
  color: #ff4d4d;
}
/* PLANNED */
.journey-status-planned {
  color: #60a5fa;
}
/* WAITING FOR TRACK */
.journey-status-waiting_for_track {
  color: #fbbf24;
}
/* COMPLETED */
.journey-status-completed {
  color: #4ade80;
}
/* CANCELLED */
.journey-status-cancelled {
  color: #94a3b8;
}
/* Journey Details — status + activity always on one line */
#drawer-activity {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
#drawer-activity .journey-status {
  display: inline;
  flex: 0 0 auto;
}
/* ============================================================================
   11. DESKTOP VIEWPORT / SHORT-SCREEN FIXES
   ============================================================================ */
/* Allow the Logbook grid row to shrink with the viewport *//* Allow the Logbook grid row to shrink with the viewport */
.logbook-layout {
  grid-template-rows: minmax(0, 1fr);
}
/* Fit Logbook to short desktop viewports */
@media (min-width: 901px) {
  .logbook-layout {
    height: 100dvh !important;
    min-height: 0 !important;
    grid-template-rows: minmax(0, 1fr);
  }
  .map-area,
  #logbook-map {
    min-height: 0 !important;
  }
}


/* ============================================================================
   12. JOURNEY STATISTICS HELP
   ============================================================================ */
.drawer-stat .stat-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.drawer-stat .stat-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 0.4);
  border-radius: 50%;
  background: transparent;
  color: rgb(255 255 255 / 0.65);
  font: inherit;
  font-size: 0.65rem;
  line-height: 1;
  cursor: pointer;
}
.drawer-stat .stat-info-button:hover,
.drawer-stat .stat-info-button:focus-visible {
  color: #fff;
  border-color: #fff;
}
.drawer-stat .stat-info-button:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 3px;
}
.stat-help-tooltip {
  position: fixed;
  z-index: 10000;
  box-sizing: border-box;
  width: min(320px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 0.65rem;
  background: #202020;
  color: #eee;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
  font-size: 0.78rem;
  line-height: 1.5;
}
.stat-help-tooltip[hidden] {
  display: none;
}

/* General explanations inside track hover previews. */
.track-tooltip-section-note {
  margin: 0 0 0.65rem;
  color: rgb(255 255 255 / 0.55);
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
}


/* ============================================================================
   13. SHARED HELP APPEARANCE AND MEASURED MAP PREVIEWS
   ============================================================================ */
/* Match the journey statistics help without changing the data-row layout. */
.leaflet-tooltip.track-map-tooltip {
  box-sizing: border-box;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgb(255 255 255 / 0.2) !important;
  border-radius: 0.65rem !important;
  background: #202020 !important;
  color: #eee !important;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35) !important;
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1.5;
  backdrop-filter: none;
  overflow: hidden;
}
/* Help panels share a plain box appearance without a directional arrow. */
.leaflet-tooltip.track-map-tooltip::before {
  display: none;
}
.track-map-tooltip .track-tooltip {
  box-sizing: border-box;
  min-width: 0;
  width: 400px;
  max-width: 100%;
  padding: 0;
}
.track-map-tooltip .track-tooltip-label,
.track-map-tooltip .track-tooltip-value {
  white-space: normal;
  overflow-wrap: anywhere;
}
.track-map-tooltip .track-tooltip-row {
  grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
}
.satellite-help-tooltip {
  pointer-events: none;
}
.journey-satellite[data-satellite-help] {
  cursor: default;
}
/* Move only the glyph; keep the circle and button position unchanged. */
.drawer-stat .stat-info-button > span {
  display: inline-block;
  transform: translateY(1px);
}


/* ============================================================
   MOBILE PAGE FLOW — FINAL OVERRIDE
   Map = full viewport, content below = normal page scroll
   ============================================================ */
@media (max-width: 900px) {

  .logbook-layout {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .map-area {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #logbook-map {
    height: 100dvh !important;
    min-height: 0 !important;
  }

  /*
   * Opening Journey Details must NOT shrink the map.
   * Details continue below the map in normal document flow.
   */
  .logbook-bleed.mobile-details-open #logbook-map {
    height: 80dvh !important;
    min-height: 0 !important;
  }

  .logbook-bleed.fullscreen-host.mobile-details-open #logbook-map {
    height: 68dvh !important;
    min-height: 0 !important;
  }

  .journey-details,
  .drawer-body,
  .drawer-entries {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* ============================================================
   MOBILE DETAILS — NORMAL DOCUMENT FLOW
   ============================================================ */
@media (max-width: 900px) {

  .logbook-bleed:not(.fullscreen-host).mobile-details-open .map-area {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .logbook-bleed:not(.fullscreen-host).mobile-details-open .details-drawer {
    position: relative !important;
    inset: auto !important;
    display: block;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .logbook-bleed:not(.fullscreen-host).mobile-details-open .drawer-body,
  .logbook-bleed:not(.fullscreen-host).mobile-details-open .drawer-entries {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
  }
}

/* ============================================================
   MOBILE PAGE SCROLL
   Desktop application shell keeps its existing behaviour.
   ============================================================ */
@media (max-width: 900px) {
  html {
    height: auto !important;
    min-height: 100%;
    overflow-y: auto !important;
  }

  body {
    height: auto !important;
    min-height: 100dvh;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
}

/* ============================================================
   MOBILE PAGE SCROLL — STOP AT DOCUMENT EDGES
   ============================================================ */
@media (max-width: 900px) {
  html,
  body {
    overscroll-behavior-y: none !important;
  }

  body {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  .logbook-bleed,
  .logbook-layout,
  .map-area,
  .details-drawer {
    margin-bottom: 0 !important;
  }
}

/* JOURNEY LOG — typed markers without outer circle */
.entry-marker-weather,
.entry-marker-event {
  border: 0;
  border-radius: 0;
  background: transparent;
}

/*
 * Original marker is 13x13 including border.
 * Typed markers keep the same 13x13 footprint,
 * so their centre remains on the existing timeline axis.
 */
.entry-marker-weather,
.entry-marker-event {
  width: 13px;
  height: 13px;
  margin-left: 0;
  margin-top: 1px;
}

.entry-marker-weather::after,
.entry-marker-event::after {
  width: 11px;
  height: 11px;
}


/* JOURNEY LOG — Note as icon, same timeline geometry */
.entry-marker-note {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  margin-top: 1px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.entry-marker-note::after {
  display: block;
  width: 11px;
  height: 11px;
  background: rgb(255 255 255 / 0.78);
  content: "";
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25Zm17.71-10.04a1.003 1.003 0 0 0 0-1.42l-2.5-2.5a1.003 1.003 0 0 0-1.42 0l-1.96 1.96 3.75 3.75 2.13-1.79Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25Zm17.71-10.04a1.003 1.003 0 0 0 0-1.42l-2.5-2.5a1.003 1.003 0 0 0-1.42 0l-1.96 1.96 3.75 3.75 2.13-1.79Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

/* Let the Journey list use the full remaining panel height */
@media (min-width: 901px) {
  .journey-list {
    flex: 1 1 auto;
    min-height: 0;
  }
}

/* Journey cards — final vertical layout */
.journey-card {
  flex-shrink: 0;
}

.journey-card-main {
  min-height: 0;
  grid-column: 1;
}

.journey-card-content {
  min-height: 0;
  grid-area: content;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.42rem;
}

.journey-meta-grid {
  grid-template-rows: auto auto auto;
  align-self: stretch;
}

.journey-status {
  grid-column: 1 / -1;
  grid-row: 1;
}

.journey-activity {
  grid-column: 1;
  grid-row: 2;
}

/* Right-align journey dates */
.journey-meta-time-top {
  grid-column: 2;
  grid-row: 2;
  text-align: right;
  justify-self: end;
}

.journey-meta-time-bottom {
  grid-column: 2;
  grid-row: 3;
  text-align: right;
  justify-self: end;
}

.journey-visibility-button {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  grid-column: 2;
  grid-row: 1;
}

/* Keep the border inside the declared container height. */
.logbook-layout {
  box-sizing: border-box;
}

/* ================================================================
   MOBILE INITIAL LOADER
   Keep the Logbook background white while the initial loader and
   application are being rendered on mobile Safari.
   ================================================================ */

@media (max-width: 900px) {
  html,
  body {
    background: #fff;
  }
}

/* ================================================================
   MOBILE — FIXED MAP HEIGHT IN EMBEDDED MODE
   ================================================================ */
@media (max-width: 900px) {
  .logbook-bleed:not(.fullscreen-host) #logbook-map,
  .logbook-bleed:not(.fullscreen-host).mobile-details-open #logbook-map {
    height: var(--logbook-initial-map-height, 80dvh) !important;
    min-height: 0 !important;
  }
}

/* ================================================================
   MOBILE — EXPAND JOURNEYS BELOW THE MAP
   Keep a small overlap while allowing the iframe to grow.
   ================================================================ */
@media (max-width: 900px) {
  .logbook-bleed:not(.fullscreen-host) .journeys-panel {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    height: 56px;
    margin-top: -56px;
    overflow: hidden;
  }
  .logbook-bleed:not(.fullscreen-host) .journeys-panel.mobile-open {
    height: auto;
    margin-top: -100px;
    overflow: hidden;
  }
  .logbook-bleed:not(.fullscreen-host) .journey-list {
    height: auto;
    max-height: none;
    overflow-y: visible;
    box-sizing: border-box;
  }
  .logbook-bleed:not(.fullscreen-host).mobile-journeys-open
  .leaflet-bottom.leaflet-left {
    bottom: 100px;
  }
}

/* Mobile — loading overlay covers the entire Logbook */
@media (max-width: 900px) {
  .logbook-bleed:not(.fullscreen-host) .map-loading-overlay.is-visible {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 10050;
    background: rgb(5 7 10 / 0.5);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
  }
}
