/* ========================================
   WEREWOLF GAME - STYLES
   Modern Dark Theme with Glassmorphism (Matched to Spy Game)
======================================== */

:root {
    /* Colors */
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(30, 30, 60, 0.6);
    --bg-card-hover: rgba(40, 40, 80, 0.8);

    /* Werewolf Themed Accents (Violet/Purple to match Spy or keep slight variation?) */
    /* User said "make it like Spy Game", so we use Spy Game's Violet defaults */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);

    /* Day/Night specific */
    --night-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --day-gradient: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);

    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #606080;

    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Shadows & Effects */
    --glow-primary: 0 0 20px rgba(99, 102, 241, 0.4);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

    /* Sizes */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Prompt', sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background 1s ease;
}

/* Day Mode Override */
body.day-mode {
    background: #1a1a2e;
    /* Slightly lighter dark blue */
    background-image:
        radial-gradient(ellipse at top, rgba(245, 158, 11, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(249, 115, 22, 0.1) 0%, transparent 50%);
}

/* Background Animation Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%236366f1' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.hidden {
    display: none !important;
}

/* ========================================
   SECTIONS & ANIMATIONS
======================================== */
.section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   LOGO
======================================== */
.logo {
    text-align: center;
    padding: 30px 0 25px;
    position: relative;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(30px);
    animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.1); }
}

.logo-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 8px;
    animation: float 3s ease-in-out infinite;
    position: relative;
    filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4));
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-2deg); }
    75% { transform: translateY(-4px) rotate(2deg); }
}

.logo h1 {
    font-size: 2.8rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.25em;
    position: relative;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 6px;
    font-weight: 300;
}

/* ========================================
   CARDS & CONTAINERS
======================================== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}

/* ========================================
   INPUTS
======================================== */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 1;
}

.input-group .input-wrapper input {
    padding-left: 52px;
}

.input-group input,
.room-code-input {
    width: 100%;
    padding: 15px 18px;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.room-code-input {
    text-transform: uppercase;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.6rem;
    padding: 16px;
}

.input-group input:focus,
.room-code-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--glow-primary);
    background: rgba(0, 0, 0, 0.45);
}

.input-group input::placeholder,
.room-code-input::placeholder {
    color: var(--text-muted);
}

/* ========================================
   BUTTONS
======================================== */
.button-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 24px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.5s ease;
    transform: translate(-50%, -50%);
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

.btn-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--glow-primary);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 35px rgba(99, 102, 241, 0.5), 0 8px 30px rgba(0,0,0,0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.btn-accent {
    background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
    color: white;
    box-shadow: 0 0 20px rgba(20, 184, 166, 0.3);
}

.btn-accent:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 35px rgba(20, 184, 166, 0.5), 0 8px 30px rgba(0,0,0,0.4);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-2px);
}

.btn-small {
    padding: 10px 18px;
    font-size: 0.85rem;
    flex: none;
}

.btn-large {
    padding: 18px 32px;
    font-size: 1.15rem;
    width: 100%;
    border-radius: var(--radius-lg);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

/* Icon Action Buttons */
.btn-icon-action {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon-action:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* ========================================
   JOIN ROOM & CREATE ROOM
======================================== */
.join-room {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 20px;
    animation: slideDown 0.3s ease;
}

.create-room-options {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 20px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.password-option {
    margin-bottom: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    position: relative;
}

.checkbox-label:hover {
    background: rgba(0, 0, 0, 0.3);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.password-option input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    margin-top: 10px;
    font-size: 1rem;
    font-family: inherit;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.password-option input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--glow-primary);
}

/* ========================================
   ROOM LOBBY LIST
======================================== */
.room-lobby {
    margin-top: 20px;
    padding: 22px;
}

.room-lobby h3,
.rules-preview h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    font-size: 1.1rem;
}

.room-list {
    display: grid;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.room-list::-webkit-scrollbar { width: 5px; }
.room-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
.room-list::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 3px; }

.no-rooms {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-size: 0.9rem;
}

.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.room-item:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--accent-primary);
    transform: translateX(5px);
}

