html, body {
    touch-action: manipulation;
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    margin: 0; 
    padding: 0; 
    height: 100vh;
    height: 100dvh; 
    overflow: hidden; 
    background: linear-gradient(to right, #009246 33.33%, #F1F2F5 33.33%, #F1F2F5 66.66%, #CE2B37 66.66%);
    background-attachment: fixed;
    color: #333; 
    box-sizing: border-box;
}

/* BACKGROUND WATERMARKS FOR DESKTOP */
.bg-watermark { display: none; }
@media (min-width: 1200px) {
    .bg-watermark { display: flex; flex-direction: column; position: fixed; top: 50%; transform: translateY(-50%); z-index: 0; color: rgba(255, 255, 255, 0.25); pointer-events: none; width: 28%; text-align: center; user-select: none; }
    .bg-watermark.left { left: 2%; }
    .bg-watermark.right { right: 2%; }
    .wm-title { font-size: 2.2rem; font-weight: 900; letter-spacing: 2px; margin-bottom: 25px; text-transform: uppercase; border-bottom: 2px solid rgba(255, 255, 255, 0.15); padding-bottom: 10px; color: rgba(255, 255, 255, 0.4); }
    .wm-section { font-size: 1.2rem; margin-bottom: 25px; line-height: 1.5; }
    .wm-section strong { font-size: 1.4rem; color: rgba(255, 255, 255, 0.4); display: block; margin-bottom: 5px; letter-spacing: 1px; }
    .wm-section em { font-style: italic; font-weight: bold; opacity: 0.9; }
}
.wm-footer { margin-top: 15px; border-top: 1px solid rgba(255, 255, 255, 0.15); padding-top: 15px; text-align: center; }
.wm-speaker-btn { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.7); cursor: pointer; font-size: 0.85rem; font-weight: bold; padding: 8px 18px; border-radius: 20px; pointer-events: auto; transition: all 0.2s ease; text-transform: uppercase; letter-spacing: 1.5px; }
.wm-speaker-btn:hover { background: rgba(255, 255, 255, 0.25); color: #fff; transform: translateY(-2px); }

.app-container { 
    position: relative; 
    z-index: 10; 
    background: rgba(255, 255, 255, 0.97);
    padding: 25px 20px 52px 20px; 
    border-radius: 0; 
    width: 100%; 
    max-width: 850px; 
    margin: 0 auto; 
    height: 100dvh;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15); 
    border: 1px solid rgba(0,0,0,0.05); 
    display: flex; 
    flex-direction: column; 
    box-sizing: border-box; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
}

h1 { margin-top: 0; margin-bottom: 5px; font-size: 2.2em; letter-spacing: 1px; color: #000; text-shadow: none; text-align: center; }
.subtitle { 
    color: #4a5568; 
    margin-bottom: 15px; 
    font-style: italic; 
    text-align: center; 
    letter-spacing: 0.8px; 
    font-weight: 500; 
}

/* ==========================================================
   STANDARDIZED TAB SECTION HEADERS, SUBTITLES & CARD CONTAINERS
   ========================================================== */
.tab-lobby-container,
#voiceLobby,
#book-selection-state,
#training-selection-state,
#games-menu-container {
    width: 100% !important;
    max-width: 450px !important;
    margin: 0 auto !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

#book-selection-state h2,
#voiceLobby h2,
#voiceLobby h3,
#training-selection-state h2,
#games-menu-container h2,
.tab-section-title {
    margin: 0 0 4px 0 !important;
    color: #1e293b !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    line-height: 1.3 !important;
    letter-spacing: normal !important;
}

#book-selection-state > p,
#voiceLobby > p,
#training-selection-state > p,
#games-menu-container > p,
.tab-section-subtitle {
    margin-top: 4px !important;
    margin-bottom: 20px !important;
    color: #64748b !important;
    font-size: 13.5px !important;
    line-height: 1.4 !important;
    text-align: center !important;
    padding: 0 10px !important;
    box-sizing: border-box !important;
}

/* Unified Card Lists Across All Tabs */
#book-grid,
#modeButtons,
#training-grid,
#games-menu {
    width: 100% !important;
    max-width: 450px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
}

/* Dedicated Spacing for Starting Point / Personal 20 Card in Reading View */
#p20OnboardingWrapper,
#startingPointWrapper {
    width: 100% !important;
    max-width: 450px !important;
    margin: 0 auto 22px auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

#p20OnboardingWrapper[style*="display: none"],
#p20OnboardingWrapper[style*="display:none"],
#startingPointWrapper[style*="display: none"],
#startingPointWrapper[style*="display:none"] {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
}

/* Persistent Badge of Honor Styles */
.badge-of-honor-wrapper { display: flex; justify-content: center; align-items: center; margin-bottom: 20px; width: 100%; min-height: 21px; }
.badge-honor-pill { 
    padding: 2px 8px; 
    border-radius: 6px; 
    font-weight: 600; 
    font-size: 11px; 
    letter-spacing: 0.5px;
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
    cursor: pointer; 
    transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    user-select: none;
    box-sizing: border-box;
    height: 21px;
    line-height: 1;
}
.badge-honor-pill:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(0, 102, 178, 0.18); 
}
#userBadgeHonor:not(.badge-ready) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
#userBadgeHonor.badge-ready {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* User Profile Icon */
.user-profile-icon { position: absolute; top: 20px; left: 20px; color: #555; transition: 0.2s; z-index: 20; display: flex; align-items: center; justify-content: center; background: #f1f2f5; padding: 8px; border-radius: 50%; border: 1px solid #e0e0e0; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.user-profile-icon:hover { color: #0066b2; transform: scale(1.05); background: #eef5fa; }
@media (max-width: 550px) { .user-profile-icon { top: 12px; left: 12px; transform: scale(0.85); transform-origin: top left; } .user-profile-icon:hover { transform: scale(0.9); } }

/* Global Auto-Read Toggle */
.global-autoread { display: none; position: absolute; top: 20px; right: 20px; align-items: center; gap: 8px; background: #f1f2f5; padding: 6px 14px; border-radius: 20px; border: 1px solid #e0e0e0; z-index: 20; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
@media (max-width: 550px) { .global-autoread { top: 12px; right: 12px; transform: scale(0.85); transform-origin: top right; } }

.user-community-icon { position: absolute; top: 20px; right: 20px; color: #555; transition: 0.2s; z-index: 20; display: flex; align-items: center; justify-content: center; background: #f1f2f5; padding: 8px; border-radius: 50%; border: 1px solid #e0e0e0; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.user-community-icon:hover { color: #0066b2; transform: scale(1.05); background: #eef5fa; }
@media (max-width: 550px) { .user-community-icon { top: 12px; right: 12px; transform: scale(0.85); transform-origin: top right; } .user-community-icon:hover { transform: scale(0.9); } }

.view-section { display: none; flex-direction: column; align-items: center; width: 100%; }
.view-section.active { display: flex; }

button.connect-btn { padding: 14px 30px; font-size: 17px; font-weight: bold; background: #009246; color: white; border: none; border-radius: 12px; cursor: pointer; margin-top: 15px; transition: 0.2s; box-shadow: 0 4px 15px rgba(0, 146, 70, 0.4); width: 100%; max-width: 350px; }
button.connect-btn:hover { filter: brightness(1.1); transform: translateY(-2px); }
button.connect-btn.active-red { background: #CE2B37; box-shadow: 0 4px 15px rgba(206, 43, 55, 0.4); }
button.action-btn { background: #0066b2; margin-top: 10px; box-shadow: 0 4px 15px rgba(0, 102, 178, 0.4); }

.replay-btn { background: rgba(0, 146, 70, 0.1); border: 1px solid rgba(0, 146, 70, 0.2); border-radius: 12px; padding: 4px 10px; color: #009246; cursor: pointer; font-size: 12px; font-weight: bold; transition: 0.2s; display: inline-flex; align-items: center; gap: 5px; }
.replay-btn:hover { background: rgba(0, 146, 70, 0.2); }

.controls { display: flex; gap: 15px; margin-top: 15px; flex-wrap: wrap; justify-content: center; width: 100%; }
.mode-buttons { display: flex; gap: 8px; margin-top: 15px; justify-content: center; width: 100%; flex-wrap: wrap; }
.mode-btn { padding: 8px 12px; font-size: 13px; font-weight: bold; background: #f1f2f5; color: #333; border: 1px solid #ccc; border-radius: 8px; cursor: pointer; transition: 0.2s; }
.mode-btn:hover { background: #e0e0e0; }
.action-row { display: flex; gap: 10px; margin-top: 15px; }

#status { margin-top: 15px; color: #333; font-weight: bold; font-size: 16px; text-align: center; }
.meter { width: 100%; max-width: 350px; height: 10px; background: #e0e0e0; margin-top: 20px; border-radius: 10px; overflow: hidden; border: 1px solid #ccc; }

/* ==========================================
   DUAL-CHANNEL AUDIO DOCK & VISUALIZER
   ========================================== */
.dual-audio-dock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 10px 18px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dock-channel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.dock-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dock-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.dock-dot.ai-dot.active {
    background: #0066b2;
    box-shadow: 0 0 8px rgba(0, 102, 178, 0.7);
}

.dock-dot.mic-dot.active {
    background: #009246;
    box-shadow: 0 0 8px rgba(0, 146, 70, 0.7);
}

.dock-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dock-divider {
    width: 1px;
    height: 28px;
    background: #e2e8f0;
    flex-shrink: 0;
}

/* AI 12-Bar Waveform Visualizer */
.ai-visualizer-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 18px;
    gap: 3px;
    padding: 0 2px;
}

.ai-bar {
    flex: 1;
    min-width: 3px;
    max-width: 6px;
    height: 3px;
    background: #0066b2;
    border-radius: 2px;
    opacity: 0.35;
    transition: height 0.08s ease, opacity 0.15s ease;
}

/* User Microphone Horizontal Meter */
.mic-meter-track {
    width: 100%;
    height: 8px;
    background: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    position: relative;
    box-sizing: border-box;
}

.mic-meter-fill, #volumeBar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #009246, #10b981);
    border-radius: 9999px;
    transition: width 0.05s ease;
}

/* ==========================================
   ACTIVE LIVE STUDIO CARD & SWITCHER TRAY
   ========================================== */
.voice-studio-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    width: 100%;
    max-width: 520px;
    margin: 10px auto 0 auto;
    padding: 24px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: studioFadeIn 0.3s ease;
}

@keyframes studioFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes liveDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.85); }
}

.studio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.studio-module-info {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
}

.studio-module-icon {
    font-size: 32px;
    line-height: 1;
    min-width: 36px;
    text-align: center;
}

.studio-module-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.studio-module-desc {
    font-size: 13px;
    color: #64748b;
    margin: 3px 0 0 0;
}

.studio-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(0, 146, 70, 0.1);
    border: 1px solid rgba(0, 146, 70, 0.25);
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    color: #009246;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #009246;
    box-shadow: 0 0 8px rgba(0, 146, 70, 0.7);
    animation: liveDotPulse 2s infinite ease-in-out;
}

/* ==========================================
   2-WAY LIVE TRANSCRIPT CONSOLE & WHISPER TRAY
   ========================================== */
.transcript-console {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.transcript-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.transcript-toolbar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    color: #64748b;
}

.transcript-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hint-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f0f7ff;
    border: 1px solid rgba(0, 102, 178, 0.25);
    color: #0066b2;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hint-pill-btn:hover {
    background: #e0f0ff;
    border-color: #0066b2;
    transform: translateY(-1px);
}

.hint-pill-btn:active {
    transform: translateY(0);
}

.toggle-transcript-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toggle-transcript-pill-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.live-transcript-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    min-height: 80px;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px 14px;
    box-sizing: border-box;
    text-align: left;
    scroll-behavior: smooth;
}

.live-transcript-content {
    transition: filter 0.2s ease;
}

.live-transcript-content.transcript-blurred {
    filter: blur(6px);
    user-select: none;
}

.transcript-empty-state {
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

.transcript-line {
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 6px;
    word-break: break-word;
}

.transcript-line:last-child {
    margin-bottom: 0;
}

.transcript-speaker-user {
    color: #009246;
    font-weight: 700;
    margin-right: 6px;
}

.transcript-speaker-ai {
    color: #0066b2;
    font-weight: 700;
    margin-right: 6px;
}

.transcript-text {
    color: #1e293b;
}

/* ==========================================
   💡 SUGGERIMENTO WHISPER TRAY
   ========================================== */
.whisper-tray {
    background: #ffffff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 4px 14px rgba(0, 102, 178, 0.08);
    animation: studioFadeIn 0.2s ease;
    text-align: left;
}

.whisper-tray-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.whisper-tray-title {
    font-size: 12px;
    font-weight: 700;
    color: #0066b2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.whisper-close-btn {
    background: none;
    border: none;
    font-size: 13px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.whisper-close-btn:hover {
    color: #475569;
    background: #f1f5f9;
}

.whisper-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.whisper-card {
    background: #f0f7ff;
    border-left: 3px solid #0066b2;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.whisper-card:hover {
    background: #e5f1ff;
    transform: translateX(2px);
}

.whisper-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.whisper-italian {
    font-weight: 600;
    color: #0f172a;
    font-size: 13.5px;
}

.whisper-tag {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 102, 178, 0.12);
    color: #0066b2;
    flex-shrink: 0;
}

.whisper-english {
    color: #64748b;
    font-size: 0.78rem;
    margin-top: 2px;
}

.voice-studio-card .dual-audio-dock {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 13px 20px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.studio-input-row {
    display: flex;
    width: 100%;
    gap: 8px;
}

.studio-input-row input {
    transition: border-color 0.2s, box-shadow 0.2s;
}

.studio-input-row input:focus {
    outline: none;
    border-color: #0066b2;
    box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.15);
}

.studio-end-btn {
    padding: 11px 32px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
}

.studio-end-btn:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.studio-switcher-tray {
    border-top: 1px solid #f1f5f9;
    padding-top: 16px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.switcher-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.switcher-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.switcher-chip {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 5px 13px;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.switcher-chip:hover {
    background: #f8fafc;
    border-color: #0066b2;
    color: #0066b2;
    transform: translateY(-1px);
}

/* ==========================================
   VERTICAL GAMES MENU STYLING
   ========================================== */
#games-view.active {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
}

#games-menu-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    width: 100% !important;
    max-width: 450px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
}

#games-menu {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 450px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

#games-menu button.connect-btn,
#games-menu .action-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    width: 100% !important;
    max-width: 450px !important;
    margin: 0 auto !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
}

/* ==========================================
   VOICE MODE CLEAN LIBRARY-MATCHED STYLING
   ========================================== */

.voice-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.voice-status-pill::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    display: inline-block;
    transition: background 0.3s ease;
}

