/* The web shell's own styling. Nothing from the host page reaches in here.
 *
 * Every colour and face is a token, and the rules below never name a literal:
 * a site theme is then one more token block (see [data-theme="bp"] at the end),
 * switched on by the shell from the `theme` address parameter. The default is
 * hammondlessons.com's V14 look.
 */
:root {
    --font: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
    --display-font: var(--font);
    --display-weight: 800;

    --accent-color: #1ca5d2;      /* progress, audition, current level, links */
    --accent-strong: #f96d41;     /* Play, the member call to action, the badge */
    --on-accent: #fff;
    --segment-active: var(--accent-color);
    --on-segment: #fff;
    --link: var(--accent-color);

    --text-color: #1b1f29;
    --text-mid: #4a4a5a;
    --text-light: #888;
    --locked-text: #c4c8cf;
    --locked-bg: #fafbfc;
    --border: #eef1f4;
    --page-bg: #fff;
    --panel-bg: #fff;             /* the cards */
    --surface: #fff;              /* buttons, selects, white keys */

    --correct: #34a853;
    --correct-tint: #eaf6ee;
    --correct-key: #cdebd6;
    --wrong: #f96d41;
    --wrong-tint: #fff0eb;
    --wrong-key: #ffd6c8;
    --audition: #1ca5d2;
    --audition-key: #cdeaf5;
    --middling: #dcba46;

    --badge-bg: var(--accent-strong);
    --badge-fg: #fff;
    --badge-border: var(--accent-strong);
    --members-bg: #0b0b14;
    --members-fg: #fff;
    --members-muted: rgba(255, 255, 255, .8);
    --overlay: rgba(11, 11, 20, .6);
    --veil: rgba(255, 255, 255, .72);   /* over the trainer once a guest's trial is up */
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page-bg); color: var(--text-color); font-family: var(--font); font-size: 14px; }
#trainer-web { padding: 28px 2px 12px; }
button { font: inherit; cursor: pointer; }

#trainer-notice { border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; color: var(--text-mid); }
#trainer-notice a { color: var(--link); font-weight: 600; }
#trainer-notice[hidden] { display: none; }

#trainer-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
#trainer-bar select { height: 36px; border: 1px solid var(--border); border-radius: 12px; padding: 0 10px; background: var(--surface); color: var(--text-color); font: inherit; }

.segment-control { display: inline-flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; height: 36px; background: var(--surface); }
.segment-control .segment { background: none; border: 0; border-radius: 0; color: var(--text-mid); font-size: 13px; font-weight: 600; padding: 0 14px; height: 36px; }
.segment-control .segment:not(:last-child) { border-right: 1px solid var(--border); }
.segment-control .segment.active { background: var(--segment-active); color: var(--on-segment); }
.segment-control .segment.locked { color: var(--locked-text); }
.segment-control .segment.locked::after { content: " 🔒"; font-size: 11px; }

#trainer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
#trainer-actions button { border-radius: 12px; padding: 11px 18px; font-weight: 700; border: 1px solid var(--border); background: var(--surface); color: var(--text-color); }
#trainer-actions button.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }

#trainer-status { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
#trainer-verdict { min-height: 20px; font-weight: 600; margin-bottom: 10px; }
#trainer-verdict.correct { color: var(--correct); }
#trainer-verdict.wrong { color: var(--wrong); }
body.trainer-play-mode #trainer-answers { display: none; }

.answers { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-bottom: 14px; }
.answer { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text-color); height: 44px; display: flex; align-items: center; justify-content: center; }
.answer__short { font-weight: 700; font-size: 14px; }
.answer--locked { color: var(--locked-text); border-style: dashed; position: relative; background: transparent; }
.answer--locked::after { content: attr(data-unlock); position: absolute; bottom: 3px; font-size: 9px; font-weight: 400; color: var(--locked-text); }
.answers--review .answer { opacity: .7; }
.answers--review .answer:hover { opacity: 1; border-color: var(--accent-color); }
.answers--review .answer--correct, .answers--review .answer--wrong { opacity: 1; }
.answer--correct { border-color: var(--correct); background: var(--correct-tint); }
.answer--wrong { border-color: var(--wrong); background: var(--wrong-tint); }

