/* Trainer's segmented TYPE / KEY instrument, in each game's own palette:
   navy #0f0f23 / graphite #1c1f26, cyan #00e6ff / amber #ffb230,
   light ink #dcebff, quiet labels #8b98a8. Existing mono labels, system body.
   A single aligned row above the playfield; settings never crowd the key. */
.cw-practice-controls {
    --input-accent: var(--amber, var(--cyan));
    --input-face: var(--surface, var(--panel-btn));
    --input-edge: var(--divider, var(--sep));
    --input-muted: var(--muted, var(--engraved));
}
.cw-input-bar { display: flex; flex: none; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 0 8px; }
.cw-input-caption { color: var(--input-muted); font-size: .8rem; }
.cw-practice-controls #btn-start-stop { min-height: 44px; }
.cw-input-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--input-edge); border-radius: 999px; background: var(--input-face); }
.cw-input-toggle .cw-input-button { min-width: 80px; min-height: 44px; padding: 8px 18px; border: 0; border-radius: 999px; background: transparent; color: var(--input-muted); font: 700 .85rem/1 var(--mono); letter-spacing: .08em; cursor: pointer; }
.cw-input-toggle .cw-input-button[aria-pressed=true] { background: var(--input-accent); color: #101523; }
.cw-input-toggle .cw-input-button:hover:not(:disabled):not([aria-pressed=true]) { color: var(--text); }
.cw-input-toggle .cw-input-button:focus-visible { outline: 2px solid var(--input-accent); outline-offset: 3px; }
.cw-input-toggle .cw-input-button:disabled { cursor: default; opacity: .65; }
.cw-practice-controls #badge-mode { display: none; } /* The switch is the single mode control. */
.cw-practice-controls .paddle-dock { --pd-panel-soft: var(--input-face); width: calc(100% - 20px); max-width: 1080px; margin: 0 auto 8px; }
.cw-practice-controls.balloon-workspace .paddle-dock { width: calc(100% - 32px); max-width: 1068px; }
.cw-practice-controls .pd-body { padding: 6px; }
.cw-practice-controls .pd-zones { height: 88px; }
.cw-screen-keyer-status { padding: 0 0 5px; color: var(--input-muted); font: .75rem system-ui, sans-serif; text-align: center; }
.cw-screen-keyer-settings { --pd-panel-soft: var(--input-face); --pd-text: var(--text); --pd-text-soft: var(--input-muted); --pd-muted: var(--input-muted); --pd-line: var(--input-edge); --pd-blue-strong: var(--input-accent); color-scheme: dark; margin-top: 16px; padding-block: 12px; border-top: 1px solid var(--input-edge); }
.cw-screen-keyer-settings h3 { margin: 0 0 12px; font: 600 1rem system-ui, sans-serif; }
.cw-screen-keyer-settings .pd-settings { display: flex; flex-wrap: wrap; gap: 12px 16px; padding: 0; margin: 0; border: 0; }
.cw-screen-keyer-settings .pd-field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.cw-screen-keyer-settings .pd-field > label { flex: 0 0 100%; font-size: .8rem; text-transform: none; letter-spacing: normal; color: var(--input-muted); }
.cw-screen-keyer-settings .pd-field:has(.pd-swap) { align-self: end; min-height: 44px; }
.cw-screen-keyer-settings .pd-field:has(.pd-remap) { flex-basis: 100%; }
.cw-screen-keyer-settings .pd-keys-label { flex-basis: 100%; overflow-wrap: anywhere; }
.cw-screen-keyer-settings .pd-field[hidden] { display: none; }
.cw-screen-keyer-settings :is(button,select,input:not([type=checkbox])) { min-height: 44px; border: 1px solid var(--input-edge); border-radius: 5px; background: var(--input-face); color: var(--text); font: inherit; }
.cw-screen-keyer-settings :is(button,select) { padding: 8px; }
.cw-screen-keyer-settings .pd-step { min-width: 44px; }
.cw-screen-keyer-settings .pd-wpm-input { width: 4.5em; padding: 6px; }
.cw-screen-keyer-settings .pd-tone-input { width: 5em; padding: 6px; }
.cw-screen-keyer-settings .pd-mode { width: auto; }
.cw-screen-keyer-settings input.pd-volume { width: 120px; max-width: 100%; margin: 0; accent-color: var(--input-accent); }
.cw-practice-controls #settings-panel input[type=range] { margin-inline: 0; max-width: 100%; }
.cw-practice-controls #settings-panel select {
    /* WebKit's native button face can remain white and paint beyond its box. */
    appearance: none;
    background-color: var(--input-face);
    color: var(--text);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23dcebff' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.cw-practice-controls :is(.competition-keyer, #settings-keyer) .pd-winkey { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cw-practice-controls :is(.competition-keyer, #settings-keyer) .pd-winkey[hidden] { display: none; }
@media (max-width: 640px) {
    .cw-input-bar { justify-content: space-between; gap: 8px; padding-bottom: 6px; }
    .cw-input-toggle .cw-input-button { min-width: 72px; }
    /* In short KEY viewports the statistics scroll. Keep Start and Settings
       ahead of them, not clipped below the sidebar's height limit. */
    .cw-practice-controls:not(.competition-playing):not(.balloon-playing) .sidebar-scroll > #btn-start-stop,
    .cw-practice-controls:not(.competition-playing):not(.balloon-playing) .sidebar-scroll > #btn-open-settings { grid-row: 1; }
}
