* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 편안한 브라운 톤 색상 팔레트 - 가독성 향상 */
:root {
    --primary: #7A6245;          /* 따뜻한 브라운 (진하게) */
    --primary-dark: #5A4835;     /* 진한 브라운 */
    --primary-light: #9A8265;    /* 연한 브라운 */
    --accent: #8A7A68;           /* 모카 (진하게) */
    --bg-start: #F5F0EB;         /* 따뜻한 크림 */
    --bg-end: #E8E0D8;           /* 부드러운 베이지 */
    --card-bg: #FAF8F5;          /* 카드 배경 */
    --card-border: #D8CFC3;      /* 카드 테두리 (진하게) */
    --text-primary: #2D2520;     /* 주요 텍스트 (더 진하게) */
    --text-secondary: #5A4D42;   /* 보조 텍스트 (더 진하게) */
    --text-muted: #7A6B5D;       /* 흐린 텍스트 (더 진하게) */
    --success: #5A8A50;          /* 성공/승리 (진하게) */
    --danger: #C45050;           /* 위험/패배 (진하게) */
    --warning: #B8952A;          /* 경고 (진하게) */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    opacity: 0;
    transition: opacity 0.1s ease-in;
}

body.i18n-ready {
    opacity: 1;
}

#app {
    width: 100%;
    max-width: 1000px;
    padding: 15px;
}

.screen {
    display: none;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--card-border);
}

.screen.active {
    display: block;
}

/* 메뉴 화면 */
#menu-screen {
    text-align: center;
}

#menu-screen h1 {
    font-size: 48px;
    margin-bottom: 40px;
    color: var(--text-primary);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 400px;
    margin: 0 auto;
}

/* 주요 메뉴와 보조 메뉴 사이 구분 */
.menu-btn.secondary:first-of-type {
    margin-top: 10px;
}

.menu-btn {
    padding: 20px 40px;
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(90, 72, 53, 0.35);
}

/* 로비 화면 */
#lobby-screen h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.lobby-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.room-list {
    border: 2px solid var(--card-border);
    border-radius: 10px;
    padding: 20px;
    min-height: 300px;
    background: white;
}

.room-list h3 {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

#room-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 8px;
    transition: background 0.2s;
}

.room-item:hover {
    background: var(--bg-end);
}

.room-item button {
    padding: 8px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.action-btn {
    padding: 12px 30px;
    font-size: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn:hover {
    background: var(--primary-dark);
}

/* 게임 화면 */
#game-screen.active {
    padding: 10px;
    max-width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-header {
    margin-bottom: 10px;
    flex-shrink: 0;
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px 15px;
    background: white;
    border-radius: 10px;
    border: 1px solid var(--card-border);
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary);
}

.player-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 내 아이디 강조 */
.my-username {
    color: #2E86C1 !important;
    font-weight: 700 !important;
}

/* 게임 타이머 */
.player-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    background: #f5f5f5;
    border-radius: 6px;
    min-width: 75px;
    border: 2px solid transparent;
}

.player-timer .main-time {
    font-size: 16px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #333;
    min-width: 50px;
    text-align: center;
}

.player-timer .byoyomi {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.period-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
    margin-top: 2px;
}

.period-dot.filled {
    background-color: #7CB342;
}

.period-dot.empty {
    background-color: transparent;
    border: 2px solid #A5D6A7;
    width: 6px;
    height: 6px;
}

