/* Подключаем шрифт для LED таймера */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

:root {
    --primary: #c41e3a;
    --primary-hover: #a01830;
    --bg-dark: #121212;
    --card-bg: rgba(30, 30, 35, 0.96);
    --text-main: #ffffff;
    --text-muted: #888888;
    --input-bg: #1f1f1f;
    --border-color: #333;
    --telegram-blue: #0088cc;
    --success: #28a745;
    --warning: #ffc107;
}

body {
    background: url('https://showbackstage.ru/media/1.jpg') repeat-x center center fixed;
    background-size: auto 100%;
    animation: scrollBg 80s linear infinite;
    color: var(--text-main); 
    position: relative;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body::before { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: -1; }
@keyframes scrollBg { from { background-position-x: 0; } to { background-position-x: -100%; } }

/* Идеальное центрирование через CSS Grid (3 колонки) */
.generator-wrapper { 
    display: grid; 
    grid-template-columns: 1fr minmax(auto, 800px) 1fr; 
    align-items: start;
    padding: 40px 20px; 
    min-height: 100vh; 
    gap: 30px;
    max-width: 1600px;
    margin: 0 auto;
}

.main-column {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 800px;
}

.generator-container {
    background: var(--card-bg); padding: 40px; border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9); width: 100%;
    border: 1px solid var(--border-color); border-top: 3px solid var(--primary);
    position: relative; margin-bottom: 40px; box-sizing: border-box;
}
.generator-container h2 {
    font-size: 20px; color: #fff; margin: 0 0 25px; text-transform: uppercase; 
    letter-spacing: 1px; text-align: center; border-bottom: 1px solid #333; padding-bottom: 15px;
}

/* --- Стили для Блока Поддержки (Слева) --- */
.support-wrapper {
    width: 100%;
    max-width: 450px;
    justify-self: start; /* Прижимаем к левому краю */
    position: sticky;
    top: 40px;
}

.support-container {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9);
    width: 100%;
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--success); /* Зеленая полоса */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    text-align: center;
}
.support-container h2 {
    font-size: 18px; color: #fff; margin: 0 0 15px; text-transform: uppercase;
    letter-spacing: 1px; border-bottom: 1px solid #333; padding-bottom: 15px;
}
.support-text {
    color: #d1d1d1;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: left;
}
.support-qr {
    width: 100%;
    max-width: 180px;
    margin: 0 auto 20px;
    border-radius: 8px;
    border: 4px solid #fff;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: block;
}
.btn-donate {
    background: var(--success);
    color: white;
    text-decoration: none;
    padding: 14px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: 0.2s;
    margin-bottom: 15px; /* Отступ снизу для крипто-кнопки */
}
.btn-donate:hover { background: #218838; box-shadow: 0 0 15px rgba(40, 167, 69, 0.4); }
.btn-donate svg { width: 20px; height: 20px; fill: currentColor; }

.cc-payment-button-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* --- Стили для Чейнджлога (Справа) --- */
.changelog-wrapper {
    width: 100%;
    max-width: 450px;
    justify-self: end; /* Прижимаем к правому краю */
    position: sticky;
    top: 40px;
}

.changelog-container {
    background: var(--card-bg);
    padding: 30px 20px 30px 30px;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9);
    width: 100%;
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--telegram-blue);
    height: 650px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}