.voice-status-pill.connected {
    background: #f0fdf4 !important;
    color: #166534 !important;
    border-color: #bbf7d0 !important;
    box-shadow: 0 2px 6px rgba(22, 101, 52, 0.08) !important;
}

.voice-status-pill.connected::before {
    background: #22c55e !important;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.voice-transcript-ticker {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    min-height: 70px;
    max-height: 100px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 15px;
    font-size: 14.5px;
    color: #475569;
    font-style: italic;
}

/* Standard Cards & Voice Module Cards (Identical style across Reading, Voice, and Training) */
#modeButtons {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 450px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.voice-module-card,
.standard-card {
    background: #ffffff !important;
    border: 1px solid #ddd !important;
    border-radius: 12px !important;
    padding: 16px 20px !important;
    width: 100% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04) !important;
    transition: 0.2s ease !important;
    text-align: left !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.voice-module-card:hover,
.standard-card:hover {
    transform: translateY(-2px) !important;
    border-color: #0066b2 !important;
    box-shadow: 0 4px 12px rgba(0, 102, 178, 0.1) !important;
}

.standard-card h4,
.starting-point-card h4,
.personal-20-menu-card h4,
#book-grid h4,
#training-grid h4 {
    margin: 0 0 4px 0 !important;
    text-align: left !important;
}

.standard-card h4,
#book-grid h4,
#training-grid h4:not(.personal-20-title):not(.starting-point-title) {
    color: #1e293b !important;
    font-size: 15px !important;
    font-weight: 600 !important;
}

.standard-card p,
.starting-point-card p,
.personal-20-menu-card p,
#book-grid p,
#training-grid p {
    margin: 0 !important;
    font-size: 12.5px !important;
    color: #64748b !important;
    line-height: 1.4 !important;
    text-align: left !important;
    padding: 0 !important;
}

.standard-card .card-text-block,
.starting-point-card .card-text-block,
.personal-20-menu-card .card-text-block,
.voice-module-card .card-text-block,
#book-grid .card-text-block,
#training-grid .card-text-block,
#book-grid > div > div:last-child,
#training-grid > div > div:last-child {
    flex: 1 !important;
    min-width: 0 !important;
    text-align: left !important;
}

.card-text-block,
.card-text-block h4,
.card-text-block p,
.card-text-block div {
    text-align: left !important;
}

/* ==========================================
   VOICE SESSION LIMIT BANNER & CARD STYLES
   ========================================== */
.voice-limit-banner {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    border-left: 4px solid #ce2b37 !important;
    color: #991b1b !important;
    padding: 12px 16px !important;
    border-radius: 10px !important;
    margin-bottom: 16px !important;
    font-size: 0.92rem !important;
    text-align: left !important;
    box-shadow: 0 2px 6px rgba(206, 43, 55, 0.08) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    box-sizing: border-box !important;
}

.voice-limit-banner-title {
    font-weight: 700 !important;
    margin-bottom: 4px !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    color: #991b1b !important;
    font-size: 0.95rem !important;
}

.voice-limit-banner-text {
    font-size: 13px !important;
    line-height: 1.45 !important;
    color: #7f1d1d !important;
}

@keyframes shakeLimitBanner {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.voice-limit-banner.shake-highlight {
    animation: shakeLimitBanner 0.45s ease-in-out !important;
    box-shadow: 0 0 0 3px rgba(206, 43, 55, 0.3) !important;
}

.voice-module-card.quota-locked {
    opacity: 0.65 !important;
    border-color: #fca5a5 !important;
    background: #fffcfc !important;
    cursor: not-allowed !important;
}

.voice-module-card.quota-locked:hover {
    transform: none !important;
    border-color: #ef4444 !important;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1) !important;
}

.voice-limit-badge {
    background: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fca5a5 !important;
    padding: 3px 8px !important;
    border-radius: 9999px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px !important;
    white-space: nowrap !important;
    text-transform: uppercase !important;
    margin-left: auto !important;
}


/* ==========================================
   UNIVERSAL CHAT BUBBLE SYSTEM
   ========================================== */
.chat-box { 
    position: relative; 
    margin-top: 20px; 
    background: #fefdfa; 
    padding: 30px; 
    border-radius: 16px; 
    width: 100%; 
    height: 400px; 
    overflow-y: auto; 
    border: 1px solid #e8e4d9; 
    box-sizing: border-box; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.03); 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

.chat-bubble { 
    position: relative; 
    word-wrap: break-word; 
    font-family: 'Segoe UI', sans-serif; 
}

.chat-bubble.user { 
    align-self: flex-start; 
    background-color: transparent; 
    color: #0066b2; 
    border: none;
    border-left: 3px solid #0066b2; 
    border-radius: 0; 
    padding: 2px 0 2px 12px; 
    font-size: 14.5px; 
    font-weight: 600; 
    font-style: italic;
    box-shadow: none; 
    max-width: 100%; 
    margin-bottom: -5px; 
}

.chat-bubble.ai { 
    align-self: flex-start; 
    width: 100%; 
    max-width: 100%; 
    background-color: transparent; 
    color: #2c2c2c; 
    border-radius: 0; 
    padding: 0; 
    box-shadow: none; 
    border: none; 
    font-size: 16px; 
    line-height: 1.8; 
}

.sys-msg { 
    color: #b26600; 
    font-weight: bold; 
    text-align: center; 
    font-size: 14px; 
    margin: 15px 0; 
    align-self: center; 
}

/* ==========================================
   MODERN TEXT INPUTS
   ========================================== */
.reading-input-area { width: 100%; display: flex; flex-direction: column; align-items: center; margin-top: 15px; gap: 10px; }

#readingInput, #voiceTextInput { 
    width: 100%; 
    padding: 16px; 
    border-radius: 16px !important; 
    border: 2px solid #e2e8f0 !important; 
    background-color: #f8fafc !important;
    font-size: 15px !important; 
    line-height: 1.5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    box-sizing: border-box; 
    transition: all 0.2s ease-in-out !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02) !important;
    color: #333;
}
#readingInput {
    resize: vertical; 
    min-height: 100px; 
}
#readingInput:focus, #voiceTextInput:focus {
    outline: none !important;
    border-color: #0066b2 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(0, 102, 178, 0.15) !important;
}

/* ==========================================
   EXPANDED READING MODE (MASSIVE CANVAS)
   ========================================== */
#active-reading-state { 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; 
    gap: 12px; 
    height: auto; 
    min-height: 0; 
    flex: 0 0 auto; 
    width: 100%; 
    box-sizing: border-box;
}

body.reading-drawer-open #active-reading-state {
    padding-bottom: max(72px, calc(68px + env(safe-area-inset-bottom, 34px)));
}

