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

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7, #fd79a8);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    min-height: 100vh;
    color: #333;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.rainbow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(255, 0, 150, 0.1), 
        rgba(0, 255, 255, 0.1), 
        rgba(255, 255, 0, 0.1), 
        rgba(255, 0, 255, 0.1));
    background-size: 200% 200%;
    animation: rainbowMove 10s ease infinite;
    z-index: -1;
}

@keyframes rainbowMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.title {
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #fd79a8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.subtitle {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 30px;
    color: #666;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.room-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

input[type="text"] {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: #4ecdc4;
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.2);
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: linear-gradient(45deg, #96ceb4, #ffeaa7);
    color: #333;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-danger {
    background: linear-gradient(45deg, #ff6b6b, #fd79a8);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 等待室樣式 */
.room-info {
    text-align: center;
    margin-bottom: 30px;
}

.room-info h2 {
    font-size: 2rem;
    color: #4ecdc4;
    margin-bottom: 10px;
}

.players-list {
    margin-bottom: 30px;
}

.players-list h3 {
    margin-bottom: 15px;
    color: #333;
}

#players-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.player-card {
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #ddd;
}

.player-card.host {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.game-settings {
    margin-bottom: 30px;
}

.setting-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group label {
    font-weight: 500;
}

select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

/* 遊戲界面樣式 */
.game-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    overflow: hidden;
}

.game-header {
    background: linear-gradient(45deg, #4ecdc4, #45b7d1);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.phase-info {
    font-size: 1.2rem;
    font-weight: 500;
}

.phase-info #phase-timer {
    margin-left: 20px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 15px;
}

.role-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
}

.role-icon {
    font-size: 2rem;
}

.role-name {
    font-size: 1.1rem;
    font-weight: 500;
}

.game-main {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    min-height: 600px;
}

.left-panel, .right-panel {
    padding: 20px;
    border-right: 1px solid #eee;
}

.right-panel {
    border-right: none;
    border-left: 1px solid #eee;
}

.center-panel {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-area {
    width: 100%;
    max-width: 400px;
}

.action-panel h3 {
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.alive-players, .dead-players {
    margin-bottom: 30px;
}

.alive-players h3, .dead-players h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.player-list-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.player-list-item:hover {
    background: rgba(78, 205, 196, 0.1);
    border-color: #4ecdc4;
}

.player-list-item.selected {
    background: rgba(78, 205, 196, 0.2);
    border-color: #4ecdc4;
}

.player-list-item.dead {
    opacity: 0.6;
    background: rgba(255, 107, 107, 0.1);
}

.voting-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vote-option {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #ddd;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.vote-option:hover {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
}

.vote-option.selected {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.2);
}

/* 聊天室樣式 */
.game-log, .chat-area {
    margin-bottom: 20px;
}

.game-log h3, .chat-area h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1rem;
}

#game-log-content, #chat-messages {
    height: 150px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
}

.chat-input {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.chat-input input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.log-entry {
    margin-bottom: 8px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 5px;
}

.chat-message {
    margin-bottom: 5px;
    padding: 3px 5px;
}

.chat-message.system {
    color: #666;
    font-style: italic;
}

/* 結果界面樣式 */
.result-content {
    text-align: center;
    max-width: 600px;
}

#game-result-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #4ecdc4;
}

.team-result {
    font-size: 1.5rem;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(78, 205, 196, 0.1);
    border-radius: 15px;
    border: 2px solid #4ecdc4;
}

.roles-reveal {
    margin-bottom: 30px;
}

.role-reveal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    border: 1px solid #ddd;
}

.result-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .game-main {
        grid-template-columns: 200px 1fr 250px;
    }
}

@media (max-width: 768px) {
    .game-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .left-panel, .right-panel {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    
    .right-panel {
        border-left: none;
        border-top: 1px solid #eee;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .container {
        padding: 20px;
    }
    
    .title {
        font-size: 2rem;
    }
}

/* 動畫效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.btn-primary:hover {
    animation: pulse 0.6s ease-in-out;
}

.role-card {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 特殊效果 */
.sparkle {
    position: relative;
    overflow: hidden;
}

.sparkle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: sparkle 2s infinite;
}

@keyframes sparkle {
    0% { left: -100%; }
    100% { left: 100%; }
}