@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
    --hud-bg: #0a0d0a;
    --hud-panel: #10140f;
    --hud-panel-border: #2a3a2a;
    --hud-green: #39ff6a;
    --hud-green-dim: #1e8f3e;
    --hud-amber: #ffb000;
    --hud-red: #ff3b30;
    --hud-blue: #3b82f6;
    --hud-text: #c8f2d0;
    --hud-text-dim: #6c8f74;
    --hud-font: 'Share Tech Mono', 'Courier New', monospace;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--hud-bg);
    color: var(--hud-text);
    font-family: var(--hud-font);
    letter-spacing: 0.02em;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

.hud-scanlines {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        rgba(0, 0, 0, 0) 2px
    );
    mix-blend-mode: overlay;
}

.hud-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Extra right padding reserves the space the fixed .lang-switch occupies, so the
       LOCK form and the clock never end up underneath it. */
    padding: 0.75rem 8rem 0.75rem 1.5rem;
    background: linear-gradient(180deg, #14180f 0%, #0a0d0a 100%);
    border-bottom: 1px solid var(--hud-panel-border);
    box-shadow: 0 0 12px rgba(57, 255, 106, 0.08);
}

.hud-header__brand {
    color: var(--hud-green);
    font-weight: bold;
    letter-spacing: 0.15em;
    text-shadow: 0 0 6px rgba(57, 255, 106, 0.6);
}

/* Sits immediately after the brand, sharing its baseline so it reads as sitting at the
   bottom of the lettering rather than floating mid-height.

   Both the brand and this are align-self: baseline, which puts them in the same baseline
   group. Setting align-items: baseline on .hud-header instead would drag the clock and
   the LOCK form in header_right out of centre too. margin-right: auto absorbs the slack
   that justify-content: space-between would otherwise open up between the brand and
   this, which would strand the version in the middle of the bar. */
.hud-header__brand,
.hud-header__version {
    align-self: baseline;
}

.hud-header__version {
    margin-left: 0.6rem;
    margin-right: auto;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--hud-text-dim);
}

/* Whatever the page puts in header_right: the console's LOCK form, the player maps'
   clock. The language switcher is no longer in here — see .lang-switch. */
.hud-header__right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Pinned top-right on every page, including the front page, which has no header bar at
   all. z-index clears .hud-scanlines (999) so it is never dimmed by the overlay. */
.lang-switch {
    position: fixed;
    top: 0.6rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    gap: 0.2rem;
}

.lang-switch__opt {
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    /* --hud-text, not --hud-text-dim: dim green on near-black was genuinely hard to
       read, and this is a control rather than a caption. */
    color: var(--hud-text);
    border: 1px solid var(--hud-panel-border);
    /* Opaque rather than transparent, so it stays legible where it floats over satellite
       imagery on the player maps. */
    background: rgba(10, 13, 10, 0.85);
    cursor: pointer;
}

.lang-switch__opt:hover {
    border-color: var(--hud-green-dim);
}

.lang-switch__opt--on {
    color: var(--hud-green);
    border-color: var(--hud-green);
    box-shadow: 0 0 8px rgba(57, 255, 106, 0.25);
}

.hud-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--hud-green);
}

button, .hud-btn {
    display: inline-block;
    font-family: var(--hud-font);
    background: var(--hud-panel);
    color: var(--hud-green);
    border: 1px solid var(--hud-green-dim);
    padding: 0.5rem 1rem;
    cursor: pointer;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s;
}

button:hover, .hud-btn:hover {
    background: var(--hud-green-dim);
    color: #0a0d0a;
    box-shadow: 0 0 10px rgba(57, 255, 106, 0.5);
}

input, select {
    font-family: var(--hud-font);
    background: #0e120d;
    color: var(--hud-text);
    border: 1px solid var(--hud-panel-border);
    padding: 0.5rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--hud-green);
    box-shadow: 0 0 6px rgba(57, 255, 106, 0.4);
}

.hud-panel {
    background: var(--hud-panel);
    border: 1px solid var(--hud-panel-border);
    padding: 1.5rem;
}

