/* Light mode. */
:root {
    --bg: #fbf8f3;
    --panel: #ffffff;
    --panel-hi: #f4efe7;
    --line: #e4dbd0;
    --line-soft: #efe8df;
    --text: #2b2520;
    --muted: #857a6d;
    --accent: #c2500c;
    --accent-soft: rgba(194, 80, 12, 0.08);
    --accent-line: #edc8a8;
    --shadow: 0 1px 2px rgba(43, 37, 32, 0.05);
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 32px 16px 64px;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 920px;
    margin: 0 auto;
}

/* ---- header ---- */

header {
    border-bottom: 1px solid var(--line);
    padding-bottom: 20px;
    margin-bottom: 26px;
}

h1 {
    font-size: 27px;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin: 0 0 5px;
}

.subtitle {
    color: var(--muted);
    font-size: 14px;
    margin: 0;
    max-width: 62ch;
}

/* ---- launch row (always visible, never collapsed) ---- */

.launch {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.linkbutton {
    display: inline-block;
    font-weight: 550;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: 8px;
    padding: 9px 16px;
    text-decoration: none;
    transition: background 120ms ease, border-color 120ms ease;
}

.linkbutton:hover {
    background: rgba(194, 80, 12, 0.14);
    border-color: var(--accent);
}

/* ---- collapsible help ---- */

details {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0 18px;
    margin-bottom: 24px;
}

summary {
    cursor: pointer;
    padding: 13px 0;
    font-weight: 550;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 9px;
}

summary::-webkit-details-marker { display: none; }

summary::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid var(--muted);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 120ms ease;
}

details[open] > summary::before { transform: rotate(90deg); }

details h3 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 4px 0 8px;
}

details > *:last-child { margin-bottom: 18px; }

ol { padding-left: 22px; margin: 0; }
li { margin-bottom: 7px; }
li::marker { color: var(--muted); }

a { color: var(--accent); text-decoration-color: var(--accent-line); }
a:hover { text-decoration-color: var(--accent); }

/* ---- transport ---- */

.transport {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    margin-bottom: 26px;
}

button {
    font: inherit;
    font-weight: 550;
    color: var(--text);
    background: var(--panel-hi);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 7px 15px;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease;
}

button:hover { border-color: var(--muted); }

#playmusicbutton {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    margin-left: auto;
    /* fixed width so the label swap doesn't shift the row */
    min-width: 88px;
}

#playmusicbutton:hover { filter: brightness(1.08); }

/* While playing, the button's action is "pause" — a secondary move, so it
   drops out of the accent treatment. */
#playmusicbutton.is-playing {
    background: var(--panel-hi);
    border-color: var(--line);
    color: var(--text);
}

#playmusicbutton.is-playing:hover {
    filter: none;
    border-color: var(--muted);
}

select, input[type="text"] {
    font: inherit;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 6px 9px;
}

select { max-width: 230px; }

input[type="text"] {
    width: 62px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

select:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---- voice cards ---- */

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

h2 {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
}

.hint { color: var(--muted); font-size: 13px; }

.voices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.voice {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
}

.voice-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.finger { font-weight: 600; font-size: 14px; }

.note {
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 5px;
    padding: 2px 7px;
    min-width: 34px;
    text-align: center;
}

.readout {
    font-size: 30px;
    font-weight: 300;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.readout:empty::before { content: "\2013"; color: #d5cbbf; }

.meter {
    height: 5px;
    background: var(--line-soft);
    border-radius: 3px;
    overflow: hidden;
    margin: 9px 0 14px;
}

.meter-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 90ms linear;
}

.field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 7px;
}

.field label {
    font-size: 12px;
    color: var(--muted);
}

.voice .field input[type="text"] { width: 58px; padding: 4px 8px; }

/* ---- console ---- */

#console {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 13px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--muted);
    min-height: 46px;
    max-height: 190px;
    overflow-y: auto;
}

footer {
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 520px) {
    body { padding-top: 22px; }
    .voices { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    #playmusicbutton { margin-left: 0; width: 100%; }
}
