:root {
    --bg-1: #071027;
    --bg-2: #0f1530;
    --glass: rgba(255, 255, 255, 0.03);
    --accent: #7f5af0;
    --accent-2: #3bd3ff;
    --muted: #9aa0b4;
    --text: #e9eef8;
    --card-radius: 14px;
    --gap: 16px;
    --max-width: 980px;
    --glass-border: rgba(255, 255, 255, 0.04);
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    color: var(--text);
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.3px
}

.subtitle {
    color: var(--muted);
    font-size: 13px
}

/* Main app area */
.app {
    display: flex;
    gap: 28px;
    max-width: var(--max-width);
    margin: 28px auto;
    width: calc(100% - 40px);
    align-items: flex-start;
    flex: 1 0 auto;
    padding-bottom: 24px;
}

/* Cards */
.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border-radius: var(--card-radius);
    padding: 20px;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
    border: 1px solid var(--glass-border);
    min-width: 300px;
}

/* Form card specifics */
.form-card {
    flex: 0 0 420px
}

.form-grid {
    display: grid;
    gap: 12px
}

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

.input-row {
    display: flex;
    gap: 8px
}

input[type="number"] {
    flex: 1;
    padding: 12px 14px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-radius: 10px;
    outline: none;
    font-size: 15px;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.18)
}

select {
    width: 120px;
    padding: 10px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(218, 59, 59, 0.02), rgba(5, 18, 75, 0.462));
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 14px;
}

/* Buttons */
.controls {
    display: flex;
    gap: 10px;
    align-items: center
}

.btn {
    padding: 10px 14px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}

.btn.primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border: none;
    color: #fff;
    box-shadow: 0 8px 20px rgba(127, 90, 240, 0.15);
}

.btn.ghost {
    background: transparent
}

.btn.small {
    padding: 6px 8px;
    font-size: 13px
}

/* Message */
.message {
    color: var(--muted);
    font-size: 13px;
    min-height: 20px;
    margin-top: 6px
}

/* Result card */
.result-card {
    flex: 1 1 420px
}

.result-display {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.00));
    border: 1px solid rgba(255, 255, 255, 0.03)
}

.label {
    color: var(--muted);
    font-weight: 700
}

.value {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.4px
}

/* Mini progress bar */
.mini-progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 999px;
    margin-top: 12px;
    overflow: hidden
}

.bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width .6s cubic-bezier(.2, .9, .2, 1)
}

/* History */
.history {
    margin-top: 16px
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.history-list {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
    max-height: 220px;
    overflow: auto
}

.history-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.01);
    margin-bottom: 8px;
    font-size: 13px
}

.history-list .meta {
    color: var(--muted);
    font-size: 12px
}

.history-actions {
    display: flex;
    gap: 8px
}

/* Footer */
.footer {
    padding: 14px 18px;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid rgba(255, 255, 255, 0.02);
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.06))
}

/* Responsive */
@media (max-width:920px) {
    .app {
        flex-direction: column;
        gap: 18px
    }

    .form-card {
        width: 100%
    }

    .result-card {
        width: 100%
    }
}

#distance-unit{
    background-color: #0f1530;
    color: antiquewhite;
}

#time-unit{
    background-color: #0f1530;
    color: antiquewhite;
}

#speed-unit {
    background-color: #0f1530;
    color: antiquewhite;
}