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

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(1200px 600px at 20% -10%, rgba(255,255,255,0.06), transparent),
                radial-gradient(1000px 500px at 120% 10%, rgba(255,255,255,0.05), transparent),
                #0b0f14;
    color: #e9eef5;
    min-height: 100vh;
    line-height: 1.6;
}

/* Global links: make them clearly visible */
a {
    color: #f59e0b;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 2px;
}
a:hover { color: #fbbf24; }
a:focus-visible, button:focus-visible, .btn-home:focus-visible, .btn-switch:focus-visible, .btn-back:focus-visible, .selection-btn:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
    border-radius: 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 32px;
    padding: 36px 0 16px;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.tagline {
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 400;
}

main {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 28px;
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.06);
}

.hero {
    margin-bottom: 16px;
}

.hero h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    text-align: center;
    font-weight: 700;
}

.hero .sub {
    text-align: center;
    opacity: 0.8;
}

.hero-badge {
    display: inline-block;
    background: linear-gradient(180deg, #16a34a, #15803d);
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    margin-right: 6px;
}

.examples, .example { display: none; }

.note {
    font-size: 0.9rem;
    opacity: 0.8;
    font-style: italic;
}

.auto-detect-info { display: none; }

.manual-form {
    background: rgba(255, 255, 255, 0.04);
    padding: 22px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 22px;
}
.minimal-card { box-shadow: 0 4px 24px rgba(0,0,0,0.25); }

.howto-card {
    margin-top: 18px;
    padding: 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
}

.howto-title {
    font-weight: 800;
    color: #f8fafc;
    margin-bottom: 10px;
}

.url-demo { display: grid; gap: 10px; }
.url-bar {
    display: block;
    width: 100%;
    padding: 12px 14px;
    background: #0f172a;
    color: #e5e7eb;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    overflow: hidden;
}
.url-part.protocol { opacity: 0.7; }
.url-part.site { color: #f8fafc; font-weight: 800; }
.url-part.path { opacity: 0.9; }
.caret {
    display: inline-block;
    width: 2px;
    height: 1.1em;
    background: #f59e0b;
    vertical-align: -0.15em;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.url-tip { color: #cbd5e1; font-size: 0.95rem; }

.manual-form h3 {
    margin-bottom: 12px;
    color: #f8fafc;
    font-weight: 700;
}

#imdbForm {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#imdbUrl {
    padding: 16px 14px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    font-size: 1rem;
    background: rgba(7, 12, 18, 0.8);
    color: #e9eef5;
    outline: none;
}

#imdbUrl::placeholder { color: #8da2b8; }
#imdbUrl:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }

.form-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

.form-group input[type="radio"] {
    width: 18px;
    height: 18px;
}

#tvOptions {
    display: flex;
    gap: 14px;
}

#tvOptions .num-group {
    flex: 1;
}

#tvOptions label {
    display: block;
    font-size: 0.95rem;
    color: #cbd5e1;
    margin: 2px 4px 6px;
}

#tvOptions .stepper {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 6px;
}

#tvOptions input {
    width: 100%;
    padding: 12px 10px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    background: rgba(7, 12, 18, 0.8);
    color: #e9eef5;
    text-align: center;
}

