:root {
    --bg: #09090b;
    --card: #18181b;
    --card-elevated: #27272a;
    --text: #fafafa;
    --muted: #a1a1aa;
    --cyan: #22d3ee;
    --cyan-dim: rgba(34, 211, 238, 0.15);
    --border: rgba(255, 255, 255, 0.1);
    --success: #10b981;
    --radius: 1rem;
}

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

body {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0a2540 0%, #09090b 50%, #1e3a5f 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 1.5rem;
}

.page {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--cyan);
    font-weight: 600;
    letter-spacing: -0.03em;
    font-size: 0.95rem;
}

.brand-mark {
    width: 2rem;
    height: 2rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #22d3ee, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
}

.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--cyan);
}

header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cyan);
    margin-bottom: 0.75rem;
}

header h1 {
    font-size: clamp(1.5rem, 5vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.calculator-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

.input-group h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.input-field {
    display: flex;
    flex-direction: column;
}

.input-field.full-width {
    width: 100%;
}

label {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: #e4e4e7;
}

input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    background: #09090b;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder {
    color: #52525b;
}

input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px var(--cyan-dim);
}

/* Remove number spin buttons where possible */
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type='number'] {
    -moz-appearance: textfield;
}

.input-group.highlight {
    background: var(--cyan-dim);
    border: 1px solid rgba(34, 211, 238, 0.25);
    padding: 1rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
}

#calculate-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(to right, #0ea5e9, #22d3ee);
    color: #000;
    border: none;
    border-radius: 1rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 10px 15px -3px rgba(34, 211, 238, 0.25);
}

#calculate-btn:hover {
    transform: translateY(-1px) scale(1.01);
}

#calculate-btn:active {
    transform: translateY(1px);
}

.results-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border);
    animation: fadeIn 0.35s ease-out;
}

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

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    font-size: 1.05rem;
}

.result-item .label {
    color: var(--muted);
}

.result-item .value {
    font-weight: 700;
    color: var(--cyan);
    font-variant-numeric: tabular-nums;
}

.result-item.highlight {
    flex-direction: column;
    align-items: flex-start;
    background: var(--card-elevated);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 1rem;
    margin-top: 0.75rem;
}

.result-item.highlight .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.25rem;
}

.result-item.highlight .value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    margin-top: 0.75rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--cyan);
    width: 0%;
    transition: width 0.8s ease-out, background-color 0.3s;
    border-radius: 4px;
}

footer {
    text-align: center;
    margin-top: 1.75rem;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

footer a {
    color: var(--cyan);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 420px) {
    .input-row {
        grid-template-columns: 1fr;
    }

    .calculator-card {
        padding: 1.25rem;
    }
}
