:root {
    --bg: #0a0a0a; --card: #141414; --accent: #c41e3a;
    --survivor: #2e7d32; --killer: #c62828;
    --text: #e8e8e8; --muted: #888; --lock: #ff9800;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg); color: var(--text);
    min-height: 100vh; padding: 25px 15px 80px;
    background-image:
        radial-gradient(ellipse at top, #1a0505 0%, transparent 60%),
        radial-gradient(ellipse at bottom, #050510 0%, transparent 50%);
    letter-spacing: 0.01em;
}

/* Кнопка возврата в Хаб */
.return-hub-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #555;
    text-decoration: none;
    font-family: 'Courier New', Courier, monospace !important;
    font-size: 1rem;
    letter-spacing: 0.5px;
    transition: color 0.3s;
    z-index: 9999;
}
.return-hub-btn:hover {
    color: #f0f0f0;
}

h1 {
    font-family: 'Creepster', cursive;
    font-size: clamp(2.2rem, 5.5vw, 3.5rem);
    color: var(--accent); text-align: center;
    letter-spacing: 4px; text-shadow: 0 0 30px rgba(196,30,58,.5);
    margin-bottom: 6px;
    margin-top: 20px;
}
.subtitle { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 22px; line-height: 1.5; }
.section { max-width: 980px; margin: 0 auto 36px; }
.section-title { font-family: 'Courier New', Courier, monospace; font-size: 1.05rem; color: #bbb; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 12px; text-align: center; }

.toolbar {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
    gap: 8px; margin-bottom: 12px;
}
.toolbar .sep { width: 1px; height: 24px; background: #333; margin: 0 2px; }

/* Отцентрированный поиск */
#searchInput {
    width: 100%;
    max-width: 450px;
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid #333;
    background: #1a1a1a;
    color: #eee;
    font-size: 1rem;
    outline: none;
    font-family: 'Courier New', Courier, monospace;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#searchInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(196,30,58,0.15);
}

/* Стили для выпадающих фильтров */
.custom-select {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #333;
    background: #1a1a1a;
    color: #eee;
    font-size: .85rem;
    outline: none;
    font-family: 'Courier New', Courier, monospace;
    cursor: pointer;
    min-width: 130px;
    transition: border-color 0.2s;
}
.custom-select:focus { border-color: var(--accent); }

.inventory-container {
    background: var(--card); border: 1px solid #222; border-radius: 14px;
    max-height: 360px; overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,.6); padding: 16px;
}
.inventory { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.perk-card {
    width: 84px; text-align: center; cursor: pointer;
    transition: .18s; border-radius: 10px; padding: 6px 3px 4px;
    position: relative; user-select: none;
}
.perk-card:hover { background: rgba(255,255,255,.04); transform: translateY(-2px); z-index: 5; }
.perk-card img { width: 60px; height: 60px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.5)); pointer-events: none; }
.perk-card span.name {
    display: block; font-size: 10px; margin-top: 4px; height: 26px;
    overflow: hidden; line-height: 1.2; color: #ccc; pointer-events: none;
}

/* Визуальная деактивация (ручная и из-за коллекции) */
.perk-card.disabled, .perk-card.missing-char {
    opacity: .2; 
    filter: grayscale(1);
}

.perk-card.locked { outline: 2px solid var(--lock); background: rgba(255,152,0,.12); }
.perk-card.locked::after { content: '🔒'; position: absolute; top: 2px; right: 4px; font-size: 12px; }
.perk-card.hidden { display: none; }

