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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 36px;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 18px;
    opacity: 0.9;
}

.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-box {
    background: white;
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 650px;
    margin: 0 auto;
    transition: none;
}

.login-box h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.error-message {
    color: #e74c3c;
    text-align: center;
    font-size: 14px;
    min-height: 20px;
}

.player-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 1600px;
    margin: 0;
}

.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    padding-left: 0;
    padding-right: 0;
}

.video-player {
    width: 100%;
    display: block;
    aspect-ratio: 16/9;
    padding-left: 0;
    padding-right: 0;
}

.video-info {
    margin-bottom: 30px;
}

.video-info h2 {
    color: #333;
    font-size: 24px;
    margin-bottom: 20px;
}

.video-controls {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    width: 100%;
    align-items: center;
}

.video-controls .btn .status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    margin-right: 0;
    flex-shrink: 0;
    display: inline-block;
}

.video-controls .btn .status-indicator.connected {
    background: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

.video-controls .btn .status-indicator.disconnected {
    background: #f44336;
    box-shadow: 0 0 8px rgba(244, 67, 54, 0.6);
}

.video-controls .btn .status-indicator.connecting {
    background: #ff9800;
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.6);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-control {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-control:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.video-list {
    margin-bottom: 30px;
    display: none !important;
}

.video-list h3 {
    color: #333;
    font-size: 20px;
    margin-bottom: 20px;
    display: none !important;
}

.video-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    display: none !important;
}

.loading,
.empty {
    text-align: center;
    color: #999;
    padding: 40px;
    grid-column: 1 / -1;
}

.video-item {
    background: #f9f9f9;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.video-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #e0e0e0;
    overflow: hidden;
}

.video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

.no-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 14px;
}

.video-info {
    padding: 10px;
}

.video-title {
    color: #333;
    font-size: 14px;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-type {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-block;
    padding: 3px 10px;
    background: #667eea;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    z-index: 10;
}

.logout-section {
    text-align: center;
}

@media (max-width: 768px) {
    .footer {
        padding: 30px 15px 15px;
        margin-top: 30px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .footer-section h3 {
        font-size: 16px;
    }
}

.watch-together {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.watch-together-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 10px;
}

.watch-together-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.watch-together-title-row .status-indicator {
    margin-right: 0;
}

.watch-together-title-row h3 {
    color: #333;
    font-size: 20px;
    margin: 0;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.watch-together-title-row h3:hover {
    color: #667eea;
}

.member-avatars {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.member-avatars .member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-left: -8px;
    cursor: pointer;
    transition: transform 0.2s, z-index 0.2s;
}

.member-avatars .member-avatar:first-child {
    margin-left: 0;
}

.member-avatars .member-avatar:hover {
    transform: scale(1.2);
    z-index: 10;
}

.room-floating-panel {
    position: absolute;
    left: 200px;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    min-width: 200px;
    max-width: 250px;
}

.room-floating-content h4 {
    color: #333;
    font-size: 18px;
    margin: 0 0 10px 0;
    text-align: center;
}

.room-floating-content p {
    color: #666;
    font-size: 13px;
    margin-bottom: 15px;
    text-align: center;
}

.room-floating-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.room-floating-buttons .btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
}

.watch-together-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 14px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffc107;
    animation: pulse 1.5s infinite;
}

.status-indicator.connected {
    background: #28a745;
    animation: none;
}

.status-indicator.disconnected {
    background: #dc3545;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-text {
    color: #666;
    font-weight: 500;
}

.watch-together-controls {
    display: flex;
    gap: 10px;
}

.room-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.room-form h4 {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group label span.required {
    color: #ff4757;
    margin-left: 2px;
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button .form-input {
    flex: 1;
}

.btn-random {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-random:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.modal-tip {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #f0f7ff;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.member-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    background: #f9f9f9;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.member-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    background: white;
    transition: all 0.3s;
    flex-shrink: 0;
}

.member-item:last-child {
    border-bottom: 1px solid #e0e0e0;
}

.member-item:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    margin-right: 10px;
    font-size: 14px;
    position: relative;
}

.member-avatar.creator {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
}

.member-avatar .crown-icon {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.member-info {
    flex: 1;
}

.member-name {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.member-status {
    font-size: 12px;
    color: #999;
}

.member-status.online {
    color: #52c41a;
}

.chat-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.chat-messages {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: #f9f9f9;
    margin-bottom: 15px;
}

.chat-message {
    margin-bottom: 12px;
    padding: 10px 15px;
    border-radius: 8px;
    background: white;
    animation: slideIn 0.3s ease-out;
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.chat-message.self {
    background: linear-gradient(135deg, #95ec69 0%, #95ec69 100%);
    align-self: flex-start;
    margin-right: auto;
}

.chat-message:not(.self) {
    align-self: flex-end;
    margin-left: auto;
}

.chat-message.system {
    background: transparent;
    align-self: center;
    text-align: center;
    max-width: 100%;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.chat-message:not(.self):not(.system) .chat-header {
    justify-content: flex-end;
}

.chat-message:not(.self):not(.system) .chat-content {
    text-align: right;
}

.chat-user {
    font-weight: 600;
    color: #667eea;
    font-size: 13px;
}

.chat-time {
    font-size: 11px;
    color: #999;
    margin-left: 8px;
}

.chat-message.self .chat-user,
.chat-message.self .chat-time {
    color: rgba(0, 0, 0, 0.6);
}

.chat-content {
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.self .chat-content {
    color: #000;
}

.danmaku-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.danmaku {
    position: absolute;
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 16px;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    animation: danmakuMove linear forwards;
    pointer-events: none;
    will-change: transform;
}

.danmaku.self {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.danmaku.system {
    background: rgba(255, 193, 7, 0.9);
    color: #333;
    text-shadow: none;
}

@keyframes danmakuMove {
    from {
        transform: translateX(100vw);
    }
    to {
        transform: translateX(-100%);
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #e0e0e0;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    color: #333;
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 15px 25px;
    border-top: 2px solid #e0e0e0;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

#quickJoinRoomBtn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-color: #f5576c;
    color: white;
}

#quickJoinRoomBtn:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    border-color: #f5576c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.3);
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 16px;
    }

    .login-box {
        width: 100%;
        max-width: none;
        padding: 30px 20px;
        border-radius: 15px;
        margin: 0 !important;
    }

    .player-section {
        width: 100%;
        max-width: none;
        padding: 20px 15px;
        border-radius: 15px;
    }

    .video-list-container {
        grid-template-columns: 1fr;
    }

    .video-controls {
        justify-content: center;
    }

    .pin-input-container {
        gap: 8px;
    }

    .pin-input {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .tab-button {
        padding: 10px 20px;
        font-size: 14px;
    }

    .footer {
        display: none !important;
    }

    .room-floating-panel {
        display: none !important;
    }

    .player-section {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .video-player {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .video-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .member-avatar {
        display: none !important;
    }
}

.footer {
    background: rgba(255, 255, 255, 0.95);
    margin-top: 40px;
    padding: 40px 20px 20px;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 600;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-block;
}

.footer-links a:hover {
    color: #667eea;
    transform: translateX(5px);
}

.footer-text {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.6;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.footer-bottom p {
    color: #999;
    font-size: 14px;
}

@media (max-width: 768px) {
    .footer {
        padding: 30px 15px 15px;
        margin-top: 30px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .footer-section h3 {
        font-size: 16px;
    }
}
