:root {
    --primary: #00f2fe;
    --secondary: #4facfe;
    --bg-dark: #0b0e14;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #e0e0e0;
    --text-dim: #a0a0a0;
    --error: #ff4d4d;
    --success: #00ff88;
}

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

/* View Transitions */
@view-transition {
    navigation: auto;
}

.input-group,
button,
.status-msg {
    view-transition-name: unset;
    /* Prevent noise */
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* Background Animated Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: move 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

@keyframes move {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(100px, 100px) scale(1.1);
    }
}

.container {
    width: 90%;
    max-width: 600px;
    padding: 2rem 0;
    z-index: 10;
}

header {
    margin-bottom: 3rem;
    display: flex;
    justify-content: center;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    text-align: left;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

.logo span {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lang-toggle {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dim);
    font-weight: 500;
}

.lang-toggle span {
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-toggle span:hover {
    color: white;
}

.lang-toggle span.active {
    color: var(--primary);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.subtitle {
    color: var(--text-dim);
    font-weight: 300;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.input-group {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-wrapper {
    position: relative;
}

input[type="text"] {
    width: 100%;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.1);
}

.input-hint {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.primary-btn {
    width: 100%;
    padding: 1.25rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(45deg, var(--secondary), var(--primary));
    color: #000;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 242, 254, 0.3);
}

.secondary-btn {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--secondary);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn.loading .btn-text {
    opacity: 0;
}

.btn-loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000;
    border-radius: 50%;
    position: absolute;
    display: none;
    animation: spin 0.8s linear infinite;
}

.primary-btn.loading .btn-loader {
    display: block;
}

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

.status-msg {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.95rem;
    min-height: 1.2em;
}

.status-msg.error {
    color: var(--error);
}

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

.instructions h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.brand-logo {
    display: block;
    height: 150px;
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

.tagline-small {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-weight: 500;
    opacity: 0.8;
}

.instructions ol {
    margin-left: 1.5rem;
    color: var(--text-dim);
}

.instructions li {
    margin-bottom: 1rem;
    line-height: 1.6;
}

footer {
    text-align: center;
    color: #444;
    font-size: 0.8rem;
    margin-top: 2rem;
}

@media (max-width: 480px) {
    .container {
        width: 95%;
    }

    .glass {
        padding: 1.5rem;
    }

    .logo {
        font-size: 2.2rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .brand-logo {
        height: 100px;
    }

    .header-nav {
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

/* --- Tire Pressure Calculator Styles --- */

/* Reuse text input styles for number/select */
input[type="number"],
select {
    width: 100%;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    appearance: none;
    /* Remove default arrow */
    -webkit-appearance: none;
}

input[type="number"].input-error {
    border-color: var(--error);
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.2);
}

.validation-msg {
    color: var(--error);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--error);
    border-radius: 8px;
    background: rgba(255, 77, 77, 0.1);
    display: none;
    /* Hidden by default */
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.1);
}

/* Custom arrow for select */
.input-group {
    position: relative;
}

.styled-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

/* Weight Input with Unit Toggle */
.weight-wrapper {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.weight-wrapper input[type="number"] {
    flex: 1;
}

.radio-group {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.radio-label {
    cursor: pointer;
    position: relative;
}

.radio-label input {
    display: none;
}

.radio-label span {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim);
    transition: all 0.3s ease;
}

.radio-label input:checked+span {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

/* Results Grid */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.result-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--secondary);
    transform: translateY(-5px);
}

.result-card h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

.psi-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.psi-value small,
.bar-value small {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-dim);
    margin-left: 0.2rem;
}

.bar-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    opacity: 0.8;
}

header {
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    /* Stack Content and Nav */
    align-items: center;
    gap: 1.5rem;
}

/* Centered Header Menu */
.header-menu {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    /* Pill shape */
    backdrop-filter: blur(5px);
}

/* Navigation Links (Moved to Header) */
.header-nav {
    margin-left: auto;
    /* Push to right */
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

/* Active indicator underline */
.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    border-radius: 2px;
}

@media (max-width: 480px) {
    .result-grid {
        grid-template-columns: 1fr;
    }
}

/* Helper Links (Surface Guide / Learn More) */
.helper-links {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    padding-left: 0.5rem;
}

.helper-links a {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-decoration: underline;
    transition: color 0.3s ease;
}

.helper-links a:hover {
    color: var(--primary);
}

/* Input Summary in Results */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
    font-size: 0.9rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-label {
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    color: var(--text-main);
    font-weight: 600;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

/* ... existing styles ... */

/* Light Mode Support */
body.light-mode {
    --bg-dark: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-main: #1e293b;
    --text-dim: #64748b;
    --secondary: #0ea5e9;
    --primary: #0284c7;
}

body.light-mode .blob {
    opacity: 0.5;
    mix-blend-mode: multiply;
}

body.light-mode .header-menu {
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body.light-mode .glass {
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
}

body.light-mode input,
body.light-mode select {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

body.light-mode input:focus,
body.light-mode select:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.2);
}

body.light-mode .nav-links a.active {
    color: var(--primary);
    text-shadow: none;
}

body.light-mode .secondary-btn {
    background: #ffffff;
    border-color: #cbd5e1;
    color: var(--text-main);
}

body.light-mode .secondary-btn:hover {
    background: #f1f5f9;
    border-color: var(--primary);
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 1rem;
    padding: 0;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
    transform: rotate(15deg) scale(1.15);
}

/* Route Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.stat-item {
    text-align: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

/* Map Marker Styling */
.marker-pin {
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.start-marker {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
}

.end-marker {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* Shiny Download Button */
.shiny-btn {
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(45deg, var(--secondary), var(--primary));
    color: #000;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.shiny-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 242, 254, 0.3);
}

.shiny-btn:active {
    transform: translateY(0);
}

/* Route Name Input */
.route-name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

/* Mobile Responsive Stats */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-item {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* Lap Control Styling */
.lap-control .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.lap-control .icon-btn:active {
    background: rgba(255, 255, 255, 0.15) !important;
}

/* Chrome, Safari, Edge, Opera - Remove arrows from number input */
#lap-count::-webkit-outer-spin-button,
#lap-count::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox - Remove arrows from number input */
#lap-count[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
    padding: 0 !important;
    height: 100%;
}