
/* Основные стили */
.box {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}

.hidden {
    display: none;
}

/* Секция с картинками словарей */
#image-section {
    padding: 20px;
}

.image-flex-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.image-item {
    text-align: center;
    cursor: pointer;
    flex: 0 0 auto;
    transition: transform 0.3s;
}

.image-item:hover {
    transform: scale(1.05);
}

.image-item img {
    width: 150px;
    height: 150px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid #0e122cc0;
    transition: all 0.3s;
}

.image-item p {
    margin-top: 10px;
    font-weight: 600;
    color: #0e122cc0;
}

/* Секция словаря */
#dictionary-section {
    padding: 20px;
}

.dictionary-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.left-panel {
    width: 100%;
    transition: all 0.3s ease;
}

.vocabulary-table {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0;
    border: 5px solid rgba(15, 5, 55, 0.61);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(17, 4, 81, 0.552);
    overflow: hidden;
}

.vocabulary-table th, 
.vocabulary-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    font-weight: 700;
    font-size: 24px;
}

.vocabulary-table th {
    background: linear-gradient(130deg, rgba(219, 234, 143, 0.482), rgba(155, 186, 102, 0.43), rgba(128, 222, 166, 0.373));
    color: rgb(51, 51, 51);
    position: sticky;
    top: 0;
}

.vocabulary-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.vocabulary-table tr:hover {
    background-color: #f1f1f1;
}

/* Общие стили для кнопок */
.completion-button {
    margin: 15px 0;
    padding: 15px 30px;
    background-color: #0e122cc0;
    color: white;
    border: 1px solid #000;
    border-radius: 25px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    width: auto;
    min-width: 200px;
    max-width: 100%;
    display: inline-block;
    text-align: center;
    height: 50px;
    line-height: 20px;
}

.completion-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
    border: 1px solid #000;
    background: linear-gradient(130deg, 
        rgba(219, 234, 143, 0.6), 
        rgba(155, 186, 102, 0.55), 
        rgba(128, 222, 166, 0.5));
}

.dictation-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    align-items: center;
}

/* Тренажер */
.trainer-box {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
    width: 100%;
}

.trainer {
    width: 100%;
    max-width: 400px;
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.trainer-card {
    width: 100%;
    height: 400px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    border: 1px solid #000;
    border-radius: 10px;
    background-color: white;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.word-img {
    display: flex;
    flex-direction: row;
    font-size: 28px;
    font-weight: 900;
    gap: 20px;
    text-align: center;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    margin-top: 10px;
}

.word-img>img {
    width: 40px;
    height: 40px;
    cursor: pointer;
}

/* Поле ввода */
#korean-input {
    width: 80%;
    max-width: 220px;
    height: 50px;
    margin: 20px auto;
    padding: 10px;
    font-size: 20px;
    font-weight: 700;
    border: 2px solid #ccc;
    border-radius: 5px;
    background: linear-gradient(130deg, rgba(219, 234, 143, 0.482), rgba(155, 186, 102, 0.43), rgba(128, 222, 166, 0.373));
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    display: block;
    text-align: center;
}

#korean-input:focus {
    outline: none;
    border-color: #c8ba8d;
    box-shadow: 0 0 5px rgba(200, 186, 141, 0.5);
}

/* Кнопки управления тренажером */
.top-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.trainer-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.trainer-controls button {
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
    backdrop-filter: blur(10px);
    padding: 5px;
}

.trainer-controls button:hover {
    transform: scale(1.1);
}

.trainer-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.trainer-controls button img {
    width: 40px;
    height: 40px;
}

/* Кнопки завершения */
.completion-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px auto;
    padding: 20px;
    width: 100%;
    max-width: 800px;
    flex-wrap: wrap;
}

/* Корзина с шариками */
.basket-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.basket {
    width: 110px;
    min-height: 275px;
    background: linear-gradient(135deg, rgba(168,237,234,0.7) 0%, rgba(254,214,227,0.7) 100%);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: space-around;
    padding: 5px;
    transition: all 0.3s ease;
}

.basket.horizontal {
    width: 275px;
    min-height: 110px;
    flex-direction: row;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: space-around;
}

.ball {
    width: 40px;
    height: 40px;
    background-image: url('/image/shar-ya.png');
    background-size: cover;
    transition: all 0.5s ease;
    transform: scale(0.1);
    animation: growBall 0.5s forwards;
    margin: 2px;
    opacity: 0.3;
}

