/**
 * Spelling Practice Widget - Styles
 *
 * Purple theme, letter-tile focused layout.
 * Mobile-first, accessible, therapeutic design.
 *
 * @package Aphasia_Exercises
 * @since 1.0.29
 */

/* =========================================================================
   1. CSS CUSTOM PROPERTIES
   ========================================================================= */

.spelling-practice-root {
    --spelling-primary: #8b5cf6;
    --spelling-primary-dark: #7c3aed;
    --spelling-primary-light: #f5f3ff;
    --spelling-success: #22c55e;
    --spelling-success-dark: #16a34a;
    --spelling-success-light: #f0fdf4;
    --spelling-error: #ef4444;
    --spelling-error-light: #fef2f2;

    /* Neutrals */
    --spelling-neutral-50: #f9fafb;
    --spelling-neutral-100: #f3f4f6;
    --spelling-neutral-200: #e5e7eb;
    --spelling-neutral-300: #d1d5db;
    --spelling-neutral-400: #9ca3af;
    --spelling-neutral-500: #6b7280;
    --spelling-neutral-600: #4b5563;
    --spelling-neutral-700: #374151;
    --spelling-neutral-800: #1f2937;

    /* Typography & Layout */
    --spelling-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --spelling-radius-full: 9999px;
    --spelling-radius-xl: 16px;
    --spelling-radius-lg: 12px;
    --spelling-radius-md: 8px;

    /* Shadows */
    --spelling-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --spelling-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --spelling-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --spelling-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --spelling-transition: 0.2s ease;

    /* Shared component theme mapping (ex- classes) */
    --ex-primary: var(--spelling-primary);
    --ex-primary-dark: var(--spelling-primary-dark);
    --ex-primary-light: var(--spelling-primary-light);
    --ex-primary-ring: #a78bfa;
    --ex-success: var(--spelling-success);
    --ex-success-light: var(--spelling-success-light);
    --ex-success-dark: var(--spelling-success-dark);
    --ex-error: var(--spelling-error);
    --ex-error-light: var(--spelling-error-light);
    --ex-error-dark: #dc2626;
    --ex-neutral-50: var(--spelling-neutral-50);
    --ex-neutral-100: var(--spelling-neutral-100);
    --ex-neutral-200: var(--spelling-neutral-200);
    --ex-neutral-500: var(--spelling-neutral-500);
    --ex-neutral-700: var(--spelling-neutral-700);
    --ex-neutral-800: var(--spelling-neutral-800);
    --ex-radius-sm: 6px;
    --ex-radius-md: var(--spelling-radius-md);
    --ex-radius-lg: var(--spelling-radius-lg);
    --ex-radius-full: var(--spelling-radius-full);
    --ex-shadow-sm: var(--spelling-shadow-sm);
    --ex-transition: var(--spelling-transition);
    --ex-font: var(--spelling-font);
}

/* =========================================================================
   2. ELEMENTOR BUTTON RESET
   ========================================================================= */

.elementor-kit-15048 .spelling-practice-root button:not(.settings-toggle):not(.spelling-hint-btn):not(.answer-slot):not(.letter-tile):not(.spelling-audio-btn):not(.spelling-next-btn):not(.spelling-check-btn):not(.spelling-clear-btn):not(.restart-btn):not(.sp-mode-btn):not(.spelling-submit-btn):not(.spelling-skip-btn):not(.spelling-back-btn),
.elementor-kit-15048 .spelling-practice-container button:not(.settings-toggle):not(.spelling-hint-btn):not(.answer-slot):not(.letter-tile):not(.spelling-audio-btn):not(.spelling-next-btn):not(.spelling-check-btn):not(.spelling-clear-btn):not(.restart-btn):not(.sp-mode-btn):not(.spelling-submit-btn):not(.spelling-skip-btn):not(.spelling-back-btn) {
    background-color: transparent;
    border-color: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    text-transform: none;
    border-radius: 0;
    box-shadow: none;
    min-height: auto;
}

/* =========================================================================
   3. BASE CONTAINER
   ========================================================================= */

.spelling-practice-root {
    font-family: var(--spelling-font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--spelling-neutral-800);
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.spelling-practice-container {
    background: white;
    border-radius: var(--spelling-radius-xl);
    box-shadow: var(--spelling-shadow-lg);
    padding: 20px;
    min-height: 400px;
}

/* =========================================================================
   4. HEADER
   ========================================================================= */

.spelling-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--spelling-neutral-100);
    position: relative;
}

