/* Trakaido CSS */
/* based on atacama "widget tools" CSS; but no longer kept in sync */

/* === CORE LAYOUT COMPONENTS === */

/* Main widget container - responsive by default */
.w-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-large);
    min-height: 100vh;
    background: var(--color-background);
    color: var(--color-text);
}

/* Fullscreen mode */
.w-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    padding: var(--spacing-base);
}

/* === RESPONSIVE LAYOUT SYSTEM === */

/* Two-column layout for desktop, stacked for mobile */
.w-layout-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-large);
}

/* Desktop: content on left, sidebar on right */
@media screen and (min-width: 1024px) {
    .w-layout-main {
        grid-template-columns: 2fr 1fr;
    }
}

/* Landscape mobile/tablet: content on left, controls on right */
@media screen and (min-width: 768px) and (orientation: landscape) {
    .w-layout-main {
        grid-template-columns: 2fr 1fr;
        height: 100vh;
    }
    
    .w-layout-content {
        overflow-y: auto;
    }
    
    .w-layout-sidebar {
        overflow-y: auto;
    }
}

/* === ESSENTIAL WIDGET COMPONENTS === */

/* Card container for main content */
.w-card {
    background: var(--color-card-bg);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-large);
    box-shadow: var(--box-shadow);
    transition: all 0.2s ease;
}

.w-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Interactive card (clickable) */
.w-card-interactive {
    cursor: pointer;
}

.w-card-interactive:hover {
    border-color: var(--color-primary);
}

/* === BUTTON SYSTEM === */

/* Base button - all buttons should use this */
.w-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: var(--spacing-base) var(--spacing-large);
    font-size: inherit;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    background-color: var(--color-primary);
    color: white;
}

.w-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.w-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Button variants */
.w-button-secondary {
    background: var(--color-background);
    color: var(--color-text);
    border: 2px solid var(--color-border);
}

.w-button-secondary:hover {
    background: var(--color-annotation-bg);
    border-color: var(--color-primary);
}

.w-button-success {
    background: var(--color-success);
}

.w-button-error {
    background: var(--color-error);
}

/* Fullscreen toggle - integrated into UI, not floating */
.w-fullscreen-toggle {
    background: var(--color-background);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    padding: var(--spacing-small) var(--spacing-base);
    font-size: 0.9rem;
}

.w-fullscreen-toggle:hover {
    background: var(--color-annotation-bg);
}

/* === MULTIPLE CHOICE SYSTEM === */

/*
 * Standard multiple choice layout with improved mobile support
 * Usage: 
 * <div class="w-multiple-choice">
 *   <button class="w-choice-option">Option 1</button>
 *   <button class="w-choice-option">Option 2</button>
 *   <button class="w-choice-option">Option 3</button>
 *   <button class="w-choice-option">Option 4</button>
 * </div>
 */
.w-multiple-choice {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-base);
    margin: var(--spacing-large) 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.w-choice-option {
    padding: var(--spacing-base);
    border: 2px solid var(--color-border);
    background: var(--color-card-bg);
    color: var(--color-text);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 60px;
    max-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1rem;
    position: relative;
    overflow: hidden;
}

.w-choice-option:hover {
    background: var(--color-annotation-bg);
    border-color: var(--color-primary);
}

.w-choice-option:disabled {
    cursor: not-allowed;
}

/* Multiple choice states */
.w-choice-option.w-correct {
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
}

.w-choice-option.w-incorrect {
    background: var(--color-error);
    color: white;
    border-color: var(--color-error);
}

.w-choice-option.w-unselected {
    opacity: 0.5;
}

/* === CHOICE OPTION CONTENT STRUCTURE === */

