/* The Practice Room — Vol. VII of the Learning Library.
   Identity: a music stand in a practice room. Warm walnut wall, an ivory
   sheet of music on the stand, staff drawn in ink, a burgundy accent for the
   "now sounding" moments, brass to tie it to the library shelf. Spectral for
   the elegant display serif; Noto Music supplies the clefs. */

:root {
    color-scheme: only light;

    /* the practice room */
    --wall: #2c211a;
    --wall-deep: #1d140f;
    --brass: #c6a15b;
    --brass-bright: #dcbd7d;
    --brass-deep: #9c7c40;
    --brass-soft: rgba(198, 161, 91, 0.5);

    /* the sheet of music */
    --paper: #f7f1e1;
    --paper-bright: #fffdf3;
    --ink: #2a2019;
    --ink-soft: #6a5a4c;
    --pencil: #9a8974;
    --rule: rgba(42, 32, 25, 0.14);

    /* accents */
    --accent: #8c3b45;         /* burgundy — sounding / highlights */
    --accent-soft: rgba(140, 59, 69, 0.12);

    --correct-ink: #2e7d4f;
    --correct-soft: rgba(46, 125, 79, 0.14);
    --wrong-ink: #b0504a;
    --wrong-soft: rgba(176, 80, 74, 0.14);

    --font-display: 'Spectral', 'Iowan Old Style', Georgia, serif;
    --font-ui: 'Archivo', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --font-music: 'Noto Music', serif;
    --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-ui);
    color: var(--ink);
    min-height: 100svh;
    background-color: var(--wall);
    background-image:
        radial-gradient(ellipse 120% 90% at 50% -10%, rgba(220, 189, 125, 0.08), transparent 60%),
        linear-gradient(var(--wall-deep), var(--wall) 30%, var(--wall) 70%, var(--wall-deep));
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 28px 16px;
}

.screen { width: min(1150px, 100%); }
.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }

.btn {
    border: 1.5px solid var(--ink);
    border-radius: 7px;
    background: var(--paper-bright);
    color: var(--ink);
    font-size: 14.5px;
    font-weight: 600;
    padding: 10px 18px;
    box-shadow: 0 2px 0 rgba(29, 20, 15, 0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 0 rgba(29, 20, 15, 0.35); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(29, 20, 15, 0.35); }
.btn.primary {
    background: linear-gradient(var(--brass-bright), var(--brass));
    border-color: var(--brass-deep);
    color: #2a2110;
    letter-spacing: 0.02em;
}
.btn.ghost { background: transparent; border-color: rgba(42, 32, 25, 0.45); box-shadow: none; }
.btn.ghost:hover { background: rgba(42, 32, 25, 0.06); }
.btn.play {
    background: linear-gradient(#a3505a, var(--accent));
    border-color: #6f2c34;
    color: #fff4ef;
    padding: 11px 26px;
    font-size: 15.5px;
}
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ============================== start screen ============================== */

#startScreen { display: flex; justify-content: center; padding-top: 6svh; }

.library-link {
    position: fixed;
    top: 16px;
    left: 20px;
    z-index: 50;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--brass);
    opacity: 0.85;
}
@media (hover: hover) {
    .library-link:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }
}

.cover-card {
    width: min(680px, 100%);
    background: var(--paper);
    border: 1px solid rgba(29, 20, 15, 0.6);
    border-radius: 4px;
    padding: 44px 46px 38px;
    box-shadow:
        inset 0 0 0 1px rgba(42, 32, 25, 0.12),
        inset 0 0 0 6px var(--paper),
        inset 0 0 0 7px rgba(42, 32, 25, 0.28),
        0 16px 40px rgba(0, 0, 0, 0.4);
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 11.5px; font-weight: 600;
    letter-spacing: 0.28em; text-transform: uppercase;
    color: var(--brass-deep);
    text-align: center;
    margin-bottom: 14px;
}

.cover-card h1 {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(34px, 5.5vw, 46px);
    text-align: center;
    line-height: 1.08;
}