@media (max-width: 768px) {
    /* Zero-scroll lock strictly for Custom Story pane when drawers are closed */
    body.reading-page.custom-story-active:not(.reading-drawer-open) .app-container,
    body.reading-page:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) .app-container {
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow-y: hidden !important;
        overscroll-behavior-y: none !important;
        padding: 12px 14px max(72px, calc(68px + env(safe-area-inset-bottom, 34px))) 14px !important;
        box-sizing: border-box !important;
    }
    body.custom-story-active:not(.reading-drawer-open) #reading-view,
    body:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) #reading-view {
        height: 100% !important;
        max-height: 100% !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }
    body.custom-story-active:not(.reading-drawer-open) #active-reading-state,
    body:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) #active-reading-state {
        height: 100% !important;
        max-height: 100% !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    body.custom-story-active:not(.reading-drawer-open) #readingChatBox:not(.fullscreen),
    body:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) #readingChatBox:not(.fullscreen) {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        padding: 14px 16px 10px 16px !important;
        margin-bottom: 0 !important;
    }
    body.custom-story-active:not(.reading-drawer-open) #executiveStoryCanvas,
    body:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) #executiveStoryCanvas {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        height: 100% !important;
    }
    body.custom-story-active:not(.reading-drawer-open) .story-header-top,
    body:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) .story-header-top {
        flex: 0 0 auto !important;
    }
    body.custom-story-active:not(.reading-drawer-open) #activeStoryContext,
    body:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) #activeStoryContext {
        flex: 0 0 auto !important;
        margin-top: 4px !important;
        margin-bottom: 8px !important;
        padding-bottom: 6px !important;
    }
    body.custom-story-active:not(.reading-drawer-open) #activeStoryText,
    body:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) #activeStoryText {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-y: contain !important;
        max-height: none !important;
        margin-bottom: 8px !important;
        padding-right: 4px !important;
    }
    body.custom-story-active:not(.reading-drawer-open) .story-media-bar,
    body:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) .story-media-bar {
        flex: 0 0 auto !important;
        padding-top: 8px !important;
    }
    body.custom-story-active:not(.reading-drawer-open) #storyPracticeBar,
    body:has(#readingChatBox.has-story-pane):not(.reading-drawer-open) #storyPracticeBar {
        flex: 0 0 auto !important;
        margin: 0 !important;
        padding: 8px 10px !important;
    }

    /* Mobile Book Mode: Full natural scrolling for chapters like Pinocchio & Le tigri */
    body.book-mode-active .app-container,
    body:has(#readingChatBox.book-mode) .app-container,
    body.reading-page:not(.custom-story-active):not(:has(#readingChatBox.has-story-pane)) .app-container {
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-y: auto !important;
        touch-action: pan-y !important;
        padding-bottom: max(72px, calc(68px + env(safe-area-inset-bottom, 34px))) !important;
    }
    body.book-mode-active #reading-view,
    body:has(#readingChatBox.book-mode) #reading-view,
    body.reading-page:not(.custom-story-active):not(:has(#readingChatBox.has-story-pane)) #reading-view {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        flex: 0 0 auto !important;
    }
    body.book-mode-active #active-reading-state,
    body:has(#readingChatBox.book-mode) #active-reading-state,
    body.reading-page:not(.custom-story-active):not(:has(#readingChatBox.has-story-pane)) #active-reading-state {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        flex: 0 0 auto !important;
    }
    #readingChatBox.book-mode:not(.fullscreen) {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
        touch-action: pan-y !important;
    }
    #readingChatBox.book-mode .book-chapter-sheet {
        touch-action: pan-y !important;
    }

    /* When a tool tab IS OPEN: unlock outer scroll with clearance above bottom dock */
    body.reading-page.reading-drawer-open .app-container,
    body:has(#reading-view).reading-drawer-open .app-container {
        overflow-y: auto !important;
        overscroll-behavior-y: auto !important;
        padding-bottom: max(72px, calc(68px + env(safe-area-inset-bottom, 34px))) !important;
    }
    body.reading-drawer-open #active-reading-state {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding-bottom: max(72px, calc(68px + env(safe-area-inset-bottom, 34px))) !important;
    }
    body.reading-drawer-open #readingChatBox:not(.fullscreen) {
        flex: 0 0 auto !important;
        height: auto !important;
    }
    body.reading-drawer-open #readingChatBox:not(.fullscreen) .active-story-text,
    body.reading-drawer-open #readingChatBox:not(.fullscreen) #activeStoryText {
        flex: 0 0 auto !important;
        max-height: 32vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}
#readingChatBox { 
    height: auto; 
    min-height: 0; 
    flex: 0 0 auto; 
    transition: all 0.3s ease-in-out; 
    cursor: text; 
    position: relative; 
}
#readingChatBox:not(.fullscreen) {
    height: auto !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
}
#readingChatBox.book-mode { padding: 0 !important; overflow-x: hidden; }

#readingChatBox.fullscreen { 
    position: fixed !important; 
    top: 20px !important; 
    bottom: 0 !important; 
    left: 20px !important; 
    right: 20px !important; 
    width: auto !important; 
    max-width: none !important; 
    height: auto !important; 
    margin: 0 !important; 
    margin-bottom: 0 !important;
    border-radius: 20px 20px 0 0 !important; 
    border-bottom-left-radius: 0 !important; 
    border-bottom-right-radius: 0 !important; 
    z-index: 99990 !important; 
    background: #ffffff !important; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.5) !important;
    box-sizing: border-box !important; 
    padding: 36px 44px 56px 44px !important; 
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

#readingChatBox.fullscreen.book-mode {
    display: block !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    padding: 36px 44px 56px 44px !important;
}

#readingChatBox.fullscreen .story-unified-canvas {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
    width: 100% !important;
}

#readingChatBox.fullscreen .story-header-top,
#readingChatBox.fullscreen #activeStoryContext {
    flex-shrink: 0 !important;
}

#readingChatBox.fullscreen .active-story-text,
#readingChatBox.fullscreen #activeStoryText {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    max-height: none !important;
    padding-right: 8px !important;
    font-size: 1.15rem !important;
    line-height: 1.9 !important;
}

#readingChatBox.fullscreen .story-media-bar {
    flex-shrink: 0 !important;
    margin-top: auto !important;
    padding-top: 12px !important;
    border-top: 1px solid #f1f5f9 !important;
    background: #ffffff !important;
    z-index: 10 !important;
}

#readingChatBox.fullscreen .story-translation-drawer {
    flex-shrink: 0 !important;
    max-height: 28vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

#readingChatBox.fullscreen .chat-bubble {
    font-size: 18px !important;
    line-height: 1.7 !important;
    max-width: 90% !important; 
}

/* Minimize button floating in fullscreen mode */
#readingChatBox.fullscreen .chatbox-expand-btn {
    position: fixed !important;
    top: 32px !important;
    right: 32px !important;
    z-index: 100010 !important;
    background: #ffffff !important;
    border: 1.5px solid #0066b2 !important;
    color: #0066b2 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22) !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

/* Fullscreen clearance during assessment mode so pane never hides behind assessment banner */
body.assessment-mode-active #readingChatBox.fullscreen {
    top: 74px !important;
    height: calc(100vh - 74px) !important;
    bottom: 0 !important;
    margin-bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    padding-bottom: 56px !important;
}

body.assessment-mode-active #readingChatBox.fullscreen .chatbox-expand-btn {
    top: 84px !important;
    right: 14px !important;
}

@media (max-width: 850px) {
    #readingChatBox.fullscreen { 
        top: 0 !important; 
        bottom: 0 !important; 
        margin-bottom: 0 !important;
        left: 0 !important; 
        right: 0 !important;
        border-radius: 0 !important; 
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        padding: 16px 16px 56px 16px !important; 
        background: #ffffff !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }
    #readingChatBox.fullscreen.book-mode {
        display: block !important;
        overflow-y: auto !important;
        background: #ffffff !important;
        padding: 16px 16px 56px 16px !important;
    }
    #readingChatBox.fullscreen .story-unified-canvas {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow: hidden !important;
    }
    #readingChatBox.fullscreen .story-header-top,
    #readingChatBox.fullscreen #activeStoryContext {
        flex-shrink: 0 !important;
    }
    #readingChatBox.fullscreen .active-story-text,
    #readingChatBox.fullscreen #activeStoryText {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior-y: contain !important;
        max-height: none !important;
        padding-right: 6px !important;
        font-size: 1.05rem !important;
        line-height: 1.75 !important;
    }
    #readingChatBox.fullscreen .story-media-bar {
        flex-shrink: 0 !important;
        margin-top: auto !important;
        padding-top: 10px !important;
        border-top: 1px solid #f1f5f9 !important;
        background: #ffffff !important;
    }
    #readingChatBox.fullscreen .chatbox-expand-btn {
        top: 14px !important;
        right: 14px !important;
    }
    body.assessment-mode-active #readingChatBox.fullscreen {
        top: 68px !important;
        height: calc(100vh - 68px) !important;
        bottom: 0 !important;
        margin-bottom: 0 !important;
        border-radius: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        padding-top: 24px !important;
        padding-bottom: 56px !important;
    }
    body.assessment-mode-active #readingChatBox.fullscreen .chatbox-expand-btn {
        top: 76px !important;
        right: 12px !important;
    }
}

/* Clear bottom dock Vocab Vault tab strictly during assessment mode Stage 4 reading */
body.assessment-mode-active .practice-action-bar,
body.assessment-mode-active #storyPracticeBar {
    margin-bottom: 75px !important;
    position: relative;
    z-index: 10;
}

body.assessment-mode-active #active-reading-state {
    padding-bottom: 85px !important;
}

body.assessment-mode-active .workbench-drawer {
    margin-bottom: 25px !important;
    padding-bottom: 20px !important;
}

body.assessment-mode-active .workbench-action-row {
    margin-top: 14px !important;
    margin-bottom: 20px !important;
}

@media (max-width: 768px) {
    body.assessment-mode-active .practice-action-bar,
    body.assessment-mode-active #storyPracticeBar {
        margin-bottom: 95px !important;
        padding-bottom: 20px !important;
    }
    body.assessment-mode-active #active-reading-state {
        padding-bottom: 105px !important;
    }
    body.assessment-mode-active .workbench-drawer {
        margin-bottom: 35px !important;
        padding-bottom: 25px !important;
    }
    body.assessment-mode-active .workbench-action-row {
        margin-bottom: 25px !important;
    }
}

/* ==========================================
   CUSTOM STORY CONTROLS & WORKBENCH STYLES
   ========================================== */
.story-media-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid #e8e4d9;
    flex-wrap: wrap;
}
.story-media-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #dcd7ca;
    background: #ffffff;
    color: #334155;
    transition: all 0.2s;
}
.story-media-btn:hover {
    background: #f5f2e9;
    border-color: #cbd5e1;
}
.story-media-btn.read-btn {
    background: #0066b2;
    color: #ffffff;
    border-color: #0066b2;
}
.story-media-btn.read-btn:hover {
    background: #00528f;
}
.story-media-btn.read-btn.speaking {
    background: #ce2b37 !important;
    border-color: #ce2b37 !important;
    color: #ffffff !important;
}
.story-media-btn.translate-btn {
    color: #0066b2;
    background: #f0f7ff;
    border-color: #bae6fd;
}
.story-media-btn.translate-btn:hover {
    background: #e0f2fe;
}
.clear-story-btn {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #dcd7ca;
    background: #ffffff;
    color: #78716c;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.clear-story-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
    transform: scale(1.1);
}
.story-translation-drawer {
    margin-top: 14px;
    padding: 14px 16px;
    background: #fcf8f2;
    border: 1px solid #e8dcc4;
    border-left: 4px solid #0066b2;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.6;
}
.translation-drawer-content {
    white-space: pre-line;
    word-break: break-word;
}
.translation-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #0066b2;
}
.drawer-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
}
.drawer-close-btn:hover { color: #334155; }

/* Optional Practice Workbenches (Zone 3) - Clean White / Slate Modern Aesthetic */
.practice-action-bar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    flex: 0 0 auto !important;
    width: 100%;
    box-sizing: border-box;
}
.practice-toggle-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
    background: #f1f5f9;
    padding: 6px;
    border-radius: 12px;
    box-sizing: border-box;
}
.workbench-tab-btn {
    padding: 8px 6px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
}
.workbench-tab-btn:hover {
    background: rgba(255, 255, 255, 0.7);
    color: #1e293b;
}
.workbench-tab-btn.active {
    background: #ffffff;
    border-color: rgba(0, 102, 178, 0.2);
    color: #0066b2;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0, 102, 178, 0.12);
}
@media (max-width: 420px) {
    .practice-action-bar {
        padding: 10px;
    }
    .practice-toggle-tabs {
        padding: 4px;
        gap: 4px;
    }
    .workbench-tab-btn {
        font-size: 0.8rem;
        padding: 7px 4px;
        gap: 3px;
    }
}
.workbench-drawer {
    padding: 14px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-top: 12px;
}
.workbench-textarea {
    width: 100%;
    min-height: 110px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    box-sizing: border-box;
    background: #ffffff;
    color: #1e293b;
    outline: none;
    margin: 10px 0;
    transition: border-color 0.2s;
}
.workbench-textarea:focus {
    border-color: #0066b2;
    box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.1);
}
.workbench-submit-btn {
    background: #0066b2;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 102, 178, 0.2);
}
.workbench-submit-btn:hover {
    background: #00528f;
}
.workbench-submit-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}
.workbench-submit-btn.locked {
    background: #475569 !important;
    color: #f8fafc !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    opacity: 0.9;
}

