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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Setup Form --- */

#setup {
    width: 100%;
    max-width: 480px;
    padding: 2rem;
}

#setup h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.3rem;
}

.tagline {
    color: #888;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

#setup-form label {
    display: block;
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 0.4rem;
    margin-top: 1.2rem;
}

#setup-form label:first-of-type {
    margin-top: 0;
}

#youtube-url {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

#youtube-url:focus {
    border-color: #666;
}

/* --- Drop Zone --- */

#drop-zone {
    border: 2px dashed #333;
    border-radius: 6px;
    padding: 1.5rem;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

#drop-zone.dragover {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.05);
}

#drop-zone.has-file {
    border-color: #4ecdc4;
    border-style: solid;
}

#drop-text {
    color: #888;
    font-size: 0.9rem;
}

#browse-btn {
    background: none;
    border: none;
    color: #4ecdc4;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
    padding: 0;
}

#file-info {
    color: #4ecdc4;
    font-size: 0.9rem;
}

/* --- Error Message --- */

#error-message {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* --- Play Button --- */

#play-btn {
    width: 100%;
    padding: 0.8rem;
    margin-top: 1.5rem;
    background: #4ecdc4;
    color: #0a0a0a;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

#play-btn:hover {
    opacity: 0.9;
}

#play-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Player Section --- */

#player-section {
    width: 100%;
    max-width: 960px;
    padding: 1rem;
    margin: 0 auto;
}

#player-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

#player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* --- Subtitle Overlay --- */

#subtitle-overlay {
    position: absolute;
    bottom: 12%;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font-size: clamp(0.75rem, 2.2vw, 1.3rem);
    line-height: 1.4;
    padding: 0.25em 0.6em;
    border-radius: 4px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 10;
    white-space: pre-line;
}

/* --- Back Button --- */

#back-btn {
    display: block;
    margin: 1rem auto 0;
    background: none;
    border: 1px solid #333;
    color: #888;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

#back-btn:hover {
    border-color: #666;
    color: #e0e0e0;
}

/* --- Player Error --- */

#player-error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #e74c3c;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
}

/* --- Watch Page (loading / error) --- */

#loading,
#watch-error {
    text-align: center;
    padding: 3rem 2rem;
    color: #888;
}

#watch-error h1 {
    color: #fff;
    margin-bottom: 0.5rem;
}

#watch-error a {
    color: #4ecdc4;
    text-decoration: none;
    margin-top: 1rem;
    display: inline-block;
}

#watch-error a:hover {
    text-decoration: underline;
}

/* --- Responsive --- */

@media (max-width: 600px) {
    #subtitle-overlay {
        max-width: 92%;
        padding: 0.2em 0.5em;
    }

    #setup {
        padding: 1.5rem;
    }

    #player-section {
        padding: 0;
    }

    #player-wrapper {
        border-radius: 0;
    }
}