.keyboard { position: relative; height: 96px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); margin-bottom: 8px; }
.key { position: absolute; top: 0; border: 0; padding: 0; margin: 0; }
.key--white { height: 100%; background: var(--surface); border-right: 1px solid var(--border); }
.key--black { height: 60%; background: var(--text-color); border-radius: 0 0 3px 3px; z-index: 2; }
.key--correct { background: var(--correct-key) !important; }
.key--wrong { background: var(--wrong-key) !important; }
.key--audition { background: var(--audition-key) !important; }
.key--black.key--correct { background: var(--correct) !important; }
.key--black.key--wrong { background: var(--wrong) !important; }
.key--black.key--audition { background: var(--audition) !important; }

#trainer-save { font-size: 12px; color: var(--text-light); min-height: 16px; }
#trainer-save.warn { color: var(--wrong); }
#trainer-save a { color: var(--link); }

#stats-overlay { position: fixed; inset: 0; background: var(--overlay); display: none; align-items: center; justify-content: center; z-index: 200; }
#stats-overlay.visible { display: flex; }
.stats-panel { position: relative; background: var(--panel-bg); border: 1px solid var(--border); border-radius: 14px; padding: 24px 28px 28px; width: min(560px, 92vw); max-height: 84vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.stats-panel h2 { margin: 0 0 4px; font-size: 18px; }
.stats-panel h3 { margin: 22px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-light); font-weight: 600; }
.stats-panel p { margin: 0; font-size: 13px; color: var(--text-mid); }
#stats-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; padding: 0; border-radius: 15px; border: 1px solid var(--border); background: var(--surface); }
.stats-list { list-style: none; margin: 0; padding: 0; }
.stats-list li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.stats-name { width: 120px; }
.stats-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.stats-bar span { display: block; height: 100%; background: var(--correct); }
.stats-bar span.middling { background: var(--middling); }
.stats-bar span.weak { background: var(--wrong); }
.stats-count { width: 64px; text-align: right; color: var(--text-light); }
.stats-empty { color: var(--text-light); }

/* ---------------------------------------------------------------- the page
 *
 * The site itself gives the trainer no heading of its own, so the frame
 * carries one: title, one line of lead, then the practice card with the
 * progress panel beside it from 900px up and under it below that.
 */
#trainer-head h1 { font-family: var(--display-font); font-size: 30px; font-weight: var(--display-weight); margin: 0 0 6px; color: var(--text-color); }
#trainer-head .lead { margin: 0 0 22px; color: var(--text-mid); max-width: 640px; line-height: 1.5; }
.beta-badge { display: inline-block; margin-left: 10px; vertical-align: middle; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: var(--badge-bg); color: var(--badge-fg); border: 1px solid var(--badge-border); font-family: var(--font); }
.beta-note { font-size: 12.5px; color: var(--text-light); margin-top: -4px; margin-bottom: 16px; }

#trainer-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
#trainer-layout[hidden] { display: none; }
@media (min-width: 900px) {
    #trainer-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

.card { border: 1px solid var(--border); border-radius: 14px; padding: 22px; background: var(--panel-bg); }
.card-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-light); font-weight: 600; margin: 0 0 6px; }
#trainer-side { display: grid; gap: 16px; align-content: start; }

/* The seven levels. Display only: what they show is earned by answering. */
.levels { display: flex; gap: 6px; margin: 16px 0 6px; }
.level-cell { flex: 1 1 0; min-width: 0; position: relative; text-align: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px 2px 6px; color: var(--text-mid); background: var(--surface); }
.level-cell__number { display: block; font-family: var(--display-font); font-size: 12px; font-weight: 700; }
.level-cell__adds { display: block; font-size: 10px; color: var(--text-light); margin-top: 2px; overflow-wrap: anywhere; }
.level-cell--done { border-color: var(--correct-key); color: var(--correct); background: var(--correct-tint); }
.level-cell--current { border-color: var(--accent-color); background: var(--accent-color); color: var(--on-accent); }
.level-cell--current .level-cell__adds { color: var(--on-accent); opacity: .85; }
.level-cell--upcoming { border-style: dashed; color: var(--text-light); }
.level-cell--upcoming .level-cell__adds { color: var(--locked-text); }
.level-cell--locked { background: var(--locked-bg); color: var(--locked-text); }
.level-cell--locked .level-cell__adds { color: var(--locked-text); }
.level-cell--locked::after { content: "🔒"; position: absolute; top: -8px; right: -4px; font-size: 11px; }
#trainer-level-hint { font-size: 11px; color: var(--text-light); margin-bottom: 16px; min-height: 14px; }