.spelling-header .title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spelling-header .exercise-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--spelling-neutral-800);
    margin: 0;
}

/* Settings Toggle - 44x44 desktop, 36x36 mobile */
.spelling-practice-root .settings-toggle {
    background: var(--spelling-neutral-100);
    border: 1px solid var(--spelling-neutral-200);
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--spelling-radius-md);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--spelling-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spelling-practice-root .settings-toggle::before {
    content: '\2699';
    font-size: 1.5rem;
    color: var(--spelling-neutral-600);
    display: block;
}

.spelling-practice-root .settings-toggle:hover {
    background: var(--spelling-neutral-200);
    border-color: var(--spelling-neutral-300);
}

.spelling-practice-root .settings-toggle.open {
    background: var(--spelling-primary);
    border-color: var(--spelling-primary);
}

.spelling-practice-root .settings-toggle.open::before {
    color: white;
}

/* =========================================================================
   5. SETTINGS PANEL (Dropdown Overlay)
   ========================================================================= */

.spelling-practice-root .settings-panel {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    background: var(--spelling-neutral-50);
    border-radius: var(--spelling-radius-lg);
    padding: 16px;
    margin-top: 8px;
    border: 1px solid var(--spelling-neutral-200);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    animation: spellingDropdownFadeIn 0.2s ease;
    min-width: 220px;
}

@keyframes spellingDropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.spelling-practice-root .setting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.spelling-practice-root .setting-row:last-child {
    margin-bottom: 0;
}

.spelling-practice-root .setting-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--spelling-neutral-600);
    min-width: 70px;
    flex-shrink: 0;
}

.spelling-practice-root .setting-select-wrapper {
    flex: 1;
}

