:root {
        --bg: #0f1f36;
        --panel: #162b47;
        --ink: #e8f0fb;
        --muted: #b4c6de;
        --line: #2a4468;
        --accent: #4ea2f2;
        --accent-soft: #1f385a;
      }

      * {
        box-sizing: border-box;
      }

      body {
        margin: 0;
        font-family: "Avenir Next", "Segoe UI", sans-serif;
        color: var(--ink);
        background:
          radial-gradient(circle at 20% 0%, #223f64 0%, transparent 45%),
          radial-gradient(circle at 80% 10%, #1a3252 0%, transparent 40%),
          var(--bg);
      }

      .wrap {
        max-width: 980px;
        margin: 0 auto;
        padding: 18px 14px 136px;
      }

      header {
        background: linear-gradient(180deg, #1d3658 0%, #172f4f 100%);
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 16px;
      }

      h1 {
        margin: 0 0 8px;
        font-size: 1.4rem;
      }

      .meta {
        color: var(--muted);
        font-size: 0.95rem;
      }

      .meta-row {
        display: flex;
        align-items: center;
        gap: 10px;
        justify-content: space-between;
        flex-wrap: wrap;
      }

      .refresh-btn {
        border: 1px solid #95bbe5;
        background: linear-gradient(180deg, #4ea2f2 0%, var(--accent) 100%);
        border-radius: 999px;
        padding: 7px 14px;
        font-size: 0.85rem;
        font-weight: 700;
        color: #fff;
        cursor: pointer;
      }

      .top-copyright {
        display: none;
        padding: 0.55rem 1rem;
        font-size: 0.8rem;
        font-weight: 700;
        color: #e5f0ff;
        text-align: center;
        background: rgba(7, 17, 31, 0.9);
        border-bottom: 1px solid #35547c;
      }

      main {
        margin-top: 14px;
        display: grid;
        gap: 14px;
      }

      .app-layout {
        display: block;
      }

      .desktop-sidebar {
        display: none;
      }

      .desktop-only {
        display: none !important;
      }

      .mobile-only {
        display: block;
      }

      section {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 12px;
      }

      .grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 12px;
      }

      figure {
        margin: 0;
        border: 1px solid var(--line);
        border-radius: 12px;
        overflow: hidden;
        background: #1a3252;
        content-visibility: auto;
        contain-intrinsic-size: 260px;
      }

      .card-meta {
        border-bottom: 1px solid var(--line);
        background: #213c61;
        padding: 8px 10px;
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
      }

      .chip {
        border: 1px solid #3c5f8c;
        background: #1a3150;
        color: #dbe9fa;
        border-radius: 999px;
        padding: 3px 8px;
        font-size: 0.75rem;
        font-weight: 700;
      }

      .card-media {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
        min-height: 180px;
        max-height: 360px;
        background:
          linear-gradient(180deg, rgba(6, 16, 30, 0.88) 0%, rgba(11, 28, 48, 0.92) 100%);
      }

      .card-media img,
      .card-media video {
        width: 100%;
        height: 100%;
        max-height: 340px;
        display: block;
        object-fit: contain;
        object-position: center;
        background: transparent;
        border-radius: 8px;
      }

      figcaption {
        padding: 8px 10px;
        font-size: 0.9rem;
        color: var(--muted);
        text-align: left;
        overflow-wrap: anywhere;
        word-break: break-word;
        white-space: normal;
      }

      .anim-actions {
        padding: 8px 10px 10px;
        border-top: 1px solid var(--line);
        display: flex;
        gap: 8px;
        align-items: center;
        flex-wrap: wrap;
      }

      .btn,
      .speed-select {
        border: 1px solid #bdd0e3;
        background: #fff;
        border-radius: 8px;
        padding: 6px 10px;
        font-size: 0.85rem;
        color: var(--ink);
      }

      .speed-select,
      .viewer-speed {
        background: #17304f;
        border-color: #4a6d96;
        color: #e8f2ff;
      }

      .speed-select option,
      .viewer-speed option {
        background: #122640;
        color: #e8f2ff;
      }

      .btn {
        cursor: pointer;
      }

      .map-clickable {
        cursor: zoom-in;
      }

      pre {
        margin: 0;
        white-space: pre-wrap;
        line-height: 1.5;
        font-family: "SF Mono", Menlo, Consolas, monospace;
      }

      .empty {
        color: var(--muted);
        border: 1px dashed var(--line);
        border-radius: 10px;
        padding: 10px;
      }

      .mobile-tabs {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: calc(40px + env(safe-area-inset-bottom));
        z-index: 1000;
        width: min(980px, calc(100vw - 20px));
        display: flex;
        gap: 6px;
        padding: 8px;
        border-top: 1px solid #395a84;
        border: 1px solid #35557d;
        border-radius: 14px;
        background: rgba(11, 24, 41, 0.95);
        backdrop-filter: blur(8px);
        box-shadow: 0 10px 24px rgba(3, 9, 18, 0.45);
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
      }

      .mobile-tabs::-webkit-scrollbar {
        display: none;
      }

      .mobile-copyright {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        display: block;
        text-align: center;
        font-size: 0.68rem;
        font-weight: 600;
        color: #d6e7fb;
        letter-spacing: 0.01em;
        padding: 5px 10px calc(5px + env(safe-area-inset-bottom));
        border-top: 1px solid #35557d;
        background: rgba(7, 17, 31, 0.95);
      }

      .mobile-tab-btn {
        border: 1px solid #40648f;
        border-radius: 999px;
        min-height: 50px;
        padding: 11px 18px;
        font-size: 0.96rem;
        font-weight: 700;
        line-height: 1;
        white-space: nowrap;
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        background: #1a3456;
        color: #d2e5fb;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
        transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
      }

      .mobile-tab-btn.active {
        border-color: #8dc7ff;
        background: linear-gradient(180deg, #4ea2f2 0%, var(--accent) 100%);
        color: #ffffff;
        transform: translateY(-1px) scale(1.02);
        text-shadow: 0 1px 0 rgba(8, 18, 31, 0.45);
        box-shadow:
          0 8px 18px rgba(46, 125, 215, 0.45),
          inset 0 1px 0 rgba(255, 255, 255, 0.95),
          0 0 0 2px rgba(141, 199, 255, 0.28);
      }

      .tab-section.mobile-hidden {
        display: none;
      }

      .meteograms-shell {
        display: grid;
        gap: 12px;
      }

      .meteograms-controls {
        display: grid;
        gap: 10px;
      }

      .control-group {
        display: flex;
        gap: 8px;
        align-items: center;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -ms-overflow-style: none;
      }

      .control-group::-webkit-scrollbar {
        display: none;
      }

      .control-row {
        display: grid;
        gap: 8px;
      }

      .group-label {
        font-size: 0.82rem;
        font-weight: 700;
        color: var(--muted);
        min-width: 66px;
      }

      .control-btn {
        border: 1px solid #40648f;
        border-radius: 999px;
        min-height: 46px;
        padding: 10px 18px;
        font-size: 0.96rem;
        font-weight: 700;
        background: #1a3456;
        color: #d2e5fb;
        cursor: pointer;
        white-space: nowrap;
        flex: 0 0 auto;
        scroll-snap-align: start;
      }

      .control-btn.active {
        border-color: #8dc7ff;
        background: linear-gradient(180deg, #4ea2f2 0%, var(--accent) 100%);
        color: #ffffff;
        box-shadow:
          0 8px 18px rgba(46, 125, 215, 0.35),
          inset 0 1px 0 rgba(255, 255, 255, 0.95),
          0 0 0 2px rgba(141, 199, 255, 0.22);
      }

      .meteogram-stage {
        border: 1px solid var(--line);
        border-radius: 16px;
        overflow: hidden;
        background: #132844;
      }

      .meteogram-stage .card-media {
        min-height: 280px;
        max-height: 70dvh;
        padding: 12px;
      }

      .meteogram-stage .card-media img {
        max-height: calc(70dvh - 24px);
      }

      .meteogram-switcher {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 10px 12px 12px;
        border-top: 1px solid var(--line);
        background: rgba(12, 28, 48, 0.9);
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -ms-overflow-style: none;
      }

      .meteogram-switcher::-webkit-scrollbar {
        display: none;
      }

      .meteogram-title {
        margin: 0;
        font-size: 1.1rem;
      }

      .viewer {
        position: fixed;
        inset: 0;
        background: rgba(7, 18, 31, 0.82);
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
          max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
      }

      .viewer.open {
        display: flex;
      }

      .viewer:fullscreen {
        padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
          max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
      }

      .viewer:fullscreen .viewer-panel {
        width: 100%;
        height: calc(100dvh - 16px);
        max-height: calc(100dvh - 16px);
      }

      .viewer.map-mode .viewer-panel {
        width: 100%;
        grid-template-rows: 1fr;
        gap: 0;
      }

      .viewer.map-mode .viewer-top {
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 2;
        background: rgba(8, 21, 36, 0.78);
        border: 1px solid #365273;
        border-radius: 10px;
        padding: 6px 8px;
      }

      .viewer.map-mode .viewer-title {
        display: none;
      }

      .viewer.map-mode .viewer-content img {
        max-width: 100vw;
        max-height: calc(100dvh - 16px);
      }

      .viewer-panel {
        width: min(1200px, 100%);
        height: calc(100dvh - 32px);
        max-height: calc(100dvh - 32px);
        display: grid;
        grid-template-rows: auto 1fr;
        gap: 10px;
      }

      .viewer-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        color: #e6effa;
        background: rgba(8, 21, 36, 0.8);
        border: 1px solid #365273;
        border-radius: 10px;
        padding: 8px 10px;
      }

      .viewer-title {
        font-size: 0.95rem;
        flex: 1;
        min-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .viewer-controls {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
      }

      .viewer-btn,
      .viewer-speed {
        border: 1px solid #6f879f;
        color: #f3f8ff;
        background: rgba(21, 39, 60, 0.85);
        border-radius: 8px;
        padding: 6px 10px;
        min-height: 40px;
        font-weight: 700;
      }

      .viewer-btn {
        cursor: pointer;
      }

      #viewerClose {
        background: #b3261e;
        border-color: #f19a96;
      }

      .viewer-content {
        width: 100%;
        height: 100%;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
      }

      .viewer.open .viewer-content {
        padding-bottom: 22px;
      }

      .viewer-content img,
      .viewer-content video {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        border-radius: 10px;
        background: #09111d;
      }

      .viewer-bottom {
        display: none;
        gap: 10px;
        align-items: center;
        color: #e6effa;
        background: rgba(8, 21, 36, 0.75);
        border: 1px solid #365273;
        border-radius: 10px;
        padding: 8px 10px;
      }

      .viewer-bottom.open {
        display: flex;
      }

      .viewer-nav {
        display: flex;
        gap: 8px;
      }

      .viewer-nav .viewer-btn {
        min-width: 56px;
        min-height: 48px;
        font-size: 1.02rem;
        padding: 10px 14px;
      }

      .viewer-progress-wrap {
        flex: 1;
        display: grid;
        grid-template-columns: 1fr;
        align-items: center;
        gap: 8px;
      }

      .viewer-progress {
        width: 100%;
        height: 12px;
        appearance: none;
        -webkit-appearance: none;
        background: transparent;
      }

      .viewer-progress::-webkit-slider-runnable-track {
        height: 8px;
        border-radius: 999px;
        background: #d6e1ef;
      }

      .viewer-progress::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 22px;
        height: 22px;
        border-radius: 50%;
        margin-top: -7px;
        background: #1e6cb8;
        border: 2px solid #ffffff;
      }

      .viewer-progress::-moz-range-track {
        height: 8px;
        border-radius: 999px;
        background: #d6e1ef;
      }

      .viewer-progress::-moz-range-thumb {
        width: 22px;
        height: 22px;
        border-radius: 50%;
        background: #1e6cb8;
        border: 2px solid #ffffff;
      }

      .viewer-note {
        display: none;
      }

      @supports not (height: 100dvh) {
        .viewer-panel {
          height: calc(100vh - 32px);
          max-height: calc(100vh - 32px);
        }

        .viewer:fullscreen .viewer-panel {
          height: calc(100vh - 16px);
          max-height: calc(100vh - 16px);
        }

        .viewer.map-mode .viewer-content img {
          max-height: calc(100vh - 16px);
        }
      }

      @media (max-width: 980px) {
        .wrap {
          padding: 12px 10px 136px;
        }

        body.meteograms-focus .wrap {
          padding-top: 10px;
        }

        body.meteograms-focus .wrap > header {
          display: none;
        }

        section {
          padding: 10px;
        }

        figure {
          border-radius: 10px;
        }

        .card-media {
          min-height: 0;
          max-height: none;
          padding: 6px;
          align-items: flex-start;
        }

        .card-media img,
        .card-media video {
          width: 100%;
          height: auto;
          max-height: none;
          object-fit: contain;
          object-position: top center;
          border-radius: 10px;
        }

        .card-meta {
          padding: 7px 8px;
          gap: 5px;
          flex-wrap: nowrap;
          overflow-x: auto;
          overflow-y: hidden;
          scrollbar-width: none;
          -ms-overflow-style: none;
        }

        .card-meta::-webkit-scrollbar {
          display: none;
        }

        .chip {
          flex: 0 0 auto;
          font-size: 0.7rem;
          padding: 3px 7px;
        }

        .meteogram-stage .card-media {
          min-height: 0;
          max-height: none;
          padding: 6px;
          align-items: flex-start;
        }

        .meteogram-stage .card-media img {
          width: 100%;
          height: auto;
          max-height: none;
          border-radius: 10px;
        }

        .meteogram-switcher {
          display: grid;
          grid-template-columns: repeat(3, minmax(0, 1fr));
          gap: 8px;
          overflow: visible;
          padding: 10px 10px 12px;
        }

        .meteogram-switcher .control-btn {
          width: 100%;
          min-width: 0;
          padding: 10px 8px;
          font-size: 0.88rem;
        }

        figcaption {
          font-size: 0.68rem;
          line-height: 1.22;
          padding: 5px 8px 6px 6px;
        }

        .anim-actions {
          padding: 5px 6px 6px;
          gap: 5px;
        }

        .btn,
        .speed-select {
          font-size: 0.72rem;
          padding: 4px 6px;
        }

        .mobile-tabs {
          left: 10px;
          right: 10px;
          width: auto;
          transform: none;
        }

        .mobile-tab-btn {
          min-height: 46px;
          padding: 10px 14px;
          font-size: 0.9rem;
        }

        .viewer-nav .viewer-btn {
          min-width: 64px;
          min-height: 52px;
          font-size: 1.1rem;
        }

        .viewer-progress {
          height: 14px;
        }

        /* Mobile fullscreen ergonomics: close button centered below media. */
        .viewer.open #viewerClose {
          position: fixed;
          left: 50%;
          transform: translateX(-50%);
          bottom: calc(122px + env(safe-area-inset-bottom));
          min-width: 128px;
          min-height: 54px;
          padding: 12px 18px;
          border-radius: 999px;
          font-size: 1rem;
          z-index: 10020;
        }
      }

      @media (min-width: 981px) {
        .wrap {
          max-width: 1440px;
          padding: 18px 18px 32px;
        }

        header {
          padding: 12px 14px;
        }

        h1 {
          margin: 0 0 4px;
          font-size: 1.18rem;
        }

        .meta {
          font-size: 0.84rem;
        }

        .meta-row {
          gap: 8px;
        }

        .refresh-btn {
          padding: 6px 12px;
          font-size: 0.8rem;
        }

        .app-layout {
          margin-top: 16px;
          display: grid;
          grid-template-columns: 240px minmax(0, 1fr);
          gap: 18px;
          align-items: start;
        }

        main {
          margin-top: 0;
        }

        .desktop-sidebar {
          display: block;
          position: sticky;
          top: 18px;
        }

        .desktop-sidebar-panel {
          background: linear-gradient(180deg, #1d3658 0%, #172f4f 100%);
          border: 1px solid var(--line);
          border-radius: 16px;
          padding: 14px;
          box-shadow: 0 14px 36px rgba(4, 12, 23, 0.22);
        }

        .desktop-sidebar-title {
          margin: 0 0 12px;
          font-size: 0.82rem;
          letter-spacing: 0.08em;
          text-transform: uppercase;
          color: #a7c1df;
        }

        .desktop-tabs {
          display: grid;
          gap: 10px;
        }

        .desktop-tab-btn {
          border: 1px solid #40648f;
          border-radius: 14px;
          min-height: 52px;
          padding: 12px 14px;
          font-size: 1rem;
          font-weight: 700;
          text-align: left;
          background: #1a3456;
          color: #d2e5fb;
          cursor: pointer;
          transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
        }

        .desktop-tab-btn.active {
          border-color: #8dc7ff;
          background: linear-gradient(180deg, #4ea2f2 0%, var(--accent) 100%);
          color: #ffffff;
          transform: translateY(-1px);
          box-shadow:
            0 8px 18px rgba(46, 125, 215, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.95),
            0 0 0 2px rgba(141, 199, 255, 0.22);
        }

        .desktop-sidebar-foot {
          margin-top: 14px;
          padding-top: 12px;
          border-top: 1px solid #35557d;
          font-size: 0.78rem;
          color: #c7dbf2;
          line-height: 1.4;
        }

        .mobile-tabs,
        .mobile-copyright {
          display: none !important;
        }

        .desktop-only {
          display: block !important;
        }

        .mobile-only {
          display: none !important;
        }

        .grid {
          grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        }

        .meteograms-shell {
          grid-template-columns: minmax(0, 1fr);
          grid-template-areas:
            "controls"
            "title"
            "stage";
          align-items: start;
          gap: 10px;
        }

        .meteograms-controls {
          grid-area: controls;
          gap: 8px;
          padding: 0;
          border: 0;
          background: transparent;
          position: static;
        }

        .meteograms-controls .control-group {
          display: flex;
          gap: 10px;
          overflow-x: auto;
          overflow-y: hidden;
          padding-bottom: 0;
        }

        .meteograms-controls .control-btn {
          width: auto;
          min-height: 44px;
          text-align: center;
          padding: 9px 14px;
          font-size: 0.92rem;
        }

        .meteogram-title {
          grid-area: title;
          display: none;
        }

        .meteogram-stage {
          grid-area: stage;
        }

        .meteogram-stage .card-media {
          min-height: 440px;
          max-height: 62dvh;
          padding: 10px;
        }

        .meteogram-stage .card-media img {
          max-height: calc(62dvh - 20px);
        }

        .meteogram-switcher {
          display: flex;
          gap: 10px;
          overflow-x: auto;
          overflow-y: hidden;
          padding: 10px 12px 12px;
        }

        .meteogram-switcher .control-btn {
          min-height: 44px;
          padding: 9px 14px;
          font-size: 0.9rem;
        }

        #meteogramsSection > h2 {
          display: none;
        }

        header,
        section {
          box-shadow: 0 14px 36px rgba(4, 12, 23, 0.22);
        }
      }
