.game-scene {
    width: 90%;
    max-width: 400px;
    min-height: 250px;
    perspective: 1000px;
    margin: 30px auto;
    position: relative;
}

.game-card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s, box-shadow 0.3s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.game-card:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.game-card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
    text-align: center;
    min-height: 250px;
}

.card-face-front {
    background-color: #ffffff;
    color: #2c3e50;
}

.card-face-front .speaker-icon svg {
    width: 48px;
    height: 48px;
    fill: #2c3e50;
}

.card-face-back {
    background-color: #f8f9fa;
    transform: rotateY(180deg);
}

.game-word {
    font-size: clamp(1.2rem, 5vw, 2.2rem);
    font-weight: bold;
    color: #2c3e50;
    word-break: break-word;
    margin-bottom: 10px;
}

.game-translation {
    font-size: clamp(1rem, 4vw, 1.8rem);
    color: #555;
    word-break: break-word;
}

.game-card .game-translation {
    font-size: clamp(1.2rem, 5vw, 2.2rem);
    font-weight: bold;
    color: #2c3e50;
    margin-top: 0;
}

.game-controls {
    text-align: center;
    margin-top: 20px;
}

.game-settings {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #ecf0f1;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    align-items: center;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group label {
    font-weight: bold;
    color: #2c3e50;
}

.setting-group.disabled-setting {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s;
}

.game-mode-selector {
    display: flex;
    background-color: #bdc3c7;
    border-radius: 8px;
    padding: 4px;
}

.game-mode-button {
    background: none;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: #2c3e50;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;
}

.game-mode-button.active {
    background-color: #ffffff;
    color: #3498db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.custom-select-wrapper {
    position: relative;
    width: 250px;
}

.custom-select-button {
    width: 100%;
    padding: 0 15px;
    height: 44px;
    box-sizing: border-box;
    background-color: #fff;
    border: 1px solid #bdc3c7;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.custom-select-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-arrow {
    transition: transform 0.3s;
}

.custom-select-wrapper.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 100%;
    background-color: #fff;
    border: 1px solid #bdc3c7;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}

.custom-select-option {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.custom-select-option:hover {
    background-color: #f0f2f5;
}

.custom-select-option input[type="checkbox"] {
    margin-right: 10px;
}

.custom-select-group-header {
    background-color: #f0f4f8;
    border-top: 1px solid #dfe6e9;
    border-left: 3px solid #95a5a6;
    font-weight: 700;
    color: #2c3e50;
    padding: 8px 15px 8px 12px;
}

.custom-select-group-header:first-child {
    border-top: none;
}

.custom-select-group-header:hover {
    background-color: #dde8f0;
}

.custom-select-sub-option {
    padding-left: 28px;
}

.game-word-front {
    font-size: clamp(1.2rem, 5vw, 2.2rem);
    font-weight: bold;
    color: #2c3e50;
    word-break: break-word;
}

@keyframes show {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.intro-animation {
    animation: show 0.5s ease-in-out;
}

@keyframes hide {
    from {
        transform: scale(1);
        opacity: 1;
    }

    to {
        transform: scale(0.5);
        opacity: 0;
    }
}

.hide-animation {
    animation: hide 0.5s ease-in-out;
}

.autoplay-setting {
    display: flex;
    align-items: center;
    gap: 12px;
}

.autoplay-setting label {
    cursor: pointer;
    user-select: none;
    color: #2c3e50;
}

#autoplayAudio {
    position: relative;
    width: 50px;
    height: 28px;
    -webkit-appearance: none;
    appearance: none;
    background-color: #bdc3c7;
    outline: none;
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#autoplayAudio::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

#autoplayAudio:checked {
    background-color: #3498db;
}

#autoplayAudio:checked::before {
    transform: translateX(22px);
}

/* ---- Study Type Selector ---- */

.study-type-selector {
    display: flex;
    background-color: #2c3e50;
    border-radius: 8px;
    padding: 4px;
}

