.hidden {
    display: none !important;
}
body, html {
    margin: 0; padding: 0;
    height: 100dvh;
    background-color: #0a0a0a;
    font-family: 'Courier New', Courier, monospace;
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

button, #scene-image {
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#top-bar {
    display: flex; justify-content: flex-end;
    padding: 10px 20px; background: #111; border-bottom: 1px solid #333;
    gap: 10px;
}

#lang-btn, #mute-btn {
    background: transparent; color: #00ffcc; border: 1px solid #00ffcc;
    padding: 5px 15px; cursor: pointer; font-weight: bold; border-radius: 5px;
}
#lang-btn:hover, #mute-btn:hover { background: rgba(0, 255, 204, 0.1); }

#viewport {
    position: relative;
    flex: 1; 
    display: flex; align-items: center; justify-content: center;
    background: #000;
    overflow: hidden;
}

#scene-image {
    width: 100%; 
    height: 100%;
    object-fit: cover; /* Заполняет весь экран без черных полос */
    object-position: center 25%; /* Смещаем "камеру" чуть выше центра (на уровень лиц) */
}

#enter-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
}
#enter-btn {
    padding: 15px 30px; font-size: 1.5rem; background: #ff007f;
    color: white; border: none; cursor: pointer; border-radius: 10px;
    box-shadow: 0 0 20px #ff007f; transition: transform 0.2s;
}
#enter-btn:active { transform: scale(0.95); }

#main-ui {
    background: #1a1a1a; border-top: 2px solid #444;
    padding: 10px 20px; /* Уменьшили отступы с 15px */
    box-shadow: 0 -10px 20px rgba(0,0,0,0.5);
    z-index: 10;
}

.stats-header {
    display: flex; justify-content: space-between;
    font-weight: bold; color: #00ffcc; margin-bottom: 8px; /* Уменьшили с 10px */
    font-size: 0.9rem; /* Чуть аккуратнее шрифт */
    align-items: center;
}

#progress-container {
    width: 100%; height: 10px; /* Сделали полоску тоньше (было 15px) */
    background: #333;
    border-radius: 10px; overflow: hidden; margin-bottom: 10px;
}
#progress-bar {
    height: 100%; background: linear-gradient(90deg, #ff007f, #00ffcc);
    width: 0%; transition: width 1s ease-in-out;
}

#room-nav {
    display: flex; gap: 8px; margin-bottom: 10px; /* Компактнее */
    overflow-x: auto; 
    padding-bottom: 5px;
}
.nav-btn {
    flex: 1; min-width: 100px; padding: 8px; /* Кнопки стали тоньше */
    background: #2a2a2a; border: 1px solid #555; color: white; border-radius: 5px; cursor: pointer;
}
.nav-btn:hover { background: #444; border-color: #00ffcc; }

#dialogue-box {
    font-size: 0.95rem; line-height: 1.3; color: #ddd;
    min-height: 20px; /* УБРАЛИ огромную высоту (было 60px) */
    background: #111; padding: 10px; /* Убрали лишний воздух внутри */
    border-radius: 8px; border: 1px dashed #555;
    margin: 0 0 10px 0;
}

#trollbox-user-info {
    display: flex; align-items: center; gap: 8px;
}

@media (max-width: 600px) {
    /* Шапка: супер-компактная сетка кнопок */
    #top-bar { padding: 6px; gap: 4px; justify-content: center; }
    #top-bar button { flex: 1 1 calc(30% - 4px); padding: 6px 4px; font-size: 0.75rem; margin: 0; white-space: nowrap; }

    /* Компактный нижний UI */
    #main-ui { padding: 8px; }
    
    /* Статистика: плотная группировка без визуального мусора */
    .stats-header { font-size: 0.8rem; flex-direction: column; align-items: center; gap: 4px; text-align: center; line-height: 1.2; margin-bottom: 6px; }
    .stats-header > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; align-items: center; }
    .status-badge { margin: 0; padding: 2px 4px; font-size: 0.65rem; border-width: 1px; }
    
    #progress-container { height: 6px; margin-bottom: 8px; } 
    
    #room-nav { margin-bottom: 8px; gap: 4px; }
    .nav-btn { padding: 6px 2px; font-size: 0.75rem; min-width: 0; }
    
    #dialogue-box { font-size: 0.8rem; padding: 6px 8px; min-height: 20px; margin-bottom: 8px; }

    /* Картинка: идеальный кроп лиц */
    #scene-image { object-fit: cover; object-position: center 15%; }

    /* Троллбокс: поджимаем всё лишнее */
    #trollbox-ui { flex-wrap: wrap; padding: 6px 8px; gap: 4px; border-bottom: 1px solid #222; }
    #trollbox-label { display: none; }
    #trollbox-user-info { 
        width: 100%; display: flex; justify-content: center; align-items: center; gap: 6px; 
        padding-bottom: 4px; margin-bottom: 2px; border-bottom: 1px dashed #333;
    }
    #trollbox-name-display { width: auto; border: none; padding: 0; margin: 0; font-size: 0.85rem; }
    #trollbox-input { flex: 1; min-width: 140px; padding: 6px; font-size: 16px !important; }
    #trollbox-send { padding: 6px 12px; font-size: 0.8rem; }

    /* Модальные окна */
    #name-modal, #shop-modal, #chart-modal { align-items: flex-start; padding-top: 5vh; }
    .modal-content { max-height: 85vh; overflow-y: auto; }
}

