* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    overflow: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.screen {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* Access Screen */
.access-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 50px 45px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    text-align: center;
    min-width: 420px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.access-container h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 35px;
    font-size: 2.5em;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.access-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.access-form label {
    font-weight: 600;
    color: #333;
    text-align: left;
}

#accessCode {
    padding: 16px 20px;
    font-size: 20px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    text-align: center;
    letter-spacing: 4px;
    font-weight: 600;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.8);
}

#accessCode:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: white;
    transform: translateY(-2px);
}

.role-selection {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 15px 0;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
}

.role-selection label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #555;
    transition: color 0.3s;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s;
}

.role-selection label:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.role-selection input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

#joinBtn {
    padding: 16px 40px;
    font-size: 17px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 14px;
}

#joinBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

#joinBtn:active {
    transform: translateY(0);
}

.error-message {
    color: #e74c3c;
    font-size: 14px;
    min-height: 20px;
    margin-top: 10px;
}

/* Meeting Room */
#meetingRoom {
    flex-direction: column;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
}

.meeting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.viewer-count {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
}

.count-label {
    color: #666;
    font-weight: 600;
    letter-spacing: 0.5px;
}

#viewerCount {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 32px;
    min-width: 50px;
    text-align: center;
}

#exitBtn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    letter-spacing: 0.5px;
}

#exitBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

#exitBtn:active {
    transform: translateY(0);
}

.meeting-content {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.host-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    gap: 12px;
}

.control-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.3px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.control-btn:active {
    transform: translateY(0);
}

.camera-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.camera-container.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

#hostVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-width: 100vw;
    max-height: 100vh;
}

.close-camera-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 28px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.6);
    z-index: 10001;
}

.close-camera-btn:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.6);
}

.text-boxes-container {
    width: 100%;
    height: 100%;
    position: relative;
    padding: 20px;
}

.text-box {
    position: absolute;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid #667eea;
    border-radius: 16px;
    padding: 18px;
    min-width: 220px;
    min-height: 120px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    cursor: move;
    transition: all 0.3s ease;
    animation: textBoxAppear 0.3s ease-out;
}

@keyframes textBoxAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.text-box:hover {
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.text-box.host-editable textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: both;
    font-size: 16px;
    font-family: inherit;
    background: transparent;
    padding: 5px;
}

.text-box.participant-view {
    cursor: default;
    border-color: #95a5a6;
}

.text-box.participant-view textarea {
    pointer-events: none;
    color: #2c3e50;
}

.text-box-delete {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.5);
    transition: all 0.3s ease;
    z-index: 10;
}

.text-box-delete:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.6);
}

.participant-video-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.participant-video-container.hidden {
    display: none !important;
}

#participantVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-width: 100vw;
    max-height: 100vh;
    background: #000;
    display: block;
}

