* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 960px;
    height: 960px;
    margin: 0 auto;
    overflow: hidden;
    font-family: Arial, sans-serif;
    background: #000;
}

.screen {
    width: 100%;
    height: 100%;
    position: relative;
}

.hidden {
    display: none !important;
}

/* Menu Screen */
#menuScreen {
    background-image: url('background/menu.png');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

#menuScreen.hidden {
    display: none !important;
}

.menu-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.menu-top {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: 100%;
    max-height: 30%;
}

.menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    z-index: 1;
    margin-top: 200px;
}

.menu-content h1 {
    color: #fff;
    font-size: 48px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.settings {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 10px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-group label {
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.volume-control label {
    min-width: 120px;
}

.volume-control input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.volume-control span {
    min-width: 50px;
    text-align: right;
}

.game-mode-selection {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

.mode-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.mode-option span {
    color: #fff;
    font-size: 16px;
}

.time-selection {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.time-selection label {
    color: #fff;
    font-size: 16px;
    margin-bottom: 10px;
    display: block;
}

.time-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.time-button {
    flex: 1;
    min-width: 80px;
    padding: 10px 15px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.time-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.time-button.selected {
    background: #4CAF50;
    border-color: #4CAF50;
    font-weight: bold;
}

.start-button, .continue-button {
    padding: 15px 40px;
    font-size: 24px;
    color: rgb(141, 32, 32);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
    max-width: 300px;
}

.start-button {
    background: #df7a7a;
}

.start-button:hover {
    background: #9b2626;
    color:#fff;
}

.continue-button {
    background: #c23d3d;
    margin-bottom: 15px;
    color:#fff;
}

.continue-button:hover {
    background: #a12a2a;
}

/* Game Screen */
#gameScreen {
    background-image: url('background/game.png');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#gameScreen.hidden {
    display: none !important;
}

/* Timer Container */
.timer-container {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    z-index: 5;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timer-display {
    text-align: center;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    line-height: 1.2;
}

.progress-bar-container {
    width: 100%;
    height: 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: #4CAF50;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 8px;
    width: 100%;
}

/* Back to Menu Button */
.back-to-menu-button {
    position: absolute;
    bottom: 20px;
    left: 20px;
    padding: 12px 24px;
    font-size: 16px;
    background: rgba(182, 70, 70, 0.9);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.back-to-menu-button:hover {
    background: rgba(107, 35, 35, 0.9);
}

.game-container {
    position: relative;
    width: 512px;
    height: 768px;
    margin-top: 0;
    transition: margin-top 0.3s ease;
}

.game-container.with-timer {
    margin-top: 70px;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.game-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 512px;
    height: 768px;
    display: grid;
    grid-template-columns: repeat(16, 32px);
    grid-template-rows: repeat(24, 32px);
    z-index: 2;
    pointer-events: none;
}

.game-cell {
    width: 32px;
    height: 32px;
    background-image: url('pieces/box.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    pointer-events: all;
    position: relative;
}

.game-cell.revealed {
    background: transparent;
}

.game-cell.flagged {
    background-image: url('pieces/flag.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.game-cell.bomb {
    background-image: url('pieces/brokenheart.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.game-cell .number {
    width: 100%;
    height: 100%;
    background-size: 32px 32px;
    background-repeat: no-repeat;
    background-position: center;
}

/* Win Screen */
.win-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 40px;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10;
}

.win-screen img {
    max-width: 90%;
    max-height: 75%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.next-button {
    padding: 15px 40px;
    font-size: 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.next-button:hover {
    background: #45a049;
}

/* Game Over Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: #8f4343;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    color: #d46363;
    margin-bottom: 20px;
    font-size: 32px;
}

.modal-content p {
    color: #cecece;
    margin-bottom: 30px;
    font-size: 18px;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-button {
    padding: 12px 30px;
    font-size: 18px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.modal-button:first-child {
    background: rgba(182, 70, 70, 0.9);
    color: white;
}

.modal-button:first-child:hover {
    background: rgba(107, 35, 35, 0.9);
}

.modal-button:last-child {
    background: #df7a7a;
    color: rgb(141, 32, 32);
}

.modal-button:last-child:hover {
    background: #9b2626;
    color: #fff;
}

