/* Scaffolding Extras (Syllables, POS, Synonyms) */
.scaffolding-extras-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scaffold-section h4 {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Word Breakdown Visual */
.breakdown-visual {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(var(--primary-rgb), 0.05);
    padding: 12px;
    border-radius: 8px;
    justify-content: center;
}

.syllable-chip {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    font-family: 'Roboto Mono', monospace;
    /* Monospace for alignment */
}

.syllable-divider {
    color: var(--primary-color);
    font-size: 0.8rem;
    opacity: 0.5;
}

/* Context & POS */
.context-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.pos-tag {
    background: #e0f2fe;
    color: #0284c7;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

.synonyms-list {
    font-size: 0.95rem;
    color: var(--text-color);
}

/* Compact Pattern List */
.pattern-list-compact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pattern-list-compact li {
    padding: 6px 10px;
    border-left: 3px solid var(--secondary-color);
    background: rgba(var(--secondary-rgb), 0.05);
    margin-bottom: 6px;
    font-size: 0.9rem;
    border-radius: 0 4px 4px 0;
}

.pattern-list-compact li:last-child {
    margin-bottom: 0;
}

/* ============================================
   WORD SCAFFOLDING PANEL (Figma Design)
   ============================================ */

.scaffolding-letter-hints {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.scaffolding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.scaffolding-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.scaffolding-title .icon {
    font-size: 1.2rem;
}

.reveal-hint-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #7c3aed;
    border-radius: 8px;
    background: transparent;
    color: #7c3aed;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reveal-hint-btn:hover {
    background: #7c3aed;
    color: white;
}

.letter-hint-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.letter-hint-word {
    display: inline-flex;
    gap: 0px;
    /* Reduced to 0 for natural word spacing */
}

.word-separator {
    width: 10px;
}

.letter-box {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    /* Changed from 14px to allow tight packing */
    height: auto;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    border-radius: 4px;
    /* text-transform: lowercase; Removed to allow capitalization */
    transition: color 0.2s ease;
    padding: 0;
    /* Removed padding for natural text flow */
    background: transparent;
}

.letter-box.revealed {
    background: transparent;
    color: #7c3aed;
    border: none;
    min-width: auto;
}

.letter-box.hidden {
    background: transparent;
    border: none;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    border-bottom: 2px solid #94a3b8;
    border-radius: 0;
    min-width: 16px;
    height: 1.4em;
    margin: 0 2px;
    /* Increased margin slightly for clear separation */
    color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.letter-box.hidden:hover {
    border-bottom-color: #7c3aed;
    background: rgba(124, 58, 237, 0.05);
}

.letter-box.punctuation {
    width: auto;
    min-width: 8px;
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 18px;
    margin: 0 2px;
}

.scaffolding-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.hints-balance {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hints-dots {
    display: flex;
    gap: 4px;
}

.hint-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
}

.hint-dot.used {
    background: #7c3aed;
}

.hints-remaining {
    font-size: 0.8rem;
    font-weight: 600;
    color: #7c3aed;
}

/* ============================================
   ADAPTIVE DIFFICULTY SCAFFOLDING
   ============================================ */

/* Auto-Hints Container */
.auto-hints-container {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    display: none;
}

.auto-hint-item {
    font-size: 0.95rem;
    color: #0369a1;
    line-height: 1.6;
    margin-bottom: 8px;
}

.auto-hint-item:last-child {
    margin-bottom: 0;
}

.auto-hint-item strong {
    color: #0284c7;
    font-weight: 700;
}

/* First Letters Hint - Monospace Style */
.auto-hint-item[data-hint-type="first-letters"] {
    font-family: 'Roboto Mono', 'Consolas', monospace;
    letter-spacing: 1px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 8px;
}

/* Replay Counter Badge */
#replay-counter-type,
#replay-counter-speak {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #4f46e5;
    margin-left: 12px;
    padding: 6px 14px;
    background: #f8fafc;
    border: 1px solid #e0e7ff;
    border-radius: 12px;
    letter-spacing: 0.3px;
    cursor: help;
    user-select: none;
}

#replay-counter-type.limit-reached,
#replay-counter-speak.limit-reached {
    background: #fef2f2;
    color: #dc2626;
    font-weight: 600;
}

/* Disabled Play Button */
#play-btn:disabled,
#play-btn-speak:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e2e8f0;
}

/* Transcript Glimpse (Timed Overlay) */
.transcript-glimpse-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.35);
    z-index: 12000;
}

.transcript-glimpse-card {
    width: min(760px, 100%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 18px 16px;
    box-shadow: 0 20px 60px rgba(2, 6, 23, 0.35);
    backdrop-filter: blur(8px);
}

.transcript-glimpse-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.2px;
    margin-bottom: 10px;
}

.transcript-glimpse-text {
    font-size: 1.1rem;
    line-height: 1.5;
    color: #0f172a;
}

/* Difficulty Badge Enhancement */
.difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.difficulty-badge.level-1 {
    background: #dcfce7;
    color: #166534;
}

.difficulty-badge.level-2 {
    background: #fef9c3;
    color: #854d0e;
}

.difficulty-badge.level-3 {
    background: #fee2e2;
    color: #991b1b;
}

