* {
    box-sizing: border-box;
}


:root {

    --bg: #242832;
    --panel: #2b2f39;
    --panel-2: #323742;

    --border: #414652;

    --text: #e9ebef;
    --muted: #9ba1ad;

    --accent: #7c6cff;
    --accent-2: #9b8fff;

    --key-height: 28px;
    --beat-width: 90px;

}


html,
body {

    width: 100%;
    height: 100%;

    margin: 0;

    overflow: hidden;

}


body {

    background: var(--bg);

    color: var(--text);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "PingFang SC",
        "Microsoft YaHei",
        sans-serif;

    user-select: none;

}


button,
input,
select {

    font: inherit;

}


/* =========================================================
   Topbar
========================================================= */

.topbar {

    height: 62px;

    display: flex;
    align-items: center;

    padding: 0 18px;

    border-bottom: 1px solid var(--border);

    background: #2b2f39;

}


.brand {

    width: 230px;

    display: flex;
    align-items: center;

    gap: 10px;

}


.brand-mark {

    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    border-radius: 9px;

    background: #fff;

    color: #242832;

    font-size: 11px;
    font-weight: 900;

}


.brand-name {

    display: flex;
    flex-direction: column;

    gap: 2px;

}


.brand-name strong {

    font-size: 13px;

}


.brand-name span {

    color: #9ba1ad;

    font-size: 9px;

    letter-spacing: .08em;

    text-transform: uppercase;

}


.transport {

    display: flex;
    align-items: center;

    gap: 6px;

}


.transport-button {

    width: 34px;
    height: 34px;

    display: grid;
    place-items: center;

    border: 1px solid #414652;
    border-radius: 7px;

    background: #343944;

    color: #b9bdc7;

    cursor: pointer;

}


.transport-button:hover {

    background: #414652;

    color: white;

}


.transport-button.play {

    background: var(--accent);

    border-color: var(--accent);

    color: white;

}


.transport-divider {

    width: 1px;
    height: 25px;

    margin: 0 8px;

    background: var(--border);

}


.tempo-control {

    height: 34px;

    display: flex;
    align-items: center;

    gap: 7px;

    padding: 0 9px;

    border: 1px solid #414652;
    border-radius: 7px;

    background: #343944;

}


.tempo-control span {

    color: #9ba1ad;

    font-size: 10px;

}


.tempo-control input {

    width: 45px;

    border: 0;
    outline: 0;

    background: transparent;

    color: white;

    font-size: 12px;

}


.time-signature,
#quantizeSelect {

    height: 34px;

    display: flex;
    align-items: center;

    padding: 0 10px;

    border: 1px solid #414652;
    border-radius: 7px;

    background: #343944;

    color: #bfc3cb;

    font-size: 11px;

}


.top-actions {

    margin-left: auto;

    display: flex;
    align-items: center;

    gap: 8px;

}


.action-button,
.file-button {

    height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 13px;

    border: 1px solid #414652;
    border-radius: 7px;

    background: #343944;

    color: #bfc3cb;

    cursor: pointer;

    font-size: 11px;

}


.action-button:hover,
.file-button:hover {

    background: #414652;

}


.action-button.primary {

    border-color: var(--accent);

    background: var(--accent);

    color: white;

}


/* =========================================================
   Workspace
========================================================= */

.workspace {

    height: calc(100vh - 92px);

    display: flex;

}


/* =========================================================
   Track panel
========================================================= */

.track-panel {

    width: 230px;

    flex-shrink: 0;

    display: flex;
    flex-direction: column;

    border-right: 1px solid var(--border);

    background: #292d36;

}


.track-header {

    height: 45px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 13px;

    border-bottom: 1px solid var(--border);

    color: #8e95a2;

    font-size: 9px;
    font-weight: 800;
    letter-spacing: .14em;

}


.track-header button {

    width: 24px;
    height: 24px;

    border: 1px solid #414652;
    border-radius: 5px;

    background: #343944;

    color: #aaaeb8;

    cursor: pointer;

}


