/**
 * YSP Lexical Games - Frontend Styles
 * Modern, responsive styling for SORTING GAME
 */

/* Game Container */
.ysp-lexical-game {
    max-width: 900px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Game Header */
.ysp-game-header {
    background: linear-gradient(135deg,rgb(74, 191, 215) 0%,rgb(41, 77, 78) 100%); 
    color: white;
    padding: 20px;
    text-align: center;
}

.ysp-game-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.ysp-game-description {
    font-size: 16px;
    margin: 0;
    opacity: 0.9;
}

/* Stats Bar - TEAL instead of grey */
.ysp-game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg,rgb(74, 191, 215) 0%,rgb(41, 77, 78) 100%);   /* CHANGED from #f8f9fa */
    color: white;  /* ADDED for text visibility */
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);  /* CHANGED from #e9ecef */
}

/* Stats text color */
.ysp-game-timer,
.ysp-game-score,
.ysp-game-attempts,
.ysp-sentence-progress {
    font-weight: 600;
    color: white;  /* CHANGED - all stats text white */
}

/* Game Controls */
.ysp-game-controls {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.ysp-btn {
    display: inline-block;
    padding: 10px 20px;
    margin: 0 5px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ysp-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.ysp-btn:active {
    transform: translateY(0);
}

.ysp-btn-secondary {
    background: #6c757d;
}

.ysp-btn-secondary:hover {
    background: #545b62;
}

.ysp-btn-success {
    background: #28a745;
}

.ysp-btn-success:hover {
    background: #1e7e34;
}

/* Sort Containers Area */
.ysp-sort-containers {
    padding: 30px 20px 20px;
    background: #ffffff;
}

.ysp-containers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Individual Container */
.ysp-sort-container {
    border: 3px dashed #dee2e6;
    border-radius: 10px;
    padding: 20px;
    min-height: 120px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    position: relative;
}

.ysp-sort-container.drag-over {
    border-color: #007cba;
    background: #e3f2fd;
    transform: scale(1.02);
}

.ysp-sort-container.correct-drop {
    border-color: #28a745;
    background: #d4edda;
    animation: successPulse 0.6s ease-out;
}

.ysp-sort-container.incorrect-drop {
    border-color: #dc3545;
    background: #f8d7da;
    animation: errorShake 0.6s ease-out;
}

.ysp-container-header {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid;
}

.ysp-container-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 60px;
}

/* Items Pool Area */
.ysp-items-pool {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.ysp-pool-header {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    color: #495057;
}

.ysp-items-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}



.ysp-draggable-item.selected {
  outline: 2px solid var(--ysp-accent, #0a9396);
  border-radius: 8px;
}
/* Make taps snappy; stop iOS long-press menus */
.ysp-draggable-item,
.ysp-sort-container {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  touch-action: manipulation;
}

/* Optional: maintain a bit of visual stability */
.ysp-container-items {
  min-height: 0.75rem; /* keeps box from collapsing while item fades */
}

/* Draggable Items */
.ysp-draggable-item {
    display: inline-block;
    padding: 12px 18px;
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    color: white;
    border-radius: 25px;
    cursor: grab;
    font-weight: 500;
    font-size: 16px;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ysp-draggable-item:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.ysp-draggable-item.dragging {
    opacity: 0.5;
    transform: rotate(-5deg) scale(1.1);
    cursor: grabbing;
    z-index: 1000;
}

.ysp-draggable-item.correct {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    animation: successBounce 0.6s ease-out;
}

.ysp-draggable-item.incorrect {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
    animation: errorPulse 0.6s ease-out;
}

.ysp-draggable-item.placed {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    cursor: default;
    opacity: 0.8;
}

/* Game Complete State */
.ysp-game-complete {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.ysp-game-complete h3 {
    font-size: 28px;
    margin: 0 0 10px 0;
}

.ysp-game-complete p {
    font-size: 18px;
    margin: 0 0 20px 0;
    opacity: 0.9;
}

.ysp-completion-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.ysp-stat-item {
    text-align: center;
}

.ysp-stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
}

.ysp-stat-label {
    font-size: 14px;
    opacity: 0.8;
}

/* Animations */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes successBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes errorPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes selectedPulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4); }
    50% { box-shadow: 0 8px 25px rgba(255, 152, 0, 0.6); }
}

