@charset "windows-1251";

a.greenbutton { text-decoration:none;margin:1px;margin-right:0px;padding:5px;background: #d0f5d0; display:inline-block;box-sizing:border-box; text-decoration-skip-ink: none; COLOR: #004400; FONT-FAMILY: verdana,geneva,arial cyr,arial,helvetica,sans-serif; }
a.greenbutton:hover { text-decoration:underline;text-decoration-skip-ink: none; background:#c4f8c4; text-decoration-skip-ink: none; COLOR: #004400; FONT-FAMILY: verdana,geneva,arial cyr,arial,helvetica,sans-serif; }

:root {
    --bg-body: #f0fff0;
    --bg-light: #e0ffe0;
    --bg-medium: #d0eed0;
    --bg-dark: #d0f5d0;
    --text-primary: #003300;
    --text-secondary: #336633;
    --accent-green: #009900;
    --accent-dark-green: #006600;
    --danger: #990000;
    --border-color: #336633;
    --border-light: #66bb66;
    --glass-bg: rgba(208, 238, 208, 0.95);
    --shadow-green: rgba(0, 51, 0, 0.2);
}

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

.hidden {
    display: none !important;
}

body {
    background-color: var(--bg-body);
    font-family: verdana, geneva, arial cyr, arial, helvetica, sans-serif;
    font-size: 9pt;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.home-link {
    position: fixed;
    top: 20px;
    left: 20px;
    color: var(--accent-green);
    text-decoration: none;
    font-weight: bold;
    padding: 5px 10px;
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.home-link:hover {
    background: var(--bg-light);
    color: var(--accent-dark-green);
    text-decoration: underline;
}

.game-container {
    text-align: center;
    max-width: 400px;
    width: 100%;
    position: relative;
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    box-shadow: 0 5px 15px var(--shadow-green);
}

/* Header Styles */
.header {
    padding: 8px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border-light);
}

.header h1 {
    font-size: 14pt;
    color: var(--text-primary);
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

/* Safe Container - Simple CSS-based safe */
.safe-container {
    margin: 10px auto;
    display: flex;
    justify-content: center;
}

.safe {
    width: 80px;
    height: 80px;
    background: linear-gradient(to bottom, #4a4a4a 0%, #2d2d2d 100%);
    border: 3px solid #1a1a1a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        0 3px 8px rgba(0, 0, 0, 0.4);
}

.safe-door {
    width: 66px;
    height: 66px;
    background: linear-gradient(to bottom, #5a5a5a 0%, #3d3d3d 100%);
    border: 2px solid #2a2a2a;
    border-radius: 2px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.safe-dial {
    width: 32px;
    height: 32px;
    background: linear-gradient(to bottom, #e0e0e0 0%, #c0c0c0 100%);
    border: 2px solid #999;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dial-center {
    width: 14px;
    height: 14px;
    background: #990000;
    border-radius: 50%;
    border: 1px solid #660000;
    transition: background 0.3s ease;
}

.safe-handle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 20px;
    background: linear-gradient(to bottom, #e0e0e0 0%, #b0b0b0 100%);
    border: 1px solid #888;
    border-radius: 2px;
}

/* Game Board */
.game-board {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px auto;
    width: fit-content;
}

.guess-row {
    display: flex;
    gap: 4px;
}

.digit-box {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    background: linear-gradient(to bottom, #ffffff 5%, var(--bg-body) 100%);
    transition: transform 0.1s ease;
}

.digit-box.active {
    border-color: var(--accent-green);
    box-shadow: 0 0 6px rgba(0, 153, 0, 0.4);
}

.digit-box.filled {
    transform: scale(1.02);
    animation: pop 0.1s ease;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1.02); }
}

/* Feedback Colors */
.match-exact {
    background: linear-gradient(to bottom, #5cb85c, #4cae4c) !important;
    border-color: #3d8b3d !important;
    color: #ffffff !important;
}

.match-partial {
    background: linear-gradient(to bottom, #f0ad4e, #ec971f) !important;
    border-color: #d58512 !important;
    color: #003300 !important;
}

.match-none {
    background: linear-gradient(to bottom, #999999, #808080) !important;
    border-color: #666666 !important;
    color: #ffffff !important;
}

/* Flip Animation */
.flip {
    animation: flip 0.5s ease forwards;
}

@keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

/* Shake Animation */
.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}

/* Message Display */
.message {
    min-height: 18px;
    font-size: 8pt;
    font-weight: bold;
    margin: 4px 0;
    color: var(--text-primary);
}

.message.error {
    color: var(--danger);
}

.message.success {
    color: var(--accent-green);
}

/* Keypad */
.keypad {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
}

.keypad-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.key {
    width: 50px;
    height: 32px;
    font-family: verdana, geneva, arial cyr, arial, helvetica, sans-serif;
    font-size: 9pt;
    font-weight: bold;
    border: 1px solid #7d727d;
    cursor: pointer;
    color: #003300;
    text-decoration: none;
    text-shadow: 1px 1px 0px #dcffc4;
    background: linear-gradient(to bottom, #dceddc 5%, #bad4ba 100%);
    background-color: #dceddc;
    user-select: none;
    transition: all 0.1s ease;
}

.key:hover {
    background: linear-gradient(to bottom, #dceddc 5%, #f0fff0 100%);
    background-color: #dceddc;
}

.key:active {
    background: linear-gradient(to bottom, #bad4ba 5%, #dceddc 100%);
    background-color: #bad4ba;
    position: relative;
    top: 1px;
}

.key-action {
    width: 50px;
    font-size: 9pt;
}

.key-submit {
    background: linear-gradient(to bottom, #77b55a 5%, #72b352 100%);
    border: 1px solid #4b8f29;
    color: #ffffff;
    text-shadow: 0px 1px 2px #3e7327;
}

.key-submit:hover {
    background: linear-gradient(to bottom, #72b352 5%, #77b55a 100%);
}

.key:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.key:disabled:hover {
    background: linear-gradient(to bottom, #dceddc 5%, #bad4ba 100%);
}

/* Confetti Container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Safe Unlock Animation */
.safe-unlocked .safe {
    animation: safe-shake 0.5s ease;
}

@keyframes safe-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

/* Victory celebration for safe */
@keyframes glow {
    0%, 100% {
        box-shadow:
            inset 0 2px 4px rgba(255, 255, 255, 0.1),
            0 3px 8px rgba(0, 0, 0, 0.4);
    }
    50% {
        box-shadow:
            inset 0 2px 4px rgba(255, 255, 255, 0.1),
            0 0 15px rgba(0, 153, 0, 0.6);
    }
}

.safe-unlocked .safe {
    animation: safe-shake 0.5s ease, glow 1s ease-in-out infinite;
}

.safe-unlocked .dial-center {
    background: var(--accent-green) !important;
    border-color: var(--accent-dark-green) !important;
}

/* Responsive Design */
@media (max-width: 400px) {
    .digit-box {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .key {
        width: 44px;
        height: 28px;
        font-size: 8pt;
    }

    .header h1 {
        font-size: 12pt;
    }

    .safe {
        width: 70px;
        height: 70px;
    }

    .safe-door {
        width: 56px;
        height: 56px;
    }
}
