:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(16, 22, 31, 0.9);
    --panel-strong: rgba(22, 30, 42, 0.96);
    --surface-soft: rgba(255, 255, 255, 0.055);
    --surface-hover: rgba(255, 255, 255, 0.095);
    --text-primary: #f8fafc;
    --text-secondary: #a7b0bf;
    --accent: #2f80ed;
    --success: #22c55e;
    --info: #38bdf8;
    --border: rgba(226, 232, 240, 0.13);
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
}

body.landing-page {
    width: auto;
    min-width: 320px;
    min-height: 100vh;
    height: auto;
    overflow: auto;
    background:
        linear-gradient(135deg, rgba(47, 128, 237, 0.16), rgba(34, 197, 94, 0.08) 42%, transparent 68%),
        #0d1117;
}

.landing-shell {
    width: min(1120px, calc(100% - 36px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 56px 0;
}

.landing-hero {
    max-width: 860px;
    padding: 46px 0 38px;
}

.landing-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 800;
}

.landing-logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
}

.landing-hero h1 {
    max-width: 760px;
    color: var(--text-primary);
    font-size: clamp(42px, 7vw, 78px);
    line-height: 0.98;
    letter-spacing: 0;
}

.landing-hero p {
    max-width: 700px;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 19px;
    line-height: 1.55;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.landing-action,
.service-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}

.landing-action.primary,
.service-link {
    border-color: rgba(47, 128, 237, 0.68);
    background: var(--accent);
}

.landing-action.secondary {
    background: rgba(255, 255, 255, 0.07);
}

.landing-action:hover,
.service-link:hover {
    transform: translateY(-1px);
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    padding-bottom: 42px;
}

.service-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(16, 22, 31, 0.78);
    box-shadow: var(--shadow);
}

.service-kicker {
    color: var(--info);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.service-card h2 {
    color: var(--text-primary);
    font-size: 28px;
    letter-spacing: 0;
}

.service-card p,
.service-list {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.service-list {
    display: grid;
    gap: 9px;
    padding-left: 18px;
}

.service-link {
    align-self: flex-start;
    margin-top: auto;
}

.android-details {
    max-width: 800px;
}

.details-back {
    display: inline-block;
    margin-bottom: 32px;
    color: var(--info);
    text-decoration: none;
}

.android-details h1 {
    font-size: clamp(32px, 5vw, 48px);
    line-height: 1.15;
}

.android-details > p,
.android-details li {
    color: var(--text-secondary);
    line-height: 1.6;
}

.android-details > p {
    margin-top: 18px;
    font-size: 18px;
}

.android-details section {
    margin-top: 42px;
}

.android-details h2 {
    margin-bottom: 16px;
    font-size: 23px;
}

.android-details ul {
    display: grid;
    gap: 10px;
    padding-left: 22px;
}

.emulator-panel p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.emulator-panel button {
    margin-top: 16px;
    font-family: inherit;
    cursor: pointer;
}

.emulator-panel button[hidden] {
    display: none;
}

.emulator-panel button:disabled {
    opacity: 0.65;
    cursor: progress;
}

.emulator-panel a {
    color: var(--info);
}

#emulator-status:not(:empty) {
    margin-top: 12px;
}

.desktop-demo {
    position: relative;
    display: grid;
    gap: 10px;
    margin-top: auto;
    padding: 12px;
    border: 1px solid rgba(56, 189, 248, 0.42);
    border-radius: 8px;
    background: rgba(13, 17, 23, 0.72);
}

.demo-badge {
    align-self: start;
    justify-self: start;
    padding: 5px 8px;
    border: 1px solid rgba(56, 189, 248, 0.46);
    border-radius: 7px;
    background: rgba(56, 189, 248, 0.14);
    color: #bae6fd;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.demo-topbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
}

.demo-map {
    position: relative;
    min-height: 155px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background:
        linear-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px),
        #111827;
    background-size: 28px 28px;
}

.demo-route {
    position: absolute;
    height: 4px;
    border-radius: 999px;
    transform-origin: left center;
}

