:root {
    --ink: #172033;
    --muted: #667085;
    --line: #d9e1ea;
    --panel: #ffffff;
    --blue: #1677ff;
    --green: #14804a;
    --amber: #a15c00;
    --red: #b4232b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    padding: 28px;
    color: var(--ink);
    background: #f2f5f8;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

main { max-width: 1600px; margin: 0 auto; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 44px); }
h2 { margin-bottom: 16px; font-size: 18px; }
h3 { margin: 26px 0 8px; font-size: 16px; }

.hero { margin-bottom: 24px; }
.hero-row {
    display: flex;
    gap: 16px;
    align-items: baseline;
    justify-content: flex-start;
}
.hero .header-title {
    color: var(--muted);
}
.header-link {
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-decoration: none;
    text-transform: uppercase;
}
.header-link:hover,
.header-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.hero > p:last-child { max-width: 760px; color: var(--muted); }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.panel {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 8px 30px rgba(25, 42, 70, .05);
}

label {
    display: block;
    margin-bottom: 13px;
    color: var(--muted);
    font-size: 13px;
}

input, select {
    width: 100%;
    margin-top: 5px;
    padding: 10px 11px;
    border: 1px solid #c9d4e1;
    border-radius: 8px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}
input:disabled { color: #98a2b3; background: #eef2f6; cursor: not-allowed; }
.checkbox-field { display: flex; gap: 9px; align-items: center; }
.checkbox-field input { width: auto; margin: 0; }
.checkbox-field.disabled { color: #98a2b3; }
.tab-panel[hidden] { display: none; }
.module-advanced-link {
    display: inline-block;
    margin-bottom: 13px;
    color: var(--blue);
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}
.module-advanced-link:hover,
.module-advanced-link:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.label-row {
    display: flex;
    gap: 7px;
    align-items: center;
}
.field-with-info {
    margin-bottom: 13px;
    color: var(--muted);
    font-size: 13px;
}
.field-label { margin-bottom: 0; }
.checkbox-with-info {
    display: flex;
    gap: 7px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}
.checkbox-with-info .checkbox-field { margin-bottom: 0; }
.info-tooltip {
    display: inline-flex;
    position: relative;
}
.info-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #9bb8d9;
    border-radius: 50%;
    color: #315b85;
    background: #eaf3ff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: help;
}
.field-help {
    display: none;
    position: absolute;
    z-index: 20;
    top: 50%;
    left: calc(100% + 9px);
    transform: translateY(-50%);
    width: min(290px, 90vw);
    padding: 10px 12px;
    border: 1px solid #bfd2ea;
    border-radius: 10px;
    color: #21466d;
    background: #fff;
    box-shadow: 0 12px 32px rgba(25, 42, 70, .16);
    font-size: 12px;
    line-height: 1.45;
    pointer-events: none;
}
.field-help::after {
    content: "";
    position: absolute;
    left: -6px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-left: 1px solid #bfd2ea;
    border-bottom: 1px solid #bfd2ea;
    background: #fff;
    transform: translateY(-50%) rotate(45deg);
}
.info-button:hover + .field-help,
.info-button:focus-visible + .field-help,
.info-tooltip.is-visible .field-help {
    display: block;
}

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.three-column-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.three-column-grid > label,
.three-column-grid > .field-with-info {
    display: flex;
    flex-direction: column;
}
.three-column-grid > label > input,
.three-column-grid > label > select,
.three-column-grid > .field-with-info > input {
    margin-top: auto;
}
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.sensor-dimensions { margin: 2px 0 0; color: #315b85; font-size: 13px; font-weight: 700; }
.inline-output {
    margin-bottom: 13px;
    color: var(--muted);
    font-size: 13px;
}
.inline-output span { display: block; }
.inline-output strong {
    display: block;
    min-height: 39px;
    margin-top: 5px;
    padding: 10px 11px;
    border-radius: 8px;
    color: #315b85;
    background: #eaf3ff;
    font-size: 13px;
}

.result-panel { margin-top: 18px; }
.result-panel.status-ok { border-color: #94d2b3; }
.result-panel.status-warning { border-color: #efc06a; }
.result-panel.status-error { border-color: #e7a5aa; }
.result-panel [data-result-title] { margin-bottom: 10px; font-size: 24px; }
.result-description { min-height: 22px; }
.result-grid {
    display: grid;
    grid-template-columns: repeat(var(--result-card-count, 1), minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}
.result-card { padding: 13px; border-radius: 10px; background: #f5f7fa; }
.result-card.accent { background: #eaf3ff; }
.result-card.warning { color: #76510a; background: #fff4d8; }
.result-card span { display: block; min-height: 30px; color: var(--muted); font-size: 12px; }
.result-card.warning span { color: #76510a; }
.result-card strong {
    display: block;
    margin-top: 6px;
    overflow-wrap: anywhere;
    font-size: 17px;
}
.result-message-slot { min-height: 44px; }
.result-message { margin: 0; padding: 12px; border-radius: 9px; }
.result-message.warning { color: #76510a; background: #fff4d8; }
.result-message.error { color: #8f2930; background: #fdebed; }
.result-message.is-empty { visibility: hidden; }
.trajectory-panel { margin-top: 18px; }
.trajectory-panel > h2 { margin-bottom: 12px; }
#dynamic-scene {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfdff;
}
.trajectory-range-label { margin: 14px 0 3px; font-weight: 700; }
.trajectory-slider {
    position: relative;
    height: 30px;
}
.trajectory-track {
    position: absolute;
    z-index: 1;
    top: 11px;
    right: 9px;
    left: 9px;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #1677ff;
}
.trajectory-working-segment {
    position: absolute;
    top: 0;
    bottom: 0;
    background: #20a36a;
}
.trajectory-slider input[type="range"] {
    appearance: none;
    position: absolute;
    z-index: 2;
    inset: 0;
    width: 100%;
    height: 30px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: grab;
}
.trajectory-slider input[type="range"]:active { cursor: grabbing; }
.trajectory-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    background: transparent;
}
.trajectory-slider input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    margin-top: -6px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #172033;
    box-shadow: 0 1px 5px rgba(23, 32, 51, .35);
}
.trajectory-slider input[type="range"]::-moz-range-track {
    height: 8px;
    background: transparent;
}
.trajectory-slider input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #172033;
    box-shadow: 0 1px 5px rgba(23, 32, 51, .35);
}
.trajectory-endpoints,
.trajectory-legend {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
}
.trajectory-legend {
    justify-content: flex-start;
    margin-top: 12px;
}
.trajectory-legend span::before {
    content: "";
    display: inline-block;
    width: 22px;
    margin-right: 6px;
    border-top: 5px solid;
    border-radius: 999px;
    vertical-align: middle;
}
.trajectory-legend .available::before { border-color: #1677ff; }
.trajectory-legend .working::before { border-color: #20a36a; }

.demo-panel { margin-top: 18px; }
.demo-panel summary { cursor: pointer; font-size: 17px; font-weight: 750; }
.demo-panel[open] summary { margin-bottom: 12px; }
#scene { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.legend span::before { content: ""; display: inline-block; width: 22px; margin-right: 6px; border-top: 3px solid; vertical-align: middle; }
.legend .ray::before { border-color: #e5484d; }
.legend .axis::before { border-color: #1677ff; border-top-style: dashed; }
.legend .fov::before { border-color: #d98b00; border-top-style: dashed; }

@media (max-width: 1000px) {
    .settings-grid { grid-template-columns: 1fr; }
    .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    body { padding: 12px; }
    .field-grid, .result-grid { grid-template-columns: 1fr; }
}

/* ----- Дополнительные стили для двухколоночного макета (настройки слева, результаты справа) ----- */
.two-column-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.settings-column {
    flex: 1.2;
    min-width: 280px;
}
.results-column {
    flex: 2.2;
    min-width: 280px;
}
/* Отключаем старую трёхколоночную сетку в контексте новой разметки (если класс settings-grid не используется) */
.settings-grid {
    display: block;
}
.settings-column .panel {
    margin-bottom: 18px;
}
.results-column .result-panel {
    margin-top: 0;
}
@media (max-width: 880px) {
    .two-column-layout {
        flex-direction: column;
    }
}
