@font-face {
    font-family: "Tektur";
    src: url("fonts/Tektur-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Tektur";
    src: url("fonts/Tektur-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Tektur";
    src: url("fonts/Tektur-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Tektur";
    src: url("fonts/Tektur-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Tektur";
    src: url("fonts/Tektur-ExtraBold.woff2") format("woff2");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Tektur";
    src: url("fonts/Tektur-Black.woff2") format("woff2");
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --hud-bg-dark: #00121a;
    --hud-bg-panel: #00202c;
    --hud-teal-border: #007f70;
    --hud-teal-dark: #00453d;
    --hud-neon-green: #00f5a0;
    --hud-mint-text: #b1ffc9;
    --hud-live-red: #ff4655;
    --hud-font: "Tektur", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--hud-bg-dark);
    color: var(--hud-mint-text);
    font-family: var(--hud-font);
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.player-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #000a0f;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* State Screens (Waiting / Error) with Tournament Backdrop */
.state-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #002837 0%, #00121a 75%, #000a0f 100%);
    z-index: 10;
    text-align: center;
    padding: 24px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.state-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0, 127, 112, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 127, 112, 0.12) 1px, transparent 1px);
    background-size: 48px 48px;
    background-position: center;
    pointer-events: none;
    opacity: 0.6;
}

.state-screen::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("texture.webp") center/cover no-repeat;
    mix-blend-mode: soft-light;
    opacity: 0.35;
    pointer-events: none;
}

.state-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Radar Animation for Waiting Screen */
.radar-spinner {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(0, 245, 160, 0.5);
    animation: radarPulse 2.6s cubic-bezier(0.2, 0.76, 0.2, 1) infinite;
}

.radar-circle.delay-1 {
    animation-delay: 0.85s;
}

.radar-circle.delay-2 {
    animation-delay: 1.7s;
}

.radar-center {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--hud-neon-green);
    box-shadow: 0 0 25px var(--hud-neon-green), 0 0 10px #ffffff;
}

@keyframes radarPulse {
    0% {
        transform: scale(0.2);
        opacity: 0.9;
    }
    75% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.waiting-title {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 10px;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 32, 44, 0.8), 0 0 20px rgba(0, 245, 160, 0.3);
    z-index: 1;
}

.waiting-subtitle {
    font-size: 15px;
    font-weight: 600;
    color: var(--hud-mint-text);
    max-width: 480px;
    line-height: 1.5;
    margin-bottom: 24px;
    opacity: 0.85;
    z-index: 1;
}

.streamer-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: var(--hud-bg-panel);
    border: 2px solid var(--hud-teal-border);
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.streamer-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hud-neon-green);
    box-shadow: 0 0 8px var(--hud-neon-green);
}

/* Error Screen */
.error-icon {
    font-size: 56px;
    margin-bottom: 16px;
    z-index: 1;
}

.error-title {
    font-size: 28px;
    font-weight: 900;
    color: var(--hud-live-red);
    text-shadow: 0 0 15px rgba(255, 70, 85, 0.4);
    margin-bottom: 10px;
    z-index: 1;
}

.error-desc {
    font-size: 15px;
    font-weight: 500;
    color: #cbd5e1;
    max-width: 420px;
    margin-bottom: 24px;
    line-height: 1.5;
    z-index: 1;
}

.manual-token-box {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    z-index: 1;
}

.manual-token-box input {
    flex: 1;
    background: var(--hud-bg-panel);
    border: 2px solid var(--hud-teal-border);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    padding: 12px 16px;
    color: #fff;
    font-family: var(--hud-font);
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s;
}

.manual-token-box input:focus {
    border-color: var(--hud-neon-green);
}

