/* flashcard/base.css */

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Category Selection Styles */
#ll-tools-category-selection {
    display: flex;
    flex-direction: column;
    height: auto;
}

.ll-tools-category-selection-buttons {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.ll-tools-category-selection-buttons button {
    margin: 0 5px;
}

#ll-tools-category-checkboxes-container {
    flex-grow: 1;
    text-align: center;
    margin-bottom: 20px;
    max-height: calc(80vh - 150px);
    -webkit-overflow-scrolling: touch;
}

#ll-tools-category-checkboxes {
    display: inline-block;
    text-align: left;
    max-height: 100%;
    min-width: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#ll-tools-start-selected-quiz {
    align-self: center;
}

/* Body State When Flashcard is Open */
body.ll-tools-flashcard-open {
    overflow: hidden;
}

/* Repeat button (play/stop icons) */
#ll-tools-repeat-flashcard {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Fixed container for icons so layout doesn't shift */
#ll-tools-repeat-flashcard .icon-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    position: relative;
}

#ll-tools-repeat-flashcard.play-mode .icon-container img,
#ll-tools-repeat-flashcard.play-mode .icon-container svg {
    width: 100%;
    height: 100%;
    display: block;
}

#ll-tools-repeat-flashcard.stop-mode .icon-container img,
#ll-tools-repeat-flashcard.stop-mode .icon-container svg {
    width: 100%;
    height: 100%;
    margin: auto;
    display: block;
}

#ll-tools-repeat-flashcard.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

#ll-tools-repeat-flashcard.disabled .icon-container {
    opacity: 0.5;
}

#ll-tools-start-flashcard {
    display: block;
    margin-bottom: 40px;
}

/* Flashcard Container */
#ll-tools-flashcard-container {
    position: relative;
}

.ll-tools-prompt {
    display: none;
    text-align: center;
    margin: 0 auto 16px;
}

.ll-tools-prompt .ll-prompt-image-wrap {
    display: inline-flex;
    justify-content: center;
    width: 80%;
    max-width: 250px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    background: #f8f8f8;
}

.ll-tools-prompt img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}

/* Category Selection Popup */
#ll-tools-category-selection-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

#ll-tools-category-selection-popup h3 {
    text-align: center;
    margin-bottom: 10px;
    margin-top: 50px;
}

/* Flashcard Quiz Popup */
#ll-tools-flashcard-quiz-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    overflow: hidden;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

/* Close Button Styles */
#ll-tools-close-category-selection,
#ll-tools-close-flashcard {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: black;
}

/* Quiz Results Styles */
#quiz-results {
    display: none;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px;
    width: 80%;
    max-width: 600px;
    z-index: 10;
}

#quiz-results-message {
    font-size: 14px;
    color: #555;
    margin-top: 10px;
}

/* Loading Animation Styles */
.ll-tools-loading-animation {
    display: none;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #333333;
    border-radius: 50%;
    animation: ll-tools-spin 2s linear infinite;
    order: 3;
    margin-top: 10px;
}

@keyframes ll-tools-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.ll-tools-loading-animation.ll-tools-loading-animation--visualizer {
    width: auto;
    min-width: 140px;
    height: 52px;
    border: none;
    border-radius: 10px;
    animation: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 5px;
    padding: 8px 16px 10px;
    background: rgba(99, 102, 241, 0.12);
    flex-direction: row;
}

.ll-tools-loading-animation:not(.ll-tools-loading-animation--visualizer) .ll-tools-visualizer-bar {
    display: none;
}

.ll-tools-loading-animation.ll-tools-loading-animation--visualizer .ll-tools-visualizer-bar {
    display: inline-block;
    flex: 0 0 6px;
    width: 6px;
    height: calc(12px + 52px * var(--level, 0));
    background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
    border-radius: 3px 3px 0 0;
    transition: height 0.12s ease-out, opacity 0.2s ease-out;
    transform-origin: center bottom;
    opacity: 0.82;
    will-change: height, transform, opacity;
    animation: ll-tools-visualizer-fallback 1.2s ease-in-out infinite;
    animation-delay: calc(var(--offset, 0) * 0.18s);
}

.ll-tools-loading-animation.ll-tools-loading-animation--visualizer.ll-tools-loading-animation--js .ll-tools-visualizer-bar {
    animation: none;
    transform: scaleY(1);
}

