/* One UI-inspired surfaces; weather values and safety colors keep their own semantics. */
:root {
    --ui-bg: #f4f5f7;
    --ui-surface: #ffffff;
    --ui-soft: #edf0f5;
    --ui-text: #192333;
    --ui-muted: #5e6b7c;
    --ui-primary: #0072de;
    --ui-primary-text: #0062c2; /* 5.27:1 on the light-blue selected surface. */
    --ui-primary-soft: #e8f2ff;
    --ui-border: #e3e7ed;
    --ui-shadow: 0 8px 32px rgb(17 39 67 / 10%), 0 1px 3px rgb(17 39 67 / 4%);
    --ui-sidebar: 304px;
    --ui-font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
        'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}

.map-page,
.privacy-page {
    color: var(--ui-text);
    background: var(--ui-bg);
    font-family: var(--ui-font);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.025em;
}

.map-page button,
.privacy-back-link {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.map-page :is(button, input, select, a, summary, [tabindex]):focus-visible,
.privacy-page :is(a, button):focus-visible {
    outline: 3px solid var(--ui-primary);
    outline-offset: 3px;
}

/* Visibility is state-owned, even when a component has its own display mode. */
.map-page [hidden],
.map-page .hidden {
    display: none !important;
}

#map-header {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
    z-index: 1000;
    width: var(--ui-sidebar);
    border: 1px solid var(--ui-border);
    border-radius: 20px;
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow);
}

.map-header-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 4px 6px;
    padding: 6px 8px 8px;
}

.map-viewing-area {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.map-brand-icon {
    display: block;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(17, 39, 67, 0.12);
}

.map-viewing-area h1 {
    margin: 0;
    color: var(--ui-text);
    font-size: 20px;
    font-weight: 750;
    line-height: 1.2;
    letter-spacing: -0.055em;
}

#map-controls-toggle {
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    color: var(--ui-primary-text);
    background: var(--ui-soft);
}

#map-controls-toggle[aria-expanded="true"] {
    background: var(--ui-primary-soft);
}

.map-search-field {
    position: relative;
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    min-height: 44px;
    padding-left: 10px;
    border: 1px solid transparent;
    border-radius: 13px;
    background: var(--ui-soft);
    transition: border-color 160ms ease, background 160ms ease;
}

.map-search-field:focus-within {
    border-color: var(--ui-primary);
    background: var(--ui-surface);
}

#search-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--ui-text);
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    user-select: text;
}

#search-input::placeholder {
    color: var(--ui-muted);
    font-weight: 400;
}

#search-btn {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: var(--ui-primary-text);
    background: transparent;
    transition: background 160ms ease;
}

#search-btn:hover { background: var(--ui-primary-soft); }

#search-autocomplete-list {
    position: absolute;
    top: calc(100% + 6px);
    left: -1px;
    right: -1px;
    z-index: 2000;
    max-height: min(360px, 45dvh);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--ui-border);
    border-radius: 16px;
    color: var(--ui-text);
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow);
    font-size: 14px;
}

#search-autocomplete-list li {
    min-height: 48px;
    border: 0;
    border-radius: 12px;
}

#search-autocomplete-list li:hover { background: var(--ui-primary-soft); }

#map-controls-content {
    display: grid;
    gap: 6px;
    max-height: calc(100dvh - 140px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 0 8px 8px;
}

.map-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
}

/* IDs survive the existing runtime className updates for toggle state. */
.map-filters > button {
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 44px;
    padding: 6px 2px;
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    color: var(--ui-muted);
    background: var(--ui-surface);
    box-shadow: none;
    font-size: 11px;
    font-weight: 600;
    opacity: 1;
    white-space: nowrap;
}

.map-filters > button > svg { display: none; }

.map-filters > button > span:last-child {
    padding: 0;
    color: inherit;
    background: transparent;
    font-family: inherit;
    font-size: 10px;
    opacity: 0.85;
}

