* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    color: white;
    text-align: center;
    padding: 20px;
    overflow-x: hidden;
    animation: gradientFlow 8s ease infinite;
    background-size: 100% 400%;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 0%;
    }

    50% {
        background-position: 0% 100%;
    }

    100% {
        background-position: 0% 0%;
    }
}

h1 {
    margin-bottom: 20px;
    font-size: 3rem;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    animation: titleBounce 2s ease-in-out infinite;
}

@keyframes titleBounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.winner-display {
    font-size: 2rem;
    color: #ffd700;
    margin-bottom: 20px;
    min-height: 40px;
    font-weight: bold;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.container {
    display: none;
    grid-template-columns: repeat(3, 150px);
    grid-template-rows: repeat(3, 150px);
    gap: 15px;
    margin: 30px auto;
    width: fit-content;
    animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

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

.cell {
    background: linear-gradient(145deg, #ff6b6b, #ee5a6f);
    border: 4px solid #fff;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: cellPop 0.5s ease;
}

@keyframes cellPop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.1);
    }

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

.cell:hover {
    background: linear-gradient(145deg, #4ecdc4, #44a3a0);
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.cell:active {
    transform: scale(0.95);
}

button {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    margin: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: buttonFloat 3s ease-in-out infinite;
}

@keyframes buttonFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

button:hover {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

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

dialog {
    border: 4px solid #f093fb;
    border-radius: 20px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
}

dialog[open] {
    animation: dialogSlide 0.4s ease;
}

@keyframes dialogSlide {
    from {
        transform: translate(-50%, -50%) translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) translateY(0);
        opacity: 1;
    }
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

fieldset {
    border: 3px solid #f093fb;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}

legend {
    font-size: 1.3rem;
    font-weight: bold;
    padding: 0 10px;
    color: #ffd700;
}

.row1,
.row2 {
    margin: 15px 0;
}

label {
    display: inline-block;
    width: 180px;
    text-align: right;
    margin-right: 10px;
    font-weight: bold;
}

input {
    padding: 10px;
    border: 3px solid #f093fb;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: #4facfe;
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.button-row {
    text-align: center;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    .container {
        grid-template-columns: repeat(3, 100px);
        grid-template-rows: repeat(3, 100px);
        gap: 10px;
    }

    .cell {
        font-size: 3rem;
        border-radius: 10px;
    }

    button {
        padding: 12px 24px;
        font-size: 1rem;
    }

    label {
        display: block;
        width: 100%;
        text-align: left;
        margin-bottom: 5px;
    }
}