@font-face {
    font-family: 'Handjet';
    src: url('fonts/handjet-cyrillic.woff2') format('woff2');
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Handjet';
    src: url('fonts/handjet-latin.woff2') format('woff2');
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('fonts/jetbrains-mono-cyrillic.woff2') format('woff2');
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('fonts/jetbrains-mono-latin.woff2') format('woff2');
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/ibm-plex-mono-cyrillic.woff2') format('woff2');
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/ibm-plex-mono-latin.woff2') format('woff2');
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/ibm-plex-mono-bold-cyrillic.woff2') format('woff2');
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/ibm-plex-mono-bold-latin.woff2') format('woff2');
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Ubuntu Mono';
    src: url('fonts/ubuntu-mono-cyrillic.woff2') format('woff2');
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Ubuntu Mono';
    src: url('fonts/ubuntu-mono-latin.woff2') format('woff2');
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Ubuntu Mono';
    src: url('fonts/ubuntu-mono-bold-cyrillic.woff2') format('woff2');
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: 'Ubuntu Mono';
    src: url('fonts/ubuntu-mono-bold-latin.woff2') format('woff2');
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ============================================================
   CSS CUSTOM PROPERTIES — ТЕМЫ ТЕРМИНАЛА
   ============================================================
   Все цвета задаются исключительно через переменные.
   Пресеты определяются в :root и переопределяются через JS.
   ============================================================ */

:root {
    --theme-font-family:     'Handjet', monospace;

    /* ── Основной акцент (яркий, L≈0.72) ── */
    --theme-accent:            #7be07b;
    --theme-accent-soft:       #a0f0a0;
    --theme-accent-dim:        #33aa33;
    --theme-accent-glow:       rgba(123, 224, 123, 0.4);
    --theme-accent-border:     #33aa33;
    --theme-accent-shadow:     rgba(80, 200, 80, 0.12);
    --theme-accent-hover:      rgba(123, 224, 123, 0.18);

    /* ── Текст ── */
    --theme-text:              #7be07b;
    --theme-text-muted:        #2d772d;
    --theme-text-bright:       #bbf0bb;

    /* ── Фоны (тёмный режим, фикс. lightness, высокая насыщенность) ── */
    --theme-bg:                #0a1a0a;
    --theme-bg-dark:           #000000;
    --theme-bg-panel:          rgba(3, 18, 3, 0.82);
    --theme-bg-panel-dark:     rgba(2, 12, 2, 0.82);
    --theme-bg-input:          rgba(0, 0, 0, 0.45);
    --theme-bg-message:        rgba(10, 30, 10, 0.35);
    --theme-bg-message-user:   rgba(15, 45, 15, 0.48);
    --theme-bg-boot:           #020a02;
    --theme-bg-cookie:         rgba(8, 25, 8, 0.96);
    --theme-bg-btn:            #051005;
    --theme-bg-btn-hover:      #0f2f0f;

    /* ── Градиент body ── */
    --theme-body-grad-start:   #0f280f;
    --theme-body-grad-end:     #000000;

    /* ── Рамки ── */
    --theme-border:            #33aa33;
    --theme-border-dashed:     #33aa33;
    --theme-border-light:      #a0f0a0;

    /* ── Ссылки ── */
    --theme-link:              #7be07b;
    --theme-link-hover-bg:     rgba(123, 224, 123, 0.13);

    /* ── Скроллбар ── */
    --theme-scrollbar-thumb:   #33aa33;
    --theme-scrollbar-thumb-hover: #7be07b;
    --theme-scrollbar-track:   rgba(0, 0, 0, 0.2);

    /* ── Сканлайн ── */
    --theme-scanline:          rgba(123, 224, 123, 0.06);

    /* ── Оверлей CRT ── */
    --theme-overlay-bg:        rgba(0, 0, 0, 0.65);
    --theme-overlay-shadow:    #000000;

    /* ── Cookie / Boot ── */
    --theme-cookie-border:     #7be07b;
    --theme-cookie-shadow:     rgba(123, 224, 123, 0.4);
    --theme-cookie-text-border:#0f2f0f;
    --theme-boot-text:         #7be07b;

    /* ── Кнопка отклонения (Reject) ── */
    --theme-reject-border:     #ff4444;
    --theme-reject-color:      #ff6666;
    --theme-reject-hover-bg:   #330000;
    --theme-reject-hover-border:#ff5555;
    --theme-reject-hover-color:#ffaaaa;
    --theme-reject-shadow:     rgba(255, 68, 68, 0.4);

    /* ── Статус ONLINE ── */
    --theme-status-online:     #a0f0a0;

    /* ── Прочее ── */
    --theme-error:             #ff4040;
    --theme-selection:         rgba(123, 224, 123, 0.3);
    --theme-input-focus-glow:  rgba(160, 240, 160, 0.25);

    /* ── CRT ── */
    --crt-flicker-speed:       5s;
    --crt-text-glow-opacity:   0.7;

    /* ── Переходы ── */
    --theme-transition:        0.35s ease;
}

/* Глобальный плавный переход всех цветов при смене темы */
body, body *, body *::before, body *::after {
    transition: background-color var(--theme-transition),
                color var(--theme-transition),
                border-color var(--theme-transition),
                box-shadow var(--theme-transition),
                text-shadow var(--theme-transition),
                fill var(--theme-transition),
                stroke var(--theme-transition);
}
/* Исключаем range — иначе слайдер дёргается */
input[type="range"], input[type="range"]::-webkit-slider-thumb {
    transition: none !important;
}

:where(button, a, input, textarea):focus-visible {
    outline: 2px solid var(--theme-border-light);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    body, body *, body *::before, body *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

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

body {
    background: var(--theme-bg-dark);
    color: var(--theme-text);
    font-family: var(--theme-font-family);
    font-weight: 300;
    font-size: 1.5rem;
    line-height: 1.4;
    height: 100vh;
    overflow: hidden;
    image-rendering: pixelated;
    background: radial-gradient(circle at center, var(--theme-body-grad-start) 0%, var(--theme-body-grad-end) 82%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(to bottom, transparent 0, var(--theme-scanline) 1px, transparent 3px);
    pointer-events: none;
    z-index: 9999;
    animation: scan var(--crt-flicker-speed, 10s) linear infinite;
}

@keyframes scan {
    to { transform: translateY(100%); }
}

.crt-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% 50%, transparent 38%, var(--theme-overlay-bg) 100%);
    box-shadow: inset 0 0 100px var(--theme-overlay-shadow);
    z-index: 9998;
}

#main-content {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem;
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.2rem;
    max-width: 1280px;
    margin: 0 auto;
}

