:root {
    --background-color: #FC926E;
    --card-width: 512px;
    --card-height: 512px;
    --mobile-padding: 10px;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    padding: var(--mobile-padding);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: min(var(--card-width), 100%);
    padding: var(--mobile-padding);
    box-sizing: border-box;
}

.input-section {
    width: 100%;
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

#wordInput {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    min-height: 44px;
}

.card {
    width: 100%;
    max-width: min(var(--card-width), calc(100vw - 2 * var(--mobile-padding)));
    height: auto;
    aspect-ratio: 1;
    perspective: 1000px;
    margin: 10px 0;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 16px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 15px;
    box-sizing: border-box;
}

.card-front {
    background-image: url('../images/card_front.png');
}

.card-back {
    background-image: url('../images/card_back.png');
    transform: rotateY(180deg);
}

#readyButton {
    position: absolute;
    top: 20%;
    right: 20%;
    padding: 12px 24px;
    min-height: 44px;
    font-size: 16px;
}

.button-section {
    display: flex;
    gap: 10px;
    width: 100%;
    flex-direction: column;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 16px;
    min-height: 44px;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #f0f0f0;
}

button:active {
    transform: translateY(1px);
}

#completionMessage {
    text-align: center;
    width: 100%;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    margin-top: 20px;
}

.hidden {
    display: none;
}

h2 {
    font-size: clamp(16px, 5vw, 20px);
    font-style: italic;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

p {
    font-size: clamp(18px, 6vw, 24px);
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    padding: 0 10px;
    word-wrap: break-word;
    margin: 0;
}

#englishText {
    color: navy;
}

/* Tablet and larger devices */
@media (min-width: 768px) {
    .input-section {
        flex-direction: row;
    }
    
    .button-section {
        flex-direction: row;
        justify-content: center;
    }
    
    button {
        width: auto;
    }
}

/* Small mobile devices */
@media (max-width: 320px) {
    body {
        padding: 5px;
    }
    
    .container {
        padding: 5px;
    }
    
    h2 {
        font-size: 14px;
    }
    
    p {
        font-size: 16px;
    }
    
    button {
        padding: 10px 16px;
    }
}