:root {
  color-scheme: light;
  --paper: #f7eddb;
  --ink: #1a1723;
  --gold: #ffba43;
  --coral: #ff826e;
  --mint: #57e5a4;
  --cyan: #61d3e9;
  --violet: #bd90f3;
  --pink: #f183c9;
  font: 100%/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid #9b4a73; outline-offset: 3px; }

.brand-mark {
  display: inline-flex;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid #443549;
  border-radius: 9px;
  background: #191622;
  box-shadow: 0 2px 5px #150c1980;
}
.brand-mark i { width: 2px; height: 11px; border-radius: 2px; background: var(--cyan); }
.brand-mark i:nth-child(2) { height: 16px; background: var(--mint); }
.brand-mark i:nth-child(3) { height: 21px; background: var(--gold); }
.brand-mark i:nth-child(4) { height: 15px; background: var(--coral); }
.brand-mark i:nth-child(5) { height: 8px; background: var(--pink); }

.demo-shell { width: min(100%, 890px); margin-inline: auto; }
.embedded-demo { background: transparent; }
.embedded-demo .demo-shell { padding: 10px; }
.demo-card {
  --panel: #201c28;
  --surface: #2b2331;
  --line: #584455;
  --mode-accent: #ffbe56;
  --cream: #fcf1e4;
  --soft: #d9cbcd;
  --demo-spacing: clamp(13px, 2.1vw, 23px);
  color: var(--cream);
  color-scheme: dark;
  border: 3px solid #121019;
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 22px 44px #31252c36, inset 0 1px #73627752;
  padding: var(--demo-spacing);
  font-size: .925rem;
}
.demo-card[data-style="peach"] { --panel: #24192e; --surface: #31243d; --line: #604a70; --mode-accent: #ffa184; }
.demo-card[data-style="dream"] { --panel: #1a1924; --surface: #262437; --line: #4d4665; --mode-accent: #cd9efa; }
.demo-card :focus-visible { outline-color: var(--mode-accent); }

.demo-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.demo-brand { display: flex; align-items: center; gap: 9px; font-weight: 760; line-height: 1.25; }
.demo-brand-note { display: block; margin-top: 2px; color: var(--soft); font-size: .75rem; font-weight: 530; }
.style-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #121019;
}
.style-buttons button {
  min-height: 38px;
  padding-inline: clamp(8px, 1.4vw, 18px);
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--cream);
  font-size: .86rem;
  font-weight: 710;
  cursor: pointer;
  white-space: nowrap;
}
.style-buttons button:hover:not(:disabled) { background: var(--surface); }
.style-buttons button[aria-pressed="true"],
.style-buttons button[aria-pressed="true"]:hover { background: var(--mode-accent); color: #1c1320; }
.style-buttons button:disabled { opacity: .7; cursor: default; }

.sketch-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 10px; margin: 0 0 7px; }
.sketch-head span:first-child { font-weight: 730; }
.sketch-head span:last-child { color: var(--soft); font-size: .82rem; }
.mini-bars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; text-align: center; }
.mini-bars span { padding: 3px 2px; border-radius: 5px 5px 0 0; background: var(--coral); color: #211723; font-weight: 720; font-size: .77rem; }
.mini-bars span:nth-child(2) { background: var(--gold); }
.mini-bars span:nth-child(3) { background: var(--mint); }
.mini-bars span:nth-child(4) { background: var(--violet); }
.mini-roll {
  position: relative;
  height: clamp(72px, 9vw, 105px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background:
    linear-gradient(to right, #f4e2ff36 1px, transparent 1px) 0 0 / 25% 100%,
    linear-gradient(to right, #f4e2ff14 1px, transparent 1px) 0 0 / 6.25% 100%,
    repeating-linear-gradient(to bottom, transparent 0 14px, #f4e2ff0f 14px 15px),
    #14111b;
}
.mini-roll i {
  position: absolute;
  min-width: 3px;
  height: 5px;
  transform: translateY(-50%);
  border-radius: 3px;
  background: var(--pink);
  box-shadow: 0 0 9px #f183c95c;
}
.demo-stage { display: grid; gap: 9px; padding-top: 14px; min-width: 0; }
.demo-stage h2, .demo-stage p, .demo-status { margin: 0; }
.demo-label { font-size: 1rem; font-weight: 760; }
.demo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.demo-actions .demo-hint { margin-inline-start: auto; color: var(--soft); font-size: .83rem; }
.demo-actions button, .download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 13px;
  font-weight: 750;
  line-height: 1.18;
  cursor: pointer;
}
.demo-primary { background: var(--mint); color: #15201b; }
.demo-primary:hover:not(:disabled) { background: #8df0bf; }
.demo-secondary { background: var(--surface); border-color: var(--line) !important; color: var(--cream); }
.demo-secondary:hover:not(:disabled) { background: #45354b; }
.demo-actions button:disabled { cursor: default; opacity: .55; }
.record-button { background: #b92d3e; color: #fff9f1; }
.record-button:hover:not(:disabled) { background: #a32031; }
.record-button::before { content: ""; width: 8px; height: 8px; flex: 0 0 8px; margin-right: 8px; border-radius: 50%; background: currentColor; }
.progressions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.progressions button {
  min-width: 0;
  min-height: 57px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--cream);
  text-align: left;
  cursor: pointer;
}
.progressions button:hover { background: #3a2e40; }
.progressions button[aria-pressed="true"] { border-color: var(--mint); box-shadow: inset 0 0 0 1px var(--mint); }
.progressions span, .progressions strong { display: block; }
.progressions span { margin-bottom: 2px; color: var(--soft); font-size: .77rem; }
.progressions strong { overflow-wrap: anywhere; font-size: .93rem; line-height: 1.3; }
.demo-status { margin-top: 8px; color: var(--soft); font-size: .86rem; }
.demo-status:empty { display: none; }
.demo-status.error { color: #ffada6; }
.demo-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px 12px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--soft); font-size: .84rem; }
.download-button { flex: 0 0 auto; margin-inline-start: auto; background: var(--gold); color: #211723; font-size: .93rem; text-decoration: none; }
.download-button:hover { background: #ffd47d; }

.recording-stage { min-height: 190px; align-content: center; }
.recording-stage h2, .piano-heading h2 { font-size: clamp(1.25rem, 2.3vw, 1.6rem); font-weight: 760; line-height: 1.2; }
.beat-markers { display: flex; gap: 8px; }
.beat-markers i { width: 11px; height: 11px; border-radius: 50%; background: #584457; }
.beat-markers i.active { background: var(--mint); }
progress { width: 100%; height: 9px; accent-color: var(--mint); }
.piano-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.text-button { flex: none; padding: 5px 0; border: 0; background: none; color: var(--mode-accent); font-size: .88rem; font-weight: 700; text-decoration: underline; text-underline-offset: .15em; cursor: pointer; }
.demo-detail { color: var(--soft); font-size: .84rem; }
.roll-frame { --key-width: 40px; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #221a2c; }
.roll-bars { display: grid; grid-template-columns: var(--key-width) repeat(4, minmax(0, 1fr)); padding-block: 4px; border-bottom: 1px solid var(--line); text-align: center; font-size: .78rem; font-weight: 700; }
.roll-scroll { display: grid; grid-template-columns: var(--key-width) minmax(0, 1fr); max-height: 168px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #a48a9b #231b2b; }
.roll-keys, .roll-rows { display: grid; grid-auto-rows: minmax(11px, 1fr); min-height: 137px; }
.roll-keys { border-inline-end: 1px solid #776675; text-align: right; user-select: none; }
.roll-keys span { display: grid; align-content: center; padding-inline-end: 4px; background: #fbedda; color: #302537; box-shadow: inset 0 -1px #c8b3b9; font-size: .65rem; line-height: 1; }
.roll-keys .natural { font-weight: 750; }
.roll-keys .sharp { background: #493751; color: #f3e6ee; box-shadow: inset 0 -1px #655572; }
.roll-grid { position: relative; min-width: 0; }
.roll-rows span { background: #201a29; box-shadow: inset 0 -1px #ffffff1c; }
.roll-rows .sharp { background: #171322; }
.roll-keys .outside-scale { background: #352c3d; color: #b4a3b4; }
.roll-rows .outside-scale { background: #100d17; }
.roll-notes { position: absolute; inset: 0; background-image: linear-gradient(to right, #ffffff3c 1px, transparent 1px), linear-gradient(to right, #ffffff18 1px, transparent 1px); background-size: 25% 100%, 6.25% 100%; }
.roll-note { position: absolute; min-width: 4px; padding: 0; border: 1px solid #71345e; border-radius: 4px; background: var(--pink); cursor: grab; touch-action: none; }
.roll-note[aria-pressed="true"] { background: #ffd287; border-color: #382432; z-index: 1; }
.roll-note:active { cursor: grabbing; }
.roll-note:focus-visible { outline-color: #fff6e5; outline-offset: 1px; z-index: 2; }
.roll-note span { position: absolute; inset: 0 0 0 auto; width: min(35%, 10px); border-inline-start: 1px solid #5c2b4e80; cursor: ew-resize; }
.roll-playhead { position: absolute; inset-block: 0; width: 2px; background: #fff1b3; z-index: 3; pointer-events: none; }
.note-controls { display: grid; grid-template-columns: minmax(0, 1.1fr) repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: 6px; }
.note-controls label { min-width: 0; display: grid; gap: 2px; color: var(--soft); font-size: .8rem; font-weight: 660; }
.note-controls select, .note-controls input, .note-buttons button { width: 100%; min-width: 0; min-height: 36px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 7px; color: var(--cream); background: var(--surface); font-size: .92rem; }
.note-buttons { display: flex; gap: 4px; }
.note-buttons button { width: 36px; color: var(--mode-accent); font-weight: 700; cursor: pointer; }
.note-buttons button:disabled { opacity: .5; cursor: default; }

.checkout-status { max-width: 620px; margin: 48px auto; padding: 28px; }
.checkout-status h1 { margin: 0 0 12px; font-size: clamp(1.6rem, 6vw, 2.6rem); }

@media (max-width: 610px) {
  .demo-header { flex-wrap: wrap; }
  .style-buttons { width: 100%; }
  .demo-actions .demo-hint { width: 100%; margin: 2px 0 0; }
}
@media (max-width: 410px) {
  .demo-card { border-radius: 15px; }
  .demo-actions button, .download-button { padding-inline: 8px; font-size: .86rem; }
  .style-buttons button { padding-inline: 4px; font-size: .78rem; }
  .progressions { gap: 4px; }
  .progressions button { padding-inline: 6px; }
  .progressions strong { font-size: .82rem; }
  .roll-scroll { max-height: 144px; }
  .note-buttons button { width: 30px; }
}