/* Main content container for choice options */
.trakaido-choice-content {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Text container for choice options */
.trakaido-choice-text-container {
    text-align: center;
    width: 100%;
}

/* Main answer text */
.trakaido-choice-answer {
    font-weight: 500;
}

/* Translation text styling */
.trakaido-choice-translation {
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    margin-top: 2px;
    opacity: 0.8;
}

/* Translation text for correct/selected answers */
.trakaido-choice-translation.correct-selected {
    color: rgba(255, 255, 255, 0.8);
}

/* Translation text for unselected answers */
.trakaido-choice-translation.unselected {
    color: var(--color-text-secondary);
}

/* Audio button container for correct answers */
.trakaido-audio-button-container {
    position: absolute;
    bottom: 4px;
    right: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* Allow clicks even when parent button is disabled */
}

/* Mobile-optimized multiple choice layout */
@media screen and (max-width: 767px) {
    .w-multiple-choice {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        max-width: none;
        margin: 1rem 0;
        padding: 0 0.25rem;
    }
    
    .w-choice-option {
        padding: 0.75rem 0.5rem;
        /* Removed font-size reduction - maintain default rem sizing */
        line-height: 1.2;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        overflow: hidden;
    }
    
    /* Ensure consistent sizing regardless of content */
    .w-choice-option .trakaido-choice-content {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.25rem;
        overflow: hidden;
    }
    
    /* Main text styling for mobile */
    .w-choice-option .trakaido-choice-answer {
        font-weight: 500;
        /* Removed font-size reduction - maintain readable size */
        line-height: 1.1;
        max-height: 2.2em; /* Limit to 2 lines */
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        word-break: break-word;
        hyphens: auto;
    }
    
    /* Translation text styling for mobile */
    .w-choice-option .trakaido-choice-translation {
        font-size: 0.85rem !important; /* Increased from 0.7rem for better readability */
        line-height: 1;
        margin-top: 0.15rem;
        opacity: 0.8;
        max-height: 1em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Audio button container for mobile */
    .w-choice-option .trakaido-audio-button-container {
        position: absolute;
        bottom: 0.25rem;
        right: 0.25rem;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0;
        padding: 0;
        pointer-events: auto; /* Allow clicks even when parent button is disabled */
    }
    
    /* Audio button styling for mobile */
    .w-choice-option .w-audio-button {
        font-size: 0.8rem;
        padding: 0.15rem;
        min-width: 1.5rem;
        min-height: 1.5rem;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.9);
        color: var(--color-primary);
        border: 1px solid rgba(0, 0, 0, 0.1);
        pointer-events: auto; /* Allow clicks even when parent button is disabled */
    }
    
    /* Correct answer audio button styling */
    .w-choice-option.w-correct .w-audio-button {
        background: rgba(255, 255, 255, 0.9);
        color: var(--color-success);
    }
}



/* Extra compact for very small screens */
@media screen and (max-width: 480px) {
    .w-multiple-choice {
        gap: 0.4rem;
        margin: 0.75rem 0;
        padding: 0 0.15rem;
    }
    
    .w-choice-option {
        padding: 0.6rem 0.4rem;
        /* Removed font-size reduction - let rem scale naturally */
    }
}

/* === MOBILE-OPTIMIZED QUESTION CARD === */

/* Mobile question card improvements */
@media screen and (max-width: 767px) {
    .w-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Compact question display for mobile */
    .w-question {
        font-size: clamp(1.2rem, 4vw, 1.4rem);
        margin-bottom: 1rem;
        line-height: 1.3;
    }
    
    /* Hide less important elements on mobile to reduce clutter */
    .w-badge {
        display: none;
    }
    
    /* Compact progress indicator */
    .w-progress {
        font-size: 0.8rem;
        margin: 0.5rem 0;
        color: var(--color-text-muted);
    }
    
    /* Mobile-friendly instruction text */
    .w-card > div:last-child {
        font-size: 0.8rem;
        margin-top: 0.5rem;
        line-height: 1.3;
    }
}

/* === MODE SELECTOR SYSTEM === */

/*
 * Mode selector for switching between options
 * Usage:
 * <div class="w-mode-selector">
 *   <button class="w-mode-option active">Mode 1</button>
 *   <button class="w-mode-option">Mode 2</button>
 * </div>
 */
.w-mode-selector {
    display: flex;
    gap: var(--spacing-small);
    justify-content: center;
    margin: var(--spacing-large) 0;
    flex-wrap: wrap;
}

.w-mode-option {
    padding: var(--spacing-small) var(--spacing-base);
    border: 1px solid var(--color-border);
    background: var(--color-background);
    color: var(--color-text);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.w-mode-option:hover {
    background: var(--color-annotation-bg);
}

.w-mode-option.w-active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

@media screen and (max-width: 767px) {
    .w-mode-selector {
        flex-direction: column;
        align-items: center;
        margin: 1rem 0;
        gap: 0.5rem;
    }
    
    .w-mode-option {
        width: 100%;
        max-width: 200px;
        padding: 0.75rem;
        font-size: 0.85rem;
    }
}

/* === NAVIGATION CONTROLS === */

/*
 * Navigation bar with previous/next and center controls
 * Usage:
 * <div class="w-nav-controls">
 *   <button class="w-button">← Previous</button>
 *   <div class="w-nav-center">
 *     <button class="w-button-secondary">Reset</button>
 *   </div>
 *   <button class="w-button">Next →</button>
 * </div>
 */
.w-nav-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--spacing-base);
    align-items: center;
    margin: var(--spacing-large) 0;
}

