@font-face {
    font-family: 'din1451alt';
    font-style: normal;
    font-weight: normal;
    src: local('din1451alt'), url(/static/fonts/din1451alt.woff) format('woff');
}

body {
    /* Keep content clear of the notch and home indicator (viewport-fit=cover). */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background-image: linear-gradient(white, rgb(149, 148, 148));
    background-attachment: fixed;
    font-family: 'din1451alt', sans-serif;
    text-align: center;
}

/* Sizes follow the display: vmin is the smaller of viewport width and height, so portrait, landscape,
   small phones and tablets all get proportionate text; clamp() keeps it readable at the extremes. */
h1 {
    font-size: clamp(24px, 6vmin, 48px);
}

#data-container {
    font-size: clamp(26px, 7.5vmin, 60px);
}

/* The signs are drawn 400 px wide; scale them down on narrow screens instead of overflowing sideways. */
#data-container > svg {
    display: block;
    margin: 0 auto;
    /* As wide as the screen allows, but not taller than about half of it, and not huge on tablets. */
    width: min(90vw, 46vh, 560px);
    height: auto;
}

html,
body {
    overflow-x: hidden;
    overscroll-behavior-x: none;
    /* No double-tap zoom (pinch zoom is switched off in the viewport meta tag). */
    touch-action: manipulation;
}

#data-container p {
    margin: 0.2em 0;
}

.footer {
    font-size: clamp(11px, 2.2vmin, 16px);
}

[hidden] {
    display: none !important;
}

.report-button {
    position: fixed;
    right: calc(16px + env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
    min-width: 96px;
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 24px;
    background: #222;
    color: #fff;
    font: inherit;
    font-size: 22px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 40;       /* above the burger button and the camera banner */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: rgba(0, 0, 0, 0.5);
}

.report-panel {
    box-sizing: border-box;
    width: min(100%, 440px);
    max-height: 92vh;
    overflow-y: auto;
    padding: 16px;
    border-radius: 12px;
    background: #fff;
    font-size: 20px;
    text-align: left;
}

.report-panel h2 {
    margin: 0 0 4px;
}

.report-context {
    margin: 0 0 8px;
    color: #555;
    font-size: 16px;
    text-align: left;
}

.report-panel fieldset {
    margin: 0 0 12px;
    border: 0;
    padding: 0;
}

.choice {
    display: block;
    padding: 10px 0;
}

.choice input {
    width: 22px;
    height: 22px;
    margin-right: 8px;
    vertical-align: middle;
}

.report-speed {
    margin-bottom: 12px;
    text-align: center;
}

.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 8px 0;
}

.stepper button {
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: #222;
    color: #fff;
    font: inherit;
    font-size: 32px;
}

.stepper output {
    min-width: 150px;
    font-size: 26px;
    text-align: center;
}

.link-button {
    border: 0;
    background: none;
    color: #06c;
    font: inherit;
    font-size: 16px;
    text-decoration: underline;
}

.comment-label {
    display: block;
    font-size: 16px;
}

.comment-label textarea {
    box-sizing: border-box;
    width: 100%;
    margin-top: 4px;
    font: inherit;
    font-size: 16px;
}

.report-message {
    min-height: 1.2em;
    font-size: 16px;
    text-align: left;
}

.report-actions {
    display: flex;
    gap: 8px;
}

.report-actions button {
    flex: 1;
    min-height: 48px;
    border: 0;
    border-radius: 8px;
    background: #222;
    color: #fff;
    font: inherit;
}

.report-actions button[type='button'] {
    background: #ddd;
    color: #222;
}

.report-actions button:disabled {
    opacity: 0.5;
}

.camera-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    /* side padding keeps the text clear of the burger button */
    padding: calc(10px + env(safe-area-inset-top)) 64px 10px;
    background: #d6001c;
    color: #fff;
    font-size: clamp(20px, 5vmin, 40px);
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.conditional {
    font-size: clamp(20px, 5.8vmin, 42px);
}

/* The clock sits in front of the text, also when the text wraps. */
.conditional svg {
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    margin-right: 0.3em;
    vertical-align: -0.2em;
}

/* Landscape on a phone is short: sign on the left, texts vertically centered on the right, no big heading. */
@media (orientation: landscape) and (max-height: 560px) {
    h1 {
        display: none;
    }

    #data-container {
        display: grid;
        grid-template-columns: auto 1fr;
        /* flexible rows above and below the texts keep them centered next to the sign */
        grid-template-rows: 1fr repeat(5, min-content) 1fr;
        column-gap: 5vw;
        min-height: 58vh;
        text-align: left;
    }

    #data-container::before,
    #data-container::after {
        content: '';
        grid-column: 2;
    }

    #data-container > svg {
        grid-column: 1;
        grid-row: 1 / -1;
        align-self: center;
        margin: 0;
        width: min(56vh, 40vw);
    }

    #data-container > p {
        grid-column: 2;
    }

}

/* Burger menu */
.menu-button {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top));
    left: calc(10px + env(safe-area-inset-left));
    z-index: 30;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    padding: 0 11px;
    border: 0;
    border-radius: 10px;
    background: rgba(34, 34, 34, 0.85);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.menu-button span {
    display: block;
    height: 3px;
    border-radius: 2px;
    background: #fff;
}

.menu {
    position: fixed;
    top: calc(64px + env(safe-area-inset-top));
    left: calc(10px + env(safe-area-inset-left));
    z-index: 30;
    min-width: 220px;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    text-align: left;
}

.menu a {
    display: block;
    padding: 16px 20px;
    color: #222;
    font-size: 22px;
    text-decoration: none;
}

/* Settings page */
.settings-page {
    text-align: left;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 640px;
    margin: 0 auto;
}

.settings-header h1 {
    margin: 0.5em 0;
    font-size: clamp(26px, 6vmin, 40px);
}

.back {
    color: #06c;
    font-size: 22px;
    text-decoration: none;
}

.settings {
    max-width: 640px;
    margin: 0 auto;
    font-size: 20px;
}

.settings h2 {
    margin: 1.2em 0 0.4em;
    font-size: 22px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.setting-row input[type='checkbox'] {
    width: 28px;
    height: 28px;
}

.setting-row select {
    min-height: 40px;
    font: inherit;
    font-size: 18px;
}

.setting-button {
    margin-top: 16px;
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 8px;
    background: #222;
    color: #fff;
    font: inherit;
    font-size: 18px;
}

.setting-hint {
    margin: 8px 0 0;
    color: #555;
    font-size: 16px;
    text-align: left;
}

/* "Blitzer noch da?" after passing a camera */
.camera-check {
    position: fixed;
    left: calc(12px + env(safe-area-inset-left));
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(80px + env(safe-area-inset-bottom));
    z-index: 25;
    padding: 12px 16px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    font-size: clamp(22px, 5vmin, 34px);
}

.camera-check p {
    margin: 0 0 10px;
}

.camera-check-buttons {
    display: flex;
    gap: 12px;
}

.camera-check-buttons button {
    flex: 1;
    min-height: 60px;
    border: 0;
    border-radius: 10px;
    background: #222;
    color: #fff;
    font: inherit;
}

.camera-check-buttons button:first-child {
    background: #2e7d32;
}

.camera-check-buttons button:last-child {
    background: #c62828;
}