header {
    border-bottom: 1px solid var(--theme-accent-dim);
    padding-bottom: 0.6rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

header h1 {
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    animation: glitch 5s infinite;
    text-shadow: 0 0 calc(5px * var(--crt-text-glow-opacity, 0.7)) var(--theme-accent-dim);
}

header p {
    color: var(--theme-text-muted);
    font-size: 1.3rem;
}

.main {
    flex: 1;
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 1.4rem;
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

.chat-container {
    display: flex;
    flex-direction: column;
    background: var(--theme-bg-panel);
    border: 1px solid var(--theme-accent-dim);
    box-shadow: 0 0 16px var(--theme-accent-shadow);
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

.messages {
    flex: 1;
    overflow-y: scroll;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    scrollbar-width: thin;
    scrollbar-color: var(--theme-scrollbar-thumb) var(--theme-scrollbar-track);
    scrollbar-gutter: stable;
    min-height: 0;
}

.messages > :first-child {
    margin-top: auto;
}

.messages::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
#theme-modal::-webkit-scrollbar {
    width: 5px;
}
.messages::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
#theme-modal::-webkit-scrollbar-track {
    background: var(--theme-scrollbar-track);
}
.messages::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
#theme-modal::-webkit-scrollbar-thumb {
    background: var(--theme-scrollbar-thumb);
    border-radius: 2px;
}
.messages::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
#theme-modal::-webkit-scrollbar-thumb:hover {
    background: var(--theme-scrollbar-thumb-hover);
}

