/**
 * Reading Fluency Popover - Isolated Styles
 * ALL classes prefixed with .madlibs-* to avoid conflicts
 * NO global selectors - completely self-contained
 */

/* ===== SHIMMER BUTTON FRAMEWORK ===== */
:root {
    --shimmer-glow-hue: 222deg;
    --shimmer-shadow-hue: 180deg;
    --overlay-color: 0, 0, 0;
    --overlay-opacity: 0;
    --text-color: #ffffff;
    --border-color: rgba(255, 255, 255, 0.2);
    --shimmer-spring-easing: linear(
    0, 0.002, 0.01 0.9%, 0.038 1.8%, 0.156, 0.312 5.8%, 0.789 11.1%, 1.015 14.2%,
    1.096, 1.157, 1.199, 1.224 20.3%, 1.231, 1.231, 1.226, 1.214 24.6%,
    1.176 26.9%, 1.057 32.6%, 1.007 35.5%, 0.984, 0.968, 0.956, 0.949 42%,
    0.946 44.1%, 0.95 46.5%, 0.998 57.2%, 1.007, 1.011 63.3%, 1.012 68.3%,
    0.998 84%, 1
  );
    --shimmer-spring-duration: 1.33s;
    --fallback-spring-easing: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --fallback-spring-duration: 0.6s;
}

@property --shimmer-shimmer {
    syntax: "<angle>";
    inherits: false;
    initial-value: 33deg;
}

@keyframes shimmer-shimmer {
    0% {
        --shimmer-shimmer: 0deg;
    }
    100% {
        --shimmer-shimmer: 360deg;
    }
}

@keyframes shimmer-shine {
    0% {
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    55% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes shimmer-text {
    0% {
        background-position: 100% center;
    }
    100% {
        background-position: -100% center;
    }
}

/* Shimmer overlay */
.shimmer-shimmer {
    position: absolute;
    inset: calc(var(--inset, 40px) * -1);
    border-radius: inherit;
    pointer-events: none;
    mask-image: conic-gradient(
        from var(--shimmer-shimmer, 0deg),
        transparent 0%,
        transparent 20%,
        black 36%,
        black 45%,
        transparent 50%,
        transparent 70%,
        black 85%,
        black 95%,
        transparent 100%
    );
    mask-size: cover;
    mix-blend-mode: plus-lighter;
    animation: shimmer-shimmer 1s linear infinite both;
}

.madlibs-tab:hover .shimmer-shimmer::before,
.madlibs-tab:hover .shimmer-shimmer::after,
.madlibs-tab.active .shimmer-shimmer::before,
.madlibs-tab.active .shimmer-shimmer::after,
.madlibs-mode-btn:hover .shimmer-shimmer::before,
.madlibs-mode-btn:hover .shimmer-shimmer::after,
.madlibs-mode-btn.active .shimmer-shimmer::before,
.madlibs-mode-btn.active .shimmer-shimmer::after,
.madlibs-control-btn:hover .shimmer-shimmer::before,
.madlibs-control-btn:hover .shimmer-shimmer::after,
.madlibs-purchase-btn:hover .shimmer-shimmer::before,
.madlibs-purchase-btn:hover .shimmer-shimmer::after {
    opacity: 1;
    animation: shimmer-shine 1.2s ease-in 1 forwards;
}

.shimmer-shimmer::before,
.shimmer-shimmer::after {
    transition: all 0.5s ease;
    opacity: 0;
    content: "";
    border-radius: inherit;
    position: absolute;
    mix-blend-mode: color;
    inset: var(--inset, 40px);
    pointer-events: none;
}

.shimmer-shimmer::before {
    box-shadow: 0 0 calc(var(--inset, 40px) * 0.1)  2px hsl(var(--shimmer-glow-hue) 20% 95%),
        0 0 calc(var(--inset, 40px) * 0.18)  4px hsl(var(--shimmer-glow-hue) 20% 80%),
        0 0 calc(var(--inset, 40px) * 0.33)  4px hsl(var(--shimmer-glow-hue) 50% 70%),
        0 0 calc(var(--inset, 40px) * 0.66) 5px hsl(var(--shimmer-glow-hue) 100% 70%);
    z-index: -1;
}

.shimmer-shimmer::after {
    box-shadow: inset 0 0 0 1px hsl(var(--shimmer-glow-hue) 70% 95%),
        inset 0 0 2px 1px hsl(var(--shimmer-glow-hue) 100% 80%),
        inset 0 0 5px 2px hsl(var(--shimmer-glow-hue) 100% 70%);
    z-index: 2;
}

/* Shimmer text effect */
.shimmer-text {
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-color: var(--text-color);
    background-image: linear-gradient(120deg, var(--text-color), rgba(255, 255, 255, 1) 40%, rgba(230, 230, 255, 1) 50%, var(--text-color) 52%);
    background-repeat: no-repeat;
    background-size: 300% 300%;
    background-position: 0% center;
    transition: background-color 0.3s ease, background-image 0.3s ease;
}

.madlibs-tab:hover .shimmer-text,
.madlibs-tab.active .shimmer-text,
.madlibs-mode-btn:hover .shimmer-text,
.madlibs-mode-btn.active .shimmer-text,
.madlibs-control-btn:hover .shimmer-text,
.madlibs-purchase-btn:hover .shimmer-text {
    animation: shimmer-text .66s ease-in 1 both;
}

/* ===== Popover Container ===== */
.madlibs-popover {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 1rem;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}


.madlibs-popover.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ===== Backdrop ===== */
.madlibs-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

/* ===== Popover Content ===== */
.madlibs-content {
    position: relative;
    width: min(90vw, 56.25rem);
    max-height: 90vh;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    border: 0.0625rem solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 1.5625rem 3.125rem -0.75rem rgba(0, 0, 0, 0.5),
                inset 0 0.0625rem 0 rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 2;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.madlibs-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(var(--overlay-color), var(--overlay-opacity));
    pointer-events: none;
    z-index: 1000;
    transition: background 0.3s ease;
    border-radius: 1.5rem;
}

/* ===== Header ===== */
.madlibs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1001;
}

.madlibs-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease;
}

