* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
    font-family: Arial, sans-serif;
}

/* ========== 화면 전환 ========== */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* ========== 시작 화면 ========== */
#startScreen {
    width: 100%;
    height: 100vh;
    display: flex !important;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.start-container {
    background: white;
    padding: 50px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 500px;
}

.start-container h1 {
    font-size: 48px;
    color: #333;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.start-container p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

.language-setting {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.language-setting label {
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

.language-setting select {
    padding: 10px 15px;
    font-size: 16px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-setting select:hover {
    border-color: #764ba2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ========== 테마 설정 ========== */
.theme-setting {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.theme-setting label {
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

.theme-setting select {
    padding: 10px 15px;
    font-size: 16px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-setting select:hover {
    border-color: #764ba2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-start {
    padding: 15px 50px;
    font-size: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    font-weight: bold;
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-start:active {
    transform: translateY(-1px);
}

.instructions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #eee;
    text-align: left;
}

.instructions h3 {
    color: #333;
    margin-bottom: 10px;
}

.instructions p {
    color: #666;
    font-size: 14px;
}

/* ========== 게임 화면 ========== */
#gameScreen {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* 게임 정보 표시 */
.game-info {
    width: 600px;
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.info-item {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

/* 캔버스 스타일 */
canvas {
    display: block;
    background-color: #ffffff;
    border: 3px solid #333;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ========== 게임 오버 모달 ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    max-width: 500px;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#gameOverTitle {
    font-size: 36px;
    color: #e74c3c;
    margin-bottom: 20px;
}

.modal-stats {
    margin: 30px 0;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.modal-stats p {
    font-size: 20px;
    color: #333;
    margin: 10px 0;
    font-weight: bold;
}

.btn-restart {
    padding: 10px 30px;
    font-size: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-restart:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-restart:active {
    transform: translateY(-1px);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: nowrap;
}

.btn-home {
    padding: 10px 30px;
    font-size: 16px;
    background: linear-gradient(135deg, #50C878 0%, #3DA870 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-home:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(80, 200, 120, 0.4);
}

.btn-home:active {
    transform: translateY(-1px);
}

/* ========== 다크모드 스타일 ========== */
body.dark-mode {
    background-color: #1a1a1a;
}

body.dark-mode #startScreen {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

body.dark-mode .start-container {
    background: #2c2c2c;
    color: #e0e0e0;
}

body.dark-mode .start-container h1 {
    color: #e0e0e0;
}

body.dark-mode .start-container p {
    color: #b0b0b0;
}

body.dark-mode .theme-setting label,
body.dark-mode .language-setting label {
    color: #e0e0e0;
}

body.dark-mode .theme-setting select,
body.dark-mode .language-setting select {
    background-color: #3c3c3c;
    color: #e0e0e0;
    border-color: #555;
}

body.dark-mode .theme-setting select:hover,
body.dark-mode .language-setting select:hover {
    border-color: #667eea;
}

body.dark-mode .instructions {
    border-top-color: #444;
}

body.dark-mode .instructions h3 {
    color: #e0e0e0;
}

body.dark-mode .instructions p {
    color: #b0b0b0;
}

body.dark-mode #gameScreen {
    background-color: #1a1a1a;
}

body.dark-mode .game-info {
    background-color: #2c2c2c;
    color: #e0e0e0;
}

body.dark-mode .info-item {
    color: #e0e0e0;
}

body.dark-mode canvas {
    background-color: #1a1a1a;
    border-color: #444;
}

body.dark-mode .modal {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-mode .modal-content {
    background-color: #2c2c2c;
    color: #e0e0e0;
}

body.dark-mode #gameOverTitle {
    color: #ff6b6b;
}

body.dark-mode .modal-stats {
    background-color: #3c3c3c;
    color: #e0e0e0;
}

body.dark-mode .modal-stats p {
    color: #e0e0e0;
}