/* A warm, wooden dark rather than the blue the rest of the site uses: this one
   is an instrument, and the keyboard wants a body around it. */
:root {
    --bg: #14110f;
    --panel: #1e1a17;
    --line: #332c26;
    --ink: #f2e9df;
    --muted: #a2938a;
    --gold: #e0a44a;
    --green: #6fc38a;
    --red: #e2705f;
    --key: #f6efe6;
    --key-dim: #d8cec2;
    --black-key: #241f1b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0; padding: 0; height: 100%; overflow: hidden;
    background: var(--bg); color: var(--ink);
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
    user-select: none; -webkit-user-select: none;
}

.shell {
    display: flex; flex-direction: column; height: 100%;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; }
.toolbar-spacer { flex: 1; }
.icon-btn {
    min-width: 40px; height: 40px; padding: 0 10px;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.07);
    color: var(--ink); font-size: 18px; text-decoration: none; cursor: pointer;
    font-family: inherit;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.14); }
.icon-btn-text { font-size: 14px; font-weight: 700; }

.hud {
    display: flex; justify-content: space-around; gap: 6px;
    padding: 6px 12px 10px;
}
.hud span { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hud b { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud i { font-size: 11px; font-style: normal; color: var(--muted); }

.stage { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.staff-area {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 0 12px;
}
#staff { display: block; width: 100%; max-width: 460px; }
.prompt {
    margin: 8px 0 0; min-height: 22px; font-size: 15px; font-weight: 700;
    color: var(--muted); text-align: center;
}
.prompt.is-right { color: var(--green); }
.prompt.is-wrong { color: var(--red); }

/* The keyboard keeps a fixed share of the height so a phone in landscape does
   not squeeze the staff away, and so the keys stay tall enough to hit. */
.tools { display: flex; gap: 8px; padding: 0 12px 8px; }
.tools[hidden] { display: none; }
.tool {
    flex: 1; min-height: 46px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    border: 1px solid var(--line); border-radius: 13px;
    background: rgba(255, 255, 255, 0.04); color: var(--ink);
    font: inherit; font-size: 12px; cursor: pointer;
}
.tool i { font-size: 16px; font-style: normal; }
.tool:active { background: rgba(255, 255, 255, 0.1); }
.tool-wide { flex: 1.8; border-color: var(--gold); background: rgba(224, 164, 74, 0.16); color: var(--gold); }
.tool.is-on { border-color: var(--gold); color: var(--gold); background: rgba(224, 164, 74, 0.16); }

.keys-area { height: 40%; min-height: 150px; max-height: 260px; padding: 0 6px 8px; }
#keys { display: block; width: 100%; height: 100%; touch-action: none; }

.overlay {
    position: fixed; inset: 0; display: none;
    align-items: center; justify-content: center; padding: 20px;
    background: rgba(12, 10, 9, 0.86); backdrop-filter: blur(6px);
    z-index: 20;
}
.overlay.is-open { display: flex; }
.panel {
    width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto;
    padding: 22px 20px; border-radius: 20px;
    background: var(--panel); border: 1px solid var(--line); text-align: center;
}
.title { margin: 0 0 6px; font-size: 30px; font-weight: 800; color: var(--gold); letter-spacing: 0.04em; }
.panel-title { margin: 0 0 6px; font-size: 24px; font-weight: 800; }
.panel-note { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.subtitle { margin: 0 0 16px; font-size: 14px; color: var(--muted); line-height: 1.6; }

.modes { display: flex; gap: 8px; margin-bottom: 10px; }
.mode {
    flex: 1; padding: 12px 6px; border: 1px solid var(--line); border-radius: 14px;
    background: rgba(255, 255, 255, 0.03); color: var(--ink);
    font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.mode.is-on { border-color: var(--gold); background: rgba(224, 164, 74, 0.16); color: var(--gold); }

.picks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.pick {
    padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px;
    background: rgba(255, 255, 255, 0.03); color: var(--muted);
    font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.pick.is-on { border-color: var(--gold); background: rgba(224, 164, 74, 0.16); color: var(--gold); }

.legend { text-align: left; border-top: 1px solid var(--line); padding-top: 14px; }
.legend h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 700; }
.legend-row { display: flex; gap: 12px; margin-bottom: 9px; font-size: 13px; line-height: 1.55; }
.legend-row b { flex: 0 0 26px; color: var(--gold); font-size: 15px; text-align: center; }
.legend-row span { color: var(--muted); }

.result { display: flex; justify-content: center; gap: 22px; margin: 4px 0 18px; }
.result div { display: flex; flex-direction: column; gap: 3px; }
.result b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.result i { font-size: 11px; font-style: normal; color: var(--muted); }

.btn {
    display: block; width: 100%; margin-top: 9px; padding: 13px;
    border: 0; border-radius: 13px; font: inherit; font-size: 15px; font-weight: 700;
    cursor: pointer;
}
.btn-primary { background: var(--gold); color: #241a0c; }
.btn-ghost { background: rgba(255, 255, 255, 0.07); color: var(--ink); }

@media (max-height: 560px) {
    .hud { padding: 2px 12px 6px; }
    .hud b { font-size: 16px; }
    .keys-area { height: 46%; min-height: 120px; }
}