.madlibs-close-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.madlibs-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.madlibs-challenge-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.5rem;
    font-family: Georgia, serif;
    transition: color 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.madlibs-focus {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    margin: 0;
    transition: color 0.3s ease;
    font-style: italic;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== Tab Navigation ===== */
.madlibs-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 2rem 0;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1001;
}

.madlibs-tab {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 1.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 0.66em 0.66em 0 0;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.8;
    font-family: system-ui, -apple-system, sans-serif;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
}

.madlibs-tab:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: rgba(255, 255, 255, 0.2);
}

.madlibs-tab.active {
    background: rgba(255, 255, 255, 0.25);
    color: var(--text-color);
    opacity: 1;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

/* ===== Tab Content ===== */
.madlibs-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border-color);
    /* Hide scrollbar for all browsers */
    -ms-overflow-style: none;
    scrollbar-width: none;
    position: relative;
    z-index: 1001;
}

/* Hide scrollbar for WebKit browsers (Chrome, Safari, Edge) */
.madlibs-tab-content::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.madlibs-panel {
    display: none;
}

.madlibs-panel.active {
    display: block;
}

/* ===== Reading Panel ===== */
.madlibs-book-info {
    margin-bottom: 1.5rem;
    text-align: center;
}

.madlibs-book-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.5rem;
    font-family: Georgia, serif;
    transition: color 0.3s ease;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.madlibs-narrator {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
    margin: 0;
    transition: color 0.3s ease;
    font-style: italic;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== Mode Toggle ===== */
.madlibs-mode-toggle {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.madlibs-mode-btn {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 2rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 0.66em;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-color);
    opacity: 0.9;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.madlibs-mode-btn svg {
    flex-shrink: 0;
    stroke: var(--text-color);
    transition: stroke 0.3s ease;
}

.madlibs-mode-btn:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.madlibs-mode-btn.active {
    background: rgba(74, 144, 226, 0.5);
    border-color: var(--border-color);
    color: var(--text-color);
    opacity: 1;
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ===== Dot Controls ===== */
.madlibs-dot-controls-grid {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.madlibs-dot-control-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
}

.madlibs-dot-control {
    position: relative;
    width: 3em;
    height: 6em;
    margin: 0;
    cursor: pointer;
}

.madlibs-dot-control canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.madlibs-dot-control-label {
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.16rem;
    color: var(--text-color);
    opacity: 0.9;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.madlibs-dot-control-value {
    margin-top: 0.04rem;
    color: #4a90e2;
    font-size: 1.2rem;
    font-weight: 600;
}

/* ===== Text Container ===== */
.madlibs-text-container {
    min-height: 20rem;
    max-height: 30rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    position: relative;
    /* Hide scrollbar for all browsers */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Hide scrollbar for WebKit browsers (Chrome, Safari, Edge) */
.madlibs-text-container::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.madlibs-text {
    font-size: 1.1rem;
    line-height: 1.8;
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--text-color);
    text-shadow: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.3);
    transition: color 0.3s ease;
}

/* Paragraph formatting */
.madlibs-text p {
    margin: 0 0 1.5rem 0;
    line-height: 2;
}

/* Mad Libs Input Fields */
.madlibs-input {
    display: inline-block;
    min-width: 8rem;
    padding: 0.25rem 0.5rem;
    background: rgba(74, 144, 226, 0.15);
    border: 2px dashed rgba(74, 144, 226, 0.5);
    border-radius: 0.25rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
    margin: 0 0.25rem;
}

.madlibs-input:focus {
    outline: none;
    border-style: solid;
    border-color: rgba(74, 144, 226, 0.8);
    background: rgba(74, 144, 226, 0.25);
}

.madlibs-input::placeholder {
    color: rgba(74, 144, 226, 0.6);
    font-style: italic;
}

.madlibs-input-label {
    display: inline-block;
    font-size: 0.75rem;
    color: rgba(74, 144, 226, 0.8);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.25rem;
}

/* ===== Word Highlighting ===== */
.madlibs-word {
    display: inline;
}

.madlibs-word--highlighted {
    /* Removed highlighting - text will just scroll */
}

/* ===== Playback Controls ===== */
.madlibs-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.madlibs-control-btn {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 1.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 0.66em;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text-color);
    opacity: 0.9;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.madlibs-control-btn svg {
    flex-shrink: 0;
    stroke: var(--text-color);
    transition: stroke 0.3s ease;
}

.madlibs-control-btn:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ===== Timeline Scrubber ===== */
.madlibs-timeline {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.madlibs-time-display {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: system-ui, -apple-system, sans-serif;
    min-width: 3rem;
    text-align: center;
}

.madlibs-timeline-scrubber {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.madlibs-timeline-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.madlibs-timeline-scrubber::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.madlibs-timeline-scrubber::-webkit-slider-thumb:hover {
    background: #357abd;
    transform: scale(1.1);
}

.madlibs-timeline-scrubber::-moz-range-thumb:hover {
    background: #357abd;
    transform: scale(1.1);
}

/* ===== Volume Control ===== */
.madlibs-volume-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.madlibs-volume-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: system-ui, -apple-system, sans-serif;
    min-width: 4rem;
}

.madlibs-volume-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.madlibs-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.madlibs-volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.madlibs-volume-slider::-webkit-slider-thumb:hover {
    background: #357abd;
    transform: scale(1.1);
}

.madlibs-volume-slider::-moz-range-thumb:hover {
    background: #357abd;
    transform: scale(1.1);
}

.madlibs-volume-value {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: system-ui, -apple-system, sans-serif;
    min-width: 3rem;
    text-align: right;
}

/* ===== Progress Bar ===== */
.madlibs-progress {
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.madlibs-progress-bar {
    height: 100%;
    background: #4a90e2;
    width: 0%;
    transition: width 0.2s ease;
}

/* ===== Quiz Panel ===== */
.madlibs-quiz {
    max-width: 700px;
    margin: 0 auto;
}

.madlibs-quiz-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    transition: color 0.3s ease;
    margin: 0 0 0.5rem;
    font-family: system-ui, -apple-system, sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.madlibs-quiz-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.madlibs-quiz-questions {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.madlibs-question {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.madlibs-question-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    transition: color 0.3s ease;
    margin: 0 0 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.madlibs-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.madlibs-option {
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.madlibs-option:hover {
    border-color: rgba(74, 144, 226, 0.6);
    background: rgba(255, 255, 255, 0.1);
}

.madlibs-option.selected {
    border-color: rgba(74, 144, 226, 0.8);
    background: rgba(74, 144, 226, 0.2);
}

.madlibs-option.correct {
    border-color: #4caf50;
    background: #e8f5e9;
}

.madlibs-option.incorrect {
    border-color: #f44336;
    background: #ffebee;
}

/* ===== Quiz Results ===== */
.madlibs-quiz-results {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem;
    background: white;
    border-radius: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.madlibs-retry-btn {
    margin-top: 1rem;
    padding: 0.75rem 2rem;
    border: none;
    background: #4a90e2;
    color: white;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.madlibs-retry-btn:hover {
    background: #357abd;
}

/* ===== Instructions Panel ===== */
.madlibs-instructions {
    max-width: 700px;
    margin: 0 auto;
}

.madlibs-instructions-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    transition: color 0.3s ease;
    margin: 0 0 0.5rem;
    font-family: system-ui, -apple-system, sans-serif;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.madlibs-instructions-subtitle {
    font-size: 0.95rem;
    color: var(--text-color);
    opacity: 0.8;
    margin: 0 0 2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.madlibs-instructions-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.madlibs-instruction-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.madlibs-instruction-term {
    font-size: 1.25rem;
    font-weight: 700;
    color: rgba(74, 144, 226, 0.9);
    margin: 0 0 0.5rem;
    font-family: Georgia, serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.madlibs-instruction-definition {
    font-size: 1rem;
    color: var(--text-color);
    opacity: 0.9;
    margin: 0 0 0.75rem;
    transition: color 0.3s ease;
}

.madlibs-instruction-example {
    font-size: 0.95rem;
    color: var(--text-color);
    opacity: 0.7;
    font-style: italic;
    padding-left: 1rem;
    border-left: 3px solid rgba(74, 144, 226, 0.6);
    transition: color 0.3s ease;
    margin: 0;
}

/* ===== Learning Content Panel ===== */
.madlibs-learning-content {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.madlibs-learning-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.madlibs-learning-subtitle {
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 2rem;
    transition: color 0.3s ease;
}

.madlibs-learning-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
    transition: all 0.3s ease;
}

.madlibs-learning-section-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.madlibs-learning-section-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    transition: color 0.3s ease;
}

/* ===== Action Buttons ===== */
.madlibs-actions {
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    z-index: 1001;
}

.madlibs-action-btns {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.madlibs-action-btn {
    --inset: 40px;
    position: relative;
    isolation: isolate;
    padding: 0.75rem 2rem;
    background: #4a90e2;
    color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0.66em;
    font-size: 1rem;
    font-weight: 600;
    font-family: system-ui, -apple-system, sans-serif;
    cursor: pointer;
    transition: all var(--shimmer-spring-duration) var(--shimmer-spring-easing);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3),
                0 2px 4px rgba(0, 0, 0, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.madlibs-action-btn:hover {
    transition-duration: calc(var(--shimmer-spring-duration)*0.5);
    background: #357abd;
    box-shadow: 0 8px 20px rgba(74, 144, 226, 0.5),
                0 4px 8px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* ===== Utility Classes ===== */
.madlibs-popover .hidden {
    display: none !important;
}

/* ===== Traditional Controls (Mobile) ===== */
.madlibs-traditional-controls {
    display: none;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.madlibs-traditional-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.madlibs-traditional-control label {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.madlibs-traditional-control input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    outline: none;
}

.madlibs-traditional-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.madlibs-traditional-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4a90e2;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.madlibs-traditional-control span {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a90e2;
    text-align: center;
}

.madlibs-mobile-controls {
    display: none;
}

.madlibs-mobile-mode-toggle {
    display: none;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    /* Hide dot controls on mobile */
    .madlibs-dot-controls-grid {
        display: none !important;
    }

    /* Show traditional controls on mobile */
    .madlibs-traditional-controls {
        display: flex;
    }

    .madlibs-mobile-controls {
        display: flex;
    }

    .madlibs-mobile-mode-toggle {
        display: flex;
    }

    .madlibs-content {
        width: 95vw;
        max-height: 95vh;
    }

    .madlibs-header {
        padding: 1rem 1.5rem;
    }

    .madlibs-title {
        font-size: 1.25rem;
    }

    .madlibs-tabs {
        padding: 0.75rem 1rem;
        gap: 0.25rem;
    }

    .madlibs-tab {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .madlibs-tab-content {
        padding: 1.5rem 1rem;
    }

    .madlibs-text {
        font-size: 1rem;
        line-height: 1.8;
    }

    .madlibs-mode-toggle {
        flex-direction: column;
    }

    .madlibs-mode-btn {
        width: 100%;
    }

    .madlibs-purchase-btns {
        flex-direction: column;
    }

    .madlibs-purchase-btn {
        width: 100%;
    }
}


/* Correct/Incorrect states */
.madlibs-input.correct {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.8);
    border-style: solid;
}

.madlibs-input.incorrect {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.8);
    border-style: solid;
}