.input-area {
    display: flex;
    border-top: 1px solid var(--theme-accent-dim);
    padding: 0.8rem 1rem;
    background: var(--theme-bg-panel-dark);
    gap: 0.5rem;
    flex-shrink: 0;
}

#question-input {
    flex: 1;
    background: var(--theme-bg-input);
    border: 1px solid var(--theme-accent-dim);
    color: inherit;
    font-family: var(--theme-font-family);
    font-weight: 300;
    font-size: 1.5rem;
    padding: 0.55rem 0.9rem;
    outline: none;
}

#question-input:focus {
    border-color: var(--theme-border-light);
    box-shadow: 0 0 7px var(--theme-input-focus-glow);
}

#question-input::placeholder {
    font-family: var(--theme-font-family);
    font-weight: 300;
    color: var(--theme-text-muted);
    opacity: 0.85;
}

#send-btn {
    background: transparent;
    border: 1px solid var(--theme-accent-dim);
    color: inherit;
    font-family: var(--theme-font-family);
    font-weight: 300;
    font-size: 1.5rem;
    padding: 0.55rem 1.2rem;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.14s;
}

#send-btn:hover {
    background: var(--theme-accent-dim);
    color: var(--theme-bg-dark);
    box-shadow: 0 0 12px var(--theme-accent);
}

/* Сообщения */
.message {
    animation: appear 0.35s forwards;
    padding: 0.45rem 0.9rem;
    border-left: 3px solid transparent;
    background: var(--theme-bg-message);
    max-width: 86%;
    word-break: break-word;
    opacity: 0;
}

.message.user {
    border-left-color: var(--theme-border-light);
    background: var(--theme-bg-message-user);
    align-self: flex-end;
    border-radius: 3px 0 0 3px;
    font-family: var(--theme-font-family);
    font-weight: 300;
}

.message.bot {
    border-left-color: var(--theme-accent);
    align-self: flex-start;
    border-radius: 0 3px 3px 0;
    font-family: var(--theme-font-family);
    font-weight: 300;
}

.source {
    font-size: 1rem;
    color: var(--theme-text-muted);
    opacity: 0.85;
}

@keyframes appear {
    to { opacity: 1; transform: translateY(0); }
}

/* Sidebar */
.sidebar {
    background: var(--theme-bg-panel);
    border: 1px solid var(--theme-accent-dim);
    padding: 1rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--theme-scrollbar-thumb) var(--theme-scrollbar-track);
    scrollbar-gutter: stable;
    box-shadow: 0 0 16px var(--theme-accent-shadow);
    height: 100%;
    min-height: 0;
}

.sidebar-section {
    font-family: var(--theme-font-family);
    font-weight: 300;
}

.sidebar h2 {
    font-size: 1.5rem;
    color: var(--theme-accent-soft);
    margin-bottom: 0.6rem;
    text-shadow: 0 0 5px var(--theme-accent-glow);
    border-bottom: 1px dashed var(--theme-accent-dim);
    padding-bottom: 0.3rem;
}

.sidebar h3 {
    font-size: 1.3rem;
    color: var(--theme-accent-soft);
    margin: 1.2rem 0 0.5rem;
}

.prompt-editor {
    width: 100%;
    min-height: 100px;
    background: var(--theme-bg-dark);
    color: inherit;
    border: 1px solid var(--theme-accent-dim);
    font-family: inherit;
    font-size: 1.3rem;
    padding: 0.7rem;
    resize: vertical;
}

.save-prompt-btn, .action-btn {
    width: 100%;
    margin-top: 0.5rem;
    background: transparent;
    border: 1px solid var(--theme-accent-dim);
    color: inherit;
    padding: 0.55rem;
    font-size: 1.3rem;
    cursor: pointer;
    font-family: var(--theme-font-family);
    font-weight: 300;
}

.save-prompt-btn:hover, .action-btn:hover {
    background: var(--theme-accent-hover);
}

/* === КНОПКА-БУРГЕР === */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1px;
    background: transparent;
    border: 1px solid var(--theme-accent-dim);
    cursor: pointer;
    padding: 15px 10px;
    transition: 0.15s;
}

.hamburger:hover {
    background: var(--theme-accent-hover);
    border-color: var(--theme-accent);
}

