/* 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

/* 화면 전환 */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
}

/* 로고 및 제목 */
.logo h1 {
    font-size: 3rem;
    color: #4a5568;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.logo p {
    font-size: 1.2rem;
    color: #718096;
    margin-bottom: 30px;
}

/* 입력 필드 */
input[type="text"] {
    width: 100%;
    max-width: 300px;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 15px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

input[type="text"]:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* 버튼 스타일 */
button {
    padding: 12px 24px;
    font-size: 1.1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    margin: 5px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px 0 rgba(102, 126, 234, 0.3);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px 0 rgba(102, 126, 234, 0.4);
}

.primary-btn.disabled,
.primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 4px 15px 0 rgba(102, 126, 234, 0.2) !important;
}

.secondary-btn {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.secondary-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.menu-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 15px auto;
    padding: 20px;
    background: white;
    color: #4a5568;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    font-size: 1.2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    border-color: #4299e1;
}

/* 에러 메시지 */
.error-message {
    color: #e53e3e;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* 사용자 정보 */
.user-info {
    background: white;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: bold;
    color: #4a5568;
}

/* 연결 상태 */
.connection-status {
    margin-top: 8px;
    font-size: 0.9rem;
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-indicator {
    font-size: 1rem;
}

.connection-status.online {
    color: #38a169;
}

.connection-status.offline {
    color: #e53e3e;
}

.connection-status.connecting {
    color: #d69e2e;
}

/* 게임 모드 선택 */
.game-mode-selection {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.mode-toggle input[type="radio"] {
    display: none;
}

.mode-toggle label {
    padding: 12px 24px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.mode-toggle input[type="radio"]:checked + label {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* 대기실 스타일 */
.room-info {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.room-info h2 {
    color: #4a5568;
    margin-bottom: 10px;
}

.players-list {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin: 8px 0;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px solid transparent;
}

.player-item.host {
    border-color: #667eea;
    background: #e6f3ff;
}

.player-item.me {
    border-color: #48bb78;
    background: #f0fff4;
}

/* 게임 화면 레이아웃 */
.game-container {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100vh;
    padding: 10px;
    gap: 10px;
}

.other-players {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.other-players-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}

.player-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    min-width: 120px;
    text-align: center;
    transition: all 0.3s ease;
}

.player-card.current-turn {
    border-color: #667eea;
    background: #e6f3ff;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.player-card.eliminated {
    opacity: 0.5;
    background: #fed7d7;
    border-color: #fc8181;
}

.player-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: #4a5568;
}

.player-stats {
    font-size: 0.9rem;
    color: #718096;
}

/* 게임 보드 */
.game-board {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.current-turn {
    font-size: 1.3rem;
    font-weight: bold;
    color: #4a5568;
    margin-bottom: 15px;
    padding: 10px;
    background: #e6f3ff;
    border-radius: 8px;
}

.action-log {
    background: #f7fafc;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 120px;
    overflow-y: auto;
}

.action-log-item {
    padding: 5px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: #4a5568;
}

.action-log-item:last-child {
    border-bottom: none;
}

/* 행동 버튼 */
.action-buttons, .character-buttons, .target-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
    padding: 0 10px;
}

.action-btn, .character-btn, .target-btn {
    padding: 20px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    text-align: center;
}

.action-btn:hover, .character-btn:hover, .target-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.action-btn:disabled, .character-btn:disabled, .target-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #cbd5e0;
    box-shadow: none;
}

/* 캐릭터 카드 */
.character-card {
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    margin: 3px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.character-description {
    font-size: 0.7rem;
    color: #718096;
    margin-top: 3px;
    line-height: 1.1;
}

.log-entry {
    padding: 5px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: #4a5568;
    text-align: left;
}

.log-entry:last-child {
    border-bottom: none;
}

.character-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.character-card.dead {
    opacity: 0.3;
    background: #fed7d7;
    border-color: #fc8181;
    cursor: not-allowed;
}

.character-card.back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.character-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.character-image {
    width: 60px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 5px;
}

.character-name {
    font-weight: bold;
    font-size: 0.9rem;
    color: #4a5568;
}

/* 내 정보 영역 */
.my-info {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.my-cards {
    margin-bottom: 15px;
}

.my-cards h3 {
    color: #4a5568;
    margin-bottom: 10px;
}

.my-cards-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.my-coins {
    color: #4a5568;
    font-weight: bold;
    margin-bottom: 15px;
}

.coin-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.coin-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.coin-item {
    display: inline-block;
}

.coin-image {
    width: 25px;
    height: 25px;
    object-fit: contain;
}

.coin-more {
    font-size: 0.9rem;
    color: #718096;
    font-weight: normal;
}

/* 도전/방어 영역 */
.challenge-defense {
    background: #fff5f5;
    border: 2px solid #fed7d7;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.challenge-info {
    margin-bottom: 15px;
    font-weight: bold;
    color: #c53030;
}

.challenge-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

#challenge-btn {
    background: #e53e3e;
    color: white;
}

#block-btn {
    background: #3182ce;
    color: white;
}

#allow-btn {
    background: #38a169;
    color: white;
}

/* 게임 종료 화면 */
.victory-animation {
    margin-bottom: 30px;
}

.victory-animation h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-30px);
    }
    60% {
        transform: translateY(-15px);
    }
}

