*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100dvh;
    font-family: system-ui, sans-serif;
    background: #0f1115;
    color: #e8eaed;
}

.app {
    max-width: 32rem;
    margin: 0 auto;
    padding: 1rem 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.app-name {
    margin: 0;
    font-size: 0.85rem;
    color: #9aa0a6;
    font-family: ui-monospace, monospace;
}

h1 {
    margin: 0.25rem 0 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.metronome-track {
    position: relative;
    height: 3rem;
    margin: 0.75rem 0;
    border-radius: 0.5rem;
    background: #0f1115;
    border: 1px solid #2d3139;
    overflow: hidden;
}

.metronome-track__center {
    position: absolute;
    top: 0.35rem;
    bottom: 0.35rem;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: #5f6368;
    border-radius: 1px;
    transition: background 0.05s ease;
}

.metronome-track.is-beat .metronome-track__center {
    background: #81c995;
    box-shadow: 0 0 8px #81c995;
}

.metronome-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: #8ab4f8;
    transform: translate(-50%, -50%);
    will-change: transform;
}

.metronome-track.is-running .metronome-dot {
    background: #1a73e8;
}

.metronome-bpm {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.95rem;
}

.metronome-bpm input[type='range'] {
    flex: 1;
    accent-color: #1a73e8;
}

.metronome-bpm output {
    min-width: 2.5rem;
    font-family: ui-monospace, monospace;
    text-align: right;
}

.listen-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.listen-toggle {
    position: relative;
    width: 3.25rem;
    height: 1.85rem;
    border: none;
    border-radius: 999px;
    background: #3c4043;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.listen-toggle[aria-pressed="true"] {
    background: #1a73e8;
}

.listen-toggle:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.mic-panel h2 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.mic-permit {
    margin-top: 0.75rem;
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #1a73e8;
    background: #1a73e8;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.mic-permit:disabled {
    opacity: 0.6;
    cursor: wait;
}

.mic-permit[hidden] {
    display: none;
}

.listen-toggle__knob {
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s ease;
}

.listen-toggle[aria-pressed="true"] .listen-toggle__knob {
    transform: translateX(1.4rem);
}

.listen-label {
    font-size: 1.1rem;
    font-weight: 500;
}

.status {
    margin: 0;
    font-size: 0.9rem;
    color: #9aa0a6;
}

.status.is-live {
    color: #81c995;
}

.live-pitch {
    margin: 0;
    font-family: ui-monospace, monospace;
    font-size: 1.25rem;
    min-height: 1.5rem;
}

.panel {
    padding: 1rem;
    border-radius: 0.75rem;
    background: #1a1d23;
    border: 1px solid #2d3139;
}

.panel[hidden] {
    display: none !important;
}

.panel h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.subhead {
    margin: 0.75rem 0 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #9aa0a6;
}

.subhead-hint {
    font-weight: 400;
    font-size: 0.75rem;
}

.meter-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.45rem;
}

.meter-btn {
    padding: 0.45rem 0.2rem;
    border-radius: 0.5rem;
    border: 1px solid #3c4043;
    background: #252830;
    color: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.meter-btn.is-selected {
    background: #1a73e8;
    border-color: #1a73e8;
}

.meter-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.playback-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.playback-btn {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #1a73e8;
    background: #1a73e8;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
}

.playback-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.playback-btn--ghost {
    background: transparent;
    color: #8ab4f8;
}

.guess {
    margin: 0 0 1rem;
    line-height: 1.45;
}

.guess strong {
    color: #8ab4f8;
}

.note-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.note-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.45rem 0.2rem;
    border-radius: 0.5rem;
    border: 1px solid #3c4043;
    background: #252830;
    color: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    line-height: 1.15;
}

.note-btn__hz {
    font-size: 0.62rem;
    color: #9aa0a6;
    font-family: ui-monospace, monospace;
}

.note-btn.is-suggested {
    border-color: #8ab4f8;
    box-shadow: 0 0 0 1px #8ab4f8 inset;
}

.note-btn.is-selected {
    background: #1a73e8;
    border-color: #1a73e8;
}

.note-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.memory pre {
    margin: 0;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: #0f1115;
    font-size: 0.72rem;
    overflow-x: auto;
    max-height: 14rem;
    border: 1px solid #2d3139;
}

.hint {
    margin: 0;
    font-size: 0.8rem;
    color: #9aa0a6;
    line-height: 1.4;
}

.hint a {
    color: #8ab4f8;
}

.staff-host {
    margin-top: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid #2d3139;
    padding-top: 0.75rem;
    position: relative;
}

.staff-frame {
    position: relative;
    display: inline-block;
    min-width: 100%;
}

.staff-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: #f28b82;
    pointer-events: none;
    z-index: 2;
}

.staff-playhead::before {
    content: '';
    position: absolute;
    top: 0;
    left: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f28b82;
}

.staff-host .staff-svg {
    display: block;
    height: auto;
    min-width: 100%;
    color: #e8eaed;
}

.staff-line {
    stroke: #5f6368;
    stroke-width: 1;
}

.staff-line.ledger {
    stroke-dasharray: 4 3;
    opacity: 0.85;
}

.staff-summary {
    margin: 0.5rem 0 0;
    font-size: 0.72rem;
    line-height: 1.45;
    color: #9aa0a6;
    font-family: ui-monospace, monospace;
    word-break: break-word;
}

.staff-clef {
    font-size: 28px;
    fill: #e8eaed;
}

.staff-key,
.staff-meter {
    font-size: 10px;
    fill: #9aa0a6;
}

.barline {
    stroke: #8ab4f8;
    stroke-width: 1.5;
}

.playhead {
    stroke: #f28b82;
    stroke-width: 2;
}

.playhead-cap {
    fill: #f28b82;
}

.note-head.filled {
    fill: #e8eaed;
}

.note-head.hollow {
    fill: #1a1d23;
    stroke: #e8eaed;
    stroke-width: 1.2;
}

.stem,
.rest {
    stroke: #e8eaed;
}

.rest {
    fill: #e8eaed;
}

.accidental,
.event-label {
    font-size: 9px;
    fill: #9aa0a6;
    font-family: ui-monospace, monospace;
}