.map-filters > button.text-white {
    border-color: var(--ui-primary);
    color: var(--ui-primary-text);
    background: var(--ui-primary-soft);
}

.map-filters > button:hover { border-color: var(--ui-primary); }

#toggle-warning-chip-btn {
    grid-column: 1 / -1;
    color: #895116;
    background: #fff5e4;
    border-color: #f1d19c;
}

#toggle-warning-chip-btn.text-white,
#toggle-warning-chip-btn.bg-cyan-950 {
    color: #ffffff !important;
    background: #083344 !important;
    border-color: #0e7490 !important;
}

#layer-menu-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.base-map-options,
.weather-layer-options { display: contents; }

#layer-menu-panel .layer-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 52px;
    padding: 5px 1px;
    border: 0;
    border-radius: 12px;
    color: var(--ui-muted);
    background: var(--ui-soft);
    box-shadow: none;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

#layer-menu-panel .layer-btn > svg {
    width: 18px;
    height: 18px;
    color: inherit;
}

#layer-menu-panel .layer-btn.text-white {
    color: var(--ui-primary-text);
    background: var(--ui-primary-soft);
    font-weight: 700;
}

#layer-menu-panel .layer-btn:hover { background: var(--ui-primary-soft); }

.map-controls-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.map-controls-actions > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1;
    min-height: 44px;
    padding: 6px;
    border-radius: 12px;
    color: var(--ui-primary-text);
    background: var(--ui-soft);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

#map-layer-launcher { display: none; }

#zoom-controls-dock {
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    bottom: auto;
}

#zoom-controls-dock > div {
    padding: 4px;
    border: 0;
    border-radius: 20px;
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow);
}

#zoom-controls-dock button {
    display: grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    border-radius: 16px;
    color: var(--ui-text);
}

#warning-legend-widget {
    top: max(16px, env(safe-area-inset-top));
    right: calc(max(16px, env(safe-area-inset-right)) + 64px);
    max-width: min(240px, calc(100vw - var(--ui-sidebar) - 112px));
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
    padding: 8px 12px;
    border: 0;
    border-radius: 18px;
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow);
}

#warning-legend-close {
    min-width: 44px;
    min-height: 44px;
}

/* Always-full playback bar, centered on the viewport rather than the map sidebar. */
.map-page { --timeline-clearance: 206px; }

#timeline-player-dock {
    left: 50%;
    right: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    width: min(1080px, calc(100vw - 2 * max(16px, env(safe-area-inset-left), env(safe-area-inset-right))));
    max-width: none;
    transform: translateX(-50%);
}

.timeline-player-surface {
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--ui-border);
    border-radius: 18px;
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow);
}

.timeline-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 44px;
}

#timeline-selection {
    display: grid;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

#timeline-selection-label {
    color: var(--ui-muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 14px;
}

#timeline-selected-time {
    color: var(--ui-text);
    font-size: 15px;
    font-weight: 750;
    line-height: 20px;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}

#timeline-play-btn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--ui-border);
    border-radius: 16px;
    color: var(--ui-primary-text);
    background: var(--ui-surface);
    box-shadow: none;
    cursor: pointer;
}

#timeline-play-btn:hover:not(:disabled) { background: var(--ui-primary-soft); }

#timeline-details {
    width: 100%;
    min-width: 0;
}

#timeline-track-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
    padding: 0;
    cursor: pointer;
    touch-action: none;
}

.timeline-progress-track {
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--ui-soft);
}

#timeline-progress-fill {
    height: 100%;
    background: var(--ui-primary);
}

#timeline-days-container {
    display: flex;
    width: 100%;
    min-height: 44px;
    margin-top: 2px;
}

#timeline-days-container .day-block {
    container-type: inline-size;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 0;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-right: 1px solid var(--ui-border);
    border-radius: 6px;
    color: var(--ui-muted);
    background: transparent;
    font: inherit;
    cursor: pointer;
}