.study-type-button {
    background: none;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    color: #ecf0f1;
    font-weight: 600;
    transition: background-color 0.3s, color 0.3s;
}

.study-type-button.active {
    background-color: #3498db;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.4);
}

/* ---- Progress Bar ---- */

.fc-progress {
    margin: 0 auto 10px auto;
    width: 90%;
    max-width: 400px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.fc-progress-text {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 6px;
    font-weight: 500;
}

.fc-progress-bar {
    height: 8px;
    background-color: #dfe6e9;
    border-radius: 4px;
    overflow: hidden;
}

.fc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ---- Remember / Forget Buttons ---- */

.game-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.fc-btn {
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.2s, box-shadow 0.2s;
    min-width: 150px;
    font-family: inherit;
    letter-spacing: 0.5px;
    user-select: none;
    touch-action: manipulation;
    color: #ffffff;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.fc-btn:active {
    transform: scale(0.96);
}

.fc-btn-remember {
    background-color: #27ae60;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.25);
}

.fc-btn-forget {
    background-color: #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.25);
}

@media (hover: hover) and (pointer: fine) {
    .fc-btn-remember:hover {
        background-color: #219a52;
        box-shadow: 0 6px 16px rgba(39, 174, 96, 0.4);
    }

    .fc-btn-forget:hover {
        background-color: #c0392b;
        box-shadow: 0 6px 16px rgba(231, 76, 60, 0.4);
    }
}

/* ---- Completion Block ---- */

.fc-complete {
    text-align: center;
    margin: 40px auto;
    max-width: 400px;
}

.fc-complete-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
}

.fc-reset-btn {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.fc-reset-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.mixed-badge {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #e67e22;
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mixed-badge.hidden {
    display: none;
}

/* ---- Mix Setting toggle ---- */

#mixWords {
    position: relative;
    width: 50px;
    height: 28px;
    -webkit-appearance: none;
    appearance: none;
    background-color: #bdc3c7;
    outline: none;
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#mixWords::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

#mixWords:checked {
    background-color: #3498db;
}

#mixWords:checked::before {
    transform: translateX(22px);
}

#shuffleWords {
    position: relative;
    width: 50px;
    height: 28px;
    -webkit-appearance: none;
    appearance: none;
    background-color: #bdc3c7;
    outline: none;
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#shuffleWords::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

#shuffleWords:checked {
    background-color: #3498db;
}

#shuffleWords:checked::before {
    transform: translateX(22px);
}

/* ---- Settings Modal ---- */
.settings-btn {
    background: #fff;
    border: 1px solid #bdc3c7;
    border-radius: 8px;
    padding: 0;
    height: 44px;
    width: 44px;
    box-sizing: border-box;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c3e50;
    transition: background-color 0.3s;
}

.settings-btn:hover {
    background-color: #f0f2f5;
}

.settings-btn svg {
    color: #34495e;
}

.settings-modal {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.settings-modal-content {
    background: #fff;
    border-radius: 14px;
    width: 90%;
    max-width: 340px;
    padding: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    animation: modalShow 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 12px;
}

.settings-modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: #2c3e50;
}

.settings-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    color: #95a5a6;
    transition: color 0.2s;
}

.settings-modal-close:hover {
    color: #e74c3c;
}

.settings-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-modal-body .setting-group {
    width: 100%;
    padding: 14px;
    background-color: #f8f9fa;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
}

@media (max-width: 768px) {
    .settings-modal {
        align-items: center;
        padding-top: 0; 
        /* On mobile, center completely to leave room for keyboard if ever added */
    }

    .settings-btn {
        min-width: 44px; /* Ensure button stays square on mobile */
    }
}

/* ---- Settings Actions ---- */
.settings-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.settings-action-btn {
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    color: white;
    width: 100%;
}

.settings-action-btn:hover {
    transform: translateY(-2px);
}

.settings-action-btn:active {
    transform: translateY(2px);
}

.btn-warning {
    background-color: #f39c12;
}

.btn-warning:hover {
    background-color: #d68910;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}