:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --background-color: #F7FFF7;
    --text-color: #292F36;
    --key-bg: #fff;
    --key-shadow: #d1d1d1;
    --slot-bg: #e0e0e0;
    --slot-border: #ccc;
    --success-color: #95E1D3;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Fredoka', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.game-container {
    text-align: center;
    width: 95%;
    max-width: 1000px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: 95vh;
}

header h1 {
    color: var(--primary-color);
    margin: 0.5rem 0;
    font-size: 2.5rem;
}

.subtitle {
    margin-top: 0;
    color: #666;
    font-size: 1.2rem;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
}

/* Loose Keys Area */
.loose-keys-area {
    background: rgba(255, 255, 255, 0.5);
    border: 3px dashed var(--secondary-color);
    border-radius: 15px;
    padding: 1.5rem;
    min-height: 120px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    align-content: center;
}

/* Keyboard Area */
.keyboard-wrapper {
    background: #f0f0f0;
    padding: 2rem;
    border-radius: 20px;
    border-bottom: 8px solid #ddd;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    display: inline-block;
    align-self: center;
}

.keyboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* Common Key Styles */
.key-base {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    user-select: none;
    box-sizing: border-box;
}

/* Key Sizes */
.key-1-5 {
    width: 60px;
}

.key-1-75 {
    width: 70px;
}

.key-2 {
    width: 80px;
}

.key-2-25 {
    width: 90px;
}

.key-2-75 {
    width: 110px;
}

.key-space {
    width: 240px;
}

.key-6 {
    width: 240px;
}

/* Alias for space if needed */

/* Draggable Key */
.key {
    background: var(--key-bg);
    border: 1px solid var(--key-shadow);
    border-bottom: 3px solid var(--key-shadow);
    cursor: grab;
    transition: transform 0.1s, box-shadow 0.1s;
    touch-action: none;
    z-index: 10;
    font-size: 0.9rem;
    /* Smaller font for fuller keyboard */
}

.key:active {
    cursor: grabbing;
}

.key.dragging {
    opacity: 0.5;
    transform: scale(1.1);
}

/* Empty Slot */
.key-slot {
    background: var(--slot-bg);
    border: 1px dashed var(--slot-border);
    color: rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 0.8rem;
}

.key-slot.hovered {
    background: #d4f7f2;
    border-color: var(--secondary-color);
}

/* Placed Key (inside slot) */
.key-slot .key {
    margin: -1px;
    cursor: default;
    background: var(--success-color);
    border-color: #76c7b9;
    border-bottom-color: #76c7b9;
    color: white;
    width: 100%;
    height: 100%;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dual Character Key Styling */
.key-dual {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px 6px;
    align-items: flex-start;
    line-height: 1;
    font-size: 0.8rem;
    width: 100%;
    height: 100%;
}

.key-dual span:last-child {
    align-self: flex-end;
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Victory Overlay */
.victory-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    z-index: 100;
}

.victory-overlay.hidden {
    display: none;
}

.victory-content {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    border: 5px solid var(--accent-color);
    animation: bounceIn 0.5s;
}

.victory-content h2 {
    font-size: 3rem;
    color: var(--primary-color);
    margin: 0;
}

.victory-content button {
    background: var(--secondary-color);
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: bold;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 1rem;
    transition: transform 0.2s;
}

.victory-content button:hover {
    transform: scale(1.05);
}

@keyframes bounceIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}