.hamburger span {
    display: block;
    width: 10px;
    height: 2px;
    background: var(--theme-accent);
    border-radius: 1px;
    transition: 0.25s ease;
}

/* Анимация превращения в крестик */
.hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
    opacity: 0;
}
.hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 900px) {
    body {
        font-size: 1.2rem;
        overflow: hidden;
    }

    header {
        border-bottom: 0px;
    }

    header h1 {
        font-size: 1rem;
        padding-top: 0.5rem;
    }

    header p {
        font-size: 0.6rem;
    }

    .main {
        display: block;
        height: 100%;
    }


    .chat-container {
        display: flex;
        height: calc(100vh - 140px);
        max-height: calc(100vh - 140px);
        min-height: 0;
        margin: 0;
        border-radius: 0;
        overflow: hidden;
    }

    .messages {
        flex: 1;
        min-height: 0;
        overflow-y: scroll;
        padding: 0.8rem;
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
        scrollbar-width: thin;
        scrollbar-color: var(--theme-scrollbar-thumb) var(--theme-scrollbar-track);
    }

    .messages > :first-child {
        margin-top: auto;
    }

    .message {
        max-width: 92%;
        padding: 0.4rem 0.6rem;
        font-size: 1.2rem;
    }

    .source {
        font-size: 0.6rem;
        opacity: 0.85;
    }

    .input-area {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.5rem;
        background: var(--theme-bg-panel-dark);
        border-top: 1px solid var(--theme-accent-dim);
        bottom: 0;
        z-index: 10;
    }
    
    #question-input {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 1rem;
        padding: 0.5rem 0.7rem;
        line-height: 1.35;
        min-height: 38px;
        max-height: 120px;
        resize: vertical;
        overflow-y: auto;
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    #send-btn {
        font-size: 0.8rem;
        font-family: var(--theme-font-family);
        font-weight: 300;
        padding: 0.7rem 0.3rem;
    }

    .hamburger {
        display: flex;
        position: absolute;
        top: 0.8rem;
        right: 1rem;
        z-index: 12;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 80%;
        max-width: 200px;
        height: 100vh;
        z-index: 99;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        border-right: none;
        border-top: none;
        border-bottom: none;
        padding: 1.2rem;
    }

    .sidebar.visible {
        transform: translateX(0);
    }

    .sidebar h2 {
        font-size: 1.2rem;
    }

    .sidebar h3 {
        font-size: 1.05rem;
    }

    .prompt-editor {
        font-size: 1rem;
        min-height: 80px;
    }

    .save-prompt-btn, .action-btn {
        font-size: 1.05rem;
        padding: 0.5rem;
    }
}

/* Затемняющий оверлей под сайдбаром на мобилках */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 98;
}

.sidebar-overlay.visible {
    display: block;
}

/* Ссылка конфиденциальности */

p a {
  color: var(--theme-link);
  font-size: 1.5rem;
  text-decoration: none;
  border-bottom: 1px dashed var(--theme-border-dashed);
  transition: all 0.15s ease;
  display: inline-block;
  padding: 0 0.2rem;
  margin-top: 0.5rem;
}

p a:hover {
  border-bottom-color: var(--theme-link);
  text-shadow: 0 0 8px var(--theme-link);
  background: var(--theme-link-hover-bg);
  transform: translateY(-1px);
}

p a:active {
  transform: translateY(1px);
}

p div[style] {
  margin-bottom: 0.5rem;
}

/* Уведомление о куки */
.cookie-notice {
    position: fixed;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 620px;
    background: var(--theme-bg-cookie);
    border: 2px solid var(--theme-cookie-border);
    padding: 1.2rem 1.4rem;
    box-shadow: 0 0 25px var(--theme-cookie-shadow);
    z-index: 10001;
    text-align: center;
}

