@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

:root {
    --primary-glow-color: #00f5d4;
    --secondary-glow-color: #9b5de5;
    --danger-glow-color: #f15bb5;
    --glass-bg: rgba(35, 35, 65, 0.25);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0c0;
}

html, body {
    margin: 0; overflow: hidden; height: 100%; width: 100%;
    touch-action: none; font-family: 'Poppins', sans-serif;
    background: radial-gradient(ellipse at bottom right, #1a1a2e, #111119);
    color: var(--text-primary); -webkit-user-select: none; -moz-user-select: none;
    -ms-user-select: none; user-select: none;
}

#app-container { display: none; flex-direction: column; width: 100%; height: 100%; }
#3d-canvas-container { flex-grow: 1; position: relative; width: 100%; height: 100%; }
canvas { display: block; cursor: default; }
canvas.interactive-cursor { cursor: pointer; }

.glass-panel {
    background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

#chat-container {
    position: absolute; bottom: 10px; left: 50%;
    transform: translateX(-50%); display: flex; padding: 8px;
    max-width: 500px; width: 60%; align-items: center;
    gap: 8px; z-index: 57;
}

#chat-input {
    flex-grow: 1; padding: 12px 18px; border: none;
    border-radius: 12px; background-color: transparent; color: var(--text-primary);
    font-size: 1em; outline: none; -webkit-user-select: text; user-select: text;
}

#chat-send {
    flex-shrink: 0; width: 48px; height: 48px; border-radius: 12px;
    background: transparent; border: none; cursor: pointer; display: flex;
    align-items: center; justify-content: center;
}
#chat-send:hover { background: rgba(0, 245, 212, 0.1); }

#top-ui-bar { position: fixed; top: 15px; left: 15px; right: 15px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; z-index: 100; }
#toggle-history-btn {
    position: relative; z-index: 105; pointer-events: auto;
}

#top-left-ui, #top-right-ui, #top-center-ui, #bottom-left-ui, #actions-ui { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
#top-right-ui { justify-content: flex-end; }
#room-name-display { font-size: 1.2em; font-weight: 600; color: #ffffff; text-shadow: 0 0 8px rgba(255,255,255,0.7); cursor: pointer; }
#room-player-count, #nickname-display { font-weight: 500; font-size: 0.9em; padding: 8px 12px; }

.icon-btn, .btn {
    display: flex; justify-content: center; align-items: center; cursor: pointer;
    border: 1px solid var(--glass-border); transition: all 0.3s ease;
    color: var(--text-primary); background: transparent;
}
.icon-btn { width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0; }
.btn { gap: 8px; padding: 10px 18px; border-radius: 12px; font-size: 1em; font-weight: 600; }
.icon-btn:hover, .btn:hover {
    border-color: var(--primary-glow-color); background-color: rgba(0, 245, 212, 0.1);
    box-shadow: 0 0 15px 0 var(--primary-glow-color);
}
.icon-btn.active { background-color: rgba(0, 245, 212, 0.2); border-color: var(--primary-glow-color); }
.icon-btn svg, .btn svg { width: 22px; height: 22px; stroke: var(--text-primary); }

#main-menu { display: none; position: absolute; top: 60px; left: 0; z-index: 70; }
#main-menu.open { display: block; }
#main-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 18px; background: none; border: none; color: white; text-align: left; cursor: pointer; font-size: 0.9em; transition: background-color 0.2s; }
#main-menu button:hover { background-color: rgba(255,255,255,0.1); }
#main-menu .delete-btn { color: var(--danger-glow-color); }

#material-editor-sidebar, #groups-sidebar {
    position: fixed; width: 300px; transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 50; display: flex; flex-direction: column; padding: 20px;
    box-sizing: border-box; pointer-events: none;
}

#furniture-sidebar {
    position: fixed; bottom: 100px; left: 50%; width: 90%; height: 160px;
    transform: translate(-50%, 200%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 0; display: flex; flex-direction: column; padding: 15px;
    box-sizing: border-box; pointer-events: auto; background: var(--glass-bg);
    backdrop-filter: blur(20px); border: 1px solid var(--glass-border);
    border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    overflow: hidden;
}
#furniture-sidebar.open { transform: translate(-50%, 0); }
#furniture-sidebar.expanded{ left: 15px; right: 15px; width: auto; }
#furniture-sidebar.expanded #furniture-list{ 
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 12px; justify-items: center; 
}
#furniture-sidebar.expanded .furniture-item { aspect-ratio: unset; height: 180px; }

#chat-history-sidebar {
    position: fixed; width: 300px; right: 15px; left: auto;
    top: 70px; bottom: 20px;
    display: none; flex-direction: column; padding: 20px;
    box-sizing: border-box; pointer-events: none;
    background: var(--glass-bg); backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border); border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    z-index: 50;
}
#chat-history-sidebar.open { display: flex; pointer-events: auto; }

#material-editor-sidebar { bottom: 20px; left: 15px; width: 220px; transform: translateX(315px); display: none; }