#timeline-days-container .day-block:last-child { border-right: 0; }
#timeline-days-container .day-block:hover { background: var(--ui-soft); }
#timeline-days-container .day-block[aria-pressed="true"] {
    color: var(--ui-primary-text);
    background: var(--ui-primary-soft);
}

.timeline-day-label {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 12px;
    line-height: 18px;
}

.timeline-day-weekday { font-size: 10px; }
.timeline-day-number { font-weight: 750; }

@container (max-width: 38px) {
    .timeline-day-weekday { display: none; }
}

@container (max-width: 20px) {
    .timeline-day-label { visibility: hidden; }
}

.timeline-details-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-left: auto;
    flex-shrink: 0;
}

#timeline-model-badge {
    display: block;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ui-muted);
    background: transparent;
    font-size: 10px;
    font-weight: 550;
    line-height: 16px;
}

#timeline-jump-today {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    color: var(--ui-primary-text);
    background: var(--ui-primary-soft);
    box-shadow: none;
    cursor: pointer;
}

#timeline-play-btn:disabled,
#timeline-jump-today:disabled {
    color: var(--ui-muted);
    background: var(--ui-soft);
    cursor: not-allowed;
}

#timeline-jump-today:disabled .timeline-live-dot { display: none; }

#timeline-status {
    margin: 0;
    min-width: 0;
    color: var(--ui-muted);
    font-size: 11px;
    font-weight: 650;
    line-height: 18px;
    text-align: center;
}

#timeline-color-strip {
    min-width: 0;
    padding-top: 8px;
    border-top: 1px solid var(--ui-border);
}

.timeline-legend-content {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.timeline-legend-title {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-shrink: 0;
    color: var(--ui-text);
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
}

.timeline-legend-unit {
    color: var(--ui-muted);
    font-size: 10px;
    font-weight: 500;
}

.timeline-legend-scale {
    flex: 1;
    min-width: 0;
}

.timeline-legend-gradient {
    height: 6px;
    margin-top: 4px;
    border-radius: 999px;
}

.timeline-legend-ticks {
    display: flex;
    justify-content: space-between;
    gap: 2px;
    margin-top: 3px;
    color: var(--ui-muted);
    font-size: 10px;
    line-height: 14px;
    font-variant-numeric: tabular-nums;
}

.timeline-legend-ticks > span {
    min-width: 0;
    white-space: nowrap;
}

/* Current SST has one reference time in the toolbar, not a synthetic date track. */
#timeline-player-dock[data-mode="static"] #timeline-details {
    display: none;
}

/* Reserve the entire visible bar for chat and any standalone layer legends. */
.map-page:has(#timeline-player-dock:not(.hidden)) #seatalk-hud {
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--timeline-clearance));
}

.map-page:has(#timeline-player-dock:not(.hidden)) #seatalk-card {
    max-height: min(320px, max(44px, calc(100dvh - var(--timeline-clearance) - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom))));
    overflow-y: auto;
}

.map-page:has(#timeline-player-dock:not(.hidden)) #warning-legend-widget {
    max-height: max(44px, calc(100dvh - var(--timeline-clearance) - 44px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
}

#sst-legend-badge,
#wind-legend-badge,
#waves-legend-badge,
#precip-legend-badge {
    right: max(16px, env(safe-area-inset-right));
    bottom: max(24px, env(safe-area-inset-bottom));
}

.map-page:has(#timeline-player-dock:not(.hidden)) :is(#sst-legend-badge, #wind-legend-badge, #waves-legend-badge, #precip-legend-badge) {
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--timeline-clearance));
}

#panel {
    top: 16px;
    right: 16px;
    width: 460px;
    max-width: calc(100% - 32px);
    height: calc(100% - 32px);
    height: calc(100dvh - 32px);
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 80%);
    border-radius: 32px;
    background: var(--ui-bg);
    box-shadow: 0 12px 48px rgb(17 39 67 / 18%);
}

