body {
    font-family: 'Arial', sans-serif;
    background-color: #f7f4f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    margin: 0;
    padding: 20px;
    background-image: linear-gradient(135deg, #f7f4f0 0%, #e8e3dc 100%);
}

.container {
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 30px;
    width: 320px;
    max-width: 90vw;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.container:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

.container h1 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #323232;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.container img {
    width: 180px;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}

.container form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-group {
    position: relative;
    width: 100%;
    margin-bottom: 6px;
}

.container input {
    width: 100%;
    padding: 14px 16px;
    margin: 0;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 15px;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.container input:focus {
    outline: none;
    border-color: #a5cdab;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(165, 205, 171, 0.2);
}

.container input:valid {
    border-color: #d0e6d4;
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #777;
    user-select: none;
    font-size: 18px;
    transition: color 0.2s ease;
    padding: 4px;
    border-radius: 4px;
}

.password-toggle:hover {
    color: #5a8f69;
    background-color: rgba(90, 143, 105, 0.1);
}

.container button {
    width: 100%;
    padding: 14px;
    background-color: #a5cdab;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(165, 205, 171, 0.3);
    position: relative;
    overflow: hidden;
}

.container button:hover {
    background-color: #8db694;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(165, 205, 171, 0.4);
}

.container button:active {
    transform: translateY(0);
}

.container button:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.error {
    color: #e74c3c;
    margin-top: 10px;
    display: none;
    font-size: 14px;
    text-align: left;
    width: 92%;
    padding: 8px 12px;
    background-color: #fdf0ef;
    border-radius: 6px;
    border-left: 4px solid #e74c3c;
}

.success {
    color: #27ae60;
    margin-top: 10px;
    display: none;
    font-size: 14px;
    padding: 8px 12px;
    background-color: #f0f9f4;
    border-radius: 6px;
    border-left: 4px solid #27ae60;
    width: 92%;
    box-sizing: border-box;
}

.links {
    margin-top: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.links a {
    color: #5a8f69;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    padding: 6px 0;
    border-radius: 6px;
}

.links a:hover {
    text-decoration: none;
    background-color: rgba(90, 143, 105, 0.1);
    padding: 6px 12px;
}

.form-section {
    display: none;
    width: 100%;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.active {
    display: block;
}

.back-link {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #5a8f69;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.back-link:hover {
    text-decoration: none;
    background-color: rgba(90, 143, 105, 0.1);
    padding: 6px 12px;
}

.terms {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    margin: 20px 0;
    font-size: 13px;
    text-align: left;
    width: 100%;
    padding: 12px;
    background-color: #f9f9f9;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.4;
}

.terms input {
    width: auto;
    margin-right: 10px;
    margin-top: 3px;
    accent-color: #5a8f69;
    flex-shrink: 0;
}

.terms label {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.4;
}

.terms a {
    color: #5a8f69;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dashed #5a8f69;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.terms a:hover {
    border-bottom: 1px solid #5a8f69;
}

.validation-message {
    font-size: 12px;
    margin-top: 0px;
    margin-bottom: 6px;
    text-align: left;
    width: 100%;
    padding-left: 4px;
    display: none;
}

.valid {
    color: #27ae60;
}

.invalid {
    color: #e74c3c;
}

/* Модальное окно */
.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 ease;
    padding: 10px;
    box-sizing: border-box;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    animation: slideUp 0.4s ease;
    margin-top: 0px;
    margin-bottom: 0px;

}

.modal-header {
    padding: 20px 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    min-height: 50px;
    position: relative;
}

.modal-header h2 {
    margin: 0;
    flex: 1;
    color: #323232;
    font-weight: 600;
    font-size: clamp(16px, 4vw, 22px);
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding-right: 10px;
}

.close-modal {
    color: #aaa;
    font-size: clamp(20px, 6vw, 28px);
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
    width: clamp(30px, 8vw, 36px);
    height: clamp(30px, 8vw, 36px);
    min-width: 30px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: -5px;
    position: relative;
    z-index: 10;
}

.close-modal:hover {
    color: #000;
    background-color: #f0f0f0;
}

.modal-body {
    padding: 15px 20px 20px;
    max-height: calc(90vh - 70px);
    overflow-y: auto;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal h2 {
    margin-top: 0;
    color: #323232;
    font-weight: 600;
}

.modal-button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #a5cdab 0%, #97ba9c 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(165, 205, 171, 0.3);
    margin-top: 0px;
    margin-bottom: 30px;
}

.modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(165, 205, 171, 0.4);
}

.code-input-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 4px;
    width: 100%;
}

.code-input {
    flex: 1;
    min-width: 0;
    height: 50px;
    max-width: 50px;
    text-align: center;
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 600;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fafafa;
    transition: all 0.3s ease;
    box-sizing: border-box;
    padding: 8px 4px;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
    margin: 20px 0;
    width: 100%;
}

/* Адаптивность для очень маленьких экранов */
@media (max-width: 380px) {
    .code-input {
        height: 45px;
        max-width: 45px;
        font-size: clamp(14px, 3.5vw, 18px);
        padding: 6px 3px;
    }
}

@media (max-width: 320px) {
    .modal {
        padding: 5px;
    }
    
    .modal-content {
        width: 98%;
        margin: 2% auto;
    }
    
    .modal-header {
        padding: 15px 15px 0;
    }
    
    .modal-body {
        padding: 10px 15px 15px;
    }
    
    .code-input {
        height: 40px;
        max-width: 40px;
        font-size: clamp(12px, 3vw, 16px);
        padding: 5px 2px;
    }
}