h3, h4 { margin: 0 0 15px 0; text-align: center; color: #ffffff; font-size: 1.2em; font-weight: 600; }
h4 { font-size: 1.0em; color: var(--text-secondary); }

#chat-log { flex-grow: 1; overflow-y: auto; }
#chat-log .chat-message-item { background-color: rgba(0,0,0,0.2); border-radius: 12px; padding: 10px; margin-bottom: 10px; display: flex; font-size: 0.9em; }
#chat-log .message-avatar, .item-avatar { 
    width: 30px; height: 30px; border-radius: 50%; margin-right: 12px; flex-shrink: 0; 
    background-size: cover !important; background-position: center top; background-repeat: no-repeat !important;
}
.message-content { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; }
.message-header { display: flex; justify-content: space-between; align-items: baseline; width: 100%; font-size: 0.8em; color: var(--text-secondary); line-height: 1.2; }
.message-sender { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 10px; }
.message-timestamp { flex-shrink: 0; }
.message-text { font-size: 1em; padding-top: 2px; word-wrap: break-word; }

.floating-score {
    position: absolute; z-index: 1001; font-size: 1.2em; font-weight: 600;
    color: #f1c40f; text-shadow: 0 0 5px rgba(0,0,0,0.7);
    pointer-events: none; transition: opacity 0.3s ease-out;
}

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 10, 20, 0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    display: flex; justify-content: center; align-items: center;
    flex-direction: column; z-index: 1100; transition: opacity 0.3s ease-in-out;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-overlay.hidden * { pointer-events: none !important; }

.form-box { padding: 30px; display: flex; flex-direction: column; gap: 18px; width: 90%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.form-box h2 { color: #ffffff; margin-top: 0; text-align: center; font-weight: 600; font-size: 1.5em; text-shadow: 0 0 5px rgba(255,255,255,0.5); }
.form-box input, .form-box select {
    padding: 12px; border: 1px solid var(--glass-border); border-radius: 12px;
    background-color: rgba(0,0,0,0.2); color: var(--text-primary);
    font-size: 1em; outline: none; transition: all 0.3s ease;
}
.form-box input:focus, .form-box select:focus { border-color: var(--primary-glow-color); box-shadow: 0 0 10px 0 var(--primary-glow-color); }
.form-box .toggle-mode { background: none; border: none; cursor: pointer; text-align: center; color: var(--primary-glow-color); font-size: 0.9em; margin-top: 10px; padding: 5px; }

.modal-close-x {
    position: absolute; top: 15px; right: 20px; font-size: 2.5em;
    color: var(--text-secondary); cursor: pointer; line-height: 0.5; transition: color 0.2s ease;
}
.modal-close-x:hover { color: var(--text-primary); }

.btn.cancel-btn, .btn.delete-btn-small { color: var(--danger-glow-color); border-color: var(--danger-glow-color); }
.btn.cancel-btn:hover, .btn.delete-btn-small:hover {
    border-color: var(--danger-glow-color); background-color: rgba(241, 91, 181, 0.1);
    box-shadow: 0 0 15px 0 var(--danger-glow-color);
}

#furniture-list {
    display: flex; flex-direction: row; gap: 12px; width: 100%; height: 100%;
    overflow-x: auto; overflow-y: hidden; scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; align-items: center; 
    
    /* Změna paddingu: Menší na krajích, aby maska fungovala lépe */
    padding: 0 10px; 

    /* --- MASKA (Fade efekt) --- */
    /* Vytvoří průhledný gradient na začátku (0px-20px) a na konci (posledních 20px) */
    -webkit-mask-image: linear-gradient(to right, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%);
    
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.1); /* Pro Firefox */
    scrollbar-width: thin; /* Pro Firefox - tenký */
}

#furniture-list::-webkit-scrollbar {
    height: 6px; /* Výška vodorovného posuvníku */
    display: block; /* Ujistíme se, že je vidět */
}

/* Dráha posuvníku */
#furniture-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1); /* Jemné tmavé pozadí */
    border-radius: 3px;
    margin: 0 20px; /* Odsazení od krajů (kvůli zaoblení okna) */
}

/* Samotný posuvník (ten co taháte) */
#furniture-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2); /* Poloprůhledná bílá */
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}

/* Po najetí myší se zvýrazní */
#furniture-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4); 
}
#furniture-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 3px; }
#furniture-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

