:root{--bg: #0f1115;--bg-2: #161a22;--fg: #e8ecf2;--muted: #8a93a3;--tile: #1c2027;--tile-border: #2a2f39;--tile-active: #3a4150;--accent: #b681ff;--green: #5dba5d;--yellow: #d8b048;--grey: #3a3f4a;--piano-h: 92px;--bk-half: 5.5%}*{box-sizing:border-box}html,body{margin:0;padding:0;background:radial-gradient(900px 500px at 50% -180px,#1a1f2e 0%,var(--bg) 60%);color:var(--fg);font-family:system-ui,-apple-system,Segoe UI,Inter,sans-serif;min-height:100vh;touch-action:manipulation;font-size:15px}body{display:flex;flex-direction:column;align-items:center;padding:.5rem .75rem 1rem;gap:.5rem}header{text-align:center}header h1{margin:0;font-weight:800;letter-spacing:.04em;font-size:clamp(1.2rem,5vw,1.6rem);background:linear-gradient(90deg,#f06b6b,#f0a04b,#e8d34a,#5dba5d,#6aa9ff,#b681ff);-webkit-background-clip:text;background-clip:text;color:transparent}.sub{color:var(--muted);font-size:.75rem;margin-top:.1rem}main{width:100%;max-width:520px;display:flex;flex-direction:column;gap:.5rem}.board{display:flex;flex-direction:column;gap:.22rem}.track{display:flex;flex-direction:column;gap:.35rem;background:var(--bg-2);padding:.45rem .5rem .55rem;border-radius:10px;border:1px solid var(--tile-border)}.track-head{display:flex;align-items:center;justify-content:space-between}.track-label{font-size:.65rem;text-transform:uppercase;letter-spacing:.13em;color:var(--muted);font-weight:700}.actions{display:grid;grid-template-columns:1fr 1.4fr;gap:.4rem}.actions button{padding:.7rem .5rem;border-radius:9px;border:1px solid var(--tile-border);background:var(--tile);color:var(--fg);font-size:.95rem;font-weight:700;cursor:pointer}.actions .primary{background:var(--accent);color:#1a0c33;border-color:var(--accent);font-weight:800}.actions button:disabled{opacity:.45;cursor:not-allowed}.row{display:grid;grid-template-columns:repeat(var(--cols, 8),minmax(0,1fr));gap:.22rem}.slot{aspect-ratio:1 / 1;border-radius:8px;background:var(--tile);border:2px solid var(--tile-border);display:flex;flex-direction:column;align-items:center;justify-content:center;font-weight:700;color:var(--fg);cursor:pointer;-webkit-user-select:none;user-select:none;position:relative;transition:transform 80ms ease,background .15s ease,border-color .15s ease,box-shadow .15s ease}.slot .note{font-size:clamp(.78rem,3vw,1.05rem);line-height:1}.slot .note.sharp{font-size:clamp(.66rem,2.6vw,.92rem)}.slot .glyph{display:inline-flex;align-items:center;justify-content:center;margin-top:1px;line-height:1;height:16px}.slot .glyph .ng{width:12px;height:16px;color:currentColor}.slot .glyph .dotmark{margin-left:1px;font-size:1.4em;line-height:.5;transform:translateY(-1px)}.slot:hover{border-color:var(--tile-active)}.slot:active{transform:scale(.94)}.pitch-row .slot[data-note=""],.duration-row .slot[data-dur=""]{border-style:dashed;background:transparent}.pitch-slot .duration-bar,.duration-slot .note{display:none}.duration-slot .glyph{height:20px}.duration-slot .glyph .ng{width:16px;height:20px}.slot.selected{border-color:var(--accent);box-shadow:0 0 0 3px #b681ff2e}.slot.playing{background:var(--tile-active);transform:scale(1.05)}.slot .duration-bar{position:absolute;bottom:4px;left:50%;transform:translate(-50%);height:2px;border-radius:2px;background:var(--muted);opacity:.55;width:0;transition:width .16s ease,background .16s ease,opacity .16s ease}.slot.dur-e .duration-bar{width:28%}.slot.dur-q .duration-bar{width:60%}.slot.dur-h .duration-bar{width:88%}.slot.dur-e.dotted .duration-bar{width:42%}.slot.dur-q.dotted .duration-bar{width:78%}.slot.dur-h.dotted .duration-bar{width:100%}.slot.p-green{background:var(--green);border-color:var(--green);color:#0c1408}.slot.p-yellow{background:var(--yellow);border-color:var(--yellow);color:#1c1604}.slot.p-grey{background:var(--grey);border-color:var(--grey);color:var(--muted)}.slot.p-green .duration-bar,.slot.p-yellow .duration-bar,.slot.p-grey .duration-bar{opacity:1}.slot.d-green .duration-bar{background:#fff;opacity:1}.slot.d-grey .duration-bar{background:#00000073;opacity:.85}.board .row.empty .slot{opacity:.3}.piano{position:relative;display:grid;grid-template-columns:repeat(7,1fr);gap:2px;height:var(--piano-h)}.key{cursor:pointer;border:0;font:inherit;position:relative;transition:transform 70ms ease,box-shadow .15s ease,filter .15s ease;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}.key .label{position:absolute;bottom:6px;left:0;right:0;text-align:center;font-weight:700;font-size:.82rem;pointer-events:none}.key.white{background:linear-gradient(180deg,#f6f6ec,#e6e4d3);color:#2a2a2a;border-radius:0 0 6px 6px;box-shadow:inset 0 -2px #00000014,0 1px 3px #00000040}.key.black{position:absolute;top:0;width:calc(2 * var(--bk-half));height:62%;background:linear-gradient(180deg,#2a2a2a,#0e0e10);color:#e8ecf2;border-radius:0 0 5px 5px;box-shadow:inset 0 -2px #0009,0 2px 5px #0009;z-index:2}.key.black .label{bottom:5px;font-size:.7rem;color:#d9d9d9}.key:active.white{filter:brightness(1.1);transform:translateY(1px)}.key:active.black{transform:translateY(1px)}.durations{display:grid;grid-template-columns:repeat(3,1fr) .55fr;gap:.3rem}.dur-btn,.dot-btn{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;padding:.45rem .35rem .55rem;border-radius:9px;border:2px solid var(--tile-border);background:var(--tile);color:var(--fg);font-weight:700;cursor:pointer;transition:background .15s ease,transform 80ms ease,border-color .15s ease,box-shadow .15s ease}.dur-btn:hover,.dot-btn:hover{background:var(--bg-2)}.dur-btn:active,.dot-btn:active{transform:scale(.97)}.dur-btn .dur-svg .ng{width:16px;height:22px;color:var(--fg)}.dur-btn .dur-name{font-weight:600;color:var(--muted);font-size:.7rem;text-transform:uppercase;letter-spacing:.05em}.dur-btn .dur-key,.dot-btn .dot-key{position:absolute;top:3px;right:5px;font-size:.65rem;color:var(--muted);border:1px solid var(--tile-border);border-radius:4px;padding:0 3px}.dot-btn .dot-symbol{font-size:1.5rem;line-height:.6;margin-top:2px}.dot-btn.active{background:#b681ff2e;border-color:var(--accent);color:var(--accent);box-shadow:0 0 0 3px #b681ff2e}.status{min-height:1rem;text-align:center;color:var(--muted);font-size:.85rem}footer{color:var(--muted);font-size:.72rem;display:flex;gap:.4rem;align-items:center}.link{background:none;border:none;color:var(--accent);cursor:pointer;padding:0;font:inherit;text-decoration:underline}dialog{background:var(--tile);color:var(--fg);border:1px solid var(--tile-border);border-radius:14px;padding:1.25rem;max-width:min(92vw,460px)}dialog::backdrop{background:#0009}dialog h2{margin-top:0}dialog ol{padding-left:1.2rem;line-height:1.55;font-size:.95rem}.reveal{margin:.25rem 0 .75rem;font-size:1rem;color:var(--accent);font-weight:700}#endGrid{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.95rem;background:var(--bg);padding:.6rem;border-radius:8px;margin:.5rem 0 .85rem;white-space:pre-wrap}.dialog-actions{display:flex;gap:.45rem;justify-content:flex-end;flex-wrap:wrap}.dialog-actions button{padding:.5rem .85rem;border-radius:8px;border:1px solid var(--tile-border);background:var(--bg);color:var(--fg);cursor:pointer;font-size:.9rem}.dialog-actions button.primary{background:var(--accent);border-color:var(--accent);color:#1a0c33;font-weight:700}kbd{display:inline-block;background:var(--bg);border:1px solid var(--tile-border);border-radius:4px;padding:0 4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.85em}
