* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Улучшение рендеринга на мобильных */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Улучшение скролла на iOS */
body {
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
    body {
        padding: 20px;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

@media (min-width: 768px) {
    .container {
        border-radius: 20px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    }
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 15px;
    text-align: center;
}

.header h1 {
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
}

@media (min-width: 480px) {
    .header {
        padding: 30px 20px;
    }
    .header h1 {
        font-size: 22px;
    }
}

@media (min-width: 768px) {
    .header {
        padding: 40px 30px;
    }
    .header h1 {
        font-size: 28px;
        margin-bottom: 10px;
    }
}

.subtitle {
    font-size: 18px;
    opacity: 0.95;
    margin-bottom: 5px;
}

.subtitle-small {
    font-size: 14px;
    opacity: 0.85;
}

.main-content {
    padding: 20px 15px;
}

@media (min-width: 480px) {
    .main-content {
        padding: 30px 20px;
    }
}

@media (min-width: 768px) {
    .main-content {
        padding: 40px 30px;
    }
}

.step {
    display: none !important;
    animation: fadeIn 0.3s ease-in;
}

.step.active {
    display: block !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 18px;
    text-align: center;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
    line-height: 1.4;
}

@media (min-width: 480px) {
    .step h2 {
        font-size: 20px;
        margin-bottom: 25px;
        padding-bottom: 12px;
    }
}

@media (min-width: 768px) {
    .step h2 {
        font-size: 24px;
        margin-bottom: 30px;
        border-bottom: 3px solid #667eea;
        padding-bottom: 15px;
    }
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

@media (min-width: 480px) {
    .options-grid {
        gap: 18px;
        margin-bottom: 25px;
    }
}

@media (min-width: 768px) {
    .options-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
        margin-bottom: 30px;
    }
}

.option-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 80px;
    display: flex;
    flex-direction: column;
}

@media (min-width: 480px) {
    .option-card {
        padding: 20px;
        border-radius: 12px;
    }
}

@media (min-width: 768px) {
    .option-card {
        padding: 25px;
        min-height: auto;
    }
}

.option-card:hover,
.option-card:active {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

@media (min-width: 768px) {
    .option-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 25px rgba(102, 126, 234, 0.2);
    }
}

@media (max-width: 767px) {
    .option-card:active {
        transform: scale(0.98);
    }
}

.option-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.option-number {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

@media (min-width: 480px) {
    .option-number {
        width: 32px;
        height: 32px;
        font-size: 17px;
    }
}

@media (min-width: 768px) {
    .option-number {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

.option-card h3 {
    color: #333;
    font-size: 16px;
    margin-bottom: 8px;
    margin-right: 40px;
    line-height: 1.3;
    font-weight: 600;
}

.option-card p {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
}

@media (min-width: 480px) {
    .option-card h3 {
        font-size: 17px;
        margin-bottom: 9px;
        margin-right: 45px;
    }
    .option-card p {
        font-size: 13.5px;
    }
}

@media (min-width: 768px) {
    .option-card h3 {
        font-size: 18px;
        margin-bottom: 10px;
        margin-right: 50px;
    }
    .option-card p {
        font-size: 14px;
        line-height: 1.5;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
}

.form-group select,
.form-group input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px; /* Не уменьшаем для удобства на мобильных */
    transition: border-color 0.3s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: white;
    min-height: 44px; /* Минимальный размер для удобного нажатия */
}

@media (min-width: 768px) {
    .form-group {
        margin-bottom: 25px;
    }
    .form-group label {
        margin-bottom: 10px;
        font-size: 16px;
    }
}

.form-group select:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
}

.checkbox-group input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

@media (min-width: 768px) {
    .checkbox-group {
        align-items: center;
        margin-bottom: 15px;
        padding: 15px;
        min-height: auto;
    }
    .checkbox-group input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-top: 0;
    }
    .checkbox-group label {
        font-size: inherit;
    }
}

.checkbox-group:hover {
    background: #e9ecef;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.checkbox-group label {
    margin: 0;
    cursor: pointer;
    flex: 1;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

@media (min-width: 768px) {
    .navigation {
        flex-direction: row;
        justify-content: space-between;
        margin-top: 40px;
        padding-top: 30px;
        gap: 0;
    }
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px; /* Минимальный размер для удобного нажатия на мобильных */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 480px) {
    .btn {
        padding: 13px 25px;
        font-size: 15px;
    }
}

@media (min-width: 768px) {
    .btn {
        padding: 14px 30px;
        font-size: 16px;
        min-height: auto;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    margin-top: 25px;
}

.button-group .btn {
    width: 100%;
}

@media (min-width: 480px) {
    .button-group {
        flex-direction: row;
        gap: 15px;
        margin-top: 30px;
    }
    .button-group .btn {
        width: auto;
        flex: 1;
    }
}

@media (min-width: 768px) {
    .button-group .btn {
        flex: none;
    }
}

.result-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

@media (min-width: 768px) {
    .result-section {
        border-radius: 12px;
        padding: 30px;
    }
}

.result-section h2 {
    color: #667eea;
    margin-bottom: 25px;
}

.result-info {
    background: white;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 480px) {
    .result-info {
        padding: 20px;
        margin-bottom: 18px;
    }
}

@media (min-width: 768px) {
    .result-info {
        border-radius: 10px;
        padding: 25px;
        margin-bottom: 20px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
}

.result-info h3 {
    color: #667eea;
    margin-bottom: 12px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.4;
}

@media (min-width: 480px) {
    .result-info h3 {
        font-size: 18px;
        margin-bottom: 14px;
        gap: 10px;
    }
}

@media (min-width: 768px) {
    .result-info h3 {
        font-size: 20px;
        margin-bottom: 15px;
    }
}

.result-info .class-name {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 18px;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 12px;
    word-break: break-word;
}

@media (min-width: 480px) {
    .result-info .class-name {
        font-size: 20px;
        padding: 7px 18px;
        margin-bottom: 14px;
    }
}

@media (min-width: 768px) {
    .result-info .class-name {
        font-size: 24px;
        padding: 8px 20px;
        border-radius: 20px;
        margin-bottom: 15px;
    }
}

.result-info p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 8px;
    font-size: 14px;
    word-wrap: break-word;
}

@media (min-width: 768px) {
    .result-info p {
        line-height: 1.8;
        margin-bottom: 10px;
        font-size: inherit;
    }
}

.result-info ul {
    list-style: none;
    padding-left: 0;
}

.result-info ul li {
    padding: 10px 15px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.result-info ul li:before {
    content: "✓ ";
    color: #667eea;
    font-weight: bold;
    margin-right: 8px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 10px auto;
    padding: 20px;
    border-radius: 10px;
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideDown 0.3s;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 480px) {
    .modal-content {
        margin: 5% auto;
        padding: 25px;
        width: 90%;
    }
}

@media (min-width: 768px) {
    .modal-content {
        padding: 30px;
        border-radius: 15px;
        max-height: 80vh;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@media (min-width: 768px) {
    .close {
        right: 20px;
        top: 20px;
        font-size: 32px;
        width: auto;
        height: auto;
    }
}

.close:hover {
    color: #667eea;
}

.document-item {
    background: #f8f9fa;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.document-item h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.document-item p {
    color: #666;
    margin-bottom: 5px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
    font-size: 18px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #dc3545;
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 360px) {
    body {
        padding: 5px;
    }
    
    .header {
        padding: 15px 10px;
    }
    
    .header h1 {
        font-size: 16px;
    }
    
    .main-content {
        padding: 15px 10px;
    }
    
    .option-card {
        padding: 15px;
    }
    
    .option-card h3 {
        font-size: 15px;
        margin-right: 35px;
    }
    
    .option-number {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .btn {
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .result-info {
        padding: 15px;
    }
    
    .result-info .class-name {
        font-size: 16px;
        padding: 5px 14px;
    }
}

/* Улучшения для touch-устройств */
@media (hover: none) and (pointer: coarse) {
    .option-card:active {
        background: #e9ecef;
        transform: scale(0.98);
    }
    
    .btn:active {
        transform: scale(0.95);
        opacity: 0.9;
    }
}

/* Улучшение для планшетов */
@media (min-width: 768px) and (max-width: 1024px) {
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Улучшение для больших экранов */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .options-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