.ll-tools-loading-animation.ll-tools-loading-animation--visualizer.ll-tools-loading-animation--active .ll-tools-visualizer-bar {
    opacity: 1;
}

.ll-tools-loading-animation.ll-tools-loading-animation--visualizer.ll-tools-loading-animation--fallback .ll-tools-visualizer-bar {
    animation-duration: 1.5s;
}

@keyframes ll-tools-visualizer-fallback {

    0%,
    100% {
        transform: scaleY(0.45);
        opacity: 0.6;
    }

    50% {
        transform: scaleY(1.05);
        opacity: 0.95;
    }
}

/* Flashcard Header and Content */
#ll-tools-flashcard-header {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px 20px 10px;
    z-index: 20;
}

#ll-tools-flashcard-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

#ll-tools-flashcard {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    align-items: flex-start;
    max-width: 720px;
    width: 100%;
}

#ll-tools-flashcard.audio-line-layout {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    width: 100%;
    max-width: 95vw;
    gap: 12px;
}

#ll-tools-flashcard-content.audio-line-mode {
    overflow: auto;
    max-height: none;
    min-height: calc(100vh - 200px);
    padding-bottom: 24px;
}

#ll-tools-flashcard-content.audio-line-mode .ll-prompt-image-wrap {
    width: clamp(120px, 28vw, 250px);
    max-width: clamp(120px, 28vw, 250px);
    max-height: clamp(120px, 28vw, 250px);
}

@media (max-height: 720px) {
    #ll-tools-flashcard-content.audio-line-mode .ll-prompt-image-wrap {
        max-width: 210px;
    }
}

@media (max-height: 620px) {
    #ll-tools-flashcard-content.audio-line-mode .ll-prompt-image-wrap {
        max-width: 150px;
        max-height: 150px;
    }
}

@media (max-width: 520px) {
    #ll-tools-flashcard-content.audio-line-mode .ll-prompt-image-wrap {
        max-width: 150px;
        max-height: 150px;
    }
}