.furniture-item {
    flex: 0 0 auto; width: 100px; height: 110px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px; border: 2px solid transparent; cursor: grab; transition: all 0.2s;
}
.furniture-item.selected { border-color: #98c379; background-color: rgba(152, 195, 121, 0.2); }
.furniture-item:hover { background-color: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }
.furniture-item .preview { width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; background: transparent; }
.furniture-item .preview img { width: 100%; height: 100%; border-radius: 8px; object-fit: contain; max-width: 100%; max-height: 100%; }
.furniture-item span { font-size: 0.75em; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.furniture-item .item-header { width: 100%; display: flex; justify-content: flex-start; align-items: center; padding-right: 40px; box-sizing: border-box; font-weight: bold; }
.furniture-item .item-footer { width: 100%; text-align: center; color: #f1c40f; margin-top: 4px; }

.btn-icon-edit {
    position: absolute; top: 5px; right: 5px; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 8px; cursor: pointer; color: var(--text-primary);
    opacity: 0; pointer-events: none; transition: all 0.2s ease; z-index: 10;
}
.btn-icon-edit:hover { background-color: rgba(155, 93, 229, 0.3); border-color: var(--secondary-glow-color); }
.furniture-item:hover .btn-icon-edit { opacity: 1; pointer-events: auto; }

.editor-handle {
    position: absolute; width: 38px; height: 38px; border-radius: 50%;
    display: none; justify-content: center; align-items: center;
    pointer-events: auto; z-index: 101; transition: all 0.2s ease;
    background: rgba(30, 30, 50, 0.4); backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
}
.editor-handle:hover { border-color: var(--primary-glow-color); }
#delete-handle:hover { border-color: var(--danger-glow-color); }

#bottom-left-ui {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    z-index: 56; overflow: visible !important; display: flex; flex-direction: row;
    gap: 12px; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(10px);
    padding: 10px 20px; border-radius: 24px; border: 1px solid var(--glass-border);
}

/* Pod-menu: Terén, Sprej, Levely */
#terrain-tools-ui, #terrain-brush-size-container, #level-controls, #spray-tools-ui {
    position: absolute; bottom: 100%; margin-bottom: 15px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: row; align-items: center; justify-content: center;
    gap: 15px; padding: 12px 25px; background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px); border-radius: 20px; border: 1px solid var(--glass-border);
    z-index: 60;
}
#terrain-tools-ui, #terrain-brush-size-container { width: auto !important; min-width: 320px !important; max-width: 90vw !important; }
#spray-tools-ui { width: auto !important; min-width: 260px !important; max-width: 90vw !important; }
#level-controls { min-width: 170px !important; max-width: 170px !important; }

/* Slidery v pod-menu */
#terrain-brush-size, #spray-size-slider { width: 80px !important; max-width: 80px !important; margin: 0; cursor: pointer; display: block; }
#terrain-tools-ui > div:last-child, #spray-tools-ui > div:last-child {
    width: 110px !important; flex-shrink: 0 !important; display: flex !important;
    flex-direction: column !important; align-items: center !important; justify-content: center;
}
#terrain-tools-ui span, #spray-tools-ui span { font-size: 0.75em; color: #ccc; margin-bottom: 4px; display: block; }

/* Color inputs v pod-menu */
#terrain-tools-ui input[type="color"], #spray-tools-ui input[type="color"] {
    -webkit-appearance: none; appearance: none; width: 42px !important; height: 42px !important;
    padding: 0 !important; border: 1px solid rgba(255,255,255,0.3) !important; border-radius: 10px !important;
    background: transparent !important; cursor: pointer; display: block;
}
#terrain-tools-ui input[type="color"]::-webkit-color-swatch, #spray-tools-ui input[type="color"]::-webkit-color-swatch {
    border: none; border-radius: 8px;
}

#actions-ui { position: absolute; bottom: 15px; right: 15px; z-index: 55; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 10px; }
#actions-menu { display: none; flex-direction: column; gap: 10px; padding: 8px; }
#actions-menu.open { display: flex; }
#actions-menu .btn { background: var(--glass-bg); }

.item-list { max-height: 50vh; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.list-item, .room-item, .friend-item, .blocked-item {
    display: flex; justify-content: space-between; align-items: center; padding: 12px;
    background-color: rgba(0,0,0,0.2); border-radius: 12px; border: 1px solid transparent; transition: all 0.2s ease;
}
.list-item:hover, .room-item:hover { border-color: var(--glass-border); background-color: rgba(0,0,0,0.3); }

.chat-bubble, .nickname-label, .info-bubble {
    position: absolute; top: 0; left: 0; padding: 8px 12px; border-radius: 12px;
    font-size: 0.9em; text-align: center; white-space: normal; max-width: 300px;
    opacity: 0; transition: opacity 0.3s ease-in-out; pointer-events: none; z-index: 100;
}
.chat-bubble, .info-bubble {
    background: rgba(30, 30, 50, 0.4); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border); color: #f0f0f0;
}
.nickname-label { background-color: rgba(0, 0, 0, 0.7); color: #ffffff; padding: 4px 8px; z-index: 99; opacity: 0; transition: opacity 0.2s; }
.nickname-label.visible { opacity: 1; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--primary-glow-color); }