.spelling-practice-root .setting-select {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border: 1px solid var(--spelling-neutral-200);
    border-radius: var(--spelling-radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    background: white;
    color: var(--spelling-neutral-800);
    cursor: pointer;
    transition: var(--spelling-transition);
    min-height: 44px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.spelling-practice-root .setting-select:focus {
    outline: none;
    border-color: var(--spelling-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* Progress bar — now handled by shared-components.css (.ex-progress-*) */

/* =========================================================================
   6b. INPUT MODE TOGGLE (Tiles / Typing)
   ========================================================================= */

.sp-mode-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    padding: 4px;
    background: var(--spelling-neutral-100);
    border: 1px solid var(--spelling-neutral-200);
    border-radius: var(--spelling-radius-full);
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.spelling-practice-root .sp-mode-btn {
    flex: 1;
    padding: 8px 16px;
    border: 2px solid transparent;
    border-radius: var(--spelling-radius-full);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--spelling-transition);
    background: transparent;
    color: var(--spelling-neutral-500);
    text-align: center;
}

.spelling-practice-root .sp-mode-btn:hover:not(.active) {
    color: var(--spelling-neutral-600);
    background: var(--spelling-neutral-50);
}

.spelling-practice-root .sp-mode-btn.active {
    background: var(--spelling-primary);
    color: white;
    border-color: var(--spelling-primary);
    font-weight: 600;
    box-shadow: var(--spelling-shadow-sm);
}

.spelling-practice-root .sp-mode-btn.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =========================================================================
   6c. INLINE ROW (Audio + Answer + Check)
   ========================================================================= */

.spelling-inline-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

/* Compact circular audio button inside inline row */
.spelling-inline-row .spelling-audio-btn {
    margin: 0;
    padding: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 1.2rem;
    gap: 0;
}

/* Answer area takes remaining space */
.spelling-answer-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

/* Remove bottom margins from answer elements inside inline row */
.spelling-inline-row .answer-slots-row {
    margin-bottom: 0;
}

.spelling-inline-row .spelling-type-input {
    margin-bottom: 0;
    flex: 1;
}

/* Inline check button (typing mode) */
.spelling-inline-row .spelling-check-btn {
    padding: 10px 20px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Typing result shown inline */
.spelling-type-result {
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 10px 20px;
    border-radius: var(--spelling-radius-lg);
    text-align: center;
}

.spelling-type-result.correct {
    color: var(--spelling-success-dark);
    background: var(--spelling-success-light);
    border: 2px solid var(--spelling-success);
}

.spelling-type-result.incorrect {
    color: var(--spelling-error);
    background: var(--spelling-error-light);
    border: 2px solid var(--spelling-error);
    text-decoration: line-through;
}

/* =========================================================================
   7. IMAGE DISPLAY
   ========================================================================= */

.spelling-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

/* Audio button when placed next to image */
.spelling-image-container .spelling-audio-btn {
    margin: 0;
    padding: 0;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 1.2rem;
    gap: 0;
}

.spelling-word-image,
.spelling-image {
    max-height: 200px;
    max-width: 100%;
    border-radius: var(--spelling-radius-lg);
    object-fit: contain;
}

/* =========================================================================
   8. AUDIO BUTTON (base styles, overridden by .spelling-inline-row context)
   ========================================================================= */

.spelling-audio-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 16px;
    padding: 10px 24px;
    background: var(--spelling-primary);
    border: none;
    border-radius: var(--spelling-radius-full);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--spelling-transition);
    box-shadow: var(--spelling-shadow);
}

.spelling-audio-btn:hover:not(:disabled) {
    background: var(--spelling-primary-dark);
    box-shadow: var(--spelling-shadow-md);
}

.spelling-audio-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spelling-audio-btn.playing {
    background: var(--spelling-success);
}

/* =========================================================================
   9. ANSWER SLOTS
   ========================================================================= */

.answer-slots-row {
    display: flex;
    justify-content: center;
    gap: 3px;
    margin-bottom: 12px;
    flex-wrap: nowrap;
    min-height: 40px;
}

.spelling-practice-root .answer-slot {
    width: 32px;
    height: 36px;
    border: 2px dashed var(--spelling-neutral-300);
    border-radius: var(--spelling-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--spelling-neutral-800);
    background: var(--spelling-neutral-50);
    transition: var(--spelling-transition);
    cursor: default;
    text-transform: uppercase;
    flex-shrink: 1;
    min-width: 22px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.spelling-practice-root .answer-slot.filled {
    border-style: solid;
    border-color: var(--spelling-primary);
    background: var(--spelling-primary-light);
    cursor: pointer;
}

.spelling-practice-root .answer-slot.filled:hover {
    background: #ede9fe;
    border-color: var(--spelling-primary-dark);
}

/* Answer checked states */
.spelling-practice-root .answer-slot.correct {
    border-color: var(--spelling-success);
    background: var(--spelling-success-light);
    color: var(--spelling-success-dark);
    border-style: solid;
}

.spelling-practice-root .answer-slot.incorrect {
    border-color: var(--spelling-error);
    background: var(--spelling-error-light);
    color: var(--spelling-error);
    border-style: solid;
}

/* =========================================================================
   10. LETTER BANK (tile grid)
   ========================================================================= */

.letter-bank {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
    padding: 8px;
    background: var(--spelling-neutral-50);
    border-radius: var(--spelling-radius-lg);
    border: 1px solid var(--spelling-neutral-200);
}

.spelling-practice-root .letter-tile {
    width: 34px;
    height: 38px;
    border-radius: var(--spelling-radius-md);
    border: 2px solid var(--spelling-neutral-300);
    background: white;
    color: var(--spelling-neutral-800);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-shadow: var(--spelling-shadow-sm);
    text-transform: uppercase;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.spelling-practice-root .letter-tile:hover:not(.used) {
    border-color: var(--spelling-primary);
    background: var(--spelling-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--spelling-shadow-md);
}

.spelling-practice-root .letter-tile:active:not(.used) {
    transform: scale(0.95);
}

.spelling-practice-root .letter-tile.used {
    opacity: 0.25;
    cursor: default;
    border-color: var(--spelling-neutral-200);
    box-shadow: none;
}

/* Distractor tiles - subtle different style */
.letter-tile.distractor {
    border-color: var(--spelling-neutral-200);
}

/* =========================================================================
   11. TYPE INPUT (Level 4)
   ========================================================================= */

.spelling-type-input {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.spelling-type-input input {
    width: 100%;
    max-width: 300px;
    padding: 14px 20px;
    border: 2px solid var(--spelling-neutral-300);
    border-radius: var(--spelling-radius-lg);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    color: var(--spelling-neutral-800);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: var(--spelling-transition);
}

.spelling-type-input input:focus {
    outline: none;
    border-color: var(--spelling-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.spelling-type-input input.correct {
    border-color: var(--spelling-success);
    background: var(--spelling-success-light);
}

.spelling-type-input input.incorrect {
    border-color: var(--spelling-error);
    background: var(--spelling-error-light);
}

/* =========================================================================
   12. ACTION BUTTONS
   ========================================================================= */

.spelling-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.spelling-check-btn {
    padding: 12px 32px;
    background: var(--spelling-primary);
    border: none;
    border-radius: var(--spelling-radius-full);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--spelling-transition);
    box-shadow: var(--spelling-shadow);
}

.spelling-check-btn:hover:not(:disabled) {
    background: var(--spelling-primary-dark);
    box-shadow: var(--spelling-shadow-md);
}

.spelling-check-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spelling-hint-btn {
    padding: 12px 20px;
    background: white;
    border: 2px solid var(--spelling-neutral-200);
    border-radius: var(--spelling-radius-full);
    color: var(--spelling-neutral-600);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--spelling-transition);
}

.spelling-hint-btn:hover {
    border-color: var(--spelling-primary);
    color: var(--spelling-primary);
    background: var(--spelling-primary-light);
}

.spelling-clear-btn {
    padding: 10px 16px;
    background: white;
    border: 2px solid var(--spelling-neutral-200);
    border-radius: var(--spelling-radius-full);
    color: var(--spelling-neutral-500);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--spelling-transition);
}

.spelling-clear-btn:hover {
    border-color: var(--spelling-error);
    color: var(--spelling-error);
}

/* Letter bank wrapper — bank + hint side by side */
.spelling-bank-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.spelling-bank-wrapper .letter-bank {
    flex: 1;
    margin-bottom: 0;
}

.spelling-bank-wrapper .spelling-hint-btn {
    flex-shrink: 0;
    align-self: center;
    white-space: nowrap;
}

/* Submit/Check button — centered and prominent */
.spelling-check-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.spelling-practice-root .spelling-submit-btn {
    padding: 14px 40px;
    background: var(--spelling-primary);
    border: none;
    border-radius: var(--spelling-radius-full);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--spelling-transition);
    box-shadow: var(--spelling-shadow-md);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.spelling-practice-root .spelling-submit-btn:hover {
    background: var(--spelling-primary-dark);
    box-shadow: var(--spelling-shadow-lg);
    transform: translateY(-1px);
}

/* Skip button — ghost style */
.spelling-practice-root .spelling-skip-btn {
    padding: 10px 16px;
    background: transparent;
    border: 2px solid var(--spelling-neutral-200);
    border-radius: var(--spelling-radius-full);
    color: var(--spelling-neutral-400);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--spelling-transition);
}

.spelling-practice-root .spelling-skip-btn:hover {
    border-color: var(--spelling-neutral-400);
    color: var(--spelling-neutral-600);
}

/* Back button — ghost style */
.spelling-practice-root .spelling-back-btn {
    padding: 10px 16px;
    background: transparent;
    border: 2px solid var(--spelling-neutral-200);
    border-radius: var(--spelling-radius-full);
    color: var(--spelling-neutral-400);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--spelling-transition);
}

.spelling-practice-root .spelling-back-btn:hover {
    border-color: var(--spelling-neutral-400);
    color: var(--spelling-neutral-600);
}

/* =========================================================================
   12b. DRAG-AND-DROP STYLES
   ========================================================================= */

.letter-tile.dragging {
    opacity: 0.4;
    transform: scale(0.95);
}

.answer-slot.drag-over {
    border-color: var(--spelling-primary);
    background: var(--spelling-primary-light);
    border-style: solid;
    transform: scale(1.05);
}

.touch-drag-clone {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--spelling-primary);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--spelling-radius-md);
    box-shadow: var(--spelling-shadow-lg);
    text-transform: uppercase;
}