/* Sound and how to answer, under the keyboard where both are needed. */
#trainer-options-line, #trainer-sound-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--text-light); margin-top: 8px; }
#trainer-options-line { margin-top: 14px; }
#trainer-options-line label + select { margin-right: 8px; }
#trainer-options-line select:disabled { opacity: .5; }
#trainer-options-line .check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-mid); cursor: pointer; user-select: none; }
#trainer-options-line .check input { margin: 0; accent-color: var(--accent-color); }
#trainer-options-line select, #trainer-sound-line select { height: 32px; max-width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 0 8px; background: var(--surface); color: var(--text-color); font: inherit; font-size: 12px; }

/* Your progress. */
.stat { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 13px; padding: 9px 0; border-bottom: 1px solid var(--border); color: var(--text-mid); }
.stat b { color: var(--text-color); text-align: right; font-family: var(--display-font); font-variant-numeric: tabular-nums; }
.stat--last { border-bottom: 0; padding-bottom: 0; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; margin: 8px 0 4px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--accent-color); transition: width .2s ease; }
.progress-reset { background: none; border: 0; padding: 0; margin-top: 12px; font-size: 12px; color: var(--text-light); text-decoration: underline; cursor: pointer; }
.progress-reset:hover { color: var(--wrong); }

/* A visitor trying it out: the card beside the trainer, and the gate over it
   once the free questions are used up. Same two ways in on both. */
#trainer-guest { background: var(--members-bg); color: var(--members-fg); border-radius: 14px; padding: 20px; }
#trainer-guest[hidden] { display: none; }
#trainer-guest h2 { margin: 0 0 6px; font-family: var(--display-font); font-size: 15px; font-weight: var(--display-weight); }
#trainer-guest p { margin: 0 0 14px; font-size: 12.5px; line-height: 1.5; color: var(--members-muted); }
.guest-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.guest-login { color: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
#trainer-panel { position: relative; }
#trainer-gate { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--veil); border-radius: 14px; z-index: 5; }
#trainer-gate[hidden] { display: none; }
.gate-card { background: var(--panel-bg); border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; max-width: 400px; box-shadow: 0 12px 40px rgba(0, 0, 0, .18); }
.gate-card h2 { margin: 0 0 6px; font-family: var(--display-font); font-size: 18px; font-weight: var(--display-weight); color: var(--text-color); }
.gate-card p { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--text-mid); }
.gate-card .guest-login { color: var(--link); }
body.guest-locked #trainer-panel > :not(#trainer-gate) { pointer-events: none; user-select: none; }

/* The membership card, in the same dark as the site's hero. */
#trainer-members { background: var(--members-bg); color: var(--members-fg); border-radius: 14px; padding: 20px; }
#trainer-members[hidden] { display: none; }
#trainer-members h2 { margin: 0 0 6px; font-family: var(--display-font); font-size: 15px; font-weight: var(--display-weight); }
#trainer-members p { margin: 0 0 14px; font-size: 12.5px; line-height: 1.5; color: var(--members-muted); }
.member-cta { display: inline-flex; align-items: center; background: var(--accent-strong); color: var(--on-accent); border-radius: 12px; padding: 10px 16px; font-size: 13px; font-weight: 700; text-decoration: none; }

/* The challenge: its button lights up while a round runs, and the result
   card sits over the trainer like the guest gate does. */