.track {

    height: 62px;

    display: flex;
    align-items: center;

    gap: 9px;

    padding: 0 11px;

    border-bottom: 1px solid #373b45;

    cursor: pointer;

}


.track.active {

    background: #353a46;

}


.track-color {

    width: 4px;
    height: 38px;

    border-radius: 3px;

    background: var(--accent);

}


.track-info {

    display: flex;
    flex-direction: column;

    gap: 4px;

}


.track-info strong {

    font-size: 12px;

}


.track-info span {

    color: #8b929f;

    font-size: 9px;

}


.track-more {

    margin-left: auto;

    border: 0;

    background: transparent;

    color: #777e8b;

    cursor: pointer;

}


.track-footer {

    margin-top: auto;

    padding: 10px;

}


.track-footer button {

    width: 100%;
    height: 34px;

    border: 1px dashed #4a505d;
    border-radius: 7px;

    background: transparent;

    color: #9299a5;

    cursor: pointer;

    font-size: 10px;

}


/* =========================================================
   Editor
========================================================= */

.editor {

    min-width: 0;

    flex: 1;

    display: flex;
    flex-direction: column;

    background: #252a33;

}


/* =========================================================
   Timeline
========================================================= */

.timeline {

    height: 45px;

    flex-shrink: 0;

    display: flex;

    border-bottom: 1px solid var(--border);

    background: #303540;

}


.timeline-corner {

    width: 70px;

    flex-shrink: 0;

    border-right: 1px solid var(--border);

}


.timeline-ruler {

    position: relative;

    flex: 1;

    overflow: hidden;

}


.measure {

    position: absolute;

    top: 0;
    bottom: 0;

    border-left: 1px solid #4a4f5b;

}


.measure span {

    position: absolute;

    top: 7px;
    left: 7px;

    color: #8b929f;

    font-size: 9px;

}


.beat-line {

    position: absolute;

    top: 28px;
    bottom: 0;

    width: 1px;

    background: #3c414c;

}


/* =========================================================
   Piano Roll
========================================================= */

.piano-roll {

    min-height: 0;

    flex: 1;

    display: flex;

    overflow: hidden;

}


.piano-keys {

    width: 70px;

    flex-shrink: 0;

    overflow: hidden;

    border-right: 1px solid #17191e;

}


.piano-key {

    position: relative;

    height: var(--key-height);

    display: flex;
    align-items: center;

    padding-left: 8px;

    border-bottom: 1px solid #292c32;

    background: #e5e5e8;

    color: #34363c;

    font-size: 8px;

}


.piano-key.black {

    z-index: 2;

    background: #3c414b;

    color: #c2c6ce;

}


.piano-key.root {

    background: #d7d7da;

    font-weight: 700;

}


.note-area-wrapper {

    min-width: 0;

    flex: 1;

    overflow: auto;

}


.note-area {

    position: relative;

    width: 5000px;

    min-height: 100%;

}


.grid-layer,
.notes-layer {

    position: absolute;

    inset: 0;

}


.grid-layer {

    background-image:
        linear-gradient(to right,
            rgba(255, 255, 255, .09) 1px,
            transparent 1px),
        linear-gradient(to right,
            rgba(255, 255, 255, .035) 1px,
            transparent 1px);

    background-size:
        calc(var(--beat-width) * 4) 100%,
        calc(var(--beat-width) / 4) 100%;

    background-position:
        0 0,
        0 0;

}


.grid-layer::after {

    content: "";

    position: absolute;

    inset: 0;

    background:
        repeating-linear-gradient(to bottom,
            transparent 0,
            transparent calc(var(--key-height) - 1px),
            rgba(255, 255, 255, .045) calc(var(--key-height) - 1px),
            rgba(255, 255, 255, .045) var(--key-height));

}


.note {

    position: absolute;

    height: 24px;

    min-width: 8px;

    display: flex;
    align-items: center;

    padding-left: 7px;

    border: 1px solid rgba(255, 255, 255, .22);

    border-radius: 5px;

    background:
        linear-gradient(90deg,
            #7869ed,
            #9889ff);

    box-shadow:
        0 3px 9px rgba(0, 0, 0, .22);

    color: rgba(255, 255, 255, .9);

    font-size: 8px;

    cursor: grab;

}


.note:hover {

    filter: brightness(1.12);

}


.note.selected {

    border-color: white;

    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .4),
        0 4px 12px rgba(0, 0, 0, .35);

}


