body {
    color: #555;
    font-family: 'Roboto', sans-serif;
    font-size: 1em;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

main {
    margin: auto;
    max-width: 1200px;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

.resultListDiv {
    display: flex;
    flex-direction: column;
    margin: auto;
    width: fit-content;
}

.resultListDiv > div {
    margin: .5em;
    display: flex;

    align-items: center;
    box-shadow: 1px 1px 2px lightslategray;
}

.resultListDiv > div:hover {
    background-color: #DDD;
}

.user-view .oxftTabsContainer {
    display: none;
}

.chartDiv {
    margin: 0;
    background-color: rgba(0, 0, 0, .5);
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    /* align-items: center; */
    justify-content: center;
}

.chartDiv > div {
    /* margin: auto; */
    /* max-width: 80vw; */
    /* max-height: 90vh; */
    width: 80vw;
    box-shadow: 4px 4px 8px #000;
    background-color: #FFF;
    border-radius: 8px;
    overflow: auto;
    position: relative;
}

.resultListDiv > div div {
    margin: 0 1em;
    padding: 0 .2em;
    flex-grow: 1;
}

section {
    padding: .2em;
    border-radius: 4px;
    box-shadow: 2px 2px 4px lightslategray;
    max-width: 100%;
    margin: auto;
    box-sizing: border-box;
}

h1 {
    text-align: center;
    font-size: 1.5em;
    color: lightslategray;
}

h2 {
    text-align: center;
    font-size: 1.3em;
    font-weight: normal;
}

ol {
    padding-inline-start: 1.5em;
}


input {
    font-size: 1em;
}

div {
    text-align: center;
}

button:hover {
    cursor: pointer;
}

button {
    display: inline;
    font-size: 1em;
    font-weight: bolder;
    padding: .5em;
    margin: .5em;
    border-radius: .5em;
    background: lightslategray;
    box-shadow: 2px 2px 4px lightslategray;
    color: white;
    border: 0;
    min-height: 44px; /* Минимальный размер для касания */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    cursor: pointer;
}

button:disabled {
    color: #777;
    background-color: #333;
}


.inputForm ul {
    padding: 0;
    margin: .5em;
}

.inputForm li div {
    margin: 0;
}

.inputForm li {
    display: flex;
    list-style: none;
    margin: 1em .3em;
}

.inputForm li > input {
    flex: 1;
    padding: .2em;
}

.inputForm li > input[type="radio"] {
    flex: none;
    min-width: 20px;
    min-height: 20px;
    margin-right: 0.5em;
}

.inputForm li label {
    display: flex;
    padding-right: .5em;
    min-width: 90px;;
}


/* Стили для альтернативного вида результатов */
.oxftAltResults {
    display: flex;
    flex-direction: column;
    gap: 0px;
    /*margin: 20px 0;*/
    padding: 20px 20px;
}

.oxftAltHeader {
    text-align: center;
    border-bottom: 2px solid #eee;
    margin-bottom: 10px;
}

/* Стили для табов */
.oxftTabsContainer {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 44px;
    align-items: center;
}

.oxftTab {
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #666;
    flex-shrink: 0;
    white-space: nowrap;
    min-width: 100px;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

.oxftTab:hover {
    color: #333;
    background-color: #f5f5f5;
}

.oxftTabActive {
    color: #007bff;
    border-bottom-color: #007bff;
    font-weight: bold;
}

/* Стили для таблицы */
.oxftResultsTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.oxftResultsTable th,
.oxftResultsTable td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.oxftResultsTable th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
}

.oxftResultsTable tr:hover {
    background-color: #f5f5f5;
}

svg.oxftSVGChart {
    max-height: 80vh;
}

/* Стили для SVG графика */
.oxftSVGChartDiv {
    width: 100%;
    /* height: 700px; */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #fff;
    box-sizing: border-box;
}

.manicMarker div {
    background: yellow;
    background: repeating-linear-gradient(
            -55deg,
            #ffea47,
            #faf5c2 5px,
            #ffea47 5px,
            #faf5c2 10px
    );
}

.shadow {
    -webkit-filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, .7));
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, .7));
    /* Similar syntax to box-shadow */
}

.shadow-hard {
    -webkit-filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.7));
    filter: drop-shadow(1px 1px 1px rgba(255, 255, 254, 1));
}