.tabs { display: flex; gap: 5px; margin-bottom: 10px; }
.tab { flex-grow: 1; padding: 8px 12px; background-color: rgba(0,0,0,0.2); border: 1px solid var(--glass-border); color: var(--text-secondary); cursor: pointer; border-radius: 8px; transition: all 0.2s ease; }
.tab.active { background-color: rgba(0, 245, 212, 0.2); color: var(--primary-glow-color); border-color: var(--primary-glow-color); }
hr { border: none; border-top: 1px solid var(--glass-border); margin: 15px 0; }

#notification-container { position: fixed; top: 75px; right: 15px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; }
.notification { color: var(--text-primary); padding: 12px 18px; border-radius: 12px; opacity: 0; transition: opacity 0.5s, transform 0.5s; transform: translateX(100%); font-size: 0.9em; }
.notification.show { opacity: 1; transform: translateX(0); }
.notification.error { background-color: rgba(241, 91, 181, 0.2); border: 1px solid var(--danger-glow-color); }
.notification.bonus {
    background-color: rgba(241, 196, 15, 0.15); border: 1px solid #f1c40f; color: #f1c40f;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5); display: flex; align-items: center; gap: 10px;
}
.notification.bonus svg { stroke: #f1c40f; flex-shrink: 0; }
.notification.friend {
    background-color: rgba(155, 93, 229, 0.15); border: 1px solid #9b5de5; color: #c0a0ff;
    text-shadow: 0 0 5px rgba(155, 93, 229, 0.5); display: flex; align-items: center; gap: 10px;
}
.notification.friend svg { stroke: #9b5de5; flex-shrink: 0; }
.notification-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; background-size: cover;
    background-position: center; border: 2px solid var(--glass-border); display: flex; align-items: center; justify-content: center;
}
.notification-avatar svg { width: 18px; height: 18px; stroke: #f0f0f0; }

.gender-selection { display: flex; justify-content: center; gap: 15px; }
.gender-selection label { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.gender-selection input { display: none; }
.gender-selection .model-preview { width: 50px; height: 50px; border: 2px solid var(--glass-border); border-radius: 8px; }
.gender-selection input:checked + .model-preview { border-color: var(--primary-glow-color); box-shadow: 0 0 10px 0 var(--primary-glow-color); }

#groups-sidebar {
    position: fixed; right: 15px; top: 85px !important; bottom: 100px !important;
    width: 300px; transform: translateX(120%); transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 51; display: flex; flex-direction: column; padding: 20px; box-sizing: border-box; pointer-events: none;
    background: var(--glass-bg); backdrop-filter: blur(20px); border: 1px solid var(--glass-border);
    border-radius: 16px; box-shadow: -5px 5px 20px rgba(0,0,0,0.3);
}
#groups-sidebar.open { transform: translateX(0); pointer-events: auto; }
#groups-list-container, #group-items-container { flex-grow: 1; overflow-y: auto; padding: 5px; }
.group-list-item, .group-item {
    display: flex; justify-content: space-between; align-items: center; padding: 10px;
    background-color: rgba(0,0,0,0.2); border-radius: 8px; margin-bottom: 8px;
    border: 1px solid transparent; transition: all 0.2s ease;
}
.group-list-item:hover { border-color: var(--glass-border); cursor: pointer; }
.group-list-item.selected { border-color: var(--primary-glow-color); background-color: rgba(0, 245, 212, 0.1); }
.group-item-name { flex-grow: 1; }
.group-actions button, .group-item-actions button { background: none; border: none; color: var(--text-primary); cursor: pointer; padding: 4px; }
.group-actions button:hover, .group-item-actions button:hover { color: var(--primary-glow-color); }
.delete-btn-small:hover { color: var(--danger-glow-color); }

#bottom-left-ui .editor-controls { display: flex; gap: 12px; }
#toggle-settings-btn { display: none; }

#category-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 15px; width: 100%;
}
.category-grid-item {
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px;
    padding: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; cursor: pointer; transition: all 0.3s ease; text-align: center;
}
.category-grid-item:hover {
    border-color: var(--primary-glow-color); background-color: rgba(0, 245, 212, 0.1);
    box-shadow: 0 0 15px 0 var(--primary-glow-color); transform: translateY(-5px);
}
.category-grid-item svg { width: 32px; height: 32px; stroke: var(--primary-glow-color); }
.category-grid-item span { font-size: 0.9em; font-weight: 500; }

#tv-toolbar .icon-btn { width: 40px; height: 40px; border-radius: 10px; }
#interaction-indicator { display: none; background-color: #98c379; pointer-events: auto; cursor: pointer; }
#video-fullscreen-container video { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }

.video-list-item {
    display: flex; justify-content: space-between; align-items: center; padding: 8px 10px;
    border-radius: 6px; transition: background-color 0.2s; cursor: pointer;
}
.video-list-item:hover { background-color: rgba(0, 0, 0, 0.2); }
.video-list-item.active { background-color: rgba(0, 245, 212, 0.2); color: var(--primary-glow-color); }
.video-list-item span { font-size: 0.85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.video-list-item .delete-video-btn { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 0; margin-left: 10px; }
.video-list-item .delete-video-btn:hover { color: var(--danger-glow-color); }

input[type="color"] {
    -webkit-appearance: none; appearance: none; padding: 0 !important;
    background-color: transparent !important; border: none !important;
    width: 50px !important; height: 40px !important; cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 2px solid var(--glass-border); border-radius: 8px; }

#model-editor-modal input[type="color"] { width: 40px; height: 25px; border: 1px solid var(--glass-border); border-radius: 4px; }
#model-editor-modal input[type="color"]::-webkit-color-swatch { border: none; border-radius: 3px; }

@media (min-width: 992px) {
    .room-sel-panel { max-width: 680px; }
    .room-sel-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 55vh; }
}

#toggle-color-brush-btn.active { background-color: rgba(0, 245, 212, 0.2); border-color: var(--primary-glow-color); }

@media (max-width: 768px) {
    #top-ui-bar { justify-content: space-between; flex-wrap: nowrap; gap: 8px; align-items: center; }
    #top-left-ui, #top-right-ui { flex-shrink: 0; }
    #top-center-ui { flex-grow: 1; justify-content: center; min-width: 0; padding-top: 0; }
    #room-name-display { font-size: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .icon-btn { width: 40px; height: 40px; }
    .btn { padding: 8px 14px; font-size: 0.9em; }
    #chat-container { padding: 6px; width: calc(100% - 140px); }
    #chat-input { padding: 10px 14px; font-size: 0.9em; }
    #chat-send { width: 40px; height: 40px; }
    #chat-history-sidebar, #furniture-sidebar, #groups-sidebar { width: 250px; }
    .form-box { padding: 20px; }
    .form-box h2 { font-size: 1.3em; }
    #actions-menu { flex-direction: row; position: absolute; bottom: 55px; right: 0; }
    #actions-ui { flex-direction: column; }
    #toggle-settings-btn { display: flex; }
    #top-right-ui > button:not(#toggle-settings-btn) { display: none; }
    #nickname-display, #room-player-count, #users-icon { display: none !important; }
    
    #lighting-modal .form-box {
        display: flex !important; flex-direction: column !important; justify-content: flex-start !important;
        gap: 0 !important; padding: 15px 20px !important; width: 320px !important; height: auto !important; max-height: 85vh !important;
    }
    #lighting-modal .form-box > div { display: flex !important; flex-direction: column !important; gap: 2px !important; margin: 0 !important; padding: 5px 0 !important; }
    #lighting-modal .form-box > div[style*="justify-content: space-between"] { flex-direction: row !important; align-items: center !important; margin-bottom: 5px !important; }
    #lighting-modal h2 { font-size: 1.2em !important; margin-bottom: 10px !important; }
    #lighting-modal h4 { font-size: 0.9em !important; margin: 5px 0 2px 0 !important; color: var(--primary-glow-color); text-transform: uppercase; }
    #lighting-modal hr { margin: 5px 0 !important; border-color: rgba(255,255,255,0.1) !important; }
    #lighting-modal label { font-size: 0.8em !important; color: #bbb !important; margin-bottom: 0 !important; }
    #lighting-modal input[type=range] { margin: 2px 0 8px 0 !important; height: 4px !important; }
    #lighting-modal input[type=checkbox] { margin: 0 !important; width: 16px !important; height: 16px !important; }

    .hud-row { gap: 160px !important; padding: 0 5px !important; }
    .hud-btn, .hud-icon { width: 38px !important; height: 38px !important; border-radius: 8px !important; }
    .hud-group-left, .hud-group-right { gap: 6px !important; min-width: auto !important; }
    #wardrobe-slots-container { width: 100% !important; max-width: 100% !important; }
    
    #auth-form-container .form-box { gap: 12px; }
    #gender-selection-container p { margin: 0; font-size: 0.9em; }
    #avatar-selection-widget { margin-top: 5px !important; }
    #avatar-preview-container { height: 220px !important; width: 180px !important; }
    #avatar-prev-btn, #avatar-next-btn { width: 36px !important; height: 36px !important; }
}