.manual-token-box button {
    background: var(--hud-live-red);
    color: #fff;
    border: none;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    padding: 12px 20px;
    font-family: var(--hud-font);
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.manual-token-box button:hover {
    background: #e03342;
    transform: translateY(-1px);
}

/* Unmute Banner */
.unmute-banner {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    transition: opacity 0.3s ease;
}

.unmute-banner.hidden {
    opacity: 0;
    pointer-events: none;
}

.unmute-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--hud-bg-panel);
    border: 2px solid var(--hud-neon-green);
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
    padding: 12px 28px;
    color: #fff;
    font-family: var(--hud-font);
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 245, 160, 0.35);
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}

.unmute-btn:hover {
    transform: scale(1.03);
    background: #00364a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 245, 160, 0.5);
}

/* UI Overlay Layer */
.ui-layer {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    z-index: 20;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.35s ease;
}

.ui-layer * {
    pointer-events: auto;
}

.player-container.idle .ui-layer {
    opacity: 0;
    pointer-events: none;
}

.player-container.obs-mode .ui-layer {
    display: none !important;
}

.player-container.obs-mode {
    cursor: none !important;
}

/* Header */
.ui-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(0, 18, 26, 0.94) 0%, rgba(0, 18, 26, 0.4) 75%, transparent 100%);
    padding: 14px 20px 28px 20px;
    margin: -20px -20px 0 -20px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--hud-bg-panel);
    border: 2px solid rgba(148, 163, 184, 0.3);
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #658291;
    transition: all 0.3s ease;
}

.live-badge.live {
    background: var(--hud-live-red);
    border-color: var(--hud-live-red);
    color: #fff;
    box-shadow: 0 0 18px rgba(255, 70, 85, 0.6);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.live-badge.live .live-dot {
    animation: liveBlink 1.2s ease-in-out infinite;
}

@keyframes liveBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.tournament-info h1 {
    font-size: 18px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 0.5px;
    line-height: 1.2;
    text-shadow: 0 0 8px rgba(0, 245, 160, 0.2);
}

.tournament-info span {
    font-size: 12px;
    font-weight: 600;
    color: var(--hud-mint-text);
    opacity: 0.8;
}

.user-chip {
    background: var(--hud-bg-panel);
    border: 1px solid var(--hud-teal-border);
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    gap: 8px;
}

.user-chip .chip-label {
    color: var(--hud-mint-text);
    opacity: 0.7;
}

/* Footer Controls */
.ui-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(0deg, rgba(0, 18, 26, 0.96) 0%, rgba(0, 18, 26, 0.5) 75%, transparent 100%);
    padding: 30px 20px 14px 20px;
    margin: 0 -20px -20px -20px;
}

.footer-left, .footer-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ctrl-btn {
    background: var(--hud-bg-panel);
    border: 1.5px solid var(--hud-teal-border);
    clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
    color: #fff;
    font-family: var(--hud-font);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.ctrl-btn:hover {
    background: #00364a;
    border-color: var(--hud-neon-green);
    box-shadow: 0 0 12px rgba(0, 245, 160, 0.35);
}

.ctrl-btn:active {
    transform: scale(0.96);
}

.live-sync-btn {
    font-weight: 800;
    font-size: 13px;
    color: #658291;
    letter-spacing: 0.5px;
}

.live-sync-btn.synced {
    color: var(--hud-neon-green);
    border-color: var(--hud-neon-green);
    box-shadow: 0 0 10px rgba(0, 245, 160, 0.3);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-control input[type="range"] {
    width: 80px;
    accent-color: var(--hud-neon-green);
    cursor: pointer;
}

.stats-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--hud-mint-text);
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
}

/* OBS Exit Hint */
.obs-exit-hint {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 30;
    background: var(--hud-bg-panel);
    border: 2px solid var(--hud-teal-border);
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 700;
    transition: opacity 0.3s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.obs-exit-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.obs-exit-hint button {
    background: var(--hud-live-red);
    border: none;
    clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
    padding: 6px 12px;
    color: #fff;
    font-family: var(--hud-font);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
}