.w-nav-center {
    display: flex;
    gap: var(--spacing-base);
    justify-content: center;
}

@media screen and (max-width: 767px) {
    .w-nav-controls {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-small);
        text-align: center;
        margin: 1rem 0;
    }
    
    .w-nav-controls .w-button {
        padding: 0.75rem 0.5rem;
        /* Removed font-size reduction - maintain readable button text */
        min-height: 44px;
    }
    
    .w-nav-center {
        grid-column: 1 / -1;
        order: 3;
        margin-top: var(--spacing-small);
    }
}

/* === STATS DISPLAY === */

/*
 * Statistics display for games
 * Usage:
 * <div class="w-stats">
 *   <div class="w-stat-item">
 *     <div class="w-stat-value">15</div>
 *     <div class="w-stat-label">Correct</div>
 *   </div>
 * </div>
 */
.w-stats {
    display: flex;
    gap: var(--spacing-base);
    justify-content: center;
    align-items: center;
    margin: var(--spacing-large) 0;
    flex-wrap: wrap;
}

.w-stat-item {
    padding: var(--spacing-small) var(--spacing-base);
    background: var(--color-annotation-bg);
    border-radius: var(--border-radius);
    text-align: center;
    min-width: 60px;
    flex: 0 0 auto;
}

.w-stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
}

.w-stat-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

@media screen and (max-width: 767px) {
    .w-stats {
        gap: var(--spacing-small);
        margin: 1rem 0;
    }
    
    .w-stat-item {
        padding: var(--spacing-small);
        min-width: 50px;
    }
    
    .w-stat-value {
        font-size: 1rem;
    }
    
    .w-stat-label {
        font-size: 0.75rem;
    }
}

/* === UTILITY CLASSES === */

/* Essential layout utilities */
.w-text-center { text-align: center; }
.w-font-bold { font-weight: bold; }
.w-mb-large { margin-bottom: var(--spacing-large); }

/* Question display */
.w-question {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: var(--spacing-large);
}

/* Progress indicator */
.w-progress {
    text-align: center;
    margin: var(--spacing-base) 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

/* Feedback messages */
.w-feedback {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin: var(--spacing-base) 0;
    padding: var(--spacing-base);
    border-radius: var(--border-radius);
}

.w-feedback.w-success {
    color: var(--color-success);
    background: rgba(76, 175, 80, 0.1);
}

.w-feedback.w-error {
    color: var(--color-error);
    background: rgba(255, 0, 0, 0.1);
}

/* Audio button for language widgets */
.w-audio-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-primary);
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    pointer-events: auto; /* Allow clicks even when parent button is disabled */
}

.w-audio-button:hover {
    background: var(--color-annotation-bg);
    transform: scale(1.1);
}

/* Category badge */
.w-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--color-annotation-bg);
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}



/* === MODAL BASE STYLES === */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-container {
    background-color: var(--color-background);
    color: var(--color-text);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--color-border);
    position: relative;
    contain: layout style;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--color-text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0.25rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--color-annotation-bg);
    color: var(--color-text);
    transform: scale(1.1);
}

