:root {
  color-scheme: dark;
  --bg: #111014;
  --panel: #19171d;
  --panel-2: #24202a;
  --ink: #f4eadf;
  --muted: #a99eaa;
  --ruby: #b81f3f;
  --wine: #5b1426;
  --gold: #c99a4c;
  --green: #63b886;
  --line: rgba(244, 234, 223, .13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.panel {
  overflow: auto;
  max-height: 100vh;
  padding: 18px;
  background: linear-gradient(180deg, #201b24, #131116);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: #320b16;
  color: #ffd59a;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
}

h2 {
  margin-bottom: 10px;
  font-size: 13px;
  color: #ffd59a;
  text-transform: uppercase;
}

p,
span {
  color: var(--muted);
}

section {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

label {
  display: grid;
  gap: 7px;
  margin: 10px 0;
  color: var(--muted);
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
}

.check input {
  accent-color: var(--ruby);
}

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

input[type="number"],
input[type="text"],
input[type="color"],
select {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--ink);
}

input[type="color"] {
  padding: 4px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.color-grid label {
  margin: 0;
}

button,
.file-button,
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #2a222b;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

button.active,
.preset.active {
  border-color: var(--gold);
  background: var(--wine);
  color: #ffe0af;
}

button:hover,
.file-button:hover,
.download:hover {
  border-color: rgba(255, 213, 154, .55);
}

.preset-grid,
.segmented,
.transport {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.segmented {
  margin-bottom: 10px;
}

.segmented button {
  min-width: 0;
}

.transport {
  grid-template-columns: 1fr 1fr;
}

#vizMode {
  grid-template-columns: repeat(2, 1fr);
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button.wide {
  width: 100%;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.download {
  display: none;
  margin-top: 10px;
  width: 100%;
}

.download.ready {
  display: flex;
}

.status-text {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--gold);
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  background:
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px),
    #0b0b0e;
  background-size: 34px 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 11, 14, .85);
}

.topbar div {
  display: grid;
  gap: 3px;
}

.stage-shell {
  display: grid;
  place-items: center;
  padding: 22px;
  min-height: 0;
}

canvas {
  width: min(100%, calc((100vh - 96px) * 16 / 9));
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: calc(100vh - 96px);
  background: #111;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  cursor: grab;
}

canvas.dragging {
  cursor: grabbing;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(5, 4, 7, .78);
}

.modal.open {
  display: grid;
}

.modal-card {
  display: grid;
  gap: 14px;
  width: min(100%, 820px);
  max-height: calc(100vh - 48px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #161319;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .65);
}

.modal-head,
.editor-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head div {
  display: grid;
  gap: 2px;
}

#vinylEditor {
  width: min(100%, 70vh);
  max-height: 70vh;
  justify-self: center;
  aspect-ratio: 1;
  background:
    linear-gradient(45deg, #2a2630 25%, transparent 25%),
    linear-gradient(-45deg, #2a2630 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2630 75%),
    linear-gradient(-45deg, transparent 75%, #2a2630 75%),
    #1a171f;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  cursor: crosshair;
  box-shadow: none;
}

.editor-tools label {
  flex: 1;
  margin: 0;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }

  .panel {
    max-height: none;
  }

  canvas {
    width: 100%;
    max-height: none;
  }

  .modal-head,
  .editor-tools {
    align-items: stretch;
    flex-direction: column;
  }
}
