/* ==========================================================================
   FOV-Rechner – Handy zuerst, ab 960 px zweispaltig
   ========================================================================== */

.fov { --c: #06b6d4; --c-2: #22d3ee; --c-soft: rgba(34, 211, 238, .12); }

/* Kopf -------------------------------------------------------------------- */
.fov-head { margin-bottom: 18px; }
.fov-head__title { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 900; letter-spacing: -.01em; }
.fov-head__title .icon { color: var(--c-2); width: 1.1em; height: 1.1em; }
.fov-head__sub { margin: 0; max-width: 640px; color: var(--muted); }

/* Tabs -------------------------------------------------------------------- */
.fov-tabs {
    display: flex; gap: 6px; margin: 0 0 18px; padding: 4px;
    border-radius: var(--radius); border: 1px solid var(--line); background: rgba(15, 23, 42, .6);
    width: fit-content; max-width: 100%;
}
.fov-tabs .tab {
    display: inline-flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 14px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.fov-tabs .tab:hover { color: var(--text); }
.fov-tabs .tab.is-active { background: var(--c-soft); color: var(--c-2); }
@media (max-width: 479px) {
    .fov-tabs { width: 100%; }
    .fov-tabs .tab { flex: 1; justify-content: center; padding: 0 8px; font-size: .85rem; }
}

/* Layout ------------------------------------------------------------------ */
.fov-layout { display: grid; gap: 16px; }
.fov-inputs, .fov-results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 960px) {
    .fov-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; gap: 22px; }
    .fov-results { position: sticky; top: 80px; }
}

.card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
@media (min-width: 640px) { .card { padding: 22px; } }
.card__title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.05rem; }
.card__title .icon { color: var(--c-2); }
.card__note { margin: 0; }
.card p { margin: 0; }

/* Felder ------------------------------------------------------------------ */
.fld { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.fld__label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.fld__hint { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--faint); }

