                            :root{
    --bg-color: #0b061f;
    --nav-bg: #14103b;
    --card-bg: #12102f;
    --panel-bg: #1a1636;
    --muted: #9ca3af;
    --accent: #3b82f6;
    --danger: #ef4444;
    --white: #ffffff;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--bg-color);
    color: var(--white);
    overflow-x: hidden;
}

/* Page layout */
body {
    padding-top: 54px;  /* matches .header fixed height */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* ── HEADER — shared spec (must match index.css exactly) ── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 54px;               /* FIXED — never changes between pages */
    box-sizing: border-box;
    background: var(--nav-bg);
    z-index: 1000;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 30px;
    max-width: 1400px;
    margin: 0 auto;
    gap: 12px;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
    min-width: 0;
}

.header-left a {
    display: block;
    line-height: 1;
}

.header-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--white);
    margin: 0;
    line-height: 1;
}

.header-subtitle {
    font-size: 12px;
    color: var(--muted);
    margin: 4px 0 0 0;
    padding: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
    flex-shrink: 0;
}

.discord-button-header {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: rgb(88, 101, 242);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.25s ease;
    white-space: nowrap;
}

.discord-button-header:hover {
    background-color: rgb(71, 82, 196);
}

.discord-button-header i {
    font-size: 18px;
}

/* Main container */
.stream-container {
    width: 90%;
    max-width: 1400px;
    margin-top: 8px;
    background: var(--card-bg);
    padding: 12px;
    border-radius: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.stream-title {
    font-size: 20px;
    font-weight: bold;
    margin-top: 8px;
    margin-bottom: 2px;
    text-align: left;
    width: 100%;
    max-width: 1200px;
}

.viewers-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #e53e3e;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

.viewers-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e53e3e;
    flex-shrink: 0;
    display: inline-block;
}

/* Server buttons above iframe */
.link-options {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.link-options button {
    background: var(--panel-bg);
    color: var(--white);
    border: 2px solid #2d2654;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 140px;
}

.link-options button:hover {
    background: #1a1340;
    border-color: var(--accent);
}

.link-options button.active {
    background: var(--danger);
    border-color: var(--danger);
}

/* Iframe / player styling - FIXED FOR DESKTOP/LAPTOP SCREENS */
.iframe-container {
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 16/9;
    /* Ensure iframe doesn't exceed viewport height - accounting for header (54px), title (~40px), buttons (~60px), padding, and footer (~100px) */
    max-height: calc(100vh - 300px);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: #000;
    box-sizing: border-box;
    margin: 0 auto;
}

/* When max-height kicks in, adjust width to maintain aspect ratio */
@media (min-width: 601px) {
    .iframe-container {
        width: min(100%, calc((100vh - 300px) * 16 / 9));
    }
    
    .stream-title {
        width: min(100%, calc((100vh - 300px) * 16 / 9));
        max-width: 1200px;
    }
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Loading overlay / spinner */
.iframe-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 40;
    transition: opacity 0.25s;
}

.spinner {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    animation: spin 1s linear infinite;
}

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

/* Extra info panel under the player */
.extra-info {
    margin: 20px auto 0;
    text-align: left;
    padding: 15px;
    background: #1b1746;
    border-radius: 10px;
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
}

.extra-info h2 { 
    margin-top: 0; 
    margin-bottom: 10px; 
    font-size: 18px; 
}

.extra-info p { 
    font-size: 14px; 
    line-height: 1.5; 
    color: var(--muted); 
}

/* Footer */
.section-footer {
    background-color: #14103b;
    color: white;
    padding: 6px;
    font-size: 12px;
    text-align: center;
    margin-top: 15px;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}

.section-footer a {
    color: #0078ff;
    text-decoration: none;
}

#backupBanner {
    background-color: #ff9800;
    color: #000;
    padding: 6px 12px;
    border-radius: 6px;
    margin: 0 auto 15px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 14px;
    max-width: 600px;
    text-align: center;
    flex-wrap: wrap;
}