.tier-badge {
    position: absolute; top: 2px; left: 4px;
    font-size: 9px; font-weight: 800; letter-spacing: .5px;
    padding: 1px 4px; border-radius: 4px; line-height: 1.2;
    pointer-events: none;
}
.tier-badge.S { background: #ffd700; color: #111; }
.tier-badge.A { background: #4caf50; color: #fff; }
.tier-badge.B { background: #1976d2; color: #fff; }
.tier-badge.C, .tier-badge.D, .tier-badge.F, .tier-badge.\? { background: #555; color: #ccc; }

#floatTip {
    display: none; position: fixed; z-index: 300;
    max-width: 300px; width: max-content;
    padding: 12px 14px;
    background: #1c1c1c; border: 1px solid #555; border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,.75);
    pointer-events: auto; text-align: left;
}
#floatTip .tt-name { font-weight: 700; font-size: .9rem; margin-bottom: 4px; color: #fff; }
#floatTip .tt-meta { font-size: .7rem; color: #aaa; margin-bottom: 8px; }
#floatTip .tt-desc { font-size: .78rem; color: #ccc; line-height: 1.4; max-height: 7.5em; overflow: hidden; }
#floatTip .tt-desc.expanded { max-height: none; }
#floatTip .tt-more {
    display: inline-block; margin-top: 8px;
    font-size: .72rem; font-weight: 700; color: var(--accent);
    cursor: pointer; text-transform: uppercase; letter-spacing: .5px;
    border: none; background: none; padding: 0;
}
#floatTip .tt-more:hover { color: #ff6b81; transform: none; }

#descModal {
    display: none; position: fixed; inset: 0; z-index: 400;
    background: rgba(0,0,0,.7); align-items: center; justify-content: center;
    padding: 20px;
}
#descModal.open { display: flex; }
#descModal .modal-box {
    background: #161616; border: 1px solid #333; border-radius: 14px;
    max-width: 480px; width: 100%; max-height: 80vh; overflow-y: auto;
    padding: 22px; position: relative;
}
#descModal .modal-close {
    position: absolute; top: 10px; right: 12px;
    border: none; background: #222; color: #aaa;
    width: 32px; height: 32px; border-radius: 8px;
    font-size: 1.1rem; cursor: pointer; padding: 0;
}
#descModal .modal-close:hover { background: #333; color: #fff; transform: none; }
#descModal .modal-icon { width: 64px; height: 64px; display: block; margin: 0 auto 12px; }
#descModal .modal-name { text-align: center; font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
#descModal .modal-meta { text-align: center; font-size: .75rem; color: #999; margin-bottom: 14px; }
#descModal .modal-desc { font-size: .9rem; line-height: 1.5; color: #ddd; }