/* ==========================================
   READING RIBBON / LINE BOOKMARK STYLES
   ========================================== */
.reading-subheader-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0 0 10px 0;
    min-height: 38px;
    padding: 0 45px;
    box-sizing: border-box;
}

.reading-subheader-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    text-align: center;
    line-height: 1.3;
    max-width: calc(100% - 150px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================
   SUB-HEADER CHAPTER SELECTOR & QUICK CURRENT
   ========================================== */
.chapter-selector-container {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    z-index: 25;
}

.chapter-selector-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chapter-selector-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.quick-current-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 34px;
    padding: 0 9px;
    border-radius: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #0284c7;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 102, 178, 0.1);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-current-pill-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.chapter-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    min-width: 170px;
    width: max-content;
    max-width: 260px;
    max-height: 280px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    padding: 6px 0;
    z-index: 100;
    text-align: left;
}

.chapter-dropdown-item {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    box-sizing: border-box;
    padding: 9px 14px;
    font-size: 13.5px;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.chapter-dropdown-item:hover {
    background: #f8fafc;
}

.chapter-dropdown-item.active {
    background: #f0f7ff;
    color: #0066b2;
    font-weight: 600;
}

.chapter-dropdown-item.chapter-item-locked {
    color: #64748b;
    opacity: 0.7;
    background: transparent;
}

.chapter-dropdown-item.chapter-item-locked:hover {
    background: #fef2f2;
    color: #991b1b;
}

.chapter-dropdown-item.current-quick-item {
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    color: #0284c7;
    font-weight: 600;
}

.chapter-dropdown-item.current-quick-item:hover {
    background: #e0effe;
    color: #0066b2;
}

.chapter-dropdown-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 4px 0;
}

.reading-ribbon-btn {
    position: absolute;
    left: 0;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    padding: 0;
    z-index: 10;
}

.reading-ribbon-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #334155;
    transform: translateY(-50%) scale(1.04);
}

.reading-ribbon-btn.active {
    background: #fef2f2 !important;
    border-color: #dc2626 !important;
    color: #dc2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2), 0 2px 4px rgba(220, 38, 38, 0.15) !important;
}

.reading-ribbon-btn.active svg {
    fill: #dc2626;
    stroke: #dc2626;
}

/* Book Card Bookmark Ribbon (Shown on book card in library when bookmarked) */
.book-card-bookmark-ribbon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.standard-card:hover .book-card-bookmark-ribbon {
    transform: scale(1.15) translateY(-1px);
}

/* Bookmark Mode ON cursor & interactive paragraph styling */
#readingChatBox.bookmark-mode-on {
    cursor: pointer;
}

#readingChatBox.bookmark-mode-on .chapter-paragraph {
    cursor: pointer !important;
    position: relative;
    transition: background-color 0.15s ease, outline 0.15s ease;
}

#readingChatBox.bookmark-mode-on .chapter-paragraph:hover {
    background-color: rgba(220, 38, 38, 0.08) !important;
    border-radius: 6px;
    outline: 1px dashed rgba(220, 38, 38, 0.4);
}

/* Bookmarked paragraph highlight & left border accent */
.chapter-paragraph.bookmarked-line {
    border-left: 4px solid #dc2626 !important;
    padding-left: 12px !important;
    background: rgba(220, 38, 38, 0.05) !important;
    border-radius: 0 8px 8px 0 !important;
    transition: all 0.2s ease !important;
}

/* Inline ribbon badge at the start of bookmarked paragraph */
.reading-ribbon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    vertical-align: middle;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 6px;
    background: #fef2f2;
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #dc2626;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.15);
    transition: transform 0.15s ease, background-color 0.15s ease;
    user-select: none;
}

.reading-ribbon-badge:hover {
    transform: scale(1.12);
    background: #fee2e2;
    border-color: #dc2626;
}

.reading-ribbon-badge svg {
    display: block;
}

