:root{
      --brand: #007bd4;
      --brand-dark: #003d6b;

      --bg: #f3f5f7;
      --panel-bg: rgba(255,255,255,0.96);
      --panel-radius: 12px;
      --panel-shadow: 0 2px 12px rgba(0,0,0,0.22);

      --sidebar-w: 388px;

      /* Instruments: smaller */
      --compass-size: clamp(92px, 14.5vw, 110px);
      --needle-h: calc(var(--compass-size) * 0.42);
      --gauge-h: clamp(62px, 9.1vw, 78px);

      --header-h: 78px;
    }

    html, body {
      height: 100%;
      margin: 0;
      padding: 0;
      font-family: Arial, sans-serif;
      background: var(--bg);
      overflow: hidden;
    }

    .app {
      display: grid;
      grid-template-columns: var(--sidebar-w) 1fr;
      height: 100dvh;
      height: 100vh;
      width: 100%;
      position: relative;
    }
    .app.sidebar-collapsed{
      /* keep a thin handle so the user can expand the panel */
      grid-template-columns: 56px 1fr;
    }

    .app.sidebar-collapsed .sidebar{
      min-width: 0;
      width: 56px;
      border-right: 1px solid rgba(0,0,0,0.08);
    }
    .app.sidebar-collapsed .sidebar-content{
      display: none;
    }
    .app.sidebar-collapsed .brand-text{
      display: none;
    }
    .app.sidebar-collapsed .brand-row{
      grid-template-columns: 1fr;
      justify-items: center;
      gap: 0;
      padding: 10px 6px;
    }
    .app.sidebar-collapsed .panel-toggle{
      width: 46px;
      height: 46px;
      border-radius: 12px;
      margin-top: 8px;
    }
    .app.sidebar-collapsed .brand-logo{
      width: 44px;
      height: 34px;
      border-radius: 8px;
    }

    .sidebar {
      background: #fff;
      border-right: 1px solid rgba(0,0,0,0.08);
      display: flex;
      flex-direction: column;
      min-width: 280px;
      position: relative;
      z-index: 1200;
      overflow: hidden;
    }

    .brand-row{
      display: grid;
      grid-template-columns: 82px 1fr 54px;
      align-items: center;
      gap: 7px;
      padding: 12px 14px;
      background: #fff;
      border-bottom: 1px solid rgba(0,0,0,0.08);
      height: var(--header-h);
      box-sizing: border-box;
    }

    .brand-link{
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-decoration: none;
    }

    .brand-logo{
      width: 74px;
      height: 56px;
      object-fit: contain;
      border-radius: 10px;
    }

    .brand-text{
      display:flex;
      flex-direction: column;
      justify-content: center;
      min-width: 0;
      align-self: center;
    }
    .brand-title{
      font-weight: 900;
      font-size: 17px;
      color: #111;
      line-height: 1.1;
	  text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .brand-subtitle{
      font-weight: 900;
      font-size: 12px;
      color: var(--brand);
      margin-top: 4px;
      line-height: 1.05;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      width: 100%;
    }

    .panel-toggle{
      appearance:none;
      border: 3px solid rgba(0,0,0,0.9);
      background: #fff;
      color: #111;
      width: 50px;
      height: 50px;
      border-radius: 12px;
      display:flex;
      align-items:center;
      justify-content:center;
      cursor:pointer;
      transition: background 0.15s ease, transform 0.15s ease;
    }
    .panel-toggle:hover{ background: rgba(0,0,0,0.04); }
    .panel-toggle:active{ transform: scale(0.98); }
    .toggle-icon{ font-size: 16px; line-height: 1; transform: translateY(-1px); }

    .sr-only{
      position:absolute;
      width:1px;height:1px;
      padding:0;margin:-1px;
      overflow:hidden;clip:rect(0,0,0,0);
      white-space:nowrap;border:0;
    }

    .sidebar-content{
      padding: 6px 9px 6px;
      overflow-y: auto;
      overflow-x: hidden;
      flex: 1 1 auto;
      min-height: 0;
      background: #fafbfc;
      display: flex;
      flex-direction: column;
      gap: 7px;
      align-content: start;
      scrollbar-width: thin;
      overscroll-behavior: contain;
    }

    .sidebar-content > *{
      flex: 0 0 auto;
      min-height: -webkit-min-content;
      min-height: min-content;
    }

    .card{
      background: var(--panel-bg);
      border-radius: var(--panel-radius);
      box-shadow: var(--panel-shadow);
      padding: 8px 11px;
      margin-bottom: 0;
    }

    .data-row {
      display: flex;
      justify-content: space-between;
      gap: 9px;
      padding: 3px 0;
      border-bottom: 1px solid rgba(0,0,0,0.06);
      font-size: 12px;
    }
    .data-row:last-child{ border-bottom: 0; padding-bottom: 0; }
    .data-label { font-weight: 900; color: #4b5563; white-space: nowrap; }
    .data-row span:last-child { text-align: right; word-break: break-word; font-weight: 900; color:#111; }

    .pill{
      display:inline-flex;
      align-items:center;
      gap: 9px;
      padding: 7px 11px;
      border-radius: 999px;
      background: rgba(0,123,212,0.10);
      color: var(--brand-dark);
      font-weight: 900;
      font-size: 12px;
      white-space: nowrap;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .speed-indicator {
      display: inline-block;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      vertical-align: middle;
    }
    .speed-stopped { background-color: #9e9e9e; }
    .speed-slow { background-color: #4CAF50; }
    .speed-medium { background-color: #FF9800; }
    .speed-fast { background-color: #f44336; }

    .course-arrow {
      font-size: 16px;
      display: inline-block;
      margin-left: 6px;
      vertical-align: middle;
    }

    .widgets-row{
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 9px;
      align-items: stretch;
    }


    /* Instruments (SVG style like dark marine panels) */
    .instruments-row{
      grid-template-columns: 1fr 1fr;
      gap: 9px;
    }
    .instrument-dark{
      background: #4b4b4b;
      border-radius: 18px;
      padding: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
      min-height: 118px;
      overflow: hidden;
    }
    .instrSvg{
      width: 100%;
      height: 114px;
      display: block;
    }
    .instrBg{ fill: #3f3f3f; }

    /* Compass */
    .compassTickMinor{ stroke: rgba(255,255,255,0.35); stroke-width: 2; }
    .compassTickMid{ stroke: rgba(255,255,255,0.55); stroke-width: 2.4; }
    .compassTickMajor{ stroke: rgba(255,255,255,0.80); stroke-width: 3; }
    .compassHdgText{ fill: #fff; font-size: 31px; font-weight: 900; text-anchor: middle; }
    .compassHdgSub{ fill: rgba(255,255,255,0.70); font-size: 14px; font-weight: 800; text-anchor: middle; letter-spacing: 1px; }
    .compassCardinal{ fill:#fff; font-size: 18px; font-weight: 900; text-anchor: middle; dominant-baseline: middle; opacity: 0.95; }
    .boatHull{ fill: #fff; opacity: 0.95; }
    .boatStripe{ fill: #0ea5e9; opacity: 0.95; }
    .boatDot{ fill: #ef4444; opacity: 0.95; }
    .compassDot{ fill: #ef4444; stroke: rgba(0,0,0,0.55); stroke-width: 2; }

    /* Speed */
    .speedArcBg{ stroke: rgba(255,255,255,0.25); stroke-width: 12; fill: none; stroke-linecap: round; }
    .speedArcVal{ stroke: #38bdf8; stroke-width: 12; fill: none; stroke-linecap: round; }
    .speedTickMinor{ stroke: rgba(255,255,255,0.35); stroke-width: 2; }
    .speedTickMajor{ stroke: rgba(255,255,255,0.70); stroke-width: 3; }
    .speedTickLabel{ fill: rgba(255,255,255,0.85); font-size: 12px; font-weight: 800; text-anchor: middle; dominant-baseline: middle; }
    .speedLabel{ fill: rgba(255,255,255,0.85); font-size: 16px; font-weight: 900; text-anchor: middle; letter-spacing: 1px; }
    .speedValue{ fill: #fff; font-size: 30px; font-weight: 900; text-anchor: middle; }
    .speedUnit{ fill: rgba(255,255,255,0.85); font-size: 15px; font-weight: 900; }
    .targetLabel{ fill: rgba(255,255,255,0.90); font-size: 14px; font-weight: 800; text-anchor: middle; }
    .speedTargetLine{ stroke: #a7f3d0; stroke-width: 4; stroke-linecap: round; opacity: 0.95; }

    /* Collapsible cards (sidebar) */
    .card-head{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      margin-bottom:5px;
      cursor: pointer;
      user-select: none;
    }
    .card-title{
      font-weight: 900;
      color:#111;
      font-size: 12px;
    }
    .card-head-right{
      display:flex;
      align-items:center;
      gap:8px;
    }
    .card-chev{
      width: 18px;
      height: 18px;
      display:grid;
      place-items:center;
      color: rgba(0,0,0,0.55);
      font-weight: 900;
      transition: transform 0.15s ease;
    }
    .card.collapsed .card-chev{
      transform: rotate(-90deg);
    }
    .card-body{ }
    .card.collapsed .card-body{
      display: none;
    }
    .compass-widget {
      background: #fff;
      border-radius: 14px;
      border: 1px solid rgba(0,0,0,0.06);
      padding: 7px;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100px;
    }

    .compass-rose {
      width: var(--compass-size);
      height: var(--compass-size);
      position: relative;
      border-radius: 50%;
      background: radial-gradient(circle at 30% 30%, rgba(0,0,0,0.03), rgba(0,0,0,0.00));
      border: 1px solid rgba(0,0,0,0.06);
    }

    .compass-needle {
      position: absolute;
      width: 4px;
      height: var(--needle-h);
      background: linear-gradient(to bottom, #f44336 0%, #f44336 50%, #666 50%, #666 100%);
      top: 10px;
      left: calc(50% - 2px);
      transform-origin: 2px calc(var(--needle-h));
      transition: transform 0.35s ease;
      border-radius: 2px;
    }

    .compass-labels {
      position: absolute;
      width: 100%;
      height: 100%;
      font-size: 12px;
      font-weight: 900;
      color: #374151;
      user-select: none;
    }
    .compass-n { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); color: #f44336; }
    .compass-e { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
    .compass-s { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); }
    .compass-w { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); }

    .speed-widget {
      background: #fff;
      border-radius: 14px;
      border: 1px solid rgba(0,0,0,0.06);
      padding: 7px;
      display:flex;
      flex-direction: column;
      justify-content: flex-start;
      min-height: 100px;
    }
    .speed-label{ text-align:center; font-size: 13px; font-weight: 900; color:#4b5563; margin-bottom: 4px;}
    #speedGauge{ width:100%; height: var(--gauge-h); display:block; }
    .speed-value{ text-align:center; font-size: 20px; font-weight: 900; color: var(--brand); margin-top: 6px; }

    .record-lines{
      font-weight: 900;
      color: #111;
      font-size: 12px;
      line-height: 1.24;
    }
    .record-lines .sub{
      font-weight: 700;
      color: #374151;
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      display: block;
    }
    .record-lines .time{
      font-weight: 900;
      color: #111;
    }


    .news-card{
      flex: 0 0 auto;
      padding-top: 7px;
      padding-bottom: 7px;
    }
    .news-head{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      margin-bottom: 3px;
    }
    .news-subhead{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      margin-bottom: 4px;
    }
    .news-nav{
      display:flex;
      align-items:center;
      gap:6px;
      flex:0 0 auto;
    }
    .news-nav-btn{
      width: 26px;
      height: 26px;
      border-radius: 999px;
      border: 2px solid rgba(17,17,17,.18);
      background:#fff;
      color:#111;
      font-weight: 900;
      font-size: 18px;
      line-height: 1;
      display:grid;
      place-items:center;
      padding:0;
      cursor:pointer;
      transition: transform .08s ease, background .12s ease, border-color .12s ease, color .12s ease;
    }
    .news-nav-btn:hover{ background:#f8fafc; border-color:rgba(17,17,17,.28); }
    .news-nav-btn:active{ transform: scale(.97); }
    .news-nav-btn:disabled{
      opacity:.38;
      cursor:default;
      transform:none;
    }
    .news-meta,
    .news-counter{
      color:#6b7280;
      font-weight:800;
      font-size: 11px;
      white-space: nowrap;
    }
    .news-time{
      font-weight: 900;
      color:#111;
      font-size: 12px;
      line-height: 1.15;
      margin-bottom: 4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .news-text{
      color:#374151;
      font-weight: 700;
      font-size: 12px;
      line-height: 1.24;
      white-space: pre-line;
      max-height: 72px;
      overflow-y: auto;
      overflow-x: hidden;
      padding-right: 6px;
      scrollbar-width: thin;
      scrollbar-gutter: stable;
    }
    .news-text::-webkit-scrollbar{
      width: 8px;
    }
    .news-text::-webkit-scrollbar-thumb{
      background: rgba(107,114,128,.55);
      border-radius: 999px;
    }
    .news-text::-webkit-scrollbar-track{
      background: rgba(229,231,235,.7);
      border-radius: 999px;
    }

    /* Collapsed: compact floating header block */
    .sidebar.collapsed{
      width: 0;
      min-width: 0;
      background: transparent;
      border-right: 0;
      overflow: visible;
    }
    .sidebar.collapsed .sidebar-content{ display:none; }
    .sidebar.collapsed .brand-row{
      position: fixed;
      left: calc(12px + env(safe-area-inset-left));
      top: calc(12px + env(safe-area-inset-top));
      right: auto;
      width: max-content;
      max-width: calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
      z-index: 1400;

      background: rgba(255,255,255,0.96);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(0,0,0,0.12);
      box-shadow: 0 10px 22px rgba(0,0,0,0.20);

      padding: 10px 12px;
      border-radius: 14px;
      pointer-events: auto;
      height: auto;
    }

    .map-area{
      position: relative;
      height: 100%;
      width: 100%;
      background: #ddd;
      z-index: 1000;
    }
    #map{
      height: 100%;
      width: 100%;
    }

    .boat-badge-link{ cursor: pointer; }
    .boat-badge{
      position: absolute;
      top: calc(12px + env(safe-area-inset-top));
      right: calc(12px + env(safe-area-inset-right));
      width: 84px;
      height: 84px;
      border-radius: 50%;
      object-fit: cover;
      box-shadow: 0 6px 20px rgba(0,0,0,0.35);
      border: 3px solid rgba(255,255,255,0.95);
      z-index: 1100;
      background: #fff;
    }

    .boat-track-marker{
      background: transparent;
      border: 0;
    }
    .boat-track-marker__rot{
      position: relative;
      left: 50%;
      top: 50%;
      width: 14px;
      height: 38px;
      transform: translate(-50%, -50%) rotate(0deg);
      transform-origin: 50% 50%;
      will-change: transform;
      filter: drop-shadow(0 1px 4px rgba(0,0,0,0.24));
    }
    .boat-track-marker__rot img{
      width: 100%;
      height: 100%;
      object-fit: contain;
      display: block;
      pointer-events: none;
    }

    .compassBoatImg{
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.22));
    }

    .speedCaption{
      fill:#6b7280;
      font: 700 14px/1 Arial, sans-serif;
      text-anchor: middle;
    }

    .wpLabelMarker{
      background: transparent;
      border: 0;
    }
    .wpLabelWrap{
      transform: translate(-50%, -170%);
      white-space: nowrap;
      pointer-events: auto;
    }
    .wpLabelLink,
    .wpLabelText{
      display: inline-block;
      padding: 5px 9px;
      border-radius: 6px;
      background: rgba(255,255,255,0.96);
      border: 1px solid rgba(0,0,0,0.14);
      box-shadow: 0 4px 12px rgba(0,0,0,0.16);
      color: #3f3f46;
      font: 700 13px/1.1 Arial, sans-serif;
      text-decoration: none;
    }
    .wpLabelLink:hover{
      color: var(--brand-dark);
      text-decoration: underline;
    }

    /* Timeline (slider + speed control) */
    .timeline{
      position: absolute;
      left: 12px;
      right: 12px;
      bottom: calc(12px + env(safe-area-inset-bottom));
      z-index: 1100;
      background: rgba(255,255,255,0.92);
      border-radius: 18px;
      box-shadow: 0 6px 20px rgba(0,0,0,0.22);
      padding: 8px 12px 6px 12px;
      display:flex;
      align-items:center;
      gap: 9px;
      overflow: hidden;
    }
    .timeline .ts{
      font-weight: 900;
      color: #111;
      font-size: 12px;
      white-space: nowrap;
      min-width: 180px;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .timeline .btn{
      width: 36px;
      height: 36px;
      border-radius: 50%;
      border:0;
      background: rgba(0,0,0,0.06);
      cursor:pointer;
      font-weight: 900;
      display:flex;
      align-items:center;
      justify-content:center;
    }
    .timeline .btn:active{ transform: scale(0.98); }

    .slider-wrap{
      flex: 1 1 auto;
      display:flex;
      flex-direction: column;
      gap: 4px;
      align-content: start;
      min-width: 0;
    }
    .slider-wrap input[type="range"]{
      width: 100%;
      margin: 0;
    }

    .timeline .status{
      font-weight: 900;
      font-size: 12px;
      color: #374151;
      min-width: 54px;
      text-align: right;
    }

    /* Domodis credit (timeline right side) */
    .timeline .poweredBy{
      display:flex;
      align-items:center;
      flex: 0 0 auto;
      max-width: 210px;
      margin-left: auto;
    }
    .timeline .poweredBy a{
      display:flex;
      flex-direction: column;
      align-items:center;
      justify-content: center;
      gap: 1px;
      text-decoration:none;
      color: #6b7280;
    }
    .timeline .poweredText{
      font-size: 10px;
      font-weight: 900;
      line-height: 1;
      white-space: nowrap;
    }
    .timeline .poweredLogo{
      height: 38px;
      width: auto;
      max-width: 190px;
      object-fit: contain;
      display:block;
      transform: scale(1.16);
      transform-origin: center center;
    }

    .panel-footer{
      margin-top: auto;
      padding: 5px 9px 6px;
      font-size: 10px;
      color: #6b7280;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 7px;
      flex-wrap: wrap;
      user-select: none;
      background: #fafbfc;
      border-top: 1px solid rgba(0,0,0,0.06);
      flex: 0 0 auto;
    }
    .panel-footer span{ white-space: nowrap; }
    .panel-footer{font-size: 10.5px; line-height:1.2;}
    .panel-footer span:first-child{ overflow: hidden; text-overflow: ellipsis; }

    .distance-card{
      margin-top: 0;
      flex: 0 0 auto;
      display:flex;
      flex-direction:column;
    }
    .distance-card .data-row{ padding: 4px 0; }
    .panel-footer a{ color: inherit; text-decoration: none; }
    .panel-footer a:hover{ text-decoration: underline; }

.speed-select{
      font-weight: 900;
      font-size: 12px;
      border: 1px solid rgba(0,0,0,0.15);
      border-radius: 10px;
      padding: 7px 9px;
      background: rgba(255,255,255,0.95);
      color: #111;
      cursor: pointer;
    }

    

    .sidebar-content{
      -webkit-overflow-scrolling: touch;
    }


    @media (min-width: 1025px) and (min-height: 840px) and (max-height: 980px){
      :root{
        --header-h: 78px;
        --compass-size: clamp(92px, 14.2vw, 108px);
        --gauge-h: clamp(64px, 9vw, 78px);
      }
      .brand-row{ padding: 12px 14px; }
      .sidebar-content{ padding-top: 6px; padding-bottom: 4px; gap: 6px; }
      .card{ padding: 7px 10px; }
      .instrument-dark{ min-height: 122px; }
      .instrSvg{ height: 118px; }
      .record-lines{ font-size: 12.25px; line-height: 1.16; }
      .record-lines .sub{ font-size: 11.75px; }
      .data-row{ padding: 2px 0; }
      .distance-card .data-row{ padding: 2px 0; }
      .panel-footer{ padding-top: 6px; padding-bottom: 7px; }
    }

    @media (min-width: 1025px) and (max-height: 900px){
      :root{
        --sidebar-w: 380px;
        --header-h: 74px;
        --compass-size: clamp(88px, 13.8vw, 104px);
        --gauge-h: clamp(58px, 8.6vw, 72px);
      }
      .brand-row{ padding: 10px 12px; }
      .brand-logo{ width: 70px; height: 52px; }
      .brand-title{ font-size: 16px; }
      .brand-subtitle{ font-size: 11px; margin-top: 3px; }
      .sidebar-content{ padding: 4px 8px 3px; gap: 5px; }
      .card{ padding: 6px 9px; }
      .card-head{ margin-bottom: 4px; }
      .card-title{ font-size: 11.5px; }
      .record-lines{ font-size: 11.5px; line-height: 1.1; }
      .record-lines .sub{ font-size: 11px; }
      .pill{ font-size: 11px; padding: 5px 9px; }
      .data-row{ font-size: 11px; padding: 1px 0; }
      .distance-card .data-row{ padding: 1px 0; }
      .widgets-row, .instruments-row{ gap: 8px; }
      .instrument-dark{ min-height: 108px; }
      .instrSvg{ height: 106px; }
      .compass-widget, .speed-widget{ min-height: 96px; padding: 6px; }
      .speed-value{ font-size: 17px; margin-top: 4px; }
      .speed-label{ font-size: 11.5px; margin-bottom: 2px; }
      .panel-footer{ font-size: 9.5px; padding: 4px 8px 5px; }
    }

    @media (max-height: 760px){
      :root{
        --sidebar-w: 350px;
        --header-h: 72px;
        --compass-size: clamp(84px, 14vw, 100px);
        --gauge-h: clamp(58px, 9vw, 72px);
      }
      .brand-title{ font-size: 16px; }
      .brand-subtitle{ font-size: 13px; }
      .record-lines{ font-size: 12px; line-height: 1.18; }
      .record-lines .sub{ font-size: 12px; }
      .pill{ font-size: 12px; padding: 7px 11px; }
      .instrument-dark{ min-height: 116px; }
      .instrSvg{ height: 114px; }
      .speed-value{ font-size: 17px; }
      /* Weather card removed in v2.00 */
    }
    
@media (max-width: 760px){
      /* Mobile: allow scrolling inside the panel when expanded */
      .sidebar:not(.collapsed) .sidebar-content{
        overflow: auto;
        -webkit-overflow-scrolling: touch;
      }

      .app{
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
      }
      .app.sidebar-collapsed{
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
      }

      .sidebar{
        grid-column: 1 / -1;
        grid-row: 2 / 3;
        border-right: 0;
        border-top: 1px solid rgba(0,0,0,0.08);
        max-height: 46dvh;
        min-width: 0;
      }
      .map-area{
        grid-row: 1 / 2;
      }
      .timeline{ bottom: calc(12px + env(safe-area-inset-bottom) + 46dvh); }

      .widgets-row{ grid-template-columns: 1fr; }

      .sidebar.collapsed{
        max-height: 0;
        border-top: 0;
      }
      .timeline{
        bottom: calc(12px + env(safe-area-inset-bottom));
      }
      .brand-title{ font-size: 16px; }
      .brand-subtitle{ font-size: 14px; text-align:center; }
      .panel-toggle{ width: 48px; height: 48px; border-width: 3px; }
      .timeline .ts{ min-width: 120px; }
      .speed-select{ display:none; } /* keep compact on phones; default 1x */

      /* Keep Domodis credit compact on phones */
      .timeline .poweredText{ display:none; }
      .timeline .poweredLogo{ height: 30px; max-width: 138px; transform: scale(1.10); }
    }


    .headerControls{
      display:flex;
      align-items:center;
      gap:10px;
    }
    .toggle{
      display:inline-flex;
      align-items:center;
      gap:8px;
      user-select:none;
      cursor:pointer;
      font-weight:600;
      color:#333;
    }
    .toggle input{ display:none; }
    .toggleTrack{
      width:42px; height:22px;
      border-radius:999px;
      background:#cfd8e3;
      position:relative;
      box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
      transition: background .15s ease;
      flex:0 0 auto;
    }
    .toggleTrack::after{
      content:"";
      width:18px; height:18px;
      border-radius:50%;
      background:#fff;
      position:absolute;
      top:2px; left:2px;
      box-shadow: 0 2px 8px rgba(0,0,0,0.18);
      transition: transform .15s ease;
    }
    .toggle input:checked + .toggleTrack{
      background: var(--brand);
    }
    .toggle input:checked + .toggleTrack::after{
      transform: translateX(20px);
    }
    .toggleLabel{
      font-size:12px;
    }

    .footer-credit{
      width:100%;
      text-align: justify;
      text-justify: inter-word;
      font-size: 10px;
      opacity: 0.75;
      padding: 10px 14px;
      box-sizing: border-box;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }


    /* Floating controls on the map (right side) */
    .mapControls{
      position: absolute;
      right: 14px;
      bottom: 150px; /* above timeline */
      top: auto;
      z-index: 1200;
      display: flex;
      flex-direction: column;
      gap: 9px;
      pointer-events: auto;
    }
    .mcBtn{
      width: 46px;
      height: 46px;
      border-radius: 14px;
      border: 2px solid rgba(0,0,0,0.85);
      background: rgba(255,255,255,0.92);
      box-shadow: 0 10px 28px rgba(0,0,0,0.18);
      display: grid;
      place-items: center;
      cursor: pointer;
      padding: 0;
      position: relative;
      touch-action: manipulation;
    }
    .mcBtn:disabled{
      cursor: not-allowed;
      opacity: 0.65;
      transform: none !important;
    }
    @media (hover:hover) and (pointer:fine){
      .mcBtn::after{
        content: attr(data-tip);
        position: absolute;
        right: 56px;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(17,17,17,0.92);
        color: #fff;
        padding: 6px 8px;
        border-radius: 10px;
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap;
        box-shadow: 0 10px 22px rgba(0,0,0,0.22);
        opacity: 0;
        pointer-events: none;
        transition: opacity .12s ease;
      }
      .mcBtn::before{
        content: "";
        position: absolute;
        right: 49px;
        top: 50%;
        transform: translateY(-50%);
        border: 6px solid transparent;
        border-left-color: rgba(17,17,17,0.92);
        opacity: 0;
        pointer-events: none;
        transition: opacity .12s ease;
      }
      .mcBtn:hover::after,
      .mcBtn:hover::before{
        opacity: 1;
      }
    }
    .mcBtn svg{ width: 24px; height: 24px; color: #111; }
    .mcBtn.off{ border-color: rgba(0,0,0,0.35); background: rgba(255,255,255,0.65); }
    .mcBtn:active{ transform: translateY(1px); }

    .media-modal{
      position: fixed;
      inset: 0;
      z-index: 1600;
      display: none;
    }
    .media-modal.open{
      display: block;
    }
    .media-backdrop{
      position: absolute;
      inset: 0;
      background: rgba(15,23,42,0.72);
      backdrop-filter: blur(2px);
    }
    .media-dialog{
      position: absolute;
      inset: 24px;
      background: rgba(255,255,255,0.98);
      border-radius: 20px;
      box-shadow: 0 18px 48px rgba(0,0,0,0.28);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .media-close{
      position: absolute;
      top: 12px;
      right: 12px;
      z-index: 2;
      width: 42px;
      height: 42px;
      border-radius: 50%;
      border: 0;
      background: rgba(17,17,17,0.72);
      color: #fff;
      font-size: 28px;
      line-height: 1;
      cursor: pointer;
    }
    .media-stage{
      flex: 1 1 auto;
      min-height: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 22px;
      background: linear-gradient(180deg, rgba(248,250,252,0.98), rgba(241,245,249,0.98));
    }
    .media-image{
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      border-radius: 14px;
      box-shadow: 0 10px 28px rgba(0,0,0,0.18);
      background: #fff;
    }
    .media-empty{
      color: #475569;
      font-size: 18px;
      font-weight: 800;
      text-align: center;
      padding: 18px;
    }
    .media-toolbar{
      display: grid;
      grid-template-columns: auto auto 1fr auto auto;
      gap: 10px;
      align-items: center;
      padding: 12px 16px 16px;
      border-top: 1px solid rgba(0,0,0,0.08);
      background: rgba(255,255,255,0.98);
    }
    .media-nav{
      min-width: 52px;
      height: 42px;
      border-radius: 12px;
      border: 1px solid rgba(0,0,0,0.14);
      background: rgba(255,255,255,0.98);
      font-size: 22px;
      font-weight: 900;
      color: #111;
      cursor: pointer;
    }
    .media-nav:disabled{
      opacity: 0.38;
      cursor: not-allowed;
    }
    .media-meta{
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 0 6px;
    }
    .media-caption{
      font-size: 13px;
      font-weight: 800;
      color: #111827;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .media-counter{
      font-size: 12px;
      font-weight: 800;
      color: #64748b;
    }
    @media (max-width: 600px){
      .mapControls{ top: 180px; right: 10px; gap: 10px; }
      .mcBtn{ width: 42px; height: 42px; }
      .mcBtn svg{ width: 22px; height: 22px; }
      .media-dialog{ inset: 12px; border-radius: 16px; }
      .media-stage{ padding: 14px; }
      .media-toolbar{ grid-template-columns: 1fr 1fr; }
      .media-meta{ grid-column: 1 / -1; order: -1; }
      .media-nav{ min-width: 0; width: 100%; }
      .media-caption{ white-space: normal; }
    }

  
    /* -------------------------
       v1.37 – Wind time alignment + UI cleanup
       ------------------------- */
    .instrument-dark{
      background: var(--panel-bg);
      border: 1px solid rgba(0,0,0,0.10);
      box-shadow: var(--panel-shadow);
    }
    .instrBg{
      fill: #ffffff;
      stroke: rgba(0,0,0,0.10);
      stroke-width: 2;
    }

    /* Compass */
    .compassRing{ stroke: rgba(0,0,0,0.18); }
    .compassTickMinor{ stroke: rgba(0,0,0,0.18); }
    .compassTickMajor{ stroke: rgba(0,0,0,0.28); stroke-width: 2; }
    .compassCardinal{ fill: rgba(0,0,0,0.86); font-size: 16px; }
    .compassHdgText{ fill: rgba(0,0,0,0.92); font-size: 34px; }
    .compassHdgSub{ fill: rgba(0,0,0,0.45); font-size: 13px; }

    .boatHull{ fill:#ffffff; stroke: rgba(0,0,0,0.78); stroke-width: 2; }
    .boatStripe{ fill: var(--brand); }
    .boatKeel{ fill: rgba(0,0,0,0.78); }
    .boatDot{ fill: #ef4444; }

    .compassWindArrow{
      fill: #22c55e;
      stroke: rgba(0,0,0,0.25);
      stroke-width: 1;
    }

    /* Speed */
    .speedArcBg{ stroke: rgba(0,0,0,0.10); }
    .speedArcVal{ stroke: var(--brand); }
    .speedTickMinor{ stroke: rgba(0,0,0,0.18); }
    .speedTickMajor{ stroke: rgba(0,0,0,0.26); }
    .speedTickLabel{ fill: rgba(0,0,0,0.55); font-size: 13px; }
    .speedLabel{ fill: rgba(0,0,0,0.48); font-size: 13px; letter-spacing: 0.06em; }
    .speedValue{ fill: var(--brand); font-size: 28px; font-weight: 800; }
    .speedUnit{ fill: rgba(0,0,0,0.48); font-size: 14px; }
    .targetLabel{ fill: rgba(0,0,0,0.48); font-size: 12px; }

    .speedTargetLine{ stroke: #22c55e; stroke-width: 4; }

/* v1.50 additions */
#paceVsRecord.pace-ahead{ color:#0b7a36; font-weight:900; }
#paceVsRecord.pace-behind{ color:#b91c1c; font-weight:900; }


/* Random xana_top mascot overlay */
.xanaMascot {
  position: fixed;
  left: 0;
  top: 0;
  display: none;
  opacity: 0;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 200ms ease;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.25));
}

    .section-title{font-weight:900;color:#111;font-size:16px; letter-spacing:-0.01em;}
    .section-mode{color:#6b7280;font-weight:800;font-size:15px;}
    .latest-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px;}
    .record-lines div{margin-bottom:1px;}
    .record-lines .sub{line-height:1.18;}
    .panel-footer span:first-child{display:flex;flex-wrap:wrap;gap:4px;}


    @media (min-width: 1025px) and (max-height: 900px){
      .news-time{ font-size: 11.5px; margin-bottom: 3px; }
      .news-text{ font-size: 11px; max-height: 64px; }
      .news-meta{ font-size: 10px; }
    }

    @media (max-width: 760px){
      .news-time{ white-space: normal; }
      .news-text{ max-height: 80px; }
    }


    @media (min-width: 1025px){
      /* Desktop: keep scrolling isolated inside OnBoard News, not the whole left column */
      .sidebar-content{
        overflow-y: hidden;
      }
      .sidebar-content{ padding: 5px 8px 4px; gap: 5px; }
      .card{ padding: 6px 9px; }
      .brand-row{ padding: 10px 12px; }
      .record-lines{ line-height: 1.1; }
      .pill{ padding: 5px 9px; }
      .data-row,
      .distance-card .data-row{ padding: 1px 0; }
      .card-head{ margin-bottom: 4px; }
      .instrument-dark{ min-height: 108px; }
      .instrSvg{ height: 106px; }
      .compass-widget, .speed-widget{ min-height: 96px; padding: 6px; }
      .news-text{ max-height: 56px; }
      .panel-footer{ font-size: 9.5px; padding: 4px 8px 5px; }
    }