.video-preview-item {
    width: 78px; height: 50px; flex-shrink: 0; border-radius: 6px; border: 2px solid transparent;
    cursor: pointer; position: relative; background-color: #333; transition: border-color 0.2s;
    text-align: center; font-size: 0.7em; color: white; line-height: 1.1; padding: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: normal; display: flex; align-items: center;
    justify-content: center; flex-direction: column;
}
.video-preview-item i { width: 24px; height: 24px; margin-bottom: 2px; stroke: var(--primary-glow-color); }
.video-preview-item.active { border-color: var(--primary-glow-color); box-shadow: 0 0 8px var(--primary-glow-color); }
.video-preview-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }

#avatar-upload-section {
    display: none; align-items: center; gap: 15px; padding: 10px;
    background-color: rgba(0,0,0,0.15); border-radius: 12px;
}
#avatar-upload-preview {
    width: 60px; height: 60px; border-radius: 50%; background-color: var(--glass-bg);
    border: 2px solid var(--glass-border); background-size: cover; background-position: center top;
    background-repeat: no-repeat; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
#auth-form-container .avatar-label[for="auth-avatar-input"] {
    display: flex; gap: 8px; padding: 10px 14px; border: 1px solid var(--glass-border);
    border-radius: 12px; cursor: pointer; transition: all 0.3s ease; font-size: 0.9em;
    flex-grow: 1; justify-content: center; color: var(--text-primary); background: transparent;
}
#auth-form-container .avatar-label[for="auth-avatar-input"]:hover { border-color: var(--primary-glow-color); background-color: rgba(0, 245, 212, 0.1); }
#auth-submit-btn { margin-top: 10px; }

