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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #121212;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --accent: #e53e00;
    --accent-hover: #ff5500;
    --accent-glow: rgba(229, 62, 0, 0.4);
    --accent-secondary: #ff8c00;
    --live: #eb0400;
    --live-glow: rgba(235, 4, 0, 0.5);
    --border: #2a2a2a;
    --border-hover: #3a3a3a;
    --gradient-start: #cc0000;
    --gradient-end: #ff8c00;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.app-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(229, 62, 0, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(255, 140, 0, 0.1), transparent),
        radial-gradient(ellipse 60% 40% at 0% 100%, rgba(204, 0, 0, 0.08), transparent);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.header {
    background: linear-gradient(180deg, rgba(18, 18, 26, 0.95) 0%, rgba(18, 18, 26, 0.8) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 40px;
    width: auto;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.logo:hover .logo-img {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-card);
}

.nav-link.active {
    color: var(--accent);
    background: linear-gradient(135deg, rgba(145, 71, 255, 0.15), rgba(255, 107, 157, 0.1));
}

.nav-icon {
    font-size: 1.1rem;
}

/* Main */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 140px);
}

/* Footer */
.footer {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    background-color: rgba(10, 10, 15, 0.8);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--accent-glow);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-twitch {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-twitch:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* Controls */
.controls {
    margin-bottom: 1.5rem;
    text-align: right;
}

@media (max-width: 768px) {
    .controls {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        padding: 0.75rem;
        background: linear-gradient(180deg, transparent 0%, rgba(10, 10, 15, 0.95) 20%);
        z-index: 100;
        text-align: center;
    }
    
    .controls .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* Sections */
.section {
    margin-bottom: 3rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.featured-game-badge {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.empty-section {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-style: italic;
    border: 1px dashed var(--border);
    border-radius: 0.75rem;
    background: var(--bg-secondary);
}

.section-secondary-spaced {
    margin-top: 2.5rem;
    padding-top: 1rem;
}

.section-header-secondary h2 {
    font-size: 1.25rem;
    opacity: 0.7;
}

.icon-live::before {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background: linear-gradient(135deg, var(--live), #ff4444);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--live-glow), 0 0 30px var(--live-glow);
    animation: pulse-glow 2s ease-in-out infinite;
}

.icon-offline::before {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background: linear-gradient(135deg, #666, #444);
    border-radius: 50%;
}

@keyframes pulse-glow {
    0%, 100% { 
        opacity: 1;
        box-shadow: 0 0 15px var(--live-glow), 0 0 30px var(--live-glow);
    }
    50% { 
        opacity: 0.7;
        box-shadow: 0 0 5px var(--live-glow), 0 0 10px var(--live-glow);
    }
}

.subsection-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subsection-title::before {
    content: '';
    width: 3px;
    height: 1rem;
    background: linear-gradient(180deg, var(--accent), var(--accent-secondary));
    border-radius: 2px;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Cards */
.card {
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(26, 26, 37, 0.8) 100%);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    padding: 1px;
    background: linear-gradient(135deg, transparent, transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    transition: background 0.4s ease;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: transparent;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 40px var(--accent-glow);
}

.card:hover::before {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
}

.card-live {
    box-shadow: 0 0 20px rgba(235, 4, 0, 0.2);
}

.card-live:hover {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 30px var(--live-glow);
}

.card-offline {
    opacity: 0.75;
}

.card-offline:hover {
    opacity: 1;
}

.card-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    overflow: hidden;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .card-thumbnail img {
    transform: scale(1.1);
}

.card-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.4;
    z-index: 0;
}

.card-thumbnail img + .card-fallback {
    display: none;
}

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 10, 15, 0.9) 0%, transparent 60%);
    pointer-events: none;
}

.card-badges {
    position: absolute;
    top: 0.875rem;
    left: 0.875rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.badge {
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-live {
    background: linear-gradient(135deg, var(--live), #ff4444);
    color: white;
    box-shadow: 0 0 15px var(--live-glow);
    animation: pulse-glow 2s ease-in-out infinite;
}

.badge-viewers {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-offline {
    background: rgba(100, 100, 100, 0.5);
    backdrop-filter: blur(10px);
    color: #aaa;
}

.card-checkbox {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    z-index: 10;
}

.card-checkbox input {
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    accent-color: var(--accent);
    border-radius: 0.25rem;
    transition: transform 0.2s ease;
}

.card-checkbox input:hover {
    transform: scale(1.1);
}

.card-checkbox input:checked {
    box-shadow: 0 0 10px var(--accent-glow);
}

.card-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(145, 71, 255, 0.3), transparent 70%);
    color: white;
    font-size: 3rem;
    text-decoration: none;
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 5;
}

.card-play::before {
    content: '';
    position: absolute;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px var(--accent-glow);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.card:hover .card-play {
    opacity: 1;
}

.card:hover .card-play::before {
    transform: scale(1);
}

.card-play span {
    position: relative;
    z-index: 1;
    margin-left: 4px;
    font-size: 1.5rem;
}

.card-info {
    padding: 1.25rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.card-name-wrapper {
    flex: 1;
    min-width: 0;
}

.card-name {
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-followers {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.25rem;
}

.card-followers::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #ff8c00, #ffa500);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.card-stream-info {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.card-game {
    font-size: 0.875rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Loading */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Watch Page */
.watch-container {
    height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
}

.watch-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.watch-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.watch-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1rem;
    min-height: 0;
}

.watch-player {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

.watch-player iframe {
    width: 100%;
    height: 100%;
}

.watch-chat {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

.watch-chat iframe {
    width: 100%;
    height: 100%;
}

/* Multi Page */
.multi-container {
    height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.multi-container.fullscreen-mode {
    position: fixed;
    inset: 0;
    height: 100vh;
    z-index: 1000;
    background: var(--bg-primary);
    padding: 0.5rem;
}

.multi-container.fullscreen-mode .multi-header {
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.multi-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.multi-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
    min-width: 100px;
}

.multi-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.control-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.layout-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.layout-buttons {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.layout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layout-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.layout-btn.active {
    color: white;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    box-shadow: 0 2px 8px var(--accent-glow);
}

.chat-toggle .btn.active,
.fullscreen-toggle .btn.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    border-color: transparent;
}

.multi-wrapper {
    flex: 1;
    display: flex;
    gap: 0.75rem;
    min-height: 0;
}

.multi-layout {
    flex: 1;
    display: grid;
    gap: 0.5rem;
    position: relative;
}

/* Auto mode layouts based on stream count */
.multi-layout.auto-mode[data-count="1"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.multi-layout.auto-mode[data-count="2"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
}

.multi-layout.auto-mode[data-count="3"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 2fr 1fr;
}

.multi-layout.auto-mode[data-count="3"] .multi-player.pinned {
    grid-column: 1 / -1;
}

.multi-layout.auto-mode[data-count="4"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.multi-layout.auto-mode[data-count="5"] {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 2fr 1fr;
}

.multi-layout.auto-mode[data-count="5"] .multi-player.pinned {
    grid-column: 1 / -1;
}

.multi-layout.auto-mode[data-count="6"] {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 2fr 1fr;
}

.multi-layout.auto-mode[data-count="6"] .multi-player.pinned {
    grid-column: 1 / -1;
}

/* 7-8 streams: pinned takes full width top, rest in 3-column grid below */
.multi-layout.auto-mode[data-count="7"],
.multi-layout.auto-mode[data-count="8"] {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 2fr 1fr 1fr;
}

.multi-layout.auto-mode[data-count="7"] .multi-player.pinned,
.multi-layout.auto-mode[data-count="8"] .multi-player.pinned {
    grid-column: 1 / -1;
}

/* 9-12 streams: pinned takes full width top, rest in 4-column grid below */
.multi-layout.auto-mode[data-count="9"],
.multi-layout.auto-mode[data-count="10"],
.multi-layout.auto-mode[data-count="11"],
.multi-layout.auto-mode[data-count="12"] {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 2fr repeat(3, 1fr);
}

.multi-layout.auto-mode[data-count="9"] .multi-player.pinned,
.multi-layout.auto-mode[data-count="10"] .multi-player.pinned,
.multi-layout.auto-mode[data-count="11"] .multi-player.pinned,
.multi-layout.auto-mode[data-count="12"] .multi-player.pinned {
    grid-column: 1 / -1;
}

/* Default fallback for even more streams */
.multi-layout.auto-mode {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 1fr;
}

.multi-layout.auto-mode .multi-player.pinned {
    grid-column: 1 / -1;
    grid-row: 1;
}

.multi-layout.free-mode {
    display: block;
}

.multi-layout.free-mode .multi-player {
    position: absolute;
    aspect-ratio: auto;
}

.multi-player {
    position: relative;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border-radius: 0.5rem;
    overflow: visible;
    border: 1px solid var(--border);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.multi-player.pinned {
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.multi-player.dragging,
.multi-player.resizing {
    z-index: 1000 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px var(--accent-glow);
    border-color: var(--accent);
}

.multi-player.dragging iframe,
.multi-player.resizing iframe {
    pointer-events: none;
}

/* Resize handles - only visible in free mode */
.resize-handle {
    position: absolute;
    background: transparent;
    z-index: 20;
    display: none;
}

.free-mode .resize-handle {
    display: block;
}

.resize-se { right: -5px; bottom: -5px; width: 20px; height: 20px; cursor: se-resize; }
.resize-sw { left: -5px; bottom: -5px; width: 20px; height: 20px; cursor: sw-resize; }
.resize-ne { right: -5px; top: -5px; width: 20px; height: 20px; cursor: ne-resize; }
.resize-nw { left: -5px; top: -5px; width: 20px; height: 20px; cursor: nw-resize; }
.resize-e { right: -5px; top: 20px; bottom: 20px; width: 10px; cursor: e-resize; }
.resize-w { left: -5px; top: 20px; bottom: 20px; width: 10px; cursor: w-resize; }
.resize-n { top: -5px; left: 20px; right: 20px; height: 10px; cursor: n-resize; }
.resize-s { bottom: -5px; left: 20px; right: 20px; height: 10px; cursor: s-resize; }

.free-mode .resize-se::after,
.free-mode .resize-sw::after,
.free-mode .resize-ne::after,
.free-mode .resize-nw::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.free-mode .resize-se::after { right: 2px; bottom: 2px; }
.free-mode .resize-sw::after { left: 2px; bottom: 2px; }
.free-mode .resize-ne::after { right: 2px; top: 2px; }
.free-mode .resize-nw::after { left: 2px; top: 2px; }

.free-mode .multi-player:hover .resize-handle::after {
    opacity: 0.8;
}

.free-mode .multi-player {
    cursor: move;
}

.free-mode .multi-player iframe {
    border-radius: 0.5rem;
}

.multi-player:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.multi-player iframe {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    border: none;
}

.multi-player-label {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
    border: 1px solid var(--border);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.multi-player:hover .multi-player-label {
    opacity: 1;
}

.multi-player.pinned .multi-player-label {
    border-color: var(--accent);
}

.pin-btn,
.audio-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.125rem;
    font-size: 0.875rem;
    opacity: 0.6;
    transition: all 0.2s ease;
    line-height: 1;
}

.pin-btn:hover,
.audio-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.multi-player.pinned .pin-btn {
    opacity: 1;
}

.multi-player.audio-active .audio-btn {
    opacity: 1;
}

.multi-player.audio-active {
    box-shadow: 0 0 20px rgba(0, 255, 100, 0.4);
}

.multi-player.audio-active::before {
    content: '';
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 12px;
    height: 12px;
    background: #00ff64;
    border-radius: 50%;
    z-index: 15;
    animation: pulse-audio 1.5s ease-in-out infinite;
}

@keyframes pulse-audio {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.audio-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.audio-selector .audio-icon {
    font-size: 1rem;
}

.audio-selector select {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-selector select:hover {
    border-color: var(--accent);
}

.twitch-player {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.twitch-player iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.multi-chat {
    width: 320px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.multi-chat.hidden {
    display: none;
}

.multi-chat-header {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.multi-chat-header select {
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.multi-chat-header select:hover {
    border-color: var(--accent);
}

.btn-open-chats {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.btn-open-chats:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.multi-chat iframe {
    flex: 1;
    width: 100%;
    border: none;
}

/* Rotate Hint for Mobile */
.rotate-hint {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.rotate-hint.visible {
    opacity: 1;
    pointer-events: auto;
}

.rotate-hint-content {
    text-align: center;
    color: var(--text-primary);
}

.rotate-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    animation: rotate-phone 2s ease-in-out infinite;
}

@keyframes rotate-phone {
    0%, 100% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
}

.rotate-hint p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) and (orientation: portrait) {
    .rotate-hint {
        display: flex;
    }
}

/* ========== MOBILE RESPONSIVE ========== */

/* Tablet and below */
@media (max-width: 1024px) {
    .container {
        padding: 0 1rem;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
    
    .multi-chat {
        width: 280px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .header .container {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .logo-img {
        height: 32px;
    }
    
    .nav-link {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .nav-link .nav-icon {
        font-size: 1rem;
    }
    
    .nav-link span:not(.nav-icon) {
        display: none;
    }
    
    .main {
        padding: 1rem 0 80px;
    }
    
    .section {
        margin-bottom: 2rem;
    }
    
    .section-header {
        margin-bottom: 1rem;
    }
    
    .section-header h2 {
        font-size: 1.1rem;
    }
    
    .subsection-title {
        font-size: 0.9rem;
    }
    
    .grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .card {
        border-radius: 0.75rem;
    }
    
    .card:hover {
        transform: none;
    }
    
    .card-info {
        padding: 0.75rem;
    }
    
    .card-name {
        font-size: 0.95rem;
    }
    
    .card-followers {
        font-size: 0.7rem;
    }
    
    .card-checkbox input {
        width: 1.75rem;
        height: 1.75rem;
    }
    
    .btn-twitch {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }
    
    .card-stream-info {
        display: none;
    }
    
    .card-play {
        opacity: 1;
        background: rgba(0, 0, 0, 0.3);
    }
    
    .card-play::before {
        width: 50px;
        height: 50px;
        transform: scale(1);
    }
    
    .card-play span {
        font-size: 1.2rem;
    }
    
    /* Watch page mobile */
    .watch-container {
        height: auto;
        min-height: calc(100vh - 120px);
    }
    
    .watch-layout {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .watch-player {
        aspect-ratio: 16/9;
        height: auto;
    }
    
    .watch-chat {
        height: 350px;
    }
    
    .watch-header {
        gap: 0.5rem;
    }
    
    .watch-header h1 {
        font-size: 1rem;
    }
    
    /* Multi-view mobile */
    .multi-container {
        height: auto;
        min-height: calc(100vh - 120px);
    }
    
    .multi-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .multi-header > .btn {
        display: none;
    }
    
    .multi-header h1 {
        font-size: 1rem;
        text-align: center;
        order: -1;
    }
    
    .multi-controls {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
        width: 100%;
    }
    
    .layout-selector {
        grid-column: span 2;
    }
    
    .control-label {
        display: none;
    }
    
    .layout-buttons {
        flex: 1;
        justify-content: center;
    }
    
    .layout-btn {
        width: 40px;
        height: 36px;
    }
    
    .audio-selector {
        grid-column: span 2;
        justify-content: center;
    }
    
    .audio-selector select {
        flex: 1;
        max-width: 120px;
    }
    
    .chat-toggle,
    .fullscreen-toggle {
        justify-content: center;
    }
    
    .chat-toggle .btn,
    .fullscreen-toggle .btn {
        width: 100%;
        justify-content: center;
    }
    
    .chat-text {
        display: none;
    }
    
    .multi-wrapper {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .multi-layout {
        min-height: 250px;
    }
    
    .multi-layout.auto-mode[data-count="2"],
    .multi-layout.auto-mode[data-count="3"],
    .multi-layout.auto-mode[data-count="4"],
    .multi-layout.auto-mode[data-count="5"],
    .multi-layout.auto-mode[data-count="6"],
    .multi-layout.auto-mode[data-count="7"],
    .multi-layout.auto-mode[data-count="8"] {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .multi-layout.auto-mode .multi-player.pinned {
        grid-column: 1;
    }
    
    .multi-player {
        min-height: 150px;
    }
    
    .multi-player-label {
        opacity: 1;
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
    
    .audio-btn,
    .pin-btn {
        font-size: 0.9rem;
        padding: 0.35rem;
        min-width: 32px;
        min-height: 32px;
    }
    
    .multi-chat {
        width: 100%;
        height: 300px;
        order: 10;
    }
    
    .multi-chat.hidden {
        display: none;
    }
    
    /* Chats page mobile */
    .chats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .chat-panel {
        min-height: 300px;
    }
    
    .footer {
        padding: 1rem 0;
        font-size: 0.75rem;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .card-info {
        padding: 0.625rem;
    }
    
    .card-name {
        font-size: 0.9rem;
    }
    
    .badge {
        font-size: 0.6rem;
        padding: 0.25rem 0.5rem;
    }
    
    .multi-controls {
        grid-template-columns: 1fr 1fr;
    }
    
    .layout-selector {
        grid-column: span 1;
    }
    
    .audio-selector {
        grid-column: span 1;
    }
    
    .watch-chat {
        height: 280px;
    }
    
    .multi-chat {
        height: 250px;
    }
}

/* Mobile landscape */
@media (max-width: 900px) and (orientation: landscape) {
    .header {
        display: none;
    }
    
    .footer {
        display: none;
    }
    
    .main {
        padding: 0;
    }
    
    .multi-container {
        height: 100vh;
        padding: 0.5rem;
        min-height: auto;
    }
    
    .multi-header {
        flex-direction: row;
        align-items: center;
        margin-bottom: 0.5rem;
        padding: 0;
    }
    
    .multi-header > .btn {
        display: flex;
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .multi-header h1 {
        font-size: 0.9rem;
        flex: 1;
        text-align: left;
    }
    
    .multi-controls {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }
    
    .layout-selector {
        grid-column: auto;
    }
    
    .audio-selector {
        grid-column: auto;
    }
    
    .audio-selector select {
        max-width: 100px;
    }
    
    .multi-wrapper {
        flex-direction: row;
        flex: 1;
    }
    
    .multi-layout {
        flex: 1;
    }
    
    .multi-layout.auto-mode[data-count="2"],
    .multi-layout.auto-mode[data-count="3"],
    .multi-layout.auto-mode[data-count="4"] {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }
    
    .multi-chat {
        width: 250px;
        height: auto;
        order: 0;
    }
    
    .multi-player-label {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }
    
    .audio-btn,
    .pin-btn {
        font-size: 0.75rem;
        padding: 0.25rem;
        min-width: 26px;
        min-height: 26px;
    }
    
    /* Watch in landscape */
    .watch-container {
        height: 100vh;
        padding: 0.5rem;
    }
    
    .watch-header {
        margin-bottom: 0.5rem;
    }
    
    .watch-layout {
        grid-template-columns: 1fr 280px;
        flex: 1;
    }
    
    .watch-player {
        aspect-ratio: auto;
        height: 100%;
    }
    
    .watch-chat {
        height: 100%;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Selection */
::selection {
    background: var(--accent);
    color: white;
}
