/* Tone Pitch Mirror — /tools/tone-mirror (growth plan D47).
   Colours come from Bootstrap variables so dark mode needs no second set of rules; the two
   plotted lines are the canvas element's own `color` and the theme's muted colour, both read
   at draw time by js/tone-mirror.js. */

/* The chart. Wide and short on purpose: a tone contour is a shape over time, and a square
   plot squashes the horizontal axis that carries the information. */
.tm-chart {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    max-height: 260px;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    background: var(--bs-body-bg);
    overflow: hidden;
}

.tm-chart canvas {
    display: block;
    width: 100%;
    height: 100%;
    color: var(--bs-body-color);
}

/* The syllable being practised, big enough to read at arm's length — this page is used with
   the device held away from the face, which is not true of anything else on the site. */
.tm-prompt-pinyin {
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 600;
    line-height: 1.1;
    color: var(--bs-primary);
}

.tm-prompt-hanzi {
    font-size: clamp(2.5rem, 10vw, 3.5rem);
    line-height: 1.1;
}

/* Tone buttons. Four equal targets rather than a dropdown: the whole drill is switching
   between them, and on a phone a select would cost two taps every time. */
.tm-tones {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.tm-tones .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding-block: 0.6rem;
}

.tm-tone-shape {
    font-size: 1.35rem;
    line-height: 1;
}

.tm-tone-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Live input level. Only visible while recording, because a bar that is always there and
   always empty reads as broken. */
.tm-meter {
    height: 6px;
    border-radius: 3px;
    background: var(--bs-secondary-bg);
    overflow: hidden;
}

.tm-meter > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--bs-success);
    transition: width 0.06s linear;
}

.tm-score {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
}

/* The legend for the two lines, drawn in CSS so it cannot drift out of sync with a canvas
   redraw. The dash pattern matches the one the target curve is stroked with. */
.tm-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
}

.tm-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.tm-legend i {
    display: inline-block;
    width: 1.75rem;
    height: 0;
    border-top-width: 3px;
    border-top-style: solid;
}

.tm-legend .tm-key-you {
    border-top-color: var(--bs-body-color);
}

.tm-legend .tm-key-target {
    border-top-width: 2px;
    border-top-style: dashed;
    border-top-color: var(--bs-secondary-color);
}

/* The syllable reference table below the tool. Four columns of one character each, so the
   minimal set reads as a set rather than as four unrelated rows. */
.tm-set-cell {
    text-align: center;
    white-space: nowrap;
}

.tm-set-cell .tm-set-hanzi {
    font-size: 1.25rem;
}

.tm-set-cell .tm-set-gloss {
    display: block;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