.rankings {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #e2e8f0;
}

.ranking-item.first {
    border-left-color: #ffd700;
    background: #fffbeb;
}

.ranking-item.second {
    border-left-color: #c0c0c0;
    background: #f7fafc;
}

.ranking-item.third {
    border-left-color: #cd7f32;
    background: #fffaf0;
}

/* 모달 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close:hover {
    color: #333;
}

/* 알림 팝업 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #667eea;
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 300px;
    font-weight: bold;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: #e53e3e;
}

.notification.success {
    background: #38a169;
}

.notification.warning {
    background: #d69e2e;
}

/* 비활성화된 모드 */
.disabled-label {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="radio"]:disabled + .disabled-label {
    color: #999;
    text-decoration: line-through;
}

/* 게임 시작 팝업 */
.start-modal {
    max-width: 400px;
    text-align: center;
}

.start-popup h2 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 2rem;
}

.start-popup p {
    color: #718096;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.start-popup button {
    margin-top: 20px;
    font-size: 1.2rem;
    padding: 15px 30px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .game-container {
        padding: 5px;
        gap: 5px;
    }
    
    .other-players-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-buttons, .character-buttons, .target-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .my-cards-container {
        justify-content: center;
        gap: 5px;
    }
    
    .character-card {
        min-width: 80px;
        min-height: 120px;
        padding: 10px;
    }
    
    .character-icon {
        font-size: 2rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 2rem;
    }
    
    .menu-btn {
        font-size: 1rem;
        padding: 15px;
    }
    
    .challenge-buttons {
        flex-direction: column;
    }
    
    input[type="text"] {
        font-size: 1rem;
        padding: 12px;
    }
}

/* 도움말 버튼 */
.help-btn {
    background: #4299e1;
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
}

.help-btn:hover {
    background: #3182ce;
    transform: scale(1.1);
}

/* 피난처 행동 (확장판) */
.sanctuary-actions {
    background: #fffaf0;
    border: 2px solid #d69e2e;
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
}

.sanctuary-actions h4 {
    color: #d69e2e;
    margin-bottom: 10px;
    text-align: center;
}

.sanctuary-info {
    text-align: center;
    font-weight: bold;
    color: #d69e2e;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

/* 종교 표시 */
.religion-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 5px;
}

.religion-catholic {
    background: #3182ce;
    color: white;
}

.religion-protestant {
    background: #38a169;
    color: white;
}

/* 공유 기능 */
.sharing-section {
    margin-top: 20px;
    padding: 15px;
    background: #f0fff4;
    border-radius: 8px;
    border: 1px solid #68d391;
}

.sharing-section p {
    margin-bottom: 10px;
    color: #2d3748;
    font-size: 0.9rem;
}

.share-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-btn:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.url-sharing-info {
    margin-top: 15px;
    padding: 10px;
    background: #e6f3ff;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
}

.url-sharing-info p {
    margin: 0;
    color: #2d3748;
    font-size: 0.9rem;
}

/* 게임 설명서 스타일 */
.rules-content {
    text-align: left;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.rules-content h2 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 30px;
}

.rules-content h3 {
    color: #667eea;
    margin: 25px 0 15px 0;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.rules-content h4 {
    color: #4a5568;
    margin: 20px 0 10px 0;
}

.rules-content p, .rules-content li {
    line-height: 1.6;
    margin-bottom: 10px;
    color: #4a5568;
}

.rules-content ul, .rules-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.character-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #f7fafc;
    border-radius: 8px;
    overflow: hidden;
}

.character-table th, .character-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.character-table th {
    background: #667eea;
    color: white;
    font-weight: bold;
}

.character-table tr:hover {
    background: #edf2f7;
}

.example-box {
    background: #e6f3ff;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.tip-box {
    background: #f0fff4;
    border-left: 4px solid #38a169;
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

.warning-box {
    background: #fffbeb;
    border-left: 4px solid #d69e2e;
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
}

/* 행동 대응 팝업 */
.action-response-popup {
    max-width: 500px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    padding: 25px;
}

.action-response-popup h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

#action-response-details {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.action-response-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.response-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.allow-btn {
    background: #48bb78;
    color: white;
}

.allow-btn:hover {
    background: #38a169;
    transform: translateY(-2px);
}

.challenge-btn {
    background: #e53e3e;
    color: white;
}

.challenge-btn:hover {
    background: #c53030;
    transform: translateY(-2px);
}

.block-btn {
    background: #ed8936;
    color: white;
}

.block-btn:hover {
    background: #dd6b20;
    transform: translateY(-2px);
}

#response-timer {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
}

#timer-seconds {
    color: #ffd700;
    font-size: 1.2rem;
}

/* 캐릭터 선택 UI */
.character-action-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
}

.character-action-btn:hover {
    background: linear-gradient(135deg, #e084f5 0%, #ef4e64 100%) !important;
}

.character-action-info {
    text-align: center;
}

.character-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 5px;
}

.character-icon {
    font-size: 1.2rem;
}

.action-detail {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.3;
}

.cancel-btn {
    background: #cbd5e0 !important;
    color: #4a5568 !important;
}

.cancel-btn:hover {
    background: #a0aec0 !important;
    transform: translateY(-2px);
}

.character-selection {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #667eea;
    border-radius: 15px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.character-selection h3 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.2rem;
}