#trend-indicator {
    font-size: 0.9rem; margin-left: 10px;
    font-weight: bold; transition: color 0.3s ease;
}
.trend-up { color: #00ffcc; text-shadow: 0 0 5px #00ffcc; }
.trend-down { color: #ff007f; text-shadow: 0 0 5px #ff007f; }

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}
.shake-animation { animation: shake 0.3s ease-in-out; }

/* Бегущая строка (Ticker) */
#ticker-wrap {
    width: 100%; background: #000; border-top: 1px solid #333;
    padding: 6px 0; font-size: 0.85rem;
    overflow: hidden; white-space: nowrap;
    position: relative; flex-shrink: 0; 
}
#ticker-content {
    display: inline-block; white-space: nowrap;
    transform: translateX(100vw);
    will-change: transform;
}
.ticker-item {
    margin-right: 40px; font-family: 'Courier New', Courier, monospace;
}
.t-green { color: #00ffcc; }
.t-red { color: #ff007f; }

/* Всплывающее окно с графиком DexScreener */
#chart-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 999;
}

.modal-content {
    width: 95%; max-width: 900px; height: 80vh;
    background: #0a0a0a; border: 2px solid #00ffcc;
    border-radius: 10px; display: flex; flex-direction: column;
    overflow: hidden; box-shadow: 0 0 30px rgba(0, 255, 204, 0.2);
}

#modal-header {
    display: flex; justify-content: space-between; align-items: center;
    background: #111; padding: 10px 20px; border-bottom: 1px solid #333;
}

#modal-title { font-weight: bold; color: #00ffcc; }

#close-chart {
    background: #ff007f; color: white; border: none; padding: 5px 15px;
    font-weight: bold; cursor: pointer; border-radius: 5px; font-size: 1rem;
}

#close-chart:hover { background: #d00068; }

#dex-iframe { width: 100%; height: 100%; background: #000; }

.monitor-hover { cursor: crosshair !important; }

/* --- UI ТРОЛЛБОКСА --- */
#trollbox-ui {
    display: flex; gap: 10px; padding: 5px 15px;
    background: #0a0a0a; border-bottom: 1px dashed #333;
    align-items: center; justify-content: center;
}
#trollbox-name { color: #ff007f; font-weight: bold; font-size: 0.9rem; text-transform: uppercase; }
#trollbox-input {
    width: 60%; max-width: 400px; background: #111; border: 1px solid #444; 
    color: #fff; padding: 5px 10px; border-radius: 5px; 
    font-family: 'Courier New', Courier, monospace; outline: none;
}
#trollbox-input:focus { border-color: #00ffcc; }
#trollbox-send {
    background: #222; color: #00ffcc; border: 1px solid #00ffcc; 
    padding: 5px 15px; font-weight: bold; border-radius: 5px; cursor: pointer;
}
#trollbox-send:hover { background: #00ffcc; color: #000; }

.user-msg { color: #fff; background: rgba(0, 255, 204, 0.2); padding: 2px 8px; border-radius: 4px; border: 1px solid #00ffcc;}

.vip-msg { 
    color: #ffd700 !important; 
    background: rgba(255, 215, 0, 0.15) !important; 
    border: 1px solid #ffd700 !important;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* --- АНИМАЦИЯ СТРЕССА ПРИ ДАМПЕ --- */
@keyframes stress-flash {
    0% { box-shadow: inset 0 0 0px rgba(255,0,0,0); }
    50% { box-shadow: inset 0 0 120px rgba(255,0,0,0.6); }
    100% { box-shadow: inset 0 0 0px rgba(255,0,0,0); }
}
.stress-active { animation: stress-flash 1s infinite; }

.status-badge {
    padding: 2px 8px;
    background: #444;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #ff007f;
    border: 1px solid #ff007f;
    margin: 0;
    display: inline-block;
}

/* --- ПАНИКА / МИНИ-ИГРА --- */
#panic-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 0, 0, 0.85);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 50; text-align: center; backdrop-filter: blur(4px);
}
#panic-content {
    animation: zoom-in-out 0.5s infinite alternate;
}
#panic-title { color: #fff; font-size: 3rem; margin: 0; text-shadow: 0 0 20px #000; }
#panic-subtitle { color: #fff; font-size: 1.5rem; margin-bottom: 20px; font-weight: bold; }
#panic-btn {
    background: #00ffcc; color: #000; border: none; padding: 20px 50px;
    font-size: 2rem; font-weight: bold; border-radius: 10px; cursor: pointer;
    box-shadow: 0 10px 0 #00997a; transition: transform 0.1s;
}
#panic-btn:active { transform: translateY(10px); box-shadow: 0 0px 0 #00997a; }
#panic-counter { color: #fff; font-size: 1.5rem; margin-top: 20px; font-weight: bold; }

