:root {
    --color-accent: #6366f1;
    --color-accent-alt: #f472b6;
    --color-success: #4ade80;
    --color-danger: #ef4444;
    --color-panel: #2a2a3e;
    --color-panel-hover: #3a3a5e;
    --color-muted: #888;
    --color-bg: #1a1a2e;
}

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

body {
    font-family: system-ui, sans-serif;
    background: var(--color-bg);
    color: #eee;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
}

.container {
    width: min(420px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px;
}

h1 { font-size: 1.4rem; text-align: center; }

.status {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-muted);
}
.status.connected { color: var(--color-success); }

/* ---- file picker ---- */

.file-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border: 2px dashed #444;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.file-area:hover,
.file-area.dragover { border-color: var(--color-accent); }
.file-area input { display: none; }
.file-name { font-size: 0.85rem; color: #aaa; }

/* ---- player ---- */

.player { display: flex; flex-direction: column; gap: 8px; }

.player-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-round {
    border-radius: 50%;
    border: none;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-round:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-play {
    width: 40px; height: 40px;
    background: var(--color-accent);
    font-size: 1.1rem;
}

.btn-nav {
    width: 32px; height: 32px;
    background: var(--color-panel-hover);
    font-size: 0.7rem;
}
.btn-nav:disabled { opacity: 0.3; }

.seek-bar {
    flex: 1;
    accent-color: var(--color-accent);
    height: 6px;
}

.time-label {
    font-size: 0.75rem;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
    min-width: 90px;
    text-align: right;
}

.track-list {
    list-style: none;
    max-height: 120px;
    overflow-y: auto;
    border-radius: 6px;
    background: var(--color-panel);
}
.track-list:empty { display: none; }
.track-list li {
    padding: 6px 10px;
    font-size: 0.8rem;
    color: #aaa;
    cursor: pointer;
    border-bottom: 1px solid #333;
}
.track-list li:last-child { border-bottom: none; }
.track-list li:hover { background: var(--color-panel-hover); }
.track-list li.active { color: #fff; background: var(--color-accent); }

/* ---- meter ---- */

.meter-container {
    position: relative;
    height: 32px;
    background: var(--color-panel);
    border-radius: 8px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #eab308, var(--color-danger));
    border-radius: 8px;
    transition: width 60ms linear;
}

.meter-gate {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: #fff8;
}

.meter-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-muted);
}

/* ---- motor display ---- */

.motor-display {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.motor-unit {
    text-align: center;
    flex: 1;
    padding: 10px 8px;
    background: var(--color-panel);
    border-radius: 8px;
}

.motor-dir {
    font-size: 1.5rem;
    line-height: 1;
    color: #555;
    transition: color 0.12s;
}
.motor-dir.cw  { color: var(--color-accent); }
.motor-dir.ccw { color: var(--color-accent-alt); }

.motor-speed-val {
    font-size: 2.2rem;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.motor-unit-label {
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- controls ---- */

.controls { display: flex; flex-direction: column; gap: 12px; }

.controls label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

input[type=range] { width: 55%; accent-color: var(--color-accent); }

/* ---- action button ---- */

button.btn-action {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
button.btn-action:active { opacity: 0.8; }

.btn-connect { background: var(--color-accent); color: #fff; }
.btn-connect.active { background: var(--color-danger); }

button.btn-action:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- footer ---- */

.footer {
    text-align: center;
    padding: 16px 0;
    font-size: 0.8rem;
    color: var(--color-muted);
}

.footer a {
    color: var(--color-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.footer a:hover { color: #eee; }
