@font-face {
    font-family: 'W95FA';
    src: url('./fonts/W95FA.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'MS Sans Serif';
    src: url('./fonts/MSSS.ttf') format('truetype');
    font-weight: bolder;
}

body {
    width: 100%;
    height: 100vh;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(-45deg, #00feef, #09ebee, #19ceeb, #28acea, #388ee9, #2d76e0);
    background-size: 400% 400%;
    animation: gradientBG 20s ease infinite;
    font-family: 'Press Start 2P', monospace;
    box-sizing: border-box;
}

body.lost-bg {
    background: linear-gradient(-45deg, #D91A1A, #B41C1C, #8F1D1E, #6B1F20, #462022, #212224);
    background-size: 400% 400%;
    animation: gradientBG 5s ease infinite;
}

body.win-bg {
    background: linear-gradient(-45deg, #CDFF03, #C2F70F, #B8EF1B, #ADE628, #A3DE34, #98D640);
    background-size: 400% 400%;
    animation: gradientBG 5s ease infinite;
}

#game-result-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    opacity: 0.6;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    pointer-events: none;
}

body.lost-bg #game-result-bg {
    background-image: url('./assets/mines-bg.png');
}

body.win-bg #game-result-bg {
    background-image: url('./assets/smiley-bg.png');
}

body.lost-bg #mines-left,
body.lost-bg #timer {
    color: #ff0000;
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.7);
}

body.win-bg #mines-left,
body.win-bg #timer {
    color: #c3f313;
    text-shadow: 0 0 8px rgba(226, 241, 5, 0.7);
}

.window {
    display: inline-flex;
    justify-content: center;
    position: relative;
    flex-direction: column;
    background: #c0c0c3;
    padding: 3px;
    box-shadow: inset -1px -1px #0a0a0a, 
                inset 1px 1px #dfdfdf, 
                inset -2px -2px #808080, 
                inset 2px 2px #ffffff;
}

.title-bar {
    background: linear-gradient(90deg, #000080, #1084d0);
    padding: 3px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.title-bar-text {
    font-weight: bold;
    color: white;
    letter-spacing: 0;
    font-size: 11px;
}

.window-body {
    padding: 10px;
    display: flex;
    justify-content: center;
}

.game {
    display: inline-block;
    background: #c0c0c3;
    padding: 6px;
    border: 3px solid;
    border-color: #808080 #fff #fff #808080;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding: 4px;
    border: 2px solid;
    border-color: #808080 #fff #fff #808080;
}

#mines-left,
#timer {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10a817;
    text-shadow: 0 0 8px rgba(76, 143, 76, 0.7);
    background: #000;
    padding: 5px 5px;
    font-size: 18px;
    min-width: 50px;
}

#smiley {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 34px;
    height: 34px;
    background: #c0c0c3;
    border: 2px solid;
    border-color: #fff #808080 #808080 #fff;
    cursor: pointer;
    padding: 0;
    outline: none;
}

#smiley:active {
    border-color: #808080 #fff #fff #808080;
}

#smiley::after {
    content: "";
    display: block;
    width: 26px;
    height: 26px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url("./assets/smiley.png");
}

#smiley.lost::after { background-image: url("./assets/death.png"); }
#smiley.won::after { background-image: url("./assets/durr.png"); }

#grid {
    display: inline-grid;
    user-select: none;
    border: 3px solid;
    border-color: #808080 #fff #fff #808080;
}

#grid button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 26px;
    height: 26px;
    font-family: inherit;
    font-size: 16px;
    background: #c0c0c3;
    position: relative;
    box-sizing: border-box;
    border: 3px solid;
    border-color: #fff #808080 #808080 #fff;
}

#grid button:active:not(:disabled) {
    border-width: 1px;
    border-color: #808080;
}

#grid button:disabled {
    background: #c0c0c3;
    border: 1px solid #808080;
    color: inherit;
    cursor: default;
}

#grid button:disabled.exploded {
    background: #ea3323;
}

#grid button.flagged::after {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url("./assets/flag.png");
}

#grid button.mine::after {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url("./assets/bomb.png");
}

#grid button.value-1 { color: #0100f3; }
#grid button.value-2 { color: #367c21; }
#grid button.value-3 { color: #e93323; }
#grid button.value-4 { color: #020079; }
#grid button.value-5 { color: #78150e; }
#grid button.value-6 { color: #387e7e; }
#grid button.value-7 { color: #000000; }
#grid button.value-8 { color: #808080; }

#secretka {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-image: url('./assets/secret.png');
    background-size: contain; background-position: center; background-repeat: no-repeat;
    z-index: 9999; opacity: 0; pointer-events: none; display: none;
}

.show-secretka {
    display: block !important;
    animation: secretkaFade 3s forwards;
}

.shake {
    animation: shake 0.2s ease-in-out;
}

