* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body,
html {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f4f6f8;
    color: #1f2937;
}

.header {
    min-height: 76px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: #ffffff;
    border-bottom: 1px solid #d8dde3;
}

.title-block h1 {
    font-size: 20px;
    line-height: 1.2;
}

.title-block p {
    margin-top: 4px;
    color: #6b7280;
    font-size: 13px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge {
    padding: 8px 12px;
    border-radius: 999px;
    background: #e8f3ff;
    color: #005ecb;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.secondary-btn,
.action-buttons button,
select,
.sheet-toggle {
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
}

.secondary-btn,
.action-buttons button {
    cursor: pointer;
}

.secondary-btn {
    padding: 10px 14px;
}

.map-status {
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
}

.map-status.warning {
    background: #fff4db;
    color: #7a5600;
    border-bottom: 1px solid #f0d38a;
}

.map-status.error {
    background: #fdeaea;
    color: #9a2323;
    border-bottom: 1px solid #efb8b8;
}

.map-status.success {
    background: #e9f8ef;
    color: #1d6b3b;
    border-bottom: 1px solid #b7e1c5;
}

#map-container {
    flex: 1;
    width: 100%;
    background: #dfe5ea;
    min-height: 360px;
}

.footer {
    position: relative;
    padding: 16px;
    background: #fff;
    border-top: 1px solid #d8dde3;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.sheet-toggle {
    display: none;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0 0 10px;
    cursor: pointer;
    outline: none;
    appearance: none;
}

.sheet-toggle:focus,
.sheet-toggle:active,
.sheet-toggle:hover {
    background: transparent;
    outline: none;
    box-shadow: none;
}

.sheet-handle {
    display: block;
    width: 52px;
    height: 6px;
    margin: 0 auto;
    border-radius: 999px;
    background: #cbd5e1;
}

.selector-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 14px;
}

.selector-row select {
    min-width: 220px;
    padding: 8px 12px;
}

.coord-panel {
    display: block;
    margin-bottom: 14px;
}

.coord-item {
    padding: 14px 16px;
    border: 1px solid #dbe3eb;
    border-radius: 14px;
    background: #fafcff;
}

.coord-item-combined {
    display: flex;
    align-items: center;
    gap: 16px;
}

.coord-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #6b7280;
}

.coord-number {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

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

.coord-divider {
    width: 1px;
    align-self: stretch;
    background: #dbe3eb;
}

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

.action-buttons button {
    padding: 12px;
    white-space: nowrap;
    font-size: 15px;
}

.action-buttons .primary {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

@media (max-width: 640px) {
    .header,
    .header-actions,
    .selector-row {
        flex-direction: column;
        align-items: stretch;
    }

    .header {
        min-height: auto;
        padding-bottom: 10px;
    }

    #map-container {
        min-height: 52vh;
    }

    .footer {
        position: sticky;
        bottom: 0;
        z-index: 500;
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.12);
        transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
        touch-action: none;
    }

    .footer.dragging {
        transition: none;
    }

    .sheet-toggle {
        display: block;
    }

    .badge {
        align-self: flex-start;
    }

    .selector-row select {
        width: 100%;
    }

    .coord-number {
        font-size: 18px;
    }

    .action-buttons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .action-buttons button {
        padding: 11px 4px;
        font-size: 12px;
        letter-spacing: -0.01em;
    }
}