.player-timer.active {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.player-timer.low-time {
    background: #f8d7da;
    border: 2px solid #dc3545;
}

.player-timer.low-time .main-time {
    color: #dc3545;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.player-timer.byoyomi-mode {
    background: #d4edda;
    border: 2px solid #28a745;
}

.player-timer.byoyomi-mode .main-time {
    color: #28a745;
}

.stone {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
}

.black-stone {
    background: radial-gradient(circle at 30% 30%, #555, #000);
}

.white-stone {
    background: radial-gradient(circle at 30% 30%, #fff, #ddd);
    border: 1px solid #999;
}

.game-status {
    text-align: center;
}

#current-turn {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

#game-mode-display {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 2px;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.control-btn {
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.control-btn:disabled {
    background: #f5f5f5;
    color: #c0c0c0;
    border-color: #e0e0e0;
    cursor: not-allowed;
    opacity: 0.7;
}

.control-btn:disabled:hover {
    background: #f5f5f5;
    color: #c0c0c0;
    border-color: #e0e0e0;
    transform: none;
}

.control-btn.back-btn {
    background: white;
    color: var(--text-muted);
    border-color: var(--text-muted);
}

.control-btn.back-btn:hover {
    background: #f5f5f5;
    color: var(--text-secondary);
    border-color: var(--text-secondary);
}

.control-btn.score-btn {
    background: white;
    color: var(--success);
    border-color: var(--success);
}

.control-btn.score-btn:hover {
    background: var(--success);
    color: white;
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: none;
    border-radius: 10px;
    padding: 0;
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
}

#board-canvas {
    cursor: pointer;
    border-radius: 5px;
    width: 100%;
    max-width: 900px;
    height: auto;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(61, 61, 61, 0.4);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.modal-content h2 {
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 24px;
    color: var(--text-primary);
}

.modal-content p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
    color: var(--text-secondary);
}

/* AI 난이도 선택 모달 */
.difficulty-modal {
    max-width: 600px;
}

.modal-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.difficulty-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.difficulty-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.difficulty-card {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 20px 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px solid transparent;
    position: relative;
    text-align: center;
}

.difficulty-card:hover {
    background: linear-gradient(135deg, #e8e8e8 0%, #d8d8d8 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.difficulty-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(139, 115, 85, 0.1) 0%, rgba(107, 90, 69, 0.1) 100%);
}

.difficulty-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    color: white;
}

.difficulty-badge.kyu {
    background: linear-gradient(135deg, var(--accent) 0%, #9A8265 100%);
}

.difficulty-badge.dan {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
}

.difficulty-badge.katago {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.difficulty-separator {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0;
}

.difficulty-separator hr {
    flex: 1;
    border: none;
    border-top: 2px solid var(--card-border);
}

.difficulty-separator span {
    font-weight: bold;
    color: var(--primary);
    white-space: nowrap;
    font-size: 14px;
}

.katago-card {
    background: linear-gradient(135deg, #EDE8E3 0%, #E5DDD3 100%);
    border: 2px solid var(--primary);
}

.katago-card:hover {
    background: linear-gradient(135deg, #E5DDD3 0%, #DAD0C3 100%);
    box-shadow: 0 10px 30px rgba(139, 115, 85, 0.25);
}

.katago-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.katago-notice {
    background: #FDF6E3;
    color: #8B7355;
    padding: 12px;
    border-radius: 8px;
    margin: 15px 0;
    border: 1px solid #E8DCC8;
    font-size: 13px;
    text-align: center;
}

.difficulty-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 10px 0 8px 0;
}

.difficulty-desc {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.action-btn.secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.action-btn.secondary:hover {
    background: var(--card-bg);
}

/* 점수 계산 모달 */
.score-modal {
    max-width: 700px;
    padding: 40px;
}

.score-result {
    display: flex;
    gap: 30px;
    align-items: center;
    margin: 30px 0;
}

.score-card {
    flex: 1;
    background: white;
    padding: 25px;
    border-radius: 15px;
    border: 1px solid var(--card-border);
}

.score-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.score-header h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin: 0;
}

.score-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 8px;
}

.score-item .label {
    font-size: 16px;
    color: var(--text-secondary);
}

.score-item .value {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-primary);
}

.score-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 8px;
    margin-top: 10px;
}

.score-total .label {
    font-size: 18px;
    color: white;
    font-weight: bold;
}

.score-total .value {
    font-size: 28px;
    font-weight: bold;
    color: white;
}

.vs-divider {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
}

.score-winner {
    background: #EDE8E3;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 2px solid var(--primary);
}

.score-winner p {
    font-size: 22px;
    font-weight: bold;
    color: var(--primary);
    margin: 0;
}

/* 인증 화면 */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 400px;
    margin: 20px auto 0;
}

.input-field {
    padding: 15px;
    font-size: 16px;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    transition: border-color 0.2s;
    background: white;
    color: #333;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
}

/* Select 드롭다운 스타일 (Safari 호환) */
select.input-field {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b5a45' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-color: white;
    padding-right: 40px;
    cursor: pointer;
}

select.input-field::-ms-expand {
    display: none;
}

.auth-btn {
    padding: 15px;
    font-size: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(139, 115, 85, 0.25);
}

.auth-btn.secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.auth-btn.secondary:hover {
    background: var(--card-bg);
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    padding: 10px;
    font-size: 14px;
}

.text-btn:hover {
    color: var(--primary-dark);
}

#login-screen h1, #register-screen h2, #reset-screen h2 {
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.question-display {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--card-border);
}

