@font-face {
    font-family: 'Tracker Icons';
    src: url('fonts/icons.woff') format('woff');
}

@font-face {
    font-family: 'Share Tech Mono';
    src: url('fonts/share-tech-mono.ttf');
}

@font-face {
    font-family: 'Outfit';
    src: url('fonts/Outfit-Light.ttf');
}

:root {
    --body-font: 'Segoe UI', 'Helvetica', 'Arial', 'Trebuchet MS', sans-serif, 'Segoe UI Emoji', 'Segoe UI Symbol';
    --body-font-size: 0.98rem;
    --cell-font-size: 0.88rem;
    --cell-icon-font-size: 0.86rem;
    --input-border-radius: 6px;

    --top-bar-height: calc(5 * var(--body-font-size));
    --piano-height: 15vmax;
    --cell-border-width: 1.4px;
    --inspector-width: 25vw;
    --column-header-height: 86px;
    --column-width: 100px;

    --height-mult: 1.0;
}

* {
    font-family: var(--body-font);
    font-size: var(--body-font-size);
    color: var(--text-color);
    accent-color: var(--accent-color);
}

h1 {
    font-size: calc(2 * var(--body-font-size));
}

h2 {
    font-size: calc(1.4 * var(--body-font-size));
}

h3 {
    font-size: calc(1.2 * var(--body-font-size));
}

.icon {
    font-family: 'Tracker Icons';
    color: var(--icons-color);
}

body {
    padding-top: var(--top-bar-height);
    background-color: var(--bg-color);
}

.long-text {
    width: 40%;
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1;
    box-sizing: border-box;
    height: var(--top-bar-height);
    padding: 10px;
    background-color: var(--top-bar-bg-color);
}

.top-bar * {
    display: inline;
    margin: 3px;
    color: var(--text-color);
}

