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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #8B0000 0%, #1a0000 50%, #4B0000 100%);
    min-height: 100vh;
    padding: 0;
    color: #f5f5f5;
    margin: 0;
}

.main-layout {
    display: flex;
    min-height: 100vh;
    gap: 20px;
    padding: 20px;
    max-width: 1800px;
    margin: 0 auto;
    justify-content: center;
}

.container {
    flex: 1;
    max-width: 1400px;
    background: linear-gradient(145deg, #2a0000 0%, #1a0000 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(139, 0, 0, 0.5), 0 0 40px rgba(139, 0, 0, 0.3);
    padding: 30px;
    border: 2px solid rgba(184, 134, 11, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(184, 134, 11, 0.4);
}

header h1 {
    font-size: 2.5em;
    color: #DC143C;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(220, 20, 60, 0.5), 0 0 10px rgba(184, 134, 11, 0.3);
}

header p {
    color: #d4af37;
    font-size: 1.1em;
}

.main-nav {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(184, 134, 11, 0.4);
    justify-content: center;
    width: 100%;
}

.nav-link {
    padding: 10px 20px;
    background: rgba(139, 0, 0, 0.3);
    color: #f5f5f5;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    border: 1px solid rgba(184, 134, 11, 0.3);
}

.nav-link:hover {
    background: rgba(220, 20, 60, 0.4);
    transform: translateY(-2px);
}

.nav-link.active {
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%);
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
}

.room-section {
    margin-bottom: 30px;
    width: 100%;
    max-width: 800px;
}

.room-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.room-input input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #4B0000;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: #1a0000;
    color: #f5f5f5;
}

.room-input input:focus {
    outline: none;
    border-color: #DC143C;
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.3);
}

.room-input button,
.video-input button {
    padding: 12px 25px;
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%);
    color: white;
    border: 1px solid rgba(184, 134, 11, 0.3);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s, transform 0.1s;
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
}

.room-input button:hover,
.video-input button:hover {
    background: linear-gradient(135deg, #FF1744 0%, #B71C1C 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 20, 60, 0.5);
}

.room-input button:active,
.video-input button:active {
    transform: translateY(0);
}

.room-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(184, 134, 11, 0.3);
}

.room-info p {
    color: #f5f5f5;
    font-size: 16px;
}

.room-info button {
    padding: 8px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.room-info button:hover {
    background: #c82333;
}

.video-section {
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
}

.video-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.video-input input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #4B0000;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    background: #1a0000;
    color: #f5f5f5;
}

.video-input input:focus {
    outline: none;
    border-color: #DC143C;
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.3);
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 auto 15px auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(220, 20, 60, 0.2);
    border: 2px solid rgba(184, 134, 11, 0.2);
    min-height: 400px;
}

#player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-container-iframe #externalFrame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.external-fallback {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: rgba(26, 0, 0, 0.95);
    color: #f5f5f5;
    text-align: center;
}

.external-fallback a {
    color: #DC143C;
    font-weight: 600;
    word-break: break-all;
}

.external-fallback a:hover {
    text-decoration: underline;
}

.external-open-link {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

.external-open-link a {
    padding: 8px 16px;
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
}

.external-open-link a:hover {
    background: linear-gradient(135deg, #FF1744 0%, #B71C1C 100%);
}

.video-info {
    text-align: center;
    padding: 15px;
    background: rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(184, 134, 11, 0.3);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.video-info p {
    color: #f5f5f5;
    font-size: 18px;
    font-weight: 500;
}

.status {
    text-align: center;
    padding: 15px;
    background: rgba(139, 0, 0, 0.2);
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid rgba(184, 134, 11, 0.3);
    width: 100%;
    max-width: 800px;
}

.status p {
    color: #d4af37;
    font-size: 14px;
}

.status.connected p {
    color: #90EE90;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(144, 238, 144, 0.5);
}

.status.disconnected p {
    color: #FF6B6B;
}

.sync-panel {
    width: 100%;
    max-width: 800px;
    margin: 20px auto 0;
    padding: 20px;
    background: rgba(139, 0, 0, 0.2);
    border: 1px solid rgba(184, 134, 11, 0.3);
    border-radius: 12px;
}

.sync-panel h4 {
    color: #DC143C;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.sync-hint {
    color: #d4af37;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.sync-controls {
    margin-bottom: 15px;
}

.sync-controls label {
    display: block;
    color: #f5f5f5;
    font-size: 0.9em;
    margin-bottom: 6px;
}

.sync-time-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sync-time-row input {
    width: 100px;
    padding: 10px 12px;
    border: 2px solid #4B0000;
    border-radius: 8px;
    background: #1a0000;
    color: #f5f5f5;
    font-size: 16px;
}

.sync-time-row input:focus {
    outline: none;
    border-color: #DC143C;
}

.sync-panel button {
    padding: 10px 18px;
    background: linear-gradient(135deg, #DC143C 0%, #8B0000 100%);
    color: white;
    border: 1px solid rgba(184, 134, 11, 0.3);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.sync-panel button:hover {
    background: linear-gradient(135deg, #FF1744 0%, #B71C1C 100%);
}

.sync-message {
    min-height: 24px;
    margin-top: 12px;
    color: #d4af37;
    font-size: 0.95em;
    transition: opacity 0.2s;
}

.sync-message.sync-message-active {
    color: #90EE90;
    font-weight: 600;
    font-size: 1.1em;
}

.sync-message.sync-countdown {
    font-size: 2.5em;
    text-align: center;
    color: #DC143C;
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
        padding: 10px;
    }

    .sidebar {
        width: 100%;
        position: relative;
        max-height: none;
    }

    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 2em;
    }

    .room-input,
    .video-input {
        flex-direction: column;
    }

    .room-input button,
    .video-input button {
        width: 100%;
    }

    .sync-time-row {
        flex-direction: column;
    }

    .sync-time-row input {
        width: 100%;
    }
}