.demo-route.route-a {
    width: 168px;
    left: 34px;
    top: 92px;
    background: #38bdf8;
    transform: rotate(-19deg);
}

.demo-route.route-b {
    width: 142px;
    left: 96px;
    top: 70px;
    background: #22c55e;
    transform: rotate(26deg);
}

.demo-tile {
    position: absolute;
    width: 38px;
    height: 38px;
    border: 2px solid rgba(250, 204, 21, 0.92);
    background: rgba(250, 204, 21, 0.2);
}

.demo-tile.tile-a {
    left: 92px;
    top: 58px;
}

.demo-tile.tile-b {
    left: 130px;
    top: 58px;
}

.demo-tile.tile-c {
    left: 130px;
    top: 96px;
}

.demo-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.demo-panel div {
    display: grid;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
}

.demo-panel strong {
    color: var(--text-primary);
    font-size: 12px;
}

.demo-panel span {
    color: var(--text-secondary);
    font-size: 11px;
}

@media screen and (max-width: 760px) {
    .landing-shell {
        width: min(100% - 28px, 640px);
        padding: 28px 0;
    }

    .landing-hero {
        padding-top: 18px;
    }

    .landing-hero h1 {
        font-size: 42px;
    }

    .landing-hero p {
        font-size: 16px;
    }

    .landing-actions {
        flex-direction: column;
    }

    .landing-action {
        width: 100%;
    }

    .service-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (min-width: 761px) and (max-width: 980px) {
    .service-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.catalog-modes, .catalog-pages {
    display: flex;
    align-items: center;
    gap: 8px;
}

.catalog-modes > button, .catalog-pages > button {
    flex: 1;
    min-width: 0;
}

.catalog-list {
    display: grid;
    gap: 4px;
    margin: 8px 0;
}

.catalog-row {
    display: grid;
    width: 100%;
    gap: 2px;
    padding: 9px 10px;
    border: 1px solid #475569;
    border-radius: 4px;
    background: #1f2937;
    color: #f8fafc;
    text-align: left;
    cursor: pointer;
}

.catalog-row:hover, .catalog-row:focus-visible {
    border-color: #38bdf8;
}

.catalog-row small {
    color: #cbd5e1;
}

.catalog-local-row {
    display: flex;
    gap: 4px;
}

.catalog-local-row .catalog-row {
    flex: 1;
    min-width: 0;
}

.catalog-upload {
    min-width: 64px;
    border: 1px solid #0f766e;
    border-radius: 4px;
    background: #115e59;
    color: #fff;
    cursor: pointer;
}

.catalog-upload:disabled {
    opacity: 0.5;
}

button,
input,
select {
    font: inherit;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

canvas:active {
    cursor: grabbing;
}

.ui-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 14px;
    padding: 18px;
    pointer-events: none;
}

body.map-only .ui-overlay {
    display: block;
    padding: 10px;
}

body.map-only .app-topbar,
body.map-only .info-panel,
body.map-only .map-attribution,
body.map-only .position-overlay,
body.map-only .bottom-toolbar {
    display: none;
}

body.map-only .map-only-btn {
    background: rgba(47, 128, 237, 0.28);
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: auto;
}

.app-topbar {
    width: fit-content;
    max-width: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 6px 8px;
}

.brand-block {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
}

.brand-block h1 {
    font-size: 16px;
    white-space: nowrap;
}

.brand-block .subtitle {
    margin-top: 0;
    white-space: nowrap;
}

.brand-block .demo-mode-badge {
    margin-top: 0;
}

h1 {
    font-size: 20px;
    font-weight: 650;
    letter-spacing: 0;
    line-height: 1.1;
}

h2,
h3 {
    font-size: 14px;
    font-weight: 650;
    line-height: 1.2;
}

.subtitle {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}

.demo-mode-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin-top: 7px;
    padding: 3px 8px;
    border: 1px solid rgba(245, 158, 11, 0.55);
    border-radius: 5px;
    background: rgba(120, 53, 15, 0.48);
    color: #fde68a;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
}

.section-tabs {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    width: auto;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
}

.section-tab {
    flex: 0 0 auto;
    height: auto;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.section-tab:hover {
    background: var(--surface-soft);
    color: var(--text-primary);
}

.section-tab.active {
    background: rgba(47, 128, 237, 0.18);
    border-color: rgba(47, 128, 237, 0.42);
    color: #ffffff;
}

.info-panel {
    align-self: start;
    width: 360px;
    max-height: calc(100vh - 178px);
    overflow: hidden;
    transition: width 0.2s ease;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--border);
}

.drawer-content {
    max-height: calc(100vh - 248px);
    overflow-y: auto;
    padding: 14px;
}

.info-panel.minimized {
    width: 228px;
}

.info-panel.minimized .drawer-content,
.info-panel.minimized .panel-header .subtitle {
    display: none;
}

.minimize-btn {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-soft);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.minimize-btn:hover {
    background: var(--surface-hover);
    border-color: rgba(47, 128, 237, 0.55);
    color: var(--text-primary);
}

.panel-section.hidden {
    display: none;
}

.section-heading {
    margin-bottom: 12px;
}

.section-kicker,
.field-label,
.label,
.tile-popup-title {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: uppercase;
}

.section-heading h3 {
    margin-top: 4px;
    font-size: 18px;
}

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

.stat-item,
.competition-stat {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-item-wide {
    grid-column: 1 / -1;
}

.value {
    font-size: 17px;
    font-weight: 650;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.value-accent {
    color: #77aef8;
}

.value-success {
    color: var(--success);
}

.value-info {
    color: var(--info);
}

.tile-stats-by-level {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
}

.tile-stat-level {
    min-width: 0;
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 7px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.tile-stat-level input {
    margin: 0;
}

.tile-stat-level.hidden-by-filter {
    opacity: 0.48;
}

.tile-stat-swatch {
    width: 9px;
    height: 18px;
    border-radius: 999px;
    background: var(--tile-color, var(--accent));
}

.tile-stat-name {
    min-width: 0;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 650;
}

.tile-stat-count {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.quick-actions {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.quick-actions-title {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
}

.follow-toggle {
    margin: 0;
}

.recording-options-panel {
    display: grid;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.56);
}

.recording-options-panel.hidden {
    display: none;
}

.location-status {
    display: grid;
    gap: 3px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

#currentTileStatus {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.3;
}

.offline-card {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.48);
}

.offline-status,
.offline-count {
    margin-top: 3px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.3;
}

.offline-status.offline {
    color: #fbbf24;
}

.offline-status.online {
    color: var(--success);
}

.local-track-browser {
    display: grid;
    gap: 8px;
    margin-top: 2px;
}

.local-track-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.text-action-btn {
    border: 0;
    background: transparent;
    color: #8ec5ff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 650;
}

.text-action-btn:hover {
    color: #ffffff;
}

.local-track-list {
    display: grid;
    gap: 7px;
}

.local-track-empty {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.35;
}

.local-track-item {
    display: grid;
    gap: 7px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.local-track-title {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.local-track-meta {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.35;
}

.local-track-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.local-track-action {
    min-height: 30px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 11px;
    font-weight: 650;
}

.local-track-action:hover {
    border-color: rgba(47, 128, 237, 0.58);
    background: rgba(47, 128, 237, 0.14);
}

.local-track-action.danger:hover {
    border-color: rgba(248, 113, 113, 0.72);
    background: rgba(248, 113, 113, 0.14);
}

.peak-progress-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.peak-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.peak-list {
    display: grid;
    gap: 7px;
}

.peak-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 9px;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.peak-item.visited {
    border-color: rgba(245, 158, 11, 0.48);
    background: rgba(245, 158, 11, 0.09);
}

.peak-badge {
    align-self: start;
    min-width: 46px;
    padding: 4px 6px;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.16);
    color: #bbf7d0;
    font-size: 10px;
    font-weight: 750;
    text-align: center;
}

.peak-badge.visited {
    background: rgba(245, 158, 11, 0.18);
    color: #fde68a;
}

.peak-details {
    min-width: 0;
}

.peak-title {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.peak-meta {
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.35;
}

.peak-item-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.panel-action-btn {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid rgba(47, 128, 237, 0.48);
    border-radius: 8px;
    background: rgba(47, 128, 237, 0.18);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
    text-align: center;
    transition: background 0.2s, border-color 0.2s;
}

.panel-action-btn:hover,
.panel-action-btn.active {
    background: rgba(47, 128, 237, 0.28);
    border-color: rgba(47, 128, 237, 0.82);
}

.secondary-action {
    background: var(--surface-soft);
    border-color: var(--border);
}

.secondary-action:hover,
.secondary-action.active {
    background: rgba(47, 128, 237, 0.18);
    border-color: rgba(47, 128, 237, 0.58);
}

.layer-item {
    display: flex;
    align-items: center;
    min-height: 30px;
    gap: 10px;
    cursor: pointer;
}

.layer-item.prominent {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
}

.layer-checkbox {
    appearance: none;
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    position: relative;
    border: 1px solid var(--text-secondary);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.2s, border-color 0.2s;
}

.layer-checkbox:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.layer-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.layer-label {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.25;
}

.layer-checkbox:checked + .layer-label,
.layer-item:hover .layer-label {
    color: var(--text-primary);
}

.trail-type-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.layer-status {
    margin-top: 7px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.panel-divider {
    width: 100%;
    height: 1px;
    margin: 12px 0;
    background: var(--border);
}

.menu-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-group-toggle {
    width: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
}

.menu-group-toggle:hover {
    background: var(--surface-hover);
}

.menu-group-icon {
    color: var(--text-secondary);
}

.menu-group-body {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 0 2px;
}

.menu-group.collapsed .menu-group-body {
    display: none;
}

.panel-select {
    width: 100%;
    min-height: 38px;
    margin: 7px 0;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-strong);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.panel-select:hover,
.panel-select:focus {
    border-color: rgba(47, 128, 237, 0.7);
}

.panel-select option {
    background: #111827;
    color: var(--text-primary);
}

.planner-field {
    display: block;
    margin: 12px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.planner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.planner-actions .panel-action-btn {
    flex: 1 1 130px;
}

#routeDownloadBtn[hidden] {
    display: none;
}

.route-map-prompt {
    width: 100%;
    padding: 6px 8px;
    color: var(--text-primary);
    font-size: 12px;
    text-align: center;
}

.route-map-prompt[hidden] {
    display: none;
}

.field-help {
    margin-top: 0;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.35;
}

.tile-level-filter-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
}

.tile-level-filter-item {
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 650;
}

.tile-level-filter-item::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--tile-color, #22c55e);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.panel-text-input {
    cursor: text;
}

#trailRegionSelect {
    min-height: 112px;
}

#trailRegionSelect option {
    padding: 5px 8px;
}

#trailRegionSelect option:checked {
    background: var(--accent);
    color: #ffffff;
}

.competition-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.competition-list-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    font-size: 12px;
}

.competition-list-item strong {
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.3;
}

.competition-list-item span {
    color: var(--text-secondary);
    line-height: 1.35;
}

.collection-file-list {
    max-height: 220px;
    margin-top: 12px;
    overflow: auto;
}

#collectionMatchList {
    max-height: 260px;
    margin-top: 10px;
    overflow: auto;
}

