/*
 * KURS — Forms & Trainers UI, step 205.
 * Geometry is shared by Light / Dark / Joyfull. Theme changes ONLY focus ink.
 * CSS only: no quiz grading, branching logic, form data or stress selection JS.
 */
:root {
    --kurs-forms-option-height: 44px;
    --kurs-forms-option-gap: 10px;
    --kurs-forms-option-padding-y: 10px;
    --kurs-forms-option-padding-x: 13px;
    --kurs-forms-indicator-size: 17px;
    --kurs-forms-focus: #167d91;
    --kurs-stress-orange: #f28c28;
}

.cabinet-theme-joyfull { --kurs-forms-focus: #c34c79; }
@media (prefers-color-scheme: dark) {
    .cabinet-theme-system { --kurs-forms-focus: #18e4e8; }
}

/* Choices in standalone and embedded tests: the same spacing and hit target. */
:is(.test-option, .test-checkbox-single, .lesson-test-option) {
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    gap: var(--kurs-forms-option-gap);
    min-height: var(--kurs-forms-option-height);
    padding: var(--kurs-forms-option-padding-y) var(--kurs-forms-option-padding-x);
    border-radius: var(--kurs-control-radius) !important;
    font-family: var(--kurs-font-ui);
    font-size: var(--kurs-text-field);
    line-height: 1.45;
}
:is(.test-option, .test-checkbox-single, .lesson-test-option) input:is([type="radio"], [type="checkbox"]) {
    flex: 0 0 var(--kurs-forms-indicator-size);
    width: var(--kurs-forms-indicator-size);
    height: var(--kurs-forms-indicator-size);
    margin: 2px 0 0;
    accent-color: var(--kurs-forms-focus);
    cursor: pointer;
}
:is(.test-option, .test-checkbox-single, .lesson-test-option):focus-within {
    outline: 2px solid var(--kurs-forms-focus);
    outline-offset: 2px;
}

/* Editable answers and selects: consistent metrics but preserve semantic colors,
   widths, correct/incorrect feedback and disabled/read-only appearance. */
:is(
    .test-short-answer, .mock-answer-input, .grammar-answer,
    .joined-select, .ne-writing, .ne-reason, .punct-reason,
    .letter-answer-input, .roots-answer-input
) {
    box-sizing: border-box;
    border-radius: var(--kurs-control-radius) !important;
    font-family: var(--kurs-font-ui) !important;
    line-height: 1.4 !important;
}
:is(
    .test-short-answer, .mock-answer-input, .grammar-answer,
    .joined-select, .ne-writing, .ne-reason, .punct-reason
) {
    min-height: var(--kurs-control-height);
    font-size: var(--kurs-text-field) !important;
}
:is(.letter-answer-input, .roots-answer-input) {
    min-height: var(--kurs-control-compact-height);
    font-size: 16px !important;
}
:is(
    .test-short-answer, .mock-answer-input, .grammar-answer,
    .joined-select, .ne-writing, .ne-reason, .punct-reason,
    .letter-answer-input, .roots-answer-input
):focus-visible {
    outline: 2px solid var(--kurs-forms-focus);
    outline-offset: 2px;
}

/* Exercise action buttons. Only shape/type metrics: theme paints the buttons. */
:is(
    .test-submit, .test-retry, .lesson-test-inline-button,
    .lesson-test-submit, .lesson-branch-retry,
    .trainer-check-btn, .trainer-secondary-btn,
    .letter-check, .letter-again, .roots-check, .roots-again,
    .stress-check, .stress-again, .grammar-check, .grammar-again,
    .joined-check, .joined-again, .ne-check, .ne-again,
    .nn-check, .nn-again, .grammar-error-again
) {
    box-sizing: border-box;
    min-height: var(--kurs-control-height);
    padding: var(--kurs-button-padding-y) var(--kurs-button-padding-x);
    border-radius: var(--kurs-control-radius) !important;
    font-family: var(--kurs-font-ui) !important;
    font-size: var(--kurs-text-button) !important;
    line-height: 1.2 !important;
}
/* Options within the grammar-error trainer are buttons, not form fields. */
.grammar-error-trainer .grammar-error-option {
    box-sizing: border-box;
    min-height: var(--kurs-forms-option-height);
    border-radius: var(--kurs-control-radius);
    font-family: var(--kurs-font-ui);
    line-height: 1.45;
}

/*
 * STRESS / УДАРЕНИЯ. The selected glyph itself is ORANGE ONLY.
 * Covers <button> in real lessons and <span role="button"> in demos.
 * Never draw a chip, border, focus ring, halo or selection background.
 * Same dimensions before and after selection: no jumping letters.
 */
.stress-trainer .stress-letters :is(button.stress-vowel, .stress-vowel[role="button"]) {
    appearance: none !important;
    display: inline !important;
    box-sizing: content-box !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
    text-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    font: inherit !important;
    font-weight: 600 !important;
    font-size: 17px !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
    cursor: pointer;
}
/* Keyboard accessibility without a box or an added mark on selected glyphs. */
.stress-trainer .stress-letters :is(button.stress-vowel, .stress-vowel[role="button"]):focus-visible:not(.is-selected) {
    text-decoration: underline !important;
    text-decoration-style: dotted !important;
    text-underline-offset: 3px;
}
.stress-trainer .stress-letters :is(button.stress-vowel, .stress-vowel[role="button"]).is-selected,
.stress-trainer .stress-letters :is(button.stress-vowel, .stress-vowel[role="button"]).is-selected:is(:hover, :focus, :focus-visible, :active, :disabled) {
    color: var(--kurs-stress-orange) !important;
    -webkit-text-fill-color: var(--kurs-stress-orange) !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
    text-shadow: none !important;
    filter: none !important;
    font-weight: 600 !important;
}

/* KURS — stress trainer: centre word glyphs vertically within each tile.
   Horizontal position stays left-aligned; all palettes share this geometry. */
.stress-trainer .stress-word {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
}
.stress-trainer .stress-word .stress-letters {
    display: flex !important;
    align-items: center !important; /* replaces legacy baseline alignment */
    align-self: center !important;
    justify-content: flex-start !important;
    margin: 0 !important;
}
/* Old CSS gives ordinary letter spans a 34px minimum height.  Remove it
   so consonants and clickable vowels sit on one vertical centreline. */
.stress-trainer .stress-word .stress-letters .stress-letter {
    min-height: 0 !important;
    height: auto !important;
    line-height: 1 !important;
}
