
:root {
    --bg: #0f0c0a;
    --bg-2: #15110e;
    --surface: #1c1714;
    --surface-2: #261f1b;
    --line: rgba(255, 232, 214, 0.08);
    --line-2: rgba(255, 232, 214, 0.15);
    --text: #f6eee8;
    --text-2: rgba(246, 238, 232, 0.70);
    --text-3: rgba(246, 238, 232, 0.45);
    --accent: #ff5722;
    --accent-2: #ff7448;
    --accent-soft: rgba(255, 87, 34, 0.14);
    --gold: #ffd54f;
    --danger: #ff6b6b;
    --ok: #5fd38d;
    --r-lg: 20px;
    --r: 14px;
    --r-sm: 10px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
    --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --header-h: 64px;
    color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: #fff; }
body.modal-open { overflow: hidden; }
[hidden] { display: none !important; }

/* ---------- Шапка ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(15, 12, 10, 0.80);
    backdrop-filter: saturate(1.4) blur(18px);
    -webkit-backdrop-filter: saturate(1.4) blur(18px);
    border-bottom: 1px solid var(--line);
}
.site-header__inner {
    max-width: 1240px; margin: 0 auto; padding: 0 24px;
    min-height: var(--header-h);
    display: flex; align-items: center; gap: 20px;
}
.logo {
    font-family: var(--font-display); font-weight: 800; font-size: 19px;
    letter-spacing: -0.02em; color: var(--text); text-decoration: none;
    display: inline-flex; align-items: center; white-space: nowrap; flex-shrink: 0;
}
.logo__accent { color: var(--accent); }
.logo__hd {
    font-family: var(--font); font-size: 10.5px; font-weight: 800; line-height: 1.35;
    color: var(--gold); border: 1.5px solid currentColor; border-radius: 5px;
    padding: 0 5px; margin-left: 8px; letter-spacing: 0.04em;
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- Кнопки ---------- */
.btn {
    --h: 44px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: var(--h); padding: 0 20px;
    border-radius: var(--r-sm); border: 1px solid transparent;
    font: 700 15px/1 var(--font); text-decoration: none; white-space: nowrap;
    cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
    transition: background-color .2s, border-color .2s, color .2s, transform .15s var(--ease), opacity .2s;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); }
.btn--ghost { background: rgba(255, 232, 214, 0.06); border-color: var(--line); color: var(--text); }
.btn--ghost:hover { background: rgba(255, 232, 214, 0.11); border-color: var(--line-2); }
.btn--sm { --h: 36px; padding: 0 14px; font-size: 14px; }
.btn--icon { padding: 0; width: var(--h); flex-shrink: 0; }
.btn--live { background: rgba(255, 59, 48, 0.12); border-color: rgba(255, 59, 48, 0.32); color: #ff6a5f; }
.btn--live:hover { background: rgba(255, 59, 48, 0.2); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: livePulse 1.8s infinite; }
@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 106, 95, .55); }
    70% { box-shadow: 0 0 0 8px rgba(255, 106, 95, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 106, 95, 0); }
}

/* ---------- Поиск ---------- */
.search {
    display: flex; align-items: center; width: 100%;
    background: var(--surface); border: 1px solid var(--line-2);
    border-radius: var(--r); padding: 5px;
    transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search__icon { margin-left: 12px; color: var(--text-3); flex-shrink: 0; }
.search__input {
    flex: 1; min-width: 0; background: none; border: 0; outline: 0;
    color: var(--text); font: 500 16px var(--font); padding: 10px 12px;
}
.search__input::placeholder { color: var(--text-3); }
.search__input::-webkit-search-cancel-button { display: none; }

/* ---------- Модальное окно ---------- */
.modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(8, 6, 5, 0.74);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    opacity: 0; visibility: hidden;
    transition: opacity .25s var(--ease), visibility 0s linear .25s;
}
.modal.is-open { opacity: 1; visibility: visible; transition: opacity .25s var(--ease), visibility 0s; }
.modal__dialog {
    position: relative; width: 100%; max-width: 720px;
    max-height: calc(100dvh - 40px); overflow: auto; overscroll-behavior: contain;
    background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    transform: translateY(18px) scale(0.97);
    transition: transform .32s var(--ease);
}
.modal.is-open .modal__dialog { transform: none; }
.modal__close {
    position: absolute; top: 12px; right: 12px; z-index: 3;
    width: 36px; height: 36px; border-radius: 50%; border: 0;
    background: rgba(0, 0, 0, 0.5); color: var(--text);
    display: grid; place-items: center; cursor: pointer; transition: background .2s;
}
.modal__close:hover { background: rgba(0, 0, 0, 0.75); }
.modal__body { padding: 24px; }
.modal__title { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.25; letter-spacing: -0.01em; padding-right: 40px; }

