:root {
  --bg: #0b0d12;
  --bg2: #10131b;
  --panel: #151924;
  --line: #262c3b;
  --line2: #323a4d;
  --text: #e8ebf2;
  --muted: #9aa3b8;
  --dim: #6b7389;
  --cyan: #3ee6ff;
  --pink: #ff4fa3;
  --violet: #a78bfa;
  --amber: #ffb84d;
  --green: #5cf2a5;
  --blue: #6c8cff;
  --radius: 18px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(62, 230, 255, .10), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(255, 79, 163, .10), transparent 60%),
    var(--bg);
  line-height: 1.6;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78em; padding: 1px 6px; border-radius: 5px;
  background: #1c2130; border: 1px solid var(--line2); border-bottom-width: 2px; color: var(--text);
}

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1280px; margin: 0 auto; padding: 14px 20px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 1.12rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand b { background: linear-gradient(90deg, var(--cyan), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 750; }
.logo { width: 32px; height: 32px; }
.site-header nav { display: flex; gap: 4px; }
.site-header nav a { color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: .95rem; }
.site-header nav a:hover { color: var(--text); background: #171b26; text-decoration: none; }

main { max-width: 1280px; margin: 0 auto; padding: 0 20px 40px; }

.hero { text-align: center; padding: 10px 0 18px; }
.hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.5rem); line-height: 1.15; margin: 4px 0 8px; letter-spacing: -.02em; }
.lede { color: var(--muted); max-width: 760px; margin: 0 auto; font-size: clamp(.98rem, 1.5vw, 1.08rem); }
.crumbs { font-size: .85rem; color: var(--dim); }
.crumbs a { color: var(--muted); }

