/* ============================================
   MAIN CSS - Основные стили
   ============================================ */

:root {
    --bg-darkest: #0a0a12;
    --bg-dark: #12121f;
    --bg-panel: #1a1a2e;
    --bg-card: #242442;
    --bg-hover: #2e2e52;
    
    --accent: #ffc107;
    --accent-light: #ffda6a;
    --accent-dark: #e6ac00;
    --accent-glow: rgba(255, 193, 7, 0.5);
    
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f97316;
    --info: #3b82f6;
    
    --text: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

audio {
    display: none !important;
    pointer-events: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-darkest);
    color: var(--text);
    overflow: hidden;
    display: flex;
    height: 100vh;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.panel {
    width: 290px;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border: 1px solid var(--border);
    z-index: 10;
}

.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-track { background: var(--bg-dark); }
.panel::-webkit-scrollbar-thumb { 
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%); 
    border-radius: 3px; 
}
.panel::-webkit-scrollbar-thumb:hover { 
    background: var(--accent-light); 
}

.panel-left {
    border-right: 2px solid var(--accent);
    box-shadow: 5px 0 30px rgba(0,0,0,0.5);
}

.panel-right {
    width: 260px;
    border-left: 2px solid var(--accent);
    box-shadow: -5px 0 30px rgba(0,0,0,0.5);
}
.panel-header {
    padding: 12px;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-panel) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-brick {
    width: 32px;
    height: 18px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.logo-stud {
    width: 7px;
    height: 7px;
    background: var(--accent-light);
    border-radius: 50%;
}

.logo-text {
    font-size: 14px;
    font-weight: 900;
}

.logo-text span { color: var(--accent); }
.coins-display {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-card);
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    color: var(--accent);
}

.coins-icon { font-size: 14px; }
.panel-section {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.section-title:hover { color: var(--accent); }

.section-title svg {
    width: 12px;
    height: 12px;
    stroke: var(--accent);
    fill: none;
    flex-shrink: 0;
}

.toggle-icon {
    margin-left: auto;
    font-size: 8px;
    transition: transform 0.3s;
}

.section-title.collapsed .toggle-icon { transform: rotate(-90deg); }

.pieces-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    transition: max-height 0.3s, opacity 0.3s;
}

.pieces-list.collapsed {
    max-height: 0 !important;
    opacity: 0;
}
.viewport {
    flex: 1;
    position: relative;
    background: var(--bg-dark);
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
}
#fx-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 100;
}

.flying-orb {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
    z-index: 1000;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
}
#toast-container {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.warning { border-color: var(--warning); color: var(--warning); }
.achievement-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-panel) 100%);
}

.achievement-toast .achievement-icon {
    font-size: 28px;
}

.achievement-toast .achievement-info {
    flex: 1;
}

.achievement-toast .achievement-title {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.achievement-toast .achievement-name {
    font-weight: 700;
    color: var(--accent);
}

.achievement-toast .achievement-reward {
    font-weight: 700;
    color: var(--success);
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */
@media (max-width: 1200px) {
    .panel { width: 260px; }
    .panel-right { width: 240px; }
    
    .piece-btn {
        padding: 5px 6px;
        font-size: 10px;
    }
    
    .piece-icon { width: 20px; height: 14px; }
    
    .toolbar {
        padding: 4px 8px;
        gap: 6px;
    }
    
    .btn-tool { width: 28px; height: 28px; }
    .stat-box { padding: 2px 8px; }
    .stat-number { font-size: 14px; }
}
@media (max-width: 900px) {
    body {
        flex-direction: column;
    }
    
    .panel {
        width: 100%;
        height: auto;
        max-height: 35vh;
        border: none;
    }
    
    .panel-left {
        order: 2;
        border-right: none;
        border-top: 2px solid var(--accent);
        box-shadow: 0 -5px 30px rgba(0,0,0,0.5);
    }
    
    .panel-right {
        order: 3;
        width: 100%;
        border-left: none;
        border-top: 2px solid var(--accent);
        box-shadow: 0 -5px 30px rgba(0,0,0,0.5);
        display: none; 
    }
    
    .viewport {
        order: 1;
        height: 50vh;
        min-height: 300px;
    }
    
    .pieces-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
    
    .piece-btn {
        flex-direction: column;
        padding: 6px;
        text-align: center;
    }
    
    .piece-name { font-size: 9px; }
    .piece-hotkey { display: none; }
    
    .panel-section { padding: 8px; }
    
    .toolbar {
        top: 5px;
        padding: 4px 6px;
        gap: 4px;
    }
    
    .toolbar-group.actions { display: none; }
    
    .hints-bar { display: none; }
    
    .main-btn-row {
        flex-wrap: wrap;
    }
}
@media (max-width: 600px) {
    .panel-left {
        max-height: 40vh;
    }
    
    .viewport {
        height: 45vh;
    }
    
    .pieces-list {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .toolbar {
        width: calc(100% - 20px);
        justify-content: center;
    }
    
    .toolbar-group.stats { display: none; }
    
    .btn-tool { width: 36px; height: 36px; }
    
    .selection-bar {
        width: calc(100% - 40px);
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        padding: 16px;
    }
    
    .shop-items {
        grid-template-columns: 1fr;
    }
    
    .achievement-group-items {
        gap: 4px;
    }
    
    .achievement-item {
        padding: 8px;
    }
    
    .achievement-item-icon { font-size: 20px; width: 28px; }
    .achievement-item-name { font-size: 11px; }
    .achievement-item-desc { font-size: 9px; }
}
@media (max-height: 500px) and (orientation: landscape) {
    body {
        flex-direction: row;
    }
    
    .panel {
        width: 200px;
        height: 100vh;
        max-height: none;
    }
    
    .panel-left {
        order: 1;
        border-top: none;
        border-right: 2px solid var(--accent);
    }
    
    .viewport {
        order: 2;
        height: 100vh;
    }
    
    .panel-right {
        display: none;
    }
}

@media (max-width: 500px) {
    .panel {
        width: 100%;
        max-height: 35vh;
    }
    
    .panel-section {
        padding: 8px;
    }
    
    .section-title {
        font-size: 9px;
        gap: 4px;
    }
    
    .section-title svg {
        width: 10px;
        height: 10px;
    }
    
    .toggle-icon {
        font-size: 7px;
    }
}

@media (max-width: 360px) {
    .panel {
        max-height: 40vh;
    }
    
    .panel-section {
        padding: 6px;
    }
    
    .section-title {
        font-size: 8px;
        margin-bottom: 6px;
    }
    
    .logo-text {
        font-size: 12px;
    }
    
    .coins-display {
        font-size: 11px;
        padding: 3px 8px;
    }
}