.question-display p {
    color: var(--text-secondary);
    font-size: 16px;
    margin: 0;
}

/* 사용자 정보 바 */
.user-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--card-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.user-info-bar span {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.user-info-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.menu-lang-selector .lang-btn {
    padding: 6px 10px;
    font-size: 16px;
}

.menu-lang-selector .lang-arrow {
    font-size: 9px;
}

.small-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.2s;
}

.small-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 로그인 헤더 */
.login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* 언어 선택기 */
.language-selector {
    position: relative;
}

.lang-btn {
    background: white;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.lang-btn:hover .lang-arrow {
    transform: translateY(2px);
}

.lang-btn:hover {
    background: var(--card-bg);
    border-color: var(--primary);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 130px;
    overflow: hidden;
}

.lang-dropdown.hidden {
    display: none;
}

.lang-option {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.lang-option:hover {
    background: var(--background);
}

.lang-option:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

/* 접속자 수 표시 */
.online-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--success) 0%, #5A8A69 100%);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-right: 10px;
}

.online-count-badge::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 프로필 화면 */
#profile-screen h2,
#my-games-screen h2,
#rankings-screen h2 {
    margin-bottom: 20px;
    margin-left: 10px;
}

.profile-content, .rankings-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid var(--card-border);
}

.stats-card h3 {
    color: var(--text-primary);
    font-size: 28px;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary);
}

/* 랭킹 화면 */
.rankings-table {
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid var(--card-border);
    overflow-x: auto;
}

.table-header {
    display: grid;
    grid-template-columns: 50px 1fr 70px 70px 70px 60px;
    gap: 10px;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: bold;
    border-radius: 10px;
    margin-bottom: 10px;
    text-align: center;
    min-width: 400px;
}

.ranking-row {
    display: grid;
    grid-template-columns: 50px 1fr 70px 70px 70px 60px;
    gap: 10px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 8px;
    align-items: center;
    text-align: center;
    transition: transform 0.2s;
    min-width: 400px;
}

.ranking-row:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.ranking-row > span {
    white-space: nowrap;
}

.ranking-row .rank {
    font-weight: bold;
    font-size: 18px;
    color: var(--primary);
}

.ranking-row .username {
    font-weight: bold;
    color: var(--text-primary);
    text-align: left;
}

.ranking-row.top-1 .rank {
    color: #D4AF37;
    font-size: 24px;
}

.ranking-row.top-2 .rank {
    color: #A8A8A8;
    font-size: 22px;
}

.ranking-row.top-3 .rank {
    color: #CD8C52;
    font-size: 20px;
}