.difficulty-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Character Slot Hint Styling */
.auto-hint-item[data-hint-type="first-letters"] {
    font-family: inherit;
    padding: 0;
    background: transparent;
    border: none;
    display: block;
}

.hint-sentence-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding: 8px 0;
}

.hint-word {
    display: inline-flex;
    gap: 3px;
    margin-bottom: 4px;
    align-items: baseline;
}

.hint-char {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 32px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 18px;
    border-radius: 4px;
    position: relative;
    border: 1px solid #cbd5e1;
    background-color: #f8fafc;
    margin: 0 1px;
}

.hint-char.revealed {
    color: #1e293b;
    font-weight: 700;
    border: 1px solid #3b82f6;
    background-color: #eff6ff;
}

.hint-char.hidden {
    color: transparent;
    border: 2px solid #64748b;
    background-color: #cbd5e1;
}

.hint-char.punctuation {
    width: auto;
    min-width: 10px;
    margin: 0 1px;
    color: #475569;
    font-weight: 600;
    font-family: inherit;
    border: none;
    background: transparent;
    font-size: 20px;
}

/* Audio Controls & Hint Button Styles */

.audio-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.playback-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.audio-tools {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #f1f5f9;
    padding: 2px;
    border-radius: 6px;
}

.tool-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 32px;
}

.tool-btn:hover:not(:disabled):not(.locked) {
    background: #e2e8f0;
    color: #334155;
}

.tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
    pointer-events: none;
}

.tool-btn.locked {
    opacity: 0.5;
    filter: grayscale(0.8);
    cursor: pointer;
}

.tool-btn.active {
    background: #e0f2fe;
    color: #0284c7;
}

/* Unified Control Toolbar Layout */
.control-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 16px;
    margin-top: 12px;
}

.function-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.utility-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    /* Push to right */
}

/* Hint Button */
.hint-controls {
    display: flex;
    align-items: center;
    /* Reset legacy styles from style.css */
    margin-top: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
}

.hint-btn,
.hint-badge-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    height: 30px;
    /* Harmonize with tool-btn typical height */
    box-sizing: border-box;
}

.hint-btn:hover:not(:disabled):not(.locked),
.hint-badge-btn:hover:not(:disabled):not(.locked) {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #334155;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.hint-btn:disabled,
.hint-badge-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f1f5f9;
}

.hint-btn.locked,
.hint-badge-btn.locked {
    opacity: 0.5;
    filter: grayscale(0.6);
    background: #f8fafc;
    cursor: pointer;
}

.hint-icon {
    font-size: 0.95rem;
}

.hint-cost {
    font-size: 0.75rem;
    font-weight: 700;
    color: #f59e0b;
    background: #fffbeb;
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: 2px;
}

.control-row-secondary {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    width: 100%;
}

/* ============================================
   ACTION POPOVER MENU (RPG Skills)
   ============================================ */
.hint-controls {
    position: relative;
    /* Need this for absolute positioning of popover */
}

.action-popover-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 100;
    min-width: 200px;
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: left;
    width: 100%;
}

.popover-item:hover {
    background: #f8fafc;
}

.popover-icon {
    font-size: 1.2rem;
}

.popover-label {
    flex-grow: 1;
    font-weight: 600;
    color: #334155;
    font-size: 0.85rem;
}

.popover-cost {
    font-size: 0.75rem;
    font-weight: 700;
    color: #f59e0b;
    background: #fffbeb;
    padding: 2px 5px;
    border-radius: 4px;
}

/* ============================================
   DICTIONARY PEEK (Reading Skill)
   ============================================ */
.dict-peek-bubble {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px;
    animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dict-peek-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #3b82f6;
    border-radius: 4px;
    transition: background 0.2s;
}

.dict-peek-btn:hover {
    background: #eff6ff;
}

.dict-peek-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 10000;
}

.dict-peek-modal-content {
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.dict-peek-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}

.dict-peek-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #1e293b;
    text-transform: capitalize;
}

.dict-peek-body {
    padding: 20px;
    overflow-y: auto;
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.5;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   SECOND TAKE (Speak Retry Overlay)
   ============================================ */
.second-take-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.second-take-card {
    background: #fff;
    padding: 24px 32px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 360px;
    width: 90%;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.second-take-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.3rem;
    color: #1e293b;
}

.second-take-card p {
    margin: 0 0 16px 0;
    color: #64748b;
    font-size: 0.95rem;
}

.second-take-card button {
    margin: 0 6px;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* ============================================
   PRON RUNE (IPA Display)
   ============================================ */
.pron-rune-display {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 1px solid #c4b5fd;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.pron-rune-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #7c3aed;
    white-space: nowrap;
}

.pron-rune-text {
    font-family: 'Noto Sans', 'Segoe UI', sans-serif;
    font-size: 1rem;
    color: #4c1d95;
    letter-spacing: 1px;
}

/* ============================================
   DICT PEEK (Definition Display)
   ============================================ */
.dict-peek-pos {
    color: #3b82f6;
    margin-top: 10px;
    margin-bottom: 4px;
    text-transform: capitalize;
}

.dict-peek-defs {
    padding-left: 20px;
    margin-top: 0;
}

.dict-peek-defs li {
    margin-bottom: 4px;
}