/* ============================================================
   Kids Kingdom - Pro Xylophone
   Dark professional theme (matches Pro Harmonica), full
   chromatic layout: 15 natural bars (2 octaves) + 10 sharp bars
   in a secondary row above, physical-modeling bar colours,
   Learn Mode glow states, particle effects.
   ============================================================ */

.xylo-wrap {
    --xylo-bg:      #0a0f1e;
    --xylo-surface: #111827;
    --xylo-card:    #1a2035;
    --xylo-border:  #2a3550;
    --xylo-accent:  #3b82f6;
    --xylo-green:   #10b981;
    --xylo-text:    #e2e8f0;
    --xylo-muted:   #64748b;

    background: var(--xylo-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 60px rgba(59,130,246,0.15);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 30px auto;
}

/* ================= TOOLBAR ================= */
.xylo-toolbar {
    background: var(--xylo-surface);
    border-bottom: 1px solid var(--xylo-border);
    padding: 14px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.xylo-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.xylo-tab-btn {
    background: var(--xylo-card);
    color: var(--xylo-muted);
    border: 1px solid var(--xylo-border);
    border-radius: 30px;
    padding: 7px 16px;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.xylo-tab-btn:hover,
.xylo-tab-btn.active {
    background: var(--xylo-accent);
    color: #fff;
    border-color: var(--xylo-accent);
    box-shadow: 0 0 14px rgba(59,130,246,0.4);
}

.xylo-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.xylo-ctrl {
    display: flex;
    align-items: center;
    gap: 6px;
}

.xylo-ctrl label {
    color: var(--xylo-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.xylo-ctrl input[type="range"] {
    width: 80px;
    accent-color: var(--xylo-accent);
}

/* ================= SONGS PANEL ================= */
.xylo-songs-panel {
    display: none;
    padding: 14px 18px;
    border-bottom: 1px solid var(--xylo-border);
    flex-wrap: wrap;
    gap: 8px;
}

.xylo-songs-panel.active { display: flex; }

.xylo-song-btn {
    background: var(--xylo-card);
    color: var(--xylo-text);
    border: 1px solid var(--xylo-border);
    border-radius: 20px;
    padding: 7px 16px;
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.xylo-song-btn:hover { border-color: var(--xylo-accent); color: var(--xylo-accent); }

.xylo-song-btn.playing {
    background: var(--xylo-accent);
    color: #fff;
    border-color: var(--xylo-accent);
}

/* ================= LEARN MODE PANEL ================= */
.xylo-learn-panel {
    display: none;
    padding: 14px 18px;
    border-bottom: 1px solid var(--xylo-border);
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

.xylo-learn-panel.active { display: flex; }

.xylo-learn-stat {
    background: var(--xylo-card);
    border: 1px solid var(--xylo-border);
    border-radius: 12px;
    padding: 8px 16px;
    text-align: center;
    min-width: 70px;
}

.xylo-learn-stat .num {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--xylo-accent);
}

.xylo-learn-stat .lbl {
    font-size: 0.65rem;
    color: var(--xylo-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.xylo-learn-start-btn {
    background: var(--xylo-green);
    color: #06281c;
    border: none;
    border-radius: 20px;
    padding: 9px 22px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.85rem;
    cursor: pointer;
}

.xylo-learn-msg {
    color: var(--xylo-muted);
    font-size: 0.8rem;
    flex: 1 1 200px;
}

/* ================= BAR AREA ================= */
.xylo-body-wrap {
    padding: 24px 18px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sharp bars row (secondary, smaller, darker - like piano black keys) */
.xylo-sharps-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 10px;
    min-width: 640px;
}

.xylo-bar-sharp {
    flex: 1 1 0;
    max-width: 44px;
    height: 70px;
    border-radius: 6px 6px 3px 3px;
    background: linear-gradient(180deg, #4c1d95 0%, #3b1370 100%);
    border: 1px solid #6d28d9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 6px;
    cursor: pointer;
    color: #d8b4fe;
    font-size: 0.62rem;
    font-weight: 800;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
    transition: transform 0.08s, filter 0.08s;
}

.xylo-bar-sharp:hover { filter: brightness(1.2); }
.xylo-bar-sharp.is-active { transform: translateY(3px) scale(0.94); filter: brightness(1.5); box-shadow: 0 0 16px #a78bfa; }
.xylo-bar-sharp.is-glowing { animation: xyloGlowPulse 0.9s ease-in-out infinite; }

/* Natural bars row (primary, larger, colourful gradient) */
.xylo-naturals-row {
    display: flex;
    gap: 4px;
    justify-content: center;
    min-width: 640px;
}

.xylo-bar {
    flex: 1 1 0;
    max-width: 58px;
    height: 170px;
    border-radius: 8px 8px 4px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 8px;
    cursor: pointer;
    position: relative;
    border: none;
    box-shadow:
        inset 0 3px 0 rgba(255,255,255,0.25),
        inset 0 -6px 10px rgba(0,0,0,0.35),
        0 6px 16px rgba(0,0,0,0.5);
    transition: transform 0.08s ease, filter 0.08s ease;
    background: var(--bar-color, #3b82f6);
}

.xylo-bar:hover { filter: brightness(1.1); }

.xylo-bar.is-active {
    transform: translateY(4px) scale(0.96);
    filter: brightness(1.4);
}

.xylo-bar.is-glowing {
    animation: xyloGlowPulse 0.9s ease-in-out infinite;
}

@keyframes xyloGlowPulse {
    0%, 100% { box-shadow: 0 0 8px 2px rgba(255,255,255,0.3), inset 0 3px 0 rgba(255,255,255,0.25); }
    50%      { box-shadow: 0 0 26px 8px rgba(255,255,255,0.85), inset 0 3px 0 rgba(255,255,255,0.5); }
}

.xylo-bar-note {
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.78rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    pointer-events: none;
}

.xylo-bar-key {
    color: rgba(255,255,255,0.75);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 1px;
    pointer-events: none;
}

.xylo-key-hint {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 14px 18px 18px;
    color: var(--xylo-muted);
    font-size: 0.75rem;
}

.xylo-body-wrap::-webkit-scrollbar { height: 4px; }
.xylo-body-wrap::-webkit-scrollbar-track { background: var(--xylo-surface); }
.xylo-body-wrap::-webkit-scrollbar-thumb { background: var(--xylo-border); border-radius: 2px; }

.xylo-particle-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
    .xylo-toolbar { padding: 10px 14px; }
    .xylo-tab-btn { padding: 6px 12px; font-size: 0.78rem; }
    .xylo-body-wrap { padding: 16px 10px 8px; }
    .xylo-naturals-row, .xylo-sharps-row { min-width: 520px; }
    .xylo-bar { height: 130px; }
    .xylo-bar-sharp { height: 56px; }
    .xylo-bar-note { font-size: 0.66rem; }
}

@media (max-width: 480px) {
    .xylo-naturals-row, .xylo-sharps-row { min-width: 440px; }
    .xylo-bar { height: 105px; }
    .xylo-bar-sharp { height: 46px; }
    .xylo-bar-note { font-size: 0.58rem; }
    .xylo-bar-key { font-size: 0.52rem; }
}
