:root {
    --glass-bg: rgba(20, 20, 28, 0.95);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.05);
    --neon-blue: #00f2ea;
    --neon-pink: #ff0050;
    --text-main: #ffffff;
    --text-dim: #888888;
}

.itm-station-wrapper {
    width: 100%; max-width: 1000px; margin: 0 auto;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background: #050505; 
    padding: 4px; border-radius: 12px;
    box-sizing: border-box; overflow: hidden;
}

.itm-station-wrapper * { box-sizing: border-box; user-select: none; }

/* --- GLASS PANEL --- */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px; padding: 15px;
}

/* --- TOP BAR --- */
.station-controls-bar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; background: rgba(255,255,255,0.03);
    padding: 10px 15px; border-radius: 8px; border: 1px solid var(--glass-border);
    gap: 10px;
}

.control-unit { display: flex; align-items: center; gap: 15px; }

.knob-group { 
    display: flex; flex-direction: column; align-items: flex-end; width: 150px; 
    flex-grow: 1; /* Allow stretching on mobile */
    max-width: 200px; /* But not too much */
}
.knob-group label { font-size: 0.7rem; color: var(--text-dim); letter-spacing: 1px; width: 100%; display: flex; justify-content: space-between; margin-bottom: 5px; }
.knob-group label span { color: var(--neon-blue); }

.mini-range { 
    width: 100%; height: 6px; -webkit-appearance: none; background: #333; border-radius: 3px; 
}
.mini-range::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; background: var(--neon-blue); border-radius: 50%; cursor: pointer; box-shadow: 0 0 5px var(--neon-blue);
}

/* --- MODULES --- */
.modules-container { display: flex; flex-direction: column; gap: 20px; }

.station-module {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px; padding: 10px;
}

/* HEADER WITH TOGGLE BUTTONS */
.module-header-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-wrap: wrap; gap: 10px;
}

/* Toggle Groups */
.btn-group-toggle {
    display: flex; background: #111; border-radius: 4px; padding: 2px;
}
.toggle-btn {
    background: transparent; border: none; color: #666; 
    padding: 6px 12px; font-size: 0.75rem; font-weight: bold; cursor: pointer;
    border-radius: 2px; transition: all 0.2s;
}
.toggle-btn:hover { color: #fff; }
.toggle-btn.active { background: var(--glass-highlight); color: var(--neon-blue); box-shadow: 0 0 5px rgba(0, 242, 234, 0.2); }

.module-actions { display: flex; align-items: center; gap: 8px; }

/* Utility Buttons */
.glass-btn, .glass-btn-sm {
    background: #222; border: 1px solid #333; color: #ddd; 
    cursor: pointer; border-radius: 4px; transition: all 0.2s; font-family: inherit;
}
.glass-btn { padding: 8px 25px; font-weight: bold; }
.glass-btn-sm { padding: 5px 10px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; }

.glass-btn:hover, .glass-btn-sm:hover {
    background: #333; border-color: #555; color: #fff;
}

.play-hero { border-color: var(--neon-blue); color: var(--neon-blue); background: rgba(0, 242, 234, 0.05); }
.play-hero.active { background: var(--neon-blue); color: #000; box-shadow: 0 0 15px var(--neon-blue); }

/* --- BEAT GRID --- */
.beat-grid { display: flex; flex-direction: column; gap: 4px; }
.channel-row { display: flex; align-items: center; gap: 8px; }
.channel-name { 
    width: 50px; font-size: 0.7rem; font-weight: bold; color: #888; text-align: right; 
}
.step-container { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; flex-grow: 1; }
.step-btn {
    height: 30px; background: #2a2a2a; border: none; border-radius: 2px; cursor: pointer;
}
.step-btn:nth-child(4n+1) { background: #333; }
.step-btn.active { background: var(--neon-pink); box-shadow: 0 0 5px var(--neon-pink); }
.step-btn.playing { filter: brightness(1.8); }

/* --- PIANO --- */
.piano-scroll-wrapper { width: 100%; overflow: auto; padding: 10px 0; }
.piano-keys-area {
    display: flex; position: relative; height: 140px; min-width: 100%;
}
.key {
    flex: 1; margin: 0 1px; z-index: 1; cursor: pointer; position: relative;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 3px rgba(0,0,0,0.5);
    transition: transform 0.1s, background 0.1s;
}

/* White Key */
.key.white {
    background: linear-gradient(to bottom, #f9f9f9 0%, #e0e0e0 100%);
    border: 1px solid #ccc; border-top: none;
    height: 100%;
}
.key.white:active, .key.white.active {
    background: linear-gradient(to bottom, #eee 0%, #ccc 100%);
    transform: translateY(2px);
    border-bottom: 4px solid var(--neon-blue); 
}

/* Black Key */
.key.black {
    background: linear-gradient(to bottom, #333 0%, #000 100%);
    height: 65%; width: 6%; margin-left: -3%; margin-right: -3%; z-index: 2;
    border-radius: 0 0 3px 3px;
    border: 1px solid #000;
    box-shadow: 2px 2px 2px rgba(0,0,0,0.6);
}
.key.black:active, .key.black.active {
    background: #000;
    transform: translateY(2px);
    border-bottom: 3px solid var(--neon-blue);
}

/* --- FOOTER & TOAST --- */
.station-footer {
    margin-top: 10px; display: flex; justify-content: flex-end; 
    font-size: 0.75rem; color: #555;
}
.itm-toast {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: #fff; color: #000; padding: 8px 16px; font-weight: bold; font-size: 0.8rem;
    border-radius: 20px; pointer-events: none; opacity: 0; transition: opacity 0.3s; z-index: 100;
}
.itm-toast.show { opacity: 1; }

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    /* Better Header Alignment */
    .station-controls-bar {
        flex-direction: row; /* Ensure row direction */
        flex-wrap: nowrap;   /* No wrapping */
        justify-content: space-between;
    }
    
    .glass-btn { padding: 8px 15px; } /* Smaller buttons on mobile */
    .control-unit { gap: 8px; }
    
    /* Module Header Adjustments */
    .module-header-row { justify-content: space-between; gap: 15px; }
    .btn-group-toggle { order: 2; width: 100%; justify-content: center; margin-top: 5px; }
    .module-actions { order: 1; width: 100%; justify-content: space-between; }
    .toggle-btn { flex-grow: 1; text-align: center; }
}