/* 반응형 디자인 - 태블릿 */
@media (max-width: 768px) {
    #app {
        padding: 10px;
    }

    .screen {
        padding: 20px;
        border-radius: 15px;
    }

    .player-info {
        flex-direction: row;
        gap: 8px;
    }

    .user-info-bar {
        flex-direction: column;
        gap: 8px;
        padding: 12px 15px;
    }

    .user-info-bar > span:first-child {
        font-size: 14px;
        text-align: center;
        width: 100%;
    }

    .user-info-bar-right {
        display: grid;
        grid-template-columns: repeat(4, auto);
        justify-content: center;
        gap: 8px;
        width: 100%;
    }

    .user-info-bar-right > .online-count-badge {
        grid-column: 1 / -1;
        justify-self: center;
        margin-right: 0;
        padding: 6px 12px;
        font-size: 12px;
    }

    .user-info-bar .small-btn {
        margin-left: 0;
        padding: 8px 12px;
        font-size: 13px;
        height: 36px;
        box-sizing: border-box;
    }

    .user-info-bar .lang-btn {
        padding: 8px 12px;
        font-size: 13px;
        height: 36px;
        box-sizing: border-box;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-header, .ranking-row {
        grid-template-columns: 40px 1fr 55px 55px 55px 50px;
        gap: 6px;
        padding: 10px;
        font-size: 13px;
        min-width: 360px;
    }

    .ranking-row .username {
        font-size: 13px;
    }

    .difficulty-options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .difficulty-modal {
        max-width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .score-result {
        flex-direction: column;
        gap: 20px;
    }

    .score-modal {
        max-width: 90%;
        padding: 20px;
    }

    .vs-divider {
        transform: rotate(90deg);
    }

    .game-controls {
        flex-wrap: wrap;
    }

    .control-btn {
        padding: 12px 16px;
        font-size: 13px;
    }
}

/* 반응형 디자인 - 모바일 */
@media (max-width: 480px) {
    body {
        align-items: flex-start;
        padding-top: 10px;
    }

    #app {
        padding: 0;
    }

    .screen {
        padding: 10px;
        border-radius: 10px;
    }

    #menu-screen h1 {
        font-size: 36px;
        margin-bottom: 25px;
    }

    .menu-btn {
        padding: 15px 25px;
        font-size: 16px;
    }

    /* 게임 화면 모바일 최적화 */
    #game-screen {
        padding: 5px;
    }

    .game-header {
        margin-bottom: 5px;
    }

    /* 모바일 게임 화면: 바둑판 먼저, 정보는 아래로 */
    #game-screen.active {
        display: flex;
        flex-direction: column;
        padding: 2px;
    }

    .game-header {
        order: 2;
        margin-bottom: 0;
        margin-top: 5px;
    }

    .canvas-container {
        order: 1;
        padding: 0;
        border-radius: 0;
        width: fit-content;
        max-width: 100%;
        margin: 0 auto;
        background: none;
    }

    .game-controls {
        order: 3;
        gap: 4px;
        margin-top: 5px;
    }

    .player-info {
        padding: 6px 8px;
        margin-bottom: 0;
        gap: 4px;
    }

    .game-status {
        text-align: center;
    }

    #current-turn {
        font-size: 13px;
    }

    #game-mode-display {
        font-size: 10px;
    }

    .player {
        font-size: 11px;
        gap: 4px;
    }

    .stone {
        width: 16px;
        height: 16px;
    }

    .player-timer {
        min-width: 55px;
        padding: 3px 5px;
    }

    .player-timer .main-time {
        font-size: 13px;
        min-width: 38px;
    }

    .player-timer .byoyomi {
        font-size: 11px;
    }

    .period-dot {
        width: 8px;
        height: 8px;
    }

    .period-dot.empty {
        width: 4px;
        height: 4px;
    }

    #black-captures, #white-captures {
        font-size: 10px;
    }

    .player-name {
        font-weight: 600;
    }

    .stone {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    #black-captures, #white-captures {
        font-size: 11px;
        color: var(--text-secondary);
    }

    #current-turn {
        font-size: 14px;
        font-weight: 700;
    }

    #game-mode-display {
        font-size: 10px;
        color: var(--text-secondary);
    }

    .control-btn {
        padding: 6px 8px;
        font-size: 10px;
        border-radius: 4px;
    }

    /* 난이도 선택 모달 모바일 */
    .difficulty-options-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 5px;
    }

    .difficulty-card {
        padding: 12px 8px;
        border-radius: 10px;
    }

    .difficulty-card h3 {
        font-size: 14px;
        margin: 4px 0 2px 0;
    }

    .difficulty-desc {
        font-size: 10px;
    }

    .difficulty-badge {
        padding: 2px 8px;
        font-size: 9px;
        top: 5px;
        right: 5px;
    }

    /* 모달 오버레이 - 모바일에서 전체 화면 덮기 */
    .modal {
        background: rgba(0, 0, 0, 0.95);
        z-index: 9999;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        margin: 0;
        padding: 0;
    }

    .modal-content {
        padding: 20px 15px;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
        width: calc(100% - 20px);
    }

    /* AI 난이도 모달 - 모바일 최적화 */
    .modal-content.difficulty-modal {
        max-width: 100%;
        width: calc(100% - 20px);
        padding: 15px 8px;
        max-height: 85vh;
    }

    .difficulty-options-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        padding: 5px;
        max-height: none;
        overflow: visible;
    }

    .difficulty-card {
        padding: 10px 6px;
    }

    .difficulty-card h3 {
        font-size: 13px;
        margin-bottom: 2px;
    }

    .difficulty-card p,
    .difficulty-desc {
        font-size: 10px;
        margin: 0;
    }

    .modal-content h2 {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .modal-subtitle {
        font-size: 13px;
        margin-bottom: 15px;
    }

    /* 인증 폼 모바일 */
    .auth-form {
        gap: 12px;
    }

    .input-field {
        padding: 12px;
        font-size: 14px;
    }

    .auth-btn {
        padding: 12px;
        font-size: 14px;
    }

    #login-screen h1, #register-screen h2, #reset-screen h2 {
        font-size: 28px;
    }

    /* 매칭 화면 모바일 */
    .matchmaking-info {
        padding: 15px;
    }

    .matchmaking-info p {
        font-size: 14px;
    }

    .spinner {
        width: 60px;
        height: 60px;
        border-width: 6px;
    }

    /* 매칭 바 모바일 */
    .matchmaking-bar {
        padding: 10px 15px;
    }

    .matchmaking-bar-content {
        flex-wrap: wrap;
        gap: 10px;
    }

    .matchmaking-status {
        font-size: 14px;
    }

    .matchmaking-bar-info {
        font-size: 12px;
        gap: 10px;
    }

    /* 프로필/랭킹 모바일 */
    .stats-card {
        padding: 20px;
    }

    .stats-card h3 {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .stat-item {
        padding: 15px;
    }

    .stat-label {
        font-size: 12px;
    }

    .stat-value {
        font-size: 24px;
    }

    .table-header, .ranking-row {
        grid-template-columns: 30px minmax(60px, 1fr) 45px 45px 45px 42px;
        gap: 4px;
        padding: 8px 5px;
        font-size: 11px;
        min-width: 320px;
    }

    /* 점수 모달 모바일 */
    .score-card {
        padding: 15px;
    }

    .score-header h3 {
        font-size: 18px;
    }

    .score-item .label {
        font-size: 13px;
    }

    .score-item .value {
        font-size: 16px;
    }

    .score-total .value {
        font-size: 22px;
    }

    .score-winner p {
        font-size: 18px;
    }

    /* 설정 모달 모바일 */
    .settings-section h3 {
        font-size: 16px;
    }

    .setting-option {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* 레이팅 변화 모달 모바일 */
    .rating-change {
        font-size: 18px;
        gap: 10px;
    }

    .change-amount {
        font-size: 16px;
    }
}

/* 아주 작은 화면 (SE 등) */
@media (max-width: 360px) {
    .difficulty-options-grid {
        grid-template-columns: 1fr;
    }

    .difficulty-card {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px;
        text-align: left;
    }

    .difficulty-card h3 {
        font-size: 13px;
        margin: 15px 0 4px 0;
    }

    .game-controls {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }

    .control-btn {
        padding: 8px 6px;
        font-size: 11px;
    }
}

/* 매칭 관련 스타일 */
.user-rating-display {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--card-border);
}