#mute-button {
    display: flex;
    position: fixed;
    top: 10px;
    right: 10px;
    align-items: center;
    gap: 15px;
    background: #c0c0c3;
    border: 2px solid;
    border-color: #fff #808080 #808080 #fff;
    padding: 4px 4px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

#volume-container {
    display: flex;
    position: fixed;
    top: 75px;
    right: 10px;
    align-items: center;
    gap: 15px;
    background: #c0c0c0;
    padding: 4px 6px;
    border-left: 2px solid #fff;
    border-top: 2px solid #fff;
    border-right: 2px solid #808080;
    border-bottom: 2px solid #808080;
    font-family: 'Press Start 2P', monospace;
    font-size: 15px;
}

#mute-button:active {
    border-color: #808080 #fff #fff #808080;
}

#mute-button .mute-icon {
    width: 36px;
    height: 36px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#volume-container .volume-icon {
    width: 32px;
    height: 32px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#mute-button .mute-text {
    font-size: 18px;
    margin-top: 4px;
}

#mute-button.unmuted .mute-icon {
    background-image: url('./assets/music-on.png');
}

#mute-button.muted .mute-icon {
    background-image: url('./assets/music-off.png');
}

#volume-container.unsilent .volume-icon {
    background-image: url('./assets/volume-on.png');
}

#volume-container.silent .volume-icon {
    background-image: url('./assets/volume-off.png');
}

#volume-container {
    display: flex;
    position: fixed;
    top: 75px;
    right: 10px;
    align-items: center;
    gap: 10px;
    background: #c0c0c0;
    padding: 6px 10px;
    box-shadow: inset -1px -1px #0a0a0a, 
                inset 1px 1px #dfdfdf, 
                inset -2px -2px #808080, 
                inset 2px 2px #ffffff;
}

#volume-container .volume-icon {
    width: 32px;
    height: 32px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    background: transparent;
    cursor: pointer;
}

#volume-slider:focus {
    outline: none;
}

#volume-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: #808080;
    box-shadow: -1px -1px 0px #0a0a0a, 1px 1px 0px #fff; 
}

#volume-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: #808080;
    box-shadow: -1px -1px 0px #0a0a0a, 1px 1px 0px #fff;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    width: 11px;
    background: #c0c0c3;
    margin-top: -8px;
    box-shadow: inset -1px -1px #0a0a0a, 
                inset 1px 1px #dfdfdf, 
                inset -2px -2px #808080, 
                inset 2px 2px #ffffff;
}

#volume-slider::-moz-range-thumb {
    height: 20px;
    width: 11px;
    background: #c0c0c3;
    border: none;
    border-radius: 0;
    box-shadow: inset -1px -1px #0a0a0a, 
                inset 1px 1px #dfdfdf, 
                inset -2px -2px #808080, 
                inset 2px 2px #ffffff;
}

@keyframes secretkaFade {
    0% { opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; }
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shake {
    0% { transform: translate(0, 0); }
    25% { transform: translate(0, -4px); }
    50% { transform: translate(0, 4px); }
    75% { transform: translate(0, -2px); }
    100% { transform: translate(0, 0); }
}

.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 42px;
    background: #bfc7c9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 4px;
    z-index: 10000;
    border-top: 2px solid #dfdfdf; 
    box-shadow: inset 0 1px #fff, 0 -1px #808080;
    box-sizing: border-box;
}

.taskbar-tray {
    display: flex;
    align-items: center;
    height: 32px;
    width: auto;
    min-width: 90px;
    gap: 6px;
    padding: 0 6px;
    background: #c0c7c8;
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    box-sizing: border-box;
}

#timer-display {
    font-family: 'W95FA', sans-serif;
    font-size: 18px;
    color: #000;
}

.start-button {
    display: flex;
    align-items: center;
    height: 34px;
    padding: 2px 10px 2px 4px;
    background: #c0c0c0;
    cursor: pointer;
    border: 3px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    outline-offset: -4px;
    box-sizing: border-box;
}

.start-button:active {
    border-color: #808080 #ffffff #ffffff #808080;
    padding: 4px 8px 1px 6px;
}

.start-icon {
    height: 26px;
    width: auto;
    margin-right: 4px;
    background-image: url('assets/start-icon.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
}

.start-text {
    font-family: 'MS Sans Serif', sans-serif;
    font-size: 16px;
    font-weight: bolder;
    color: #000;

    -webkit-font-smoothing: none;     
    -moz-osx-font-smoothing: grayscale; 
    font-smooth: never;                
    text-rendering: optimizeSpeed;
}

.taskbar-element {
    height: 30px;
    width: auto;
    margin-left: 2px;
    margin-right: auto;
    image-rendering: pixelated;
}

.taskbar-element2 {
    height: 24px;
    width: auto;
    margin-left: auto;
    image-rendering: pixelated;
}

.icons {
    display: flex;
    position: fixed;
    align-items: center;
    height: 320px;
    width: auto;
    top: 20px;
    left: 10px;
    z-index: -1;
    image-rendering: pixelated;
}
