/* ===========================
   Remote Screen - Fullscreen Mobile Controller
   =========================== */

#remoteScreen {
    background: var(--primary-bg);
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(0, 91, 187, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(199, 240, 0, 0.1) 0%, transparent 50%);
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

.remote-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
    gap: 16px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Error State */
.remote-error {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: clamp(20px, 5vw, 40px);
    box-sizing: border-box;
}

.remote-error-content {
    text-align: center;
    max-width: 90%;
    width: 100%;
}

.remote-error-icon {
    font-size: clamp(3rem, 15vw, 4rem);
    margin-bottom: clamp(16px, 4vw, 24px);
}

.remote-error-content h2 {
    font-size: clamp(1.4rem, 6vw, 1.8rem);
    color: var(--text-primary);
    margin-bottom: clamp(12px, 3vw, 16px);
    font-weight: 700;
}

.remote-error-content p {
    font-size: clamp(1rem, 4vw, 1.1rem);
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Remote Controls */
.remote-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    flex: 1;
    justify-content: center;
    align-items: stretch;
    min-height: 0; /* Allow flex shrinking */
    overflow: hidden;
}

/* Remote Buttons */
.remote-btn {
    flex: 1;
    min-height: 60px; /* Minimum for touch targets */
    max-height: none; /* Remove any max-height constraints */
    border: none;
    border-radius: 20px;
    font-size: clamp(1.5rem, 8vw, 2.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: clamp(1px, 0.5vw, 2px);
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vh, 32px);
    /* Optimize for haptic feedback */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Prevent double-tap zoom and accidental taps */
.remote-btn:active {
    transform: scale(0.98);
}

.remote-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Team A Button */
.remote-btn-team-a {
    background: linear-gradient(135deg, var(--team-a-color) 0%, rgba(199, 240, 0, 0.8) 100%);
    color: var(--primary-bg);
    box-shadow: 0 8px 24px rgba(199, 240, 0, 0.4);
}

.remote-btn-team-a:active:not(:disabled) {
    background: linear-gradient(135deg, rgba(199, 240, 0, 0.9) 0%, rgba(199, 240, 0, 0.7) 100%);
    box-shadow: 0 4px 12px rgba(199, 240, 0, 0.3);
}

/* Team B Button */
.remote-btn-team-b {
    background: linear-gradient(135deg, var(--team-b-color) 0%, rgba(0, 201, 183, 0.8) 100%);
    color: var(--primary-bg);
    box-shadow: 0 8px 24px rgba(0, 201, 183, 0.4);
}

.remote-btn-team-b:active:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 201, 183, 0.9) 0%, rgba(0, 201, 183, 0.7) 100%);
    box-shadow: 0 4px 12px rgba(0, 201, 183, 0.3);
}

/* Undo Button */
.remote-btn-undo {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.remote-btn-undo:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .remote-container {
        padding: calc(12px + var(--safe-top)) calc(12px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(12px + var(--safe-left));
        gap: 12px;
    }

    .remote-controls {
        gap: 12px;
    }

    .remote-btn {
        font-size: clamp(1.4rem, 7vw, 2rem);
        padding: clamp(16px, 4vh, 24px);
        border-radius: 18px;
        min-height: 60px;
    }
}

@media (max-width: 480px) {
    .remote-container {
        padding: calc(10px + var(--safe-top)) calc(10px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(10px + var(--safe-left));
        gap: 10px;
    }

    .remote-controls {
        gap: 10px;
    }

    .remote-btn {
        font-size: clamp(1.2rem, 6vw, 1.8rem);
        padding: clamp(16px, 3vh, 20px);
        border-radius: 16px;
        min-height: 50px;
        letter-spacing: 0.5px;
    }

    .remote-error-content {
        padding: 20px;
    }

    .remote-error-icon {
        font-size: 3rem;
        margin-bottom: 16px;
    }

    .remote-error-content h2 {
        font-size: 1.5rem;
    }

    .remote-error-content p {
        font-size: 1rem;
    }
}

/* Small mobile devices */
@media (max-width: 360px) {
    .remote-container {
        padding: calc(8px + var(--safe-top)) calc(8px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(8px + var(--safe-left));
        gap: 8px;
    }

    .remote-controls {
        gap: 8px;
    }

    .remote-btn {
        font-size: clamp(1.1rem, 5.5vw, 1.6rem);
        padding: clamp(16px, 3.5vh, 20px);
        min-height: 60px;
    }
}

/* Landscape Mode */
@media (orientation: landscape) {
    .remote-container {
        padding: calc(8px + var(--safe-top)) calc(16px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(16px + var(--safe-left));
        gap: 12px;
    }

    .remote-controls {
        flex-direction: row;
        gap: 12px;
        max-width: 100%;
    }

    .remote-btn {
        min-height: auto;
        flex: 1;
        font-size: clamp(1.2rem, 4vw, 1.8rem);
        padding: clamp(12px, 3vh, 20px);
        border-radius: 16px;
    }
}

/* Small landscape devices */
@media (orientation: landscape) and (max-height: 500px) {
    .remote-container {
        padding: calc(6px + var(--safe-top)) calc(12px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(12px + var(--safe-left));
        gap: 8px;
    }

    .remote-controls {
        gap: 8px;
    }

    .remote-btn {
        font-size: clamp(1rem, 3.5vw, 1.5rem);
        padding: clamp(10px, 2.5vh, 16px);
        border-radius: 12px;
    }
}

/* Prevent text selection on buttons */
.remote-btn::selection {
    background: transparent;
}

.remote-btn::-moz-selection {
    background: transparent;
}

/* Button press animation */
.remote-btn.pressed {
    transform: scale(0.95);
    opacity: 0.8;
}
