/* ========================================
   ACT KARO - VIDEO CHARADES STYLING
   Premium Gaming Aesthetic
   ======================================== */

/* ========================================
   SETTINGS MODAL SCROLL & BUTTON FIXES
   ======================================== */

/* Make modal scrollable */
#roomSettingsModal .modal-content,
.modal .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#roomSettingsModal .modal-body,
.modal .modal-body {
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
    padding-bottom: 1.5rem;
}

/* Ensure buttons are clickable */
.mode-toggle-buttons {
    position: relative;
    z-index: 10;
}

.mode-btn {
    position: relative;
    z-index: 11;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Fix any overlapping elements */
.setting-group {
    position: relative;
    z-index: 1;
}

.game-mode-setting {
    z-index: 5;
    margin-bottom: 1.5rem;
}

/* Custom scrollbar for modal */
#roomSettingsModal .modal-body::-webkit-scrollbar,
.modal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#roomSettingsModal .modal-body::-webkit-scrollbar-track,
.modal .modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

#roomSettingsModal .modal-body::-webkit-scrollbar-thumb,
.modal .modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    border-radius: 4px;
}

#roomSettingsModal .modal-body::-webkit-scrollbar-thumb:hover,
.modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #F7931E, #FF6B35);
}

/* Mode Selection Overlay */
.mode-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.mode-selection-modal {
    background: linear-gradient(145deg, rgba(30, 30, 45, 0.98), rgba(20, 20, 35, 0.98));
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideUp 0.4s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mode-selection-title {
    text-align: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

/* Mode Card */
.mode-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border-radius: 20px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    overflow: hidden;
}

.mode-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 107, 53, 0.5);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.mode-card.draw-mode:hover {
    border-color: rgba(255, 107, 53, 0.6);
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(247, 147, 30, 0.1));
}

.mode-card.act-mode:hover {
    border-color: rgba(155, 89, 182, 0.6);
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.15), rgba(142, 68, 173, 0.1));
}

.mode-card .mode-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    display: block;
}

.mode-card .mode-name {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.mode-card .mode-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* ========================================
   MODE TOGGLE BUTTONS (Settings Modal)
   ======================================== */

.mode-toggle-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
}

.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    color: rgba(255, 255, 255, 0.7);
}

.mode-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(247, 147, 30, 0.15));
    border-color: #FF6B35;
    color: white;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
}

.mode-btn[data-mode="act"].active {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.2), rgba(142, 68, 173, 0.15));
    border-color: #9B59B6;
    box-shadow: 0 8px 25px rgba(155, 89, 182, 0.3);
}

.mode-btn .mode-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.mode-btn .mode-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.mode-btn .mode-desc {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Light mode override for settings modal */
.modal .mode-toggle-buttons {
    margin-top: 0.5rem;
}

.modal .mode-btn {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-color: #dee2e6;
    color: #495057;
}

.modal .mode-btn:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    border-color: #adb5bd;
}

.modal .mode-btn.active {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(247, 147, 30, 0.1));
    border-color: #FF6B35;
    color: #FF6B35;
}

.modal .mode-btn[data-mode="act"].active {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.15), rgba(142, 68, 173, 0.1));
    border-color: #9B59B6;
    color: #9B59B6;
}

/* ========================================
   ACT KARO GAME SCREEN
   ======================================== */

.act-karo-container {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    gap: 1rem;
    height: calc(100vh - 120px);
    padding: 1rem;
}

/* Video Container */
.video-container {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(155, 89, 182, 0.3);
    /* Prevent collapse */
    min-height: 480px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.video-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #9B59B6, #E74C3C, #F39C12, #2ECC71);
    z-index: 10;
}

.video-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    background: #000;
}

.video-label {
    position: absolute;
    top: 15px;
    left: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    z-index: 20;
    backdrop-filter: blur(4px);
}

/* Video Element */
.main-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Don't crop acting */
    background: #111;
}

/* PiP Local Video */
.local-video-wrapper {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 160px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    z-index: 30;
}

.pip-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.me-label {
    position: absolute;
    bottom: 5px;
    right: 8px;
    font-size: 0.7rem;
    color: white;
    text-shadow: 0 1px 2px black;
}

/* Video Overlay */
.video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
}

.actor-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.actor-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9B59B6, #E74C3C);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.2rem;
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.actor-name {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
}

.actor-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: #2ECC71;
    font-size: 0.85rem;
}