.modal-content {
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* === TABLE STYLING PATTERNS === */

.data-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--color-border);
    background: var(--color-card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.data-table-container {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--color-card-bg);
}

.data-table th {
    padding: var(--spacing-base);
    border: 1px solid var(--color-border);
    background: var(--color-annotation-bg);
    text-align: left;
    font-weight: 600;
    color: var(--color-text);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td {
    padding: var(--spacing-base);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.data-table tbody tr:nth-child(even) {
    background: var(--color-card-bg);
}

.data-table tbody tr:nth-child(odd) {
    background: var(--color-background);
}

.data-table tbody tr:hover {
    background: var(--color-annotation-bg);
}

.table-scrollable {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile table adjustments */
@media screen and (max-width: 767px) {
    .data-table th,
    .data-table td {
        padding: var(--spacing-small);
        font-size: 0.9rem;
    }
    
    .table-scrollable {
        max-height: 50vh;
    }
}

/* Mobile modal adjustments */
@media screen and (max-width: 767px) {
    .modal-container {
        padding: 1.5rem;
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .modal-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
}

@media screen and (max-width: 480px) {
    .modal-container {
        padding: 1rem;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-overlay {
        padding: 0;
    }
}

/* === TRAKAIDO-SPECIFIC STYLES === */

/* Answer text display */
.trakaido-answer-text {
    font-size: 1.5rem;
    color: var(--color-text-secondary);
    margin-top: var(--spacing-base);
    display: flex;
    align-items: center;
    gap: var(--spacing-small);
    justify-content: center;
}



/* Corpus section container */
.trakaido-corpus-section {
    margin-bottom: var(--spacing-base);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-base);
}

/* Corpus header */
.trakaido-corpus-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-small);
    cursor: pointer;
    font-weight: bold;
    color: var(--color-primary);
}

/* Group grid layout */
.trakaido-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-small);
    margin-top: var(--spacing-small);
}

/* Group item */
.trakaido-group-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-small);
    padding: var(--spacing-small);
    background: var(--color-annotation-bg);
    border-radius: var(--border-radius);
}

/* Corpus toggle button */
.trakaido-corpus-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-small) var(--spacing-base);
    cursor: pointer;
    color: var(--color-text);
    font-size: 0.8rem;
}

.trakaido-corpus-toggle:hover {
    background: var(--color-annotation-bg);
}

/* === RESPONSIVE HELPERS === */

/* Hide on mobile */
@media screen and (max-width: 767px) {
    .w-hide-mobile {
        display: none;
    }
}

/* Hide on desktop */
@media screen and (min-width: 768px) {
    .w-hide-desktop {
        display: none;
    }
}

/* Show/hide based on screen size */
.w-show-mobile {
    display: inline;
}

.w-hide-mobile {
    display: none;
}

/* Hide app title on very small screens */
.w-hide-mobile-title {
    display: block;
}

@media screen and (max-width: 480px) {
    .w-hide-mobile-title {
        display: none;
    }
}

@media screen and (min-width: 768px) {
    .w-show-mobile {
        display: none;
    }
    
    .w-hide-mobile {
        display: inline;
    }
}

/* Mobile button group - fit 3 buttons on one line */
.w-button-group-mobile {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: var(--spacing-base) 0;
}