.oxftSVGChart {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.point:hover {
    cursor: pointer;
}

.oxftDataPoint {
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.oxftDataPoint:hover {
    r: 8;
    stroke-width: 3;
}

/* Улучшение для мобильных касаний */
@media (hover: none) and (pointer: coarse) {
    .oxftDataPoint:hover {
        r: 6;
        stroke-width: 2;
    }

    .oxftDataPoint:active {
        r: 8;
        stroke-width: 3;
    }
}

.oxftChartLine {
    pointer-events: none;
}

.oxftDataLine {
    pointer-events: none;
}

/* Стили для зон 1-4 */
.oxftZone-1 {
    fill: #5cb85c; /* зеленый */
}

.oxftZone-2 {
    fill: #5bc0de; /* голубой */
}

.oxftZone-3 {
    fill: #f0ad4e; /* желтый */
}

.oxftZone-4 {
    fill: #d9534f; /* красный */
}

/* Стили для SVG групп */
.oxftGridGroup {
    /* Сетка - базовый слой */
    opacity: 0.8;
}

.oxftYAxisGroup {
    /* Подписи Y-оси */
    font-family: Arial, sans-serif;
}

.oxftXAxisGroup {
    /* Подписи X-оси */
    font-family: Arial, sans-serif;
}

.oxftChartGroup {
    /* Линии графика */
    pointer-events: none;
}

.oxftDataGroup {
    /* Точки данных и их значения */
    pointer-events: all;
}

/* Стили для подписей зон */
.oxftPosLabel {
    /* Положительные характеристики сверху */
    word-break: break-word;
    white-space: normal;
    text-anchor: middle;
    dominant-baseline: middle;
}

.oxftNegLabel {
    /* Негативные характеристики снизу */
    word-break: break-word;
    white-space: normal;
    text-anchor: middle;
    dominant-baseline: middle;
}

/* Стили для старого графика (оставляем для совместимости) */
.oxftOldChartDiv {
    width: 100%;
    height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.oxftOldChartDiv svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

svg text {
    white-space: pre;
    word-break: break-word;
}

/* Стили для лейблов в SVG графике */
.chart-label-top,
.chart-label-bottom {
    word-break: break-word;
    white-space: normal;
    text-anchor: middle;
    dominant-baseline: middle;
}

.chart-label-top {
    fill: #2e7d32 !important;
    font-weight: bold;
    font-size: 9px;
}

.chart-label-bottom {
    fill: #d32f2f !important;
    font-weight: bold;
    font-size: 9px;
}

.oxftAltRow {
    display: grid;
    grid-template-columns: 1fr 11fr;
    gap: 10px;
    margin: 0 !important;
}

.oxftAltResults > * {
    margin: 0 !important;
}

.oxftAltLeft {
    padding: 10px;
    border-right: 1px solid #ddd;
}

.oxftAltRight {
    padding: 10px;
}

.oxftHBarContainer {
    position: relative;
    margin: 10px 0;
}

.oxftHBarContainer * {
    margin: 0 !important;
}

.oxftAltResults h3 {
    margin: 0;
}

.oxftHBarTrack {
    position: relative;
    height: 20px;
    background: #f0f0f0;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin: 0 !important;
    width: 100%;
}

/* Блоки зон в дорожке */
.oxftHBarZone {
    position: absolute;
    top: 0;
    height: 100%;
    opacity: 0.3;
    border-radius: 2px;
}

.oxftHBarZone-1 {
    background: linear-gradient(90deg, #5cb85c, #449d44); /* зеленый градиент - зона 1 (71-100) */
}

.oxftHBarZone-2 {
    background: linear-gradient(90deg, #5bc0de, #31b0d5); /* голубой градиент - зона 2 (21-70) */
}

.oxftHBarZone-3 {
    background: linear-gradient(90deg, #f0ad4e, #ec971f); /* желтый градиент - зона 3 (-40 до 20) */
}

.oxftHBarZone-4 {
    background: linear-gradient(90deg, #d9534f, #c9302c); /* красный градиент - зона 4 (-100 до -41) */
}

.oxftHBarMarker {
    position: absolute;
    top: -5px;
    width: 40px;
    height: 26px;
    background: #fff;
    border-radius: 3px;
    margin: 0 !important;
    border: 1px solid #d5d5d5;
    box-shadow: 1px 1px 0 #a7a7a7;

}

.oxftHBarMarker > div {
    white-space: nowrap;
    z-index: 10;
}

/* Стили для значения в маркере */
.oxftHBarValue {
    position: relative;
    font-weight: bold;
    color: #333;
    background: white;
    padding: 2px 4px;
    white-space: nowrap;
    z-index: 10;
    text-align: center;
}

/* Стили для подписей дорожки */
.topTrackLabel {
    position: absolute;
    font-size: 10px;
    color: #666;
    font-weight: normal;
}

.bottomTrackLabel {
    position: absolute;
    font-size: 10px;
    color: #666;
    font-weight: normal;
}

/* Позиционирование меток трека */
.topTrackLabel.left {
    left: 0;
    top: -16px;
}

.topTrackLabel.right {
    right: 0;
    top: -16px;
}

.topTrackLabel.middle {
    left: 49.5%;
    top: -16px;
}

.bottomTrackLabel.left {
    left: 0;
    top: 24px;
}

.bottomTrackLabel.right {
    right: 0;
    top: 24px;
}

/* Стили для качеств в альтернативном виде */
.oxftQualityPositive {
    color: #2e7d32;
    font-weight: bold;
}

.oxftQualityNegative {
    color: #d32f2f;
    font-weight: bold;
}

.oxftHBarTick {
    position: absolute;
    width: 1px;
    height: 20px;
    background: #ccc;
    margin: 0 !important;
}

.oxftHBarTick:nth-child(5n) {
    height: 18px;
    background: #999;
}

/* Стили для подписей дорожки */
.oxftHBarTrack > div[style*="position: absolute"] {
    font-size: 10px !important;
    color: #666 !important;
    font-weight: normal !important;
}

/* Дополнительные стили для элементов результатов */
.oxftResultDiv {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.oxftPointsDiv, .oxftPercentsDiv {
    flex: 1;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
}

.oxftChartDiv, .oxftAltDiv {
    /*margin: 20px 0;*/
}

.oxftQuestionCounter {
    padding: 8px;
}

.oxftQuestion {
    margin: 4px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

.oxftQuestionText {
    font-size: 1.1em;
    margin-bottom: 20px;
    line-height: 1.5;
}

.oxftQuestionButtons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Медиа-запросы для адаптивности */

/* Планшеты и маленькие ноутбуки */
@media (max-width: 1024px) {
    main {
        padding: 0 15px;
    }

    .oxftSVGChartDiv {
        /*height: 500px;*/
    }

    .oxftAltRow {
        grid-template-columns: 1fr 3fr;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    body {
        font-size: 0.9em;
    }

    main {
        padding: 0 10px;
    }

    h1 {
        font-size: 1.3em;
        margin: 0.5em 0;
    }

    h2 {
        font-size: 1.1em;
    }

    section {
        padding: 0.5em;
        margin: 0.5em 0;
    }

    /* Формы для мобильных */
    .inputForm li {
        flex-direction: column;
        align-items: stretch;
        margin: 0.5em 0;
    }

    /* Специальные стили для радиокнопок на мобильных */
    .inputForm li:has(input[type="radio"]) {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5em;
    }

    .inputForm li label {
        min-width: auto;
        margin-bottom: 0.3em;
        padding-right: 0;
    }

    /* Лейблы для радиокнопок на мобильных */
    .inputForm li:has(input[type="radio"]) label {
        margin-bottom: 0;
        padding-right: 0.5em;
        min-width: auto;
        flex-shrink: 0;
    }

    .inputForm li > input {
        padding: 0.5em;
        font-size: 16px; /* Предотвращает зум на iOS */
    }

    /* Радиокнопки на мобильных */
    .inputForm li > input[type="radio"] {
        flex: none;
        min-width: 24px;
        min-height: 24px;
        margin-right: 0.5em;
        margin-bottom: 0;
    }

    /* Кнопки для мобильных */
    .oxftQuestionButtons button {
        width: 100%;
        margin: 0.3em 0;
        padding: 0.8em;
        font-size: 1.1em;
    }

    .oxftQuestionButtons {
        flex-direction: column;
        gap: 5px;
    }

    .oxftQuestionButtons button {
        width: 100%;
        margin: 0.2em 0;
    }

    /* Таблицы для мобильных */
    .oxftResultsTable {
        font-size: 0.8em;
    }

    .oxftResultsTable th,
    .oxftResultsTable td {
        padding: 8px 4px;
    }

    /* Графики для мобильных */
    .oxftSVGChartDiv {
        /*height: 400px;*/
    }

    .oxftAltRow {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .oxftAltLeft {
        border-right: none;
        border-bottom: 1px solid #ddd;
        padding: 5px;
    }

    .oxftAltRight {
        padding: 5px;
    }

    /* Модальные окна для мобильных */
    .chartDiv > div {
        max-width: 95vw;
        max-height: 95vh;
        width: 95vw;
        margin: 2.5vh auto;
    }

    /* Табы для мобильных */
    .oxftTabsContainer {
        flex-wrap: nowrap;
        gap: 2px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 60px;
        justify-content: flex-start;
    }

    .oxftTab {
        padding: 6px 8px;
        font-size: 11px;
        flex-shrink: 0;
        min-width: 100px;
        white-space: nowrap;
        width: auto;
        display: inline-flex;
    }
}

/* Очень маленькие экраны (iPhone SE и подобные) */
@media (max-width: 480px) {
    body {
        font-size: 0.85em;
    }

    main {
        padding: 0 5px;
    }

    h1 {
        font-size: 1.2em;
    }

    h2 {
        font-size: 1em;
    }

    section {
        padding: 0.3em;
        margin: 0.3em 0;
    }

    /* Радиокнопки на очень маленьких экранах */
    .inputForm li > input[type="radio"] {
        min-width: 20px;
        min-height: 20px;
    }

    .oxftSVGChartDiv {
        height: 300px;
    }

    .oxftResultsTable {
        font-size: 0.7em;
    }

    .oxftResultsTable th,
    .oxftResultsTable td {
        padding: 6px 2px;
    }

    .oxftTab {
        padding: 6px 8px;
        font-size: 11px;
    }

    .oxftHBarMarker {
        width: 30px;
        height: 20px;
    }

    .oxftHBarValue {
        font-size: 0.8em;
        padding: 1px 2px;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .oxftSVGChartDiv {
        height: 250px;
    }

    .chartDiv > div {
        max-height: 90vh;
    }
}

/* Высокие экраны (iPhone X и новее) */
@media (max-width: 768px) and (min-height: 800px) {
    .oxftSVGChartDiv {
        /* height: 450px; */
    }
}

/* Специальные стили для iPhone */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari */
    body {
        -webkit-overflow-scrolling: touch;
    }

    .oxftSVGChartDiv {
        -webkit-overflow-scrolling: touch;
    }

    input, textarea, select {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 0;
    }

    button {
        -webkit-appearance: none;
        appearance: none;
    }
}

/* Предотвращение зума на iOS при фокусе на input */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select, textarea, input[type="text"], input[type="password"],
    input[type="datetime"], input[type="datetime-local"],
    input[type="date"], input[type="month"], input[type="time"],
    input[type="week"], input[type="number"], input[type="email"],
    input[type="url"], input[type="search"], input[type="tel"],
    input[type="color"] {
        font-size: 16px !important;
    }
}

/* Улучшение для устройств с маленьким экраном */
@media (max-width: 320px) {
    body {
        font-size: 0.8em;
    }

    main {
        padding: 0 3px;
    }

    .oxftSVGChartDiv {
        /*height: 250px;*/
    }

    /* Радиокнопки на самых маленьких экранах */
    .inputForm li > input[type="radio"] {
        min-width: 18px;
        min-height: 18px;
    }

    .oxftResultsTable {
        font-size: 0.65em;
    }

    .oxftTabsContainer {
        min-height: 60px;
        gap: 1px;
    }

    .oxftTab {
        padding: 4px 6px;
        font-size: 10px;
        flex-shrink: 0;
        white-space: nowrap;
    }
}

@media print {
    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background-color: #fff;
    }

    body > *:not(#chartDiv) {
        display: none;
    }

    body.user-view > main {
        display: block !important;
    }

    .oxftTabsContainer {
        display: none;
    }

    #oxftQuestionButtons {
        display: none;
    }

    .container {
        padding: 10px;
    }

    .oxftAltResults {
        margin: 0;
        padding: 20px;
    }

    .oxftSVGChartDiv {
        min-width: 60vw;
        max-height: 80vh;
    }

    .oxftAltRow .oxftAltRight {
        padding: 10px 0px 0px;
    }

    .oxftAltLeft {
        padding: 0;
    }


    .chartDiv {
        padding: 0;
        margin:0;

    }

    .chartDiv > div {
        width: 100%;
    }

    .container {
        padding: 10px;
    }

    .oxftAltHeader > div {
        margin: 0px;
    }

}