.actor-status .live-dot {
    width: 8px;
    height: 8px;
    background: #2ECC71;
    border-radius: 50%;
    animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* Timer Overlay */
.video-timer {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.75rem 1.25rem;
    border-radius: 30px;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.video-timer.warning {
    color: #F39C12;
    border-color: #F39C12;
    animation: timerPulse 1s ease-in-out infinite;
}

.video-timer.critical {
    color: #E74C3C;
    border-color: #E74C3C;
    animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Word Hint Display */
.word-hint-container {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem 2rem;
    border-radius: 15px;
    text-align: center;
}

.word-hint-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.word-hint-boxes {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.word-hint-boxes .hint-box {
    width: 35px;
    height: 45px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
}

.word-hint-boxes .hint-box.revealed {
    background: rgba(46, 204, 113, 0.3);
    border-color: #2ECC71;
}

/* Draw Karo Hint Boxes (Visible) */
.hint-boxes .hint-box {
    width: 35px;
    height: 45px;
    background: #fff;
    border: 2px solid #ff6b35;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 1.3rem;
    font-weight: 700;
}

.hint-boxes .hint-box.revealed {
    background: #ff6b35;
    color: #fff;
}

/* ========================================
   ACTOR'S WORD CARD (Only visible to actor)
   ======================================== */

.actor-word-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #9B59B6, #E74C3C);
    padding: 3rem 4rem;
    border-radius: 25px;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    animation: wordCardAppear 0.5s ease;
}

@keyframes wordCardAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.actor-word-card .word-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.actor-word-card .word-text {
    color: white;
    font-size: 2.5rem;
    font-weight: 900;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.75rem;
}

.actor-word-card .word-category {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.actor-word-card .warning-text {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    color: #FFD23F;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Camera Permission Modal */
.camera-permission-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.camera-permission-card {
    background: linear-gradient(145deg, rgba(30, 30, 45, 0.98), rgba(20, 20, 35, 0.98));
    border-radius: 24px;
    padding: 3rem;
    max-width: 400px;
    text-align: center;
    border: 1px solid rgba(155, 89, 182, 0.3);
}

.camera-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.camera-title {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.camera-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.camera-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-allow-camera {
    background: linear-gradient(135deg, #2ECC71, #27AE60);
    color: white;
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-allow-camera:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(46, 204, 113, 0.4);
}

.btn-skip-camera {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.875rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-skip-camera:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* No Camera Fallback */
.no-camera-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    color: white;
    text-align: center;
    padding: 2rem;
}

.no-camera-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.no-camera-text {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .act-karo-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .video-container {
        height: 50vh;
    }
}

@media (max-width: 768px) {
    .mode-cards {
        grid-template-columns: 1fr;
    }

    .actor-word-card {
        padding: 2rem;
        width: 90%;
    }

    .actor-word-card .word-text {
        font-size: 1.8rem;
    }
}

/* FORCE HIDE Drawing Elements in Act Karo Mode */
body.act-karo-active .canvas-container,
body.act-karo-active .drawing-tools,
body.act-karo-active .toolbar,
body.act-karo-active #drawingTools,
body.act-karo-active #gameCanvas {
    display: none !important;
}

/* FORCE SHOW Video Container in Act Karo Mode */
body.act-karo-active #videoContainer {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 500px;
    flex: 1;
}

body.act-karo-active .game-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Dedicated Act Karo Dashboard Styles */

#act-karo-screen {
    width: 100%;
    height: 100vh;
    background: #f0f2f5;
    display: none;
}

#act-karo-screen.active {
    display: block;
}

.act-game-layout {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    grid-template-rows: 100%;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBARS */
.act-sidebar {
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.act-sidebar.right {
    border-left: 1px solid #e0e0e0;
    border-right: none;
}

.sidebar-header {
    padding: 1rem;
    background: #4f46e5;
    color: white;
    font-weight: bold;
    text-align: center;
}

/* CENTER STAGE */
.act-stage {
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    position: relative;
    padding: 1rem;
    align-items: center;
    justify-content: flex-start;
}

.act-header {
    width: 100%;
    margin-bottom: 1rem;
}

.header-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #1f1f2e, #2d2d44);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.header-badges h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #fff;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.header-badges .actor-badge,
.header-badges .timer-badge {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1rem;
}

.header-badges .timer-badge {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.act-header h2 {
    color: #fff;
    margin: 0;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
}

/* Video Feed Container */
.video-main-container {
    flex: 1;
    width: 100%;
    max-width: 900px;
    min-height: 400px;
    height: calc(100vh - 250px);
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-feed {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-feed::before {
    content: '🎬 Video Stream';
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    position: absolute;
    z-index: 0;
}

#actMainVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Video Overlays - Positioned on top of video */
.video-overlay {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 20;
    pointer-events: none;
}

.actor-badge,
.timer-badge {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.timer-badge {
    color: #ffd700;
}

/* Self View PiP */
#actSelfView {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    width: 160px;
    height: 120px;
    background: #333;
    border: 2px solid #fff;
    border-radius: 8px;
    overflow: hidden;
    z-index: 10;
}

#actSelfVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#actSelfView span {
    position: absolute;
    bottom: 2px;
    left: 4px;
    font-size: 10px;
    color: white;
    text-shadow: 1px 1px 2px black;
}

/* Word Hint Section */
.word-display-section {
    margin-top: 1rem;
    text-align: center;
}

.word-hint {
    font-size: 2.5rem;
    color: white;
    letter-spacing: 0.5rem;
    font-family: monospace;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Actor Dashboard Overlay */
.actor-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    text-align: center;
    z-index: 100;
    min-width: 400px;
    border: 4px solid #4f46e5;
}

.actor-overlay h3 {
    color: #4f46e5;
    margin-top: 0;
    font-size: 1.8rem;
    text-transform: uppercase;
}

.secret-card {
    background: #f3f4f6;
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    border: 2px dashed #cbd5e1;
}

.secret-label {
    color: #64748b;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#actSecretWord {
    font-size: 2.5rem;
    color: #1e293b;
    margin: 0.5rem 0;
    font-weight: 800;
}

.secret-category {
    color: #4f46e5;
    background: #e0e7ff;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: bold;
}

.actor-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.status-pill {
    background: #10b981;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-pill:last-child {
    background: #ef4444;
}

.warning {
    color: #b91c1c;
    font-weight: bold;
    background: #fef2f2;
    padding: 0.75rem;
    border-radius: 8px;
    margin: 0;
}

/* ========================================
   MOBILE RESPONSIVE - Act Karo Dashboard
   ======================================== */

/* Tablet (768px - 900px) */
@media (max-width: 900px) {
    .act-game-layout {
        grid-template-columns: 1fr 280px;
        grid-template-rows: 100vh;
        height: 100vh;
    }

    .act-sidebar:not(.right) {
        display: none;
    }

    .act-sidebar.right {
        display: flex;
        height: 100%;
    }

    .video-main-container {
        min-height: 300px;
        height: calc(100vh - 200px);
    }

    #actSelfView {
        width: 120px;
        height: 90px;
    }
}

/* Mobile Elements - Hidden on Desktop */
.mobile-chat-toggle,
.mobile-chat-panel {
    display: none;
}

/* Mobile (max-width 600px) */
@media (max-width: 600px) {
    #act-karo-screen {
        overflow-x: hidden;
    }

    .act-game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: 100vh;
        gap: 0;
    }

    .act-sidebar {
        display: none !important;
    }

    .act-sidebar.right {
        display: none !important;
    }

    .act-stage {
        padding: 0.5rem;
        height: 100%;
        overflow: hidden;
    }

    .act-header {
        margin-bottom: 0.5rem;
    }

    .act-header h2 {
        font-size: 1rem;
        padding: 0.25rem 0.75rem;
    }

    .video-main-container {
        min-height: 250px;
        height: calc(100vh - 150px);
        max-height: 70vh;
        border-radius: 8px;
    }

    /* Self View (PiP) - Mobile positioning */
    #actSelfView {
        width: 100px;
        height: 75px;
        bottom: 0.5rem;
        right: 0.5rem;
    }

    #actSelfView span {
        font-size: 8px;
    }

    /* Word Hint - Mobile */
    .word-display-section {
        margin-top: 0.5rem;
    }

    .word-hint {
        font-size: 1.5rem;
        letter-spacing: 0.25rem;
    }

    /* Actor Overlay - Mobile */
    .actor-overlay {
        min-width: 90%;
        max-width: 95%;
        padding: 1rem;
    }

    .actor-overlay h3 {
        font-size: 1.2rem;
    }

    #actSecretWord {
        font-size: 2rem;
    }

    .secret-card {
        padding: 1rem;
        margin: 1rem 0;
    }

    .actor-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .status-pill {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    /* Mobile Chat Toggle Button */
    .mobile-chat-toggle {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: linear-gradient(135deg, #4f46e5, #7c3aed);
        border: none;
        color: white;
        font-size: 1.5rem;
        box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
        cursor: pointer;
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Mobile Chat Panel (Slide Up) */
    .mobile-chat-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60vh;
        background: white;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
        transform: translateY(100%);
        transition: transform 0.3s ease;
        z-index: 999;
        display: flex;
        flex-direction: column;
    }

    .mobile-chat-panel.show {
        transform: translateY(0);
    }

    .mobile-chat-header {
        padding: 1rem;
        background: #4f46e5;
        color: white;
        border-radius: 20px 20px 0 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-chat-close {
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
    }
}

/* iOS Video Fixes - ensure inline playback */
video {
    /* The 'playsinline' attribute must be on the HTML element */
    background: #000;
}

#actMainVideo,
#actSelfVideo {
    object-fit: cover;
    background: #111;
}

/* Landscape Mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .act-game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 100vh;
    }

    .video-main-container {
        height: calc(100vh - 80px);
    }

    #actSelfView {
        bottom: 0.25rem;
        right: 0.25rem;
        width: 80px;
        height: 60px;
    }

    .act-header {
        position: absolute;
        top: 0.5rem;
        left: 50%;
        transform: translateX(-50%);
        z-index: 10;
    }

    .word-display-section {
        position: absolute;
        bottom: 0.5rem;
        left: 50%;
        transform: translateX(-50%);
        z-index: 10;
    }
}

/* ========================================
   PLAYERS LIST STYLES (Act Karo)
   ======================================== */
.players-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
}

.players-list li {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.players-list li:hover {
    background: rgba(255, 255, 255, 0.1);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.player-rank {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.player-avatar {
    font-size: 1.5rem;
}

.player-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.player-name {
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
}

.player-score {
    font-size: 0.85rem;
    color: #FFD23F;
    /* Gold color for points */
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Mic Toggle Button */
.mic-toggle-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    z-index: 10;
    transition: background 0.3s;
}

.mic-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.mic-toggle-btn.muted {
    background: #ff4757;
    /* Red when muted */
}