/* ---------- Лоадер-"плёнка" ---------- */
.reel {
    position: relative; height: 18px; border-radius: 4px; overflow: hidden;
    background: #0b0908; border: 1px solid var(--line);
}
.reel::before {
    content: ''; position: absolute; inset: 3px -40px; 
    background: repeating-linear-gradient(90deg, rgba(255,232,214,.22) 0 8px, transparent 8px 20px);
    border-radius: 2px;
    animation: reelRun .6s linear infinite;
}
.reel::after {
    content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
    background: linear-gradient(90deg, transparent, rgba(255, 87, 34, .55), transparent);
    animation: reelSweep 1.4s var(--ease) infinite;
}
@keyframes reelRun { to { transform: translateX(20px); } }
@keyframes reelSweep { to { left: 100%; } }

.spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid rgba(255, 232, 214, .14); border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Подвал ---------- */
.site-footer { margin-top: auto; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; }
.site-footer__inner {
    max-width: 1240px; margin: 0 auto; padding: 22px 24px;
    display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between;
}
.site-footer .accent { color: var(--accent); }
/* «Секретная» третья точка в подвале: выглядит как текст, но кликабельна с запасом */
.footer-dot { color: inherit; text-decoration: none; cursor: inherit; padding: 8px 3px; margin: -8px -3px; }

@media (max-width: 640px) {
    :root { --header-h: 58px; }
    .site-header__inner { padding: 0 16px; gap: 12px; }
    .logo { font-size: 16px; }
    .logo__hd { margin-left: 6px; }
    .modal { align-items: flex-end; padding: 0; }
    .modal__dialog {
        max-width: none; max-height: 92dvh;
        border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0;
        transform: translateY(100%);
    }
    .modal__body { padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
    .site-footer__inner { padding: 18px 16px; justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important; animation-iteration-count: 1 !important;
        transition-duration: .01ms !important; scroll-behavior: auto !important;
    }
}
.announce { position: relative; display: flex; align-items: center; justify-content: center; padding: 10px 52px; font-size: 14px; font-weight: 600; line-height: 1.45; text-align: center; }
.announce p { margin: 0; max-width: 1000px; overflow-wrap: anywhere; }
.announce a { color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.announce--info { background: #1b2730; color: #cfe6f5; }
.announce--warning { background: #392d10; color: #ffe39a; }
.announce--accent { background: var(--accent); color: #fff; }
.announce__close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(0,0,0,.22); color: inherit; display: grid; place-items: center; cursor: pointer; }
.announce__close:hover { background: rgba(0,0,0,.4); }
@media (max-width: 640px) { .announce { padding: 10px 46px 10px 16px; justify-content: flex-start; text-align: left; font-size: 13px; } }

/* Общие поля форм (используются на странице настройки, в комнатах и т.д.) */
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-3); margin: 18px 0 6px; }
.text-input {
    width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-sm);
    background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); font: 500 16px var(--font);
}
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.text-input--mono { font: 500 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text-2); }

/* Логотип-картинка (настройки «Оформление») */
.logo--image { gap: 10px; }
.logo__img { display: block; height: 34px; width: auto; max-width: 200px; object-fit: contain; }
.logo__text { white-space: nowrap; }
@media (max-width: 640px) { .logo__img { height: 28px; max-width: 140px; } }

/* ---------- Режим для телевизоров (tv.js) ---------- */
.tv-toggle { color: inherit; opacity: .7; margin-left: 10px; }
.tv-toggle:hover { opacity: 1; }
.tv body { font-size: 17px; }
.tv :focus, .tv :focus-visible {
    outline: 4px solid var(--accent); outline-offset: 3px;
    box-shadow: 0 0 0 9px rgba(255, 87, 34, .28); border-radius: 10px;
}
.tv .btn { --h: 52px; font-size: 17px; }
.tv .btn--sm { --h: 46px; font-size: 16px; }
.tv .card:focus-within { transform: translateY(-4px); transition: transform .2s var(--ease); }
.tv .modal__close { width: 48px; height: 48px; }

/* Всплывающие подсказки (используются и вне комнат: режим для ТВ, горячие клавиши) */
.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 1100; max-width: calc(100vw - 32px);
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none; text-align: center;
    background: var(--surface-2); border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 999px;
    font-size: 14px; font-weight: 600; box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
    transition: opacity .25s, transform .3s var(--ease);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