/* Wardrobe HUD */
#wardrobe-modal .form-box {
    width: 100% !important; max-width: 100% !important; height: 100vh !important; max-height: 100vh !important;
    padding: 0; background: radial-gradient(circle at center, #2a2a40 0%, #000000 100%);
    border-radius: 0; overflow: hidden;
}
#wardrobe-preview-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
#wardrobe-ui-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10;
    pointer-events: none; display: flex; flex-direction: column; justify-content: space-between;
}
#wardrobe-slots-container {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 100%; max-width: 750px; display: flex; flex-direction: column; gap: 12px; pointer-events: none;
}
.hud-row { display: grid; grid-template-columns: 1fr 1fr; align-items: center; padding: 0; width: 100%; gap: 360px; pointer-events: none; }
.hud-group-left { display: flex; align-items: center; gap: 12px; pointer-events: auto; justify-self: end; }
.hud-group-right { display: flex; align-items: center; gap: 12px; pointer-events: auto; justify-self: start; }
.hud-btn {
    width: 48px; height: 48px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0, 0, 0, 0.5); color: #fff; display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: all 0.2s; backdrop-filter: blur(5px);
}
.hud-btn:hover { background: rgba(255,255,255,0.3); border-color: var(--primary-glow-color); transform: scale(1.1); }
.hud-btn.arrow-btn { background: rgba(0, 245, 212, 0.15); border-color: rgba(0, 245, 212, 0.5); }
.hud-icon {
    width: 48px; height: 48px; display: flex; justify-content: center; align-items: center;
    color: var(--primary-glow-color); background: rgba(255,255,255,0.05); border-radius: 12px; margin-right: 5px;
}
#wardrobe-ui-overlay #wardrobe-close-x { pointer-events: auto; cursor: pointer; z-index: 20; color: white; text-shadow: 0 0 5px #000; }
#wardrobe-ui-overlay > div:first-child { pointer-events: none; }
#wardrobe-ui-overlay > div:first-child h2 { pointer-events: auto; }

/* Range inputs */
input[type=range] { -webkit-appearance: none; width: 100%; height: 16px !important; background: transparent !important; margin: 10px 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; border: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%; background: var(--primary-glow-color); box-shadow: 0 0 5px rgba(0,0,0,0.5); margin-top: -6px; }
input[type=range]::-moz-range-track { width: 100%; height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; border: none; }
input[type=range]::-moz-range-thumb { height: 16px; width: 16px; border: none; border-radius: 50%; background: var(--primary-glow-color); }

#selection-box { position: absolute; border: 1px solid var(--primary-glow-color); background-color: rgba(0, 245, 212, 0.15); display: none; pointer-events: none; z-index: 2000; }

/* Nápověda */
.help-section { margin-bottom: 20px; }
.help-section h4 { border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px; margin-bottom: 10px; color: var(--primary-glow-color); }
.shortcut-list { display: flex; flex-direction: column; gap: 8px; }
.s-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9em; color: #ccc; }
.keys { display: flex; gap: 4px; align-items: center; }
kbd {
    background-color: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
    border-bottom: 2px solid rgba(255,255,255,0.2); border-radius: 6px; padding: 2px 8px;
    font-family: monospace; font-weight: bold; color: #fff; min-width: 20px; text-align: center; font-size: 0.85em;
}

/* Overhead UI */
.overhead-stat-container {
    /* Změnil jsem z-index, aby to nepřekrývalo okna (bary budou pod menu, ale nad hrou) */
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    display: none;
    flex-direction: column;
    gap: 2px;
    pointer-events: none;
    z-index: 900 !important; /* Bylo 100000, sníženo pod modální okna */
    background: rgba(0, 0, 0, 0.6);
    padding: 4px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -100%);
}
.overhead-bar-bg {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    display: none;
}

.overhead-bar-fill {
    height: 100%;
    width: 100%;
    transition: width 0.2s;
}
.bar-energy {
    box-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
    /* SMAZÁNO: background-color: #f1c40f !important; */
}

.bar-hunger {
    box-shadow: 0 0 5px rgba(230, 126, 34, 0.5);
    /* SMAZÁNO: background-color: #e67e22 !important; */
}

.bar-thirst {
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
    /* SMAZÁNO: background-color: #3498db !important; */
}

