/* Общие настройки — визуальный стиль CitruStream */
:root {
    --bg: #111318;
    --panel: #1b1e26;
    --panel-soft: #252936;
    --border: #303440;
    --border-strong: #3c414e;
    --accent: #7c4dff;
    --accent-hover: #6939ed;
    --accent-soft: #9474ff;
    --text: #f5f5f5;
    --muted: #b5b8c4;
    --label: #d4d5dc;
    --danger: #ff9999;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--accent-soft);
}

/* Шапка */
.header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 40px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: inherit;
    text-decoration: none;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent);
    font-size: 22px;
    color: white;
}

.header h1 {
    margin: 0;
    font-size: 25px;
}

/* Основной контейнер */
.container {
    width: min(900px, 100%);
    margin: 0 auto;
    padding: 40px 24px;
}

h2 {
    margin: 0 0 24px;
    font-size: 22px;
}

/* Карточки и секции */
.create-section {
    padding: 28px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 48px;
}

.streams-section {
    margin-top: 10px;
}

/* Формы */
#stream-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#stream-form label,
.item label {
    margin-top: 8px;
    font-size: 15px;
    color: var(--label);
}

#stream-form input,
.item input[type="text"],
.item select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    outline: none;
    background: var(--bg);
    color: white;
    font-size: 15px;
}

#stream-form input:focus,
.item input[type="text"]:focus,
.item select:focus {
    border-color: var(--accent-soft);
}

#stream-form input::placeholder {
    color: #858997;
}

/* Кнопки */
button,
.join-button {
    display: inline-block;
    border: none;
    border-radius: 9px;
    padding: 13px 18px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
}

button:hover,
.join-button:hover {
    transform: translateY(-1px);
}

button:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.start-button,
#publish-button {
    margin-top: 12px;
    background: var(--accent);
    color: white;
}

.start-button:hover,
#publish-button:hover {
    background: var(--accent-hover);
}

.join-button {
    align-self: flex-start;
    background: var(--border);
    color: white;
}

.join-button:hover {
    background: #454b5a;
}

.back-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
}

.back-link:hover {
    color: var(--text);
}

/* Список трансляций */
.streams-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.stream-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.stream-card h3 {
    margin: 0;
    font-size: 19px;
    overflow-wrap: anywhere;
}

.stream-author {
    margin: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

/* Превью трансляции */
.stream-preview-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 9px;
    background: var(--panel-soft);
}

.stream-preview {
    display: block;
    width: 100%;
    max-height: 260px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 9px;
    background: var(--panel-soft);
}

.preview-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    color: var(--muted);
    font-size: 14px;
    background: rgba(5, 7, 10, 0.55);
    pointer-events: none;
}

.preview-message:empty {
    display: none;
}

/* Сообщения */
.message {
    margin: 16px 0 0;
    font-size: 14px;
    color: #c4b5fd;
}

.message:empty {
    display: none;
}

.loading,
.empty-message,
.error-message {
    padding: 20px;
    color: var(--muted);
    background: var(--panel);
    border-radius: 12px;
}

.error-message {
    color: var(--danger);
}

/* Страница публикации */
.publish-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.video-stage {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #05070a;
    border: 1px solid var(--border);
}

.video-stage video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #05070a;
}

.video-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    background: rgba(5, 7, 10, 0.55);
    pointer-events: none;
    text-shadow: 0 0 5px black;
}

.video-message:empty {
    display: none;
}

.publish-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.control-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: center;
}

.item[hidden] {
    display: none;
}

.item label {
    margin-top: 0;
}

.item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

#submit-line {
    margin-top: 10px;
}

#message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    background: rgba(5, 7, 10, 0.55);
    pointer-events: none;
    text-shadow: 0 0 5px black;
}

#message:empty {
    display: none;
}

/* Страница просмотра: плеер занимает всё место ниже шапки */
.watch-page {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.watch-main {
    flex: 1;
    display: flex;
    min-height: 0;
    width: 100%;
    margin: 0;
    padding: 0;
}

.stream-name {
    color: var(--muted);
    font-weight: normal;
}

.watch-player {
    flex: 1;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    border-radius: var(--radius);
}

/* Мобильная версия */
@media (max-width: 600px) {
    .header {
        padding: 16px 20px;
    }

    .header h1 {
        font-size: 21px;
    }

    .container {
        padding: 24px 16px;
    }

    .create-section {
        padding: 20px;
        margin-bottom: 36px;
    }

    .stream-card {
        padding: 16px;
    }
}
