:root {
  --ink: #19221d;
  --muted: #657068;
  --paper: #f3f0e7;
  --card: #fbfaf5;
  --line: #d7d3c7;
  --accent: #d95c35;
  --green: #416f5a;
  --shadow: 0 22px 70px rgba(45, 49, 39, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
main { min-height: 100vh; overflow: hidden; }

.topbar { height: 72px; max-width: 1240px; margin: auto; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; text-transform: uppercase; font-size: 13px; font-weight: 800; letter-spacing: .19em; }
.brandMark { width: 31px; height: 31px; display: flex; align-items: center; justify-content: center; gap: 3px; border-radius: 50%; background: var(--ink); }
.brandMark i { display: block; width: 2px; background: var(--paper); border-radius: 2px; }
.brandMark i:nth-child(1) { height: 8px; }.brandMark i:nth-child(2) { height: 17px; }.brandMark i:nth-child(3) { height: 11px; }
.status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #9c9b94; }
.status-ready i { background: #4f9b72; box-shadow: 0 0 0 4px rgba(79,155,114,.13); }
.status-loading i { background: #dca33e; animation: pulse 1s infinite alternate; }
.status-error i { background: #c53f34; }
@keyframes pulse { to { opacity: .35; } }

.hero { max-width: 1184px; margin: 74px auto 55px; padding: 0 28px; display: flex; align-items: end; justify-content: space-between; gap: 60px; }
.eyebrow { margin: 0 0 18px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .19em; text-transform: uppercase; }
h1 { margin: 0; max-width: 800px; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(52px, 7vw, 92px); font-weight: 400; letter-spacing: -.055em; line-height: .91; }
h1 em { color: var(--green); font-weight: 400; }
.lede { max-width: 600px; margin: 28px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.heroActions { flex: 0 0 auto; min-width: 210px; display: grid; gap: 9px; }
.audioButton { width: 100%; min-width: 180px; padding: 15px 20px; border: 1px solid var(--ink); border-radius: 100px; background: transparent; cursor: pointer; font-size: 13px; font-weight: 800; }
.audioButton span { margin-right: 9px; }
.iconPlay { display: inline-block; width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid var(--accent); }
.iconStop { display: inline-block; width: 9px; height: 9px; background: var(--accent); }
.iconCheck { display: inline-block; width: 9px; height: 5px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: translateY(-2px) rotate(-45deg); }
.audioButton:disabled { border-color: var(--line); cursor: default; }
.midiButton { width: 100%; padding: 11px 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 100px; background: var(--card); color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.midiButton i { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: #9c9b94; }
.midiButton i.midiConnected { background: #4f9b72; box-shadow: 0 0 0 3px rgba(79,155,114,.13); }
.midiButton:disabled { cursor: default; }

.instrument { max-width: 1184px; margin: auto; padding: 0 28px; }
.controlStrip { min-height: 92px; display: grid; grid-template-columns: 1fr 1fr 190px; gap: 24px; align-items: center; padding: 18px 30px; border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; background: var(--card); }
.control span { display: flex; justify-content: space-between; margin-bottom: 13px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.control output { color: var(--muted); }
input[type="range"] { width: 100%; height: 3px; appearance: none; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent)) no-repeat, #d8d8d0; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-thumb { width: 14px; height: 14px; appearance: none; border: 3px solid var(--card); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--accent); cursor: pointer; }
.timbreControl { padding-left: 28px; border-left: 1px solid var(--line); }
.timbreControl span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .13em; }
.timbreControl select { width: 100%; padding: 8px 30px 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font-size: 12px; font-weight: 700; cursor: pointer; }

.keyboard { position: relative; height: clamp(190px, 24vw, 270px); border: 10px solid #222a25; border-top-width: 14px; border-radius: 0 0 16px 16px; background: #222a25; box-shadow: var(--shadow); touch-action: none; user-select: none; }
.whiteKeys { display: flex; height: 100%; gap: 2px; }
.pianoKey { border: 0; cursor: pointer; touch-action: none; }
.white { position: relative; flex: 1; border-radius: 0 0 7px 7px; background: linear-gradient(90deg, #e8e7e1 0, #fff 9%, #f7f6f0 92%, #d9d8d1 100%); box-shadow: inset 0 -8px 0 #e4e1d8; }
.white span { position: absolute; bottom: 19px; left: 0; right: 0; color: #989991; font-size: 10px; font-weight: 700; }
.white.active { transform: translateY(4px); background: #e7bca8; box-shadow: inset 0 -4px 0 #c97856; }
.blackKeys { position: absolute; inset: 0; pointer-events: none; }
.black { position: absolute; top: 0; width: 4.5%; height: 61%; z-index: 2; pointer-events: auto; border-radius: 0 0 5px 5px; background: linear-gradient(90deg, #101512, #303833 70%, #0b0f0d); box-shadow: inset 0 -9px 0 #090c0a, 0 7px 8px rgba(0,0,0,.35); }
.black.active { height: 59%; background: #814b38; box-shadow: inset 0 -5px 0 #452a20; }

.practice { max-width: 1184px; margin: 105px auto 75px; padding: 0 28px; }
.sectionHeading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 34px; }
h2 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(40px, 5vw, 63px); font-weight: 400; letter-spacing: -.04em; }
.rootControls { display: grid; gap: 9px; }
.rootPicker { display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.rootPicker button { width: 54px; height: 59px; border: 0; background: transparent; cursor: pointer; font-size: 22px; }
.rootPicker button:hover { background: #ebe7dc; }
.rootPicker span { min-width: 115px; padding: 0 18px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; }
.rootPicker small { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .11em; }
.rootPicker strong { display: block; margin-top: 3px; font-family: Georgia, serif; font-size: 22px; }
.shiftPlayButtons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shiftPlayButtons button { padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); cursor: pointer; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .03em; }
.shiftPlayButtons button:hover { border-color: var(--green); color: var(--green); background: #e8ebe2; }
.shiftIcon { position: relative; display: inline-block; width: 8px; height: 11px; margin-right: 4px; vertical-align: -1px; }
.shiftIcon::before { content: ""; position: absolute; left: 3px; top: 1px; width: 2px; height: 9px; border-radius: 2px; background: var(--accent); }
.shiftIcon::after { content: ""; position: absolute; left: 1px; width: 5px; height: 5px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); }
.shiftIcon.down::after { bottom: 0; transform: rotate(45deg); }
.shiftIcon.up::after { top: 0; transform: rotate(-135deg); }
.patternGrid { display: grid; grid-template-columns: 1fr 1.05fr; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--card); box-shadow: 0 15px 55px rgba(45,49,39,.07); }
.patternList { padding: 20px; border-right: 1px solid var(--line); }
.patternList button { width: 100%; display: grid; grid-template-columns: 42px 1fr 28px; align-items: center; gap: 9px; padding: 18px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.patternList button:last-child { border-bottom: 0; }
.patternList button.selected { border-radius: 11px; background: #e8ebe2; }
.patternList i { color: var(--muted); font-size: 10px; font-style: normal; }
.patternList b { display: block; margin-bottom: 6px; font-family: Georgia, serif; font-size: 18px; font-weight: 400; }
.patternList small { color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.patternArrow { position: relative; width: 16px; height: 16px; }
.patternArrow::before { content: ""; position: absolute; width: 13px; height: 2px; left: 0; top: 8px; border-radius: 2px; background: var(--accent); transform: rotate(-45deg); }
.patternArrow::after { content: ""; position: absolute; width: 7px; height: 7px; right: 0; top: 0; border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.transport { min-height: 330px; padding: 32px; display: flex; flex-direction: column; }
.tempo { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 22px; }
.tempo label span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.tempo label b { display: block; margin-top: 5px; font-size: 13px; }
.sequence { flex: 1; min-height: 145px; display: flex; align-items: center; justify-content: center; gap: 9px; border-bottom: 1px solid var(--line); }
.sequence span { width: 3px; min-height: 32px; position: relative; border-radius: 4px; background: var(--green); opacity: .55; }
.sequence span i { width: 9px; height: 9px; position: absolute; top: -3px; left: -3px; border-radius: 50%; background: var(--accent); }
.playButton { width: 100%; margin-top: 24px; padding: 16px; border: 0; border-radius: 10px; background: var(--ink); color: #fff; cursor: pointer; font-weight: 800; font-size: 13px; }
.playButton span { margin-right: 10px; }
footer { max-width: 1184px; margin: auto; padding: 24px 28px 38px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }

@media (max-width: 760px) {
  .hero { margin-top: 45px; align-items: start; flex-direction: column; gap: 28px; }
  .audioButton { width: 100%; }
  .heroActions { width: 100%; }
  .controlStrip { grid-template-columns: 1fr; gap: 25px; }
  .timbreControl { padding-left: 0; border-left: 0; }
  .keyboard { height: 190px; overflow-x: auto; }
  .sectionHeading { align-items: start; flex-direction: column; gap: 28px; }
  .rootPicker { width: 100%; justify-content: space-between; }
  .rootControls { width: 100%; }
  .rootPicker span { flex: 1; }
  .patternGrid { grid-template-columns: 1fr; }
  .patternList { border-right: 0; border-bottom: 1px solid var(--line); }
  .practice { margin-top: 75px; }
  footer { gap: 15px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; } }
