/* 스네이크 게임 */

.snake-container {
    max-width: 520px;
    margin: 0 auto;
    padding: 40px 16px 80px;
    padding-bottom: calc(50px + 20px);
    font-family: 'Pretendard', sans-serif;
    min-height: 100vh;
}

.snake-header {
    text-align: center;
    margin-bottom: 24px;
}

.snake-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
}

.snake-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

/* 게임 방법 */
.snake-howto {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.snake-howto-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
}

.snake-howto-list {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.9rem;
    line-height: 1.65;
    color: #444;
}

.snake-howto-list li {
    margin-bottom: 6px;
}

.snake-howto-list li:last-child {
    margin-bottom: 0;
}

/* 컨트롤 */
.snake-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.snake-difficulty {
    display: flex;
    align-items: center;
    gap: 10px;
}

.snake-control-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
}

.snake-difficulty-buttons {
    display: flex;
    gap: 6px;
}

.snake-diff-btn {
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: #555;
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.snake-diff-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.snake-diff-btn.active {
    background: #2c3e50;
    color: #fff;
    border-color: #2c3e50;
}

.snake-new-btn {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.snake-new-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1f6dad 100%);
}

/* 상태 바 */
.snake-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 400px;
    margin: 0 auto 16px;
    padding: 10px 16px;
    background: #2c3e50;
    border-radius: 10px;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.snake-score,
.snake-best,
.snake-timer {
    font-size: 1rem;
    font-weight: 700;
    min-width: 60px;
}

.snake-score {
    text-align: left;
}

.snake-best {
    text-align: center;
}

.snake-timer {
    text-align: right;
}

/* 게임판 */
.snake-board-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    touch-action: none;
}

#snakeCanvas {
    display: block;
    border: 3px solid #2c3e50;
    border-radius: 8px;
    background: #1a1a2e;
    max-width: 100%;
}

/* 오버레이 */
.snake-overlay {
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s;
}

.snake-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.snake-overlay-content {
    text-align: center;
}

.snake-overlay-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 16px 0;
}

.snake-start-btn {
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.snake-start-btn:hover {
    background: linear-gradient(135deg, #1e8449 0%, #186a3b 100%);
}

/* 메시지 */
.snake-message {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    margin: 0 0 8px 0;
    min-height: 1.5em;
    color: #333;
}

.snake-message:empty {
    visibility: hidden;
}

/* 기록 */
.snake-record {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.snake-record-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.snake-record-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.snake-record-clear-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: #666;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
}

.snake-record-clear-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.snake-record-empty {
    font-size: 0.9rem;
    color: #888;
    margin: 0 0 12px 0;
}

.snake-record-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.snake-record-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f5f5f5;
    border-radius: 10px;
    font-size: 0.9rem;
}

.snake-record-item .record-level {
    font-weight: 700;
    color: #2c3e50;
    min-width: 48px;
}

.snake-record-item .record-score {
    font-weight: 600;
    color: #e74c3c;
}

.snake-record-item .record-time {
    font-weight: 600;
    color: #27ae60;
}

.snake-record-item .record-date {
    margin-left: auto;
    font-size: 0.8rem;
    color: #888;
}

/* 반응형 */
@media (max-width: 420px) {
    .snake-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .snake-difficulty {
        justify-content: center;
    }
    .snake-diff-btn {
        flex: 1;
    }
    .snake-new-btn {
        text-align: center;
    }
}
