/* ==========================================================================
   1. СБРОС, БАЗОВЫЕ СТИЛИ И КАСТОМНЫЕ СКРОЛЛБАРЫ
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: #09090b;
    color: #e4e4e7;
    overflow-x: hidden;
}

/* Глобальное масштабирование всего интерфейса на ~25% */
.container {
    display: flex;
    height: calc(100vh - 24px);
    gap: 16px;
    padding: 12px;
    font-size: 125%; 
}

/* Стилизация скроллбаров под общий темный дизайн */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #09090b;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #27272a;
    border: 1px solid #18181b;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
    border-color: #27272a;
}

/* Для Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #27272a #09090b;
}

/* ==========================================================================
   2. СЕТКА ИНТЕРФЕЙСА (LAYOUT)
   ========================================================================== */
.left {
    width: 420px;
    min-width: 420px;
    background: #121214;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 14px 14px 0 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.center {
    flex: 2;
    background: #121214;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
}

.right {
    width: 340px;
    min-width: 340px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #121214;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 12px;
}

/* ==========================================================================
   3. ИГРОВЫЕ СТРЕЛКИ И ДЕРЕВО КАТЕГОРИЙ + ЧЕКБОКСЫ
   ========================================================================== */
#skillsList {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.class-header,
.subclass-header {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    padding: 8px 10px;
    border-radius: 4px;
    transition: background 0.2s;
}

.class-header {
    background: #18181b;
    margin-top: 8px;
    font-size: 0.85em;
    font-weight: bold;
    color: #fff;
    border: 1px solid #27272a;
}
.class-header:hover { background: #202024; }

.subclass-header {
    padding-left: 20px;
    font-size: 0.75em;
    color: #a1a1aa;
}
.subclass-header:hover { color: #fff; }

.arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #71717a;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.arrow:not(.collapsed-arrow) {
    transform: rotate(0deg);
}
.collapsed-arrow {
    transform: rotate(-90deg);
}

.class-content.collapsed,
.subclass-content.collapsed {
    display: none;
}

.class-header img,
.subclass-header img,
.menu-subclass-icon-fallback,
.menu-subclass-sprite {
    width: 32px !important;
    height: 32px !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
}

.menu-subclass-sprite {
    background-image: url('/img/skills_atlas.png');
    background-size: 2048px auto;
    background-repeat: no-repeat;
    border-radius: 4px;
}

.menu-subclass-placeholder {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

/* Элемент списка умений */
.skill-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 10px 6px 36px;
    cursor: pointer;
    border-bottom: 1px solid #18181b;
}
.skill-item:hover {
    background: #18181b;
}

.skill-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.skill-name {
    font-size: 0.75em;
    color: #d4d4d8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.skill-item:hover .skill-name {
    color: #fff;
}

.skill-item .skill-id-badge {
    flex-shrink: 0;
}

/* КРАСИВЫЙ ТЕМНО-КРАСНЫЙ ЧЕКБОКС */
.custom-checkbox {
    display: inline-block;
    position: relative;
    width: 18px;
    height: 18px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: #09090b;
    border: 1px solid #3f3f46;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.custom-checkbox:hover input ~ .checkmark {
    border-color: #52525b;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.1);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: #991b1b;
    border-color: #b91c1c;
    box-shadow: 0 0 6px rgba(185, 28, 28, 0.4);
}

.custom-checkbox:hover input:checked ~ .checkmark {
    background-color: #b91c1c;
    border-color: #ef4444;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 5px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ==========================================================================
   4. СТИЛИ ИКОНОК АТЛАСА И ОБЁРТОК ДЛЯ МАСШТАБИРОВАНИЯ
   ========================================================================== */

.mini-icon-wrapper {
    width: 32px;
    height: 32px;
    position: relative;
    flex-shrink: 0;
    overflow: visible;
}

/* ==========================================================================
   5. КАРТОЧКА СКИЛЛА В ЦЕНТРЕ
   ========================================================================== */
#skillCardsList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px;
    width: 100%;
    transition: all 0.3s ease;
}

.card-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    color: #52525b;
    text-align: center;
    width: 100%;
    font-size: 0.9rem;
}