#cookie-text {
  font-family: var(--theme-font-family);
  font-size: 1.15rem;
  line-height: 1.45;
  color: var(--theme-cookie-border);
  white-space: pre-wrap;
  text-align: left;
  margin-bottom: 1.2rem;
  border-bottom: 1px dashed var(--theme-cookie-text-border);
  padding-bottom: 1rem;
}
.cookie-notice a {
  color: var(--theme-cookie-border);
  text-decoration: none;
  border-bottom: 1px dashed var(--theme-border-dashed);
  transition: all 0.15s ease;
  display: inline-block;
  padding: 0 0.2rem;
}

.cookie-notice a:hover {
  border-bottom-color: var(--theme-cookie-border);
  text-shadow: 0 0 8px var(--theme-cookie-border);
  background: var(--theme-link-hover-bg);
  transform: translateY(-1px);
}

.cookie-notice a:active {
  transform: translateY(1px);
}

.cookie-buttons {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.mobile-status-bar {
    display: none;
}

@media (max-width: 900px) {
    .mobile-status-bar {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.25rem;
        position: absolute;
        top: 0.8rem;
        right: 1rem;
        z-index: 10;
    }

    .status-column {
        display: flex;
        padding-top: 0.5rem;
        align-items: center;
        gap: 0.4rem;
        color: var(--theme-status-online);
        font-size: 1rem;
        font-weight: bold;
        text-shadow: 0 0 4px var(--theme-accent-glow);
        white-space: nowrap;
    }

    .status-text {
        opacity: 0.85;
        font-size: 0.7rem;
    }

    .status-value {
        color: var(--theme-border-light);
        font-size: 0.7rem;
    }

    .action-btn {
        width: 90%;
        margin-top: 0.1rem;
        background: transparent;
        border: 1px solid var(--theme-accent-dim);
        color: inherit;
        padding: 0.1rem;
        font-family: var(--theme-font-family);
        font-weight: 300;
        font-size: 0.7rem;
        cursor: pointer;
    }
    .cookie-buttons {gap: 0.5rem;}
    .cookie-notice pre {font-size: 1rem;}

    p a {
      color: var(--theme-link);
      font-size: 0.8rem;
      text-decoration: none;
      border-bottom: 1px dashed var(--theme-border-dashed);
      transition: all 0.15s ease;
      display: inline-block;
      padding: 0 0.1rem;
      margin-top: 0.1rem;
    }
    p a:hover {
      border-bottom-color: var(--theme-link);
      text-shadow: 0 0 6px var(--theme-link);
      background: var(--theme-link-hover-bg);
      transform: translateY(-1px);
    }
    p a:active {
      transform: translateY(1px);
    }
    p div[style] {
      margin-bottom: 0.2rem;
    }
}

@media (min-width: 901px) {
    .mobile-status-bar {
        display: none !important;
    }
}

#visitors-mobile {
    color: var(--theme-border-light);
    font-weight: bold;
    text-shadow: 0 0 4px var(--theme-accent-glow);
    font-size: 0.4rem;
}

/* === BOOT & COOKIE UI === */
.hidden { display: none !important; }

#boot-screen {
    position: fixed; inset: 0; background: var(--theme-bg-boot); color: var(--theme-boot-text);
    font-family: var(--theme-font-family); font-size: 1.3rem; padding: 2rem;
    z-index: 9999; overflow-y: auto; transition: opacity 0.8s ease;
}
#boot-text { margin: 0; white-space: pre-wrap; line-height: 1.4; }
#terminal-cursor { animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Кнопки куки */
.pipboy-btn {
    background: var(--theme-bg-btn); color: var(--theme-cookie-border); border: 2px solid var(--theme-border-dashed);
    padding: 0.75rem 1.8rem; font-family: var(--theme-font-family); font-size: 1.35rem;
    cursor: pointer; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.08em;
}
.pipboy-btn:hover { background: var(--theme-bg-btn-hover); border-color: var(--theme-cookie-border); box-shadow: 0 0 20px var(--theme-cookie-border); color: var(--theme-text-bright); }
.pipboy-btn:active { transform: scale(0.95); background: var(--theme-cookie-border); color: var(--theme-bg-dark); }