.user-rating-display h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.rating-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tier-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tier-badge {
    font-size: 18px;
    font-weight: bold;
    padding: 8px 16px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.rating-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}

.stats-summary {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.matchmaking-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    font-size: 18px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 115, 85, 0.3);
}

.action-btn.secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 15px;
    font-size: 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn.secondary:hover {
    background: var(--primary);
    color: white;
}

/* 매칭 중 화면 */
#matchmaking-screen {
    text-align: center;
}

.matchmaking-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.matchmaking-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 80px;
    height: 80px;
    border: 8px solid var(--card-border);
    border-top: 8px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.matchmaking-info {
    background: white;
    padding: 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--card-border);
}

.matchmaking-info p {
    font-size: 16px;
    color: var(--text-secondary);
}

.matchmaking-info span {
    font-weight: 600;
    color: var(--primary);
}

.matchmaking-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 400px;
}

/* 매칭 바 (게임 화면 상단) */
.matchmaking-bar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    margin: 5px;
}

.matchmaking-bar-content {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

.matchmaking-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.matchmaking-bar-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    opacity: 0.9;
}

.separator {
    opacity: 0.5;
    font-size: 12px;
    font-weight: 600;
}

.btn-cancel-small {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-cancel-small:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 레이팅 변화 모달 */
.rating-modal {
    max-width: 500px;
}

.rating-change-display {
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin: 20px 0;
    border: 1px solid var(--card-border);
}

.player-rating-change {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.player-rating-change h3 {
    font-size: 24px;
    color: var(--text-primary);
}

.rating-change {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 24px;
    font-weight: 600;
}

.old-rating {
    color: var(--text-muted);
}

.arrow {
    color: var(--primary);
}

.new-rating {
    color: var(--text-primary);
}

.change-amount {
    font-size: 20px;
    padding: 5px 12px;
    border-radius: 6px;
    background: var(--card-bg);
}

.tier-change {
    text-align: center;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 8px;
    margin: 10px 0;
}

.tier-promotion {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
}

#rating-tier-text {
    font-size: 18px;
    color: var(--text-secondary);
}


.tier-badge-small {
    font-size: 14px;
    font-weight: bold;
    padding: 4px 8px;
    background: var(--card-bg);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    display: inline-block;
}

.tier-cell {
    text-align: center;
}

.rating-cell {
    text-align: center;
    font-weight: 600;
    color: var(--primary);
}

/* 프로필 레이팅 표시 */
.profile-rating {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.profile-tier-badge {
    font-size: 24px;
}

.profile-rating-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary);
}