.bar-toilet {
    box-shadow: 0 0 5px rgba(241, 91, 181, 0.5);
    /* SMAZÁNO: background-color: #f15bb5 !important; */
    animation: pulse-red 0.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 rgba(241, 91, 181, 0.4); }
    100% { box-shadow: 0 0 10px rgba(241, 91, 181, 0); }
}

.puddle-label {
    position: absolute; color: #f1c40f; font-weight: bold; text-shadow: 0 0 4px #000;
    pointer-events: none; font-size: 1.0em; text-align: center; width: 200px;
    transform: translate(-50%, -100%); z-index: 100;
}
/* Hlavní kontejner panelu */
.status-panel {
    position: fixed; /* Přilepí se k oknu prohlížeče */
    top: 0;
    right: 0;
    bottom: 0; /* Roztáhne se na celou výšku */
    width: 300px; /* Šířka podobná oknu s objekty */
    
    background-color: rgba(20, 20, 30, 0.95); /* Tvé tmavé pozadí */
    padding: 20px;
    box-shadow: -2px 0 10px rgba(0,0,0,0.5);
    
    /* Flexbox pro rozložení obsahu uvnitř */
    display: flex;
    flex-direction: column;
    gap: 15px; /* Mezery mezi bary */
    
    /* Aby se dalo klikat na panel, ale zbytek stránky byl průchozí */
    pointer-events: auto; 
    z-index: 1000;
  }
  
  /* Pokud máš nějaký wrapper okolo, musí být průchozí pro myš */
  .overlay-wrapper {
    pointer-events: none; /* DŮLEŽITÉ: Tohle umožní klikat "skrz" prázdná místa */
    position: fixed;
    inset: 0;
    z-index: 999;
  }
  /* === STYLY PRO TELEPORT MODAL A TLAČÍTKA === */

/* === STYLY PRO TELEPORT (JEN NEZBYTNÉ ÚPRAVY) === */

/* Upravíme jen roletku, aby nebyla bílá (hnusná), ale zapadla do skla */
#teleport-room-select {
    width: 100%;
    padding: 10px;
    margin: 15px 0 25px 0;
    
    /* Tmavší sklo pro input */
    background: rgba(0, 0, 0, 0.4); 
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    
    font-family: 'Poppins', sans-serif;
    outline: none;
    cursor: pointer;
}

#teleport-room-select:focus {
    border-color: var(--primary-glow-color);
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.2);
}

#teleport-room-select option {
    background: #1a1a2e; /* Aby možnosti byly čitelné */
    color: white;
}

/* Tlačítko - NORMÁLNÍ VELIKOST */
#save-teleport-btn {
    /* Zrušíme to roztahování na 100% */
    width: auto; 
    min-width: 120px; 
    padding: 8px 24px;
    
    background: linear-gradient(135deg, var(--primary-glow-color), #00a896);
    color: #000;
    font-weight: 600;
    font-size: 0.95rem;
    
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    
    /* Zarovnání na střed */
    display: block;
    margin: 0 auto; 
}

#save-teleport-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--primary-glow-color);
}

/* === MOBILNÍ OVLÁDÁNÍ VOZIDEL === */
#mobile-vehicle-controls {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    height: 180px; /* Výška oblasti ovládání */
    pointer-events: none; /* Aby šlo klikat skrz prázdná místa */
    z-index: 10001; /* Nad vším ostatním */
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
}

#mobile-vehicle-controls.hidden {
    display: none !important;
}

/* Skupiny tlačítek */
.mobile-ctrl-group {
    pointer-events: auto; /* Tlačítka musí reagovat */
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.mobile-ctrl-group.left {
    padding-bottom: 10px;
}

.mobile-ctrl-group.right {
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 15px;
}

.drive-row {
    display: flex;
    gap: 15px;
}

.action-row {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
}

/* Společný styl tlačítek */
.ctrl-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    touch-action: none; /* Zabrání zoomování při rychlém klikání */
    user-select: none;
    transition: transform 0.1s, background 0.1s;
    outline: none;
}

.ctrl-btn:active {
    background: rgba(0, 245, 212, 0.4); /* Primary Glow Color */
    transform: scale(0.95);
}

/* Specifické úpravy */
.gas-btn {
    width: 70px;
    height: 70px;
    background: rgba(0, 255, 0, 0.2);
}

.brake-btn {
    width: 70px;
    height: 70px;
    background: rgba(255, 0, 0, 0.2);
}

.action-btn {
    width: 80px;
    height: 50px;
    border-radius: 25px; /* Oválné */
    font-size: 12px;
    font-weight: bold;
    background: rgba(241, 196, 15, 0.3);
}

.exit-btn {
    background: rgba(255, 50, 50, 0.4);
    border-color: rgba(255, 50, 50, 0.6);
}

/* Skryjeme to na PC (pokud nemají dotykovou obrazovku) */
@media (hover: hover) and (pointer: fine) {
    #mobile-vehicle-controls {
        display: none !important;
    }
}