.step-btn {
    padding: 10px 0;
    background: #1f2937;
    color: #e5e7eb;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    font-size: 1.1rem;
    line-height: 1;
}
.step-btn:hover { background: #111827; }
#tvOptions input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }

button {
    padding: 14px 22px;
    background: linear-gradient(180deg, #f59e0b, #d97706);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover { transform: translateY(-1px); filter: brightness(1.05); }

.btn-primary { background: linear-gradient(180deg, #f59e0b, #d97706); }

.embed-container {
    background: rgba(255, 255, 255, 0.04);
    padding: 18px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
}

.embed-container h3 { margin-bottom: 12px; color: #f8fafc; }

#playerFrame {
    width: 100%;
    aspect-ratio: 16/9;
    height: auto;
    border: none;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.close-btn { background: #ef4444; }
.close-btn:hover { background: #dc2626; }

footer {
    text-align: center;
    margin-top: 28px;
    padding: 16px 0 8px;
    opacity: 0.7;
}

footer p {
    margin-bottom: 5px;
}

.disclaimer { font-size: 0.9rem; opacity: 0.6; }

/* Player Section Styles */
.player-section {
    margin-bottom: 20px;
}

.player-header {
    text-align: center;
    margin-bottom: 18px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.player-header h2 {
    color: #f8fafc;
    margin-bottom: 6px;
    font-size: 1.6rem;
}

.player-header p { opacity: 0.7; margin-bottom: 12px; }

.detection-notice {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: #ffc107 !important;
    opacity: 1 !important;
}

.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-home {
    background: #334155;
    color: white;
    padding: 10px 16px;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    transition: all 0.2s ease;
}
.btn-home:hover { background: #475569; }

.btn-switch {
    background: #1f2937;
    color: #e5e7eb;
    padding: 10px 16px;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.06);
}
.btn-switch:hover { background: #111827; }

.episode-controls { display: flex; gap: 10px; }
.season-controls { display: flex; gap: 10px; }

.btn-episode {
    background: linear-gradient(180deg, #f59e0b, #d97706);
    color: white;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
}
.btn-episode:hover { filter: brightness(1.05); }

.embed-container-main {
    background: rgba(255, 255, 255, 0.04);
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.06);
}

#mainPlayer {
    width: 100%;
    aspect-ratio: 16/9;
    height: auto;
    border: none;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.4);
}

/* Selection Page Styles */
.selection-section {
    text-align: center;
    margin-bottom: 20px;
}

.selection-header {
    margin-bottom: 28px;
    padding: 22px 18px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.selection-header::before { display: none; }

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.selection-header h2 {
    color: #f8fafc;
    margin-bottom: 6px;
    font-size: 1.6rem;
    font-weight: 800;
    position: relative;
    z-index: 1;
}

.selection-header p {
    margin-bottom: 10px;
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.selection-header p:last-child { font-size: 1.05rem; color: #9eb6cf; }

.selection-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.selection-btn {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    text-decoration: none;
    color: white;
    transition: transform 0.15s ease, background 0.2s ease;
    position: relative;
    overflow: hidden;
    min-height: 110px;
}

.selection-btn::before { display: none; }

.selection-btn:hover { transform: translateY(-2px); background: rgba(255,255,255,0.06); }

.movie-btn:hover { box-shadow: 0 10px 28px rgba(14,103,255,0.15); }
.tv-btn:hover { box-shadow: 0 10px 28px rgba(19,193,141,0.15); }

.btn-icon {
    font-size: 2.6rem;
    margin-right: 16px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.selection-btn:hover .btn-icon { transform: none; }

.btn-content {
    flex: 1;
    text-align: left;
}

.btn-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
    display: block;
    color: #f8fafc;
}

.btn-desc {
    font-size: 0.95rem;
    opacity: 0.75;
    display: block;
    line-height: 1.4;
}

.btn-arrow { display: none; }

.selection-help {
    background: rgba(255, 255, 255, 0.04);
    padding: 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.selection-help p { margin-bottom: 14px; color: #cbd5e1; font-size: 0.95rem; }

.btn-back {
    background: #1f2937;
    color: #e5e7eb;
    padding: 10px 14px;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.06);
}
.btn-back:hover { background: #111827; }

/* Responsive adjustments for player */
@media (max-width: 768px) {
    .player-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .episode-controls {
        flex-direction: column;
        width: 100%;
    }
    .season-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-episode {
        width: 100%;
    }
    
    #mainPlayer {
        height: 50vh;
        min-height: 300px;
    }
    
    .player-header h2 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    #mainPlayer {
        height: 40vh;
        min-height: 250px;
    }
}
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    main { padding: 20px; }
    
    .examples {
        grid-template-columns: 1fr;
    }
    
    .form-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    #tvOptions {
        flex-direction: column;
    }
    
    #playerFrame { height: 300px; }
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.embed-container { animation: fadeIn 0.4s ease-out; }

/* Loading state */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments for selection page */
@media (max-width: 768px) {
    .selection-buttons {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 18px;
    }
    
    .selection-btn {
        padding: 16px 18px;
        min-height: unset;
    }
    
    .btn-icon {
        font-size: 2.2rem;
        margin-right: 12px;
    }
    
    .btn-title { font-size: 1.2rem; }
    .btn-desc { font-size: 0.85rem; }
    .selection-header h2 { font-size: 1.3rem; }
    .selection-header { padding: 16px; margin-bottom: 20px; }
}

@media (max-width: 480px) {
    .selection-btn {
        flex-direction: column;
        text-align: center;
        padding: 18px 16px;
        min-height: auto;
    }
    
    .btn-icon {
        margin-right: 0;
        margin-bottom: 10px;
        font-size: 2.4rem;
    }
    
    .btn-content { text-align: center; }
    .btn-arrow { margin-left: 0; margin-top: 10px; }
}

/* Segmented control style for content type */
.form-segmented {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 4px;
}
.form-segmented .seg {
    position: relative;
    flex: 1;
    justify-content: center;
    gap: 8px;
}
.form-segmented .seg input { position: absolute; inset: 0; opacity: 0; }
.form-segmented .seg span {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 10px;
    color: #cde3ff;
}
.form-segmented .seg input:checked + span {
    background: #f59e0b;
    color: white;
}

/* Subtle helper text */
.subtle { opacity: 0.65; margin-top: 10px; }
