/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Press Start 2P', cursive;
    background: #2d2d2d;
    background-image:
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Main container */
.container {
    background: #1a1a1a;
    padding: 40px;
    max-width: 450px;
    width: 100%;
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.3);
    border: 4px solid #000;
}

h1 {
    text-align: center;
    color: #00ff00;
    margin-bottom: 10px;
    font-size: 1.8em;
    text-shadow: 3px 3px 0px #000;
    letter-spacing: 2px;
}

.subtitle {
    text-align: center;
    color: #ffff00;
    margin-bottom: 30px;
    font-size: 0.5em;
    text-shadow: 2px 2px 0px #000;
    letter-spacing: 1px;
}

/* Display area for entered digits */
.display {
    background: #000;
    border: 4px solid #333;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    box-shadow: inset 4px 4px 0 rgba(0, 0, 0, 0.5);
}

.digit {
    font-size: 1.8em;
    font-weight: bold;
    color: #00ff00;
    flex: 1;
    text-align: center;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
}

/* Keypad grid */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

/* Keypad buttons - Pixel Block Style */
.key {
    background: #ff6b9d;
    color: #fff;
    border: none;
    padding: 25px;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.05s ease;
    box-shadow:
        inset -4px -4px 0 0 #d1527a,
        inset 4px 4px 0 0 #ff9dbf,
        4px 4px 0 0 #000;
    position: relative;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
    font-family: 'Press Start 2P', cursive;
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
}

/* Grid lines effect on buttons */
.key::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
    background-size: 8px 8px;
    pointer-events: none;
}

.key:hover {
    background: #ff85b3;
    box-shadow:
        inset -4px -4px 0 0 #e0628a,
        inset 4px 4px 0 0 #ffadd0,
        4px 4px 0 0 #000;
}

.key:active {
    transform: translate(2px, 2px);
    box-shadow:
        inset -4px -4px 0 0 #d1527a,
        inset 4px 4px 0 0 #ff9dbf,
        2px 2px 0 0 #000;
}

/* Clear button styling */
.key.clear {
    background: #ff4444;
    box-shadow:
        inset -4px -4px 0 0 #cc3333,
        inset 4px 4px 0 0 #ff6666,
        4px 4px 0 0 #000;
    font-size: 0.7em;
}

.key.clear:hover {
    background: #ff6666;
    box-shadow:
        inset -4px -4px 0 0 #dd4444,
        inset 4px 4px 0 0 #ff8888,
        4px 4px 0 0 #000;
}

.key.clear:active {
    box-shadow:
        inset -4px -4px 0 0 #cc3333,
        inset 4px 4px 0 0 #ff6666,
        2px 2px 0 0 #000;
}

/* Submit button styling */
.key.submit {
    background: #44ff44;
    color: #000;
    box-shadow:
        inset -4px -4px 0 0 #33cc33,
        inset 4px 4px 0 0 #66ff66,
        4px 4px 0 0 #000;
    font-size: 0.7em;
}

.key.submit:hover {
    background: #66ff66;
    box-shadow:
        inset -4px -4px 0 0 #44dd44,
        inset 4px 4px 0 0 #88ff88,
        4px 4px 0 0 #000;
}

.key.submit:active {
    box-shadow:
        inset -4px -4px 0 0 #33cc33,
        inset 4px 4px 0 0 #66ff66,
        2px 2px 0 0 #000;
}

/* Status message area */
.status {
    min-height: 40px;
    text-align: center;
    padding: 15px;
    font-weight: 500;
    transition: all 0.1s ease;
    border: 3px solid transparent;
    font-size: 0.6em;
    line-height: 1.6;
    letter-spacing: 1px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.status.success {
    background: #44ff44;
    color: #000;
    border-color: #000;
    box-shadow:
        inset -3px -3px 0 0 #33cc33,
        inset 3px 3px 0 0 #66ff66,
        4px 4px 0 0 #000;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.3);
}

.status.error {
    background: #ff4444;
    color: #fff;
    border-color: #000;
    box-shadow:
        inset -3px -3px 0 0 #cc3333,
        inset 3px 3px 0 0 #ff6666,
        4px 4px 0 0 #000;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.5);
    animation: shake 0.3s ease-in-out;
}

.status.info {
    background: #44ddff;
    color: #000;
    border-color: #000;
    box-shadow:
        inset -3px -3px 0 0 #33aacc,
        inset 3px 3px 0 0 #66eeff,
        4px 4px 0 0 #000;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.3);
}

@keyframes shake {

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

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        padding: 25px;
        max-width: 95%;
    }

    h1 {
        font-size: 1.3em;
        letter-spacing: 1px;
    }

    .subtitle {
        font-size: 0.45em;
    }

    .key {
        padding: 18px;
        font-size: 1.2em;
    }

    .key.clear,
    .key.submit {
        font-size: 0.6em;
    }

    .digit {
        font-size: 1.4em;
    }

    .status {
        font-size: 0.5em;
        padding: 12px;
    }

    .keypad {
        gap: 10px;
    }
}

@media (max-width: 360px) {
    h1 {
        font-size: 1.1em;
    }

    .subtitle {
        font-size: 0.4em;
    }

    .key {
        padding: 15px;
        font-size: 1em;
    }

    .key.clear,
    .key.submit {
        font-size: 0.55em;
    }
}