.ball.active {
    opacity: 1;
}

/* Анимации */
@keyframes growBall {
    from { transform: scale(0.1); }
    to { transform: scale(1); }
}

@keyframes flip {
    0% { transform: rotateY(0); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0); }
}

.flip-effect {
    animation: flip 0.6s ease-out;
}

.flash-effect {
    animation: flash 0.5s;
}

@keyframes flash {
    0% { background-color: transparent; }
    50% { background-color: rgba(0, 255, 0, 0.2); }
    100% { background-color: transparent; }
}

.rolling-ball {
    position: absolute;
    width: 5px;
    height: 5px;
    background-image: url('/image/shar-ya.png');
    background-size: cover;
    animation: ballRoll 1.5s ease-in forwards;
    z-index: 10;
}

@keyframes ballRoll {
    0% { 
        transform: scale(0.1); 
        opacity: 1;
    }
    100% { 
        transform: scale(1); 
        opacity: 0;
    }
}

/* Медиазапросы для адаптации */
@media (max-width: 1440px) {
    .vocabulary-table th, 
    .vocabulary-table td {
        font-size: 22px;
        padding: 10px;
    }
    
    #korean-input {
        font-size: 18px;
    }
    
    .word-img {
        font-size: 24px;
    }
    
    .completion-button {
        padding: 12px 25px;
        font-size: 16px;
        min-width: 180px;
    }
}

@media (max-width: 1200px) {
    .trainer-box {
        flex-direction: column;
    }
    
    .basket {
        width: 90px;
    }
    
    .ball {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 1024px) {
    .image-item img {
        width: 120px;
        height: 120px;
    }
    
    .vocabulary-table {
        max-width: 95%;
    }
    
    /* .trainer-card {
        height: 350px;
    } */
    
    .completion-button {
        padding: 10px 20px;
        font-size: 15px;
        min-width: 160px;
    }
}

@media (max-width: 768px) {
    .image-flex-container {
        gap: 15px;
    }
    
    .image-item img {
        width: 100px;
        height: 100px;
    }
    
    .vocabulary-table th, 
    .vocabulary-table td {
        font-size: 18px;
        padding: 8px;
    }
    
    .dictation-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .completion-button {
        width: 100%;
        max-width: 250px;
    }
    
    /* .trainer-card {
        height: 320px;
        padding: 15px;
    } */
    
    .word-img {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    #korean-input {
        height: 45px;
        font-size: 18px;
    }
    
    .basket {
        width: 250px;
        min-height: 80px;
    }
    
    .top-controls {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .image-flex-container {
        flex-direction: column;
        align-items: center;
    }
    
    .image-item {
        margin-bottom: 15px;
    }
    
    .vocabulary-table {
        border-width: 3px;
        border-radius: 15px;
    }
    
    .vocabulary-table th, 
    .vocabulary-table td {
        font-size: 16px;
        padding: 6px;
    }
    
    /* .trainer-card {
        height: 300px;
    } */
    
    .word-img {
        font-size: 20px;
        flex-direction: column;
        gap: 10px;
    }
    
    #korean-input {
        width: 90%;
        font-size: 16px;
    }
    
    .completion-button {
        font-size: 14px;
        padding: 10px;
        min-width: 140px;
    }
    
    .completion-buttons {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 400px) {
    .vocabulary-table th, 
    .vocabulary-table td {
        font-size: 14px;
        padding: 4px;
    }
    
    .trainer-card {
        height: 400px;
        padding: 10px;
    }
    
    .word-img {
        font-size: 18px;
    }
    
    #korean-input {
        height: 40px;
        font-size: 15px;
    }
    
    .completion-button {
        font-size: 13px;
        padding: 8px 12px;
        min-width: 120px;
    }
    
    .basket {
        width: 200px;
    }
    
    .ball {
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 320px) {
    .vocabulary-table th, 
    .vocabulary-table td {
        font-size: 13px;
    }
    
    /* .trainer-card {
        height: 260px;
    } */
    
    .word-img {
        font-size: 16px;
    }
    
    #korean-input {
        font-size: 14px;
    }
    
    .completion-button {
        font-size: 12px;
        min-width: 110px;
    }
}