.tile-preview-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.tile-preview-details.hidden {
    display: none;
}

.tile-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

#tilePreviewTitle {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 650;
}

.tile-popup-section {
    margin-top: 13px;
}

.tile-popup-title {
    margin-bottom: 6px;
}

.tile-popup-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tile-popup-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.tile-popup-item:hover {
    border-color: rgba(47, 128, 237, 0.58);
    background: rgba(47, 128, 237, 0.12);
}

.tile-popup-color {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-radius: 999px;
}

.tile-popup-text {
    font-size: 12px;
    line-height: 1.35;
}

.tile-popup-empty {
    padding: 5px 2px;
    color: var(--text-secondary);
    font-size: 12px;
}

.route-info-popup {
    position: absolute;
    z-index: 250;
    max-width: min(340px, calc(100vw - 32px));
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background: rgba(15, 17, 21, 0.95);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    color: var(--text-primary);
    pointer-events: auto;
    backdrop-filter: blur(14px);
}

.route-info-popup.hidden {
    display: none;
}

.route-info-popup h3 {
    margin: 0 22px 8px 0;
    font-size: 14px;
    line-height: 1.3;
}

.route-info-popup dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 10px;
    margin: 0;
    font-size: 12px;
}

.route-info-popup dt {
    color: var(--text-secondary);
}