/* Compact buttons for mobile */
.w-compact-button {
    /* Removed font-size reduction - maintain readable button text */
    padding: 0.4rem 0.6rem;
    min-height: 36px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media screen and (max-width: 767px) {
    .w-button-group-mobile {
        max-width: 375px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .w-compact-button {
        max-width: calc(33.333% - 0.17rem);
        /* Removed font-size reduction - maintain readable button text */
        padding: 0.3rem 0.4rem;
    }
}

/* Landscape mobile optimization - prioritize horizontal space */
@media screen and (max-width: 767px) and (orientation: landscape) {
    .w-button-group-mobile {
        max-width: none; /* Use full available width */
        margin: 0.5rem 0; /* Reduce vertical margins to save height */
        gap: 0.4rem; /* Slightly larger gap for better readability */
    }
    
    .w-compact-button {
        max-width: none; /* Remove width restriction */
        flex: 1; /* Equal distribution of available space */
        padding: 0.4rem 0.5rem; /* Slightly more padding for better touch targets */
        font-size: 0.85rem; /* Slightly smaller font to fit more content */
        min-width: 60px; /* Minimum width to prevent too-narrow buttons */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Very small landscape screens (like 480x320) */
@media screen and (max-width: 480px) and (orientation: landscape) {
    .w-button-group-mobile {
        gap: 0.25rem; /* Tighter spacing */
        margin: 0.25rem 0; /* Minimal vertical margins */
    }
    
    .w-compact-button {
        padding: 0.3rem 0.4rem; /* More compact padding */
        font-size: 0.8rem; /* Smaller font for very small screens */
        min-width: 50px; /* Smaller minimum width */
    }
}

/* === STUDY MODE SELECTOR STYLES === */

/* Dropdown container styling */
.w-dropdown-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0 0.5rem;
}

.w-dropdown-container label {
    font-weight: bold;
    font-size: 0.9rem;
}

.w-dropdown-container select {
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    background: var(--color-card-bg);
    color: var(--color-text);
    min-height: 44px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.w-dropdown-container select:hover {
    border-color: var(--color-primary);
}

.w-dropdown-container select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.2);
}

/* Voice selector styling */
.w-voice-selector {
    margin-top: 0.5rem;
}

.w-voice-selector select {
    width: 100%;
    max-width: 200px;
}

/* === STUDY MODE SELECTOR LANDSCAPE OPTIMIZATIONS === */

/* Optimize dropdown containers for landscape mobile */
@media screen and (max-width: 767px) and (orientation: landscape) {
    .w-dropdown-container {
        margin: 0 0.15rem; /* Reduce horizontal margins */
        gap: 0.25rem; /* Tighter gap between label and select */
        flex: 0 0 auto; /* Don't grow or shrink, use content size */
        width: 140px; /* Fixed width for predictable layout */
    }
    
    .w-dropdown-container label {
        font-size: 0.8rem; /* Smaller label text */
        margin-bottom: 0; /* Remove bottom margin if any */
    }
    
    .w-dropdown-container select {
        padding: 0.4rem; /* More compact padding */
        font-size: 0.85rem; /* Slightly smaller text */
        min-height: 40px; /* Reduce minimum height */
    }
    
    /* Make the mode selector more compact in landscape */
    .w-mode-selector {
        gap: 0.25rem; /* Tighter spacing between elements */
        margin: 0.5rem 0; /* Reduce vertical margins */
        flex-wrap: nowrap; /* Prevent wrapping to new lines */
        flex-direction: row; /* Override mobile column layout */
        align-items: flex-start; /* Align items to top */
        justify-content: center; /* Center the content */
    }
    
    /* Make button group fit in remaining space */
    .w-button-group-mobile {
        flex: 1; /* Take remaining space */
        max-width: none; /* Remove width restriction */
        margin: 0; /* Remove margins to save space */
        min-width: 0; /* Allow shrinking if needed */
    }
    
    .w-voice-selector {
        margin-top: 0.25rem;
    }
}

/* Extra compact for very small landscape screens */
@media screen and (max-width: 480px) and (orientation: landscape) {
    .w-dropdown-container {
        margin: 0 0.15rem;
    }
    
    .w-dropdown-container label {
        font-size: 0.75rem;
    }
    
    .w-dropdown-container select {
        padding: 0.3rem;
        font-size: 0.8rem;
        min-height: 36px;
    }
    
    .w-mode-selector {
        gap: 0.15rem;
        margin: 0.3rem 0;
        flex-wrap: nowrap; /* Maintain single line layout */
    }
    
    .w-dropdown-container {
        width: 120px; /* Even smaller fixed width for very small screens */
        margin: 0 0.1rem; /* Tighter margins */
    }
    
    .w-button-group-mobile {
        flex: 1;
        margin: 0;
        min-width: 0;
    }
    
    .w-voice-selector {
        margin-top: 0.15rem;
    }
    
    .w-voice-selector select {
        max-width: 160px;
    }
}

/* === MOBILE CONTAINER OPTIMIZATIONS === */

@media screen and (max-width: 767px) {
    .w-container {
        padding: 1rem 0.75rem;
        min-height: 100vh;
    }
    
    /* Reduce title size on mobile */
    .w-container h1 {
        font-size: clamp(1.5rem, 6vw, 2rem);
        margin-bottom: 1rem;
        text-align: center;
    }
}

@media screen and (max-width: 480px) {
    .w-container {
        padding: 0.75rem 0.5rem;
    }
    
    .w-container h1 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }
}

/* === MULTI WORD SEQUENCE ACTIVITY === */

.multi-word-sequence-activity {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-large);
    padding: var(--spacing-base);
}