/* 매칭 수락/거절 모달 */
.match-accept-modal {
    max-width: 400px;
    text-align: center;
}

.match-timer {
    font-size: 48px;
    font-weight: bold;
    color: var(--danger);
    margin: 20px 0;
}

.match-timer span {
    display: inline-block;
    min-width: 60px;
}

.opponent-info-card {
    background: linear-gradient(135deg, var(--card-bg) 0%, #E8E4DF 100%);
    border-radius: 16px;
    padding: 25px;
    margin: 20px 0;
    border: 2px solid var(--card-border);
}

.opponent-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: bold;
}

.opponent-color {
    padding: 8px 16px;
    border-radius: 8px;
    color: white;
}

#match-my-color {
    background: #333;
}

#match-opponent-color {
    background: #f0f0f0;
    color: #333;
    border: 2px solid #333;
}

.vs-text {
    color: var(--text-secondary);
    font-size: 18px;
}

.opponent-details h3 {
    font-size: 22px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.opponent-stats {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}

.opponent-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.opponent-stats .label {
    font-size: 12px;
    color: var(--text-secondary);
    height: 18px;
}

.opponent-stats .value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.opponent-stats .stat {
    min-width: 70px;
    justify-content: flex-start;
    min-height: 50px;
}

.opponent-stats .stat:not(:first-child) .value {
    margin-top: 8px;
}

.match-accept-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: #EDE8E3;
    border-radius: 8px;
    margin: 15px 0;
    color: var(--primary);
}

.match-accept-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.match-accept-buttons .action-btn {
    min-width: 120px;
}