#panel-swipe-handle {
    flex-shrink: 0;
    background: var(--ui-bg);
}

#panel .panel-heading {
    flex-shrink: 0;
    gap: 12px;
    padding: 20px 20px 14px;
    border: 0;
    background: var(--ui-bg);
}

#panel .panel-heading h2 {
    margin: 0;
    min-width: 0;
    font-size: 20px;
    font-weight: 750;
    line-height: 1.35;
    word-break: keep-all;
    overflow-wrap: break-word;
    letter-spacing: -0.03em;
}

#panel-type-badge {
    line-height: 1.4;
    white-space: nowrap;
}

#panel-coords {
    margin-top: 4px;
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 400;
}

#panel-observed-time {
    color: var(--ui-muted);
}

#panel :is(button, select) {
    min-height: 44px;
    border-radius: 16px;
}

#panel-close,
#cal-prev,
#cal-next,
#tide-day-prev,
#tide-day-next {
    min-width: 44px;
}

#panel-share-btn {
    padding: 10px 12px;
    color: var(--ui-primary-text);
    background: var(--ui-primary-soft);
    box-shadow: none;
}

#panel .panel-content {
    min-height: 0;
    padding: 0 16px max(28px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #c3cbd6 transparent;
}

#data-section > section {
    margin-top: 14px;
    padding: 20px;
    border: 0;
    border-radius: 26px;
    background: var(--ui-surface);
}

#data-section > section:first-child {
    margin-top: 0;
    background: var(--ui-primary-soft);
}

#data-section h3 {
    color: var(--ui-text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: -0.025em;
    text-transform: none;
}

#data-section > section > .rounded-xl {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.primary-metrics {
    padding: 8px 0 14px;
}

.primary-metrics .text-2xl {
    font-family: var(--ui-font);
    font-size: 32px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.045em;
}

.primary-metrics .text-slate-400 {
    color: #55677f;
}

.secondary-metrics > div {
    min-height: 44px;
    padding: 10px;
    border: 0;
    border-radius: 14px;
    box-shadow: none;
}

#fishing-current-score {
    font-family: var(--ui-font);
    font-size: 48px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

#panel :is(#realtime-breakdown-toggle, #forecast-breakdown-toggle, #cal-close, #tide-day-close) {
    padding: 12px 14px;
    border: 0;
    background: var(--ui-soft);
}

#tide-calendar-btn {
    padding: 8px 12px;
    border: 0;
    color: var(--ui-primary-text);
    background: var(--ui-primary-soft);
    box-shadow: none;
}

#panel :is(#tide-calendar-overlay, #tide-day-overlay) {
    padding: 24px 18px max(24px, env(safe-area-inset-bottom));
    background: var(--ui-bg);
}

#cal-title,
#tide-day-title {
    font-size: 22px;
}

#tide-station-select {
    min-height: 52px;
    background: var(--ui-surface);
    font-size: 15px;
}

#cal-grid > [data-tide-date] {
    min-height: 68px;
    border-radius: 14px;
}

#cal-close,
#tide-day-close {
    flex-shrink: 0;
    font-size: 14px;
}

#target-fish-grid > div,
#weekly-forecast > div {
    border-radius: 18px;
}

#error-box {
    padding: 16px;
    border-radius: 20px;
    line-height: 1.7;
}

#global-tooltip {
    border-radius: 22px;
    font-size: 13px;
    line-height: 1.65;
}

#seatalk-hud {
    left: max(24px, env(safe-area-inset-left));
    bottom: max(24px, env(safe-area-inset-bottom));
    width: var(--ui-sidebar);
    max-width: var(--ui-sidebar);
    transform: none;
}

#seatalk-card,
#seatalk-min-pill {
    color: var(--ui-text);
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: 26px;
    box-shadow: var(--ui-shadow);
    backdrop-filter: none;
}

#seatalk-card {
    max-height: min(320px, 40dvh);
    padding: 14px;
    gap: 10px;
}

