/* Rosewood and brass: the fretboard is the whole screen, so the page is the
   colour of the instrument rather than the colour of the site. */
:root {
    --bg: #15100c;
    --panel: #201811;
    --line: #3a2d22;
    --ink: #f4ece2;
    --muted: #a89482;
    --gold: #d9a441;
    --green: #6fc38a;
    --red: #e2705f;
    --wood: #4a3323;
    --wood-dark: #3a2718;
    --fret: #8d7e6b;
    --string: #cbb69a;
}

* { 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 4px; }
.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; }

.ask-area { text-align: center; padding: 6px 12px 2px; }
.chord-name {
    margin: 0; font-size: 40px; font-weight: 800; letter-spacing: 0.02em;
    color: var(--gold); line-height: 1.1;
}
.prompt { margin: 4px 0 0; min-height: 20px; font-size: 14px; color: var(--muted); }
.prompt.is-right { color: var(--green); }
.prompt.is-wrong { color: var(--red); }

.board-area { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px 10px; }
#board { display: block; touch-action: none; }

.tools { display: flex; gap: 8px; padding: 6px 12px 12px; }
.tool {
    flex: 1; min-height: 52px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px;
    border: 1px solid var(--line); border-radius: 14px;
    background: rgba(255, 255, 255, 0.04); color: var(--ink);
    font: inherit; font-size: 12px; cursor: pointer;
}
.tool i { font-size: 17px; font-style: normal; }
.tool:active { background: rgba(255, 255, 255, 0.1); }
.tool[hidden] { display: none; }
.tool.is-on { border-color: var(--gold); color: var(--gold); background: rgba(217,164,65,0.16); }
.tool-wide { flex: 1.6; border-color: var(--gold); background: rgba(217, 164, 65, 0.16); color: var(--gold); }

.overlay {
    position: fixed; inset: 0; display: none;
    align-items: center; justify-content: center; padding: 20px;
    background: rgba(12, 9, 6, 0.88); 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(217, 164, 65, 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(217, 164, 65, 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 30px; color: var(--gold); font-size: 14px; 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: #241a08; }
.btn-ghost { background: rgba(255, 255, 255, 0.07); color: var(--ink); }

@media (max-height: 620px) {
    .hud { padding: 2px 12px; }
    .hud b { font-size: 16px; }
    .chord-name { font-size: 30px; }
    .tool { min-height: 46px; }
}