/* Device */
.device {
  position: relative;
  background: linear-gradient(180deg, #181c28 0%, #11141c 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .05);
  user-select: none; -webkit-user-select: none;
}

.topbar { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; }
.lcd { flex: 1 1 360px; display: flex; align-items: stretch; gap: 6px; min-width: 0; }
.lcd-nav {
  width: 38px; flex: none; border-radius: 12px; border: 1px solid var(--line2);
  background: #1a1f2c; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted);
}
.lcd-nav:hover { color: var(--text); background: #21283a; }
.lcd-screen {
  position: relative; flex: 1; min-width: 0; height: 84px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(120% 140% at 50% 0%, #0f2a30 0%, #071316 70%);
  border: 1px solid #1d3a40;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .8), inset 0 0 2px rgba(62, 230, 255, .4);
}
.lcd-screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px);
}
#scope { position: absolute; inset: 0; width: 100%; height: 100%; color: rgba(62, 230, 255, .75); }
.lcd-text { position: absolute; left: 16px; top: 12px; display: flex; flex-direction: column; text-shadow: 0 0 10px rgba(62, 230, 255, .6); }
#lcd-cat { font: 600 .7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; text-transform: uppercase; color: #6fd8e8; opacity: .85; }
#lcd-name { font: 700 1.55rem/1.25 ui-monospace, SFMono-Regular, Menlo, monospace; color: #b8f6ff; letter-spacing: .01em; margin-top: 6px; white-space: nowrap; }
#lcd-name.edited::after { content: " *"; color: var(--pink); }
#lcd-msg {
  position: absolute; right: 14px; bottom: 10px; font: 600 .8rem ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #b8f6ff; background: rgba(7, 19, 22, .8); padding: 2px 8px; border-radius: 6px;
  opacity: 0; transition: opacity .2s; text-shadow: 0 0 8px rgba(62, 230, 255, .6);
}
#lcd-msg.show { opacity: 1; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 14px; border-radius: 11px; cursor: pointer;
  background: linear-gradient(180deg, #212737, #1a1f2c); border: 1px solid var(--line2);
  color: var(--text); font-size: .88rem; font-weight: 600; white-space: nowrap;
  box-shadow: 0 2px 0 #0a0c11;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: #46506a; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn svg circle[r="1.4"], .btn svg circle[r="1"] { fill: currentColor; stroke: none; }
.btn[aria-pressed="true"] { background: linear-gradient(180deg, #13404a, #0f2e36); border-color: var(--cyan); color: #c9f8ff; box-shadow: 0 0 16px -4px rgba(62, 230, 255, .6); }
.btn.sq { width: 40px; padding: 0; font-size: 1.2rem; }
.rec i { width: 10px; height: 10px; border-radius: 50%; background: #ff4d5e; box-shadow: 0 0 8px #ff4d5e; }
.rec[aria-pressed="true"] { background: linear-gradient(180deg, #4a1320, #340d17); border-color: #ff4d5e; color: #ffd5da; box-shadow: 0 0 16px -4px rgba(255, 77, 94, .8); }
.rec[aria-pressed="true"] i { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.vol-slot { margin-left: 4px; }

/* Preset bank */
.bank { display: flex; gap: 14px; margin: 14px 0 4px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.bank .cat { display: flex; flex-direction: column; gap: 6px; flex: none; }
.bank .cat-name { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); font-weight: 700; padding-left: 2px; }
.bank .chips { display: flex; gap: 6px; }
.chip {
  display: inline-block; padding: 7px 12px; border-radius: 10px; font-size: .86rem; font-weight: 600;
  color: var(--muted); background: #171b26; border: 1px solid var(--line); white-space: nowrap;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--line2); text-decoration: none; background: #1c2130; }
.chip[aria-current="true"] { color: #071316; background: linear-gradient(135deg, var(--cyan), #8af0ff); border-color: transparent; box-shadow: 0 0 18px -4px rgba(62, 230, 255, .7); }

/* Editor */
.editor { margin-top: 14px; border-top: 1px solid var(--line); }
.editor summary {
  list-style: none; cursor: pointer; padding: 12px 2px; display: flex; align-items: baseline; gap: 12px;
  font-weight: 700; font-size: .95rem;
}
.editor summary::-webkit-details-marker { display: none; }
.editor summary::before { content: "▸"; color: var(--cyan); transition: transform .2s; display: inline-block; }
.editor[open] summary::before { transform: rotate(90deg); }
.editor summary small { color: var(--dim); font-weight: 500; font-size: .82rem; }
.panels { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 12px; }
.panel {
  --ac: var(--cyan);
  flex: 1 1 auto; background: rgba(10, 12, 18, .55); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 12px 10px; min-width: 0;
}
.panel.c1 { --ac: var(--cyan); }
.panel.c2 { --ac: var(--violet); }
.panel.c3 { --ac: var(--pink); }
.panel.c4 { --ac: var(--amber); }
.panel.c5 { --ac: var(--green); }
.panel.c6 { --ac: var(--blue); }
.panel h3 { margin: 0 0 6px; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ac); font-weight: 800; }
.ctrls { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: flex-start; }

.knob { --ac: inherit; width: 58px; display: flex; flex-direction: column; align-items: center; }
.knob .dial { position: relative; width: 46px; height: 46px; cursor: ns-resize; touch-action: none; border-radius: 50%; outline: none; }
.knob .dial::before {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a4256, #1a1e29 70%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.knob .dial:focus-visible { box-shadow: 0 0 0 2px var(--ac); }
.knob svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.knob .track { fill: none; stroke: #2a3142; stroke-width: 3.2; stroke-linecap: round; }
.knob .arc { fill: none; stroke: var(--ac); stroke-width: 3.2; stroke-linecap: round; filter: drop-shadow(0 0 3px var(--ac)); }
.knob .ptr { stroke: #f1f4fa; stroke-width: 2.2; stroke-linecap: round; }
.knob .val { font: 600 .68rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text); margin-top: 1px; opacity: .85; white-space: nowrap; }
.knob .lbl { font-size: .7rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.knob.active .val { color: var(--ac); opacity: 1; }
.knob.small { width: 52px; }
.panel .knob { --ac: inherit; }
.panel .knob .arc { stroke: var(--ac); }
.vol-slot .knob { --ac: var(--cyan); }

.sel { display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 8px; width: 88px; }
.sel select {
  width: 100%; height: 30px; border-radius: 8px; border: 1px solid var(--line2); background: #1a1f2c;
  font-size: .78rem; font-weight: 600; padding: 0 6px; cursor: pointer;
}
.sel .lbl { font-size: .7rem; color: var(--muted); font-weight: 600; margin-top: 12px; }
.tgl {
  margin-top: 12px; height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line2);
  background: #1a1f2c; font-size: .78rem; font-weight: 700; cursor: pointer; color: var(--muted);
}
.tgl[aria-pressed="true"] { border-color: var(--ac); color: var(--ac); box-shadow: 0 0 12px -4px var(--ac); }

/* Performance strip */
.perf { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 10px 2px 12px; border-top: 1px solid var(--line); }
.grp { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.glbl { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
output { font: 700 .95rem ui-monospace, SFMono-Regular, Menlo, monospace; color: #b8f6ff; min-width: 2.4em; text-align: center; }
.vel output { font-size: .82rem; min-width: 0; }
.arp-ctrls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; transition: opacity .2s; }
.arp-ctrls.dim { opacity: .45; }
.arp-ctrls select { height: 36px; border-radius: 9px; border: 1px solid var(--line2); background: #1a1f2c; padding: 0 8px; font-size: .84rem; font-weight: 600; cursor: pointer; }
.bpm { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.bpm input { width: 110px; accent-color: var(--cyan); }
.bpm output { font-size: .85rem; min-width: 2em; }

/* Keybed */
.keybed { display: flex; gap: 10px; height: clamp(150px, 24vw, 230px); }
.wheels { display: flex; gap: 6px; flex: none; }
.wheel {
  position: relative; width: 34px; height: 100%; border-radius: 10px; cursor: ns-resize; touch-action: none;
  background: linear-gradient(90deg, #0b0d12, #171b26 50%, #0b0d12); border: 1px solid var(--line);
}
.wheel .slot { position: absolute; left: 50%; top: 10px; bottom: 26px; width: 4px; transform: translateX(-50%); background: #05070a; border-radius: 2px; }
.wheel .thumb {
  position: absolute; left: 4px; right: 4px; height: 22px; border-radius: 6px; bottom: 50%;
  background: linear-gradient(180deg, #4a5470, #2a3044); border: 1px solid #5a6684; box-shadow: 0 3px 8px rgba(0, 0, 0, .6);
}
.wheel span { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: .6rem; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }

.keys {
  position: relative; flex: 1; display: flex; height: 100%; touch-action: none; min-width: 0;
  background: #05070a; border-radius: 10px; padding: 6px 4px 4px; overflow: hidden;
  box-shadow: inset 0 8px 12px -6px rgba(0, 0, 0, .9);
}
.key { position: relative; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.key.white {
  flex: 1; margin: 0 1px; border-radius: 0 0 7px 7px;
  background: linear-gradient(180deg, #d9dde5 0%, #f6f7fa 12%, #ffffff 92%, #e3e6ec 100%);
  box-shadow: inset 0 -5px 0 #c9ced8, 0 2px 2px rgba(0, 0, 0, .4);
  transition: background .05s;
}
.key.black {
  position: absolute; top: 6px; height: 61%; z-index: 2; border-radius: 0 0 5px 5px;
  background: linear-gradient(180deg, #0c0e13 0%, #2a2f3c 85%, #3a4150 100%);
  box-shadow: inset 0 -4px 0 #111, 0 3px 4px rgba(0, 0, 0, .6);
  border: 1px solid #000;
}
.key.white.on { background: linear-gradient(180deg, #9eeefa 0%, #c9f8ff 60%, #e6fcff 100%); box-shadow: inset 0 -2px 0 #7ad9e8, 0 0 22px rgba(62, 230, 255, .7); }
.key.black.on { background: linear-gradient(180deg, #0b5966 0%, #3ee6ff 100%); box-shadow: 0 0 18px rgba(62, 230, 255, .8); }
.key.white.arp { background: linear-gradient(180deg, #ffb0d6 0%, #ffd6ea 100%); box-shadow: 0 0 22px rgba(255, 79, 163, .7); }
.key.black.arp { background: linear-gradient(180deg, #6a1240 0%, #ff4fa3 100%); box-shadow: 0 0 18px rgba(255, 79, 163, .8); }
.key .kb { font: 700 .66rem ui-monospace, SFMono-Regular, Menlo, monospace; color: #8a92a6; margin-bottom: 4px; text-transform: uppercase; }
.key.black .kb { color: #7c8499; }
.key .nn { font-size: .62rem; color: #9aa1b1; font-weight: 700; margin-bottom: 8px; }
.key.white .kb + .nn { margin-bottom: 7px; }

.hint { text-align: center; color: var(--dim); font-size: .8rem; margin: 12px 0 0; line-height: 2; }
.touch-hint { display: none; }
@media (pointer: coarse) { .touch-hint { display: block; } .hint:not(.touch-hint) { display: none; } .key .kb { display: none; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1c2232; border: 1px solid var(--line2); color: var(--text); padding: 10px 16px; border-radius: 12px;
  font-size: .9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transition: all .25s; z-index: 50; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Content */
.content { max-width: 900px; margin: 56px auto 0; }
.content h2 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); letter-spacing: -.015em; margin: 48px 0 12px; line-height: 1.2; }
.content h3 { font-size: 1.08rem; margin: 22px 0 6px; }
.content p, .content li { color: #c3c9d7; }
.content strong { color: var(--text); }
.content table { border-collapse: collapse; width: 100%; font-size: .92rem; margin: 12px 0; }
.content th, .content td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.content th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 16px; padding: 0; list-style: none; }
.sound-grid li { margin: 0; }
.sound-card {
  display: block; height: 100%; padding: 14px 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  transition: border-color .15s, transform .15s;
}
.sound-card:hover { border-color: var(--cyan); text-decoration: none; transform: translateY(-2px); }
.sound-card strong { display: block; color: var(--text); font-size: 1rem; }
.sound-card span { display: block; font-size: .72rem; color: var(--cyan); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: 4px; }
.sound-card p { font-size: .87rem; margin: 6px 0 0; color: var(--muted); line-height: 1.5; }
.feature-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.feature-list li { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font-size: .92rem; }
.faq details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.faq summary { cursor: pointer; font-weight: 650; padding: 10px 0; color: var(--text); }
.faq details p { margin: 0 0 12px; }
.tipbox { background: linear-gradient(135deg, rgba(62, 230, 255, .08), rgba(255, 79, 163, .08)); border: 1px solid var(--line2); border-radius: 14px; padding: 14px 18px; }

.site-footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 32px 20px 40px; }
.foot-cols { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: 1fr 2fr; gap: 32px; }
.site-footer p { color: var(--dim); font-size: .9rem; }
.site-footer h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); margin: 6px 0 10px; }
.foot-links { list-style: none; padding: 0; margin: 0; columns: 3 150px; font-size: .88rem; }
.foot-links a { color: var(--muted); line-height: 2; }
.copy { max-width: 1280px; margin: 24px auto 0; font-size: .8rem !important; }

@media (max-width: 760px) {
  main { padding: 0 10px 30px; }
  .lede { display: none; }
  .hero { padding: 0 0 10px; }
  .arp-ctrls.dim { display: none; }
  .perf { gap: 8px 12px; padding: 8px 0 10px; }
  .glbl.vel { display: none; }
  .actions { gap: 6px; }
  .vol-slot { display: none; }
  .site-header { padding: 10px 12px; }
  .site-header nav a { padding: 6px 8px; font-size: .88rem; }
  .device { padding: 10px; border-radius: 18px; }
  .lcd-screen { height: 70px; }
  #lcd-name { font-size: 1.2rem; }
  .actions { width: 100%; justify-content: space-between; }
  .actions .btn { padding: 0 10px; flex: 1; }
  .actions .btn span { font-size: .8rem; }
  .keybed { height: clamp(150px, 40vw, 220px); }
  .wheel { width: 26px; }
  .foot-cols { grid-template-columns: 1fr; }
  .hero { padding-bottom: 12px; }
}
@media (max-width: 420px) {
  .site-header nav a:nth-child(3) { display: none; }
  .actions .btn svg { display: none; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .site-header { padding: 6px 12px; }
  .hero h1 { font-size: 1.1rem; margin: 0; }
  .hero .lede, .crumbs { display: none; }
  .topbar { flex-wrap: nowrap; }
  .lcd { flex: 1 1 auto; }
  .lcd-screen { height: 48px; }
  .lcd-text { top: 6px; }
  #lcd-name { font-size: 1.05rem; margin-top: 2px; }
  .actions { width: auto; flex-wrap: nowrap; }
  .actions .btn { height: 36px; }
  .bank { margin-top: 8px; }
  .bank .cat-name { display: none; }
  .keybed { height: 62vh; }
  .arp-ctrls.dim, .glbl.vel, .vol-slot, .perf .glbl { display: none; }
  .perf { padding: 6px 0 8px; gap: 8px; }
  .perf .btn { height: 34px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
