/* Alarmist: a dark map, neon cyan controls, sirens flashing red and blue. */

:root {
    --bg: #0B0D12;
    --panel: rgba(20, 24, 34, 0.92);
    --cyan: #00E5FF;
    --red: #FF2846;
    --siren-red: rgb(255, 40, 70);
    --siren-blue: rgb(40, 110, 255);
    --text: #FFFFFF;
    --muted: #9AA0AE;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    /* How far the screen goes below the layout viewport: see the standalone rule below */
    --under: 0px;
    color-scheme: dark;
}

/* iOS Home Screen app (black-translucent status bar): fixed elements and 100% heights stop short of the bottom of the
   screen, leaving a strip under the map. Without browser toolbars 100lvh is the whole screen, so anything anchored to
   the bottom is moved down by the difference (a negative bottom). Zero wherever the viewport already fills it. */
@media (display-mode: standalone) {
    :root { --under: calc(100% - 100lvh); }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    min-height: 100lvh;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

#app { height: 100%; }

.loading {
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--red);
    letter-spacing: 4px;
    font-weight: 600;
    text-shadow: 0 0 12px var(--red);
}

.map {
    position: fixed;
    inset: 0;
    bottom: var(--under);
    background: var(--bg);
}

/* Title and status, over the map, never in the way of a tap */
.top {
    position: fixed;
    top: calc(var(--safe-top) + 16px);
    left: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.brand {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 4px;
    color: var(--red);
    text-shadow: 0 0 12px var(--red);
}

.status {
    max-width: 100%;
    padding: 6px 14px;
    border: 1px solid var(--red);
    border-radius: 14px;
    background: var(--panel);
    font-size: 13px;
    text-align: center;
}

/* Locate and add */
.map-buttons {
    position: fixed;
    right: 16px;
    bottom: calc(var(--under) + var(--safe-bottom) + 40px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
    color: inherit;
}

button.round {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 1;
    color: var(--cyan);
    background: var(--panel);
    border: 1.5px solid var(--cyan);
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.6);
}

/* The EN/PL switch: smaller, it's not a map action */
button.round.lang {
    width: 40px;
    height: 40px;
    align-self: center;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
}

button:focus-visible, input:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

/* Placing a new siren: the middle of the map */
.crosshair {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    z-index: 1000;
    pointer-events: none;
    border: 2px solid var(--cyan);
    border-radius: 50%;
    background:
        linear-gradient(var(--cyan), var(--cyan)) center / 2px 100% no-repeat,
        linear-gradient(var(--cyan), var(--cyan)) center / 100% 2px no-repeat;
}

.place-bar {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(var(--under) + var(--safe-bottom) + 40px);
    z-index: 1000;
    max-width: 480px;
    margin: 0 auto;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    border: 1.5px solid var(--cyan);
    border-radius: 18px;
    background: var(--panel);
}

.place-bar button, .sheet button {
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.06);
}

button.primary { background: var(--red); font-weight: 600; }
button.danger { color: var(--red); font-weight: 600; }
button.ghost { background: transparent; color: var(--muted); }
/* Not now: on for its two hours, or too far away. Says why, can't be tapped. */
button:disabled { color: var(--muted); cursor: default; }

.attribution {
    position: fixed;
    left: 8px;
    bottom: calc(var(--under) + var(--safe-bottom) + 12px);
    z-index: 1000;
    font-size: 10px;
    color: #8A90A0;
}

.attribution a { color: inherit; }

/* Action sheet and prompts */
.backdrop {
    position: fixed;
    inset: 0;
    bottom: var(--under);
    z-index: 2000;
    background: rgba(0, 0, 0, 0.45);
}

.sheet {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(var(--under) + var(--safe-bottom) + 16px);
    z-index: 2001;
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1.5px solid var(--cyan);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 0 0 24px rgba(0, 229, 255, 0.25);
}

.sheet-title {
    font-weight: 600;
    font-size: 17px;
    text-align: center;
    padding-bottom: 4px;
    overflow-wrap: anywhere;
}

.sheet-text {
    margin: 0;
    color: var(--muted);
    text-align: center;
    font-size: 15px;
    line-height: 1.4;
}

.sheet-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 8px;
}

.sheet input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #2A3040;
    background: #0F121A;
    color: var(--text);
    font-size: 16px; /* 16px: iOS doesn't zoom into the field */
}

/* Sirens on the map (js/map.js). The marker is a point; everything is centred on it. */
.leaflet-container { background: var(--bg); font: inherit; }

.siren-icon { background: none; border: none; }

.siren {
    position: relative;
    width: 0;
    height: 0;
}

.siren > span {
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* A comfortable tap target around the small dot */
.siren::before {
    content: "";
    position: absolute;
    left: -22px;
    top: -22px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.siren .core {
    width: 13px;
    height: 13px;
    background: rgb(70, 75, 88);
    border: 1.5px solid rgb(130, 138, 155);
}

.siren.on .core {
    width: 14px;
    height: 14px;
    border: 2px solid #FFFFFF;
    animation: flash 0.667s steps(1) infinite;
    animation-delay: var(--flash-delay, 0s);
}

.siren .glow { display: none; }

.siren.on .glow {
    display: block;
    width: 26px;
    height: 26px;
    animation: pulse 1s linear infinite;
    animation-delay: var(--pulse-delay, 0s);
}

.siren .ring { display: none; }

.siren.followed .ring {
    display: block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--cyan);
}

.siren .label {
    top: 22px;
    border-radius: 0;
    white-space: nowrap;
    font-size: 12px;
    color: rgb(150, 156, 170);
    text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 3px #000;
    transform: translate(-50%, -50%);
}

.siren.on .label { color: #FFFFFF; font-weight: 700; }

/* Red and blue swap three times a second */
@keyframes flash {
    0% { background: var(--siren-red); }
    50% { background: var(--siren-blue); }
}

/* The glow grows and fades once a second, in the colour of the moment */
@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); background: rgba(255, 40, 70, 0.67); }
    33% { background: rgba(40, 110, 255, 0.45); }
    66% { background: rgba(255, 40, 70, 0.22); }
    100% { transform: translate(-50%, -50%) scale(3); background: rgba(40, 110, 255, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .siren.on .glow { animation: none; transform: translate(-50%, -50%) scale(1.6); background: rgba(255, 40, 70, 0.35); }
    .siren.on .core { animation-duration: 2s; }
}

.not-found { padding: 32px; text-align: center; }
.not-found a { color: var(--cyan); }

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--under);
    z-index: 3000;
    padding: 12px 16px calc(var(--safe-bottom) + 12px);
    background: #3A0B14;
    color: #FFFFFF;
}

#blazor-error-ui a { color: var(--cyan); margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