@media (max-height: 640px) {
    #ll-tools-flashcard-content.audio-line-mode .ll-prompt-image-wrap {
        max-width: 130px;
        max-height: 130px;
    }
    .flashcard-container.audio-option.audio-line-option {
        padding: 6px 8px;
        gap: 6px;
        max-height: 54px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-option-bullet {
        width: 12px;
        height: 12px;
        border-width: 2px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-play {
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-play-icon {
        font-size: 12px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-option-label {
        font-size: 13px;
        line-height: 1.25;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer {
        min-height: 16px;
        gap: 4px;
    }
    .flashcard-container.audio-option.audio-line-option.text-audio-option .ll-audio-mini-visualizer {
        flex: 0 0 38px;
        gap: 3px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar {
        width: 4px;
    }
}

@media (max-height: 540px) {
    #ll-tools-flashcard-content.audio-line-mode .ll-prompt-image-wrap {
        max-width: 110px;
        max-height: 110px;
    }
    #ll-tools-flashcard-content.audio-line-mode {
        min-height: calc(100vh - 160px);
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-option-label {
        font-size: 12px;
        line-height: 1.2;
    }
    .flashcard-container.audio-option.audio-line-option {
        padding: 5px 7px;
        gap: 5px;
        max-height: 50px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-play {
        width: 24px;
        height: 24px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-option-bullet {
        width: 11px;
        height: 11px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer {
        min-height: 14px;
    }
    .flashcard-container.audio-option.audio-line-option.text-audio-option .ll-audio-mini-visualizer {
        flex: 0 0 34px;
    }
}

@media (max-height: 500px) {
    #ll-tools-flashcard-content.audio-line-mode .ll-prompt-image-wrap {
        max-width: 100px;
        max-height: 100px;
    }
    .flashcard-container.audio-option.audio-line-option {
        padding: 4px 6px;
        gap: 4px;
        height: 10vh;
        min-height: 42px;
        max-height: 56px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-option-bullet {
        width: 10px;
        height: 10px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-play {
        width: 22px;
        height: 22px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-play-icon {
        font-size: 11px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-option-label {
        font-size: 11px;
        line-height: 1.1;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer {
        min-height: 10px;
    }
    .flashcard-container.audio-option.audio-line-option.text-audio-option .ll-audio-mini-visualizer {
        flex: 0 0 28px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar {
        width: 3px;
    }
}

/* Flashcard Container Styles */
.flashcard-container {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    padding: 0;
    background: #fff;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
}

.flashcard-container img {
    object-fit: contain;
}

/* Modifier Classes for Flashcard Orientation */
.flashcard-container.landscape {
    height: auto;
}

.flashcard-container.portrait {
    height: auto;
}

.flashcard-container.text-based {
    width: 220px;
    max-width: 220px;
    height: 150px;
}

.flashcard-container.audio-option {
    padding: 8px;
    flex-direction: column;
    gap: 6px;
    width: 160px;
    max-width: 160px;
    height: 140px;
    max-height: 150px;
}

.flashcard-container.audio-option .ll-audio-play {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid #d9d9d9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}

.flashcard-container.audio-option .ll-audio-play:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.flashcard-container.audio-option .ll-audio-play-icon {
    font-size: 20px;
    line-height: 1;
}

.flashcard-container.audio-option .quiz-text {
    padding: 0 8px;
    font-weight: 600;
    line-height: 1.2;
}

.flashcard-container.audio-option.audio-line-option {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: fit-content;
    max-width: min(95vw, 720px);
    min-width: 240px;
    flex: 0 1 auto;
    align-self: center;
    height: auto;
    max-height: none;
    padding: 10px 14px;
    box-sizing: border-box;
    box-shadow: none;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}

.flashcard-container.audio-option.audio-line-option.ll-option-disabled {
    opacity: 0.55;
    background: #f3f4f6;
    border-color: #e5e7eb;
    pointer-events: none;
}

.flashcard-container.audio-option.audio-line-option:hover {
    background: #fff;
    border-color: #d1d5db;
}

.flashcard-container.audio-option.audio-line-option:active {
    transform: translateY(1px);
}

.flashcard-container.audio-option.audio-line-option .ll-audio-option-bullet {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    flex-shrink: 0;
}

.flashcard-container.audio-option.audio-line-option.playing .ll-audio-option-bullet {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.flashcard-container.audio-option.audio-line-option .ll-audio-play {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    box-shadow: none;
    flex-shrink: 0;
}

.flashcard-container.audio-option.audio-line-option .ll-audio-play:hover {
    transform: none;
    box-shadow: none;
    background: #f3f4f6;
}

.flashcard-container.audio-option.audio-line-option .ll-audio-play:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.flashcard-container.audio-option.audio-line-option .ll-audio-play-icon {
    font-size: 16px;
}

.flashcard-container.audio-option.audio-line-option .quiz-text {
    padding: 0;
    text-align: left;
    font-size: 17px;
    line-height: 1.4;
    flex: 1;
}

.flashcard-container.audio-option.audio-line-option .ll-audio-option-label {
    font-weight: 600;
    color: #111827;
}

.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer {
    display: inline-flex;
    align-items: flex-end;
    gap: 6px;
    flex: 1;
    min-height: 22px;
}

.flashcard-container.audio-option.audio-line-option.text-audio-option .ll-audio-mini-visualizer {
    flex: 0 0 52px;
    gap: 5px;
}

.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar {
    width: 6px;
    height: 10px;
    border-radius: 3px;
    background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%);
    opacity: 0.55;
    transform-origin: center bottom;
    transition: height 0.18s ease, opacity 0.18s ease;
}

.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar:nth-child(2) { height: 13px; }
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar:nth-child(3) { height: 11px; }
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar:nth-child(4) { height: 15px; }
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar:nth-child(5) { height: 12px; }
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar:nth-child(6) { height: 14px; }
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar:nth-child(7) { height: 11px; }
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar:nth-child(8) { height: 13px; }

.flashcard-container.audio-option.audio-line-option.audio-line-option-audio-only .ll-audio-mini-visualizer {
    gap: 8px;
}

.flashcard-container.audio-option.audio-line-option.audio-line-option-audio-only .ll-audio-mini-visualizer .bar {
    width: 6px;
}

.flashcard-container.audio-option.audio-line-option.playing .ll-audio-mini-visualizer .bar,
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer.active .bar {
    opacity: 0.95;
    animation: ll-audio-mini-eq 1s ease-in-out infinite;
}

.flashcard-container.audio-option.audio-line-option.playing .ll-audio-mini-visualizer .bar:nth-child(2),
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer.active .bar:nth-child(2) {
    animation-delay: 0.08s;
}

.flashcard-container.audio-option.audio-line-option.playing .ll-audio-mini-visualizer .bar:nth-child(3),
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer.active .bar:nth-child(3) {
    animation-delay: 0.15s;
}

.flashcard-container.audio-option.audio-line-option.playing .ll-audio-mini-visualizer .bar:nth-child(4),
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer.active .bar:nth-child(4) {
    animation-delay: 0.22s;
}

.flashcard-container.audio-option.audio-line-option.playing .ll-audio-mini-visualizer .bar:nth-child(5),
.flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer.active .bar:nth-child(5) {
    animation-delay: 0.28s;
}

.flashcard-container.audio-option.audio-line-option .ll-audio-option-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Audio-only line options: shrink-wrap to content */
.flashcard-container.audio-option.audio-line-option.audio-line-option-audio-only {
    min-width: 0;
    width: auto;
    max-width: 95vw;
    padding-left: 12px;
    padding-right: 12px;
}

@media (max-height: 500px) {
    #ll-tools-flashcard.audio-line-layout {
        gap: 6px;
    }
    #ll-tools-flashcard-content.audio-line-mode {
        padding-bottom: 10px;
    }
    .flashcard-container.audio-option.audio-line-option {
        padding: 4px 6px;
        gap: 4px;
        height: 9vh;
        min-height: 38px;
        max-height: 48px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-option-bullet {
        width: 10px;
        height: 10px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-play {
        width: 22px;
        height: 22px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-play-icon {
        font-size: 11px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-option-label {
        font-size: 11px;
        line-height: 1.2;
        padding-bottom: 1px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer {
        min-height: 10px;
    }
    .flashcard-container.audio-option.audio-line-option.text-audio-option .ll-audio-mini-visualizer {
        flex: 0 0 26px;
    }
    .flashcard-container.audio-option.audio-line-option .ll-audio-mini-visualizer .bar {
        width: 6px;
    }
    .flashcard-container.audio-option.audio-line-option.text-audio-option .ll-audio-mini-visualizer .bar:nth-child(n+4) {
        display: none;
    }
}

@keyframes ll-audio-mini-eq {
    0% { transform: scaleY(0.7); }
    35% { transform: scaleY(1.35); }
    65% { transform: scaleY(0.9); }
    100% { transform: scaleY(1); }
}

/* Correct Answer Overlay */
.correct-answer {
    position: relative;
    z-index: 9999;
}

.correct-answer::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: brightness(1.1);
    z-index: 1;
}

.correct-answer::after {
    content: "\2714";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    color: #85cd6a !important;
    font-weight: bold;
    font-family: Arial, Helvetica, sans-serif !important;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 2;
    line-height: 1;
    -webkit-text-size-adjust: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

@media (max-height: 500px) {
    .correct-answer::after {
        font-size: 36px;
    }
}

/* Fade-Out Animation */
.fade-out {
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

/* Quiz Image Styles */
.quiz-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.quiz-text {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    padding-top: 20px;
    padding-bottom: 20px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 5px;
}

.quiz-image:hover {
    transform: scale(1.05);
}

/* Hide the audio player */
#ll-tools-flashcard audio {
    display: none;
}

/* New Classes for Flashcard Sizes */
.flashcard-size-small {
    width: 150px;
    height: 150px;
    max-width: 150px;
    max-height: 150px;
}

.flashcard-size-medium {
    width: 200px;
    height: 200px;
    max-width: 200px;
    max-height: 200px;
}

.flashcard-size-large {
    width: 250px;
    height: 250px;
    max-width: 250px;
    max-height: 250px;
}

/* --- Flashcard header: stack category label above play/pause --- */
.ll-tools-category-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    order: 2;
}
.ll-tools-category-stack.ll-no-repeat-btn {
    gap: 0;
}
.ll-tools-category-stack.ll-no-repeat-btn #ll-tools-repeat-flashcard {
    display: none !important;
}

/* Ensure the category name is centered and visually distinct */
#ll-tools-category-display.ll-tools-category-display {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    max-width: 100%;
    word-wrap: anywhere;
}

/* Floating mode switcher (single toggle + expanding menu) */
.ll-tools-mode-switcher-wrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

.ll-tools-mode-switcher {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1d4ed8;
    /* blue-700 */
    color: #ffffff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    padding: 0;
}

.ll-tools-mode-switcher:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}

.ll-tools-mode-switcher:focus-visible {
    outline: 3px solid #38bdf8;
    outline-offset: 2px;
}

.ll-tools-mode-switcher .mode-icon {
    display: block;
    line-height: 1;
    font-size: 28px;
}

.ll-tools-mode-menu {
    position: absolute;
    bottom: 70px;
    /* sits above the toggle button */
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    /* click-through when hidden */
}

.ll-tools-mode-switcher-wrap[aria-expanded="true"] .ll-tools-mode-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.ll-tools-mode-option {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    /* subtle ring to separate on light bg */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    background: #ffffff;
    /* white for higher contrast with gray icons */
    color: #111827;
    /* dark text for non-emoji icons */
}

.ll-tools-mode-option .mode-icon::before {
    content: attr(data-emoji);
    display: block;
    font-size: 26px;
    line-height: 1;
}

/* SVG icon support inside mode menu (color follows element color) */
.ll-tools-mode-option .mode-icon svg,
#ll-tools-mode-switcher-wrap .ll-tools-mode-switcher .mode-icon svg {
    width: 26px !important;
    height: 26px !important;
    display: block !important;
    fill: currentColor !important;
    stroke: currentColor !important;
}

/* Darken/adjust emoji rendering for better contrast on light backgrounds */
.ll-tools-mode-option.listening .mode-icon {
    /* Darken gray headphones on white */
    filter: brightness(0.7) contrast(1.25);
}

.ll-tools-mode-option.practice .mode-icon {
    /* Tweak red question mark toward a deeper tone */
    filter: hue-rotate(200deg) saturate(1.1) brightness(0.95) contrast(1.15);
}

/* Optional: remove filters on active for consistency against green bg */
.ll-tools-mode-option.active .mode-icon {
    filter: none;
}

/* Make the Practice '?' appear white/off-white on active (green) */
.ll-tools-mode-option.practice.active .mode-icon {
    /* Desaturate and brighten to near-white for strong contrast */
    filter: saturate(0) brightness(2.0) contrast(1.05);
}

/* Make Learning cap and Listening headphones near-white on active */
.ll-tools-mode-option.learning.active .mode-icon,
.ll-tools-mode-option.listening.active .mode-icon {
    filter: saturate(0) brightness(2.0) contrast(1.05);
}

/* Slightly lighter for Learning icon on green */
.ll-tools-mode-option.learning.active .mode-icon {
    filter: saturate(0) brightness(1.2) contrast(1.15);
}

.ll-tools-mode-option:hover:not(.active):not([disabled]) {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    background: #f9fafb;
    /* near-white hover */
    border-color: #d1d5db;
}

.ll-tools-mode-option.active {
    background: #15803d;
    /* green-700 for high contrast */
    color: #ffffff;
    border-color: #15803d;
    cursor: default;
}

.ll-tools-mode-option[disabled],
.ll-tools-mode-option[aria-disabled="true"] {
    opacity: 0.9;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .ll-tools-mode-switcher-wrap {
        bottom: 15px;
        right: 15px;
    }

    .ll-tools-mode-switcher,
    .ll-tools-mode-option {
        width: 48px;
        height: 48px;
    }

    .ll-tools-mode-switcher .mode-icon {
        font-size: 24px;
    }

    .ll-tools-mode-option .mode-icon::before {
        font-size: 22px;
    }

    .ll-tools-mode-menu {
        bottom: 60px;
        gap: 8px;
    }
}

/* Quiz Mode Buttons on Results Page */
#quiz-mode-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.quiz-mode-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 160px;
    justify-content: center;
}

.quiz-mode-button .button-icon {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.quiz-mode-button .button-icon::before {
    content: attr(data-emoji);
    font-size: 20px;
    line-height: 1;
}

/* Hide mode switcher during results */
#quiz-results:not([style*="display: none"])~.ll-tools-mode-switcher {
    display: none !important;
}

#quiz-results:not([style*="display: none"])~.ll-tools-mode-switcher-wrap {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .quiz-mode-button {
        min-width: 140px;
        padding: 10px 20px;
        font-size: 14px;
    }

    .quiz-mode-button .button-icon::before {
        font-size: 18px;
    }

}

/* Autoplay blocked overlay */
.ll-tools-autoplay-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.ll-tools-autoplay-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 20px;
    transition: transform 0.2s ease;
    animation: pulse 2s ease-in-out infinite;
}

.ll-tools-autoplay-button:hover {
    transform: scale(1.05);
}

.ll-tools-autoplay-button:active {
    transform: scale(0.95);
}

.ll-tools-autoplay-button span {
    color: white;
    font-size: 24px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Ensure the overlay appears above everything in the flashcard widget */
#ll-tools-flashcard-content {
    position: relative;
}

/* Autoplay blocked overlay */
.ll-tools-autoplay-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    backdrop-filter: blur(3px) !important;
}

.ll-tools-autoplay-button {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 20px !important;
    transition: transform 0.2s ease !important;
}

/* Ensure the flashcard content container is positioned for the overlay */
#ll-tools-flashcard-content {
    position: relative !important;
}

#quiz-results-message {
    font-size: 14px;
    color: #555;
    margin-top: 0;
    text-align: center;
}

/* =============================
   Hardening against theme CSS
   ============================= */
/* Keep the floating switcher and its menu options perfectly circular */
#ll-tools-mode-switcher-wrap #ll-tools-mode-switcher.ll-tools-mode-switcher {
    width: 56px !important;
    height: 56px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    background: #1d4ed8 !important; /* lock base blue */
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
    border: none !important;
}

#ll-tools-mode-switcher-wrap #ll-tools-mode-menu .ll-tools-mode-option,
#ll-tools-mode-switcher-wrap .ll-tools-mode-option.ll-tools-mode-option {
    width: 56px !important;
    height: 56px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    padding: 0 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

#ll-tools-mode-switcher-wrap #ll-tools-mode-menu .ll-tools-mode-option:not(.active):not([aria-checked="true"]),
#ll-tools-mode-switcher-wrap .ll-tools-mode-option.ll-tools-mode-option:not(.active):not([aria-checked="true"]) {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    color: #111827 !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25) !important;
}

/* Lock icon sizing/visibility for mode switcher */
#ll-tools-mode-switcher-wrap .ll-tools-mode-option .mode-icon::before {
    display: block !important;
    font-size: 26px !important;
    line-height: 1 !important;
}

#ll-tools-mode-switcher-wrap .ll-tools-mode-switcher .mode-icon {
    display: block !important;
    font-size: 28px !important;
    line-height: 1 !important;
}