/* =========================================================================
   12c. HINT GLOW / WIGGLE ANIMATION
   ========================================================================= */

@keyframes hintWiggle {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-3px) rotate(-2deg); }
    30% { transform: translateX(3px) rotate(2deg); }
    45% { transform: translateX(-2px) rotate(-1deg); }
    60% { transform: translateX(2px) rotate(1deg); }
    75% { transform: translateX(-1px); }
}

@keyframes hintGlow {
    0%, 100% { box-shadow: 0 0 4px rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 0 0 16px rgba(139, 92, 246, 0.7), 0 0 24px rgba(139, 92, 246, 0.3); }
}

.letter-tile.hint-glow {
    animation: hintWiggle 0.6s ease-in-out, hintGlow 1.5s ease-in-out infinite;
    border-color: var(--spelling-primary);
    background: var(--spelling-primary-light);
    z-index: 1;
    position: relative;
}

/* =========================================================================
   12d. AUTO-ADVANCE COUNTDOWN BAR
   ========================================================================= */

.auto-advance-bar {
    width: 100%;
    height: 4px;
    background: var(--spelling-neutral-200);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.auto-advance-fill {
    height: 100%;
    background: var(--spelling-primary);
    border-radius: 2px;
    animation: autoAdvanceShrink 2s linear forwards;
}

@keyframes autoAdvanceShrink {
    from { width: 100%; }
    to { width: 0%; }
}

/* Shown word hint (level 4) */
.spelling-shown-word {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--spelling-primary);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 10px 16px;
    background: var(--spelling-primary-light);
    border: 2px solid #ddd6fe;
    border-radius: var(--spelling-radius-lg);
    margin-bottom: 12px;
}