.chatbox-expand-btn { 
    position: absolute; 
    top: 12px; 
    right: 12px; 
    z-index: 20; 
    background: rgba(255, 255, 255, 0.9); 
    border: 1px solid #d1d5db; 
    border-radius: 8px; 
    width: 32px; 
    height: 32px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: #4b5563; 
    transition: all 0.2s; 
}
.chatbox-expand-btn:hover { background: #eef5fa; color: #0066b2; border-color: #0066b2; }

.toggle-wrapper { display: flex; align-items: center; justify-content: center; gap: 8px; width: auto; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #0066b2; transition: .4s; border-radius: 26px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: #009246; }
input:checked + .slider:before { transform: translateX(20px); }
.toggle-label { font-size: 13px; font-weight: bold; }

/* Vocab Vault UI */
.floating-save-btn { position: fixed; display: none; background: #0066b2; color: white; border: none; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: bold; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 10001; transition: transform 0.1s; }
.floating-save-btn:active { transform: scale(0.95); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #333; color: white; padding: 10px 20px; border-radius: 20px; font-size: 14px; font-weight: bold; z-index: 10002; opacity: 0; transition: opacity 0.3s; pointer-events: none; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 10005; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; }
.modal-overlay.active { display: flex; }
.modal-content { background: white; width: 100%; max-width: 600px; max-height: 85vh; border-radius: 20px; padding: 25px; box-shadow: 0 25px 50px rgba(0,0,0,0.3); display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #eee; padding-bottom: 15px; margin-bottom: 15px; }
.modal-header h2 { margin: 0; font-size: 1.5rem; color: #333; }
.close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #888; transition: 0.2s; }
.close-btn:hover { color: #CE2B37; }
.vocab-section { overflow-y: auto; padding-right: 10px; }
.vocab-section h3 { margin-top: 0; font-size: 1.1rem; color: #555; }
.active-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 25px; }
.chip { background: #009246; color: white; padding: 6px 12px; border-radius: 20px; font-size: 14px; font-weight: bold; display: flex; align-items: center; gap: 8px; }
.chip-delete { background: rgba(255,255,255,0.2); border: none; color: white; border-radius: 50%; width: 20px; height: 20px; display: flex; justify-content: center; align-items: center; cursor: pointer; font-size: 12px; }

/* Fantasy Game HUD & Controls */
.game-hud { 
    background: transparent !important; 
    color: #fff !important; 
    width: 100%; 
    display: flex; 
    justify-content: center !important; 
    align-items: center;
    gap: 120px;
    padding: 5px 0; 
    border-radius: 0; 
    font-weight: bold; 
    margin-bottom: 15px; 
    font-size: 1rem; 
    box-shadow: none !important; 
}

.hud-item { 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    background: #111111 !important; 
    color: #ffffff !important; 
    border: 1px solid #333333; 
    padding: 6px 16px; 
    border-radius: 30px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.game-hidden-pane {
    display: none !important;
}
.game-controls-row { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.rules-button { background: transparent; color: #0066b2; border: 1px solid #0066b2; padding: 6px 12px; border-radius: 8px; font-size: 0.9rem; font-weight: bold; cursor: pointer; transition: 0.2s; }
.rules-button:hover { background: #eef5fa; }

/* Native Dialog Modals */
.rules-modal { border: none; border-radius: 16px; padding: 0; width: 90%; max-width: 450px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); font-family: inherit; }
.rules-modal::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.rules-modal-content { padding: 25px; line-height: 1.6; color: #444; }
.rules-modal-content ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 15px; }

/* Universal Guide Modal Blocks (Menu Guides) */
.guide-blocks-container { display: flex; flex-direction: column; }
.guide-block { margin-bottom: 16px; }
.guide-block:last-child { margin-bottom: 0; }
.guide-block-title { font-size: 1rem; font-weight: 700; color: #1e293b; margin-bottom: 4px; line-height: 1.3; }
.guide-block-desc { font-size: 0.875rem; color: #64748b; line-height: 1.5; }

/* Universal Feature Guide Items (Inline Layout) */
.feature-guide-container { display: flex; flex-direction: column; gap: 14px; }
.feature-guide-item { font-size: 0.9rem; line-height: 1.55; color: #475569; }
.feature-guide-item strong { color: #1e293b; font-weight: 700; }

/* Quest Objective Banner */
.quest-objective { background: #eef5fa; color: #0066b2; width: 100%; padding: 12px; border-radius: 12px; font-weight: bold; font-style: italic; margin-bottom: 15px; text-align: center; border: 1px solid #cce0f0; display: none; box-sizing: border-box; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

.game-btn { background: #0066b2; color: white; border: none; padding: 12px 15px; font-size: 15px; border-radius: 10px; cursor: pointer; width: 100%; text-align: left; font-weight: bold; display: flex; justify-content: space-between; margin-bottom: 10px; transition: 0.2s; }
.game-btn:hover { filter: brightness(1.2); }
.game-btn:disabled { background: #ccc; cursor: not-allowed; color: #777; filter: none; }
.dice-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 10010; display: none; flex-direction: column; justify-content: center; align-items: center; color: white; font-size: 2rem; font-weight: bold; text-align: center; padding: 20px; }

/* Copyright Footer */
.site-footer { position: fixed; bottom: 20px; right: 20px; color: rgba(255, 255, 255, 0.7); font-size: 13px; font-weight: bold; z-index: 100; }

/* AUTHENTICATION OVERLAY STYLES */
#login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #0f172a; z-index: 9999; display: flex; justify-content: center; align-items: center; }
.login-card { background-color: #1e293b; padding: 2.5rem 2rem; border-radius: 1rem; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); width: 100%; max-width: 400px; text-align: center; color: #f8fafc; font-family: system-ui, -apple-system, sans-serif; box-sizing: border-box; }
.login-card img { width: 120px; height: auto; margin-bottom: 1rem; border-radius: 20%; }
.login-card h1 { margin: 0 0 0.5rem 0; font-size: 1.5rem; color: #f8fafc; text-shadow: none; }
.login-card p { color: #94a3b8; margin-bottom: 2rem; font-size: 0.95rem; }
.login-card .input-group { text-align: left; margin-bottom: 1.5rem; }
.login-card label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; color: #94a3b8; }
.login-card select { width: 100%; padding: 0.75rem; border-radius: 0.5rem; border: 1px solid #334155; background-color: #0f172a; color: #f8fafc; font-size: 1rem; outline: none; box-sizing: border-box; }
.login-card select:focus { border-color: #4f46e5; }
.login-card button { width: 100%; padding: 0.875rem; border: none; border-radius: 0.5rem; background-color: #4f46e5; color: white; font-size: 1rem; font-weight: 600; cursor: pointer; transition: 0.2s; }
.login-card button:hover { background-color: #4338ca; }
#error-msg { color: #ef4444; font-size: 0.875rem; margin-top: 1rem; display: none; }

/* ==========================================
   AURA DIFFICULTY TIERS & BADGES
   ========================================== */
.aura-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.aura-a0 { background: #f1f2f5; color: #666666; border: 1px solid #d1d5db; box-shadow: none; }
.aura-bronze { background: linear-gradient(135deg, #b06525, #8a4d1b); color: #ffffff; box-shadow: 0 4px 12px rgba(176, 101, 37, 0.25); }
.aura-silver { background: linear-gradient(135deg, #4b5563, #1f2937); color: #ffffff; box-shadow: 0 4px 12px rgba(31, 41, 55, 0.25); }
.aura-gold { background: linear-gradient(135deg, #f59e0b, #d97706); color: #ffffff; box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35); }

/* ========================================== */
/* UNIFIED INTEGRATED PILL TOOLBAR (ENLARGED)   */
/* ========================================== */
.tabs {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    padding: 10px 12px !important;
    background: #f1f3f5 !important;
    border-radius: 26px !important;
    position: relative !important;
    max-width: 600px !important;
    margin: 0 auto 20px auto !important;
    box-sizing: border-box !important;
    width: 100% !important;
    border: 1px solid #e0e0e0;
}

.hamburger-pill-container {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.hamburger-btn {
    background: #ffffff !important;
    border: 1px solid #dcdcdc !important;
    cursor: pointer !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: background 0.2s ease;
    box-sizing: border-box !important;
}

.hamburger-btn svg {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
}

.hamburger-btn:hover {
    background: #eef5fa !important;
}

.pill-divider {
    width: 1px;
    height: 30px;
    background: #d0d5dc;
    margin: 0 8px;
    flex-shrink: 0;
}

.tabs .tab-btn, .tabs a.tab-btn {
    flex: 1 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    font-size: 15px !important;
    font-weight: bold !important;
    line-height: 1.2 !important;
    padding: 11px 8px !important;
    border-radius: 14px;
    background: transparent;
    color: #555;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .tabs .tab-btn, .tabs a.tab-btn {
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
        font-size: 13px !important;
        font-weight: bold !important;
        line-height: 1.2 !important;
        padding: 10px 4px !important;
    }
}

.tabs .tab-btn:hover, .tabs a.tab-btn:hover {
    color: #000;
    background: rgba(0,0,0,0.05);
}

.tabs .tab-btn.active, .tabs a.tab-btn.active {
    background: #0066b2 !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(0, 102, 178, 0.4);
}

/* Dropdown Menu Positioning */
.nav-dropdown-menu {
    display: none !important;
    position: absolute !important;
    top: calc(100% + 10px) !important;
    left: 0 !important;
    background: #ffffff !important;
    border: 1px solid #dcdcdc !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    width: 200px !important;
    z-index: 99999 !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.nav-dropdown-menu.active {
    display: flex !important;
}

.nav-dropdown-menu a {
    padding: 12px 16px !important;
    color: #333333 !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #f2f2f2 !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.nav-dropdown-menu a:last-child {
    border-bottom: none !important;
}

.nav-dropdown-menu a:hover {
    background: #f0f7ff !important;
    color: #0066b2 !important;
}

/* ==========================================
   MODERN GUIDE BUTTON
   ========================================== */
.modern-guide-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(241, 245, 249, 0.6);
    color: #64748b;
    border: 1px solid transparent;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.modern-guide-btn:hover {
    background: #f1f5f9;
    color: #0066b2;
    border-color: #cbd5e1;
}

.modern-guide-btn svg {
    transition: stroke 0.2s ease;
}

.modern-guide-btn:hover svg {
    stroke: #0066b2;
}

/* ==========================================
   MOBILE SAFE AREA & FLEXBOX FIXES
   ========================================== */
.reading-input-area,
#fantasy-quest-ui {
    /* 1. Prevents the story text from crushing the buttons */
    flex-shrink: 0 !important; 
    
    /* 2. Dynamically pushes the UI up above the iOS home bar */
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
}

/* ==========================================
   VOCAB VAULT GRID & FLIP CARDS (CLEAN STABLE)
   ========================================== */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    width: 100%;
}

.vocab-card {
    perspective: 1000px;
    width: 100%;
    aspect-ratio: 1 / 1;
    cursor: pointer;
}

.vocab-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

.vocab-card.flipped .vocab-card-inner {
    transform: rotateY(180deg);
}

.vocab-card-front, .vocab-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
    box-sizing: border-box;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vocab-card-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    justify-content: space-between;
}

.vocab-card:hover .vocab-card-front, 
.vocab-card:hover .vocab-card-back {
    border-color: #0066b2;
    box-shadow: 0 10px 15px -3px rgba(0, 102, 178, 0.1);
}

.vocab-flip-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 11px;
    opacity: 0.3;
}

.vocab-word-front-text {
    font-weight: 800;
    font-size: 19px;
    color: #0f172a;
    word-break: break-word;
}

.vocab-card-content-back {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
}

.vocab-translation-text {
    font-weight: 800;
    font-size: 17px;
    color: #0066b2;
    margin-bottom: 2px;
    word-break: break-word;
}

.vocab-original-sub {
    font-weight: 600;
    font-size: 11.5px;
    color: #64748b;
    font-style: italic;
}

.vocab-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: auto;
}

.vocab-action-btn {
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    padding: 3px 6px;
    border: 1px solid transparent;
    position: relative;
    z-index: 10;
}

.vocab-action-btn.primary { background: #eef5fa; border-color: #0066b2; color: #0066b2; }
.vocab-action-btn.secondary, .vocab-action-btn.focus { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.vocab-action-btn.delete { background: none; border: none; color: #dc2626; font-size: 16px; padding: 0 2px; }

/* ==========================================
   VOCAB VAULT - VISIBLE FLIP FACE CLICK FIX
   ========================================== */

.vocab-card:not(.flipped) .vocab-card-front {
    pointer-events: auto;
}

.vocab-card:not(.flipped) .vocab-card-back {
    pointer-events: none;
}

.vocab-card.flipped .vocab-card-front {
    pointer-events: none;
}

.vocab-card.flipped .vocab-card-back {
    pointer-events: auto;
}

.vocab-card .vocab-action-btn {
    pointer-events: auto;
    touch-action: manipulation;
    cursor: pointer;
}


/* ==========================================
   FAINT DOTTED UNDERLINE VOCAB HIGHLIGHTER
   ========================================== */
.vault-highlight {
    cursor: pointer !important;
    position: relative !important;
    /* Creates a faint, elegant dotted underline right beneath the word */
    text-decoration: underline dotted rgba(0, 0, 0, 0.25) !important;
    text-underline-offset: 3px !important; /* Pushes the dots down slightly so they don't crowd the letters */
}

.vault-highlight:hover {
    text-decoration: underline dotted rgba(0, 102, 178, 0.6) !important; /* Soft blue tint on hover */
    color: #0066b2 !important;
}

/* ==========================================
   VOCAB VAULT MODAL ACCORDION & SEARCH
   ========================================== */
.unfocused-accordion {
    margin-top: 22px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.unfocused-toggle-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f1f5f9;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.unfocused-toggle-bar:hover {
    background: #e2e8f0;
}

.unfocused-accordion:not(.collapsed) .unfocused-toggle-bar {
    border-bottom-color: #e2e8f0;
}

.unfocused-toggle-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.unfocused-chevron {
    font-size: 16px;
    font-weight: bold;
    color: #64748b;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    line-height: 1;
}

.unfocused-accordion:not(.collapsed) .unfocused-chevron {
    transform: rotate(180deg);
}

.unfocused-collapsible-body {
    padding: 12px 14px 14px 14px;
}

.unfocused-accordion.collapsed .unfocused-collapsible-body {
    display: none;
}

.vocab-search-wrapper {
    margin-bottom: 12px;
}

.vocab-search-input {
    width: 100%;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    font-size: 13.5px;
    background: #ffffff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vocab-search-input:focus {
    border-color: #0066b2;
    box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.15);
}

.unfocused-grid-container {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

/* ==========================================
   STANDARDIZED GLOBAL VOCAB VAULT TRIGGER
   ========================================== */
.bottom-dock-container {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    z-index: 100005 !important;
    pointer-events: none;
    padding: 0;
    margin: 0;
}

.modal-overlay,
#vocabModal,
.daily-allowance-modal-overlay,
.tier-limits-modal-overlay,
.assessment-modal-overlay,
.assessment-exit-modal-overlay {
    z-index: 100020 !important;
}

.bottom-dock-tab,
#globalVocabVaultBtn,
#globalQuotaTabBtn {
    pointer-events: auto;
    position: relative;
    bottom: 0;
    left: auto;
    transform: none;
    border-radius: 12px 12px 0 0;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #334155;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: none;
    padding: 8px 14px;
    width: 140px;
    min-width: 140px;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    line-height: 1.2;
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
    outline: none;
    box-sizing: border-box;
    text-align: center;
}

.bottom-dock-tab:hover,
.bottom-dock-tab:focus-visible,
#globalVocabVaultBtn:hover,
#globalVocabVaultBtn:focus-visible,
#globalQuotaTabBtn:hover,
#globalQuotaTabBtn:focus-visible {
    background: #0066b2;
    color: #ffffff;
    border-color: #00508c;
    box-shadow: 0 -6px 18px rgba(0, 102, 178, 0.35);
    transform: translateY(-2px);
    outline: none;
    z-index: 2;
}

@media (max-width: 360px) {
    .bottom-dock-tab,
    #globalVocabVaultBtn,
    #globalQuotaTabBtn {
        width: 125px;
        min-width: 125px;
        padding: 8px 10px;
        font-size: 12px;
    }
}

.bottom-dock-tab:active,
#globalVocabVaultBtn:active,
#globalQuotaTabBtn:active {
    background: #004d85;
    color: #ffffff;
    transform: translateY(0);
}

/* Quota Tab Specific Styling (Clones clean white Vocab Vault styling) */
#globalQuotaTabBtn .quota-tab-icon {
    font-size: 13.5px;
    line-height: 1;
}

#globalQuotaTabBtn .quota-tab-text {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: 700;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Zero / locked subtle tint - still same clean white button */
#globalQuotaTabBtn.quota-tab-zero {
    color: #475569;
}

#globalQuotaTabBtn.quota-tab-zero .quota-tab-icon {
    opacity: 0.9;
}

#globalQuotaTabBtn.quota-tab-zero:hover,
#globalQuotaTabBtn.quota-tab-zero:focus-visible {
    background: #0066b2;
    color: #ffffff;
    border-color: #00508c;
}

/* Subtle deduction pulse animation */
@keyframes quotaDeductPulse {
    0% {
        transform: scale(1);
        color: #334155;
    }
    30% {
        transform: scale(1.15);
        color: #0284c7;
    }
    100% {
        transform: scale(1);
        color: #334155;
    }
}

.quota-deduct-pulse {
    animation: quotaDeductPulse 0.5s ease-out;
}

/* Dark mode adaptation for Games (Dragos RPG) */
body:has(.dragos-theme) .bottom-dock-tab,
body:has(.dragos-theme) #globalVocabVaultBtn,
body:has(.dragos-theme) #globalQuotaTabBtn,
.dragos-theme #globalVocabVaultBtn,
.dragos-theme #globalQuotaTabBtn {
    background: rgba(24, 24, 32, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #cbd5e1;
    border: 1px solid rgba(79, 79, 102, 0.4);
    border-bottom: none;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.5);
}

body:has(.dragos-theme) .bottom-dock-tab:hover,
body:has(.dragos-theme) .bottom-dock-tab:focus-visible,
body:has(.dragos-theme) #globalVocabVaultBtn:hover,
body:has(.dragos-theme) #globalVocabVaultBtn:focus-visible,
body:has(.dragos-theme) #globalQuotaTabBtn:hover,
body:has(.dragos-theme) #globalQuotaTabBtn:focus-visible,
.dragos-theme #globalVocabVaultBtn:hover,
.dragos-theme #globalQuotaTabBtn:hover {
    background: #0066b2;
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 -6px 20px rgba(0, 102, 178, 0.5);
    transform: translateY(-2px);
}

/* ==========================================================
   START HERE: PERSONAL 20 (SENTENCE BUILDER) STYLES
   ========================================================== */

.starting-point-card,
.personal-20-menu-card {
    cursor: pointer;
    padding: 16px 20px !important;
    border: 2px dashed #0066b2 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 102, 178, 0.08) !important;
    transition: all 0.2s ease !important;
    background: #f0f7ff !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}
.starting-point-card:hover,
.personal-20-menu-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(0, 102, 178, 0.15) !important;
    background: #e8f3fe !important;
}

.starting-point-card h4,
.personal-20-menu-card h4,
#training-grid .personal-20-menu-card h4,
#training-grid h4.personal-20-title,
.personal-20-title {
    margin: 0 !important;
    color: #0066b2 !important;
    font-size: 15px !important;
    font-weight: bold !important;
    white-space: nowrap !important;
    text-align: left !important;
}

.starting-point-card p,
.personal-20-menu-card p {
    text-align: left !important;
}

/* Starting Point Hub Cards */
.starting-point-hub-card {
    cursor: pointer;
    padding: 16px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.starting-point-hub-card:hover {
    transform: translateY(-2px);
    border-color: #0066b2;
    box-shadow: 0 8px 20px rgba(0, 102, 178, 0.12);
    background: #f8fafc;
}

.starting-point-hub-icon {
    font-size: 26px;
    background: #e0effe;
    color: #0066b2;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.starting-point-hub-body {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.starting-point-hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.starting-point-hub-title {
    margin: 0;
    color: #0066b2;
    font-size: 15.5px;
    font-weight: 700;
}

.starting-point-hub-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e0effe;
    color: #0066b2;
    white-space: nowrap;
    flex-shrink: 0;
}

.starting-point-hub-desc {
    margin: 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.45;
}

#customStoryModeCard,
.custom-story-card-blue {
    cursor: pointer !important;
    padding: 16px 20px !important;
    border: 2px dashed #0066b2 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 102, 178, 0.08) !important;
    transition: all 0.2s ease !important;
    background: #f0f7ff !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    text-align: left !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

#customStoryModeCard:hover,
.custom-story-card-blue:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(0, 102, 178, 0.15) !important;
    background: #e8f3fe !important;
}

#customStoryModeCard h4,
#customStoryModeCard .custom-story-title,
.custom-story-card-blue h4 {
    margin: 0 0 4px 0 !important;
    color: #0066b2 !important;
    font-size: 15px !important;
    font-weight: bold !important;
    text-align: left !important;
}

#p20MenuBadge {
    white-space: nowrap;
    flex-shrink: 0;
}


.p20-header-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 12px;
}

.p20-progress-bar-track {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.p20-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066b2 0%, #16a34a 100%);
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.p20-setup-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 14px;
    transition: all 0.25s ease;
}

.p20-setup-summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.p20-edit-topics-btn {
    background: #f0f7ff;
    border: 1px solid #0066b2;
    color: #0066b2;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.p20-edit-topics-btn:hover {
    background: #0066b2;
    color: #ffffff;
}

.p20-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.p20-chip {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.p20-chip:hover {
    border-color: #0066b2;
    background: #f8fafc;
    transform: translateY(-1px);
}
.p20-chip.active {
    background: #0066b2;
    border-color: #0066b2;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 102, 178, 0.25);
}

.p20-chip-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.28);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    transition: all 0.15s ease;
}
.p20-chip-add-btn:hover {
    background: #ffffff;
    color: #0066b2;
    transform: scale(1.15);
}
.p20-chip-add-btn.has-detail {
    background: #ffffff;
    color: #0066b2;
}

.p20-topic-details-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.p20-topic-detail-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 6px 12px;
    animation: fadeIn 0.2s ease-in-out;
}
.p20-topic-detail-tag {
    font-size: 12.5px;
    font-weight: 700;
    color: #0066b2;
    white-space: nowrap;
}
.p20-topic-detail-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    color: #1e293b;
    outline: none;
    padding: 4px 6px;
    font-family: inherit;
}
.p20-topic-detail-input:focus {
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 0 0 2px rgba(0, 102, 178, 0.15);
}
.p20-topic-detail-remove {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.15s ease;
}
.p20-topic-detail-remove:hover {
    color: #dc2626;
    background: #fee2e2;
}

.p20-note-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 13.5px;
    color: #1e293b;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.p20-note-input:focus {
    outline: none;
    border-color: #0066b2;
    box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.1);
}

.p20-cat-header {
    margin: 8px 0 6px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 6px;
}

.p20-cat-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.p20-cat-badge {
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 10px;
}

.p20-phrase-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.p20-phrase-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.p20-phrase-card.is-mastered {
    border-left: 4px solid #16a34a;
    background: #fafdfa;
}

.p20-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.p20-sentence-row {
    font-size: 16.5px;
    line-height: 1.45;
    color: #1e293b;
}

.p20-frame-text {
    color: #0066b2;
    font-weight: 700;
}

.p20-ending-text {
    color: #334155;
    font-weight: 500;
}

.p20-sentence-row .tts-word {
    cursor: pointer;
    border-radius: 4px;
    padding: 0 1px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.p20-sentence-row .tts-word:hover {
    background-color: #e0effe;
}
.p20-sentence-row .p20-frame-text .tts-word {
    color: #0066b2;
    font-weight: 700;
}
.p20-sentence-row .p20-ending-text .tts-word {
    color: #334155;
    font-weight: 500;
}

.p20-english-text {
    font-size: 13.5px;
    color: #64748b;
    font-style: italic;
    margin-top: 2px;
}

/* 3-Pip Progress Badge */
.p20-pips-container {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 3px 8px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
}

.p20-pip {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: all 0.25s ease;
}
.p20-pip.filled {
    background: #0066b2;
    transform: scale(1.1);
}
.p20-pip.mastered {
    background: #16a34a;
    transform: scale(1.15);
}

.p20-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f1f5f9;
}

.p20-action-btn {
    background: #f0f7ff;
    color: #0066b2;
    border: 1px solid #cce0f0;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.p20-action-btn:hover {
    background: #0066b2;
    color: #ffffff;
    border-color: #0066b2;
    transform: translateY(-1px);
}

.p20-review-btn {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}
.p20-review-btn:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

.p20-tts-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
    color: #475569;
    transition: all 0.2s;
}
.p20-tts-btn:hover {
    background: #e2e8f0;
    color: #0066b2;
}

/* Practice Mode Interactive Styles */
.p20-drill-container {
    background: #f8fafc;
    border: 1.5px solid #cce0f0;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.p20-drill-prompt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    font-weight: 600;
    color: #0066b2;
}

.p20-peek-btn {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.p20-peek-btn:hover {
    background: #f1f5f9;
    color: #0066b2;
    border-color: #0066b2;
}
.p20-peek-btn.active {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0284c7;
}

.p20-tts-btn.playing {
    background: #fee2e2 !important;
    border-color: #f87171 !important;
    color: #b91c1c !important;
}

/* Universal real-time word karaoke highlighting */
.tts-word-active {
    background-color: #dbeafe !important;
    color: #0066b2 !important;
    border-radius: 4px !important;
    box-shadow: 0 0 0 2px rgba(0, 102, 178, 0.35) !important;
    font-weight: 700 !important;
    transition: background-color 0.1s ease, box-shadow 0.1s ease;
}

/* Peek target words highlight (shows what the user is recalling) */
.p20-peek-target-highlight {
    background-color: #fef08a !important;
    color: #854d0e !important;
    border-radius: 4px !important;
    padding: 1px 4px !important;
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.45) !important;
    font-weight: 700 !important;
    transition: all 0.2s ease;
}

.p20-peek-box {
    background: #fefce8;
    border: 1px dashed #facc15;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 15px;
    animation: fadeIn 0.2s ease-in-out;
}

.p20-locked-container {
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.2s ease-in-out;
}
.p20-locked-word {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #15803d;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 1px 2px rgba(22, 163, 74, 0.1);
}
.p20-missing-word {
    color: transparent;
    padding: 2px 6px;
    border-bottom: 2.5px dashed #94a3b8;
    display: inline-block;
    min-width: 52px;
    height: 24px;
    text-align: center;
    font-size: 15px;
    vertical-align: middle;
    margin: 0 3px;
    user-select: none;
}
.p20-retry-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    margin-bottom: 4px;
    font-style: italic;
}

.p20-drill-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 16px;
    line-height: 1.4;
}

.p20-drill-input {
    padding: 7px 10px;
    border: 1.5px solid #0066b2;
    border-radius: 8px;
    font-size: 15px;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
    background: #ffffff;
}
.p20-drill-input:focus {
    box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.15);
}
.p20-drill-input-full {
    width: 100%;
    box-sizing: border-box;
}

.p20-drill-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.p20-check-btn {
    background: #0066b2;
    color: #ffffff;
    border: none;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.p20-check-btn:hover {
    background: #00508c;
    transform: translateY(-1px);
}

.p20-feedback-msg {
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s;
}
.p20-feedback-msg.correct {
    color: #16a34a;
}
.p20-feedback-msg.hint {
    color: #d97706;
}
.p20-feedback-msg.wrong {
    color: #dc2626;
}

/* Floating XP Celebration Badge */
.floating-xp-badge {
    position: fixed;
    z-index: 10005;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.45);
    pointer-events: none;
    animation: floatUpFade 2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    letter-spacing: 0.5px;
}

@keyframes floatUpFade {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0.7);
    }
    15% {
        opacity: 1;
        transform: translate(-50%, -20px) scale(1.15);
    }
    75% {
        opacity: 1;
        transform: translate(-50%, -60px) scale(1.0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -85px) scale(0.9);
    }
}

@keyframes p20Shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
.p20-shake {
    animation: p20Shake 0.4s ease-in-out;
    border-color: #dc2626 !important;
}

/* ==========================================
   ADMIN PANEL MODAL & DASHBOARD STYLING
   ========================================== */
.admin-panel-modal {
    border: none;
    border-radius: 18px;
    padding: 0;
    width: 95%;
    max-width: 920px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
    font-family: inherit;
    color: #1e293b;
    background: #ffffff;
}

.admin-panel-modal::backdrop {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
}

.admin-panel-container {
    padding: 24px 28px;
    max-height: 86vh;
    overflow-y: auto;
    box-sizing: border-box;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 22px;
}

.admin-section {
    margin-bottom: 26px;
}

.admin-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.admin-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}

.admin-stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-align: left;
}

.admin-stat-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
    margin-top: 4px;
}

.admin-stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13.5px;
    background: #ffffff;
    color: #1e293b;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.admin-input:focus {
    outline: none;
    border-color: #1e293b;
}

.admin-btn-primary {
    background: #1e293b;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.admin-btn-primary:hover {
    background: #334155;
}

.admin-btn-outline {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.admin-btn-outline:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

.admin-table-container {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.admin-table th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: #f8fafc;
}

.admin-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
}

.admin-badge-active {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.admin-badge-paused {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.admin-badge-used {
    background: #f8fafc;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
}

.admin-badge-beta {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.admin-badge-camp {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
}

.admin-tabs {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
    margin-bottom: 16px;
}

.admin-tab-btn {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}

.admin-tab-btn.active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.admin-gate-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.admin-gate-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-gate-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .2s;
    border-radius: 24px;
}

.admin-gate-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
}

.admin-gate-switch input:checked + .admin-gate-slider {
    background-color: #059669;
}

.admin-gate-switch input:checked + .admin-gate-slider:before {
    transform: translateX(20px);
}

/* ==========================================
   DAILY ALLOWANCE MODAL & ZERO STATE CARDS
   ========================================== */
.daily-allowance-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10010;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}
.daily-allowance-modal-overlay.active {
    display: flex !important;
}
.daily-allowance-modal-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 32px 26px 26px 26px;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    position: relative;
    box-sizing: border-box;
    animation: dailyAllowancePop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dailyAllowancePop {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.daily-allowance-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}
.daily-allowance-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.daily-allowance-modal-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    margin: 0 auto 14px auto;
}
.daily-allowance-modal-title {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.2px;
}
.daily-allowance-modal-body {
    margin: 0 0 24px 0;
    font-size: 14px;
    color: #334155;
    line-height: 1.55;
}
.daily-allowance-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
}
.daily-allowance-btn-secondary {
    flex: 1;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 11px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
}
.daily-allowance-btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}
.daily-allowance-btn-upgrade {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #334155;
    color: #ffffff;
    text-decoration: none;
    padding: 11px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13.5px;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    text-align: center;
    font-family: inherit;
}
.daily-allowance-btn-upgrade:hover {
    background: #1e293b;
    color: #ffffff;
    transform: translateY(-1px);
}
@media (max-width: 480px) {
    .daily-allowance-modal-actions {
        flex-direction: column-reverse;
    }
    .daily-allowance-btn-secondary,
    .daily-allowance-btn-upgrade {
        width: 100%;
    }
}
.quota-zero-state-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #64748b;
    border-radius: 12px;
    padding: 16px 18px;
    margin: 14px 0;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ==========================================
   UNIFIED TOP-BAR STATUS QUOTA PILL
   ========================================== */
.quota-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.2;
    box-sizing: border-box;
    font-family: inherit;
}