#seatalk-card > div:first-child {
    color: var(--ui-text);
    border-color: var(--ui-border);
}

#seatalk-card > div:first-child .text-white {
    color: var(--ui-text);
    font-size: 14px;
    text-shadow: none;
    filter: none;
}

#seatalk-count-badge,
#seatalk-min-badge,
#seatalk-spot-badge {
    color: var(--ui-primary-text);
    background: var(--ui-primary-soft);
    border: 0;
}

#seatalk-toggle-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 12px;
    border-radius: 16px;
    color: var(--ui-muted);
    background: var(--ui-soft);
}

#seatalk-stream {
    min-height: 0;
    flex-shrink: 1;
}

#seatalk-form {
    flex-shrink: 0;
    border-color: var(--ui-border);
}

#seatalk-reroll-nick {
    min-height: 36px;
    color: var(--ui-muted);
    background: var(--ui-soft);
    border: 0;
    border-radius: 12px;
}

#seatalk-form .seatalk-input-glass {
    min-height: 52px;
    padding: 4px 4px 4px 12px;
    border: 1px solid var(--ui-border);
    border-radius: 18px;
    background: var(--ui-bg);
}

#seatalk-form .seatalk-input-glass:focus-within {
    border-color: var(--ui-primary);
}

#seatalk-input {
    color: var(--ui-text);
    font-size: 14px;
    user-select: text;
}

#seatalk-input::placeholder {
    color: var(--ui-muted);
}

#seatalk-send-btn {
    min-width: 48px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 14px;
    background: var(--ui-primary);
    box-shadow: none;
    font-size: 13px;
}

#seatalk-min-pill {
    min-height: 48px;
    margin: 0;
    padding: 12px 18px;
    border-radius: 20px;
}

#seatalk-min-pill:hover {
    background: var(--ui-primary-soft);
}

#seatalk-min-pill .drop-shadow-xs {
    filter: none;
}

.seatalk-min-icon { display: none; }

.seatalk-msg-item {
    padding: 8px;
    border-color: var(--ui-border);
    border-radius: 12px;
    background: var(--ui-bg);
}

.seatalk-msg-item > span:first-child {
    color: var(--ui-primary-text);
    border: 0;
    background: var(--ui-primary-soft);
}

.seatalk-msg-item > span:nth-child(2),
.seatalk-msg-item > span:nth-child(3) {
    color: var(--ui-text);
}

.seatalk-msg-item > span:last-child {
    color: var(--ui-muted);
}

#smart-app-banner > div {
    border-radius: 26px;
}

#smart-app-install-btn,
#smart-app-close-btn {
    min-width: 44px;
    min-height: 44px;
    border-radius: 16px;
}

#welcome-modal {
    background: rgb(18 29 47 / 38%);
}

#welcome-modal-card {
    max-width: 440px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    border: 0;
    border-radius: 32px;
}

#welcome-modal-card > div {
    flex-shrink: 0;
}

#welcome-modal-card > div:first-child {
    padding: 12px 20px 4px;
    border: 0;
}

#welcome-title {
    font-size: 18px;
}

#welcome-app-link-banner {
    min-height: 52px;
    border-radius: 18px;
    background: var(--ui-primary);
    color: #fff;
}

#welcome-slider-track {
    align-items: flex-start;
}

#welcome-modal .welcome-slide {
    padding: 16px;
    height: auto;
}

#welcome-modal .welcome-slide > p {
    word-break: keep-all;
    overflow-wrap: anywhere;
}

#welcome-modal .welcome-slide > div {
    margin-bottom: 8px;
}

#welcome-modal-card > div:last-child {
    padding: 10px 20px 8px;
    gap: 4px;
}

#welcome-modal-card label {
    min-height: 44px;
    font-size: 12px;
}

#welcome-close-x-btn,
#welcome-prev-btn,
#welcome-next-btn,
#welcome-skip-btn {
    min-width: 44px;
    min-height: 44px;
    border-radius: 18px;
}