.route-info-popup dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.route-info-popup .close-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    cursor: pointer;
}

.map-attribution {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 100;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.52);
    color: var(--text-secondary);
    font-size: 11px;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}

.map-attribution a {
    color: #8ec5ff;
    text-decoration: none;
}

.map-attribution a:hover {
    text-decoration: underline;
}

.bottom-toolbar {
    align-self: end;
    justify-self: start;
    width: fit-content;
    max-width: calc(100vw - 36px);
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 10px;
}

.controls-panel {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.icon-btn:hover,
.icon-btn.active {
    background: var(--surface-hover);
}

.map-only-btn {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    z-index: 20;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    background: var(--panel-bg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: auto;
}

.zoom-slider-control {
    min-width: 180px;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.zoom-slider-main {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-slider-control input {
    width: 100%;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.zoom-slider-control span {
    min-width: 32px;
    text-align: right;
}

.divider {
    width: 1px;
    height: 20px;
    background: var(--border);
}

.position-overlay {
    color: #ffffff;
    font-size: 12px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    white-space: nowrap;
}

.drop-zone {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 17, 21, 0.9);
    transition: opacity 0.2s;
}

.drop-zone.hidden {
    opacity: 0;
    pointer-events: none;
}

.drop-message {
    text-align: center;
    color: var(--text-primary);
}

.drop-message .icon {
    display: block;
    margin-bottom: 16px;
    font-size: 48px;
}

.drop-message h2 {
    font-size: 24px;
    font-weight: 550;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f1115;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(47, 128, 237, 0.22);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(47, 128, 237, 0.3);
}

.loading-text {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 650;
    letter-spacing: 0;
    text-transform: uppercase;
    animation: pulse 2s ease-in-out infinite;
}

.progress-container {
    width: 100%;
    height: 4px;
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.progress-bar {
    width: 0%;
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent), #61d394);
    box-shadow: 0 0 10px rgba(47, 128, 237, 0.5);
    transition: width 0.3s ease;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.84;
    }

    50% {
        opacity: 0.48;
    }
}

@media screen and (max-width: 760px) {
    .ui-overlay {
        padding: 10px;
        gap: 10px;
    }

    .app-topbar {
        width: fit-content;
        max-width: calc(100% - 52px);
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
        padding: 5px 6px;
    }

    .brand-block .subtitle {
        display: none;
    }

    .section-tabs {
        width: auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .section-tab {
        height: auto;
        padding: 5px 7px;
    }

    .info-panel {
        width: 100%;
        max-height: calc(100vh - 300px);
    }

    .drawer-content {
        max-height: calc(100vh - 370px);
    }

    .info-panel.minimized {
        width: min(240px, 100%);
    }

    .bottom-toolbar {
        width: 100%;
        max-width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 7px;
        padding: 8px;
    }

    .controls-panel {
        width: 100%;
        flex-wrap: wrap;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }

    .map-only-btn {
        width: 44px;
        height: 44px;
    }

    .zoom-slider-control {
        flex: 1 1 180px;
        min-width: 150px;
    }

    .position-overlay {
        width: 100%;
        font-size: 11px;
    }
}