.quota-pill:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-1px);
}

.quota-pill-icon {
    font-size: 13px;
    line-height: 1;
}

/* Modernized zero / locked quota pill state: standardized with modal upgrade button (#334155 dark slate) */
.quota-pill.quota-pill-zero,
.quota-pill.quota-pill-amber {
    background: #334155;
    border: 1px solid #1e293b;
    color: #ffffff;
    padding: 4px 11px;
    gap: 5px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.quota-pill.quota-pill-zero:hover,
.quota-pill.quota-pill-amber:hover {
    background: #1e293b;
    border-color: #0f172a;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.quota-pill-zero-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #0f172a;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2.5px 8px;
    border-radius: 12px;
    letter-spacing: 0.2px;
    line-height: 1.2;
}

.quota-pill-upgrade-badge {
    color: #0284c7;
    font-weight: 700;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.quota-pill.quota-pill-zero:hover .quota-pill-upgrade-badge,
.quota-pill.quota-pill-amber:hover .quota-pill-upgrade-badge {
    color: #0369a1;
    text-decoration: underline;
}

/* Pro / unlimited access badge */
.quota-pill.quota-pill-pro {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #475569;
    font-weight: 600;
}

.quota-pill.quota-pill-pro:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* Mobile responsive polish: collapse unit text on narrow screens */
@media (max-width: 600px) {
    .quota-pill {
        padding: 3px 8px;
        font-size: 11.5px;
        gap: 3px;
    }
    .quota-pill-unit {
        display: none !important;
    }
}

/* Dragos RPG dark theme subheader styling */
.dragos-theme-nav .quota-pill {
    background: rgba(35, 35, 45, 0.85);
    border-color: rgba(79, 79, 102, 0.6);
    color: #e0e0e0;
}
.dragos-theme-nav .quota-pill:hover {
    background: rgba(45, 45, 58, 1);
    border-color: #ffd700;
    color: #fff;
}
.dragos-theme-nav .quota-pill.quota-pill-zero,
.dragos-theme-nav .quota-pill.quota-pill-amber {
    background: #334155;
    border: 1px solid #1e293b;
    color: #ffffff;
}
.dragos-theme-nav .quota-pill.quota-pill-zero:hover,
.dragos-theme-nav .quota-pill.quota-pill-amber:hover {
    background: #1e293b;
    border-color: #0f172a;
    color: #ffffff;
}
.dragos-theme-nav .quota-pill-zero-badge {
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
}
.dragos-theme-nav .quota-pill-upgrade-badge {
    color: #38bdf8;
}
.dragos-theme-nav .quota-pill.quota-pill-pro {
    background: rgba(35, 35, 45, 0.85);
    border-color: rgba(79, 79, 102, 0.6);
    color: #e0e0e0;
}

/* ==========================================
   TIER LIMITS & USAGE MODAL STYLING
   ========================================== */
.tier-limits-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10015;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.tier-limits-modal-overlay.active {
    display: flex !important;
}

.tier-limits-modal-card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 20px;
    max-width: 560px;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.03);
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    animation: tierLimitsPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tierLimitsPop {
    from {
        opacity: 0;
        transform: scale(0.93) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tier-limits-modal-header {
    padding: 22px 24px 14px 24px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.tier-limits-icon-badge {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0, 102, 178, 0.08);
}

.tier-limits-header-text {
    flex: 1;
    min-width: 0;
}

.tier-limits-modal-title {
    margin: 0 0 3px 0;
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.2px;
}

.tier-limits-modal-subtitle {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.tier-limits-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.tier-limits-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* 2 Clickable Buttons (Tier Tabs) */
.tier-limits-tabs {
    margin: 14px 24px 0 24px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    display: flex;
    gap: 6px;
    border: 1px solid #e2e8f0;
}

.tier-tab-btn {
    flex: 1;
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: inherit;
    outline: none;
    color: #64748b;
    background: transparent;
    user-select: none;
}

.tier-tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.65);
    color: #0f172a;
}

.tier-tab-btn.active.tab-free {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tier-tab-btn.active.tab-pro {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.25);
}

.tier-tab-chip {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tier-tab-btn.active.tab-free .tier-tab-chip {
    background: #e2e8f0;
    color: #334155;
}

.tier-tab-btn:not(.active) .tier-tab-chip {
    background: #e2e8f0;
    color: #64748b;
}

.tier-tab-btn.active.tab-pro .tier-tab-chip {
    background: #fef08a;
    color: #854d0e;
}

/* Scrollable Content Body */
.tier-limits-body {
    padding: 14px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    overscroll-behavior: contain;
}

.tier-limits-body::-webkit-scrollbar {
    width: 6px;
}

.tier-limits-body::-webkit-scrollbar-track {
    background: #f8fafc;
}

.tier-limits-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.tier-limits-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Plan summary banner */
.tier-info-banner {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tier-info-banner.pro-banner {
    background: linear-gradient(135deg, #f0fdf4 0%, #eff6ff 100%);
    border-color: #bfdbfe;
}

.tier-info-banner-left {
    flex: 1;
}

.tier-banner-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.tier-banner-desc {
    font-size: 12px;
    color: #64748b;
    margin: 0;
    line-height: 1.4;
}

.tier-current-tag {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.tier-pro-highlight-tag {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* Feature Usage & Limit Rows */
.tier-feature-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 7px;
    transition: all 0.15s ease;
}

.tier-feature-item:hover {
    border-color: #cbd5e1;
    background: #fcfdfe;
}

.tier-feature-item.item-active-mode {
    border-color: #93c5fd;
    background: #f0f7ff;
}

.tier-feature-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tier-feature-name-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.tier-feature-icon {
    font-size: 16px;
    line-height: 1;
    width: 24px;
    text-align: center;
}

.tier-feature-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tier-feature-unit-hint {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 400;
}

.tier-feature-usage-group {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: right;
    white-space: nowrap;
}

.tier-feature-count {
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
}

.tier-status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    line-height: 1.2;
}

.tier-status-pill.status-available {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.tier-status-pill.status-full {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.tier-status-pill.status-unlimited {
    background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
    color: #0369a1;
    border: 1px solid #bae6fd;
    font-weight: 700;
}

.tier-status-pill.status-expanded {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-weight: 700;
}

/* Micro progress bar for current usage */
.tier-progress-track {
    margin-top: 6px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.tier-progress-fill {
    height: 100%;
    background: #0284c7;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.tier-progress-fill.fill-green {
    background: #10b981;
}

.tier-progress-fill.fill-amber {
    background: #f59e0b;
}

.tier-progress-fill.fill-red {
    background: #ef4444;
}

/* Upgrade Card inside Pro view or bottom of Free view */
.tier-upgrade-teaser {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 10px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.tier-upgrade-teaser-text {
    flex: 1;
}

.tier-upgrade-teaser-title {
    font-size: 13.5px;
    font-weight: 700;
    margin: 0 0 2px 0;
    color: #ffffff;
}

.tier-upgrade-teaser-sub {
    font-size: 11.5px;
    color: #94a3b8;
    margin: 0;
}

.tier-upgrade-teaser-btn {
    background: #ffffff;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 7px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tier-upgrade-teaser-btn:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

/* Modal Footer */
.tier-limits-footer {
    padding: 12px 24px 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #fafafa;
}

.tier-reset-note {
    font-size: 11.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tier-footer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tier-btn-done {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tier-btn-done:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.tier-btn-upgrade-primary {
    background: #0066b2;
    color: #ffffff;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 102, 178, 0.2);
}

.tier-btn-upgrade-primary:hover {
    background: #00508c;
    color: #ffffff;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .tier-limits-modal-header {
        padding: 18px 16px 12px 16px;
    }
    .tier-limits-tabs {
        margin: 12px 16px 0 16px;
    }
    .tier-limits-body {
        padding: 12px 16px;
    }
    .tier-limits-footer {
        padding: 12px 16px 16px 16px;
        flex-direction: column-reverse;
        align-items: stretch;
    }
    .tier-reset-note {
        justify-content: center;
    }
    .tier-footer-actions {
        width: 100%;
        justify-content: stretch;
    }
    .tier-btn-done,
    .tier-btn-upgrade-primary {
        flex: 1;
        text-align: center;
        justify-content: center;
    }
    .tier-upgrade-teaser {
        flex-direction: column;
        align-items: flex-start;
    }
    .tier-upgrade-teaser-btn {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================
   LISTENING COMPREHENSION & BLINDFOLD MASK
   ========================================== */
.listening-blindfold {
    filter: blur(10px) !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    pointer-events: none !important;
    transition: filter 0.4s ease;
}

#listeningChatBox {
    position: relative;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
    min-height: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease-in-out;
}

#listeningChatBox.fullscreen {
    position: fixed !important;
    top: 20px !important;
    bottom: 20px !important;
    left: 20px !important;
    right: 20px !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    margin: 0 !important;
    border-radius: 20px !important;
    z-index: 99999 !important;
    background: #f8fafc !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5) !important;
    box-sizing: border-box !important;
    padding: 40px !important;
    overflow-y: auto !important;
}

@media (max-width: 850px) {
    #listeningChatBox {
        padding: 12px 14px !important;
        min-height: auto !important;
    }
    .listening-clip-text {
        font-size: 15px !important;
        line-height: 1.5 !important;
        margin: 6px 0 !important;
        padding: 10px 12px !important;
    }
    #listeningChatBox.fullscreen {
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0 !important;
        padding: 20px !important;
    }
}

.listening-speaker-gate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0066b2;
    color: white;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 102, 178, 0.25);
    transition: all 0.2s ease;
}

.listening-speaker-gate-btn:hover:not(:disabled) {
    background: #00508f;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 102, 178, 0.35);
}

.listening-speaker-gate-btn:disabled,
.listening-speaker-gate-btn.locked {
    background: #94a3b8 !important;
    color: #f1f5f9 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    transform: none !important;
    pointer-events: none !important;
}

.listening-speaker-gate-btn.playing {
    background: #009246 !important;
    animation: listeningPulse 1.2s infinite;
    pointer-events: none !important;
    cursor: default !important;
}

@keyframes listeningPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.listening-clip-pill {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: #e0effe;
    color: #0066b2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.listening-clip-text {
    font-size: 18px;
    line-height: 1.8;
    color: #1e293b;
    font-family: 'Georgia', serif;
    margin: 16px 0;
    padding: 18px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #0066b2;
}

.listening-clip-card-review {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.listening-scorecard-hero {
    background: linear-gradient(135deg, #0066b2 0%, #009246 100%);
    color: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(0, 102, 178, 0.2);
}

/* ==========================================================
   MONTHLY CEFR ASSESSMENT STYLES & GUIDED OVERLAY TOUR
   ========================================================== */
.assessment-top-banner {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 10px 24px 12px;
    border-bottom: 2px solid #0284c7;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
    animation: slideDownBanner 0.3s ease;
    gap: 6px;
}
@keyframes slideDownBanner {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.assessment-banner-brand-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.assessment-banner-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 1.18rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.8px;
    text-transform: none;
    line-height: 1;
}

.assessment-brand-text {
    color: #ffffff;
    font-weight: 800;
}

.assessment-banner-flag {
    display: inline-flex;
    width: 22px;
    height: 15px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
    margin: 0 1px;
}

.assessment-banner-flag .flag-green {
    width: 33.33%;
    height: 100%;
    background: #009246;
}

.assessment-banner-flag .flag-white {
    width: 33.34%;
    height: 100%;
    background: #ffffff;
}

.assessment-banner-flag .flag-red {
    width: 33.33%;
    height: 100%;
    background: #CE2B37;
}

.assessment-banner-sub-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}

.assessment-top-banner-title {
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #cbd5e1;
}

.assessment-top-banner-pill {
    background: #0284c7;
    color: #ffffff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.assessment-cancel-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.assessment-cancel-btn:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

/* ==========================================================
   STYLISH CENTRAL ASSESSMENT EXIT MODAL
   ========================================================== */
.assessment-exit-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.assessment-exit-modal-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 28px 24px 22px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: scaleInCard 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleInCard {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.assessment-exit-modal-icon {
    font-size: 38px;
    line-height: 1;
    margin-bottom: 12px;
}

.assessment-exit-modal-title {
    margin: 0 0 10px;
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.2px;
}

.assessment-exit-modal-desc {
    margin: 0 0 24px;
    font-size: 14px;
    line-height: 1.55;
    color: #475569;
}

.assessment-exit-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.assessment-exit-btn-cancel {
    flex: 1;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.assessment-exit-btn-cancel:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.assessment-exit-btn-confirm {
    flex: 1;
    background: #ef4444;
    color: #ffffff;
    border: 1px solid #dc2626;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.28);
    transition: all 0.2s;
}

.assessment-exit-btn-confirm:hover {
    background: #dc2626;
    border-color: #b91c1c;
}

/* Silverish / Grey Metallic Pulse Animation for Level Badge on Assessment Availability */
@keyframes assessmentBadgePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(203, 213, 225, 0.9);
        transform: scale(1);
    }
    45% {
        box-shadow: 0 0 16px 5px rgba(226, 232, 240, 0.95), 0 0 28px 9px rgba(148, 163, 184, 0.55);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(148, 163, 184, 0);
        transform: scale(1);
    }
}

.badge-honor-pill.assessment-available-pulse,
#userBadgeHonor.assessment-available-pulse {
    animation: assessmentBadgePulse 1.2s cubic-bezier(0.25, 1, 0.5, 1) 1 forwards !important;
}

/* ==========================================================
   ASSESSMENT MODE SLIMLINE HEADER & MOBILE SPACE RECLAMATION
   ========================================================== */
/* ==========================================================
   TOP NAVIGATION BUTTON (MATCHING CUSTOM STORIES & BOOKS)
   ========================================================== */
.top-nav-btn {
    background: #ffffff !important;
    color: #0066b2 !important;
    border: 1px solid #0066b2 !important;
    padding: 0 14px !important;
    height: 36px !important;
    border-radius: 8px !important;
    font-size: 0.9rem !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02) !important;
    box-sizing: border-box !important;
    text-decoration: none !important;
}
.top-nav-btn:hover {
    background: #eef5fa !important;
    transform: translateY(-1px) !important;
}

body.assessment-mode-active h1,
body.assessment-mode-active .subtitle,
body.assessment-mode-active .badge-of-honor-wrapper,
body.assessment-mode-active .tabs,
body.assessment-mode-active [onclick*="openGuide"],
body.assessment-mode-active .modern-guide-btn,
body.assessment-mode-active #trainingLobbyGuideRow,
body.assessment-mode-active [onclick*="exitTrainingSession"],
body.assessment-mode-active [onclick*="exitListeningSession"],
body.assessment-mode-active [onclick*="exitPersonal20Session"],
body.assessment-mode-active a.top-nav-btn[href="/"],
body.assessment-mode-active .game-controls-row > .top-nav-btn,
body.assessment-mode-active .reading-subheader-bar,
body.assessment-mode-active #readingUnifiedNavBar,
body.assessment-mode-active .reading-unified-nav-bar {
    display: none !important;
}

@media (max-width: 768px) {
    .assessment-top-banner {
        padding: 8px 14px 10px !important;
        gap: 5px !important;
    }
    .assessment-banner-brand {
        font-size: 1.05rem !important;
        gap: 5px !important;
    }
    .assessment-banner-flag {
        width: 19px !important;
        height: 13px !important;
    }
    .assessment-top-banner-title {
        font-size: 12.5px !important;
        gap: 6px !important;
    }
    .assessment-top-banner-pill {
        font-size: 10.5px !important;
        padding: 2px 7px !important;
    }
    .assessment-cancel-btn {
        padding: 4px 9px !important;
        font-size: 11px !important;
    }
}

/* Explicit Target Tense Header & Explanation Banner */
.assessment-tense-banner {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1.5px solid #7dd3fc;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 18px;
    text-align: left;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
}
.assessment-tense-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
}
.assessment-tense-badge {
    background: #0284c7;
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.assessment-tense-desc {
    font-size: 13.5px;
    color: #0369a1;
    line-height: 1.45;
    margin: 0;
}

/* First-attempt neutral feedback indicator */
.assessment-first-attempt-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #bae6fd;
    animation: fadeIn 0.3s ease;
}

/* Assessment Modals */
.assessment-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}
.assessment-modal-card {
    background: #ffffff;
    border-radius: 20px;
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    padding: 28px;
    box-sizing: border-box;
    text-align: left;
}
.assessment-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 16px;
    margin-bottom: 18px;
}
.assessment-stage-step-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    margin-bottom: 8px;
}
.assessment-stage-step-num {
    background: #0284c7;
    color: white;
    font-weight: 800;
    font-size: 11px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* XP Burst Animation */
.assessment-xp-burst {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 18px 24px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(217, 119, 6, 0.3);
    margin-bottom: 20px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Score Pills */
.assessment-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(95px, 1fr));
    gap: 8px;
    margin: 16px 0;
}
.assessment-score-pill {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
}
.assessment-score-val {
    font-size: 16px;
    font-weight: 800;
    color: #0284c7;
    margin-bottom: 2px;
}
.assessment-score-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
}

/* Comparison Bar */
.assessment-level-compare {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px;
    background: #f1f5f9;
    border-radius: 12px;
    margin: 18px 0;
}
.assessment-level-box {
    text-align: center;
}
.assessment-level-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 800;
}
.assessment-level-box.current .assessment-level-badge {
    background: #cbd5e1;
    color: #334155;
}
.assessment-level-box.recommended .assessment-level-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Collapsible Notes */
.assessment-notes-details {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 10px;
    cursor: pointer;
}
.assessment-notes-summary {
    font-weight: 700;
    font-size: 13px;
    color: #475569;
    outline: none;
}
.assessment-notes-body {
    padding-top: 10px;
    font-size: 13px;
    color: #334155;
    line-height: 1.5;
}

/* ==========================================================
   INPUT VALIDATION: SUBTLE SHAKE & RED TINT ANIMATION
   ========================================================== */
@keyframes inputMissingShake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

.input-error-shake,
input.input-error-shake,
textarea.input-error-shake {
    animation: inputMissingShake 0.4s ease-in-out !important;
    border: 1.5px solid #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
    outline: none !important;
}

.input-error-shake::placeholder,
input.input-error-shake::placeholder,
textarea.input-error-shake::placeholder {
    color: #ef4444 !important;
    opacity: 0.8 !important;
}

/* ==========================================================
   CUSTOM STORY MODE: EASY INTERACTIVE VS HARD DEEP STUDY
   ========================================================== */
/* Subtle selection style for active unsubmitted Grammar Hunt */
.tts-word.grammar-selected {
    border-bottom: 2px solid #f59e0b !important;
    color: #b45309 !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
}

.grammar-story-hint {
    user-select: none;
    line-height: 1.4;
}

/* Easy Mode Target Sentence Card in Translation Workbench */
.trans-target-sentence-card {
    background: #f8fafc;
    border: 1.5px solid #bae6fd;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.05);
}

.trans-sentence-badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.trans-sentence-step-badge {
    font-size: 12px;
    font-weight: 800;
    color: #0369a1;
    background: #e0f2fe;
    padding: 3px 10px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.trans-mode-pill {
    font-size: 11px;
    font-weight: 700;
    color: #009246;
    background: #dcfce7;
    padding: 2px 8px;
    border-radius: 10px;
}

.trans-target-sentence-quote {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.5;
    font-style: italic;
    background: #ffffff;
    border-left: 3px solid #0284c7;
    padding: 8px 12px;
    border-radius: 4px;
}

/* Easy Mode Grammar Helper Bar */
.grammar-easy-helper-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: 8px;
    margin-bottom: 12px;
}

.grammar-status-pill {
    font-size: 13px;
    font-weight: 700;
    color: #854d0e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.grammar-clear-btn {
    border: none;
    background: transparent;
    color: #b45309;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 6px;
}

.grammar-clear-btn:hover {
    color: #78350f;
}

/* Hard Mode Structured Input Rows */
.grammar-hard-rows-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.grammar-hard-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    transition: border-color 0.2s;
}