#trainer-actions button.active { background: var(--segment-active); border-color: var(--segment-active); color: var(--on-segment); }
#trainer-result { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--veil); border-radius: 14px; z-index: 5; }
#trainer-result[hidden] { display: none; }
.result-score { font-family: var(--display-font); font-size: 40px; font-weight: var(--display-weight); line-height: 1; color: var(--text-color); margin: 0 0 4px; }
.result-pool { font-size: 13px; color: var(--text-light); margin: 0 0 12px; }
.result-card p { margin: 0 0 6px; font-size: 13.5px; color: var(--text-mid); }
.result-best.is-best { color: var(--correct); font-weight: 700; }
.result-card .guest-actions { margin-top: 12px; }
.result-card .member-cta { border: 0; font-family: inherit; font-weight: 700; cursor: pointer; }
.result-back { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--link); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* The legend: a link under the answers, a panel like the statistics. */
.legend-link { background: none; border: 0; padding: 0; margin: -6px 0 12px; font: inherit; font-size: 12px; color: var(--link); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.legend-link[hidden] { display: none; }
#legend-overlay { position: fixed; inset: 0; background: var(--overlay); display: none; align-items: center; justify-content: center; z-index: 200; }
#legend-overlay.visible { display: flex; }
#legend-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; padding: 0; border-radius: 15px; border: 1px solid var(--border); background: var(--surface); }
.legend-letters { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--text-mid); }
.legend-letters li { padding: 4px 0; }
.legend-letters b { display: inline-block; min-width: 28px; color: var(--text-color); }
.legend-notes p { margin: 8px 0 0; font-size: 13px; color: var(--text-mid); }
.legend-list { list-style: none; margin: 0; padding: 0; }
.legend-list li { display: grid; grid-template-columns: 40px 1fr 1fr; gap: 10px; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.legend-short { font-weight: 700; color: var(--text-color); }
.legend-name { color: var(--text-mid); }
.legend-song { color: var(--text-light); }

@media (max-width: 600px) {
    #trainer-head h1 { font-size: 24px; }
    .card { padding: 16px; }
    /* Seven cells still fit across a phone once the captions come off. */
    .levels { gap: 4px; }
    .level-cell { padding: 7px 0 6px; }
    .level-cell__adds { display: none; }
    .keyboard { height: 72px; }
}

/* ------------------------------------------------------- bluespianoschool.com
 *
 * The site's own tokens (bp-custom/assets/tokens.css), applied to the names
 * above. Gold where the default has blue and orange, the site's cream for the
 * cards, Zilla Slab for numbers and headings, Karla for the rest. The shell
 * stamps data-theme="bp" from the address and loads the two faces.
 */
:root[data-theme="bp"] {
    --font: "Karla", system-ui, -apple-system, sans-serif;
    --display-font: "Zilla Slab", Georgia, serif;
    --display-weight: 700;

    --accent-color: #E3A536;
    --accent-strong: #E3A536;
    --on-accent: #1B1A17;
    --segment-active: #1B1A17;
    --on-segment: #F8F6F2;
    --link: #9A6410;

    --text-color: #1B1A17;
    --text-mid: #57534C;
    --text-light: #8A8378;
    --locked-text: #B7AE9F;
    --locked-bg: #F8F6F2;
    --border: #ECE9E3;
    --page-bg: #FFFFFF;
    --panel-bg: #F8F6F2;
    --surface: #FFFFFF;

    --correct: #2B5E36;
    --correct-tint: #EAF5EA;
    --correct-key: #C3E1C6;
    --wrong: #8A2A24;
    --wrong-tint: #FBEAEA;
    --wrong-key: #F0C4C0;
    --audition: #E3A536;
    --audition-key: #FBF2E1;
    --middling: #E3A536;

    --badge-bg: #FBF2E1;
    --badge-fg: #9A6410;
    --badge-border: #F0D9A8;
    --members-bg: #191410;
    --members-fg: #F2EAE0;
    --members-muted: #A2958A;
    --overlay: rgba(0, 0, 0, .62);
    --veil: rgba(248, 246, 242, .78);
}
:root[data-theme="bp"] .level-cell__number { font-size: 15px; }
:root[data-theme="bp"] #trainer-verdict { font-family: var(--display-font); font-size: 18px; }
:root[data-theme="bp"] #trainer-head .lead { font-size: 15px; }