.cover-rule {
    display: flex; align-items: center; gap: 12px;
    width: min(300px, 70%);
    margin: 16px auto 14px;
    color: var(--brass-deep); font-size: 15px;
}
.cover-rule::before, .cover-rule::after { content: ''; flex: 1; height: 1px; background: var(--brass-soft); }

.subtitle { text-align: center; color: var(--ink-soft); font-size: 15px; margin-bottom: 32px; line-height: 1.5; }

.setup-row { display: flex; gap: 16px; margin-bottom: 16px; align-items: flex-end; flex-wrap: wrap; }
.field { flex: 1; min-width: 200px; }

.field label {
    display: block;
    font-family: var(--font-mono);
    font-size: 10.5px; font-weight: 600;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 7px;
}

.field select {
    width: 100%;
    font-family: inherit; font-size: 14.5px;
    color: var(--ink);
    padding: 10px 12px;
    border: 1.5px solid rgba(42, 32, 25, 0.5);
    border-radius: 7px;
    background: var(--paper-bright);
}

#startBtn { flex: 1; min-width: 200px; padding: 12px 18px; font-size: 15.5px; }

.drill-blurb {
    font-family: var(--font-ui);
    font-size: 14.5px; font-style: italic;
    color: var(--ink-soft);
    text-align: center;
    min-height: 22px;
    margin-top: 4px;
}
.sound-note {
    font-family: var(--font-mono);
    font-size: 11px; letter-spacing: 0.08em;
    color: var(--accent);
    text-align: center;
    margin-top: 10px;
}

/* ============================== the stand / sheet ============================== */

.page {
    background:
        repeating-linear-gradient(transparent 0 33px, var(--rule) 33px 34px),
        var(--paper);
    border: 1px solid rgba(29, 20, 15, 0.6);
    border-radius: 4px;
    box-shadow:
        inset 0 0 0 1px rgba(42, 32, 25, 0.1),
        0 16px 40px rgba(0, 0, 0, 0.4);
    padding: 20px 26px 26px;
}

.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 18px;
    border-bottom: 1.5px solid rgba(42, 32, 25, 0.26);
    padding-bottom: 10px;
}

.prompt-eyebrow {
    font-family: var(--font-mono);
    font-size: 10.5px; font-weight: 600;
    letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 4px;
}
.prompt-main {
    font-family: var(--font-display);
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 600; line-height: 1.12;
    color: var(--ink);
}

.stats-block {
    display: flex; gap: 16px; flex-wrap: wrap; justify-content: flex-end;
    font-family: var(--font-mono);
    font-size: 12.5px; color: var(--ink-soft);
    padding-top: 6px; white-space: nowrap;
}
.stat b { color: var(--ink); font-weight: 700; }

.feedback-line {
    font-family: var(--font-ui);
    font-size: 15.5px; font-weight: 500;
    min-height: 26px; padding: 8px 2px 0;
    transition: color 0.15s ease;
}
.feedback-line.correct { color: var(--correct-ink); }
.feedback-line.incorrect { color: var(--wrong-ink); }

.hint-line {
    font-family: var(--font-ui);
    font-size: 14.5px; font-style: italic;
    color: var(--accent);
    padding: 0 2px 4px;
}

.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.page-controls { display: flex; gap: 8px; justify-content: flex-end; }

/* ============================== the staff ============================== */

.stage { display: flex; justify-content: center; padding: 8px 0 4px; }

