@import url("https://fonts.googleapis.com/css?family=Press+Start+2P&display=swap");

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

body {
    font-family: "Press Start 2P", sans-serif;
    color: #333;
    background-color: #2d8652;
    min-height: 100vh;
}

h1 {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: #fff;
}

header {
    position: relative;
    height: 350px;
    border-bottom: 7px solid #eee;
    background-color: #222;
}

.between {
    position: absolute;
    text-align: right;
    top: 20px;
    right: 20px;
    font-size: 1rem;
    color: #eee;
}

.btn {
    margin-top: 20px;
    margin-left: 20px;
    border: none;
    font-family: inherit;
    font-size: 1.2rem;
    padding: 15px 25px;
    cursor: pointer;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    text-align: center;
    border-radius: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.4);
    background: linear-gradient(45deg, #2980b9, #1f4d73);
}

.number {
    position: absolute;
    left: 50%;
    width: 150px;
    bottom: 0;
    padding: 20px;
    background: #333;
    color: #fff;
    font-size: 3.5rem;
    text-align: center;
    transform: translate(-50%, 50%);
    border-radius: 10px;
    border: 3px solid #555;
    box-shadow: 0 0 0 1px #000;
}

main {
    flex: 1;
    padding: 40px 20px;
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 40px;
    min-height: 400px;
    background-color: #e74c3c;
    color: #fff;
}

.right {
    width: 400px;
    font-size: 1rem;
}

.left {
    width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.input-container {
    background: rgba(0, 0, 0, 0.8);
    padding: 30px;
    border-radius: 10px;
    border: 4px solid #000;
    width: 100%;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.input-container label {
    display: block;
    margin-bottom: 15px;
    font-size: 1rem;
    font-weight: bold;
    color: #0f0;
}

.guess {
    background: #000;
    border: 4px solid #0f0;
    font-family: inherit;
    color: #0f0;
    font-size: 2rem;
    text-align: center;
    width: 100%;
    display: block;
    margin-bottom: 25px;
    padding: 20px;
    border-radius: 5px;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.1);
}

.guess:focus {
    outline: none;
    border-color: #fff;
    color: #fff;
    background: #111;
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.2);
}

.guess::placeholder {
    color: #666;
    font-size: 0.8rem;
}

.game-info {
    background: rgba(0, 0, 0, 0.8);
    padding: 25px;
    border-radius: 10px;
    border: 4px solid #000;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.msg {
    margin-bottom: 30px;
    font-size: 1rem;
    color: #ffff00;
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 5px;
    border: 2px solid #ffff00;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.3);
}

.score-container {
    margin-bottom: 20px;
}

.score-label,
.top-score-label,
.attempts-label {
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #0ff;
}

.score-label span,
.top-score-label span,
.attempts-label span {
    color: #ff0;
    font-weight: bold;
}

.top-score-label span {
    color: #ff6b00;
}

.attempts-label span {
    color: #f00;
}

.quick-instructions {
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 10px;
    border: 4px solid #000;
    margin-top: 20px;
}

.quick-instructions h3 {
    color: #0f0;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.quick-instructions ul {
    list-style: none;
}

.quick-instructions li {
    color: #0ff;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.quick-instructions li:before {
    content: ">";
    color: #0f0;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Modal */
.instructions-modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.5s ease-out;
}

.modal-content {
    background: linear-gradient(145deg, #1a1a1a, #333);
    margin: auto;
    padding: 0;
    border-radius: 5px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.3);
    border: 4px solid #0f0;
    animation: slideIn 0.5s ease-out;
}

.modal-header {
    background: linear-gradient(90deg, #000, #333);
    padding: 20px;
    border-radius: 0;
    border-bottom: 3px solid #0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #0f0;
    font-size: 1.2rem;
    margin: 0;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.close-modal {
    color: #f00;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.close-modal:hover {
    transform: scale(1.2);
    color: #ff4444;
}

.modal-body {
    padding: 30px;
}

.instruction-item {
    display: block;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 5px;
    border: 2px solid #555;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.text h3 {
    color: #0ff;
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.text p {
    color: #ccc;
    line-height: 1.6;
    font-size: 0.8rem;
}

.modal-footer {
    padding: 20px 30px 30px;
    text-align: center;
}

.btn-start-game {
    background: linear-gradient(45deg, #00ff00, #00cc00);
    border: 3px solid #000;
    color: #000;
    font-size: 1rem;
    font-weight: bold;
    padding: 15px 40px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
    font-family: "Press Start 2P", sans-serif;
}

.btn-start-game:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
    background: linear-gradient(45deg, #33ff33, #00ff00);
}

/* Game container styling */
.game-container {
    display: flex;
    flex-direction: column;
}

.game-container.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .instruction-item {
        text-align: center;
    }

    main {
        flex-direction: column;
        gap: 30px;
    }

    .left,
    .right {
        width: 100%;
    }

    h1 {
        font-size: 1.5rem;
    }

    .guess {
        font-size: 1.5rem;
        padding: 15px;
    }

    .btn {
        font-size: 1rem;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .modal-body {
        padding: 20px;
    }

    .input-container {
        padding: 20px;
    }

    header {
        height: 280px;
    }

    h1 {
        font-size: 1.2rem;
    }

    .number {
        width: 120px;
        font-size: 2.5rem;
        padding: 15px;
    }
}

/* Animation Improvements */
body.winning {
    background-color: #27ae60;
}

body.losing {
    background-color: #e74c3c;
}

body.default {
    background-color: #2d8652;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }
    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

@keyframes celebrate {
    0% {
        transform: translate(-50%, 50%) scale(1);
    }
    50% {
        transform: translate(-50%, 50%) scale(1.2) rotate(5deg);
    }
    100% {
        transform: translate(-50%, 50%) scale(1);
    }
}

@keyframes feedbackFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -70%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -120%) scale(0.8);
    }
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) translate(var(--random-x) px, 0)
            rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, 100vh) translate(var(--random-x) px, 0)
            rotate(var(--random-rotate) deg);
    }
}

.msg.success {
    background: rgba(0, 255, 0, 0.1);
    border-color: #0f0;
    color: #0f0;
}

.msg.error {
    background: rgba(255, 0, 0, 0.1);
    border-color: #f00;
    color: #f00;
}

.msg.warning {
    background: rgba(255, 255, 0, 0.1);
    border-color: #ff0;
    color: #ff0;
}

.msg.info {
    background: rgba(0, 255, 255, 0.1);
    border-color: #0ff;
    color: #0ff;
}