/* =========================================================================
   13. HINT PANEL
   ========================================================================= */

.spelling-hint-panel {
    background: var(--spelling-primary-light);
    border: 1px solid #ddd6fe;
    border-radius: var(--spelling-radius-lg);
    padding: 12px 16px;
    margin-bottom: 12px;
    text-align: center;
}

.spelling-hint-panel .hint-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--spelling-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.spelling-hint-panel .hint-text {
    font-size: 0.95rem;
    color: var(--spelling-neutral-700);
    line-height: 1.4;
}

/* Feedback overlay — now handled by shared-components.css (.ex-feedback-*) */

.spelling-feedback .correct-word {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--spelling-neutral-800);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
}

.spelling-feedback .feedback-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.spelling-next-btn {
    padding: 12px 32px;
    background: var(--spelling-primary);
    border: none;
    border-radius: var(--spelling-radius-full);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--spelling-transition);
    box-shadow: var(--spelling-shadow);
}

.spelling-next-btn:hover {
    background: var(--spelling-primary-dark);
    box-shadow: var(--spelling-shadow-md);
}

.spelling-hear-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--spelling-neutral-200);
    border-radius: var(--spelling-radius-full);
    color: var(--spelling-neutral-600);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--spelling-transition);
}

.spelling-hear-btn:hover:not(:disabled) {
    border-color: var(--spelling-primary);
    color: var(--spelling-primary);
}

/* =========================================================================
   15. COMPLETE SCREEN
   ========================================================================= */

.spelling-complete-screen {
    text-align: center;
    padding: 20px 0;
}

.spelling-complete-screen .celebration {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.spelling-complete-screen h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--spelling-neutral-800);
    margin: 0 0 24px 0;
}

/* Stats — now handled by shared-components.css (.ex-complete-stats, .ex-stat-*) */

.spelling-complete-screen .encouragement {
    font-size: 1.1rem;
    color: var(--spelling-neutral-600);
    margin-bottom: 28px;
}

.spelling-restart-btn {
    padding: 14px 36px;
    background: var(--spelling-primary);
    border: none;
    border-radius: var(--spelling-radius-full);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--spelling-transition);
    box-shadow: var(--spelling-shadow);
}

.spelling-restart-btn:hover {
    background: var(--spelling-primary-dark);
    box-shadow: var(--spelling-shadow-md);
}

/* =========================================================================
   16. LOADING & ERROR STATES
   ========================================================================= */

.spelling-practice-loading,
.spelling-practice-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
}

/* =========================================================================
   17. RESPONSIVE - MOBILE OPTIMIZED
   ========================================================================= */