@keyframes pulseReady {
    0%, 100% { 
        border-color: #ffc107;
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4);
    }
    50% { 
        border-color: #ff9800;
        box-shadow: 0 0 0 8px rgba(255, 193, 7, 0.1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ysp-lexical-game {
        margin: 10px;
        border-radius: 8px;
    }
    
    .ysp-game-header {
        padding: 15px;
    }
    
    .ysp-game-title {
        font-size: 20px;
    }
    
    .ysp-containers-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ysp-sort-container {
        padding: 15px;
        min-height: 100px;
    }
    
    .ysp-draggable-item {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .ysp-draggable-item.selected { outline: 3px solid #4caf50; outline-offset: 2px; 
        
    }
    
    
    .ysp-game-stats {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .ysp-completion-stats {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .ysp-sort-containers {
        padding: 20px 15px;
    }
    
    .ysp-items-pool {
        padding: 15px;
    }
    
    .ysp-draggable-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .ysp-items-grid {
        gap: 8px;
    }
}

/* Loading State */
.ysp-game-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.ysp-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.ysp-draggable-item:focus {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

.ysp-sort-container:focus-within {
    border-color: #007cba;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ysp-sort-container {
        border-width: 2px;
        border-style: solid;
    }
    
    .ysp-draggable-item {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ysp-draggable-item,
    .ysp-sort-container,
    .ysp-btn {
        transition: none;
        animation: none;
    }
    
    .ysp-draggable-item:hover {
        transform: none;
    }
}

/**
 * END OF SORTING GAME CSS
 * Modern, responsive styling for SORTING GAME
 */
 
 /* ==========================================
   MATCHING GAME STYLES
   ========================================== */

/* Matching Game Layout – joined two-column panels */
.ysp-matching-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;                /* almost touching; set to 0 for seamless */
    padding: 10px;
    background: #ffffff;
    align-items: start;
}

/* Panels: distinct tints, shared border, joined edges */
.ysp-definitions-section,
.ysp-terms-section {
    padding: 12px;
    border: 1px solid #e5e7eb;
    background: #f0f8ff;     /* default; overridden for terms below */
}

/* Stack panels, full-width */
.ysp-matching-area {
  display: block;
  padding: 12px;
  background: #fff;
}

/* Distinct tints; full-width blocks */
.ysp-definitions-section,
.ysp-terms-section {
  padding: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 10px;
  background: #eaf4ff;   /* defs: blue */
}

.ysp-terms-section { background: #e9f9eb; } /* terms: green */

/* Hide headers (space saver) */
.ysp-section-header { display: none !important; }

/* Default: flexible grid */
.ysp-definitions-grid,
.ysp-terms-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 12px !important;
  margin-top: 0 !important;
}

/* Make sure long text wraps nicely */
.ysp-definition-item,
.ysp-term-item {
  white-space: normal;
  word-break: break-word;
}

/* Wide screens: allow bigger cards */
@media (min-width: 1100px) {
  .ysp-definitions-grid,
  .ysp-terms-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  }
}

/* ✅ Mobile: force exactly 2 columns + smaller text */
@media (max-width: 640px) {
  .ysp-definitions-grid,
  .ysp-terms-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .ysp-definition-item,
  .ysp-term-item {
    font-size: 13px;
    padding: 10px;
    min-height: 44px;
  }
}

/* Ensure “button” look everywhere */
.ysp-definitions-grid .ysp-definition-item,
.ysp-terms-grid .ysp-term-item {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 14px 12px;
  background: #fff;
  border-radius: 8px;
  border: 2px solid transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  font-size: 16px;
  min-height: 56px;
  text-align: center;
}

/* Accents */
.ysp-definition-item { border-left: 4px solid #1e88e5; }
.ysp-term-item       { border-left: 4px solid #2e7d32; font-weight: 600; }


/* Remove section headers to save space */
.ysp-section-header { display: none !important; }



/* Cards */
.ysp-definition-item,
.ysp-term-item {
    padding: 14px 12px;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
    border: 2px solid transparent;
    font-size: 16px;
    line-height: 1.35;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ysp-definition-item:hover,
.ysp-term-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}


/* Selection states */
.ysp-term-item.selected {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: #fff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255,152,0,.35);
    border-color: #ff9800;
}

.ysp-definition-item.awaiting {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #ff9800;
    animation: awaitingPulse 1.5s ease-in-out infinite;
}

.ysp-definition-item.awaiting:hover {
    background: linear-gradient(135deg, #ffe0b2 0%, #ffcc80 100%);
}

/* Match feedback */
.ysp-term-item.correct-match,
.ysp-definition-item.correct-match {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%) !important;
    color: #fff !important;
    border-color: #4caf50 !important;
    animation: correctMatchPulse 0.6s ease-out;
}

.ysp-term-item.incorrect-match,
.ysp-definition-item.incorrect-match {
    background: linear-gradient(135deg, #f44336 0%, #e57373 100%) !important;
    color: #fff !important;
    border-color: #f44336 !important;
    animation: incorrectMatchShake 0.6s ease-out;
}

/* Temporary style while JS fades them; JS will then remove nodes */
.ysp-term-item.matched,
.ysp-definition-item.matched {
    opacity: 0.35;
    transform: scale(0.97);
    pointer-events: none;
    background: #f5f7fa !important;
    color: #8a8f98 !important;
    border-color: #d7dde5 !important;
}

/* Removal animation class (JS adds .ysp-vanish then removes on transitionend) */
.ysp-vanish {
    opacity: 0 !important;
    transform: scale(0.92) !important;
    transition: opacity .18s ease, transform .18s ease;
}

/* Progress chip */
.ysp-game-progress {
    font-weight: 600;
    color: #1565c0;
    background: rgba(21,101,192,.10);
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 14px;
}

/* Lives Display with Hearts */
.ysp-lives-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ysp-heart {
    font-size: 20px;
    line-height: 1;
    display: inline-block;
    animation: heartBeat 0.3s ease;
}

.ysp-heart-full {
    color: #dc2626;
    filter: drop-shadow(0 1px 2px rgba(220, 38, 38, 0.5));
}

.ysp-heart-empty {
    color: #374151;
    opacity: 0.5;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Timer Display */
.ysp-timer-container {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    color: #1f2937;
}

.ysp-timer-value {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 1px;
    color: #0A9396;
}

/* When timer is low (under 30 seconds), make it pulse red */
.ysp-timer-container.ysp-timer-warning {
    animation: timerPulse 1s infinite;
}

.ysp-timer-container.ysp-timer-warning .ysp-timer-value {
    color: #dc2626;
}

@keyframes timerPulse {
    0%, 100% { 
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    50% { 
        background: rgba(254, 226, 226, 0.95);
        box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    }
}

/* Practice Mode Display */
.ysp-mode-practice {
    padding: 4px 12px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    color: #059669;
    font-weight: 600;
}

/* Game Status Container - ensure proper layout */
.ysp-game-status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .ysp-heart {
        font-size: 18px;
    }
    
    .ysp-lives-container,
    .ysp-timer-container {
        padding: 3px 6px;
    }
    
    .ysp-timer-value {
        font-size: 14px;
    }
}

/* Ensure game container doesn't cut off content */
.ysp-lexical-game {
    max-width: 900px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: visible; /* Changed from hidden to visible */
    min-height: fit-content; /* Ensure it expands for content */
}

/* Ensure matching area expands properly */
.ysp-matching-area {
    display: block;
    padding: 12px;
    background: #fff;
    min-height: 400px; /* Ensure minimum height */
    overflow: visible; /* Don't clip content */
}

/* Ensure sections don't get cut off */
.ysp-definitions-section,
.ysp-terms-section {
    padding: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 10px;
    min-height: 200px; /* Ensure minimum height */
}

/* Fix game instructions visibility */
.ysp-game-instructions {
    padding: 15px;
    background: #f8f9fa;
    text-align: center;
    border-top: 1px solid #e9ecef;
    margin-top: 10px; /* Add spacing */
}

/* Animations (unchanged) */
@keyframes awaitingPulse {
    0%, 100% { box-shadow: 0 2px 4px rgba(0,0,0,.08); border-color: #ff9800; }
    50%      { box-shadow: 0 4px 15px rgba(255,152,0,.28); border-color: #f57c00; }
}
@keyframes correctMatchPulse { 0%{transform:scale(1)} 50%{transform:scale(1.1)} 100%{transform:scale(1)} }
@keyframes incorrectMatchShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }

/* Responsive */
@media (max-width: 768px) {
    .ysp-matching-area { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
    .ysp-definitions-section,
    .ysp-terms-section {
        border-radius: 8px;         /* restore when stacked */
        border-left: 1px solid #e5e7eb;
        border-right: 1px solid #e5e7eb;
    }
    .ysp-definitions-grid, .ysp-terms-grid { gap: 10px; }
    .ysp-definition-item, .ysp-term-item { padding: 12px; font-size: 15px; min-height: 50px; }
}

@media (max-width: 480px) {
    .ysp-definition-item, .ysp-term-item { padding: 10px; font-size: 14px; min-height: 46px; }
}

/* High contrast */
@media (prefers-contrast: high) {
    .ysp-definition-item, .ysp-term-item, .ysp-definitions-section, .ysp-terms-section { border-width: 3px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ysp-definition-item, .ysp-term-item { transition: none; animation: none; }
    .ysp-definition-item:hover, .ysp-term-item:hover { transform: none; }
    .ysp-term-item.selected { transform: none; }
}

/* ==========================================
   CLOZE TEST GAME STYLES
   ========================================== */

/* Cloze Game Container */
.ysp-cloze-dropdown { position: relative; display: inline-block; }
.ysp-cloze-gap { position: relative; z-index: 1; } /* stays above text line */
.ysp-cloze-options {
  display: none;
  position: absolute; top: 100%; left: 0;
  min-width: 160px; max-height: 220px; overflow-y: auto;
  background: #fff; border: 2px solid #ffc107; border-radius: 6px;
  box-shadow: 0 8px 25px rgba(0,0,0,.15); z-index: 9999;
}
.ysp-cloze-options.show { display: block; }
.ysp-cloze-option { display: block; padding: 10px 15px; cursor: pointer; }

.ysp-cloze-game {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Cloze Text Area */
.ysp-cloze-text-area {
    padding: 30px 25px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.ysp-cloze-text {
    font-size: 18px;
    line-height: 1.8;
    color: #2c3e50;
    text-align: justify;
}

/* Cloze Gaps - Dropdown Style */
.ysp-cloze-gap {
    display: inline-block;
    min-width: 120px;
    max-width: 200px;
    margin: 0 4px;
    padding: 6px 12px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    color: #856404;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    vertical-align: baseline;
}

.ysp-cloze-gap:hover {
    background: #fff3cd;
    border-color: #ff9800;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.ysp-cloze-gap:focus {
    outline: none;
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

/* Gap States */
.ysp-cloze-gap.correct {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
    color: #155724;
    animation: correctPulse 0.6s ease-out;
}

.ysp-cloze-gap.incorrect {
    background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
    border-color: #dc3545;
    color: #721c24;
    animation: incorrectShake 0.6s ease-out;
}

.ysp-cloze-gap.completed {
    background: #e9ecef;
    border-color: #6c757d;
    color: #495057;
    cursor: default;
    opacity: 0.8;
}

.ysp-cloze-gap.retry-available {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
    cursor: pointer;
}

/* Input Mode Gaps */
.ysp-cloze-game.mode-input .ysp-cloze-gap {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    color: #495057;
    text-align: center;
    min-width: 100px;
}

.ysp-cloze-game.mode-input .ysp-cloze-gap:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 123, 186, 0.2);
}

/* Progress and Stats */
.ysp-cloze-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.ysp-cloze-stats {
    display: flex;
    gap: 25px;
    align-items: center;
}

.ysp-cloze-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ysp-cloze-stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #007cba;
}

.ysp-cloze-stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Controls */
.ysp-cloze-controls {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ysp-cloze-hint {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 15px 0;
    color: #0c5460;
    font-size: 14px;
    display: none;
}

.ysp-cloze-hint.show {
    display: block;
    animation: fadeInUp 0.4s ease-out;
}

/* Completion Screen */
.ysp-cloze-complete {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-radius: 12px;
    margin-top: 20px;
}

.ysp-cloze-complete h3 {
    font-size: 28px;
    margin: 0 0 15px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ysp-cloze-complete p {
    font-size: 18px;
    margin: 0 0 25px 0;
    opacity: 0.95;
}

.ysp-completion-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin: 25px 0;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.ysp-completion-stat {
    text-align: center;
}

.ysp-completion-stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.ysp-completion-stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dropdown Options */
.ysp-cloze-dropdown {
    position: relative;
    display: inline-block;
}

.ysp-cloze-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #ffc107;
    border-radius: 6px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.ysp-cloze-options.show {
    display: block;
    animation: dropdownSlide 0.2s ease-out;
}

.ysp-cloze-option {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #495057;
}

.ysp-cloze-option:hover {
    background: #f8f9fa;
}

.ysp-cloze-option:last-child {
    border-bottom: none;
}

.ysp-cloze-option.selected {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
}

/* Feedback Messages */
.ysp-cloze-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ysp-cloze-feedback.show {
    transform: translateX(0);
}

.ysp-cloze-feedback.correct {
    background: #28a745;
}

.ysp-cloze-feedback.incorrect {
    background: #dc3545;
}

/* Smart upward positioning when near bottom */
.ysp-cloze-options.open-upward {
    top: auto;
    bottom: 100%;
    margin-bottom: 4px;
}

/* Animations */
@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ysp-cloze-text-area {
        padding: 20px 15px;
    }
    
    .ysp-cloze-text {
        font-size: 16px;
        line-height: 1.6;
    }
    
    .ysp-cloze-gap {
        min-width: 100px;
        max-width: 150px;
        padding: 8px 10px;
        font-size: 14px;
        margin: 2px;
    }
    
    .ysp-cloze-progress {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .ysp-cloze-stats {
        justify-content: center;
        gap: 20px;
    }
    
    .ysp-completion-breakdown {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .ysp-cloze-feedback {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        transform: translateY(-100%);
        text-align: center;
    }
    
    .ysp-cloze-feedback.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .ysp-cloze-text {
        font-size: 15px;
    }
    
    .ysp-cloze-gap {
        min-width: 80px;
        max-width: 120px;
        padding: 6px 8px;
        font-size: 13px;
    }
    
    .ysp-cloze-stats {
        gap: 15px;
    }
    
    .ysp-cloze-stat-value {
        font-size: 18px;
    }
    
    .ysp-completion-breakdown {
        grid-template-columns: 1fr;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ysp-cloze-gap {
        border-width: 3px;
    }
    
    .ysp-cloze-gap.correct {
        border-color: #000;
        background: #90EE90;
        color: #000;
    }
    
    .ysp-cloze-gap.incorrect {
        border-color: #000;
        background: #FFB6C1;
        color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ysp-cloze-gap,
    .ysp-cloze-option,
    .ysp-cloze-feedback {
        transition: none;
        animation: none;
    }
    
    .ysp-cloze-gap:hover {
        transform: none;
    }
}

/**
 * YSP Lexical Games - Frontend Styles
 * Modern, responsive styling for SORTING GAME
 */

/* Game Container */
.ysp-lexical-game {
    max-width: 900px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Game Header */
.ysp-game-header {
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.ysp-game-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.ysp-game-description {
    font-size: 16px;
    margin: 0;
    opacity: 0.9;
}

/* Game Stats Bar */
.ysp-game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
}

.ysp-game-timer {
    font-weight: 600;
    color: #495057;
}

.ysp-game-score {
    font-weight: 600;
    color: #28a745;
}

.ysp-game-attempts {
    font-weight: 600;
    color: #6c757d;
}

/* Game Controls */
.ysp-game-controls {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.ysp-btn {
    display: inline-block;
    padding: 10px 20px;
    margin: 0 5px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.ysp-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.ysp-btn:active {
    transform: translateY(0);
}

.ysp-btn-secondary {
    background: #6c757d;
}

.ysp-btn-secondary:hover {
    background: #545b62;
}

.ysp-btn-success {
    background: #28a745;
}

.ysp-btn-success:hover {
    background: #1e7e34;
}

/* Sort Containers Area */
.ysp-sort-containers {
    padding: 30px 20px 20px;
    background: #ffffff;
}

.ysp-containers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Individual Container */
.ysp-sort-container {
    border: 3px dashed #dee2e6;
    border-radius: 10px;
    padding: 20px;
    min-height: 120px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    position: relative;
}

.ysp-sort-container.drag-over {
    border-color: #007cba;
    background: #e3f2fd;
    transform: scale(1.02);
}

.ysp-sort-container.correct-drop {
    border-color: #28a745;
    background: #d4edda;
    animation: successPulse 0.6s ease-out;
}

.ysp-sort-container.incorrect-drop {
    border-color: #dc3545;
    background: #f8d7da;
    animation: errorShake 0.6s ease-out;
}

.ysp-container-header {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid;
}

.ysp-container-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 60px;
}

/* Items Pool Area */
.ysp-items-pool {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.ysp-pool-header {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    color: #495057;
}

.ysp-items-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}



.ysp-draggable-item.selected {
  outline: 2px solid var(--ysp-accent, #0a9396);
  border-radius: 8px;
}
/* Make taps snappy; stop iOS long-press menus */
.ysp-draggable-item,
.ysp-sort-container {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  touch-action: manipulation;
}

/* Optional: maintain a bit of visual stability */
.ysp-container-items {
  min-height: 0.75rem; /* keeps box from collapsing while item fades */
}

/* Draggable Items */
.ysp-draggable-item {
    display: inline-block;
    padding: 12px 18px;
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    color: white;
    border-radius: 25px;
    cursor: grab;
    font-weight: 500;
    font-size: 16px;
    user-select: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ysp-draggable-item:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.ysp-draggable-item.dragging {
    opacity: 0.5;
    transform: rotate(-5deg) scale(1.1);
    cursor: grabbing;
    z-index: 1000;
}

.ysp-draggable-item.correct {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    animation: successBounce 0.6s ease-out;
}

.ysp-draggable-item.incorrect {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
    animation: errorPulse 0.6s ease-out;
}

.ysp-draggable-item.placed {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    cursor: default;
    opacity: 0.8;
}

/* Game Complete State */
.ysp-game-complete {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.ysp-game-complete h3 {
    font-size: 28px;
    margin: 0 0 10px 0;
}

.ysp-game-complete p {
    font-size: 18px;
    margin: 0 0 20px 0;
    opacity: 0.9;
}

.ysp-completion-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.ysp-stat-item {
    text-align: center;
}

.ysp-stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
}

.ysp-stat-label {
    font-size: 14px;
    opacity: 0.8;
}

/* Animations */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes successBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes errorPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes selectedPulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4); }
    50% { box-shadow: 0 8px 25px rgba(255, 152, 0, 0.6); }
}

@keyframes pulseReady {
    0%, 100% { 
        border-color: #ffc107;
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4);
    }
    50% { 
        border-color: #ff9800;
        box-shadow: 0 0 0 8px rgba(255, 193, 7, 0.1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ysp-lexical-game {
        margin: 10px;
        border-radius: 8px;
    }
    
    .ysp-game-header {
        padding: 15px;
    }
    
    .ysp-game-title {
        font-size: 20px;
    }
    
    .ysp-containers-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ysp-sort-container {
        padding: 15px;
        min-height: 100px;
    }
    
    .ysp-draggable-item {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .ysp-draggable-item.selected { outline: 3px solid #4caf50; outline-offset: 2px; 
        
    }
    
    
    .ysp-game-stats {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .ysp-completion-stats {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .ysp-sort-containers {
        padding: 20px 15px;
    }
    
    .ysp-items-pool {
        padding: 15px;
    }
    
    .ysp-draggable-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .ysp-items-grid {
        gap: 8px;
    }
}

/* Loading State */
.ysp-game-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.ysp-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.ysp-draggable-item:focus {
    outline: 3px solid #007cba;
    outline-offset: 2px;
}

.ysp-sort-container:focus-within {
    border-color: #007cba;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ysp-sort-container {
        border-width: 2px;
        border-style: solid;
    }
    
    .ysp-draggable-item {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ysp-draggable-item,
    .ysp-sort-container,
    .ysp-btn {
        transition: none;
        animation: none;
    }
    
    .ysp-draggable-item:hover {
        transform: none;
    }
}

/**
 * END OF SORTING GAME CSS
 * Modern, responsive styling for SORTING GAME
 */
 
 /* ==========================================
   MATCHING GAME STYLES
   ========================================== */

/* Matching Game Layout â€“ joined two-column panels */
.ysp-matching-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;                /* almost touching; set to 0 for seamless */
    padding: 10px;
    background: #ffffff;
    align-items: start;
}

/* Panels: distinct tints, shared border, joined edges */
.ysp-definitions-section,
.ysp-terms-section {
    padding: 12px;
    border: 1px solid #e5e7eb;
    background: #f0f8ff;     /* default; overridden for terms below */
}

/* Stack panels, full-width */
.ysp-matching-area {
  display: block;
  padding: 12px;
  background: #fff;
}

/* Distinct tints; full-width blocks */
.ysp-definitions-section,
.ysp-terms-section {
  padding: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 10px;
  background: #eaf4ff;   /* defs: blue */
}

.ysp-terms-section { background: #e9f9eb; } /* terms: green */

/* Hide headers (space saver) */
.ysp-section-header { display: none !important; }

/* Default: flexible grid */
.ysp-definitions-grid,
.ysp-terms-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 12px !important;
  margin-top: 0 !important;
}

/* Make sure long text wraps nicely */
.ysp-definition-item,
.ysp-term-item {
  white-space: normal;
  word-break: break-word;
}

/* Wide screens: allow bigger cards */
@media (min-width: 1100px) {
  .ysp-definitions-grid,
  .ysp-terms-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  }
}

/* âœ… Mobile: force exactly 2 columns + smaller text */
@media (max-width: 640px) {
  .ysp-definitions-grid,
  .ysp-terms-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .ysp-definition-item,
  .ysp-term-item {
    font-size: 13px;
    padding: 10px;
    min-height: 44px;
  }
}

/* Ensure â€œbuttonâ€ look everywhere */
.ysp-definitions-grid .ysp-definition-item,
.ysp-terms-grid .ysp-term-item {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 14px 12px;
  background: #fff;
  border-radius: 8px;
  border: 2px solid transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  font-size: 16px;
  min-height: 56px;
  text-align: center;
}

/* Accents */
.ysp-definition-item { border-left: 4px solid #1e88e5; }
.ysp-term-item       { border-left: 4px solid #2e7d32; font-weight: 600; }


/* Remove section headers to save space */
.ysp-section-header { display: none !important; }



/* Cards */
.ysp-definition-item,
.ysp-term-item {
    padding: 14px 12px;
    background: #ffffff;
    border-radius: 8px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
    border: 2px solid transparent;
    font-size: 16px;
    line-height: 1.35;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ysp-definition-item:hover,
.ysp-term-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}


/* Selection states */
.ysp-term-item.selected {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: #fff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255,152,0,.35);
    border-color: #ff9800;
}

.ysp-definition-item.awaiting {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #ff9800;
    animation: awaitingPulse 1.5s ease-in-out infinite;
}

.ysp-definition-item.awaiting:hover {
    background: linear-gradient(135deg, #ffe0b2 0%, #ffcc80 100%);
}

/* Match feedback */
.ysp-term-item.correct-match,
.ysp-definition-item.correct-match {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%) !important;
    color: #fff !important;
    border-color: #4caf50 !important;
    animation: correctMatchPulse 0.6s ease-out;
}

.ysp-term-item.incorrect-match,
.ysp-definition-item.incorrect-match {
    background: linear-gradient(135deg, #f44336 0%, #e57373 100%) !important;
    color: #fff !important;
    border-color: #f44336 !important;
    animation: incorrectMatchShake 0.6s ease-out;
}

/* Temporary style while JS fades them; JS will then remove nodes */
.ysp-term-item.matched,
.ysp-definition-item.matched {
    opacity: 0.35;
    transform: scale(0.97);
    pointer-events: none;
    background: #f5f7fa !important;
    color: #8a8f98 !important;
    border-color: #d7dde5 !important;
}

/* Removal animation class (JS adds .ysp-vanish then removes on transitionend) */
.ysp-vanish {
    opacity: 0 !important;
    transform: scale(0.92) !important;
    transition: opacity .18s ease, transform .18s ease;
}

/* Progress chip */
.ysp-game-progress {
    font-weight: 600;
    color: #1565c0;
    background: rgba(21,101,192,.10);
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 14px;
}
/* Auto-Advance Set Celebration Overlay */
.ysp-set-celebration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.ysp-celebration-content {
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    color: white;
    padding: 40px 60px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease;
}

.ysp-celebration-content h3 {
    font-size: 32px;
    margin: 0 0 10px 0;
    font-weight: 700;
}

.ysp-celebration-content p {
    font-size: 18px;
    margin: 0;
    opacity: 0.9;
}
/* ==========================================
   FIX: Term Items Text Color
   ADD TO game-styles.css
   ========================================== */

/* The CSS had .ysp-term-item strong { color: #1a1a2e; } 
   but the JS doesn't wrap terms in <strong> tags,
   so we need to add color directly to .ysp-term-item */

.ysp-term-item {
    color: #1a1a2e !important;  /* Dark text color for readability */
}

/* Also ensure definition items have explicit color */
.ysp-definition-item {
    color: #4b5563 !important;  /* Medium gray for definitions */
}

/* Keep the existing rules for when items ARE in strong tags */
.ysp-term-item strong {
    color: #1a1a2e;
    font-weight: 600;
}

.ysp-definition-item strong {
    color: #4b5563;
}

/* When selected, terms should be white */
.ysp-term-item.selected {
    color: white !important;
}

.ysp-term-item.selected strong {
    color: white !important;
}

/* When paired (awaiting/hovering) */
.ysp-term-item.paired {
    color: #0c4a6e !important;
}

.ysp-term-item.paired strong {
    color: #0c4a6e !important;
}

/* When matched (correct) */
.ysp-term-item.correct-match,
.ysp-definition-item.correct-match {
    color: white !important;
}

/* When incorrect */
.ysp-term-item.incorrect-match,
.ysp-definition-item.incorrect-match {
    color: white !important;
}

/* When faded out (matched pairs) */
.ysp-term-item.matched,
.ysp-definition-item.matched {
    color: #8a8f98 !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Mobile responsive */
@media (max-width: 640px) {
    .ysp-celebration-content {
        padding: 30px 40px;
    }
    
    .ysp-celebration-content h3 {
        font-size: 24px;
    }
    
    .ysp-celebration-content p {
        font-size: 16px;
    }
}

/* Animations (unchanged) */
@keyframes awaitingPulse {
    0%, 100% { box-shadow: 0 2px 4px rgba(0,0,0,.08); border-color: #ff9800; }
    50%      { box-shadow: 0 4px 15px rgba(255,152,0,.28); border-color: #f57c00; }
}
@keyframes correctMatchPulse { 0%{transform:scale(1)} 50%{transform:scale(1.1)} 100%{transform:scale(1)} }
@keyframes incorrectMatchShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }

/* Responsive */
@media (max-width: 768px) {
    .ysp-matching-area { grid-template-columns: 1fr; gap: 8px; padding: 12px; }
    .ysp-definitions-section,
    .ysp-terms-section {
        border-radius: 8px;         /* restore when stacked */
        border-left: 1px solid #e5e7eb;
        border-right: 1px solid #e5e7eb;
    }
    .ysp-definitions-grid, .ysp-terms-grid { gap: 10px; }
    .ysp-definition-item, .ysp-term-item { padding: 12px; font-size: 15px; min-height: 50px; }
}

@media (max-width: 480px) {
    .ysp-definition-item, .ysp-term-item { padding: 10px; font-size: 14px; min-height: 46px; }
}

/* High contrast */
@media (prefers-contrast: high) {
    .ysp-definition-item, .ysp-term-item, .ysp-definitions-section, .ysp-terms-section { border-width: 3px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ysp-definition-item, .ysp-term-item { transition: none; animation: none; }
    .ysp-definition-item:hover, .ysp-term-item:hover { transform: none; }
    .ysp-term-item.selected { transform: none; }
}

/* ==========================================
   CLOZE TEST GAME STYLES
   ========================================== */

/* Cloze Game Container */
.ysp-cloze-dropdown { position: relative; display: inline-block; }
.ysp-cloze-gap { position: relative; z-index: 1; } /* stays above text line */
.ysp-cloze-options {
  display: none;
  position: absolute; top: 100%; left: 0;
  min-width: 160px; max-height: 220px; overflow-y: auto;
  background: #fff; border: 2px solid #ffc107; border-radius: 6px;
  box-shadow: 0 8px 25px rgba(0,0,0,.15); z-index: 9999;
}
.ysp-cloze-options.show { display: block; }
.ysp-cloze-option { display: block; padding: 10px 15px; cursor: pointer; }

.ysp-cloze-game {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Cloze Text Area */
.ysp-cloze-text-area {
    padding: 30px 25px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.ysp-cloze-text {
    font-size: 18px;
    line-height: 1.8;
    color: #2c3e50;
    text-align: justify;
}

/* Cloze Gaps - Dropdown Style */
.ysp-cloze-gap {
    display: inline-block;
    min-width: 120px;
    max-width: 200px;
    margin: 0 4px;
    padding: 6px 12px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    color: #856404;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    vertical-align: baseline;
}

.ysp-cloze-gap:hover {
    background: #fff3cd;
    border-color: #ff9800;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.ysp-cloze-gap:focus {
    outline: none;
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

/* Gap States */
.ysp-cloze-gap.correct {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #28a745;
    color: #155724;
    animation: correctPulse 0.6s ease-out;
}

.ysp-cloze-gap.incorrect {
    background: linear-gradient(135deg, #f8d7da 0%, #f1aeb5 100%);
    border-color: #dc3545;
    color: #721c24;
    animation: incorrectShake 0.6s ease-out;
}

.ysp-cloze-gap.completed {
    background: #e9ecef;
    border-color: #6c757d;
    color: #495057;
    cursor: default;
    opacity: 0.8;
}

.ysp-cloze-gap.retry-available {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
    cursor: pointer;
}

/* Input Mode Gaps */
.ysp-cloze-game.mode-input .ysp-cloze-gap {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    color: #495057;
    text-align: center;
    min-width: 100px;
}

.ysp-cloze-game.mode-input .ysp-cloze-gap:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 123, 186, 0.2);
}

/* Progress and Stats */
.ysp-cloze-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.ysp-cloze-stats {
    display: flex;
    gap: 25px;
    align-items: center;
}

.ysp-cloze-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ysp-cloze-stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #007cba;
}

.ysp-cloze-stat-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Controls */
.ysp-cloze-controls {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ysp-cloze-hint {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 15px 0;
    color: #0c5460;
    font-size: 14px;
    display: none;
}

.ysp-cloze-hint.show {
    display: block;
    animation: fadeInUp 0.4s ease-out;
}

/* Completion Screen */
.ysp-cloze-complete {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-radius: 12px;
    margin-top: 20px;
}

.ysp-cloze-complete h3 {
    font-size: 28px;
    margin: 0 0 15px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ysp-cloze-complete p {
    font-size: 18px;
    margin: 0 0 25px 0;
    opacity: 0.95;
}

.ysp-completion-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin: 25px 0;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.ysp-completion-stat {
    text-align: center;
}

.ysp-completion-stat-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.ysp-completion-stat-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dropdown Options */
.ysp-cloze-dropdown {
    position: relative;
    display: inline-block;
}

.ysp-cloze-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #ffc107;
    border-radius: 6px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.ysp-cloze-options.show {
    display: block;
    animation: dropdownSlide 0.2s ease-out;
}

.ysp-cloze-option {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: #495057;
}

.ysp-cloze-option:hover {
    background: #f8f9fa;
}

.ysp-cloze-option:last-child {
    border-bottom: none;
}

.ysp-cloze-option.selected {
    background: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
}

/* Feedback Messages */
.ysp-cloze-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ysp-cloze-feedback.show {
    transform: translateX(0);
}

.ysp-cloze-feedback.correct {
    background: #28a745;
}

.ysp-cloze-feedback.incorrect {
    background: #dc3545;
}

/* Animations */
@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ysp-cloze-text-area {
        padding: 20px 15px;
    }
    
    .ysp-cloze-text {
        font-size: 16px;
        line-height: 1.6;
    }
    
    .ysp-cloze-gap {
        min-width: 100px;
        max-width: 150px;
        padding: 8px 10px;
        font-size: 14px;
        margin: 2px;
    }
    
    .ysp-cloze-progress {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .ysp-cloze-stats {
        justify-content: center;
        gap: 20px;
    }
    
    .ysp-completion-breakdown {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .ysp-cloze-feedback {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        transform: translateY(-100%);
        text-align: center;
    }
    
    .ysp-cloze-feedback.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .ysp-cloze-text {
        font-size: 15px;
    }
    
    .ysp-cloze-gap {
        min-width: 80px;
        max-width: 120px;
        padding: 6px 8px;
        font-size: 13px;
    }
    
    .ysp-cloze-stats {
        gap: 15px;
    }
    
    .ysp-cloze-stat-value {
        font-size: 18px;
    }
    
    .ysp-completion-breakdown {
        grid-template-columns: 1fr;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ysp-cloze-gap {
        border-width: 3px;
    }
    
    .ysp-cloze-gap.correct {
        border-color: #000;
        background: #90EE90;
        color: #000;
    }
    
    .ysp-cloze-gap.incorrect {
        border-color: #000;
        background: #FFB6C1;
        color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ysp-cloze-gap,
    .ysp-cloze-option,
    .ysp-cloze-feedback {
        transition: none;
        animation: none;
    }
    
    .ysp-cloze-gap:hover {
        transform: none;
    }
}

/**
 * YSP Lexical Games - Sentence Builder CSS
 * Styles for scrambled sentence game
 */

/* ==========================================
   SENTENCE BUILDER GAME STYLES
   ========================================== */

/* Welcome Screen */
.ysp-welcome-screen {
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    color: white;
    border-radius: 12px;
}

.ysp-welcome-content h3 {
    font-size: 28px;
    margin: 0 0 15px 0;
}

.ysp-welcome-content p {
    font-size: 18px;
    margin-bottom: 20px;
}

.ysp-game-info {
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 10px;
    max-width: 600px;
    margin: 0 auto;
    text-align: left;
}

.ysp-game-info {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.ysp-game-info p {
    margin: 10px 0;
}

.ysp-game-info ul {
    margin: 10px 0;
    padding-left: 25px;
}

.ysp-game-info li {
    margin: 8px 0;
    font-size: 16px;
}

/* Sentence Builder Area - TEAL instead of white */
.ysp-sentence-builder-area {
    padding: 30px 20px;
    background: linear-gradient(135deg,rgb(74, 191, 215) 0%,rgb(41, 77, 78) 100%);   /* CHANGED from #ffffff */
}

/* Instruction Area - TEAL with white text */
.ysp-sentence-instruction {
    text-align: center;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.15);  /* CHANGED - semi-transparent white */
    border-radius: 8px;
    border-left: 4px solid white;  /* CHANGED from #2196f3 */
}

.ysp-sentence-instruction p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: white;  /* CHANGED from #1565c0 */
}

/* Building Area */
.ysp-building-area {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #dee2e6;
    transition: all 0.3s ease;
}

.ysp-building-area.correct-sentence {
    background: #d4edda;
    border-color: #28a745;
    animation: successPulse 0.6s ease-out;
}

.ysp-building-area.incorrect-sentence {
    background: #f8d7da;
    border-color: #dc3545;
    animation: errorShake 0.6s ease-out;
}

/* Building Slots */
.ysp-building-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    min-height: 60px;
    margin-bottom: 20px;
    padding: 10px;
}

.ysp-word-slot {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 500;
    min-width: 80px;
    text-align: center;
    transition: all 0.2s ease;
}

.ysp-word-slot.empty {
    background: #ffffff;
    border: 2px dashed #adb5bd;
    color: #6c757d;
    font-size: 20px;
}

.ysp-word-slot.filled {
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    color: white;
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ysp-word-slot.filled:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ysp-word-slot.hint-word {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    border: 2px solid #ff9800;
    color: #212529;
    font-weight: 600;
    cursor: default;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.35);
}

.ysp-word-slot.hint-word:hover {
    transform: none;
}

.ysp-word-slot.hint-slot,
.ysp-word-slot.empty.hint-slot {
    background: #fff3cd;
    border: 2px dashed #ffc107;
    animation: hintSlotPulse 2s ease-in-out infinite;
}

.ysp-punctuation {
    font-size: 24px;
    font-weight: bold;
    color: #495057;
    margin-left: 2px;
}

@keyframes hintSlotPulse {
    0%, 100% {
        border-color: #ffc107;
    }
    50% {
        border-color: #ff9800;
    }
}

/* Check Button Container */
.ysp-check-container {
    text-align: center;
    margin-top: 15px;
}

.ysp-check-sentence {
    font-size: 16px;
    padding: 12px 30px;
}

.ysp-check-sentence:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Word Pool */
.ysp-word-pool {
    padding: 25px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #dee2e6;
}

.ysp-pool-header {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    color: #495057;
}

.ysp-word-pool-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.ysp-pool-word {
    display: inline-block;
    padding: 12px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    font-size: 16px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    user-select: none;
}

.ysp-pool-word:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.ysp-pool-word:active {
    transform: translateY(0) scale(0.98);
}

/* Sentence progress badge */
.ysp-sentence-progress {
    background: rgba(0, 0, 0, 0.25);   /* darker pill for contrast */
    color: #ffffff;                  /* force white text */
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Game Over / Complete Screens */
.ysp-game-over,
.ysp-game-complete {
    text-align: center;
    padding: 40px 20px;
}

.ysp-game-over {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.ysp-game-complete {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.ysp-game-over h3,
.ysp-game-complete h3 {
    font-size: 32px;
    margin: 0 0 15px 0;
}

.ysp-game-over p,
.ysp-game-complete p {
    font-size: 18px;
    margin: 10px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ysp-sentence-builder-area {
        padding: 20px 15px;
    }

    .ysp-building-area {
        padding: 20px 15px;
    }

    .ysp-building-slots {
        gap: 8px;
    }

    .ysp-word-slot {
        padding: 10px 16px;
        font-size: 16px;
        min-width: 70px;
    }

    .ysp-pool-word {
        padding: 10px 16px;
        font-size: 15px;
    }

    .ysp-word-pool-grid {
        gap: 10px;
    }

    .ysp-sentence-instruction p {
        font-size: 14px;
    }

    .ysp-welcome-content h3 {
        font-size: 24px;
    }

    .ysp-game-info {
        padding: 15px;
    }

    .ysp-game-info li {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .ysp-building-slots {
        gap: 6px;
    }

    .ysp-word-slot {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 60px;
    }

    .ysp-pool-word {
        padding: 8px 14px;
        font-size: 14px;
    }

    .ysp-word-pool-grid {
        gap: 8px;
    }

    .ysp-punctuation {
        font-size: 20px;
    }
}

/* Touch Improvements */
@media (hover: none) and (pointer: coarse) {
    .ysp-pool-word {
        padding: 14px 22px;
        font-size: 16px;
        min-height: 44px;
    }

    .ysp-word-slot.filled {
        min-height: 44px;
    }

    .ysp-check-sentence {
        padding: 14px 32px;
        font-size: 18px;
        min-height: 44px;
    }
}

/* Animations */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ysp-word-slot.empty {
        border-width: 3px;
    }

    .ysp-word-slot.filled,
    .ysp-pool-word {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ysp-building-area,
    .ysp-word-slot,
    .ysp-pool-word {
        transition: none;
        animation: none;
    }

    .ysp-word-slot:hover,
    .ysp-pool-word:hover {
        transform: none;
    }
}

/* Ultra-small screens (phones in portrait) */
@media (max-width: 420px) {
  .ysp-word-slot {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 52px;
  }

  .ysp-pool-word {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 20px;
  }

  .ysp-building-slots {
    gap: 4px;
  }

  .ysp-word-pool-grid {
    gap: 6px;
  }

  .ysp-sentence-instruction p {
    font-size: 13px;
  }

  /* Optional: slightly smaller punctuation & reduce vertical spacing */
  .ysp-punctuation {
    font-size: 18px;
  }

  .ysp-building-area,
  .ysp-word-pool {
    padding: 15px 10px;
  }
}


/* ==================== PROGRESSIVE HINTS STYLES ==================== */

/* Hint Message - Light teal */
.ysp-sentence-instruction .hint-message {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.25);  /* CHANGED - more visible white overlay */
    color: white;  /* CHANGED from dark */
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);  /* CHANGED shadow */
    animation: hintPulse 0.5s ease-in-out;
    border: 2px solid white;  /* ADDED for definition */
}

@keyframes hintPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.ysp-correct-sentence-reveal {
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    border-radius: 12px;
    padding: 30px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 95, 115, 0.3);
    animation: slideInReveal 0.5s ease-out;
}

@keyframes slideInReveal {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ysp-correct-sentence-reveal .reveal-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ysp-correct-sentence-reveal .reveal-sentence {
    background: white;
    color: #000;
    padding: 20px 30px;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.6;
    margin: 0 0 20px 0;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.3px;
}

/* Force reveal sentence text to be readable */
.ysp-correct-sentence-reveal p.reveal-sentence{
  color: #000 !important;
  opacity: 1 !important;
}

.ysp-correct-sentence-reveal .ysp-next-sentence {
    background: white;
    color: #005f73;
    border: 2px solid white;
    font-weight: 600;
    padding: 12px 32px;
    font-size: 16px;
}

.ysp-correct-sentence-reveal .ysp-next-sentence:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ysp-completion-note {
    margin-top: 15px;
    padding: 10px 15px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    font-size: 14px;
    color: #856404;
}
/* Compact sentence builder until Start */
.ysp-sentence-builder-game.ysp-sb-collapsed .ysp-welcome-screen,
.ysp-sentence-builder-game.ysp-sb-collapsed .ysp-sentence-builder-area {
  display: none !important;
}



/**
 * Enhanced Recap Match Game Styles - UPDATED
 * Added: "paired" state for matches before checking
 * 
 * Author: Jonathan Boydell - YouSpeakPlus.com
 */

/* ==================== GAME CONTAINER ==================== */
.ysp-recap-match-game-enhanced {
  max-width: 1000px;
  margin: 40px auto;
  padding: 30px;
  background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.ysp-recap-header {
  text-align: center;
  margin-bottom: 30px;
}

.ysp-recap-header h2 {
  font-size: 28px;
  color: #1a1a2e;
  margin-bottom: 10px;
}

.ysp-recap-header p {
  color: #666;
  font-size: 16px;
  margin-bottom: 15px;
}

.ysp-game-progress {
  display: inline-block;
  background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
}

/* ==================== MATCHING INTERFACE ==================== */
.ysp-matching-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.ysp-terms-column h3,
.ysp-definitions-column h3 {
  font-size: 18px;
  color: #1a1a2e;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e5e7eb;
}

.ysp-terms-list,
.ysp-definitions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Match Items */
.ysp-match-item {
  padding: 16px 20px;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 15px;
  line-height: 1.5;
}

.ysp-match-item:hover:not(.checked):not(.paired) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: #667eea;
}

/* Term Items */
.ysp-term-item strong {
  color: #1a1a2e;
  font-weight: 600;
}

/* SELECTED state (when clicking to match) */
.ysp-term-item.selected {
  background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
  color: white;
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

.ysp-term-item.selected strong {
  color: white;
}

/* PAIRED state (matched but not yet checked) - NEUTRAL */
.ysp-match-item.paired {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #0ea5e9;
  color: #0c4a6e;
}

.ysp-term-item.paired strong {
  color: #0c4a6e;
}

.ysp-match-item.paired:hover {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  cursor: pointer;
}

/* Definition Items */
.ysp-definition-item {
  color: #4b5563;
}

/* CORRECT Match (only shown after checking) */
.ysp-match-item.correct-match {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: white !important;
  border-color: #10b981 !important;
  animation: correctPulse 0.6s ease-out;
}

/* INCORRECT Match (only shown after checking) */
.ysp-match-item.incorrect-match {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: white !important;
  border-color: #ef4444 !important;
  animation: incorrectShake 0.5s ease-out;
}

/* UNMATCHED terms (not paired when checking) */
.ysp-match-item.unmatched-term {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
  opacity: 0.7;
}

/* Checked items (can't interact anymore) */
.ysp-match-item.checked {
  pointer-events: none;
}

/* Animations */
@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* ==================== GAME CONTROLS ==================== */
/* Controls Bar - TEAL instead of grey */
.ysp-game-controls {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg,rgb(74, 191, 215) 0%,rgb(41, 77, 78) 100%);   /* CHANGED from #f8f9fa */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);  /* CHANGED from #e9ecef */
}

.ysp-btn {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0 10px;
}

.ysp-check-btn {
  background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.ysp-check-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102,126,234,0.5);
}

.ysp-check-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ysp-reset-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(245,158,11,0.4);
}

.ysp-reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245,158,11,0.5);
}

/* ==================== RESULTS DISPLAY ==================== */
.ysp-results-summary {
  text-align: center;
  padding: 20px;
  background: white;
  border-radius: 12px;
  margin: 20px 0;
}

.ysp-score {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 15px;
}

.ysp-score span {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
}

.correct-score {
  background: #d1fae5;
  color: #065f46;
}

.wrong-score {
  background: #fee2e2;
  color: #991b1b;
}

.ysp-feedback-message {
  color: #666;
  font-size: 16px;
  margin-top: 15px;
}

/* ==================== ALL CORRECT DISPLAY ==================== */
.ysp-all-correct-container {
  text-align: center;
  padding: 40px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 12px;
  margin: 20px 0;
}

.ysp-success-message {
  margin-bottom: 20px;
}

.ysp-trophy {
  font-size: 64px;
  display: block;
  margin-bottom: 20px;
  animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.ysp-success-message h3 {
  font-size: 28px;
  color: #78350f;
  margin-bottom: 10px;
}

.ysp-success-message p {
  font-size: 16px;
  color: #92400e;
}

.ysp-show-sources-btn {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  color: white;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(8,145,178,0.4);
  transition: all 0.3s ease;
}

.ysp-show-sources-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(8,145,178,0.5);
}

/* ==================== SCENARIO CARDS ==================== */
.ysp-scenario-cards-container {
  margin: 30px 0;
}

.ysp-scenario-cards-container h3 {
  text-align: center;
  font-size: 24px;
  color: #1a1a2e;
  margin-bottom: 20px;
}

.ysp-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Individual Scenario Card */
.ysp-scenario-card {
  background: white;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ysp-scenario-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-color: #667eea;
}

.ysp-card-link {
  display: block;
  padding: 20px;
  text-decoration: none;
  color: inherit;
}

.ysp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.ysp-card-header h4 {
  flex: 1;
  font-size: 18px;
  color: #f3f4f6;
  margin: 0;
  line-height: 1.4;
}

.ysp-cefr-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 10px;
  white-space: nowrap;
}

.ysp-card-description {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 15px;
}

.ysp-card-meta {
  margin-bottom: 15px;
}

.ysp-episode-count {
  display: inline-block;
  background: #f3f4f6;
  color: #374151;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.ysp-card-action {
  padding-top: 15px;
  border-top: 1px solid #e5e7eb;
}

.ysp-explore-btn {
  color: #667eea;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
}

.ysp-scenario-card:hover .ysp-explore-btn {
  color: #764ba2;
  transform: translateX(4px);
}

/* ==================== SCENARIO CARD STATUS BORDERS ==================== */

/* Correct match - Green border */
.ysp-scenario-card.ysp-card-correct {
    border: 3px solid #10b981 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.ysp-scenario-card.ysp-card-correct:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    border-color: #059669 !important;
}

/* Incorrect match - Red border */
.ysp-scenario-card.ysp-card-incorrect {
    border: 3px solid #ef4444 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.ysp-scenario-card.ysp-card-incorrect:hover {
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
    border-color: #dc2626 !important;
}

/* ==================== TERM BADGE ON CARDS ==================== */

.ysp-card-term-container {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ysp-card-term-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Correct term badge - Green */
.ysp-card-term-badge.ysp-term-badge-correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #10b981;
}

/* Incorrect term badge - Red */
.ysp-card-term-badge.ysp-term-badge-incorrect {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* ==================== UPDATED RESULTS FEEDBACK ==================== */

/* Legend hint in results */
.ysp-feedback-message p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Optional: Add visual legend */
.ysp-results-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
}

.ysp-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4b5563;
}

.ysp-legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.ysp-legend-dot.correct {
    background: #10b981;
}

.ysp-legend-dot.incorrect {
    background: #ef4444;
}

/* ==================== CARD HEADER ADJUSTMENTS ==================== */

/* Ensure card header accommodates term badge */
.ysp-scenario-card .ysp-card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.ysp-scenario-card .ysp-card-header h4 {
    margin-top: 0;
}

/* ==================== SUBTLE BACKGROUND TINT (OPTIONAL) ==================== */
/* Uncomment these if you want a subtle background color as well */

/*
.ysp-scenario-card.ysp-card-correct {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.ysp-scenario-card.ysp-card-incorrect {
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}
*/

/* ==================== MOBILE RESPONSIVE ==================== */

@media (max-width: 768px) {
    .ysp-card-term-badge {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .ysp-card-term-container {
        margin-bottom: 10px;
    }
    
    .ysp-scenario-card.ysp-card-correct,
    .ysp-scenario-card.ysp-card-incorrect {
        border-width: 2px !important;
    }
}

/* ==================== ANIMATION ON CARD LOAD ==================== */

.ysp-scenario-card {
    animation: cardFadeIn 0.4s ease-out;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for multiple cards */
.ysp-cards-grid .ysp-scenario-card:nth-child(1) { animation-delay: 0s; }
.ysp-cards-grid .ysp-scenario-card:nth-child(2) { animation-delay: 0.1s; }
.ysp-cards-grid .ysp-scenario-card:nth-child(3) { animation-delay: 0.2s; }
.ysp-cards-grid .ysp-scenario-card:nth-child(4) { animation-delay: 0.3s; }
.ysp-cards-grid .ysp-scenario-card:nth-child(5) { animation-delay: 0.4s; }

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
  .ysp-recap-match-game-enhanced {
      padding: 20px;
      margin: 20px auto;
  }

  .ysp-matching-container {
      grid-template-columns: 1fr;
      padding: 15px;
  }

  .ysp-recap-header h2 {
      font-size: 22px;
  }

  .ysp-match-item {
      padding: 14px 16px;
      font-size: 14px;
  }

  .ysp-btn {
      padding: 12px 24px;
      font-size: 14px;
      margin: 5px;
      display: block;
      width: 100%;
  }

  .ysp-cards-grid {
      grid-template-columns: 1fr;
  }

  .ysp-score {
      flex-direction: column;
      gap: 10px;
  }
}









/**
 * Enhanced Recap Match Game Styles - UPDATED
 * Added: "paired" state for matches before checking
 * 
 * Author: Jonathan Boydell - YouSpeakPlus.com
 */

/* ==================== GAME CONTAINER ==================== */
.ysp-recap-match-game-enhanced {
  max-width: 1000px;
  margin: 40px auto;
  padding: 30px;
  background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.ysp-recap-header {
  text-align: center;
  margin-bottom: 30px;
}

.ysp-recap-header h2 {
  font-size: 28px;
  color: #1a1a2e;
  margin-bottom: 10px;
}

.ysp-recap-header p {
  color: #666;
  font-size: 16px;
  margin-bottom: 15px;
}

.ysp-game-progress {
  display: inline-block;
  background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
}

/* ==================== MATCHING INTERFACE ==================== */
.ysp-matching-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
  padding: 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.ysp-terms-column h3,
.ysp-definitions-column h3 {
  font-size: 18px;
  color: #1a1a2e;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e5e7eb;
}

.ysp-terms-list,
.ysp-definitions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Match Items */
.ysp-match-item {
  padding: 16px 20px;
  border-radius: 10px;
  border: 2px solid #e5e7eb;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 15px;
  line-height: 1.5;
}

.ysp-match-item:hover:not(.checked):not(.paired) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-color: #667eea;
}

/* Term Items */
.ysp-term-item strong {
  color: #1a1a2e;
  font-weight: 600;
}

/* SELECTED state (when clicking to match) */
.ysp-term-item.selected {
  background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
  color: white;
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102,126,234,0.3);
}

.ysp-term-item.selected strong {
  color: white;
}

/* PAIRED state (matched but not yet checked) - NEUTRAL */
.ysp-match-item.paired {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #0ea5e9;
  color: #0c4a6e;
}

.ysp-term-item.paired strong {
  color: #0c4a6e;
}

.ysp-match-item.paired:hover {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  cursor: pointer;
}

/* Definition Items */
.ysp-definition-item {
  color: #4b5563;
}

/* CORRECT Match (only shown after checking) */
.ysp-match-item.correct-match {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: white !important;
  border-color: #10b981 !important;
  animation: correctPulse 0.6s ease-out;
}

/* INCORRECT Match (only shown after checking) */
.ysp-match-item.incorrect-match {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  color: white !important;
  border-color: #ef4444 !important;
  animation: incorrectShake 0.5s ease-out;
}

/* UNMATCHED terms (not paired when checking) */
.ysp-match-item.unmatched-term {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
  opacity: 0.7;
}

/* Checked items (can't interact anymore) */
.ysp-match-item.checked {
  pointer-events: none;
}

/* Animations */
@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* ==================== GAME CONTROLS ==================== */
.ysp-game-controls {
  text-align: center;
  margin: 30px 0;
}

.ysp-btn {
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0 10px;
}

.ysp-check-btn {
  background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.ysp-check-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102,126,234,0.5);
}

.ysp-check-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ysp-reset-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(245,158,11,0.4);
}

.ysp-reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245,158,11,0.5);
}

/* ==================== RESULTS DISPLAY ==================== */
.ysp-results-summary {
  text-align: center;
  padding: 20px;
  background: white;
  border-radius: 12px;
  margin: 20px 0;
}

.ysp-score {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 15px;
}

.ysp-score span {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
}

.correct-score {
  background: #d1fae5;
  color: #065f46;
}

.wrong-score {
  background: #fee2e2;
  color: #991b1b;
}

.ysp-feedback-message {
  color: #666;
  font-size: 16px;
  margin-top: 15px;
}

/* ==================== ALL CORRECT DISPLAY ==================== */
.ysp-all-correct-container {
  text-align: center;
  padding: 40px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 12px;
  margin: 20px 0;
}

.ysp-success-message {
  margin-bottom: 20px;
}

.ysp-trophy {
  font-size: 64px;
  display: block;
  margin-bottom: 20px;
  animation: trophyBounce 1s ease-in-out infinite;
}

@keyframes trophyBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.ysp-success-message h3 {
  font-size: 28px;
  color: #78350f;
  margin-bottom: 10px;
}

.ysp-success-message p {
  font-size: 16px;
  color: #92400e;
}

.ysp-show-sources-btn {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  color: white;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(8,145,178,0.4);
  transition: all 0.3s ease;
}

.ysp-show-sources-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(8,145,178,0.5);
}

/* ==================== SCENARIO CARDS ==================== */
.ysp-scenario-cards-container {
  margin: 30px 0;
}

.ysp-scenario-cards-container h3 {
  text-align: center;
  font-size: 24px;
  color: #1a1a2e;
  margin-bottom: 20px;
}

.ysp-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Individual Scenario Card */
.ysp-scenario-card {
  background: white;
  border-radius: 12px;
  border: 2px solid #e5e7eb;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.ysp-scenario-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-color: #667eea;
}

.ysp-card-link {
  display: block;
  padding: 20px;
  text-decoration: none;
  color: inherit;
}

.ysp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.ysp-card-header h4 {
  flex: 1;
  font-size: 18px;
  color: #f3f4f6;
  margin: 0;
  line-height: 1.4;
}

.ysp-cefr-badge {
  background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 10px;
  white-space: nowrap;
}

.ysp-card-description {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 15px;
}

.ysp-card-meta {
  margin-bottom: 15px;
}

.ysp-episode-count {
  display: inline-block;
  background: #f3f4f6;
  color: #374151;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.ysp-card-action {
  padding-top: 15px;
  border-top: 1px solid #e5e7eb;
}

.ysp-explore-btn {
  color: #667eea;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
}

.ysp-scenario-card:hover .ysp-explore-btn {
  color: #764ba2;
  transform: translateX(4px);
}

/* ==================== SCENARIO CARD STATUS BORDERS ==================== */

/* Correct match - Green border */
.ysp-scenario-card.ysp-card-correct {
    border: 3px solid #10b981 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.ysp-scenario-card.ysp-card-correct:hover {
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
    border-color: #059669 !important;
}

/* Incorrect match - Red border */
.ysp-scenario-card.ysp-card-incorrect {
    border: 3px solid #ef4444 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.ysp-scenario-card.ysp-card-incorrect:hover {
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
    border-color: #dc2626 !important;
}

/* ==================== TERM BADGE ON CARDS ==================== */

.ysp-card-term-container {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ysp-card-term-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Correct term badge - Green */
.ysp-card-term-badge.ysp-term-badge-correct {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #10b981;
}

/* Incorrect term badge - Red */
.ysp-card-term-badge.ysp-term-badge-incorrect {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* ==================== UPDATED RESULTS FEEDBACK ==================== */

/* Legend hint in results */
.ysp-feedback-message p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Optional: Add visual legend */
.ysp-results-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 8px;
}

.ysp-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4b5563;
}

.ysp-legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.ysp-legend-dot.correct {
    background: #10b981;
}

.ysp-legend-dot.incorrect {
    background: #ef4444;
}

/* ==================== CARD HEADER ADJUSTMENTS ==================== */

/* Ensure card header accommodates term badge */
.ysp-scenario-card .ysp-card-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.ysp-scenario-card .ysp-card-header h4 {
    margin-top: 0;
}

/* ==================== SUBTLE BACKGROUND TINT (OPTIONAL) ==================== */
/* Uncomment these if you want a subtle background color as well */

/*
.ysp-scenario-card.ysp-card-correct {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.ysp-scenario-card.ysp-card-incorrect {
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}
*/

/* ==================== MOBILE RESPONSIVE ==================== */

@media (max-width: 768px) {
    .ysp-card-term-badge {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .ysp-card-term-container {
        margin-bottom: 10px;
    }
    
    .ysp-scenario-card.ysp-card-correct,
    .ysp-scenario-card.ysp-card-incorrect {
        border-width: 2px !important;
    }
}

/* ==================== ANIMATION ON CARD LOAD ==================== */

.ysp-scenario-card {
    animation: cardFadeIn 0.4s ease-out;
}

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for multiple cards */
.ysp-cards-grid .ysp-scenario-card:nth-child(1) { animation-delay: 0s; }
.ysp-cards-grid .ysp-scenario-card:nth-child(2) { animation-delay: 0.1s; }
.ysp-cards-grid .ysp-scenario-card:nth-child(3) { animation-delay: 0.2s; }
.ysp-cards-grid .ysp-scenario-card:nth-child(4) { animation-delay: 0.3s; }
.ysp-cards-grid .ysp-scenario-card:nth-child(5) { animation-delay: 0.4s; }

/* ==================== RESPONSIVE DESIGN ==================== */
@media (max-width: 768px) {
  .ysp-recap-match-game-enhanced {
      padding: 20px;
      margin: 20px auto;
  }

  .ysp-matching-container {
      grid-template-columns: 1fr;
      padding: 15px;
  }

  .ysp-recap-header h2 {
      font-size: 22px;
  }

  .ysp-match-item {
      padding: 14px 16px;
      font-size: 14px;
  }

  .ysp-btn {
      padding: 12px 24px;
      font-size: 14px;
      margin: 5px;
      display: block;
      width: 100%;
  }

  .ysp-cards-grid {
      grid-template-columns: 1fr;
  }

  .ysp-score {
      flex-direction: column;
      gap: 10px;
  }
}
/* ============================================
   MEMBER-ONLY NOTICE PANEL
   ============================================ */

.ysp-member-only-notice.ysp-game-locked {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 40px;
    margin: 30px 0;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.ysp-member-only-notice .notice-content {
    position: relative;
}

/* Lock Icon */
.ysp-member-only-notice .lock-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.7;
    filter: grayscale(30%);
}

/* Heading */
.ysp-member-only-notice h3 {
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 15px 0;
    line-height: 1.3;
}

/* Paragraphs */
.ysp-member-only-notice p {
    color: #495057;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.ysp-member-only-notice p:last-of-type {
    margin-bottom: 25px;
}

.ysp-member-only-notice p strong {
    color: #2c3e50;
    font-weight: 600;
}

/* CTA Button */
.ysp-member-only-notice .ysp-cta-button {
    display: inline-block;
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    color: #ffffff !important;
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border: none;
    cursor: pointer;
}

.ysp-member-only-notice .ysp-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    text-decoration: none;
}

.ysp-member-only-notice .ysp-cta-button:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .ysp-member-only-notice.ysp-game-locked {
        padding: 30px 20px;
        margin: 20px 10px;
    }
    
    .ysp-member-only-notice .lock-icon {
        font-size: 36px;
        margin-bottom: 15px;
    }
    
    .ysp-member-only-notice h3 {
        font-size: 20px;
    }
    
    .ysp-member-only-notice p {
        font-size: 15px;
    }
    
    .ysp-member-only-notice .ysp-cta-button {
        padding: 12px 24px;
        font-size: 15px;
        width: 100%;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .ysp-member-only-notice.ysp-game-locked {
        padding: 25px 15px;
    }
    
    .ysp-member-only-notice h3 {
        font-size: 18px;
    }
    
    .ysp-member-only-notice p {
        font-size: 14px;
    }
}

/* ============================================
   ALTERNATIVE COLOR SCHEMES (OPTIONAL)
   ============================================ */

/* Gold/Premium Theme */
.ysp-member-only-notice.ysp-game-locked.theme-gold {
    background: linear-gradient(135deg, #fff5e6 0%, #ffe8cc 100%);
    border-color: #ffd699;
}

.ysp-member-only-notice.theme-gold .ysp-cta-button {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.ysp-member-only-notice.theme-gold .ysp-cta-button:hover {
    background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
    box-shadow: 0 6px 16px rgba(243, 156, 18, 0.4);
}

/* Blue/Professional Theme */
.ysp-member-only-notice.ysp-game-locked.theme-blue {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #90caf9;
}

.ysp-member-only-notice.theme-blue .ysp-cta-button {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.ysp-member-only-notice.theme-blue .ysp-cta-button:hover {
    background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%);
    box-shadow: 0 6px 16px rgba(33, 150, 243, 0.4);
}

/* Green/Success Theme */
.ysp-member-only-notice.ysp-game-locked.theme-green {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-color: #a5d6a7;
}

.ysp-member-only-notice.theme-green .ysp-cta-button {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.ysp-member-only-notice.theme-green .ysp-cta-button:hover {
    background: linear-gradient(135deg, #388e3c 0%, #4caf50 100%);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

/* ============================================
   DARK MODE SUPPORT (OPTIONAL)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .ysp-member-only-notice.ysp-game-locked {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
        border-color: #4a5568;
    }
    
    .ysp-member-only-notice h3 {
        color: #e2e8f0;
    }
    
    .ysp-member-only-notice p {
        color: #cbd5e0;
    }
    
    .ysp-member-only-notice p strong {
        color: #e2e8f0;
    }
    
    .ysp-member-only-notice .lock-icon {
        opacity: 0.9;
    }
}

/* ============================================
   ANIMATION (OPTIONAL)
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ysp-member-only-notice.ysp-game-locked {
    animation: fadeInUp 0.5s ease-out;
}

.ysp-member-only-notice .lock-icon {
    animation: fadeInUp 0.5s ease-out 0.1s both;
}

.ysp-member-only-notice h3 {
    animation: fadeInUp 0.5s ease-out 0.2s both;
}

.ysp-member-only-notice p {
    animation: fadeInUp 0.5s ease-out 0.3s both;
}

.ysp-member-only-notice .ysp-cta-button {
    animation: fadeInUp 0.5s ease-out 0.4s both;
}




/**
 * GAME STATS PANELS - CSS STYLES
 * 
 * Add this to: game-styles.css (or your main CSS file)
 * 
 * This provides styling for the game history stats panels that appear
 * beneath cloze and sentence builder games.
 */

/* ============================================================
   GAME STATS PANEL - MAIN CONTAINER
   ============================================================ */

.ysp-game-stats-panel {
    margin: 25px 0;
    border: 1px solid rgba(10, 147, 150, 0.2);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 95, 115, 0.1);
    overflow: hidden;
}

/* ============================================================
   STATS PANEL HEADER (Clickable)
   ============================================================ */

.stats-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(135deg, #005f73 0%, #0A9396 100%);
    color: white;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.stats-panel-header:hover {
    background: linear-gradient(135deg, #004d5c 0%, #088488 100%);
}

.stats-panel-header:focus {
    outline: 2px solid #0A9396;
    outline-offset: 2px;
}

.stats-icon {
    font-size: 22px;
    line-height: 1;
}

.stats-title {
    font-weight: 600;
    font-size: 16px;
    color: white;
    flex: 1;
    letter-spacing: 0.3px;
}

.stats-count {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 500;
}

.stats-toggle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    transition: transform 0.3s ease;
    margin-left: 8px;
}

.stats-panel-header.expanded .stats-toggle {
    transform: rotate(180deg);
}

/* ============================================================
   STATS PANEL CONTENT (Session History)
   ============================================================ */

.stats-panel-content {
    padding: 0;
    background: #f8fcfd;
}

.stats-session-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    margin: 0;
    background: white;
    border-bottom: 1px solid rgba(10, 147, 150, 0.1);
    font-size: 14px;
    transition: background 0.2s ease;
}

.stats-session-row:hover {
    background: rgba(10, 147, 150, 0.03);
}

.stats-session-row:last-child {
    border-bottom: none;
}

/* ============================================================
   SESSION ROW ELEMENTS
   ============================================================ */

/* Date Column */
.session-date {
    min-width: 130px;
    font-weight: 600;
    color: #005f73;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.session-time {
    font-size: 12px;
    color: #6b7280;
    font-weight: 400;
}

/* Score Column */
.session-score {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 100px;
}

.score-numbers {
    font-weight: 700;
    font-size: 15px;
    color: #1f2937;
}

.score-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* Percentage Badge */
.session-percentage {
    min-width: 70px;
}

.percentage-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
    text-align: center;
}

.badge-excellent {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #166534;
}

.badge-good {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.badge-fair {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.badge-needs-practice {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

/* Stars Display */
.session-stars {
    font-size: 16px;
    letter-spacing: 3px;
    line-height: 1;
    min-width: 80px;
}

/* Time Spent */
.session-time-spent {
    margin-left: auto;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

/* ============================================================
   RESPONSIVE DESIGN - MOBILE
   ============================================================ */

@media (max-width: 768px) {
    .stats-panel-header {
        padding: 14px 16px;
        gap: 8px;
    }
    
    .stats-title {
        font-size: 15px;
    }
    
    .stats-count {
        font-size: 13px;
    }
    
    .stats-session-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 16px;
    }
    
    .session-date {
        width: 100%;
        border-bottom: 1px solid rgba(10, 147, 150, 0.15);
        padding-bottom: 10px;
        margin-bottom: 4px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .session-time {
        font-size: 11px;
    }
    
    .session-score,
    .session-percentage,
    .session-stars {
        min-width: auto;
    }
    
    .session-time-spent {
        margin-left: 0;
        width: 100%;
        text-align: right;
    }
}

/* ============================================================
   RESPONSIVE DESIGN - TABLET
   ============================================================ */

@media (max-width: 1024px) and (min-width: 769px) {
    .stats-session-row {
        gap: 12px;
        padding: 12px 16px;
    }
    
    .session-stars {
        letter-spacing: 2px;
        font-size: 15px;
    }
}

/* ============================================================
   DARK MODE SUPPORT (Optional)
   ============================================================ */

@media (prefers-color-scheme: dark) {
    .ysp-game-stats-panel {
        background: #1f2937;
        border-color: rgba(10, 147, 150, 0.3);
    }
    
    .stats-panel-content {
        background: #111827;
    }
    
    .stats-session-row {
        background: #1f2937;
        border-bottom-color: rgba(10, 147, 150, 0.2);
    }
    
    .stats-session-row:hover {
        background: rgba(10, 147, 150, 0.1);
    }
    
    .session-date {
        color: #0A9396;
    }
    
    .score-numbers {
        color: #f9fafb;
    }
}

/* ============================================================
   ANIMATION - EXPAND/COLLAPSE
   ============================================================ */

.stats-panel-content {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
}

.stats-panel-content.expanded {
    max-height: 2000px; /* Large enough for 10 session entries */
}

/* ============================================================
   LOADING STATE (Optional Enhancement)
   ============================================================ */

.stats-panel-loading {
    padding: 20px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

/* ============================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================ */

.stats-panel-header:focus-visible {
    outline: 3px solid #0A9396;
    outline-offset: 2px;
}

/* Ensure good contrast for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .ysp-game-stats-panel {
        page-break-inside: avoid;
        box-shadow: none;
    }
    
    .stats-panel-header {
        background: #005f73 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .stats-toggle {
        display: none;
    }
    
    .stats-panel-content {
        display: block !important;
        max-height: none !important;
    }
}
/* Session details toggle button */
.session-details-toggle {
    grid-column: 1 / -1;
    margin-top: 8px;
}

.ysp-details-btn {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.ysp-details-btn:hover {
    color: #005177;
    background: #f0f0f1;
    border-radius: 3px;
}

.ysp-details-btn .toggle-icon {
    display: inline-block;
    transition: transform 0.2s;
}

.ysp-details-btn[aria-expanded="true"] .toggle-icon {
    transform: rotate(90deg);
}

/* Session details content */
.session-details-content {
    grid-column: 1 / -1;
    margin-top: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #0073aa;
}

/* Details grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.detail-item.warning {
    border-color: #ff9800;
    background: #fff3e0;
}

.detail-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 2px;
}

.detail-item.warning .detail-value {
    color: #f57c00;
}

.detail-label {
    font-size: 11px;
    color: #666;
    text-align: center;
}

/* Detail note */
.detail-note {
    padding: 10px 12px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    font-size: 13px;
    color: #856404;
    display: flex;
    align-items: center;
    gap: 6px;
}

.note-icon {
    font-size: 16px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .detail-item {
        padding: 8px;
    }
    
    .detail-icon {
        font-size: 18px;
    }
    
    .detail-value {
        font-size: 16px;
    }
    
    .detail-label {
        font-size: 10px;
    }
}