.btn-group { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
button {
    font-family: 'Courier New', Courier, monospace; letter-spacing: 1px;
    font-size: .9rem; font-weight: 700;
    padding: 12px 22px; border-radius: 10px; border: 2px solid #333;
    background: #1a1a1a; color: #fff; cursor: pointer; transition: .2s;
    text-transform: uppercase;
}
button:hover { transform: translateY(-2px); }
.btn-survivor:hover { border-color: var(--survivor); box-shadow: 0 0 20px rgba(46,125,50,.4); background: #0d1f0d; }
.btn-killer:hover { border-color: var(--killer); box-shadow: 0 0 20px rgba(198,40,40,.4); background: #1f0d0d; }
.btn-challenge:hover { border-color: #9c27b0; box-shadow: 0 0 20px rgba(156,39,176,.4); background: #1a0a1f; }
.btn-clear { border-color: #555; font-size: .8rem; padding: 8px 16px; }
.btn-clear:hover { border-color: #888; background: #222; }

.results-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px; margin-top: 28px;
}
.result-box {
    background: #161616; border: 1px solid #2a2a2a; border-radius: 14px;
    padding: 18px; min-height: 160px;
}
.result-box h3 { font-family: 'Courier New', Courier, monospace; font-size: .85rem; letter-spacing: 1.5px; text-transform: uppercase; color: #999; margin-bottom: 14px; text-align: center; }
.build-slots { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.slot {
    width: 100px; text-align: center; background: #1e1e1e;
    border-radius: 10px; padding: 10px 6px; border-bottom: 4px solid #333;
    cursor: pointer; position: relative; transition: .15s;
}
.slot:hover { transform: translateY(-3px); background: #252525; }
.slot img { width: 72px; height: 72px; display: block; margin: 0 auto 6px; pointer-events: none; }
.slot span { font-size: 11px; font-weight: 600; line-height: 1.25; display: block; pointer-events: none; }
.slot.empty { opacity: .35; cursor: default; }
.slot.empty:hover { transform: none; background: #1e1e1e; }

.slot-menu {
    position: absolute; z-index: 100;
    background: #1c1c1c; border: 1px solid #444; border-radius: 10px;
    padding: 6px; min-width: 140px;
    box-shadow: 0 8px 25px rgba(0,0,0,.6);
    display: none;
}
.slot-menu button {
    display: block; width: 100%; text-align: left;
    padding: 8px 12px; margin: 2px 0; border: none;
    background: transparent; font-size: .82rem; text-transform: none;
    letter-spacing: 0; border-radius: 6px;
}
.slot-menu button:hover { background: #333; transform: none; }

.char-display {
    text-align: center; min-height: 150px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.char-display img {
    width: 90px; height: 90px; border-radius: 14px; object-fit: cover;
    background: #1a1a1a; margin-bottom: 10px; box-shadow: 0 4px 15px rgba(0,0,0,.45); display: block;
}
.char-display .fallback {
    width: 90px; height: 90px; border-radius: 14px; background: #2a2a2a;
    display: none; align-items: center; justify-content: center;
    font-size: 2.2rem; font-weight: 700; margin: 0 auto 10px; color: #666;
}
.big-name { font-size: 1.2rem; font-weight: 700; line-height: 1.3; max-width: 220px; }
.role-tag {
    display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: 1.5px;
    padding: 3px 10px; border-radius: 20px; text-transform: uppercase; margin-bottom: 8px;
}
.role-tag.survivor { background: rgba(46,125,50,.25); color: #81c784; }
.role-tag.killer { background: rgba(198,40,40,.25); color: #ef9a9a; }
.role-tag.any { background: rgba(156,39,176,.25); color: #ce93d8; }
.challenge-text { font-size: 1.05rem; line-height: 1.4; text-align: center; color: #ddd; }
.error-msg { color: #ff5252; font-weight: 600; text-align: center; margin-top: 12px; font-size: .95rem; }
.hint { text-align: center; color: #666; font-size: .8rem; margin-top: 8px; }
.stats { text-align: center; color: var(--muted); font-size: .82rem; margin-bottom: 10px; }
.stats span { color: #ccc; font-weight: 600; }

.collection-tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.collection-grid {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
    background: var(--card); border: 1px solid #222; border-radius: 14px;
    padding: 16px; max-height: 320px; overflow-y: auto;
}
.char-card {
    width: 88px; text-align: center; cursor: pointer;
    border-radius: 10px; padding: 8px 4px; transition: .15s;
    border: 2px solid transparent; position: relative;
}
.char-card:hover { background: rgba(255,255,255,.04); }
.char-card img {
    width: 64px; height: 64px; border-radius: 10px; object-fit: cover;
    background: #1a1a1a; display: block; margin: 0 auto 6px;
}
.char-card .cname { font-size: 10px; color: #ccc; line-height: 1.2; height: 26px; overflow: hidden; }
.char-card.missing { opacity: .35; filter: grayscale(1); }
.char-card.missing::after {
    content: '✕'; position: absolute; top: 4px; right: 6px;
    font-size: 12px; color: #f44336; font-weight: 800;
}
.char-card.owned::after {
    content: '✓'; position: absolute; top: 4px; right: 6px;
    font-size: 12px; color: #4caf50; font-weight: 800;
}

.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #222; border: 1px solid #444; color: #eee;
    padding: 10px 18px; border-radius: 10px; font-size: .85rem;
    z-index: 500; display: none; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.toast.show { display: block; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

::-webkit-scrollbar { width: 7px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* Compact secondary buttons */
.btn-sm { padding: 7px 14px !important; font-size: .75rem !important; }

/* Collapsible more options */
.more-panel {
    max-width: 420px;
    margin: 10px auto 0;
    text-align: center;
}
.more-toggle {
    background: transparent !important;
    border: 1px solid #2a2a2a !important;
    color: #777 !important;
    font-size: .75rem !important;
    padding: 6px 14px !important;
    letter-spacing: 0.5px !important;
    text-transform: none !important;
    font-weight: 600 !important;
}
.more-toggle:hover {
    color: #ccc !important;
    border-color: #444 !important;
    transform: none !important;
    background: #151515 !important;
}
.more-body {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
}
.more-panel.open .more-body { display: flex; }
.more-panel.open .more-toggle { color: #bbb !important; border-color: #444 !important; }

.primary-actions { margin-bottom: 4px; }
/* Визуальный замок на слотах в текущем билде */
.slot.locked {
    outline: 2px solid var(--lock);
    background: rgba(255,152,0,.12);
}
.slot.locked::after {
    content: '🔒';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 12px;
}