body {
    background-color: #0d1117;
    color: #f0f6fc;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow-y: auto;
    padding: 40px 0;
}

.bg-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Opening_chess_position_from_black_side.jpg/1280px-Opening_chess_position_from_black_side.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(0.4) blur(4px);
    z-index: -1;
}

.game-container {
    text-align: center;
    z-index: 1;
}

/* 상단 타이틀 & 버튼 영역 */
.header-area {
    margin-bottom: 25px;
}

h1 {
    color: #bef264;
    letter-spacing: 5px;
    font-size: 3rem;
    margin: 0 0 15px 0;
    text-shadow: 0 0 15px rgba(190, 242, 100, 0.5);
}

#rules-btn, #rank-btn {
    background: rgba(35, 134, 54, 0.8);
    border: 1px solid rgba(48, 54, 61, 0.8);
    color: white;
    padding: 8px 18px;
    margin: 0 5px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.3s;
    font-weight: bold;
}

#rules-btn:hover, #rank-btn:hover {
    background: #bef264;
    color: #0d1117;
    box-shadow: 0 0 10px rgba(190, 242, 100, 0.7);
}

/* 컨트롤 패널 (설정 및 정보) */
.control-panel {
    background: rgba(22, 27, 34, 0.95);
    padding: 25px;
    border-radius: 15px;
    margin: 0 auto 25px auto;
    border: 1px solid rgba(48, 54, 61, 0.9);
    width: 450px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
    box-sizing: border-box;
}

#player-name {
    background: #0d1117;
    border: 1px solid #30363d;
    color: white;
    padding: 12px;
    width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    box-sizing: border-box;
    font-size: 1rem;
}

#player-name:focus {
    outline: none;
    border-color: #bef264;
    box-shadow: 0 0 5px rgba(190, 242, 100, 0.5);
}

.setting-group {
    margin-bottom: 15px;
}

.setting-group p {
    font-size: 0.95rem;
    color: #8b949e;
    margin-bottom: 10px;
    font-weight: bold;
}

/* 진영 및 난이도 버튼 */
.color-btn, .diff-btn {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    padding: 10px 20px;
    margin: 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
}

.color-btn.active, .diff-btn.active {
    background: #bef264;
    color: #0d1117;
    font-weight: bold;
    border-color: #bef264;
    box-shadow: 0 0 10px rgba(190, 242, 100, 0.5);
}

.color-btn:hover:not(.active), .diff-btn:hover:not(.active) {
    border-color: #8b949e;
    color: white;
}

/* 시작 및 재시작 버튼 */
#start-btn {
    background: #238636;
    color: white;
    border: none;
    width: 100%;
    font-size: 1.25rem;
    font-weight: bold;
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
}

#start-btn:hover {
    background: #2ea043;
    box-shadow: 0 0 15px rgba(46, 160, 67, 0.6);
}

#restart-btn {
    background: rgba(218, 54, 51, 0.8);
    color: white;
    border: 1px solid rgba(248, 81, 73, 0.5);
    width: 100%;
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

#restart-btn:hover {
    background: #da3633;
    box-shadow: 0 0 10px rgba(218, 54, 51, 0.6);
}

#status-box {
    font-size: 1.2rem;
    color: #f0f6fc;
    font-weight: bold;
    margin-bottom: 10px;
}

/* AI 4초 타이머 UI */
#timer-container {
    margin: 15px 0;
    font-weight: bold;
    color: #bef264;
    font-size: 1.1rem;
}

.timer-bar-bg {
    width: 100%;
    height: 6px;
    background: #30363d;
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

#timer-bar-fill {
    width: 100%;
    height: 100%;
    background: #bef264;
    transition: width 0.1s linear;
    box-shadow: 0 0 5px rgba(190, 242, 100, 0.7);
}

/* 체스판 메인 스타일 */
#board {
    width: 450px;
    border: 10px solid rgba(56, 62, 71, 0.8);
    border-radius: 12px;
    margin: 0 auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    overflow: hidden;
}

/* ★★★ 이동 경로 힌트 윤곽선 ★★★ */
.highlight-active {
    box-shadow: inset 0 0 0 4px #bef264 !important;
    background-color: rgba(190, 242, 100, 0.25) !important;
}

.highlight-hint {
    box-shadow: inset 0 0 0 6px rgba(190, 242, 100, 0.7) !important;
    border-radius: 4px;
}

.highlight-capture {
    box-shadow: inset 0 0 0 7px rgba(218, 54, 51, 0.8) !important;
    background-color: rgba(218, 54, 51, 0.15) !important;
    border-radius: 4px;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    overflow-y: auto;
}

.modal-content {
    background-color: #161b22;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #30363d;
    border-radius: 15px;
    width: 600px;
    text-align: left;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.7);
}

.close {
    color: #8b949e;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover {
    color: #bef264;
}

/* 규칙 텍스트 */
.rules-text {
    line-height: 1.8;
    color: #c9d1d9;
    font-size: 0.95rem;
}

.rules-text strong {
    color: #bef264;
}

.rules-text ul {
    padding-left: 20px;
    margin: 10px 0;
}

.rules-text li {
    margin-bottom: 8px;
}

/* =========================================
   🏆 명예의 전당 (리더보드) 프리미엄 테이블 스타일
========================================= */
#leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 25px;
    font-size: 1rem;
    table-layout: fixed; /* 👈 이 속성이 표 간격을 일정하고 넓게 쫙 펴줍니다! */
}

#leaderboard-table th, 
#leaderboard-table td {
    padding: 15px 10px;
    border-bottom: 1px solid #30363d;
    text-align: center;
    vertical-align: middle;
}

#leaderboard-table th {
    color: #bef264;
    font-weight: bold;
    background-color: rgba(48, 54, 61, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

#leaderboard-table tbody tr {
    transition: background-color 0.2s ease;
}

#leaderboard-table tbody tr:hover {
    background-color: rgba(48, 54, 61, 0.4);
}

/* 1등, 2등, 3등 텍스트 포인트 컬러 */
#leaderboard-table tbody tr:nth-child(1) td:first-child {
    color: #ffd700; /* 금색 */
    font-weight: bold;
    font-size: 1.2rem;
}
#leaderboard-table tbody tr:nth-child(2) td:first-child {
    color: #c0c0c0; /* 은색 */
    font-weight: bold;
    font-size: 1.1rem;
}
#leaderboard-table tbody tr:nth-child(3) td:first-child {
    color: #cd7f32; /* 동색 */
    font-weight: bold;
    font-size: 1.1rem;
}