.changelog-container h2 {
    font-size: 18px; color: #fff; margin: 0 0 20px; text-transform: uppercase;
    letter-spacing: 1px; text-align: center; border-bottom: 1px solid #333; padding-bottom: 15px;
}
.changelog-content {
    flex: 1;
    overflow-y: auto;
    color: #d1d1d1;
    font-size: 13px;
    line-height: 1.6;
    padding-right: 15px;
}
.changelog-content::-webkit-scrollbar { width: 6px; }
.changelog-content::-webkit-scrollbar-track { background: #111; border-radius: 4px; }
.changelog-content::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
.changelog-content::-webkit-scrollbar-thumb:hover { background: var(--telegram-blue); }

.changelog-content h3 { color: #fff; font-size: 14px; margin-top: 20px; margin-bottom: 10px; border-left: 3px solid var(--telegram-blue); padding-left: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.changelog-content p { margin-bottom: 12px; }
.changelog-content strong { color: #fff; font-weight: 600; }

@media (max-width: 1200px) {
    .generator-wrapper { display: flex; flex-direction: column; align-items: center; }
    .main-column { order: 1; }
    .support-wrapper { order: 2; justify-self: center; position: static; max-width: 800px; margin-top: 10px; }
    .changelog-wrapper { order: 3; justify-self: center; position: static; max-width: 800px; margin-top: 20px; }
    .changelog-container { height: 500px; }
}

/* --------------------------- */
.info-box {
    background: rgba(0, 136, 204, 0.1); border: 1px solid var(--telegram-blue);
    border-left: 4px solid var(--telegram-blue); padding: 15px 20px;
    margin-bottom: 25px; border-radius: 4px; font-size: 13px; color: #d1d1d1; line-height: 1.6;
}
.info-box a { color: #4da6ff; text-decoration: none; font-weight: bold; }
.info-box a:hover { color: #fff; text-decoration: underline; }

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { font-size: 11px; color: #aaa; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.form-group select, .form-group input[type="file"] {
    width: 100%; padding: 12px; border-radius: 4px; border: 1px solid #333;
    background: var(--input-bg); color: #fff; font-size: 14px; box-sizing: border-box; transition: .3s;
}
.form-group select:focus, .form-group input[type="file"]:focus { border-color: var(--primary); outline: none; background: #2a2a2a; }

.upload-hint {
    font-size: 12px;
    color: #aaa;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 15px;
    border-radius: 4px;
    border-left: 3px solid var(--primary);
    margin-bottom: 12px;
    line-height: 1.5;
}
.upload-hint strong { color: #fff; font-weight: 600; }

.btn-reg {
    width: 100%; padding: 14px; border: none; border-radius: 4px;
    font-size: 13px; font-weight: 700; cursor: pointer; text-transform: uppercase; letter-spacing: 1px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--primary); color: #fff; transition: all 0.2s;
}
.btn-reg:hover:not(:disabled) { background: var(--primary-hover); }
.btn-reg svg { width: 18px; height: 18px; fill: currentColor; }

#loading { display: none; text-align: center; margin-top: 25px; color: var(--text-muted); font-size: 13px; }
.spinner { border: 3px solid #333; border-top: 3px solid var(--primary); border-radius: 50%; width: 30px; height: 30px; animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Очередь и Подписка */
#queue-overlay, #sub-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.92); z-index: 10001; justify-content: center; align-items: center;
}
.queue-box, .sub-content {
    background: #1a1a1a; padding: 30px; border-radius: 12px; text-align: center;
    border: 1px solid #444; max-width: 400px; width: 90%; box-shadow: 0 0 30px rgba(0,0,0,0.5);
}
.sub-content { border-color: var(--telegram-blue); box-shadow: 0 0 30px rgba(0, 136, 204, 0.2); }
.sub-timer { font-size: 32px; font-weight: bold; color: var(--primary); margin: 20px 0; }
.btn-sub-close { background: #333; color: #777; border: none; padding: 12px 30px; border-radius: 5px; font-size: 14px; width: 100%; font-weight: bold; text-transform: uppercase; transition: 0.3s; }
.btn-sub-close.active { background: var(--telegram-blue); color: #fff; cursor: pointer; }
.btn-sub-close.active:hover { background: #0077b3; }

/* === НОВОЕ ОБЪЕДИНЕННОЕ ОКНО РЕЗУЛЬТАТА === */
#result-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 9999; overflow-y: auto; padding: 20px; box-sizing: border-box; }
#result-content-wrapper { display: flex; justify-content: center; min-height: 100%; padding-bottom: 50px; align-items: flex-start; margin-top: 20px;}

.fixture-card {
    background: #1a1a1f; border: 1px solid #444; border-top: 3px solid var(--primary);
    border-radius: 12px; width: 100%; max-width: 1000px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.8); position: relative; display: flex; flex-direction: column;
}
.close-result { position: absolute; top: 15px; right: 20px; color: #fff; font-size: 28px; cursor: pointer; z-index: 10; opacity: 0.7; transition: 0.2s; }
.close-result:hover { opacity: 1; color: var(--primary); }

.fc-header { padding: 25px 30px; border-bottom: 1px solid #333; display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.02); }
.fc-header h2 { margin: 0; font-size: 22px; color: #fff; }
.fc-header .brand { color: var(--primary); font-size: 13px; text-transform: uppercase; font-weight: bold; display: block; margin-bottom: 5px; }

.fc-body { display: grid; grid-template-columns: 35% 65%; gap: 30px; padding: 30px; }
@media (max-width: 800px) { .fc-body { grid-template-columns: 1fr; } }

.fc-params { max-height: 65vh; overflow-y: auto; padding-right: 15px; }
.fc-params::-webkit-scrollbar { width: 6px; }
.fc-params::-webkit-scrollbar-track { background: #111; border-radius: 4px; }
.fc-params::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }

.fc-params h3 { margin-top: 0; font-size: 16px; border-left: 3px solid var(--telegram-blue); padding-left: 10px; color: #fff; text-transform: uppercase; }
.preset-box { background: #222228; border-radius: 8px; padding: 15px; border: 1px solid #333; margin-bottom: 15px; }
.preset-box h4 { margin: 0 0 10px 0; color: #aaa; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

.color-list { display: flex; flex-wrap: wrap; gap: 8px; }
.color-item { display: flex; align-items: center; background: #15151a; padding: 4px 10px; border-radius: 20px; font-size: 11px; border: 1px solid #333; color: #ccc; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.macro-list { list-style: none; padding: 0; margin: 0; }
.macro-list li { font-size: 12px; padding: 5px 0; border-bottom: 1px dashed #333; color: #ccc; display: flex; justify-content: space-between; }
.macro-list li:last-child { border-bottom: none; }

.fc-patch { display: flex; flex-direction: column; height: 100%; }
.mode-selector { margin-bottom: 15px; display: flex; align-items: center; gap: 15px; }
.mode-selector select { flex: 1; padding: 10px; background: #111; border: 1px solid #444; color: #fff; border-radius: 4px; font-size: 14px; }

.patch-table-container { flex: 1; max-height: 60vh; overflow-y: auto; border: 1px solid #333; border-radius: 6px; background: #111; margin-bottom: 20px; }
.patch-table-container::-webkit-scrollbar { width: 6px; }
.patch-table-container::-webkit-scrollbar-track { background: #111; }
.patch-table-container::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
.patch-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.patch-table th { position: sticky; top: 0; background: #222; color: #aaa; text-align: left; padding: 10px; border-bottom: 2px solid #444; z-index: 2; }
.patch-table td { padding: 10px 10px; border-bottom: 1px solid #2a2a2a; color: #ddd; vertical-align: top; }
.patch-table tr:hover { background: rgba(196, 30, 58, 0.1); }
.badge-attr { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: bold; background: #333; color: #aaa; border: 1px solid #444; }

.channel-sets-container { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.set-badge { background: #1a1a24; border: 1px solid #333; border-radius: 4px; font-size: 10px; padding: 3px 6px; color: #aaa; line-height: 1.2; display: flex; align-items: center; }
.set-badge strong { color: #fff; margin-right: 4px; font-weight: 600; }
.set-icon { margin-right: 3px; font-size: 10px; }

.dl-actions { background: rgba(255,255,255,0.03); padding: 15px; border-radius: 8px; border: 1px solid #333; text-align: center; }
.dl-actions p { margin: 0 0 15px 0; font-size: 12px; color: #888; }
.btn-confirm { background: var(--success); color: white; border: none; font-weight: bold; padding: 12px 20px; border-radius: 4px; cursor: pointer; transition: 0.2s; text-transform: uppercase; font-size: 13px; }
.btn-confirm:hover { background: #218838; }
.btn-orange { background: var(--warning); color: #000; }
.btn-orange:hover { background: #e0a800; }

/* === НОВЫЕ СТИЛИ ДЛЯ РЕЙТИНГА И ССЫЛКИ === */
.feedback-section { margin-top: 20px; background: rgba(0,0,0,0.3); padding: 15px; border-radius: 6px; border: 1px dashed #444; }
.stars-container { display: flex; justify-content: center; gap: 10px; margin-bottom: 15px; }
.star-item { font-size: 30px; color: #555; cursor: pointer; transition: 0.2s; user-select: none; }
.star-item:hover, .star-item.active { color: var(--warning); text-shadow: 0 0 10px rgba(255, 193, 7, 0.5); }
.feedback-textarea { width: 100%; background: #111; border: 1px solid #444; color: #fff; padding: 10px; border-radius: 4px; resize: vertical; min-height: 70px; margin-bottom: 10px; box-sizing: border-box; font-family: inherit; font-size: 13px; }
.feedback-textarea:focus { outline: none; border-color: var(--telegram-blue); }

.share-box { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.share-input { flex: 1; background: #111; border: 1px solid #444; color: #aaa; padding: 6px 10px; border-radius: 4px; font-size: 11px; cursor: text; }
.share-input:focus { outline: none; border-color: var(--telegram-blue); color: #fff; }

/* === СТИЛИ ДЛЯ ИНФО БЛОКА И ТАЙМЕРА LED === */
.recent-section { width: 100%; box-sizing: border-box; }
.recent-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 15px; }
.recent-header-flex h3 { font-size: 16px; color: #fff; text-transform: uppercase; margin: 0; border-left: 3px solid var(--primary); padding-left: 10px; }

.led-timer-box {
    background: #050505;
    border: 2px solid #222;
    border-radius: 6px;
    padding: 8px 18px;
    box-shadow: inset 0px 3px 10px rgba(0, 0, 0, 1), 0 5px 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    border-top: 1px solid #444;
    border-bottom: 1px solid #111;
}
.led-timer-title {
    color: #666;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    font-family: 'Segoe UI', sans-serif;
    font-weight: bold;
}
.led-timer-display {
    font-family: 'Share Tech Mono', 'Courier New', Courier, monospace;
    font-size: 38px;
    color: #ff1a1a;
    text-shadow: 0 0 5px #ff1a1a, 0 0 10px #ff0000, 0 0 20px #cc0000;
    letter-spacing: 2px;
    line-height: 1;
}
/* === 3D ВИЗУАЛИЗАТОР ВНУТРИ ПАТЧА === */
.table-and-3d-wrapper {
    display: flex;
    gap: 20px;
    align-items: stretch; /* Растягиваем 3D блок по высоте таблицы */
    margin-bottom: 20px;
    flex: 1;
    min-height: 0; /* Важно для скролла таблицы внутри flex-контейнера */
}

/* Переопределяем margin у таблицы, т.к. margin теперь у обертки */
.patch-table-container {
    margin-bottom: 0 !important;
}

.fixture-3d-view {
    width: 250px; /* Ширина 3D окна */
    flex-shrink: 0;
    background: radial-gradient(circle, rgba(0, 136, 204, 0.08) 0%, rgba(0,0,0,0.2) 80%);
    border: 1px solid #333;
    border-radius: 8px;
    position: relative;
    cursor: grab; /* Иконка "схватить" для вращения */
    overflow: hidden;
}

.fixture-3d-view:active {
    cursor: grabbing;
}

/* Мобильная адаптация: переносим 3D блок над или под таблицу */
@media (max-width: 900px) {
    .table-and-3d-wrapper {
        flex-direction: column;
    }
    .fixture-3d-view {
        width: 100%;
        height: 250px;
    }
}
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 15px; }
.recent-card { background: rgba(30, 30, 35, 0.8); border: 1px solid #333; border-radius: 6px; padding: 15px; cursor: pointer; transition: 0.2s all; position: relative; }
.recent-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(196, 30, 58, 0.2); }
.recent-card .mfg { color: var(--text-muted); font-size: 11px; text-transform: uppercase; font-weight: bold; }
.recent-card .model { color: #fff; font-size: 14px; font-weight: bold; margin: 5px 0; }
.recent-card .type { color: #666; font-size: 12px; }
.recent-card .date { position: absolute; top: 10px; right: 10px; font-size: 10px; color: #444; }
.recent-card .info-footer { margin-top: 10px; font-size: 11px; color: #aaa; border-top: 1px solid #333; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; }