/* Keep switcher blue on focus/active/expanded regardless of theme accent */
#ll-tools-mode-switcher-wrap .ll-tools-mode-switcher:focus,
#ll-tools-mode-switcher-wrap .ll-tools-mode-switcher:active,
#ll-tools-mode-switcher-wrap .ll-tools-mode-switcher[aria-expanded="true"],
#ll-tools-mode-switcher-wrap .ll-tools-mode-switcher[aria-pressed="true"] {
    background: #1d4ed8 !important;
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
    border: none !important;
}

/* Hover stays in the same blue family, not theme accent */
#ll-tools-mode-switcher-wrap .ll-tools-mode-switcher:hover {
    background: #2563eb !important; /* slightly lighter blue */
    background-color: #2563eb !important;
}

#ll-tools-mode-switcher-wrap .ll-tools-mode-option.active,
#ll-tools-mode-switcher-wrap .ll-tools-mode-option[aria-checked="true"],
#ll-tools-mode-switcher-wrap .ll-tools-mode-option.active[disabled],
#ll-tools-mode-switcher-wrap .ll-tools-mode-option[aria-checked="true"][disabled],
#ll-tools-mode-switcher-wrap .ll-tools-mode-option.active[aria-disabled="true"],
#ll-tools-mode-switcher-wrap .ll-tools-mode-option[aria-checked="true"][aria-disabled="true"] {
    background: #15803d !important;
    background-color: #15803d !important;
    background-image: none !important;
    color: #ffffff !important;
    border: 1px solid #15803d !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25) !important;
}

#ll-tools-mode-switcher-wrap .ll-tools-mode-option:hover:not(.active):not([disabled]):not([aria-checked="true"]) {
    background: #f9fafb !important;
    background-color: #f9fafb !important;
    background-image: none !important;
    border-color: #d1d5db !important;
}

/* Prefer emoji-capable fonts for the small icons */
#ll-tools-mode-switcher-wrap .mode-icon,
#ll-tools-mode-switcher-wrap .mode-icon::before {
    font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji", system-ui, sans-serif !important;
    -webkit-text-size-adjust: none !important;
}
