.zoe-free-record {
  --zoe-record-rail: #393046;
  --zoe-record-tint: var(--accent-soft, #ede5f9);
  --zoe-record-action: #a43b56;
  --zoe-record-signal: #a43b56;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  color: var(--ink, #2b2239);
}

:root[data-theme="dark"] .zoe-free-record {
  --zoe-record-signal: #f1a2b8;
  --zoe-record-action: #ba496b;
}

.zoe-free-record [hidden] {
  display: none !important;
}

.zoe-free-record > section {
  min-width: 0;
}

.zoe-record-panel h2 {
  margin: 0;
  line-height: 1.25;
  color: var(--heading, #261d33);
}

.zoe-record-saved > p,
.zoe-record-key-hint {
  margin: 6px 0 0;
  color: var(--muted, #6b6077);
  line-height: 1.5;
}

.zoe-record-panel {
  min-width: 0;
  padding: clamp(12px, 2.6vw, 22px);
  border: 1px solid var(--line, #e8e0ef);
  border-radius: 20px;
  background: var(--surface, #fffdfd);
}

.zoe-record-panel h2 {
  font-size: 1.16rem;
}

.zoe-record-transport,
.zoe-record-keyboard-header,
.zoe-record-saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 9px;
}

.zoe-record-transport {
  margin-bottom: 17px;
  padding: clamp(10px, 2vw, 16px);
  border-radius: 13px;
  background: var(--zoe-record-tint);
}

.zoe-record-meter {
  display: grid;
  gap: 2px;
  min-width: 80px;
}

.zoe-record-meter span,
.zoe-record-keyboard-header > span,
.zoe-record-saved-header span {
  color: var(--muted, #6b6077);
  font-size: .875rem;
  font-weight: 700;
}

.zoe-record-meter strong {
  color: var(--ink, #2b2239);
  font-size: 1.55rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

[data-record-mode="recording"] .zoe-record-meter span {
  color: var(--zoe-record-signal);
}

[data-record-mode="recording"] .zoe-record-meter span::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  vertical-align: .08em;
}

.zoe-record-buttons,
.zoe-record-range {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.zoe-record-buttons button,
.zoe-record-range button,
.zoe-record-range select {
  min-width: 44px;
  min-height: 46px;
  padding: 6px 12px;
  border: 1px solid var(--line, #e8e0ef);
  border-radius: 10px;
  color: var(--ink, #2b2239);
  background: var(--surface, #fffdfd);
  font: inherit;
  font-size: .9rem;
  font-weight: 680;
  cursor: pointer;
}

.zoe-record-buttons .zoe-record-primary {
  border-color: transparent;
  color: #fff;
  background: var(--accent, #7253a3);
}

.zoe-record-buttons [data-record-main] {
  min-width: 116px;
  min-height: 52px;
  padding-inline: 15px;
  color: #fff;
  background: var(--zoe-record-action);
}

.zoe-record-buttons button:hover:not(:disabled),
.zoe-record-range button:hover:not(:disabled) {
  border-color: var(--accent, #7253a3);
}

.zoe-record-buttons button:disabled,
.zoe-record-range button:disabled {
  opacity: .48;
  cursor: default;
}

:root[data-theme="dark"] .zoe-record-buttons .zoe-record-primary:not([data-record-main]) {
  color: #2b2239;
}

.zoe-record-keyboard-header {
  margin-bottom: 9px;
}

.zoe-record-range {
  flex-wrap: nowrap;
}

.zoe-record-range button {
  padding: 3px 8px;
  font-size: 1.125rem;
}

.zoe-record-range select {
  appearance: none;
  width: 100%;
  padding-right: 29px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.zoe-record-keyboard-frame {
  overflow: hidden;
  border: 5px solid var(--zoe-record-rail);
  border-top-width: 7px;
  border-radius: 12px;
  background: var(--zoe-record-rail);
}

.zoe-record-keyboard {
  width: 100%;
  min-width: 0;
  container-type: inline-size;
}

.zoe-record-keyboard:focus-visible {
  outline: 2px solid #cfb1eb;
  outline-offset: -2px;
}

.zoe-record-keys {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  position: relative;
  touch-action: none;
  user-select: none;
}

.zoe-record-octave {
  --key-width: calc(100% / var(--white-keys));
  position: relative;
  min-width: 0;
  height: clamp(84px, 14vw, 112px);
}

.zoe-record-octave[data-partial] {
  width: calc(100% / 7 * var(--white-keys));
  height: 78px;
}

@container (min-width: 920px) {
  .zoe-record-keys {
    display: flex;
    gap: 0;
  }

  .zoe-record-octave,
  .zoe-record-octave[data-partial] {
    flex: var(--white-keys) 1 0%;
    height: 178px;
  }
}

.zoe-record-key {
  position: absolute;
  top: 0;
  display: grid;
  justify-items: center;
  align-content: end;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 0 1px 8px;
  font: inherit;
  font-size: .8125rem;
  line-height: 1.12;
  white-space: nowrap;
  touch-action: none;
}

.zoe-record-key > * {
  pointer-events: none;
}

.zoe-record-key span {
  color: var(--accent, #7253a3);
  font-weight: 700;
}

.zoe-record-key.is-white {
  z-index: 1;
  left: calc(var(--key-width) * var(--position));
  width: var(--key-width);
  height: 100%;
  border: 1px solid var(--zoe-record-rail);
  border-radius: 0 0 7px 7px;
  background: linear-gradient(color-mix(in srgb, var(--surface, #fffdfd) 89%, #cbbcd2), var(--surface, #fffdfd) 54%);
  box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--line, #e8e0ef) 78%, #af9cbc);
  color: var(--ink, #2b2239);
}

.zoe-record-key.is-black {
  z-index: 2;
  left: calc(var(--key-width) * var(--position) + var(--key-width) * .2);
  width: calc(var(--key-width) * .6);
  height: 58%;
  border: 1px solid #261d32;
  border-radius: 0 0 6px 6px;
  box-shadow: inset 0 -4px #2a2034, 1px 2px 3px #23173159;
  color: #fff5ff;
  background: linear-gradient(#514261, #362944);
  font-size: .69rem;
}

.zoe-record-key.is-black span {
  color: #e3cdf7;
}

:root[data-theme="dark"] .zoe-record-key.is-white:not(.is-playing) {
  color: var(--ink, #eee5f5);
  background: linear-gradient(#625968, #51465c);
  box-shadow: inset 0 -4px #43374d;
}

.zoe-record-key.is-white.is-playing {
  color: #352343;
  background: #dbc0ef;
  box-shadow: inset 0 -4px #ac89ce;
}

.zoe-record-key.is-white.is-playing span {
  color: #573477;
}

.zoe-record-key.is-black.is-playing {
  background: #7752a1;
  box-shadow: inset 0 -4px #563579;
}

.zoe-record-key:focus-visible {
  z-index: 3;
  outline: 2px solid #a782d4;
  outline-offset: -2px;
}

.zoe-record-key-hint {
  margin-top: 8px;
  font-size: .875rem;
}

.zoe-record-visual {
  position: relative;
  height: 76px;
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid var(--line, #e8e0ef);
  border-radius: 10px;
  background: var(--zoe-record-tint);
}

.zoe-record-visual canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.zoe-record-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--zoe-record-signal);
  pointer-events: none;
}

.zoe-record-saved .zoe-record-status:empty {
  display: none;
}

.zoe-record-saved .zoe-record-status:not(:empty) {
  margin-top: 10px;
  padding: 8px 11px;
  border-left: 3px solid var(--accent, #7253a3);
  border-radius: 8px;
  background: var(--zoe-record-tint);
}

.zoe-record-screenreader {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