#backupBanner a {
    color: #000;
    text-decoration: underline;
}

/* Small view / mobile breakpoints */
@media (max-width: 768px) {
    body {
        padding-top: 56px;   /* matches .header mobile height */
    }

    .header {
        height: 56px;        /* FIXED mobile header height */
    }

    .header-content {
        padding: 0 12px;
        gap: 8px;
    }

    .header-left {
        flex-shrink: 0;
        min-width: 0;
        text-align: left;
    }

    .header-title {
        font-size: 15px;
        white-space: nowrap;
    }

    .header-subtitle {
        font-size: 9px;
        margin-top: 2px;
        white-space: nowrap;
    }

    .header-right {
        flex-shrink: 0;
        justify-content: flex-end;
        gap: 6px;
    }

    .discord-button-header {
        padding: 6px 10px;
        font-size: 11px;
        gap: 4px;
        flex-shrink: 0;
    }

    .discord-button-header i {
        font-size: 14px;
    }

    .discord-button-header span {
        display: none;
    }

    .stream-container { 
        width: 95%; 
        padding: 8px; 
    }
    
    .stream-title { 
        font-size: 14px;
        margin-top: 8px;
        margin-bottom: 8px;
        margin-left: 0;
    }

    /* Fixed server buttons for mobile - use grid so wrapped buttons align in columns predictably */
    .link-options {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
        margin-bottom: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .link-options button {
        padding: 8px 6px;
        font-size: 10px;
        border-width: 1px;
        width: 100%;
        height: auto;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        min-width: 0;
        box-sizing: border-box;
    }

    .extra-info {
        padding: 10px;
    }

    #backupBanner {
        font-size: 12px;
        padding: 8px 10px;
    }
}

/* Mobile landscape: keep the player large and on-screen.
   The desktop rule reserves 300px of chrome which leaves the iframe tiny
   on phones in landscape (header is only ~50-56px). Reserve far less here
   and let the player size to the available viewport height. */
@media (max-width: 900px) and (orientation: landscape) {
    .iframe-container {
        max-height: calc(100vh - 110px);
        width: min(100%, calc((100vh - 110px) * 16 / 9));
        max-width: 100%;
        margin: 0 auto;
    }

    .stream-title {
        width: min(100%, calc((100vh - 110px) * 16 / 9));
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    .stream-container {
        width: 100%;
        padding: 6px;
    }

    /* Compact server buttons so they don't eat vertical space */
    .link-options {
        margin-bottom: 6px;
    }

    .link-options button {
        min-height: 28px;
        padding: 5px 6px;
    }
}

/* Extra small phones (Samsung S series ≤ 400px, iPhone SE etc.) */
@media (max-width: 400px) {
    body {
        padding-top: 50px;
    }

    .header {
        height: 50px;
    }

    .header-content {
        padding: 0 10px;
        gap: 6px;
    }

    .header-title {
        font-size: 13px;
    }

    .header-subtitle {
        font-size: 8px;
        letter-spacing: 0.5px;
    }

    .discord-button-header {
        padding: 5px 8px;
    }

    .stream-title {
        font-size: 13px;
    }
    
    .link-options button {
        font-size: 9px;
        padding: 7px 3px;
        min-height: 30px;
    }
}

/* Small phones (400px - 480px) */
@media (min-width: 401px) and (max-width: 480px) {
    .stream-title {
        font-size: 14px;
    }
    
    .link-options button {
        font-size: 10px;
        padding: 8px 5px;
    }
}

/* Medium phones (481px - 600px) */
@media (min-width: 481px) and (max-width: 600px) {
    .stream-title {
        font-size: 15px;
    }
    
    .link-options button {
        font-size: 11px;
        padding: 9px 6px;
    }
}

/* Tablet (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-content {
        padding: 0 20px;
        gap: 15px;
    }

    .stream-container {
        width: 92%;
    }
}

/* ── MULTI STREAM BUTTON ── */
.ms-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity 0.2s;
}
.ms-btn:hover { opacity: 0.88; }

