:root {
    --bg: #050505;
    --panel: #111214;
    --border: #26282c;
    --text: #e6e6e6;
    --dim: #8a8f98;
    --amber: #ffb000;
    --green: #39ff14;
    --cyan: #34e3ff;
    --red: #ff3b30;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; }
h1:focus { outline: none; }
a { color: var(--amber); }
code, .mono { font-family: ui-monospace, monospace; }

/* ---------- LED text ---------- */
.led {
    font-family: VT323, ui-monospace, monospace;
    letter-spacing: .06em;
    text-transform: uppercase;
    font-size: clamp(1.1rem, 2.4vw, 2.4rem);
    line-height: 1.1;
}
.led.small { font-size: clamp(.9rem, 1.5vw, 1.5rem); }
.led.big { font-size: clamp(1.4rem, 3.2vw, 3.2rem); }
.led.huge { font-size: clamp(2.2rem, 6vw, 6rem); }
.led.amber { color: var(--amber); text-shadow: 0 0 6px rgba(255,176,0,.7), 0 0 18px rgba(255,176,0,.35); }
.led.green { color: var(--green); text-shadow: 0 0 6px rgba(57,255,20,.6), 0 0 16px rgba(57,255,20,.3); }
.led.cyan { color: var(--cyan); text-shadow: 0 0 6px rgba(52,227,255,.6); }
.led.white { color: #f4f4f4; text-shadow: 0 0 5px rgba(255,255,255,.45); }
.led.red { color: var(--red); text-shadow: 0 0 6px rgba(255,59,48,.7); }
.led.dim { color: var(--dim); }
.blink { animation: blink 1.2s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* ---------- Wall ---------- */
.wall {
    position: relative;
    min-height: 100vh;
    padding: 2vh 3vw;
    display: flex; flex-direction: column; gap: 2vh;
    background: #000;
    cursor: default;
    overflow: hidden;
}
/* dot-matrix overlay */
.wall::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(rgba(0,0,0,0) 55%, rgba(0,0,0,.55) 60%);
    background-size: 4px 4px;
}
.wall-header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #1c1c1c; padding-bottom: 1vh; }
.wall-footer { margin-top: auto; display: flex; gap: 2rem; justify-content: space-between; position: relative; z-index: 1; }
.wall-footer a { color: #555; text-decoration: none; }
.wall-empty { flex: 1; display: grid; place-items: center; text-align: center; }

.board { display: flex; flex-direction: column; gap: 1.2vh; }
.board-row {
    display: grid;
    grid-template-columns: 1.9fr 1.1fr 1.6fr 1.5fr 1.1fr 1.2fr;
    gap: 1.5vw; align-items: center;
    padding: .8vh 1vw;
    background: #0a0a0a;
    border: 1px solid #161616;
    border-radius: 4px;
    animation: flip .5s ease-out;
}
.board-row > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ident-cell { display: flex; align-items: center; gap: .8vw; min-width: 0; overflow: hidden; }
.ident-cell > .led { overflow: hidden; text-overflow: ellipsis; }
/* Logos sit on a light chip so dark logos stay legible on the black board. */
.airline-logo {
    flex: none; height: clamp(1.6rem, 3vw, 3rem); width: clamp(3.2rem, 6vw, 6rem);
    object-fit: contain; background: #f2f2f2; border-radius: 4px; padding: 2px 4px;
}
.airline-logo.large { height: clamp(3rem, 7vw, 7rem); width: clamp(6rem, 14vw, 14rem); padding: 4px 8px; }
.airline-logo.empty, .airline-logo.failed { visibility: hidden; }
.board-head { background: none; border: none; animation: none; }
.board-head > span { font-size: clamp(.8rem, 1.3vw, 1.3rem); }
@keyframes flip { from { transform: rotateX(80deg); opacity: 0; } to { transform: none; opacity: 1; } }

.pager { display: flex; gap: 8px; justify-content: center; }
.pager span { width: 10px; height: 10px; border-radius: 50%; background: #222; }
.pager span.on { background: var(--amber); box-shadow: 0 0 8px var(--amber); }

.flight-card { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 5vh; animation: flip .6s ease-out; }
.fc-ident { display: flex; flex-direction: column; gap: .5vh; }
.fc-route { display: grid; grid-template-columns: auto 1fr auto; gap: 3vw; align-items: center; }
.fc-ap { display: flex; flex-direction: column; }
.fc-ap.right { text-align: right; }
.fc-progress .track { position: relative; height: 10px; background: #1a1a1a; border-radius: 5px; }
.fc-progress .fill { height: 100%; background: linear-gradient(90deg, #1d7a0c, var(--green)); border-radius: 5px; box-shadow: 0 0 12px rgba(57,255,20,.5); transition: width 1s; }
.fc-progress .plane { position: absolute; top: 50%; transform: translate(-50%, -55%); color: var(--amber); font-size: clamp(1.5rem, 3vw, 3rem); text-shadow: 0 0 10px var(--amber); transition: left 1s; }
.fc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 2vw; }
.fc-stats > div { display: flex; flex-direction: column; }

/* ---------- Home ---------- */
.home { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; text-align: center; padding: 2rem; }
.home-links { display: flex; gap: 1rem; }

/* ---------- Settings ---------- */
.settings { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
.settings-header { display: flex; justify-content: space-between; align-items: center; }
.settings-header h1 { margin: 0; font-size: 1.5rem; }
.settings-grid { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 1.5rem; margin-top: 1.5rem; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.panel h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); margin: .75rem 0 0; }
.map-panel { min-height: 520px; }
.map { flex: 1; min-height: 480px; border-radius: 8px; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--dim); flex: 1; }
label.check { flex-direction: row; align-items: center; color: var(--text); }
input, select {
    background: #0b0c0d; color: var(--text); border: 1px solid var(--border); border-radius: 6px;
    padding: .5rem .6rem; font: inherit; font-size: .95rem;
}
input[type=range] { padding: 0; }
input[type=checkbox] { width: 1rem; height: 1rem; }
.row { display: flex; gap: .75rem; align-items: flex-end; }
.hint { color: var(--dim); font-size: .8rem; margin: 0; }
.dim { color: var(--dim); }
.btn {
    display: inline-block; background: #1d1f22; color: var(--text); border: 1px solid var(--border);
    border-radius: 6px; padding: .5rem .9rem; font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #444; }
.btn.primary { background: var(--amber); color: #000; border-color: var(--amber); font-weight: 600; }
.btn.small { padding: .1rem .45rem; font-size: .8rem; }
.segmented { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.segmented button { flex: 1; background: #0b0c0d; color: var(--dim); border: 0; padding: .55rem; cursor: pointer; font: inherit; }
.segmented button.on { background: var(--amber); color: #000; font-weight: 600; }
.tracked { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.tracked li { display: flex; justify-content: space-between; align-items: center; background: #0b0c0d; border: 1px solid var(--border); border-radius: 6px; padding: .4rem .6rem; }
.actions { display: flex; align-items: center; gap: 1rem; margin-top: .5rem; }
.status { color: var(--green); font-size: .85rem; }
.error { color: #ff6b61; font-size: .85rem; }
.live-row { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--border); }

/* Leaflet dark tweaks */
.leaflet-container { background: #0b0c0d; }
.fw-dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.4); }
.row > label { min-width: 0; }
.row input, .row select { width: 100%; min-width: 0; }
.leaflet-draw-toolbar a { background-color: #fff; }

/* ---------- Blazor ---------- */
#blazor-error-ui {
    background: #b32121; color: #fff; bottom: 0; display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred." }

/* ---------- Live map ---------- */
.livemap-page { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
.livemap { flex: 1; min-height: 0; background: #111; }
.livemap-bar {
    display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap;
    padding: .35rem 1rem; background: #050505; border-top: 1px solid var(--border);
}
.livemap-bar .led { font-size: clamp(1rem, 1.8vw, 1.6rem); }
.livemap-bar .led.small { font-size: clamp(.85rem, 1.3vw, 1.2rem); }
.livemap-bar nav { margin-left: auto; display: flex; gap: 1rem; font-family: VT323, monospace; font-size: 1.2rem; }
.livemap-bar nav a { color: #777; text-decoration: none; }
.livemap-bar nav a:hover { color: var(--amber); }

.fw-map-btn {
    display: block; width: 34px; height: 34px; font-size: 18px; line-height: 1;
    background: #fff; color: #222; border: 2px solid rgba(0,0,0,.2); border-radius: 4px; cursor: pointer;
}
.fw-map-btn:hover { background: #f4f4f4; }

.fw-plane-icon { background: none; border: none; }
.fw-plane { position: relative; width: 28px; height: 28px; }
.fw-plane svg {
    width: 20px; height: 20px; margin: 4px; transform-origin: 50% 50%;
    stroke: #000; stroke-width: 1; filter: drop-shadow(0 0 2px rgba(0,0,0,.8)); opacity: .8;
}
.fw-plane.on-wall svg { width: 26px; height: 26px; margin: 1px; stroke: var(--amber); stroke-width: 1.4; opacity: 1;
    filter: drop-shadow(0 0 4px rgba(255,176,0,.9)); }
.fw-plane.ground svg { opacity: .5; }
.fw-plane-label {
    position: absolute; left: 26px; top: 4px; white-space: nowrap; pointer-events: none;
    font: 15px/1 VT323, monospace; letter-spacing: .05em; padding: 1px 4px; border-radius: 2px;
    color: #fff; background: rgba(0,0,0,.65); display: none;
}
.fw-plane.on-wall .fw-plane-label { display: block; color: var(--amber); }
.fw-plane:hover .fw-plane-label { display: block; }

.fw-legend { background: rgba(0,0,0,.7); color: #ddd; padding: 6px 8px; border-radius: 4px; font: 12px Inter, sans-serif; width: 210px; }
.fw-legend-bar { height: 8px; border-radius: 4px; }
.fw-legend-labels { display: flex; justify-content: space-between; margin-top: 3px; }

.fw-plane.selected svg { width: 28px; height: 28px; margin: 0; stroke: #fff; stroke-width: 1.6; opacity: 1;
    filter: drop-shadow(0 0 6px #fff); }
.fw-plane.selected .fw-plane-label { display: block; color: #fff; background: #000; }
.fw-plane { cursor: pointer; }

.fw-panel {
    position: absolute; top: 0; right: 0; bottom: 42px; width: min(380px, 100%); z-index: 1000;
    overflow-y: auto; background: rgba(12,13,15,.97); border-left: 1px solid var(--border);
    color: var(--text); font-size: 14px; padding: 0 0 16px; box-shadow: -8px 0 24px rgba(0,0,0,.5);
}
.fw-panel[hidden] { display: none; }
.fw-panel.stale .fw-panel-grid { opacity: .5; }
.fw-panel-close {
    position: absolute; top: 8px; right: 8px; z-index: 1; width: 30px; height: 30px; border-radius: 50%;
    border: 0; background: rgba(0,0,0,.7); color: #fff; font-size: 16px; cursor: pointer;
}
.fw-panel-photo { background: #000; }
.fw-panel-photo img { display: block; width: 100%; height: auto; }
.fw-panel-photo-empty { aspect-ratio: 3 / 2; display: grid; place-items: center; color: var(--dim); }
.fw-panel-credit { font-size: 11px; padding: 3px 12px; color: var(--dim); background: #000; }
.fw-panel-credit a { color: var(--dim); }
.fw-panel-ident { font: 34px/1 VT323, monospace; color: var(--amber); letter-spacing: .05em; padding: 12px 16px 0;
    text-shadow: 0 0 6px rgba(255,176,0,.6); }
.fw-panel-type { font-weight: 600; padding: 2px 16px 0; }
.fw-panel-route { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px 0; }
.fw-panel-route:empty { display: none; }
.fw-panel-stop { display: flex; flex-direction: column; }
.fw-panel-stop b { font: 26px/1 VT323, monospace; color: var(--green); }
.fw-panel-stop small { color: var(--dim); font-size: 11px; max-width: 120px; }
.fw-panel-arrow { color: var(--dim); }
.fw-panel-status { margin: 8px 16px 0; font: 15px VT323, monospace; color: var(--amber); }
.fw-panel-status:empty { display: none; }
.fw-panel h3 { margin: 16px 16px 6px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.fw-panel-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 16px; }
.fw-panel-grid dt { color: var(--dim); }
.fw-panel-grid dd { margin: 0; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.fw-panel-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 16px 0; }
.fw-panel-links a { padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; text-decoration: none; font-size: 13px; }
.fw-panel-links a:hover { border-color: var(--amber); }

.settings-header nav { display: flex; gap: .5rem; }
.route-cell[title] { cursor: help; }

/* ---------- Accounts ---------- */
.account { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.account-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 2rem; }
.account-card h1 { margin: 0 0 .5rem; }
.account-card label { display: flex; flex-direction: column; gap: .3rem; margin: .8rem 0; }
.account-card label.check { flex-direction: row; align-items: center; font-size: .9rem; }
.account-card input[type=email], .account-card input[type=password] { padding: .55rem .6rem; background: #0b0c0d; color: var(--text); border: 1px solid var(--border); border-radius: 4px; }
.btn.wide { width: 100%; margin-top: .6rem; }
.btn.danger { border-color: #5a1f1c; color: #ff8a80; }
.dim { color: var(--dim); }
.error { color: #ff8a80; }
.or { text-align: center; color: var(--dim); margin: 1rem 0 .2rem; font-size: .85rem; }
.user-menu { display: inline-flex; gap: .8rem; align-items: center; }
.user-menu a, .link-button { color: inherit; opacity: .8; }
.link-button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.inline-form { display: inline; margin: 0; }
.temp-password { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
table.users { width: 100%; border-collapse: collapse; }
table.users th, table.users td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.users tr.disabled { opacity: .55; }
table.users .actions { display: flex; flex-wrap: wrap; gap: .3rem; }