.dino-bg-image {
    width: 500px;
    height: 500px;
    margin-bottom: 20px;
    background-image: url('/img/dino_placeholder.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.85;
}

/* --- МОНОЛИТНЫЙ БЛОК КАРТОЧКИ (ОБЪЕДИНЕНО ДЛЯ ИСКЛЮЧЕНИЯ БАГОВ) --- */
.central-skill-card {
    background: #121214;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 14px;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    min-height: 440px;
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.central-skill-card:hover {
    border-color: #3f3f46; 
}

/* Сбрасываем возможные флекс-поведения у главных внутренних блоков */
.main-card-header, 
.main-card-desc, 
.main-card-fields-row {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    float: none !important;
}

.main-card-header {
    display: block !important; 
    margin-bottom: 12px;
}

.main-card-info-zone {
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-card-title {
    font-size: 0.95rem;
    font-weight: bold;
    color: #fff;
    min-height: 36px;
    display: flex;
    align-items: center;
}

.main-card-id {
    font-size: 0.75rem;
    color: #71717a;
    margin-top: 2px;
}

.skill-id-badge {
    font-size: 0.75rem;
    font-family: monospace;
    background: #09090b;
    color: #71717a;
    border: 1px solid #27272a;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: bold;
}

.card-delete-btn {
    background: transparent;
    border: 1px solid #3f3f46;
    color: #71717a;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}
.card-delete-btn:hover {
    border-color: #ef4444;
    background: #451a1a;
    color: #fff;
}

.main-card-desc {
    background: #09090b;
    border: 1px solid #18181b;
    border-radius: 6px;
    padding: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #e4e4e7;
    flex-grow: 1;
    margin-top: 12px !important;
    margin-bottom: 14px !important;
}

.skill-card-properties {
    color: #a1a1aa;
    margin-bottom: 6px;
}

.skill-number {
    color: #f59e0b !important;
    font-weight: bold;
}

.main-card-fields-row {
    display: flex !important; /* Возвращаем flex для нижнего блока */
    flex-direction: column !important;
    gap: 6px;
    background: #09090b;
    border: 1px solid #27272a;
    padding: 8px;
    border-radius: 6px;
    margin-top: auto;
}

.card-inline-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.card-inline-field .label {
    font-size: 0.75rem;
    color: #71717a;
    padding-left: 4px;
}

.card-inline-field input.lvl-custom-input {
    width: 100% !important;
    background: #18181b !important;
    border: 1px solid #27272a !important;
    border-radius: 4px;
    color: #fff !important;
    text-align: center;
    font-size: 0.85rem;
    font-weight: bold;
    outline: none;
    padding: 4px 0;
    margin-bottom: 4px;
}

.lvl-ctrl-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    width: 100%;
}

.lvl-btn {
    padding: 5px 0;
    font-size: 0.75rem;
    font-weight: bold;
    color: #a1a1aa;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-shadow: none;
    box-shadow: none;
}
.lvl-btn:hover {
    background: #27272a;
    color: #fff;
    border-color: #3f3f46;
}
.lvl-btn.btn-orange {
    color: #f59e0b;
}
.lvl-btn.btn-orange:hover {
    background: #f59e0b;
    color: #09090b;
    border-color: #fbbf24;
}

/* ==========================================================================
   6. ПРАВАЯ ПАНЕЛЬ И ОКЕТЫ
   ========================================================================== */
.panel-block {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-title {
    font-size: 0.75rem;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
    border-bottom: 1px solid #27272a;
    padding-bottom: 4px;
}

.selected-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #09090b;
    border: 1px solid #27272a;
    padding: 6px 8px;
    border-radius: 4px;
    gap: 6px;
}

.selected-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    flex: 1;
}

.selected-name {
    font-size: 0.8rem;
    color: #e4e4e7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-lvl-badge {
    color: #f59e0b;
    font-weight: bold;
    font-size: 0.75rem;
}

.selected-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.selected-item .remove-btn {
    background: transparent;
    border: none;
    color: #71717a;
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}
.selected-item .remove-btn:hover {
    color: #ef4444;
}

.selected-item .prog-input {
    width: 35px;
    background: #18181b;
    border: 1px solid #27272a;
    color: #fff;
    font-size: 0.75rem;
    text-align: center;
    border-radius: 3px;
    outline: none;
}

.panel-block button, 
#copyBtn {
    width: 100%;
    padding: 10px 16px;
    background: #27272a;
    border: 1px solid #3f3f46;
    color: #e4e4e7;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    box-shadow: none;
    text-shadow: none;
}
.panel-block button:hover {
    background: #3f3f46;
    color: #fff;
    border-color: #52525b;
}

#resetBtn {
    background: #451a1a !important;
    border-color: #7f1d1d !important;
    color: #fca5a5 !important;
}
#resetBtn:hover {
    background: #7f1d1d !important;
    border-color: #b91c1c !important;
    color: #fff !important;
}

.reset-full-width-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px 0;
    background: #111113;
    border: 1px solid #3f3f46;
    color: #ef4444;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.reset-full-width-btn:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* Настройки для полей ввода и вывода октетов (ОБЪЕДИНЕНО) */
#octetInput, 
#output {
    resize: none; 
    max-height: 120px; 
    overflow-y: auto; 
    word-wrap: break-word; 
    white-space: pre-wrap; 
}

#octetInput {
    width: 100%;
    background: #09090b;
    border: 1px solid #27272a;
    color: #22c55e;
    padding: 8px;
    font-family: monospace;
    font-size: 0.8rem;
    border-radius: 4px;
    outline: none;
}

#output {
    background: #09090b;
    border: 1px solid #27272a;
    padding: 10px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #e4e4e7;
    border-radius: 4px;
    min-height: 40px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}