.pipboy-btn.reject { border-color: var(--theme-reject-border); color: var(--theme-reject-color); }
.pipboy-btn.reject:hover { background: var(--theme-reject-hover-bg); border-color: var(--theme-reject-hover-border); color: var(--theme-reject-hover-color); box-shadow: 0 0 20px var(--theme-reject-shadow); }
.pipboy-btn.reject:active { background: var(--theme-reject-border); color: var(--theme-bg-dark); }

@media (max-width: 900px) {
    .pipboy-btn { font-size: 1rem; padding: 0.5rem 1rem; }
    #cookie-text { font-size: 0.95rem; }
}

/* ============================================================
   ACTION BUTTONS ROW — [ОЧИСТИТЬ] [ЦВЕТ]
   ============================================================ */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    white-space: nowrap;
}

#theme-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 70px;
    padding: 0.55rem 0.8rem;
    font-size: 1.3rem;
}

@media (max-width: 900px) {
    .action-buttons {
        flex-direction: column;
    }
    #theme-btn {
        width: 90%;
        margin-top: 0.1rem;
        padding: 0.1rem;
        font-size: 0.7rem;
        min-width: 0;
    }
}

/* ============================================================
   THEME MODAL — Окно выбора темы
   ============================================================ */
#theme-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

#theme-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

#theme-modal {
    background: var(--theme-bg-panel);
    border: 2px solid var(--theme-accent-dim);
    box-shadow: 0 0 30px var(--theme-accent-shadow), inset 0 0 30px rgba(0,0,0,0.4);
    padding: 1.5rem;
    width: 92%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--theme-scrollbar-thumb) var(--theme-scrollbar-track);
    scrollbar-gutter: stable;
    z-index: 10003;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

#theme-modal h2 {
    font-size: 1.7rem;
    color: var(--theme-accent-soft);
    text-shadow: 0 0 6px var(--theme-accent-glow);
    border-bottom: 1px dashed var(--theme-accent-dim);
    padding-bottom: 0.5rem;
    margin-bottom: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#theme-modal h3 {
    font-size: 1.2rem;
    color: var(--theme-text-muted);
    margin: 1rem 0 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Сетка пресетов */
.theme-preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
}

.theme-font-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.theme-preset-btn {
    background: transparent;
    border: 1px solid var(--theme-accent-dim);
    color: var(--theme-text);
    font-family: var(--theme-font-family);
    font-weight: 300;
    font-size: 1.25rem;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-preset-btn:hover {
    background: var(--theme-accent-hover);
    border-color: var(--theme-accent);
    box-shadow: 0 0 10px var(--theme-accent-glow);
}

.theme-preset-btn.selected {
    background: var(--theme-accent-hover);
    border-color: var(--theme-border-light);
    box-shadow: inset 3px 0 0 var(--theme-border-light);
}

.theme-preset-btn:active {
    background: var(--theme-accent-dim);
    color: var(--theme-bg-dark);
}

.theme-font-btn {
    background: transparent;
    border: 1px solid var(--theme-accent-dim);
    color: var(--theme-text);
    font-size: 1rem;
    padding: 0.65rem 0.8rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}

.theme-font-btn:hover {
    background: var(--theme-accent-hover);
    border-color: var(--theme-accent);
    box-shadow: 0 0 10px var(--theme-accent-glow);
}

.theme-font-btn.selected {
    background: var(--theme-accent-hover);
    border-color: var(--theme-border-light);
    box-shadow: inset 3px 0 0 var(--theme-border-light);
}

.theme-preset-btn .preset-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Кастомный цвет */
#theme-custom-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

#theme-custom-row label {
    font-size: 1.25rem;
    color: var(--theme-text-muted);
    white-space: nowrap;
}

#theme-custom-color {
    width: 44px;
    height: 34px;
    border: 1px solid var(--theme-accent-dim);
    background: transparent;
    cursor: pointer;
    padding: 2px;
}

#theme-custom-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

#theme-custom-color::-webkit-color-swatch {
    border: none;
}

/* Кнопка закрытия модалки */
#theme-modal-close {
    display: block;
    width: 100%;
    margin-top: 1.2rem;
    background: transparent;
    border: 1px solid var(--theme-accent-dim);
    color: var(--theme-text);
    font-family: var(--theme-font-family);
    font-weight: 300;
    font-size: 1.3rem;
    padding: 0.55rem;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: all 0.15s;
}

