@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  font-family: 'DM Sans', Arial, sans-serif;
  color: #28232f;
  font-synthesis: none;
  --ui-ink: #28232f;
  --ui-muted: #706778;
  --ui-border: #dcd8e2;
  --ui-soft: #f5f3f8;
  --ui-accent: #5426e8;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
body {
  margin: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100dvh;
  background: #fff;
}

button, input, select { font: inherit; }
button {
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  background: transparent;
  color: var(--ui-ink);
  font-size: 14px;
  line-height: 1.3;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .15s, border-color .15s, color .15s;
}
button:hover { background-color: var(--ui-soft); }
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--ui-accent);
  outline-offset: 3px;
}

aside {
  min-width: 0;
  padding: 28px 25px 16px;
  overflow: auto;
  border-right: 1px solid var(--ui-border);
  background: #fff;
  color: var(--ui-ink);
  scrollbar-width: thin;
  z-index: 2;
}
header h1 { margin: 0; font-size: 32px; letter-spacing: -1.1px; line-height: 1.1; font-weight: 700; }
section { padding: 24px 0; border-bottom: 1px solid #e9e6ed; }
h2 {
  display: flex;
  align-items: baseline;
  gap: 13px;
  margin: 0 0 16px;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 500;
}
h2 span { color: var(--ui-ink); font-size: 14px; font-weight: 600; }
p { margin: 12px 0 0; color: var(--ui-muted); font-size: 12px; line-height: 1.5; }

.genres {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.genres button { padding: 10px 7px; overflow-wrap: anywhere; }
.genres button[aria-pressed=true] {
  border-color: var(--ui-ink);
  background: var(--ui-ink);
  color: #fff;
}
.genres button[aria-busy=true] {
  border-style: dashed;
  text-decoration: underline;
  text-underline-offset: 4px;
}
#status { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.quiet {
  min-height: 44px;
  padding: 9px 0;
  border: 0;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.quiet:hover { background: transparent; text-decoration-thickness: 2px; }
#jazzTools { padding: 0 0 20px; border-bottom: 1px solid #e9e6ed; }
#freezeJazz { margin-top: 12px; }

.random-colors { display: block; width: 100%; padding: 0; overflow: hidden; border-radius: 8px; background: #fff; text-align: left; }
.random-colors:hover { background: #fff; border-color: #8d8298; }
.random-colors-art { display: block; height: 66px; overflow: hidden; background: var(--random-gradient,linear-gradient(135deg,var(--random-bg,#eeeaff),var(--random-second,#ffb5da))); }
.random-colors-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; padding: 8px 12px; color: var(--ui-ink); font-size: 13px; font-weight: 600; }
.random-colors-label > span { font-size: 20px; line-height: 1; font-weight: 400; }

label:not(.colorLabel) { display: block; margin-top: 18px; font-size: 14px; }
output { float: right; color: var(--ui-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  margin-top: 9px;
  padding: 10px 8px;
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  background: #fff;
  color: var(--ui-ink);
  font-size: 14px;
}
input[type=range] {
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  accent-color: var(--ui-accent);
  cursor: pointer;
}
label.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-top: 8px;
  cursor: pointer;
}
input[type=checkbox] { flex: 0 0 20px; width: 20px; height: 20px; margin: 0; accent-color: var(--ui-accent); cursor: pointer; }
input[type=color] {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}
.custom-colors { margin-top: 14px; }
.custom-colors .colorLabel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-top: 8px;
  color: var(--ui-ink);
  font-size: 13px;
}
#layoutColorControls { margin-top: 16px; padding-top: 2px; border-top: 1px solid #e9e6ed; }
#identityScaleControl { margin-top: 22px; padding-top: 18px; border-top: 1px solid #e9e6ed; }

footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 8px; }
footer span { color: var(--ui-muted); font-size: 10px; white-space: nowrap; }

main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: #eeeaff;
  color: #5426e8;
}
canvas { display: block; flex: 1; width: 100%; min-height: 200px; }
#gradientCanvas { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; pointer-events: none; z-index: 0; }
main > *:not(#gradientCanvas) { position: relative; z-index: 1; }
.stageTop { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 28px 35px 0; }
main[data-experience] .stageTop { justify-content: flex-end; }
.view-tabs { display: flex; flex: 0 0 auto; gap: 4px; padding: 3px; border: 1px solid var(--ui-border); border-radius: 7px; background: #fff; }
.view-tabs button { min-height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--ui-ink); font-size: 13px; }
.view-tabs button:hover { background: var(--ui-soft); }
.view-tabs button[aria-selected=true] { background: var(--ui-ink); color: #fff; }
.stageTop > button { flex: 0 0 auto; padding: 0 12px; background: #fff; color: var(--ui-ink); font-size: 12px; }
.stageTop > button:hover { background: var(--ui-soft); }
.stageBottom { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 0 38px 22px; }
.stageBottom > div { min-width: 0; }
.stageBottom p { margin-top: 7px; color: inherit; font-size: 30px; letter-spacing: -.7px; }
.stage-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
#musicCredits { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 4px; background: #ffffff; color: var(--ui-muted); font-size: 11px; text-underline-offset: 3px; }
#stateLabel { font-size: 14px; opacity: .65; text-align: right; }
main:fullscreen { width: 100vw; height: 100dvh; }

#layoutControls { padding-top: 10px; }
#shuffleLayout { margin: 18px 12px 0 0; }
#layoutControls #resetLayout { margin-top: 12px; }
main[data-view=layout] { background: #f1f1f5; }
main[data-view=layout] .stageBottom { padding-top: 4px; }
main[data-view=layout] #canvas { cursor: grab; touch-action: none; }
main[data-view=layout] #canvas.is-dragging { cursor: grabbing; }

@media (min-width: 1500px) {
  body { grid-template-columns: 360px minmax(0, 1fr); }
  aside { padding: 35px; }
}

@media (max-width: 800px) {
  body { height: auto; grid-template-columns: minmax(0, 1fr); }
  main { grid-row: 1; height: 65dvh; min-height: 420px; }
  aside { overflow: visible; padding: 24px; border-right: 0; }
  header { display: none; }
  section { padding: 22px 0; }
  .stageTop { padding: 14px 14px 0; }
  .view-tabs button { padding: 0 10px; }
  .stageBottom { padding: 0 18px 14px; }
  .stageBottom p { font-size: 25px; }
  #stateLabel { font-size: 12px; }
  main[data-view=layout] { height: 78dvh; min-height: 520px; }
}

@media (min-width: 480px) and (max-width: 800px) {
  .genres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 479px) {
  aside { padding: 18px; }
  .stageBottom { gap: 10px; }
  .stageBottom p { font-size: 22px; }
  #stateLabel { max-width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