.match-accept-buttons .action-btn.primary {
    background: linear-gradient(135deg, var(--success) 0%, #5A8A69 100%);
}

.match-accept-buttons .action-btn.primary:hover {
    background: linear-gradient(135deg, #5A8A69 0%, var(--success) 100%);
}

/* 모바일 대응 */
@media (max-width: 480px) {
    .match-accept-modal {
        padding: 20px;
    }

    .match-timer {
        font-size: 36px;
    }

    .opponent-header {
        font-size: 18px;
        gap: 10px;
    }

    .opponent-stats {
        gap: 15px;
    }

    .match-accept-buttons {
        flex-direction: column;
    }

    .match-accept-buttons .action-btn {
        width: 100%;
    }
}

/* 친구 대전 섹션 */
.friend-match-section {
    background: #EDE8E3;
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.friend-match-section h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 18px;
}

.friend-match-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.friend-match-buttons .action-btn {
    flex: 1;
    max-width: 200px;
}

/* 친구 대전 로비 */
.friend-lobby {
    text-align: center;
}

.lobby-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.friend-match-options {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.friend-option-card {
    flex: 1;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border: 2px solid var(--card-border);
    border-radius: 16px;
    padding: 25px 20px;
    text-align: center;
    transition: all 0.2s ease;
}

.friend-option-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(90, 72, 53, 0.15);
}

.friend-option-card h3 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 18px;
}

.friend-option-card p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.friend-option-card .action-btn {
    width: 100%;
}

@media (max-width: 480px) {
    .friend-match-options {
        flex-direction: column;
    }
}

/* 초대 코드 모달 */
.invite-code-modal {
    max-width: 400px;
}

.invite-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.invite-code-display #invite-code-value {
    font-size: 36px;
    font-weight: bold;
    color: white;
    letter-spacing: 8px;
    font-family: monospace;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.invite-waiting {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: #EDE8E3;
    border-radius: 8px;
    color: var(--primary);
    margin-bottom: 15px;
}

.invite-expiry {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* 초대 코드 입력 모달 */
.join-code-modal {
    max-width: 400px;
}

.invite-code-input {
    width: 100%;
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    letter-spacing: 6px;
    padding: 15px;
    border: 3px solid var(--primary);
    border-radius: 12px;
    font-family: monospace;
    text-transform: uppercase;
    margin: 20px 0;
}

.invite-code-input:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(139, 115, 85, 0.2);
}

.invite-code-input::placeholder {
    color: #ccc;
    letter-spacing: 6px;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-buttons .action-btn {
    min-width: 100px;
}

/* 모바일 대응 */
@media (max-width: 480px) {
    .friend-match-buttons {
        flex-direction: column;
    }

    .friend-match-buttons .action-btn {
        max-width: none;
    }

    .invite-code-display #invite-code-value {
        font-size: 28px;
        letter-spacing: 5px;
    }

    .invite-code-input {
        font-size: 22px;
        letter-spacing: 4px;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .modal-buttons .action-btn {
        width: 100%;
    }
}

/* 관전/내 대국 화면 공통 */
.spectate-content,
.my-games-content {
    width: 100%;
}

.my-games-content .action-btn {
    width: 100%;
}

/* 복기 화면 - 게임 화면과 유사하게 */
.review-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 15px;
}

.loading-message,
.empty-message,
.error-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

.error-message {
    color: var(--danger);
}

/* 관전 목록 */
.spectate-list,
.my-games-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.spectate-item,
.my-game-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-radius: 12px;
    padding: 15px 20px;
    border: 1px solid var(--card-border);
}

.spectate-players,
.game-players {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.player-black {
    color: var(--text-primary);
}

.player-white {
    color: var(--text-secondary);
}

.vs {
    color: var(--text-muted);
    font-size: 14px;
}

.spectate-info {
    display: flex;
    gap: 15px;
    color: var(--text-muted);
    font-size: 14px;
}

.spectate-btn,
.review-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.spectate-btn:hover,
.review-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.3);
}

/* 내 대국 목록 */
.my-game-item {
    gap: 15px;
}

.game-result-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.game-result-area .game-moves {
    font-size: 11px;
    color: var(--text-muted);
}

.my-game-item .game-result {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 14px;
}

.my-game-item .game-result.win {
    background: linear-gradient(135deg, var(--success), #5A8A69);
}

.my-game-item .game-result.loss {
    background: linear-gradient(135deg, var(--danger), #A06060);
}

.game-info {
    flex: 1;
}

.game-meta {
    display: flex;
    gap: 15px;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 5px;
}

/* 게임 타입 뱃지 */
.game-type-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
    margin-right: 5px;
    margin-top: 3px;
}

.game-type-badge.ranked {
    background: linear-gradient(135deg, #6C7A89, #485563);
}

.game-type-badge.friend {
    background: linear-gradient(135deg, #7B68EE, #6A5ACD);
}

/* 복기 화면 */
.review-header {
    text-align: center;
    margin-bottom: 15px;
}

.review-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    max-width: 500px;
    max-height: 500px;
    margin-left: auto;
    margin-right: auto;
}

#review-board-canvas {
    border-radius: 5px;
}

.review-info {
    text-align: center;
    margin-bottom: 20px;
}

#review-players {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text-primary);
}