/* Header section with instructions and replay button */
.sequence-header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
    text-align: center;
    padding: var(--spacing-base);
    background: var(--color-card-background);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
}

.sequence-instructions h3 {
    margin: 0 0 var(--spacing-small) 0;
    color: var(--color-primary);
    font-size: 1.2rem;
}

.sequence-hint {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.sequence-controls {
    display: flex;
    justify-content: center;
    margin-top: var(--spacing-small);
}

/* Sequence control buttons use existing w-button classes with minor adjustments */
.sequence-controls .w-button {
    padding: var(--spacing-small) var(--spacing-base);
    font-size: 1rem;
}

.sequence-controls .w-button:not(:first-child) {
    margin-left: var(--spacing-small);
}

/* Options grid - responsive layout */
.sequence-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-base);
    max-width: 800px;
    margin: 0 auto;
}

.sequence-option {
    background: var(--color-card-background);
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-base);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sequence-option:hover:not(:disabled) {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.sequence-option:disabled {
    cursor: not-allowed;
}

.sequence-option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-small);
    width: 100%;
    position: relative;
}

.sequence-selection-number {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.sequence-option-text {
    text-align: center;
}

.sequence-option-lithuanian {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.sequence-option-english {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    font-style: italic;
}

.sequence-audio-container {
    margin-top: var(--spacing-small);
}

/* Option states */
.sequence-option.sequence-selected {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.sequence-option.sequence-correct {
    border-color: var(--color-success);
    background: var(--color-success-light);
}

.sequence-option.sequence-incorrect {
    border-color: var(--color-error);
    background: var(--color-error-light);
}

.sequence-option.sequence-unselected {
    opacity: 0.6;
    background: var(--color-background);
}

.sequence-option.sequence-missed {
    border-color: var(--color-primary);
    background: rgba(var(--color-primary-rgb), 0.1);
}

/* Answer reveal section */
.sequence-answer-reveal {
    background: var(--color-card-background);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-base);
    margin-top: var(--spacing-base);
}

.sequence-answer-reveal h4 {
    margin: 0 0 var(--spacing-base) 0;
    color: var(--color-primary);
    text-align: center;
}

.sequence-correct-order {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-small);
}

.sequence-correct-word {
    display: flex;
    align-items: center;
    gap: var(--spacing-small);
    padding: var(--spacing-small);
    background: var(--color-success-light);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-success);
}

.sequence-word-number {
    font-weight: bold;
    color: var(--color-success);
    min-width: 1.5rem;
}

.sequence-word-text {
    flex: 1;
    font-weight: 500;
}

/* Responsive design */
@media screen and (min-width: 768px) {
    .sequence-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .sequence-instructions {
        flex: 1;
    }
    
    .sequence-controls {
        margin-top: 0;
    }
    
    .sequence-options-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .sequence-correct-order {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-base);
    }
}

@media screen and (max-width: 480px) {
    .sequence-options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-small);
    }
    
    .sequence-option {
        min-height: 60px;
        padding: var(--spacing-small);
    }
    
    .sequence-option-lithuanian {
        font-size: 1rem;
    }
    
    .sequence-option-english {
        font-size: 0.8rem;
    }
}

/* Error state for multi-word sequence mode */
.multi-word-sequence-error {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-large);
    padding: var(--spacing-large);
    text-align: center;
    background: var(--color-card-background);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
}

.multi-word-sequence-error h3 {
    color: var(--color-error);
    margin: 0 0 var(--spacing-base) 0;
}

.multi-word-sequence-error p {
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.5;
}