/* === REŽIM ŘÍZENÍ: AGRESIVNÍ SKRÝVÁNÍ === */
body.driving-mode #chat-ui,
body.driving-mode #bottom-bar,
body.driving-mode .bottom-bar,
body.driving-mode #room-info-panel,
body.driving-mode #inventory-ui,
body.driving-mode .action-btn-group,
body.driving-mode #toggle-status-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Ujistěte se, že mobilní ovládání má vysoký zindex */
#mobile-vehicle-controls {
    z-index: 999999 !important;
}

/* Zvětšení dotykové plochy tlačítek pro lepší reakci */
.ctrl-btn::after {
    content: '';
    position: absolute;
    top: -10px; left: -10px; right: -10px; bottom: -10px;
}
body.driving-mode #chat-box, 
body.driving-mode #chat-ui, 
body.driving-mode .bottom-bar {
    display: none !important;
}

/* Kontejner pro položky v obchodě */
.shop-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;      /* Všechny položky zůstanou v jedné řadě */
    justify-content: center;
    gap: 10px;              /* Menší mezera mezi položkami */
    padding: 10px;
    width: 100%;
    overflow-x: hidden;     /* Pokud jsou položky malé, scroll není potřeba */
}

/* Zmenšená karta jednotlivé položky */
.shop-item-card {
    flex: 0 0 130px;        /* Zmenšena šířka ze 160px na 130px */
    min-height: 180px;      /* Snížena minimální výška */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.08); /* Jemnější pozadí */
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 8px;      /* Kompaktnější vnitřní prostor */
    transition: transform 0.2s;
}

/* Zmenšení ikon/obrázků uvnitř karet */
.shop-item-card i, 
.shop-item-card img {
    font-size: 24px;        /* Menší ikony feather */
    width: 45px;            /* Menší náhledové obrázky */
    height: 45px;
    margin-bottom: 8px;
}

/* Úprava textů v kartě */
.shop-item-card h4 {
    font-size: 0.85em;      /* Menší písmo pro název */
    margin: 5px 0;
    text-align: center;
    line-height: 1.2;
}

.shop-item-card .price-tag {
    font-size: 0.8em;
    font-weight: bold;
    color: #f1c40f;         /* Zlatá barva pro cenu */
    margin-bottom: 8px;
}

/* Zmenšení tlačítka Koupit */
.shop-item-card .buy-btn {
    width: 100%;
    padding: 6px 0;
    font-size: 0.75em;
    border-radius: 6px;
}

/* ═══════════════════════════════════════════
   ROOM LIST – Lobby-style dark theme
═══════════════════════════════════════════ */
#room-selection-container {
    background: rgba(10,10,10,0.85);
    backdrop-filter: blur(20px);
}
.room-sel-panel {
    background: #141414;
    border: 1px solid #222;
    border-radius: 16px;
    max-width: 520px;
    width: 92%;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 90vh;
    overflow-y: auto;
}
.room-sel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.room-sel-header h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #f0f0f0;
    text-shadow: none;
    text-transform: uppercase;
    margin: 0;
}
.room-sel-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: #888;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.room-sel-close:hover {
    background: rgba(255,255,255,0.1);
    color: #f0f0f0;
    border-color: #333;
}
.room-sel-search {
    background: rgba(255,255,255,0.04);
    border: 1px solid #222;
    border-radius: 10px;
    color: #f0f0f0;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    padding: 11px 14px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.room-sel-search:focus {
    border-color: #c8ff00;
    box-shadow: 0 0 10px rgba(200,255,0,0.1);
}
.room-sel-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
    max-height: 45vh;
    overflow-y: auto;
}
.room-sel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.03);
    border: 1px solid #222;
    border-radius: 10px;
    padding: 10px 14px;
    transition: all 0.2s;
}
.room-sel-item:hover {
    background: rgba(200,255,0,0.04);
    border-color: rgba(200,255,0,0.25);
}
.room-sel-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: 'Inter', sans-serif;
}
.room-sel-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f0f0f0;
}
.room-sel-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: #888;
}
.room-sel-item-meta .friend-indicator {
    color: #c8ff00;
}
.room-sel-item .room-sel-join {
    background: #c8ff00;
    color: #000;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.room-sel-item .room-sel-join:hover {
    box-shadow: 0 0 15px rgba(200,255,0,0.3);
    transform: translateY(-1px);
}
.room-sel-item .room-sel-full {
    color: #ff3e8e;
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
}
.room-sel-divider {
    border: none;
    border-top: 1px solid #222;
    margin: 4px 0;
    height: 0;
}
.room-sel-create-btn,
.room-sel-go-btn {
    background: transparent;
    color: #c8ff00;
    border: 1px solid rgba(200,255,0,0.25);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.room-sel-create-btn:hover,
.room-sel-go-btn:hover {
    background: rgba(200,255,0,0.08);
    border-color: #c8ff00;
}