:root {
    --bg-color: #121212;
    --panel-color: #1e1e1e;
    --toast-bg-color: #2c2c2c;
    --text-color: #e0e0e0;
    --accent-color: #007bff;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --disabled-color: #555555;
    --button-text-color: #ffffff;
    --border-color: #333333;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    gap: 1rem;
}

header {
    width: 100%;
    background-color: var(--panel-color);
    text-align: center;
    border-bottom: 1px solid #333;
    margin-bottom: 1rem;
}

footer {
    width: 100%;
    background-color: var(--panel-color);
    text-align: center;
    border-top: 1px solid #333;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: #888;
    margin-top: auto;
}

footer ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

p {
    line-height: 1.6;
}

p svg, li svg {
    vertical-align: middle;
    height: 1em;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

li {
    margin-bottom: 0.5rem;
}

h2 {
    border-bottom: 4px solid var(--accent-color);
}

h3 {
    border-bottom: 2px solid var(--accent-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
}

header a {
    display: inline-block;
    /*padding: 1rem;*/
    color: var(--text-color);
    text-decoration: none;
    /*font-size: 1.5rem;*/
    font-weight: bold;
}

.container {
    width: 90%;
    max-width: 1200px;
    background: var(--panel-color);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
}

.container-full {
    flex-grow: 1;
}


.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 4px;
    /*overflow: hidden;*/
    margin-bottom: 1.5rem;
}

.video-wrapper button {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0);
    opacity: 0;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.video-wrapper:hover button {
    opacity: 1;
}

.video-wrapper .offline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.video-wrapper .offline-overlay h2 {
    top: 0;
    font-size: 2rem;
    text-align: center;
    background: var(--danger-color);
    color: var(--bg-color);
    padding: 0.5rem;
    border: none;
}

.video-wrapper .offline-overlay p {
    font-size: 1.5rem;
    text-align: center;
    margin: 0.2rem;
}

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

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 1rem;
    font-size: 0.9rem;
    color: #888;
}

.status-bar div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #555;
    margin-right: 5px;
}

.status-indicator.connected {
    background-color: var(--success-color);
    box-shadow: 0 0 5px var(--success-color);
}

.status-indicator.reconnecting {
    background-color: var(--warning-color);
    animation: pulse 1s infinite;
}

.status-indicator.error {
    background-color: var(--danger-color);
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        opacity: 1;
    }
}

.slider-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 0.5rem;
}

.slider-group input {
    width: 100%;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.slider-group label {
    font-family: sans-serif;
}

.button-group {
    display: flex;
    gap: 1rem;
    align-items: stretch;
}

button {
    padding: 0.8rem;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--disabled-color);
}

button:hover {
    opacity: 0.9;
}

.btn-primary {
    background-color: var(--accent-color);
    color: var(--button-text-color);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-secondary {
    background-color: #333;
    color: var(--text-color);
}

.closebtn {
    background: none;
    font-weight: bold;
    float: right;
    color: var(--text-color);
    font-size: 22px;
    /*line-height: 20px;*/
    padding: 0 0 0 1rem;
    cursor: pointer;
    transition: 0.3s;
}

#toast-container {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background-color: var(--toast-bg-color);
    color: var(--text-color);
    padding: 1rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    opacity: 0.95;
    animation: slideIn 0.3s ease-out;
}

.toast.toast-error {
    border-left: 5px solid var(--danger-color);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.form-group label {
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.5rem;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: var(--panel-color);
    color: var(--text-color);
}

input[type="submit"] {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.about-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.about-section div.centered {
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.small-video {
    width: 100%;
}

.yt-placeholder {
    width: 100%;
    height: auto;
    border-radius: 4px;
    background-color: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
}

.yt-placeholder svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
}

/*@media (max-width: 1000px) {*/
/*    .small-video {*/
/*        width: 360px;*/
/*    }*/
/*}*/

.advanced-controls {
    margin: 1rem 0;
}

textarea {
    padding: 0.5rem;
    box-sizing: border-box;
    border: 1px solid #444;
    border-radius: 4px;
    background-color: var(--panel-color);
    color: var(--text-color);
    resize: vertical;
}

#editor-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 1rem 0;
    gap: 1rem;
}

#editor-container button svg {
    height: 1.5rem;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/*#editor-container button {*/
/*    display: flex;*/
/*    align-items: center;*/
/*    justify-content: center;*/
/*    gap: 0.5rem;*/
/*    font-size: 1.5rem;*/
/*}*/

textarea#userscript-code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    height: 400px;
    width: 100%;
    margin: 0 auto;
}

/* textarea scrollbar */
/*textarea::-webkit-scrollbar {*/
/*    width: 8px;*/
/*}*/
/*textarea::-webkit-scrollbar-thumb {*/
/*    background-color: var(--accent-color);*/
/*    border-radius: 4px;*/
/*}*/
/*textarea::-webkit-scrollbar-thumb:hover {*/
/*    background-color: var(--accent-color);*/
/*}*/

@media (max-width: 600px) {

    .slider-group {
        padding: 0 1rem;
    }

    .container {
        /*padding: 1rem 0;*/
        /*border-radius: 0;*/
    }

    .small-video {
        width: 100%;
    }

    .about-section {
        grid-template-columns: 1fr;
    }

    .video-wrapper .offline-overlay h2 {
        font-size: 1.3rem;
    }

    .video-wrapper .offline-overlay p {
        font-size: 1rem;
    }
}