.staff-svg { display: block; width: min(340px, 90%); height: auto; }
.staff-svg .staff-lines line { stroke: var(--ink); stroke-width: 1.4; }
.staff-svg .ledgers line { stroke: var(--ink); stroke-width: 1.6; }
.staff-svg .clef { fill: var(--ink); font-family: var(--font-music); dominant-baseline: alphabetic; }
.staff-svg .notehead { fill: var(--accent); stroke: #5c2830; stroke-width: 1; }
.staff-svg .accidental { fill: var(--ink); font-family: var(--font-music); }

/* ============================== circle of fifths ============================== */

.wheel { width: min(420px, 96%); margin: 10px auto 4px; }
.wheel-svg { display: block; width: 100%; height: auto; }

.wheel-seg { cursor: pointer; }
.wheel-seg:focus { outline: none; }
.wheel-seg:focus-visible .seg-fill {
    stroke: var(--brass-deep);
    stroke-width: 4;
}
.wheel-seg .seg-fill {
    fill: var(--paper-bright);
    stroke: rgba(42, 32, 25, 0.4);
    stroke-width: 1.4;
    transition: fill 0.12s ease;
}
.wheel-seg.minor .seg-fill { fill: #efe7d4; }
.wheel-seg .seg-major {
    font-family: var(--font-display);
    font-weight: 600; fill: var(--ink);
    pointer-events: none;
}
.wheel-seg .seg-minor {
    font-family: var(--font-ui);
    font-weight: 600; fill: var(--ink-soft);
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    .wheel-seg:hover .seg-fill { fill: #efe0c6; }
}
.wheel-seg.correct .seg-fill { fill: var(--correct-soft); stroke: var(--correct-ink); stroke-width: 2.4; }
.wheel-seg.correct .seg-major, .wheel-seg.correct .seg-minor { fill: var(--correct-ink); }
.wheel-seg.wrong .seg-fill { fill: var(--wrong-soft); stroke: var(--wrong-ink); stroke-width: 2.4; }

.wheel-hub { fill: var(--paper); stroke: var(--brass-soft); stroke-width: 1.5; }
.hub-label { font-family: var(--font-display); font-weight: 600; fill: var(--ink-soft); }
.hub-side { font-family: var(--font-mono); fill: var(--brass-deep); }

/* ============================== play bar ============================== */

.play-bar { display: flex; justify-content: center; padding: 14px 0 6px; }

/* ============================== choice buttons ============================== */

.choices {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
    padding: 12px 0 6px;
    max-width: 640px; margin: 0 auto;
}
.choice {
    font-family: var(--font-ui);
    font-size: 15px; font-weight: 600;
    color: var(--ink);
    background: var(--paper-bright);
    border: 1.5px solid rgba(42, 32, 25, 0.45);
    border-radius: 8px;
    padding: 12px 18px;
    box-shadow: 0 2px 0 rgba(29, 20, 15, 0.18);
    transition: transform 0.1s ease, box-shadow 0.1s ease, border-color 0.1s ease;
}
@media (hover: hover) and (pointer: fine) {
    .choice:hover { transform: translateY(-1px); border-color: var(--brass-deep); }
}
.choice:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(29, 20, 15, 0.18); }
.choice.correct { border-color: var(--correct-ink); background: var(--correct-soft); color: var(--correct-ink); }
.choice.wrong { border-color: var(--wrong-ink); background: var(--wrong-soft); color: var(--wrong-ink); }

/* ============================== melodic dictation ============================== */

.dictation {
    display: flex; align-items: center; justify-content: center;
    gap: 16px; flex-wrap: wrap;
    padding: 14px 0 6px;
}
.dict-dots { display: flex; gap: 10px; align-items: center; }
.dict-dots .dot {
    width: 15px; height: 15px; border-radius: 50%;
    border: 1.6px solid var(--pencil);
    background: transparent;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.dict-dots .dot.filled { background: var(--accent); border-color: #6f2c34; }

/* ============================== rhythm ============================== */

.rhythm { padding: 10px 0 4px; }
.rhythm-controls {
    display: flex; align-items: center; justify-content: center;
    gap: 16px; flex-wrap: wrap; margin-bottom: 14px;
}
.tap-pad {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    width: 100%; height: 150px;
    border: 2px dashed var(--brass-deep);
    border-radius: 12px;
    background: var(--paper-bright);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 22px; font-weight: 600;
    cursor: pointer;
    transition: background 0.08s ease, transform 0.06s ease, border-color 0.08s ease;
    -webkit-user-select: none; user-select: none;
}
.tap-pad span {
    font-family: var(--font-mono); font-size: 11px; font-weight: 500;
    letter-spacing: 0.06em; color: var(--ink-soft);
}
.tap-pad.hit {
    background: linear-gradient(#a3505a, var(--accent));
    border-color: #6f2c34; border-style: solid;
    color: #fff4ef; transform: scale(0.99);
}
.tap-pad.hit span { color: rgba(255, 244, 239, 0.8); }

/* rhythm notation inside choice buttons */
.choice .rn {
    font-family: var(--font-music), var(--font-display);
    font-size: 26px; line-height: 1;
    letter-spacing: 0.08em;
}

/* ============================== piano keyboard ============================== */

.keyboard {
    width: min(560px, 100%);
    margin: 16px auto 4px;
}
.keys {
    position: relative;
    height: 190px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}
.key {
    position: absolute; top: 0;
    padding: 0;
    cursor: pointer;
}
.key.white {
    height: 100%;
    background: linear-gradient(#fffef8, #f0e9d8);
    border: 1.5px solid #b7ab93;
    border-radius: 0 0 6px 6px;
    display: flex; align-items: flex-end; justify-content: center;
}
.key.white span {
    font-family: var(--font-mono);
    font-size: 12px; font-weight: 600;
    color: var(--pencil);
    padding-bottom: 10px;
}
.key.black {
    height: 62%;
    background: linear-gradient(#3a2c22, #221812);
    border: 1.5px solid #140d09;
    border-radius: 0 0 5px 5px;
    z-index: 3;
    box-shadow: 0 3px 4px rgba(0, 0, 0, 0.4);
    display: flex; align-items: flex-end; justify-content: center;
}
.key.black span {
    font-family: var(--font-mono);
    font-size: 9px; font-weight: 600; line-height: 1.2;
    color: rgba(247, 241, 225, 0.62);
    text-align: center;
    padding-bottom: 7px;
    pointer-events: none;
}
.key.black.lit span { color: rgba(255, 244, 239, 0.9); }
@media (hover: hover) and (pointer: fine) {
    .key.white:hover { background: linear-gradient(#fffef8, #efe6cf); }
    .key.black:hover { background: linear-gradient(#4a392c, #2c2018); }
}
.key.white:active { background: linear-gradient(#f3ead4, #e7ddc4); }
.key.white.correct { background: linear-gradient(#bfe6cc, #9fd3b2); border-color: var(--correct-ink); }
.key.white.wrong { background: linear-gradient(#eec4c1, #e0a9a4); border-color: var(--wrong-ink); }
.key.black.correct { background: linear-gradient(#2e7d4f, #226040); border-color: #16482e; }
.key.black.wrong { background: linear-gradient(#b0504a, #8c3c37); border-color: #6f2c28; }

/* "pressed" keys — the See & hear chord drill lights the notes being played */
.key.white.lit {
    background: linear-gradient(#c98d94, var(--accent));
    border-color: #6f2c34;
    box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.32);
}
.key.white.lit span { color: #fff2ef; }
.key.black.lit {
    background: linear-gradient(#a3505a, var(--accent));
    border-color: #5c2830;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.45);
}

/* ============================== completion overlay ============================== */

.overlay {
    position: fixed; inset: 0;
    background: rgba(29, 20, 15, 0.74);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; z-index: 10;
}
.report-card {
    width: min(440px, 100%);
    background: var(--paper);
    border: 1px solid rgba(29, 20, 15, 0.6);
    border-radius: 4px;
    padding: 34px 36px 30px;
    text-align: center;
    box-shadow:
        inset 0 0 0 1px rgba(42, 32, 25, 0.12),
        inset 0 0 0 6px var(--paper),
        inset 0 0 0 7px rgba(42, 32, 25, 0.28),
        0 20px 48px rgba(0, 0, 0, 0.5);
}
.report-card h2 { font-family: var(--font-display); font-size: 30px; font-weight: 800; margin-bottom: 18px; }
.report-stats {
    font-family: var(--font-mono);
    font-size: 14px; color: var(--ink-soft);
    display: grid; gap: 8px; margin-bottom: 26px;
}
.report-stats b { color: var(--ink); }
.report-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============================== small screens ============================== */

@media (max-width: 640px) {
    body { padding: 12px 8px; }
    .page { padding: 14px 14px 20px; }
    .page-header { flex-direction: column; gap: 6px; }
    .head-right { align-items: flex-start; }
    .stats-block { justify-content: flex-start; }
    .page-controls { justify-content: flex-start; }
    .cover-card { padding: 30px 24px 26px; }
    .keys { height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
