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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    padding: 20px;
    color: #fff;
}

h1 {
    text-align: center;
    margin: 0;
    font-weight: 300;
    letter-spacing: 2px;
}

.page-header {
    max-width: 1200px;
    margin: 0 auto 24px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}

.page-brand {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 12px;
    min-width: 0;
}

.page-brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
}

.page-brand-text {
    color: #c29938;
    font-size: 0.90rem;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    font-style: italic;
}

.page-title {
    grid-column: 2;
    font-size: clamp(2rem, 4vw, 3rem);
}

.page-header-spacer {
    min-height: 1px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-4px);
}

.card h2 {
    font-size: 1.4em;
    margin: 0;
    color: #7dd3fc;
}

.card-header {
    margin-bottom: 16px;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title-row h2 {
    flex: 1;
    min-width: 0;
}

.card-collapse {
    appearance: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.18);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition:
        transform 0.12s ease,
        background 0.12s ease,
        border-color 0.12s ease;
}

.card-collapse::after {
    content: "";
    display: block;
    width: 10px;
    height: 10px;
    border-right: 2px solid rgba(226, 232, 240, 0.9);
    border-bottom: 2px solid rgba(226, 232, 240, 0.9);
    transform: rotate(-135deg);
    transition: transform 0.15s ease;
}

.card-collapse:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
}

.card-collapse:active {
    transform: translateY(0);
}

.card-collapse:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.15);
    border-color: rgba(125, 211, 252, 0.6);
}

.card.is-collapsed .card-header {
    margin-bottom: 0;
}

.card.is-collapsed .card-collapse::after {
    transform: rotate(45deg);
}

.card.is-collapsed .card-body {
    display: none;
}

.card-updated {
    text-align: right;
    font-size: 0.75em;
    color: #94a3b8;
    margin-bottom: 6px;
}

.card-country {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.75em;
    color: #94a3b8;
    font-weight: 500;
}

.card-panels {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.panel {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 16px;
}

.panel .temp {
    margin-bottom: 10px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.data-row:last-child {
    border-bottom: none;
}

.label {
    color: #94a3b8;
}

.value {
    font-weight: 600;
}

.wind-icon {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.18);
    position: relative;
    margin-right: 8px;
    vertical-align: -4px;
}

.wind-icon-arrow {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 2px;
    height: 9px;
    background: rgba(125, 211, 252, 0.85);
    border-radius: 999px;
    transform: translateX(-50%) rotate(var(--angle, 0deg));
    transform-origin: bottom center;
}

.wind-icon-arrow::after {
    content: "";
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid rgba(125, 211, 252, 0.85);
}

.wind-icon-unknown .wind-icon-arrow {
    background: rgba(148, 163, 184, 0.55);
}

.wind-icon-unknown .wind-icon-arrow::after {
    border-bottom-color: rgba(148, 163, 184, 0.55);
}

.temp {
    font-size: 2.5em;
    font-weight: 300;
}

.temp .unit {
    font-size: 0.4em;
    color: #94a3b8;
}

.temp-secondary {
    font-size: 0.35em;
    color: #94a3b8;
    margin-left: 10px;
    font-weight: 500;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    grid-column: 1 / -1;
}

.error {
    text-align: center;
    padding: 40px;
    color: #f87171;
    grid-column: 1 / -1;
}

.updated {
    text-align: center;
    margin-top: 30px;
    color: #64748b;
    font-size: 0.9em;
}

.controls {
    max-width: 1200px;
    margin: 0 auto 20px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.controls label {
    display: block;
    margin-bottom: 8px;
    color: #94a3b8;
    font-size: 0.95em;
}

.controls select {
    width: 100%;
    min-height: 160px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    outline: none;
}

.controls input {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    outline: none;
}

.controls input::placeholder {
    color: rgba(148, 163, 184, 0.75);
}

.controls input:focus {
    border-color: rgba(125, 211, 252, 0.7);
    box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.15);
}

.controls select:focus {
    border-color: rgba(125, 211, 252, 0.7);
    box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.15);
}

.controls-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(125, 211, 252, 0.25);
    color: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition:
        transform 0.12s ease,
        background 0.12s ease,
        border-color 0.12s ease;
}

.btn:hover {
    transform: translateY(-1px);
    background: rgba(125, 211, 252, 0.32);
    border-color: rgba(125, 211, 252, 0.55);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
}

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

.help {
    margin-top: 10px;
    color: #94a3b8;
    font-size: 0.9em;
}

.metar {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.metar-label {
    color: #94a3b8;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.metar-raw {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    font-size: 0.85em;
    line-height: 1.35;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px;
    white-space: pre-wrap;
    word-break: break-word;
    color: #e2e8f0;
}

.decode-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.btn-small {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.85em;
}

.runways {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.runways-label {
    color: #94a3b8;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.runways-na {
    color: #94a3b8;
    font-size: 0.9em;
}

.runways-top {
    display: flex;
    gap: 14px;
    align-items: center;
}

.runways-summary {
    flex: 1;
    min-width: 0;
}

.runway-diagram {
    position: relative;
    width: 140px;
    height: 140px;
    flex: 0 0 140px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.18);
}

.runway-line {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 10px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    transform: translate(-50%, -50%) rotate(var(--angle));
}

.runway-line::before {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    top: 50%;
    height: 2px;
    background: rgba(0, 0, 0, 0.35);
    transform: translateY(-50%);
    border-radius: 999px;
}

.wind-arrow {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 2px;
    height: 62px;
    background: rgba(125, 211, 252, 0.85);
    border-radius: 999px;
    transform: translateX(-50%) rotate(var(--angle, 0deg));
    transform-origin: bottom center;
}

.wind-arrow::after {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid rgba(125, 211, 252, 0.85);
}

.wind-arrow-unknown {
    background: rgba(148, 163, 184, 0.55);
}

.wind-arrow-unknown::after {
    border-bottom-color: rgba(148, 163, 184, 0.55);
}

.runways-preferred {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    font-weight: 600;
    flex-wrap: wrap;
}

.runways-preferred-text {
    flex: 1;
    min-width: 0;
}

.runways-preferred strong {
    color: #7dd3fc;
    font-weight: 600;
}

.runways-preferred .runways-airport {
    margin-top: 0;
    flex: 0 0 auto;
}

.runways-meta,
.runways-wind,
.runways-airport {
    margin-top: 6px;
    color: #94a3b8;
    font-size: 0.85em;
}

.runways-airport {
    text-align: right;
}

.runways-airport-lon,
.runways-airport-elev {
    margin-top: 10px;
}

.runway-ends {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.runway-end {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.18);
}

.runway-end.preferred {
    border-color: rgba(125, 211, 252, 0.6);
    background: rgba(125, 211, 252, 0.12);
}

.runway-end-title {
    font-weight: 600;
}

.runway-end-heading {
    margin-left: 8px;
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.85em;
}

.runway-end-components {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    font-size: 0.85em;
}

.pill.is-headwind {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.12);
}

.pill.is-tailwind {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.12);
}

@media (max-width: 640px) {
    .page-header {
        grid-template-columns: 1fr;
        margin-bottom: 20px;
    }

    .page-brand {
        justify-self: start;
    }

    .page-brand-text {
        text-align: left;
    }

    .page-title {
        grid-column: auto;
    }

    .page-header-spacer {
        display: none;
    }

    .runways-top {
        flex-direction: column;
        align-items: stretch;
    }

    .runway-diagram {
        margin: 0 auto;
    }
}

@media (min-width: 900px) {
    .card-panels {
        grid-template-columns: 360px 1fr;
        align-items: stretch;
    }
}