@keyframes zoom-in-out {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

/* --- КОПИУМ --- */
#copium-btn {
    background: rgba(0, 255, 204, 0.1); color: #00ffcc; border: 1px solid #00ffcc;
    padding: 5px 15px; cursor: pointer; font-weight: bold; border-radius: 5px;
    margin-right: auto;
    transition: all 0.3s ease;
    font-family: 'Courier New', Courier, monospace;
}
#copium-btn:hover { background: #00ffcc; color: #000; box-shadow: 0 0 10px #00ffcc; }

/* Эффект применения Копиума (иллюзия туземуна) */
@keyframes copium-trip {
    0% { filter: hue-rotate(0deg) saturate(100%); transform: scale(1); }
    25% { filter: hue-rotate(90deg) saturate(200%) blur(1px); transform: scale(1.01); }
    50% { filter: hue-rotate(180deg) saturate(300%) blur(2px); transform: scale(1.03); }
    75% { filter: hue-rotate(270deg) saturate(200%) blur(1px); transform: scale(1.01); }
    100% { filter: hue-rotate(360deg) saturate(100%); transform: scale(1); }
}

.copium-active {
    animation: copium-trip 2s infinite linear;
}

/* --- SHILL / TWITTER ENGINE --- */
#shill-btn {
    background: #000; color: #fff; border: 1px solid #555;
    padding: 5px 15px; cursor: pointer; font-weight: bold; border-radius: 5px;
    margin-right: 10px; transition: all 0.3s ease;
    display: flex; align-items: center; justify-content: center;
}
#shill-btn:hover {
    background: #1da1f2; border-color: #1da1f2; box-shadow: 0 0 10px #1da1f2;
}

/* --- SHOP --- */
#shop-btn {
    background: #222; color: #ff007f; border: 1px solid #ff007f;
    padding: 5px 15px; cursor: pointer; font-weight: bold; border-radius: 5px;
    margin-right: 10px; transition: all 0.3s ease;
}
#shop-btn:hover { background: #ff007f; color: #fff; box-shadow: 0 0 10px #ff007f; }

#shop-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 999;
}
.shop-content { max-width: 450px; height: auto; }
.shop-items { padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.shop-item {
    background: #111; border: 1px solid #333; padding: 15px;
    border-radius: 8px; display: flex; flex-direction: column; gap: 5px; text-align: left;
}
.shop-item h3 { margin: 0; color: #00ffcc; font-size: 1.2rem; }
.shop-item p { margin: 0 0 10px 0; font-size: 0.9rem; color: #aaa; }
.buy-btn {
    background: #2a2a2a; color: #fff; border: 1px solid #00ffcc;
    padding: 10px; font-weight: bold; border-radius: 5px; cursor: pointer; transition: 0.2s;
}
.buy-btn:hover:not(:disabled) { background: #00ffcc; color: #000; }
.buy-btn:disabled { border-color: #555; color: #555; background: #222; cursor: not-allowed; }

/* --- THEMES --- */
/* Матрица */
body.matrix-theme { background-color: #001100; color: #00ff00; }
body.matrix-theme #main-ui, body.matrix-theme #trollbox-ui, body.matrix-theme .shop-item {
    background: #001a00; border-color: #00ff00;
}
body.matrix-theme .nav-btn { background: #002200; color: #00ff00; border-color: #00ff00; }
body.matrix-theme .stats-header { color: #00ff00; }
body.matrix-theme #dialogue-box { background: #000; border-color: #00ff00; color: #00ff00; }

/* --- НИКНЕЙМ В ЧАТЕ --- */
#trollbox-label {
    color: #888; 
    font-size: 0.8rem;
}
#trollbox-name-display { 
    color: #ff007f; 
    font-weight: bold; 
    font-size: 0.9rem; 
    text-transform: uppercase; 
    cursor: pointer;
    border-bottom: 1px dashed #ff007f;
    transition: all 0.2s;
}
#trollbox-name-display:hover { 
    color: #fff; 
    text-shadow: 0 0 5px #ff007f;
    border-color: transparent;
}

/* --- МОДАЛКА НИКНЕЙМА --- */
#name-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.name-content { max-width: 350px; height: auto; }
.name-modal-body { padding: 20px; display: flex; flex-direction: column; gap: 15px; }
#name-input {
    background: #111; border: 1px solid #00ffcc; color: #fff;
    padding: 10px; border-radius: 5px; font-family: 'Courier New', Courier, monospace;
    font-size: 1rem; text-align: center; outline: none;
}
#name-input:focus { box-shadow: 0 0 10px rgba(0, 255, 204, 0.3); }