#theme-modal-close:hover {
    background: var(--theme-accent-hover);
    border-color: var(--theme-accent);
}

@media (max-width: 600px) {
    #theme-modal {
        width: 96%;
        padding: 1rem;
        max-height: 90vh;
    }
    .theme-preset-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.4rem;
    }
    .theme-preset-btn {
        font-size: 1rem;
        padding: 0.45rem 0.5rem;
    }
    .theme-font-grid {
        grid-template-columns: 1fr;
    }
    #theme-modal h2 {
        font-size: 1.3rem;
    }
}

/* ============================================================
   STATUS INDICATORS
   ============================================================ */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 6px;
    vertical-align: baseline;
}

.status-online {
    background: var(--theme-status-online);
    box-shadow: 0 0 6px var(--theme-status-online);
    animation: pulse 2s infinite;
}

.status-offline {
    background: var(--theme-error);
    box-shadow: 0 0 6px var(--theme-error);
}

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

/* ============================================================
   ВЫДЕЛЕНИЕ ТЕКСТА (Selection)
   ============================================================ */
::selection {
    background: var(--theme-selection);
    color: var(--theme-text-bright);
}

::-moz-selection {
    background: var(--theme-selection);
    color: var(--theme-text-bright);
}

/* ============================================================
   MODE TOGGLE (Dark / Light radio)
   ============================================================ */
.theme-mode-row {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.theme-mode-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--theme-accent-dim);
    cursor: pointer;
    font-family: var(--theme-font-family);
    font-weight: 300;
    font-size: 1.25rem;
    color: var(--theme-text-muted);
    transition: all 0.15s ease;
    user-select: none;
}

.theme-mode-label:hover {
    border-color: var(--theme-accent);
    color: var(--theme-text);
    background: var(--theme-accent-hover);
}

.theme-mode-label input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border: 1px solid var(--theme-accent-dim);
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-mode-label input[type="radio"]:checked {
    border-color: var(--theme-accent);
    background: var(--theme-accent);
    box-shadow: 0 0 6px var(--theme-accent-glow);
}

.theme-mode-label:has(input:checked) {
    border-color: var(--theme-accent);
    color: var(--theme-text);
}

.mode-indicator {
    font-size: 1.1rem;
}

/* ============================================================
   CRT INTENSITY SLIDER
   ============================================================ */
.crt-slider-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.crt-slider-label {
    font-size: 1.15rem;
    color: var(--theme-text-muted);
    white-space: nowrap;
    font-family: var(--theme-font-family);
    font-weight: 300;
}

#crt-intensity-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    min-width: 100px;
    height: 8px;
    background: var(--theme-bg-input);
    border: 1px solid var(--theme-accent-dim);
    outline: none;
    cursor: pointer;
}

#crt-intensity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--theme-accent);
    border: 1px solid var(--theme-accent-dim);
    cursor: pointer;
    box-shadow: 0 0 6px var(--theme-accent-glow);
}

#crt-intensity-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--theme-accent);
    border: 1px solid var(--theme-accent-dim);
    cursor: pointer;
    box-shadow: 0 0 6px var(--theme-accent-glow);
}

.crt-value {
    font-size: 1.1rem;
    color: var(--theme-accent);
    min-width: 60px;
    text-align: right;
    font-family: var(--theme-font-family);
    font-weight: 300;
}

/* ============================================================
   МЕЛКИЕ ДОПОЛНЕНИЯ ДЛЯ МОДАЛКИ
   ============================================================ */
#theme-modal h3 {
    font-size: 1.15rem;
    color: var(--theme-text-muted);
    margin: 1rem 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px dashed var(--theme-accent-dim);
    padding-bottom: 0.25rem;
}

@media (max-width: 600px) {
    .theme-mode-label {
        font-size: 1rem;
        padding: 0.35rem 0.7rem;
    }
    .crt-slider-label {
        font-size: 0.95rem;
    }
    .crt-value {
        font-size: 0.95rem;
        min-width: 50px;
    }
    #theme-modal h3 {
        font-size: 1rem;
    }
}