#welcome-next-btn {
    background: var(--ui-primary);
}

#welcome-modal .welcome-dot {
    min-width: 28px;
    min-height: 28px;
    border: 10px solid transparent;
    border-radius: 20px;
    background-clip: content-box;
}


#toast-msg {
    max-width: calc(100% - 32px);
    min-height: 48px;
    padding: 12px 20px;
    border: 0;
    border-radius: 22px;
    font-size: 14px;
}

/* The legal page shares the same palette, type scale, and focus treatment. */
.privacy-page {
    min-height: 100vh;
    padding: 48px 24px;
}

.privacy-shell {
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 48px;
    border-radius: 32px;
    background: var(--ui-surface);
}

.privacy-heading {
    padding-bottom: 30px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--ui-border);
}

.privacy-heading h1 {
    color: var(--ui-text);
    line-height: 1.35;
}

.privacy-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    margin-bottom: 28px;
    padding: 10px 16px;
    border-radius: 16px;
    color: var(--ui-primary-text);
    background: var(--ui-primary-soft);
    font-size: 14px;
    font-weight: 600;
}

.privacy-shell section {
    font-size: 15px;
    line-height: 1.85;
}

.privacy-shell section h2 {
    margin-bottom: 12px;
    color: var(--ui-text);
    font-size: 19px;
}

.privacy-shell section :is(.bg-slate-50, .bg-sky-50) {
    padding: 20px;
    border: 0;
    border-radius: 20px;
    background: var(--ui-bg);
}

@media (min-width: 768px) {
    #zoom-controls-dock #locate-btn { display: none; }
}

@media (min-width: 768px) and (max-width: 1100px) {
    #panel { width: 430px; }
}

