:root {
    --bg-dark: #0a0a0c;
    --panel-bg: rgba(20, 20, 25, 0.7);
    --primary: #00ffcc;
    --primary-glow: rgba(0, 255, 204, 0.4);
    --secondary: #ff0055;
    --secondary-glow: rgba(255, 0, 85, 0.4);
    --accent: #bd00ff;
    --text: #e0e0e0;
    --text-muted: #666;
    --border: 1px solid rgba(255, 255, 255, 0.1);
    --surface: #151518;

    /* 字体 */
    --font-heading: 'Orbitron', sans-serif;
    --font-ui: 'Rajdhani', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    outline: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text);
    font-family: var(--font-ui);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    min-width: 1024px;
    overflow-x: auto;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* --- 布局 --- */
.app-container {
    display: grid;
    grid-template-rows: 80px 1fr;
    height: 100%;
}

/* --- 顶部控制栏 --- */
.control-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 10;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    min-width: 1024px;
    flex-shrink: 0;
}

.brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand small {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-family: var(--font-ui);
    letter-spacing: 2px;
    margin-left: 5px;
}

/* 中间控制区 */
.center-controls {
    display: flex;
    align-items: center;
    gap: 30px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 20px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.transport-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.divider {
    width: 1px;
    height: 20px;
    background: #333;
    margin: 0 5px;
}

/* 按钮样式 */
.control-btn {
    background: linear-gradient(145deg, #1e1e24, #151518);
    border: none;
    color: var(--text);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 5px 5px 10px #0b0b0e, -5px -5px 10px #25252e;
    display: flex;
    justify-content: center;
    align-items: center;
}

.control-btn:hover {
    color: var(--primary);
    transform: translateY(-2px);
}

.control-btn:active {
    box-shadow: inset 3px 3px 6px #0b0b0e, inset -3px -3px 6px #25252e;
    transform: translateY(0);
}

.control-btn.active {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px var(--primary-glow);
}

#btn-stop:hover {
    color: var(--secondary);
}

#btn-clear:hover {
    color: var(--secondary);
}

/* 分页器 */
.page-selector {
    display: flex;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #333;
}

.page-btn {
    width: 35px;
    height: 28px;
    background: transparent;
    border: none;
    color: #444;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.8rem;
    transition: 0.2s;
    border-right: 1px solid #111;
}

.page-btn:hover {
    color: #fff;
    background: #111;
}

.page-btn.active {
    background: var(--primary);
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 15px var(--primary-glow);
    z-index: 1;
}

/* 参数控制区 */
.param-controls {
    display: flex;
    gap: 20px;
    align-items: center;
}

.knob-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #888;
}

#bpm-input {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    width: 80px;
    text-align: center;
    padding: 5px;
    transition: border-color 0.3s;
}

#bpm-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.2);
}

#preset-select {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 1px solid #333;
    padding: 8px 15px;
    border-radius: 4px;
    font-family: var(--font-ui);
    cursor: pointer;
    outline: none;
}

#preset-select:hover {
    border-color: var(--primary);
}

/* --- 主视图 --- */
.sequencer-view {
    display: flex;
    position: relative;
    background: #050505;
}

.track-labels {
    width: 160px;
    background: var(--surface);
    border-right: 1px solid #222;
    display: flex;
    flex-direction: column;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.label-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    font-size: 0.85rem;
    transition: background 0.2s;
}

.label-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.label-text {
    font-weight: 700;
    letter-spacing: 1px;
}

.label-item.drum {
    border-left: 4px solid var(--secondary);
}

.label-item.bass {
    border-left: 4px solid var(--accent);
}

.label-item.synth {
    border-left: 4px solid var(--primary);
}

.track-actions {
    display: flex;
    gap: 5px;
}

.mini-btn {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #333;
    background: #111;
    color: #555;
    font-size: 10px;
    font-family: var(--font-heading);
    transition: 0.2s;
}

.mini-btn:hover {
    border-color: #666;
    color: #fff;
}

.mini-btn.mute.active {
    background: var(--secondary);
    color: #fff;
    box-shadow: 0 0 8px var(--secondary-glow);
    border-color: var(--secondary);
}

.mini-btn.solo.active {
    background: #ffaa00;
    color: #000;
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
    border-color: #ffaa00;
}

/* 画布区域 */
.canvas-wrapper {
    flex: 1;
    position: relative;
    background: #08080a;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

.vignette {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.6) 100%);
}

/* --- 启动页 Overlay (炫酷版) --- */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    background: #000;
    overflow: hidden;
    /* 防止 Canvas 溢出 */
}

/* 新增：启动页动态背景 Canvas */
#landing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.8;
}

.overlay-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 50% 50%, rgba(0, 255, 204, 0.05) 0%, transparent 50%),
        linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(10, 10, 12, 0.8) 100%);
    z-index: -1;
    opacity: 0.5;
    /* 调低不透明度，让波形显示 */
}

.overlay-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    z-index: 2;
    /* 确保内容在波形上方 */
    position: relative;
}

.logo-large {
    font-size: 4rem;
    font-family: var(--font-heading);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px var(--primary-glow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: fadeInDown 1s ease-out;
}

.logo-large i {
    color: var(--primary);
    font-size: 3rem;
    margin-bottom: 10px;
}

.subtitle {
    font-family: var(--font-ui);
    letter-spacing: 5px;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 30px;
    text-transform: uppercase;
}

#btn-start {
    padding: 18px 60px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
    text-shadow: 0 0 8px var(--primary-glow);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.1);
}

#btn-start:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 40px var(--primary-glow);
    text-shadow: none;
    transform: scale(1.05);
}

/* 滑块样式 */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 4px;
    background: #333;
    border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary);
    margin-top: -4px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}