@media (max-width: 768px) {
    .spelling-practice-container {
        padding: 16px;
    }

    .spelling-header {
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .spelling-word-image,
    .spelling-image {
        max-height: 175px;
    }

    .answer-slots-row {
        gap: 2px;
    }

    .spelling-practice-root .answer-slot {
        width: 28px;
        height: 32px;
        font-size: 0.9rem;
    }

    .spelling-practice-root .letter-tile {
        width: 30px;
        height: 34px;
        font-size: 0.9rem;
    }

    .letter-bank {
        padding: 6px;
        gap: 4px;
    }

    .spelling-bank-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .spelling-bank-wrapper .spelling-hint-btn {
        align-self: center;
    }
}

@media (max-width: 500px) {
    .spelling-practice-root {
        padding: 8px;
    }

    .spelling-practice-container {
        padding: 14px;
        border-radius: var(--spelling-radius-lg);
    }

    .spelling-header .exercise-title {
        font-size: 1rem;
    }

    /* Mode toggle compact */
    .sp-mode-toggle {
        max-width: 240px;
    }

    .spelling-practice-root .sp-mode-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .spelling-word-image,
    .spelling-image {
        max-height: 150px;
    }

    .spelling-practice-root .answer-slot {
        width: 26px;
        height: 30px;
        font-size: 0.85rem;
        min-width: 20px;
    }

    .answer-slots-row {
        gap: 2px;
    }

    .spelling-practice-root .letter-tile {
        width: 28px;
        height: 32px;
        font-size: 0.85rem;
    }

    .letter-bank {
        gap: 3px;
        padding: 6px;
    }

    .spelling-audio-btn {
        padding: 8px 20px;
        font-size: 0.85rem;
    }

    .spelling-nav-row {
        gap: 6px;
    }

    .spelling-practice-root .settings-panel {
        min-width: 200px;
        right: -10px;
    }

    .spelling-practice-root .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .spelling-practice-container {
        padding: 10px;
    }

    .spelling-practice-root .answer-slot {
        width: 22px;
        height: 26px;
        font-size: 0.75rem;
        min-width: 18px;
    }

    .spelling-practice-root .letter-tile {
        width: 24px;
        height: 28px;
        font-size: 0.75rem;
    }
}

/* Navigation row (back, clear, skip) */
.spelling-nav-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

/* Hint row — below nav, centered */
.spelling-hint-row {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

/* =========================================================================
   18. ACCESSIBILITY
   ========================================================================= */

.spelling-practice-root .settings-toggle:focus,
.spelling-audio-btn:focus,
.letter-tile:focus,
.answer-slot:focus,
.spelling-check-btn:focus,
.spelling-hint-btn:focus,
.spelling-clear-btn:focus,
.spelling-next-btn:focus,
.spelling-hear-btn:focus,
.spelling-restart-btn:focus,
.spelling-practice-root .sp-mode-btn:focus,
.spelling-practice-root .setting-select:focus {
    outline: 3px solid var(--spelling-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {


    .letter-tile:hover:not(.used),
    .spelling-check-btn:hover,
    .spelling-next-btn:hover {
        transform: none;
    }

    .spelling-feedback,
    .spelling-practice-root .settings-panel {
        animation: none;
    }
}

/* =========================================================================
   19. ELEMENTOR PREVIEW
   ========================================================================= */

.spelling-practice-preview {
    padding: 20px;
}

.spelling-practice-preview .preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--spelling-neutral-200);
}

.spelling-practice-preview .preview-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.spelling-practice-preview .preview-badge {
    background: linear-gradient(135deg, var(--spelling-primary), var(--spelling-primary-dark));
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--spelling-radius-full);
}

.spelling-practice-preview .preview-settings {
    background: var(--spelling-neutral-50);
    border-radius: var(--spelling-radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.spelling-practice-preview .preview-settings p {
    margin: 4px 0;
    font-size: 0.9rem;
    color: var(--spelling-neutral-600);
}

.spelling-practice-preview .preview-exercise {
    text-align: center;
}

.spelling-practice-preview .preview-prompt {
    font-size: 1rem;
    color: var(--spelling-neutral-700);
    margin-bottom: 16px;
}

.spelling-practice-preview .preview-answer-slots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.spelling-practice-preview .preview-slot {
    width: 44px;
    height: 48px;
    border: 2px dashed var(--spelling-neutral-300);
    border-radius: var(--spelling-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--spelling-neutral-400);
    background: var(--spelling-neutral-50);
}

.spelling-practice-preview .preview-letter-bank {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.spelling-practice-preview .preview-tile {
    width: 44px;
    height: 48px;
    border: 2px solid var(--spelling-neutral-300);
    border-radius: var(--spelling-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--spelling-neutral-700);
    background: white;
}