.grammar-hard-row:focus-within {
    border-color: #0066b2;
    box-shadow: 0 0 0 3px rgba(0, 102, 178, 0.1);
}

.grammar-hard-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.grammar-hard-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.grammar-hard-input {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    color: #1e293b;
    outline: none;
    transition: all 0.15s ease;
    background: #f8fafc;
}

.grammar-hard-input:focus {
    border-color: #0066b2;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(0, 102, 178, 0.15);
}

.grammar-hard-input.correct {
    border-color: #22c55e !important;
    background-color: #f0fdf4 !important;
    color: #166534 !important;
    font-weight: 600 !important;
}

.grammar-hard-input.incorrect {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    color: #991b1b !important;
}

.grammar-hard-ref-hint {
    font-size: 11px;
    color: #0284c7;
    margin-top: 2px;
    font-weight: 600;
}

/* Grammar Table Breakdown */
.grammar-breakdown-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 12px;
}

.grammar-rule-callout {
    background: #f0f9ff;
    border-left: 4px solid #0284c7;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 13.5px;
    color: #0c4a6e;
    line-height: 1.5;
    margin-bottom: 12px;
}

.grammar-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 8px;
}

.grammar-breakdown-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1.5px solid #cbd5e1;
    font-size: 11.5px;
    text-transform: uppercase;
}

.grammar-breakdown-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

@media (max-width: 640px) {
    .grammar-hard-row {
        grid-template-columns: 1fr;
    }
}