:root {
    color-scheme: light;
    --ink: #132d22;
    --muted: #456255;
    --primary: #174e37;
    --paper: #fff;
    --background: #eef4ef;
    --border: #aec4b6;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font: 1rem/1.45 system-ui, sans-serif;
}

.capture-app {
    box-sizing: border-box;
    max-width: 34rem;
    margin: auto;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
        max(1.25rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.capture-app.is-camera {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
    color: #fff;
    background: #101914;
}

.camera-feed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: -2;
}

.is-camera::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    content: "";
    pointer-events: none;
    background: linear-gradient(180deg, #000b, transparent 26%, transparent 64%, #000c);
}

.camera-heading { text-align: center; }
.camera-heading h2 { margin: .25rem 0; font-size: clamp(1.2rem, 5vw, 1.6rem); }
.camera-heading p { margin: .25rem 0; }
.is-camera .capture-controls { margin-top: auto; padding-top: 1rem; }
.capture-app.is-camera .camera-shutter {
    min-height: 4.25rem;
    color: #132d22;
    background: #f0fff2;
    border-color: #f0fff2;
    font-size: 1.2rem;
}
.is-camera .camera-link, .is-camera .text-action {
    background: #141f19d9;
    border-color: #a7bdb1;
    color: #fff;
}
.is-camera .camera-hint { text-align: center; margin: 0; }
.is-camera .queue, .is-camera .message, .is-camera .notice { color: var(--ink); }
.is-camera .queue-empty { display: none; }
.is-camera .install-help { color: #fff; }

.brand {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: .25rem 0 1rem;
    border-bottom: 1px solid var(--border);
}

.brand img { border-radius: .7rem; flex: none; }
.brand h1 { margin: 0; font-size: 1.28rem; line-height: 1.15; }
.brand p { margin: .22rem 0 0; color: var(--muted); font-size: .9rem; }
h2 { font-size: 1.42rem; line-height: 1.2; margin: 1.15rem 0 .45rem; }
.hint { color: var(--muted); margin: 0 0 .7rem; }

.capture-app form { display: grid; gap: .55rem; }
.capture-app input:not([type=file]) {
    box-sizing: border-box;
    border: 1px solid #607669;
    border-radius: .65rem;
    padding: .8rem;
    font: inherit;
    width: 100%;
}

.capture-app button, .capture-app .file-label {
    box-sizing: border-box;
    display: grid;
    place-items: center;
    width: 100%;
    min-height: 3.35rem;
    margin: .55rem 0;
    border: 1px solid var(--primary);
    border-radius: .75rem;
    padding: .6rem .75rem;
    background: var(--primary);
    color: #fff;
    font: 750 1rem/1.25 system-ui, sans-serif;
    text-align: center;
    cursor: pointer;
    touch-action: manipulation;
}

.capture-app .secondary { background: var(--paper); color: var(--ink); }
.capture-app .text-action { background: transparent; color: #812422; border-color: transparent; }
.capture-app .danger { background: #812422; border-color: #812422; }
.capture-app button:active, .file-label:active { filter: brightness(.9); }
.capture-app :disabled, .photo-input:disabled + label { opacity: .58; cursor: default; }
.capture-app :focus-visible, .photo-input:focus-visible + label {
    outline: 3px solid #a34a15;
    outline-offset: 2px;
}

.preview:not([hidden]) {
    display: block;
    width: 100%;
    max-height: 43vh;
    max-height: 43svh;
    object-fit: contain;
    background: #14221b;
    border-radius: .9rem;
    margin-bottom: .85rem;
}

.photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
}

.queue, .message, .notice {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: .75rem;
    padding: .7rem .85rem;
}

.queue { display: flex; flex-wrap: wrap; gap: .35rem .8rem; margin-top: .9rem; font-size: .92rem; }
.queue .sending { color: var(--primary); font-weight: 650; }
.message { margin: .85rem 0; border-left: .25rem solid var(--primary); }
.notice { margin: .85rem 0; }
.notice p { margin: 0; }
.notice button { margin: 0; }
.install-help { margin-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); }
.install-help summary { cursor: pointer; min-height: 2.75rem; align-content: center; }
.install-help p { margin: .2rem 0 0; }

#blazor-error-ui {
    display: none;
    position: fixed;
    background: #faebcd;
    inset: auto 0 0;
    padding: .8rem 2rem .8rem 1rem;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; }

.loading-progress { display: block; width: 5rem; height: 5rem; margin: 20vh auto 1rem; }
.loading-progress circle { fill: none; stroke: var(--border); stroke-width: .6rem; }
.loading-progress circle:last-child {
    stroke: var(--primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * .8), 500%;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}
.loading-progress-text { text-align: center; }
.loading-progress-text::after { content: var(--blazor-load-percentage-text, "Načítám aplikaci…"); }