.stepper {
    display: flex; align-items: stretch; height: 52px;
    border-radius: var(--radius); border: 1px solid #334155; background: var(--bg-soft);
    overflow: hidden; transition: border-color .15s ease, box-shadow .15s ease;
}
.stepper:focus-within { border-color: var(--c-2); box-shadow: 0 0 0 3px rgba(34, 211, 238, .18); }
.stepper__btn {
    flex: 0 0 52px; display: grid; place-items: center;
    border: 0; background: rgba(148, 163, 184, .06); color: var(--text-2); cursor: pointer;
    font-size: 1.1rem; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.stepper__btn:hover { background: rgba(148, 163, 184, .14); color: #fff; }
.stepper__btn:active { background: var(--c-soft); color: var(--c-2); }
.stepper__input {
    flex: 1; min-width: 0; width: 100%; padding: 0 4px 0 14px;
    border: 0; background: transparent; color: var(--text);
    font: inherit; font-size: 1.35rem; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums;
    outline: none;
}
.stepper__unit { display: flex; align-items: center; padding: 0 14px 0 6px; color: var(--muted); font-weight: 600; }
.stepper--plain { height: 48px; }
.stepper.is-invalid { border-color: var(--danger); }

select.input { height: 48px; border-radius: var(--radius); font-size: 1rem; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.chip {
    height: 34px; padding: 0 12px; border-radius: 999px;
    border: 1px solid var(--line); background: rgba(15, 23, 42, .5); color: var(--text-2);
    font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; touch-action: manipulation;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.chip:hover { border-color: var(--line-strong); color: #fff; }
.chip.is-active { background: var(--c-soft); border-color: rgba(34, 211, 238, .5); color: var(--c-2); }
.chips--solid { margin-top: 0; }
.chips--solid .chip { height: 40px; padding: 0 14px; border-radius: var(--radius-sm); }

.ratio-custom { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.ratio-custom .input { height: 44px; text-align: center; font-size: 1rem; font-weight: 700; }
.ratio-custom[hidden] { display: none; }

.seg {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
    border-radius: var(--radius); background: var(--bg-soft); border: 1px solid #334155;
}
.seg__btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer;
    transition: background-color .15s ease, color .15s ease; touch-action: manipulation;
}
.seg__btn:hover { color: var(--text); }
.seg__btn.is-active { background: var(--c-soft); color: var(--c-2); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .35); }
.seg--sm .seg__btn { height: 40px; }

.dims { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(148, 163, 184, .06); color: var(--muted); font-size: .85rem; }
.dims strong { color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Schieberegler */
.range { width: 100%; height: 32px; margin: -2px 0 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--c) var(--p, 50%), #334155 var(--p, 50%)); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: #334155; }
.range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--c); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #fff; border: 4px solid var(--c); box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid var(--c); }

.btn--measure {
    height: 52px; font-size: 1rem; color: #04222a;
    background: linear-gradient(135deg, var(--c-2), #67e8f9);
    box-shadow: 0 6px 20px rgba(34, 211, 238, .25);
}
.btn--measure:hover { color: #04222a; filter: brightness(1.06); }
.btn--block { width: 100%; }
.btn--xl { height: 56px; font-size: 1.05rem; }

/* Ergebnis ---------------------------------------------------------------- */
.result__big { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; }
.stat {
    display: flex; flex-direction: column; gap: 2px; padding: 14px 16px;
    border-radius: var(--radius); background: rgba(15, 23, 42, .55); border: 1px solid var(--line);
}
.stat--main { background: linear-gradient(135deg, rgba(34, 211, 238, .16), rgba(99, 102, 241, .12)); border-color: rgba(34, 211, 238, .35); }
.stat__label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat__value { font-size: clamp(1.9rem, 8vw, 2.6rem); font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat--main .stat__value { color: #cffafe; }

.result__more { display: flex; flex-wrap: wrap; gap: 8px; }
.result__more:empty { display: none; }
.pill {
    display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 10px;
    border-radius: var(--radius-sm); background: rgba(148, 163, 184, .08); color: var(--muted); font-size: .82rem;
}
.pill strong { color: var(--text); font-size: .95rem; font-variant-numeric: tabular-nums; }
.pill--warn { background: rgba(234, 179, 8, .1); color: var(--gold-2); }

.diagram { width: 100%; height: auto; display: block; border-radius: var(--radius); background: radial-gradient(ellipse at 50% 100%, rgba(34, 211, 238, .07), transparent 70%), rgba(2, 6, 23, .35); }
.diagram .d-screen { stroke: #e2e8f0; stroke-width: 5; stroke-linecap: round; fill: none; }
.diagram .d-frame { stroke: #475569; stroke-width: 5; stroke-linecap: round; fill: none; }
.diagram .d-ray { stroke: var(--c-2); stroke-width: 1.4; stroke-dasharray: 5 5; opacity: .75; }
.diagram .d-cone { fill: rgba(34, 211, 238, .1); }
.diagram .d-arc { stroke: var(--c-2); stroke-width: 2; fill: none; }
.diagram .d-eye { fill: var(--c-2); }
.diagram .d-eye-ring { fill: none; stroke: var(--c-2); stroke-width: 1.5; opacity: .4; }
.diagram .d-text { fill: #e2e8f0; font: 700 15px var(--font); }
.diagram .d-sub { fill: var(--muted); font: 600 11.5px var(--font); }
.diagram .d-dist { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 4; }

.result__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.games { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.game {
    display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px;
    padding: 11px 0; border-top: 1px solid var(--line);
}
.game:first-child { border-top: 0; padding-top: 2px; }
.game__name { font-weight: 700; }
.game__value { grid-row: span 2; font-size: 1.3rem; font-weight: 900; color: var(--c-2); font-variant-numeric: tabular-nums; text-align: right; }
.game__note { color: var(--faint); font-size: .78rem; }

/* Umrechnen --------------------------------------------------------------- */
.convert { max-width: 760px; }
.convert__row { display: grid; gap: 14px; }
@media (min-width: 560px) { .convert__row { grid-template-columns: 1fr 1fr; align-items: end; } }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.cv-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.cv-table th, .cv-table td { padding: 12px 14px; text-align: right; }
.cv-table th:first-child, .cv-table td:first-child { text-align: left; }
.cv-table th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: rgba(15, 23, 42, .6); }
.cv-table td { border-top: 1px solid var(--line); font-weight: 700; font-size: 1.05rem; }
.cv-table td:first-child { font-weight: 600; color: var(--text-2); font-size: .95rem; }
.cv-table tr.is-source td { background: var(--c-soft); }
.cv-table tr.is-source td:first-child::after { content: " (Eingabe)"; color: var(--c-2); font-size: .78rem; }
.cv-table tr.is-mine td:first-child::before { content: "● "; color: var(--gold-2); }

/* Mess-Dialog ------------------------------------------------------------- */
dialog.measure { width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 18px; }
dialog.measure .modal__head h2 { display: flex; align-items: center; gap: 10px; }
dialog.measure .modal__head .icon { color: var(--c-2); }
@media (max-width: 559px) {
    dialog.measure { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; }
}
.m-step { display: flex; flex-direction: column; gap: 14px; }
.m-step[hidden] { display: none; }
.m-step > p { margin: 0; color: var(--text-2); }
.m-mode-help { padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(148, 163, 184, .07); font-size: .9rem; }
.m-mode-help[hidden] { display: none; }
.m-error { padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(239, 68, 68, .1); border: 1px solid rgba(239, 68, 68, .35); color: #fecaca; font-size: .9rem; }
.m-error[hidden] { display: none; }

.viewfinder {
    position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
    background: repeating-linear-gradient(45deg, #0f172a 0 12px, #111c33 12px 24px);
}
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewfinder__cross { position: absolute; inset: 0; pointer-events: none; }
.viewfinder__cross::before, .viewfinder__cross::after { content: ""; position: absolute; background: #f43f5e; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.viewfinder__cross::before { left: 8%; right: 8%; top: 50%; height: 2px; margin-top: -1px; }
.viewfinder__cross::after { top: 38%; bottom: 38%; left: 50%; width: 2px; margin-left: -1px; }
.viewfinder__edge { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-weight: 600; text-align: center; padding: 16px; }
.viewfinder__edge .icon { width: 42px; height: 42px; color: var(--c-2); }
.viewfinder.is-edge { aspect-ratio: auto; height: 120px; }
.viewfinder.is-edge video, .viewfinder.is-edge .viewfinder__cross { display: none; }
.viewfinder.is-edge .viewfinder__edge { display: flex; }

.aim { display: flex; flex-direction: column; gap: 10px; align-items: stretch; text-align: center; }
.aim__task { margin: 0; font-size: 1.05rem; color: var(--text); }
.aim__angle { display: flex; align-items: baseline; justify-content: center; gap: 10px; font-size: 2.4rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.aim__stab { font-size: .8rem; font-weight: 700; color: var(--faint); }
.aim__stab.is-ok { color: var(--ok-2); }
.aim__stab.is-bad { color: var(--gold-2); }
.aim__marks { display: flex; justify-content: center; gap: 8px; }
.aim__mark { padding: 4px 10px; border-radius: 999px; background: rgba(148, 163, 184, .08); color: var(--muted); font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.aim__mark.is-set { background: rgba(16, 185, 129, .12); color: var(--ok-2); }
.aim #m-redo { align-self: center; }
.btn.is-counting { background: var(--gold); color: #1c1403; }

.m-result { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 12px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(34, 211, 238, .16), rgba(99, 102, 241, .12)); text-align: center; }
.m-result__label { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.m-result__value { font-size: 3rem; font-weight: 900; font-variant-numeric: tabular-nums; color: #cffafe; line-height: 1.1; }
.m-result__sub { color: var(--text-2); font-size: .9rem; }

/* Ergebnisleiste unten (nur Handy/Tablet) --------------------------------- */
.minibar {
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 30;
    display: flex; align-items: center; gap: 16px; padding: 10px 16px;
    border-radius: var(--radius-lg); border: 1px solid rgba(34, 211, 238, .4);
    background: rgba(8, 47, 73, .88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45); color: var(--text);
    animation: minibar-in .2s var(--ease);
}
.minibar[hidden] { display: none; }
.minibar:hover { color: var(--text); }
.minibar__item { display: flex; align-items: baseline; gap: 6px; }
.minibar__label { font-size: .72rem; font-weight: 800; color: var(--c-2); }
.minibar__item strong { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.minibar__go { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 700; color: var(--c-2); }
.minibar__go .icon { transform: rotate(90deg); }
@keyframes minibar-in { from { opacity: 0; transform: translateY(12px); } }
@media (max-width: 959px) { .fov { padding-bottom: 96px; } }

/* Freihändig-Modus: Knopf füllt sich grün, während man ruhig hält */
#m-capture.is-auto { background: linear-gradient(90deg, var(--ok) var(--hold, 0%), var(--accent) var(--hold, 0%)); }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(16, 185, 129, .07); border: 1px solid rgba(16, 185, 129, .25); color: var(--text-2); font-size: .9rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--ok); }

/* Mess-Knöpfe ------------------------------------------------------------- */
.measure-btns { display: grid; gap: 10px; }
@media (min-width: 520px) { .measure-btns { grid-template-columns: 1fr 1fr; } }
.measure-btns .btn { height: auto; min-height: 52px; padding: 8px 14px; white-space: normal; flex-wrap: wrap; text-align: center; line-height: 1.2; }
.btn__sub { font-size: .75rem; font-weight: 700; opacity: .75; }
.btn--measure-alt { background: rgba(34, 211, 238, .1); color: var(--c-2); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .45); }
.btn--measure-alt:hover { color: #cffafe; background: rgba(34, 211, 238, .18); filter: none; }

/* Blinder-Fleck-Test ------------------------------------------------------ */
.steps { margin: 0; padding-left: 1.3em; color: var(--text-2); font-size: .92rem; display: flex; flex-direction: column; gap: 4px; }
.cardcheck { display: grid; place-items: center; padding: 14px; border-radius: var(--radius); background: rgba(2, 6, 23, .4); overflow: hidden; }
.cardcheck__card {
    display: grid; place-items: center; border-radius: 3.2mm;
    border: 2px solid var(--c-2); background: rgba(34, 211, 238, .08);
    color: var(--c-2); font-weight: 800; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
}
.blind-stage { position: fixed; inset: 0; z-index: 100; background: #05070d; color: var(--muted); cursor: none; user-select: none; -webkit-user-select: none; }
.blind-stage[hidden] { display: none; }
.blind-stage__info { position: absolute; top: 5vh; left: 0; right: 0; margin: 0; padding: 0 20px; text-align: center; font-size: 1.1rem; color: var(--text-2); }
.blind-stage__info strong { color: #fff; }
.blind-stage__hint { position: absolute; bottom: 4vh; left: 0; right: 0; margin: 0; text-align: center; font-size: .8rem; color: var(--faint); }
.blind-stage__fix, .blind-stage__dot { position: absolute; left: 0; top: 0; will-change: transform; }
.blind-stage__fix { background: #fff; }
.blind-stage__dot { border-radius: 50%; background: #ef4444; }
.blind-stage__dot[hidden] { display: none; }
.fld[hidden], #fld-bezel[hidden] { display: none; }
/* Auf Touch-Geräten (Handy/Tablet) kommt die Handy-Messung zuerst */
@media (pointer: coarse) {
    #btn-measure { order: -1; color: #04222a; background: linear-gradient(135deg, var(--c-2), #67e8f9); box-shadow: 0 6px 20px rgba(34, 211, 238, .25); }
    #btn-blind { color: var(--c-2); background: rgba(34, 211, 238, .1); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .45); }
}