#review-result {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 5px;
}

#review-move-count {
    color: var(--primary);
    font-weight: bold;
    font-size: 18px;
}

.review-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.review-content .action-btn {
    width: 100%;
}

.review-controls .control-btn {
    padding: 10px 20px;
    font-size: 14px;
}

/* 메뉴 버튼 secondary 스타일 */
.menu-btn.secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--card-border);
    padding: 16px 40px;
    font-size: 17px;
    font-weight: 500;
    text-shadow: none;
}

.menu-btn.secondary:hover {
    background: var(--card-bg);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 5px 15px rgba(90, 72, 53, 0.15);
}

/* 모바일 대응 - 관전/복기 */
@media (max-width: 480px) {
    .spectate-item,
    .my-game-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .spectate-btn,
    .review-btn {
        width: 100%;
    }

    .review-controls {
        flex-wrap: wrap;
    }

    .review-controls .control-btn {
        flex: 1;
        min-width: 70px;
    }

    .review-board-container {
        width: calc(100vw - 30px);
        max-width: calc(100vw - 30px);
        padding: 2px;
    }

    .review-content {
        padding: 0 5px;
    }
}

/* 게임 재개/새 게임 선택 모달 */
.resume-game-modal {
    max-width: 400px;
}

.resume-game-info {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.resume-game-type {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 15px;
}

.resume-game-details {
    text-align: left;
}

.resume-game-details p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.resume-game-details p:last-child {
    margin-bottom: 0;
}

.resume-game-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.resume-game-buttons .action-btn {
    width: 100%;
}

/* 커스텀 알림 팝업 */
.custom-alert-modal {
    max-width: 380px;
    text-align: center;
}

.custom-alert-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
}

.alert-icon-info {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Georgia, serif;
    font-style: italic;
}

.alert-icon-success {
    background: linear-gradient(135deg, var(--success) 0%, #4A7A40 100%);
    color: white;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-icon-error {
    background: linear-gradient(135deg, var(--danger) 0%, #A04040 100%);
    color: white;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-icon-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #9A7520 100%);
    color: white;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-icon-question {
    background: linear-gradient(135deg, #6A8AB5 0%, #4A6A95 100%);
    color: white;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Georgia, serif;
}

.custom-alert-modal h2 {
    font-size: 22px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.custom-alert-modal p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 25px;
    word-break: keep-all;
}

.custom-alert-modal .action-btn {
    min-width: 120px;
}

.custom-alert-modal .modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.custom-alert-modal .modal-buttons .action-btn {
    flex: 1;
    max-width: 140px;
}

/* 모바일 커스텀 알림 */
@media (max-width: 480px) {
    .custom-alert-modal {
        max-width: 90%;
        padding: 25px 20px;
    }

    .custom-alert-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }

    .custom-alert-modal h2 {
        font-size: 18px;
    }

    .custom-alert-modal p {
        font-size: 14px;
    }
}

/* 상대방 연결 끊김 카운트다운 오버레이 */
.disconnect-countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.disconnect-countdown-overlay.active {
    display: flex;
}

.disconnect-countdown-content {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 380px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.disconnect-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.disconnect-countdown-content h3 {
    font-size: 22px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.disconnect-countdown-content p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.disconnect-timer {
    background: linear-gradient(135deg, var(--warning) 0%, #9A7520 100%);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 15px;
}

.disconnect-timer #disconnect-countdown-value {
    font-size: 42px;
    font-weight: bold;
    display: block;
    line-height: 1;
}

.disconnect-timer span {
    font-size: 16px;
}

.disconnect-warning {
    font-size: 13px !important;
    color: var(--text-muted) !important;
    margin-bottom: 0 !important;
}

/* 모바일 대응 - 연결 끊김 오버레이 */
@media (max-width: 480px) {
    .disconnect-countdown-content {
        padding: 30px 25px;
        margin: 0 20px;
    }

    .disconnect-icon {
        font-size: 40px;
    }

    .disconnect-countdown-content h3 {
        font-size: 18px;
    }

    .disconnect-timer {
        padding: 15px 30px;
    }

    .disconnect-timer #disconnect-countdown-value {
        font-size: 36px;
    }
}