.room-info { display: flex; flex-direction: column; gap: 3px; }
.room-code { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.15em; color: var(--accent-secondary); }
.room-host { font-size: 0.8rem; color: var(--text-secondary); }
.room-meta { display: flex; align-items: center; gap: 10px; }
.room-players { font-size: 0.85rem; color: var(--text-secondary); }
.room-locked, .room-open { font-size: 1.1rem; }

/* Rules Preview */
.rules-preview {
    padding: 22px;
    margin-top: 20px;
}

/* ========================================
   BACK HOME LINK
======================================== */
.back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 25px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.back-home:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    transform: translateX(-4px);
}

/* ========================================
   ROOM HEADER & CODE DISPLAY
======================================== */
.room-header {
    text-align: center;
    margin-bottom: 24px;
}

.room-code-display {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 40px;
    gap: 8px;
    position: relative;
}

.room-code-display .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 500;
}

.room-code-display .code {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: 0.35em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.room-actions-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* ========================================
   PLAYER LIST
======================================== */
.player-list {
    display: grid;
    gap: 8px;
    margin: 16px 0;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.3s ease;
    animation: playerIn 0.3s ease;
}

@keyframes playerIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.player-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.95rem;
}

.player-badge {
    font-size: 0.7rem;
    padding: 4px 12px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.player-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-status.online {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
}

.player-status.offline {
    background: var(--text-muted);
}

/* Rules / Roles Grid */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.role-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.role-item span {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 5px;
}

/* Game Phase & Timer */
.phase-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.day-night-icon {
    font-size: 2rem;
    animation: float 3s ease-in-out infinite;
}

.timer {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    padding: 10px 40px;
    border-radius: var(--radius-xl);
    border: 2px solid var(--accent-primary);
    box-shadow: var(--glow-primary);
    margin-bottom: 20px;
}

/* Role Card (3D Flip) */
.role-card {
    perspective: 1000px;
    margin: 20px auto;
    width: 220px;
    height: 300px;
    cursor: pointer;
}

.role-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.role-card.flipped .role-card-inner {
    transform: rotateY(180deg);
}

.role-card-front,
.role-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.role-card-front {
    background: var(--accent-gradient);
    box-shadow: var(--glow-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.role-card-back {
    background: var(--bg-card);
    border: 2px solid var(--accent-primary);
    transform: rotateY(180deg);
    padding: 20px;
    text-align: center;
}

.card-icon {
    font-size: 5rem;
}

.role-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.role-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.role-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn-role-detail {
    margin-top: 12px;
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 20px;
    color: var(--accent-secondary);
    font-size: 0.8rem;
    font-family: 'Prompt', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-role-detail:hover {
    background: rgba(99, 102, 241, 0.35);
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

.btn-role-detail:active {
    transform: scale(0.95);
}

/* Targets & Action */
.action-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 20px;
    border: 2px solid var(--accent-primary);
    margin: 20px 0;
}

.target-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.target-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.target-item:hover {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
}

.target-item.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
}

.target-item.dead {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(1);
}

/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-gradient);
    box-shadow: var(--glow-primary);
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
}

.chat-toggle-btn.pulse {
    animation: pulse 1s infinite;
}

.chat-container {
    width: 300px;
    height: 400px;
    background: rgba(15, 15, 30, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.other-message {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 2px;
}

.my-message {
    align-self: flex-end;
    background: var(--accent-primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.message-sender {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-bottom: 2px;
}

.chat-input-area {
    padding: 10px;
    display: flex;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.chat-input-area input {
    flex: 1;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: none;
    background: rgba(0, 0, 0, 0.3);
    color: white;
}

.chat-input-area button {
    padding: 8px 15px;
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
}

/* Utilities */
.unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid var(--bg-primary);
}

/* ========================================
   NIGHT OVERLAY
======================================== */
.night-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(10, 10, 40, 0.6) 0%, rgba(0, 0, 10, 0.85) 100%);
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.night-overlay.active {
    opacity: 1;
}

/* ========================================
   LOBBY ACTIONS
======================================== */
.lobby-actions {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.waiting-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.waiting-dots {
    display: inline-flex;
    gap: 4px;
}

.waiting-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: dotPulse 1.4s infinite;
}

.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

.min-players-text {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 8px;
}

/* ========================================
   MESSAGE PANEL (waiting/phase info)
======================================== */
.message-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 30px 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin: 20px 0;
}

.message-panel p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   GAME PLAYERS STATUS
======================================== */
.game-players {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.game-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.game-player.dead {
    opacity: 0.4;
    text-decoration: line-through;
    filter: grayscale(0.8);
}

.game-player.is-me {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

/* ========================================
   VOTING SECTION
======================================== */
.voting-header {
    text-align: center;
    margin-bottom: 20px;
}

.voting-header h2 {
    margin-bottom: 5px;
}

.voting-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.voting-players {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.vote-target {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.vote-target:hover {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
}

.vote-target.selected {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

.vote-target.dead {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(1);
}

.vote-status {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 10px;
}

/* ========================================
   RESULT SECTION
======================================== */
.result-content {
    text-align: center;
    padding: 30px 0;
}

.result-content h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.result-content p {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ========================================
   WITCH ACTIONS PANEL
======================================== */
.witch-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.witch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.witch-btn-heal {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.3);
}

.witch-btn-heal:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: var(--success);
}

.witch-btn-poison {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border-color: rgba(168, 85, 247, 0.3);
}

.witch-btn-poison:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: #a855f7;
}

.witch-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ========================================
   GAME HEADER
======================================== */
.game-header {
    text-align: center;
    margin-bottom: 20px;
}

/* ========================================
   TAP HINT
======================================== */
.tap-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

/* ========================================
   CHAT CLOSE BUTTON
======================================== */
.chat-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

.chat-close-btn:hover {
    color: var(--text-primary);
}

/* ========================================
   LOADING SPINNER
======================================== */
.loading-spinner {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 0.9rem;
}

/* ========================================
   ROOM LOBBY
======================================== */
.room-lobby h3 {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.room-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ========================================
   PASSWORD OPTION
======================================== */
.password-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.password-option label {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ========================================
   PLAYERS STATUS CARD
======================================== */
.players-status {
    margin-top: 20px;
}

.players-status h3 {
    margin-bottom: 10px;
    font-size: 1rem;
}

/* ========================================
   PHASE TRANSITION ANIMATION
======================================== */
@keyframes phaseFlash {
    0% { opacity: 0; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

.phase-change-anim {
    animation: phaseFlash 0.6s ease-out;
}

/* ========================================
   GAME SETTINGS (Lobby Timer Panel)
======================================== */
.game-settings {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-title {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-align: center;
}

.setting-row {
    margin-bottom: 15px;
}

.setting-row label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.setting-options {
    display: flex;
    gap: 8px;
}

.setting-btn {
    flex: 1;
    padding: 10px 8px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.setting-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.setting-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

/* ========================================
   MORNING ANNOUNCEMENT OVERLAY
======================================== */
.morning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: morningFadeIn 0.5s ease-out;
}

@keyframes morningFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.morning-content {
    text-align: center;
    padding: 30px;
    max-width: 400px;
    width: 90%;
}

.morning-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 30px;
    animation: titlePulse 1s ease-in-out;
}

@keyframes titlePulse {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.morning-animation {
    font-size: 4rem;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    position: relative;
}

.morning-message {
    font-size: 1.2rem;
    color: var(--text-secondary);
    animation: messageSlideUp 0.5s ease-out 1s both;
}

@keyframes messageSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Wolf Attack Animation */
.morning-animation .wolf-emoji {
    animation: wolfAttack 1.5s ease-in-out;
}

@keyframes wolfAttack {
    0% { transform: translateX(-80px); opacity: 0; }
    30% { transform: translateX(0); opacity: 1; }
    50% { transform: scale(1.3); }
    70% { transform: translateX(10px) scale(1); }
    100% { transform: translateX(0); }
}

.morning-animation .victim-emoji {
    animation: victimFade 1.5s ease-in-out;
}

@keyframes victimFade {
    0%, 30% { transform: scale(1); opacity: 1; }
    60% { transform: scale(1.2); opacity: 0.5; }
    100% { transform: scale(0); opacity: 0; }
}

.morning-animation .skull-emoji {
    animation: skullAppear 0.5s ease-out 1.2s both;
}

@keyframes skullAppear {
    from { transform: scale(0) rotate(-180deg); opacity: 0; }
    to { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Saved Animation */
.morning-animation .shield-emoji {
    animation: shieldAppear 0.8s ease-out 0.8s both;
}

@keyframes shieldAppear {
    from { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.3); }
    to { transform: scale(1); opacity: 1; }
}

.morning-animation .sparkle-emoji {
    animation: sparkle 0.5s ease-out 1.2s both;
}

@keyframes sparkle {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Peaceful Animation */
.morning-animation .sun-emoji {
    animation: sunRise 1.5s ease-out;
}

@keyframes sunRise {
    0% { transform: translateY(50px); opacity: 0; }
    50% { transform: translateY(-10px); opacity: 1; }
    100% { transform: translateY(0); }
}

.morning-animation .nature-emoji {
    animation: natureAppear 0.5s ease-out var(--delay, 0.5s) both;
}

@keyframes natureAppear {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Poison Animation */
.morning-animation .poison-emoji {
    animation: poisonDrip 1.2s ease-in-out;
}

@keyframes poisonDrip {
    0% { transform: rotate(0); }
    30% { transform: rotate(-30deg); }
    60% { transform: rotate(0); }
    100% { transform: rotate(0); }
}

.morning-animation .poison-victim {
    animation: poisonEffect 1.5s ease-in-out;
}

@keyframes poisonEffect {
    0%, 30% { transform: scale(1); opacity: 1; filter: hue-rotate(0deg); }
    60% { transform: scale(1.1); filter: hue-rotate(90deg); }
    100% { transform: scale(0.8); opacity: 0.3; filter: hue-rotate(180deg); }
}

/* ========================================
   DEAD PLAYER / SPECTATOR OVERLAY
======================================== */
.dead-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    pointer-events: none;
    z-index: 10;
}

.dead-overlay::after {
    content: '👻 ผู้ชม';
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    z-index: 11;
}

body.spectator-mode .action-panel,
body.spectator-mode .voting-player {
    pointer-events: none;
    opacity: 0.5;
}

body.spectator-mode .chat-input-area {
    opacity: 0.3;
    pointer-events: none;
}

body.spectator-mode .chat-input-area::after {
    content: '👻 คุณตายแล้ว ไม่สามารถแชทได้';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

body.spectator-mode #btnSkipAction {
    pointer-events: none;
    opacity: 0.3;
}

/* ========================================
   NIGHT VILLAGER SLEEP PANEL
======================================== */
.night-villager-panel {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px 20px;
}

.night-villager-panel .sleep-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: float 3s ease-in-out infinite;
}

.night-villager-panel p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 20px;
}

.night-sleep-btn {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   MORNING ANIMATION TRANSITIONS (Sequential)
======================================== */
.morning-animation {
    transition: opacity 0.3s ease;
}

.morning-message {
    transition: opacity 0.3s ease;
}

/* Heal targets grid */
.heal-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.heal-targets .btn {
    flex: 0 0 auto;
}

/* Game player chip (used in player status) */
.game-player-chip {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-player-chip.dead {
    opacity: 0.4;
    text-decoration: line-through;
    filter: grayscale(0.8);
}

/* Voting player items */
.voting-player {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.voting-player:hover {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
}

.voting-player.selected {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

.voting-player.voted {
    pointer-events: none;
    opacity: 0.6;
}

.voting-player.voted.selected {
    opacity: 1;
}

/* Witch option panels */
.witch-option {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 10px;
}

.witch-option h4 {
    margin-bottom: 8px;
}

.witch-option p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.poison-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    .target-list {
        grid-template-columns: 1fr;
    }

    .voting-players {
        grid-template-columns: 1fr;
    }

    .game-players {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .roles-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chat-container {
        width: 260px;
        height: 350px;
    }

    .setting-options {
        flex-wrap: wrap;
    }

    .setting-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
    }

    .morning-animation {
        font-size: 3rem;
        min-height: 90px;
    }

    .morning-title {
        font-size: 1.4rem;
    }

    .morning-message {
        font-size: 1rem;
    }
}