* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Arial', sans-serif;
    color: #fff;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

#ui-top {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    margin-bottom: 10px;
    gap: 10px;
}

#score-container {
    text-align: left;
}

#turn-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.ui-label {
    font-size: 14px;
    font-weight: bold;
    color: #ddd;
    margin-bottom: 4px;
}

#score-value, #turn-value {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
}

#settings-btn {
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    transition: transform 0.1s;
    flex-shrink: 0;
}

#settings-btn:active {
    transform: scale(0.95);
}

#info-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
    min-height: 100px;
}

#target-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #fff;
    border-radius: 8px;
    min-height: 80px;
}

#target-header {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    width: 100%;
}

#target-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

.target-item {
    position: relative;
}

.target-color-box {
    width: 50px;
    height: 50px;
    border: 2px solid #000;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

#timer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #fff;
    border-radius: 8px;
    min-height: 80px;
}

#timer-header {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

#timer-gauge-bg {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #fff;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

#timer-gauge-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ECDC4 0%, #44A08D 100%);
    transition: width 0.1s linear;
    width: 100%;
}

#timer-text {
    font-size: 18px;
    font-weight: bold;
    margin-top: 8px;
}

#game-canvas {
    width: 100%;
    aspect-ratio: 1;
    background: transparent;
    border: 3px solid #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    touch-action: none;
}

#preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

#preview-canvas {
    background: transparent;
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    border: 4px solid #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#game-over h1 {
    font-size: 36px;
    margin-bottom: 20px;
}

#final-score {
    font-size: 24px;
    margin-bottom: 30px;
}

#restart-btn {
    padding: 12px 40px;
    font-size: 20px;
    background: #fff;
    color: #667eea;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-shadow: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#restart-btn:active {
    transform: scale(0.95);
}

#pause-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px 60px;
    border-radius: 12px;
    text-align: center;
    border: 4px solid #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#pause-overlay h1 {
    font-size: 36px;
    margin-bottom: 20px;
}

#pause-overlay p {
    font-size: 18px;
    color: #ccc;
}

/* 메인화면 */
#main-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
    max-width: 400px;
}

#main-menu h1 {
    font-size: 48px;
    margin-bottom: 60px;
    letter-spacing: 2px;
}

.menu-btn {
    width: 100%;
    padding: 16px;
    margin-bottom: 20px;
    font-size: 20px;
    background: #fff;
    color: #667eea;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    text-shadow: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s, background 0.2s;
}

.menu-btn:hover {
    background: #f0f0f0;
}

.menu-btn:active {
    transform: scale(0.95);
}

/* 튜토리얼 팝업 */
#tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#tutorial-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 4px solid #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#tutorial-content h2 {
    font-size: 32px;
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: 1px;
}

#tutorial-content h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #fff;
}

.tutorial-section {
    margin-bottom: 30px;
}

.tutorial-section p {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 10px;
    color: #ccc;
}

#tutorial-start-btn {
    margin-top: 10px;
}

/* 색상 강조 */
.color-normal {
    color: #00ffcc;
    font-weight: bold;
}

.color-steel {
    color: #888888;
    font-weight: bold;
}

.color-bomb {
    color: #ff0000;
    font-weight: bold;
}

.color-preview {
    color: #ff0000;
    font-weight: bold;
}

/* 설정 팝업 */
#settings-overlay, #debug-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#settings-content, #debug-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 4px solid #fff;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#settings-content h2, #debug-content h2 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 30px;
}

.debug-item {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-item label {
    font-size: 16px;
    color: #fff;
}

.debug-item input, .debug-item select {
    width: 80px;
    padding: 8px;
    font-size: 16px;
    border: 2px solid #fff;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
}

.debug-item select {
    width: auto;
}

.hidden {
    display: none !important;
}
