/* ============================================
   StarSong Orchestra — Global Styles
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a1a;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    color: #e0e0ff;
}

#canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#ui-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

#ui-overlay > * {
    pointer-events: auto;
}

#toolbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    background: rgba(10, 10, 30, 0.75);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    z-index: 20;
}

#toolbar button, #toolbar select {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #e0e0ff;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

#toolbar button:hover, #toolbar select:hover {
    background: rgba(255,255,255,0.2);
}

#bpm-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

#bpm-slider {
    width: 120px;
    accent-color: #7b8cff;
}

#bpm-value {
    min-width: 30px;
    text-align: center;
    font-weight: bold;
    color: #7b8cff;
}

#toolbar-right {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

#music-editor {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(10, 10, 30, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 16px 24px 24px;
    transition: transform 0.35s ease, opacity 0.35s ease;
    z-index: 30;
}

#music-editor.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

#editor-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

#editor-planet-name {
    font-size: 18px;
    font-weight: 600;
    color: #c0c8ff;
}

#instrument-select {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    color: #e0e0ff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
}

#btn-close-editor {
    margin-left: auto;
    background: rgba(255,80,80,0.25);
    border: 1px solid rgba(255,80,80,0.4);
    color: #ff8888;
    width: 32px; height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#btn-close-editor:hover {
    background: rgba(255,80,80,0.45);
}

#editor-grid {
    display: grid;
    gap: 3px;
    user-select: none;
}

.grid-cell {
    width: 100%;
    aspect-ratio: 1 / 0.6;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: background 0.12s, transform 0.1s;
}

.grid-cell:hover {
    background: rgba(255,255,255,0.15);
    transform: scale(1.05);
}

.grid-cell.active {
    background: var(--cell-color, rgba(120,140,255,0.7));
    border-color: var(--cell-color-bright, rgba(140,160,255,0.9));
    box-shadow: 0 0 6px var(--cell-color, rgba(120,140,255,0.5));
}

.grid-cell.current-step {
    border-color: rgba(255,255,255,0.6);
    box-shadow: inset 0 0 8px rgba(255,255,255,0.15);
}

#start-hint {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    cursor: pointer;
    transition: opacity 0.5s;
}

#start-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

#start-hint p {
    font-size: 24px;
    color: #c0c8ff;
    text-shadow: 0 0 20px rgba(120,140,255,0.6);
    animation: pulse-hint 2s infinite ease-in-out;
}

@keyframes pulse-hint {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* ---- Screen-reader only (a11y) ---- */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}