.hud-error {
    color: var(--hud-red);
    border: 1px solid var(--hud-red);
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.hud-gate {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-gate__box {
    width: 320px;
    text-align: center;
}

.hud-gate__box h1 {
    color: var(--hud-green);
    letter-spacing: 0.2em;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.hud-gate__box input[type="password"], .hud-gate__box input[type="text"] {
    width: 100%;
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: 0.3em;
}

.hud-gate__box button {
    width: 100%;
}

/* Missile range zone marker: a permanent missile icon + name at the circle's center
   (shared between the viewer and the console's flight/zone map editors). Icon size
   can't be set via transform on .missile-icon itself (Leaflet uses that to position
   it on the map) — the inner .missile-icon__scale wrapper carries the zoom-based
   scale instead (see bindIconScaling in map-base.js). */
.missile-icon {
    pointer-events: none;
}

.missile-icon__scale {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(var(--icon-scale, 1));
    transform-origin: center top;
}

.missile-icon__img {
    width: 22px;
    height: 22px;
    display: block;
    filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.8));
}

.missile-icon__label {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: var(--hud-font);
    font-size: 0.65rem;
    color: var(--hud-blue);
    background: rgba(10, 13, 10, 0.75);
    padding: 1px 4px;
    text-shadow: 0 0 4px rgba(59, 130, 246, 0.6);
}

/* Black box (flight recorder) marker: same pattern as .missile-icon — amber/orange to
   match the real-world "orange box" convention, distinct from green aircraft, red
   hazards, and blue missile ranges. */
.blackbox-icon {
    pointer-events: none;
}

.blackbox-icon__scale {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(var(--icon-scale, 1));
    transform-origin: center top;
}

.blackbox-icon__img {
    width: 22px;
    height: 22px;
    display: block;
    filter: drop-shadow(0 0 4px rgba(255, 176, 0, 0.8));
}

.blackbox-icon__label {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    text-align: center;
    font-family: var(--hud-font);
    font-size: 0.65rem;
    color: var(--hud-amber);
    background: rgba(10, 13, 10, 0.75);
    padding: 1px 4px;
    text-shadow: 0 0 4px rgba(255, 176, 0, 0.6);
}

.hud-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.hud-checkbox-label input[type="checkbox"] {
    width: auto;
}

.blackbox-fields {
    display: none;
}

/* Shared form/text primitives. These live here rather than in console.css because
   the lobby (game picker, event create, manage login) uses them too. */
.hud-hint {
    color: var(--hud-text-dim);
    font-size: 0.75rem;
}

.hud-text-dim {
    color: var(--hud-text-dim);
}

.hud-hint--warn {
    color: var(--hud-amber);
}

.field-row {
    margin-bottom: 0.75rem;
    text-align: left;
}

.field-row label {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: var(--hud-text-dim);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.hud-gate__box--wide {
    width: 420px;
}

.hud-gate__box--wide input[type="text"],
.hud-gate__box--wide input[type="password"] {
    text-align: left;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

/* --- self-locator.js (shared/js/self-locator.js) ---------------------------------
   The GPS "you are here" overlay is game-agnostic, so its styling lives here rather
   than in any one game's stylesheet. */
.gps-toggle-btn {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
}

.gps-status {
    display: block;
    margin-top: 0.3rem;
    color: var(--hud-text-dim);
    font-size: 0.65rem;
}

/* "You are here" marker: the viewer's own GPS position + compass heading, in a
   distinct cyan/white so it never reads as an aircraft or hazard. .self-icon__scale
   carries both the zoom scale and the heading rotation together (see self-locator.js) —
   Leaflet owns the outer .self-icon element's own transform for map positioning. */
.self-icon {
    pointer-events: none;
}

.self-icon__scale {
    position: relative;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    transition: transform 200ms linear;
}

.self-icon__cone {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
    border-top: 54px solid rgba(0, 229, 255, 0.22);
    transform: translateX(-50%);
}

.self-icon__img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    transform: translate(-50%, -50%);
    display: block;
    filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.9));
}

/* --- 404 -----------------------------------------------------------------------------
   templates/404.html. In the shared theme rather than a page stylesheet because the
   error page can be reached from anywhere, including URLs that match no app. */
.notfound {
    flex: 1;
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
    padding: 4rem 1.5rem;
    text-align: center;
}

.notfound__code {
    margin: 0;
    font-size: clamp(3rem, 18vw, 7rem);
    line-height: 1;
    letter-spacing: 0.1em;
    color: var(--hud-green);
    text-shadow: 0 0 20px rgba(57, 255, 106, 0.35);
}

.notfound__title {
    margin: 0.5rem 0 1.5rem;
    font-size: 1rem;
    letter-spacing: 0.25em;
    color: var(--hud-amber);
}

.notfound__text {
    font-size: 0.8rem;
    line-height: 1.6;
    margin: 0 0 1rem;
}