/* ── MULTI STREAM OVERLAY ── */
#msOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.ms-modal {
  background: #0d0b1f;
  border: 1px solid #2a2750;
  border-radius: 12px;
  width: 100%;
  max-width: 1100px;
  height: 85vh;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ms-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid #2a2750;
  flex-shrink: 0;
}
.ms-modal-title {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.03em;
}
.ms-modal-sub {
  font-size: 12px;
  color: #6b7280;
  flex: 1;
}
.ms-close-btn {
  background: #1e1b35;
  border: 1px solid #2a2750;
  color: #fff;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.ms-close-btn:hover { background: #2d2a50; }

/* Panels */
.ms-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  height: 0;
}
.ms-panel {
  background: #12102f;
  border: 1px solid #2a2750;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

/* Search area */
.ms-search-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 300px;
}
.ms-search-wrap {
  padding: 10px;
  border-bottom: 1px solid #2a2750;
  flex-shrink: 0;
}
.ms-search-input {
  width: 100%;
  box-sizing: border-box;
  background: #0b061f;
  border: 1px solid #2a2750;
  border-radius: 7px;
  color: #fff;
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
}
.ms-search-input::placeholder { color: #4b5563; }
.ms-results {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.ms-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #1e1b35;
  transition: background 0.12s;
}
.ms-result-item:hover { background: #1e1b35; }
.ms-result-sport {
  font-size: 9px;
  font-weight: 800;
  background: #2a2750;
  color: #a78bfa;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}
.ms-result-title {
  flex: 1;
  font-size: 12px;
  color: #e5e7eb;
  line-height: 1.3;
}
.ms-result-time {
  font-size: 11px;
  color: #6b7280;
  flex-shrink: 0;
}
.ms-no-results {
  padding: 20px;
  text-align: center;
  color: #4b5563;
  font-size: 13px;
}

/* Player area */
.ms-player-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ms-panel-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #2a2750;
  flex-shrink: 0;
}
.ms-panel-title {
  flex: 1;
  font-size: 11px;
  font-weight: 700;
  color: #e5e7eb;
  line-height: 1.3;
}
.ms-change-btn {
  background: #1e1b35;
  border: 1px solid #2a2750;
  color: #a78bfa;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.12s;
}
.ms-change-btn:hover { background: #2d2a50; }
.ms-stream-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 7px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid #2a2750;
}
.ms-stream-btn {
  background: #1e1b35;
  border: 1px solid #2a2750;
  color: #9ca3af;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.12s;
}
.ms-stream-btn.active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}
.ms-stream-btn:hover { background: #2d2a50; color: #fff; }
.ms-iframe-wrap {
  flex: 1;
  position: relative;
  min-height: 200px;
}
.ms-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Mobile */
@media (max-width: 700px) {
  .ms-panels { grid-template-columns: 1fr; overflow-y: auto; height: calc(85vh - 60px); }
  .ms-panel { min-height: 300px; max-height: 380px; }
  .ms-search-area { min-height: 260px; }
  .ms-modal-sub { display: none; }
  .ms-btn span { display: none; }
  .ms-btn { padding: 6px 10px; font-size: 13px; }
}


/* ── VPN Notice ── */
.vpn-notice {
  width: 90%;
  max-width: 1400px;
  box-sizing: border-box;
  background-color: #12102f;
  border: 1px solid #2a2750;
  border-radius: 6px;
  padding: 6px 14px;
  margin: 8px auto 0 auto;
  font-size: 12px;
  color: #b0b8cc;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vpn-icon { font-size: 13px; flex-shrink: 0; }
.vpn-link { font-weight: 700; text-decoration: none; }
.vpn-chrome  { color: #f5a623; }
.vpn-firefox { color: #ffffff; }
.vpn-warp    { color: #00e1ff; }
@media (max-width: 768px) {
  .vpn-notice { width: 95%; font-size: 10px; padding: 5px 10px; gap: 4px; margin: 5px auto 0 auto; }
}