.note-handle {

    position: absolute;

    top: 0;
    right: 0;
    bottom: 0;

    width: 6px;

    cursor: ew-resize;

}


.playhead {

    position: absolute;

    top: 0;
    bottom: 0;

    left: 0;

    width: 1px;

    z-index: 20;

    background: #ff596d;

    box-shadow:
        0 0 8px rgba(255, 89, 109, .6);

    pointer-events: none;

}


.playhead::before {

    content: "";

    position: absolute;

    top: -1px;
    left: -4px;

    width: 9px;
    height: 9px;

    border-radius: 50%;

    background: #ff596d;

}


/* =========================================================
   Velocity
========================================================= */

.velocity-panel {

    height: 110px;

    flex-shrink: 0;

    display: flex;

    border-top: 1px solid var(--border);

    background: #292d36;

}


.velocity-label {

    width: 70px;

    flex-shrink: 0;

    padding: 12px 8px;

    border-right: 1px solid var(--border);

    color: #7e8592;

    font-size: 8px;
    font-weight: 800;

}


.velocity-area {

    position: relative;

    flex: 1;

    overflow: hidden;

}


.velocity-bar {

    position: absolute;

    bottom: 0;

    width: 5px;

    min-height: 4px;

    border-radius: 3px 3px 0 0;

    background: #7063df;

}


/* =========================================================
   Bottom Piano
========================================================= */

.bottom-piano {

    height: 92px;

    flex-shrink: 0;

    padding: 10px 12px;

    border-top: 1px solid var(--border);

    background: #2b2f39;

    overflow-x: auto;

}


.keyboard {

    height: 72px;

    min-width: 720px;

    display: flex;

}


.piano-white {

    position: relative;

    flex: 1;

    min-width: 45px;

    border: 1px solid #17191e;

    border-top: 0;

    background: linear-gradient(to bottom,
            #f7f7f8,
            #cfd1d5);

    color: #555a64;

    cursor: pointer;

}


.piano-white:hover {

    background: #ffffff;

}


.piano-white.active {

    background: #aaa2ff;

}


.piano-black {

    position: relative;

    width: 28px;
    height: 47px;

    margin-left: -14px;
    margin-right: -14px;

    z-index: 3;

    border: 1px solid #17191e;
    border-radius: 0 0 5px 5px;

    background: linear-gradient(to bottom,
            #454a54,
            #16181c);

    box-shadow:
        0 4px 5px rgba(0, 0, 0, .4);

    cursor: pointer;

}


.piano-black:hover {

    background: #5a606b;

}


.piano-black.active {

    background: var(--accent);

}


/* =========================================================
   Status
========================================================= */

.statusbar {

    height: 30px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 13px;

    border-top: 1px solid var(--border);

    background: #292d36;

    color: #7d8491;

    font-size: 9px;

}


.status-right {

    display: flex;

    gap: 18px;

}


.status-right strong {

    color: #b8bdc7;

}


/* =========================================================
   Scrollbar
========================================================= */

::-webkit-scrollbar {

    width: 8px;
    height: 8px;

}


::-webkit-scrollbar-track {

    background: #242832;

}


::-webkit-scrollbar-thumb {

    border-radius: 10px;

    background: #4a505d;

}


::-webkit-scrollbar-thumb:hover {

    background: #5a6170;

}

.song-select {

    height: 34px;

    min-width: 150px;

    padding: 0 10px;

    border: 1px solid #414652;
    border-radius: 7px;

    outline: none;

    background: #343944;

    color: #d7dae0;

    font-size: 11px;

    cursor: pointer;

}


.song-select:hover {

    background: #414652;

}


.song-select:focus {

    border-color: var(--accent);

}


.song-select option {

    background: #2b2f39;

    color: #e9ebef;

}