@media (max-width: 767px) {
    #map-header {
        top: max(8px, env(safe-area-inset-top));
        left: max(8px, env(safe-area-inset-left));
        width: calc(100% - max(8px, env(safe-area-inset-left)) - max(8px, env(safe-area-inset-right)));
        border-radius: 18px;
    }
    .map-header-card {
        grid-template-areas: "search settings";
        grid-template-columns: minmax(0, 1fr) 44px;
        gap: 6px;
        padding: 6px;
    }
    /* Keep the single page heading available without a mobile masthead. */
    .map-viewing-area {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
    .map-search-field { grid-area: search; }
    #map-controls-toggle { display: grid; grid-area: settings; }
    #search-input { font-size: 16px; }
    #search-input::placeholder { font-size: 12px; }
    #map-controls-content {
        max-height: calc(100dvh - 152px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        padding: 2px 6px 6px;
    }
    #map-header[data-controls-expanded="false"] #map-controls-content { display: none; }
    .map-filters > button { font-size: 12px; }
    #zoom-controls-dock,
    #smart-app-banner {
        display: none;
    }

    #map-layer-launcher {
        position: fixed;
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
        z-index: 1000;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-width: 48px;
        min-height: 48px;
        padding: 0 12px;
        border: 1px solid var(--ui-border);
        border-radius: 17px;
        color: var(--ui-primary-text);
        background: var(--ui-surface);
        box-shadow: var(--ui-shadow);
        font-size: 12px;
        font-weight: 700;
    }
    #map-layer-launcher[aria-expanded="true"] {
        color: var(--ui-primary-text);
        background: var(--ui-primary-soft);
        border-color: var(--ui-primary);
    }
    .map-page:has(#timeline-player-dock:not(.hidden)) #map-layer-launcher {
        display: none;
    }

    #seatalk-hud {
        left: max(12px, env(safe-area-inset-left));
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
        width: calc(100% - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right)));
        max-width: 480px;
        z-index: 1005;
    }
    #seatalk-card { max-height: min(340px, 44dvh); border-radius: 22px; }
    #seatalk-input { font-size: 16px; }
    #seatalk-input::placeholder { font-size: 13px; }
    #seatalk-min-pill {
        width: 44px;
        height: 44px;
        min-height: 44px;
        margin: 0;
        padding: 10px;
        border-radius: 16px;
        color: var(--ui-primary-text);
    }
    #seatalk-min-pill > span { display: none; }
    #seatalk-min-pill .seatalk-min-icon { display: block; }
    #timeline-player-dock {
        width: calc(100vw - 2 * max(12px, env(safe-area-inset-left), env(safe-area-inset-right)));
        bottom: max(12px, env(safe-area-inset-bottom));
    }
    .map-page { --timeline-clearance: 218px; }
    .timeline-player-surface {
        gap: 6px;
        padding: 8px 10px;
    }
    .timeline-toolbar { gap: 0; }
    #timeline-selected-time { font-size: 14px; }
    #timeline-play-btn,
    .timeline-details-actions {
        display: none;
    }
    .timeline-legend-content { gap: 8px; }
    .timeline-legend-title {
        flex-direction: column;
        gap: 0;
        font-size: 10px;
        line-height: 14px;
    }
    .timeline-legend-unit { font-size: 9px; }
    .timeline-legend-ticks {
        gap: 0;
        font-size: 9px;
    }
    .map-page:has(#timeline-player-dock:not(.hidden)) #seatalk-hud {
        bottom: calc(max(12px, env(safe-area-inset-bottom)) + var(--timeline-clearance));
    }
    .map-page:has(#timeline-player-dock:not(.hidden)) #seatalk-card {
        max-height: min(340px, max(44px, calc(100dvh - var(--timeline-clearance) - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom))));
        overflow-y: auto;
    }
    #warning-legend-widget {
        top: calc(max(8px, env(safe-area-inset-top)) + 72px);
        right: calc(max(12px, env(safe-area-inset-right)) + 60px);
        max-width: min(220px, calc(100vw - 96px));
        max-height: calc(100dvh - 160px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
    .map-page:has(#map-header[data-controls-expanded="true"]) #warning-legend-widget {
        top: auto;
        bottom: calc(max(12px, env(safe-area-inset-bottom)) + 64px);
        max-height: 24dvh;
    }
    .map-page:has(#timeline-player-dock:not(.hidden)) #warning-legend-widget {
        max-height: max(44px, calc(100dvh - var(--timeline-clearance) - 104px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    }
    .map-page:has(#timeline-player-dock:not(.hidden)):has(#map-header[data-controls-expanded="true"]) #warning-legend-widget {
        bottom: calc(max(12px, env(safe-area-inset-bottom)) + var(--timeline-clearance));
        max-height: min(24dvh, max(44px, calc(100dvh - var(--timeline-clearance) - 44px - env(safe-area-inset-top) - env(safe-area-inset-bottom))));
    }
    #panel {
        top: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }
    #panel-swipe-handle { padding-top: max(10px, env(safe-area-inset-top)); }
    #panel .panel-heading { padding: 14px 16px 12px; }
    #panel .panel-heading h2 { font-size: 18px; }
    #panel .panel-content { padding-left: 12px; padding-right: 12px; }
    #data-section > section { padding: 18px; border-radius: 26px; }
    .primary-metrics .text-2xl { font-size: 30px; }
    #toast-msg { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 64px); }
    .privacy-page { padding: 16px 12px; }
    .privacy-shell { padding: 24px 20px; border-radius: 28px; }
    .privacy-heading h1 { font-size: 28px; }
}

@media (max-height: 700px) and (min-width: 768px) {
    #seatalk-hud {
        left: calc(var(--ui-sidebar) + 32px);
        width: min(320px, calc(100vw - var(--ui-sidebar) - 112px));
        max-width: 320px;
    }
    #seatalk-card {
        max-height: min(300px, calc(100dvh - 48px));
        overflow-y: auto;
    }
}


@media (max-height: 560px) and (max-width: 767px) {
    #seatalk-card { max-height: calc(100dvh - 100px); overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .map-page *,
    .map-page *::before,
    .map-page *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
