/* 기본 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #8e44ad;
    --primary-light: #9b59b6;
    --primary-dark: #6a1b9a;
    --accent-color: #ff9800;
    --accent-dark: #f57c00;
    --king-color: #ffd166;
    --citizen-color: #2196f3;
    --light-color: #f9f3ff;
    --dark-color: #333333;
    --success-color: #4caf50;
    --danger-color: #f44336;
    --text-color: #424242;
    --text-secondary: #757575;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    --card-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    --border-radius: 15px;
    --border-radius-sm: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 공통 스타일 */
a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

/* 헤더 */
header {
    background-color: var(--primary-color);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo {
    font-family: 'Jua', sans-serif;
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.logo i {
    margin-right: 8px;
    font-size: 1.8rem;
    color: var(--king-color);
}

/* 사용자 정보 표시 */
.user-info {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.user-info:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.user-info i {
    color: white;
    font-size: 0.9rem;
}

.user-id-display {
    font-size: 0.9rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.clickable {
    cursor: pointer;
}

/* 메인 콘텐츠 */
main {
    padding: 80px 0 40px;
}

/* 섹션 헤더 */
.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #e1d0f0;
    padding-bottom: 10px;
    position: relative;
}

.section-header i {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-right: 10px;
}

.section-header h2 {
    font-family: 'Jua', sans-serif;
    font-size: 1.8rem;
    color: var(--primary-dark);
    flex: 1;
}

.player-count {
    font-size: 1rem;
    background-color: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
}

/* 방 정보 영역 */
.room-info-section {
    margin-bottom: 30px;
}

.room-info {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--card-shadow);
}

/* 방 정보 그리드 레이아웃 - 2x2 형태로 변경 */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 20px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    transition: all 0.2s ease;
    height: 100%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.info-item:hover {
    background-color: rgba(255, 255, 255, 0.95);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.info-item i {
    font-size: 2.2rem;
    color: var(--primary-color);
    opacity: 0.9;
    width: 45px;
    text-align: center;
    transition: transform 0.2s ease;
}

.info-item:hover i {
    transform: scale(1.15);
}

/* 각 정보 항목별 특별한 스타일 */
.room-name-item i {
    color: #3498db;
}

.owner-item i {
    color: #9b59b6;
}

.kings-item i {
    color: var(--king-color);
}

.status-item i {
    color: #2ecc71;
}

.info-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    display: block;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
    display: block;
}

/* 게임 상태 인디케이터 */
.status-indicator {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.status-waiting {
    background-color: rgba(33, 150, 243, 0.2);
    color: #1976d2;
}

.status-playing {
    background-color: rgba(76, 175, 80, 0.2);
    color: #388e3c;
}

/* 플레이어 영역 */
.players-section {
    margin-bottom: 30px;
}

.game-area {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    min-height: 300px;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
    text-align: center;
}

.player-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.player-card.king {
    background-color: rgba(255, 209, 102, 0.2);
}

.player-card.citizen {
    background-color: rgba(33, 150, 243, 0.1);
}

.player-card.dead {
    opacity: 0.7;
    background-color: #f5f5f5;
}

.player-card.dead::after {
    content: "✝";
    position: absolute;
    font-size: 2.5rem;
    color: var(--danger-color);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.7;
}

.player-card.current-player {
    border: 2px solid var(--primary-color);
}

.player-card i {
    font-size: 2rem;
    margin-bottom: 8px;
}

.player-card i.fa-crown {
    color: var(--king-color);
}

.player-card i.fa-user {
    color: var(--citizen-color);
}

.player-card .player-name {
    font-weight: 500;
    font-size: 0.9rem;
    word-break: break-word;
    max-width: 100%;
}

.player-card .player-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* 액션 버튼 영역 */
.actions-section {
    margin-bottom: 30px;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 15px;
}

/* 나가기 버튼은 마지막 행에서 전체 폭을 차지 */
.action-buttons .exit-btn {
    grid-column: 1 / -1;
}

.action-btn {
    padding: 12px 18px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.action-btn i {
    font-size: 1.1rem;
}

.start-btn {
    background-color: var(--success-color);
    color: white;
}

.start-btn:hover {
    background-color: #5cb85c;
}

.role-btn {
    background-color: var(--king-color);
    color: var(--dark-color);
}

.role-btn:hover {
    background-color: #ffdb5c;
}

.result-btn {
    background-color: var(--primary-color);
    color: white;
}

.result-btn:hover {
    background-color: var(--primary-light);
}

.reset-btn {
    background-color: var(--accent-color);
    color: white;
}

.reset-btn:hover {
    background-color: var(--accent-dark);
}

.exit-btn {
    background-color: var(--danger-color);
    color: white;
}

.exit-btn:hover {
    background-color: #e53935;
}

/* 컨페티 효과 */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f0f;
    opacity: 0.7;
    pointer-events: none;
    will-change: transform;
}

/* 스크롤 상단 버튼 */
.scroll-to-top {
    position: fixed;
    bottom: -60px;
    right: 20px;
    width: 45px;
    height: 45px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 99;
}

.scroll-to-top.show {
    bottom: 20px;
}

.scroll-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
}

/* 스크롤바 스타일 */
.missions-list::-webkit-scrollbar,
.teams-container::-webkit-scrollbar {
    width: 6px;
}

.missions-list::-webkit-scrollbar-track,
.teams-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.missions-list::-webkit-scrollbar-thumb,
.teams-container::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 10px;
}

.missions-list::-webkit-scrollbar-thumb:hover,
.teams-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}