.tg-link-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #17212b;
    color: #4dabf7;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    padding: 10px;
    margin: 0 -14px;
    border-top: 1px solid #202b36;
}
.tg-link-block:hover { background: #1e2c3a; color: #fff; }
.tg-icon { width: 16px; height: 16px; fill: currentColor; }

/* ==========================================================================
   7. ТАБЫ ПЕРЕКЛЮЧЕНИЯ СТОРОН (РАЙ / ОБЫЧН / АД) И ЭФФЕКТЫ
   ========================================================================== */
.version-switchers-container {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: #09090b;
    border: 1px solid #27272a;
    border-radius: 6px;
    padding: 2px;
    margin-top: 8px;
    box-sizing: border-box;
}

.version-btn {
    padding: 6px 0;
    font-size: 0.75rem;
    font-weight: bold;
    color: #71717a;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.version-btn:disabled {
    opacity: 0.15;
    cursor: not-allowed;
    color: #3f3f46 !important;
    background: transparent !important;
    box-shadow: none !important;
}

.version-btn.active-normal {
    background: #27272a;
    color: #fff;
}

.version-btn.active-rai {
    background: #1e3a8a;
    color: #60a5fa;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.version-btn.active-xian {
    background: #581c87;
    color: #c084fc;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
}

.version-btn:not(.active-normal):not(.active-rai):not(.active-xian):not(:disabled):hover {
    background: #18181b;
    color: #e4e4e7;
}

/* Адаптивная неоновая подсветка для Райской стороны */
.central-skill-card.card-rai {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2), inset 0 0 10px rgba(59, 130, 246, 0.05) !important;
}
.central-skill-card.card-rai:hover {
    border-color: #60a5fa !important;
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.35), inset 0 0 12px rgba(59, 130, 246, 0.1) !important;
}

/* Адаптивная неоновая подсветка для Адской стороны */
.central-skill-card.card-xian {
    border-color: #a855f7 !important;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.2), inset 0 0 10px rgba(168, 85, 247, 0.05) !important;
}
.central-skill-card.card-xian:hover {
    border-color: #c084fc !important;
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.35), inset 0 0 12px rgba(168, 85, 247, 0.1) !important;
}

/* ==========================================================================
   8. ВСПЛЫВАЮЩЕЕ УВЕДОМЛЕНИЕ (ТУЛТИП НАД КНОПКОЙ)
   ========================================================================== */
.copy-container {
    position: relative; 
}

.copy-toast {
    position: absolute;
    bottom: 100%; 
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px; 
    background: #16a34a; 
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
    opacity: 1;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap; 
}

.copy-toast.error {
    background: #ef4444; 
}

.copy-toast::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #16a34a transparent transparent transparent;
}

.copy-toast.error::after {
    border-color: #ef4444 transparent transparent transparent;
}

.copy-toast.fade-out {
    opacity: 0;
}

/* ==========================================================================
   9. АНИМАЦИИ
   ========================================================================== */
.card-appear {
    animation: smoothFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes smoothFadeIn {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(1);
        filter: brightness(0.1); 
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: brightness(1);
    }
}
/* Контейнер: убираем фиксированный gap, чтобы центр мог расширяться до самого края */
.container {
    display: flex;
    height: calc(100vh - 24px);
    padding: 12px;
    gap: 0; 
    overflow: hidden;
}

/* Расстояние между левой панелью и центром возвращаем через margin */
.left { margin-right: 12px; }

.center {
    flex: 1; /* Центр теперь гибкий */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 12px; /* Базовый отступ от правой панели */
}

.right {
    position: relative;
    width: 340px;
    min-width: 340px;
    background: #121214;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Анимируем ширину и отступы */
    transition: width 0.3s ease, min-width 0.3s ease, margin-right 0.3s ease, opacity 0.2s ease;
}

/* Кнопка-полоса во всю высоту, приклеенная к ЛЕВОМУ краю правой панели */
.right-panel-toggle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: #18181b;
    border-right: 1px solid #27272a;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.right-panel-toggle:hover {
    background: #27272a;
}

.toggle-icon {
    font-size: 14px;
    color: #71717a;
    transition: transform 0.3s ease;
}

/* СОСТОЯНИЕ СВЕРНУТО */
.right.collapsed {
    width: 20px; /* Оставляем ширину только для кнопки */
    min-width: 20px;
    margin-right: 0;
    padding: 0;
    border-radius: 8px 0 0 8px;
}

.right.collapsed .toggle-icon {
    transform: rotate(180deg);
}

/* Скрываем всё содержимое панели кроме кнопки */
.right.collapsed > *:not(.right-panel-toggle) {
    display: none;
}

/* Если панель развернута, контент не должен наползать на кнопку */
.right:not(.collapsed) {
    padding-left: 28px;
}

/* В style.css */
.class-content.collapsed, 
.subclass-content.collapsed {
    display: none;
    /* Браузер не будет рендерить содержимое, пока оно скрыто */
    content-visibility: hidden; 
}

.class-content:not(.collapsed), 
.subclass-content:not(.collapsed) {
    display: block;
    content-visibility: visible;
}

.mini-icon-wrapper {
    width: 32px;
    height: 32px;
    background: #18181b; /* Темный фон-заглушка */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.no-transition {
    transition: none !important;
}