.top-bar-high-level {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.wavespace-logo {
    height: calc(1.4 * var(--body-font-size));
    margin-right: 12px;
    cursor: pointer;
}

.top-bar-button {
    background-color: var(--top-bar-bg-color);
}

.playing-button {
    background-color: var(--control-bg-color);
}

.view-switch-container {
    margin-right: 10px;
}

.icon-button {
    width: 1.8rem;
    height: 1.8rem;
    display: inline-flex;
    justify-content: center;
    margin: 2px;
}

.trash-button {
    margin-left: 10px;
    background-color: var(--inspector-bg-color);
}

.column-header h3 {
    margin-bottom: 4px;
}

.column-header .icon-button {
    line-height: 1.8rem;
    background-color: var(--column-header-bg-color);
}

.column-header .icon-button:hover {
    background-color: var(--control-hover-bg-color);
}

.status-bar {
    position: absolute;
    color: var(--top-bar-status-text-color);
    bottom: 5px;
    right: 5px;
}

label * {
    margin: 10px;
}

button,
select {
    background-color: var(--control-bg-color);
    border: none;
    border-radius: 2px;
    padding: 2px 6px;
}

.big-button {
    border: 4px solid var(--accent-color);
    border-radius: 6px;
    font-size: calc(1.4 * var(--body-font-size));
    margin: 6px;
    padding: 8px;
}

button:hover,
select:hover {
    background-color: var(--control-hover-bg-color);
}

hr {
    width: 100%;
    color: var(--hint-color);
}

input[type="file"] {
    display: none;
}

input[type="text"],
input[type="number"] {
    color: var(--input-text-color);
    font-family: 'Outfit';
    font-weight: bold;
    padding: 0 5px;
}

.import-zone {
    width: 300px;
    height: 200px;
    font-size: calc(1.4 * var(--body-font-size));
    border: 3px dashed var(--hint-color);
    background-color: var(--control-light-fill-color);
    display: flex;
    flex-direction: column;
    text-align: center;
    justify-content: center;
    user-select: none;
}

.pattern {
    --size: 25px;

    width: var(--size);
    height: var(--size);
    border: 1px solid var(--cell-outline-color);
}

.selected-pattern {
    color: var(--selected-cell-text-color);
    background-color: var(--selected-cell-color);
}

.not-selected-pattern {
    background-color: var(--background-color);
}

.cabinet * {
    display: inline;
    margin: 3px;
}

input {
    border: 3px solid var(--control-bg-color);
    border-radius: var(--input-border-radius);
    height: calc(1.6 * var(--body-font-size));
    background-color: var(--control-light-fill-color);
}

.effect-container {
    padding: 15px;
    background-color: var(--effect-container-bg-color);
    width: 100%;
    box-sizing: border-box;
}

.tiny-flex {
    display: flex;
}

.tiny-flex-sentence {
    display: flex;
    align-items: baseline;
}

.tiny-flex-sentence * {
    margin-right: 8px;
}

.tiny-flex-center {
    display: flex;
    align-items: center;
}

.tiny-flex-center * {
    margin-right: 12px;
}

.tiny-flex-col {
    display: flex;
    flex-direction: column;
}

.mini-piano {
    display: flex;
    align-items: start;
    width: 100%;
    height: 80px;
    margin-right: 10px;
}

.mini-piano-key {
    width: 100%;
    height: 100%;
    border: 1px solid var(--piano-outline-color);
}

.mini-piano-key-white {
    background-color: var(--piano-white-color);
}

.mini-piano-key-black {
    background-color: var(--piano-black-color);
}

.mini-piano-key-white.mini-piano-key-selected,
.mini-piano-key-white:hover {
    background-color: var(--piano-white-selected-color);
}

.mini-piano-key-black.mini-piano-key-selected,
.mini-piano-key-black:hover {
    background-color: var(--piano-black-selected-color);
}

.octave-picker {
    display: flex;
    flex-direction: column;
    width: 40px;
    overflow-x: visible;
    align-items: center;
}

.pattern-view {
    width: 100%;
    height: max-content;
    display: flex;
    flex-direction: row;
}

.subdivision-table {
    width: 100%;
    box-sizing: content-box;
    margin: 0;
    border-collapse: collapse;
    border: none;

    table-layout: fixed;
}

.column-header {
    background-color: var(--column-header-bg-color);
    margin-bottom: 6px;
    width: var(--column-width);
    height: var(--column-header-height);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.add-column-button {
    font-size: calc(2.5 * var(--body-font-size));
    width: var(--column-header-height);
    height: var(--column-header-height);
}

.subdivision-cell {
    box-sizing: border-box;
    height: calc(var(--body-font-size) * var(--length));
    display: flex;
    flex-direction: column;
}

.pattern-column .cell {
    height: calc(var(--body-font-size) * var(--height-ratio));
}

.cell {
    border: var(--cell-border-width) solid var(--cell-outline-color);
    border-bottom: none;
    border-right: none;
    text-align: left;
    font-family: 'Share Tech Mono', 'Courier New', Courier, monospace;
    box-sizing: border-box;
    scroll-margin-top: var(--top-bar-height);
    scroll-margin-bottom: var(--piano-height);
    overflow: hidden;
    padding: calc(0.3px * var(--height-ratio));
    font-size: calc(0.89rem * var(--font-size-ratio));
    line-height: calc(var(--body-font-size) * var(--height-ratio));
    user-select: none;
}

.pattern-column:last-of-type .cell {
    border-right: var(--cell-border-width) solid var(--cell-outline-color);
}

.pattern-column .cell:last-child {
    border-bottom: var(--cell-border-width) solid var(--cell-outline-color);
}

.subdivision-cell .cell:last-child {
    border-bottom: none;
}

.subdivision-cell:last-child .cell:last-child {
    border-bottom: var(--cell-border-width) solid var(--cell-outline-color);
}

.cell .icon {
    height: calc(var(--cell-icon-font-size) * var(--font-size-ratio));
    font-size: calc(var(--cell-icon-font-size) * var(--font-size-ratio));
    line-height: calc(var(--cell-icon-font-size) * var(--font-size-ratio));
    overflow: hidden;
}

.highlighted-cell {
    background-color: var(--highlighted-cell-color);
}

.selected-row-cell {
    background-color: var(--selected-row-cell-color);
}

.multi-selected-cell {
    background-color: var(--multi-selected-cell-color);
}

.selected-cell {
    background-color: var(--selected-cell-color);
    color: var(--selected-cell-text-color);
}

.selected-cell * {
    color: var(--selected-cell-text-color);
}

.not-selected-cell {
    background-color: var(--not-selected-cell-color);
}

.piano-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
}

.piano-spacer {
    height: var(--piano-height);
}

.piano {
    display: flex;
    vertical-align: top;
    overflow-x: scroll;
    flex-wrap: nowrap;
    height: var(--piano-height);
    background-color: var(--bg-color);
}

.piano-key {
    flex-shrink: 0;
    padding-bottom: 8px;
    display: inline-flex;
    position: relative;
    justify-content: center;
    color: var(--hint-color);
    text-align: center;
    align-items: end;
    font-size: large;
    vertical-align: top;
    border: 1px solid var(--piano-outline-color);
}

.white-key {
    width: 60px;
    height: 100%;
    background-color: var(--piano-white-color);
    margin: 0;
    z-index: 0;
}

.white-key:hover {
    background-color: var(--piano-white-selected-color);
}

.black-key {
    --width: 40px;

    background-color: var(--piano-black-color);
    width: var(--width);
    height: 66%;
    margin-left: calc(var(--width) * -0.5);
    margin-right: calc(var(--width) * -0.5);
    z-index: 1;
}

.black-key:hover {
    background-color: var(--piano-black-selected-color);
}

.piano-controls {
    position: absolute;
    right: 0;
    top: calc(-20px - 2cm);
    padding: 12px;
}

.piano-controls button {
    height: 2cm;
    min-width: 2cm;
    margin: 3px;
    vertical-align: bottom;
}

.space-button {
    width: 5cm;
}

.sample {
    width: max-content;
    padding: 20px;
    margin-bottom: 14px;
    border: 2px solid black;
    position: relative;
}

.not-selected-sample {
    background-color: var(--background-color);
}

.selected-sample {
    background-color: var(--control-bg-color);
}

.big-bg-icon {
    position: absolute;
    left: 20px;
    top: 20px;
    opacity: 0.2;
    z-index: -1;
}

.big-bg-icon .icon {
    font-size: calc(4.0 * var(--body-font-size));
}

.envelope-editor {
    --margin-width: 10px;

    margin: var(--margin-width);
    width: calc(var(--inspector-width) - 2 * var(--margin-width));
    position: relative;
    right: var(--margin-width);
}

.inspector {
    position: fixed;
    right: 0;
    top: var(--top-bar-height);
    bottom: 0;
    z-index: 0;

    padding: 10px;
    padding-bottom: var(--piano-height);
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-items: start;
    background-color: var(--inspector-bg-color);
    overflow-y: scroll;
    overflow-x: hidden;
}

.inspector * {
    width: max-content;
    margin-top: 2px;
    margin-bottom: 2px;
}

.inspector div {
    width: 100%;
}

.input-label {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-content: center;
    align-items: center;
    text-align: left;
    text-wrap-mode: nowrap;
}

.mini-flex-input {
    width: min-content;
    display: flex;
    flex-direction: row;
    align-content: center;
    align-items: center;
    text-align: left;
    text-wrap-mode: nowrap;
}

.input-label * {
    width: 100%;
}

.fake-cell-display {
    --height-ratio: 1.0;
    --font-size-ratio: 1.0;
    border: var(--cell-border-width) solid var(--cell-outline-color);
    height: calc(var(--body-font-size) * var(--height-ratio));
    min-height: 20px;
}

.inspector .fake-cell-display {
    width: 100px;
}

.tiny-full-flex {
    display: flex;
    width: 100%;
}

.tiny-full-flex * {
    width: 100%;
    margin-right: 2px;
}

.tiny-full-flex *:last-child {
    margin-right: 0px;
}

.inspector-show {
    width: var(--inspector-width);
}

.inspector-hide {
    width: min-content;
}

.inspector-button {
    --font-size: calc(1.1 * var(--body-font-size));
    font-size: var(--font-size);
    width: calc(2 * var(--font-size));
    height: calc(2 * var(--font-size));
    flex-shrink: 0;

    align-self: flex-end;
    margin-right: 10px;
}

@media (max-aspect-ratio: 4/5) {
    :root {
        --body-font-size: 1.55rem;

        --top-bar-height: calc(6 * var(--body-font-size));
        --inspector-width: 100%;

        --column-width: 33vw;
        --column-header-height: 27vw;
    }

    .cell {
        height: calc(4 * var(--body-font-size));
    }

    .piano-container {
        width: 100%;
    }

    .piano-key {
        font-size: 3vw;
    }

    .white-key {
        width: 15vw;
    }

    .black-key {
        --width: 10vw;
    }

    .inspector-show {
        position: fixed;
        left: 0;
    }
}