/**
 * Normally Widget CSS
 * Simple and functional accessibility widget
 */

/* Widget container */
#normally-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    --accent: var(--normally-accent, #1698B5);
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #475569;
}

/* Overlay for modal behavior */
#normally-widget-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: saturate(120%) blur(1.5px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease;
}

#normally-widget.is-open + #normally-widget-overlay,
#normally-widget-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Position classes */
#normally-widget.normally-widget-bottom-right {
    bottom: 24px;
    right: 24px;
}

#normally-widget.normally-widget-bottom-left {
    bottom: 24px;
    left: 24px;
}

#normally-widget.normally-widget-top-right {
    top: 24px;
    right: 24px;
}

#normally-widget.normally-widget-top-left {
    top: 24px;
    left: 24px;
}

/* Toggle button */
.normally-widget-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--normally-accent, var(--accent)) 0%, color-mix(in oklab, var(--normally-accent, var(--accent)) 85%, black) 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.normally-widget-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.normally-widget-toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.normally-widget-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25), 0 4px 8px rgba(0, 0, 0, 0.15);
}

.normally-widget-toggle:hover::before {
    opacity: 1;
}

.normally-widget-toggle:hover::after {
    width: 120%;
    height: 120%;
}

.normally-widget-toggle:active {
    transform: scale(0.95);
}

.normally-widget-toggle:focus {
    outline: 3px solid color-mix(in oklab, var(--normally-accent, var(--accent)) 50%, white);
    outline-offset: 3px;
}

.normally-widget-toggle svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: #fff;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

/* Widget content panel */
.normally-widget-content {
    position: absolute;
    width: 380px;
    max-width: calc(100vw - 48px);
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    box-shadow: 
        0 30px 60px -12px rgba(50, 50, 93, 0.25),
        0 18px 36px -18px rgba(0, 0, 0, 0.3),
        0 -12px 36px -8px rgba(0, 0, 0, 0.025);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    backdrop-filter: blur(10px);
    transform-origin: var(--origin, center bottom);
}

@keyframes widgetPulse {
    0%, 100% { box-shadow: 0 30px 60px -12px rgba(50, 50, 93, 0.25), 0 18px 36px -18px rgba(0, 0, 0, 0.3), 0 -12px 36px -8px rgba(0, 0, 0, 0.025); }
    50% { box-shadow: 0 30px 60px -12px rgba(50, 50, 93, 0.35), 0 18px 36px -18px rgba(0, 0, 0, 0.4), 0 -12px 36px -8px rgba(0, 0, 0, 0.035); }
}

/* Content positioning */
#normally-widget.normally-widget-bottom-right .normally-widget-content {
    bottom: 70px;
    right: 0;
}

#normally-widget.normally-widget-bottom-left .normally-widget-content {
    bottom: 70px;
    left: 0;
}

#normally-widget.normally-widget-top-right .normally-widget-content {
    top: 70px;
    right: 0;
}

#normally-widget.normally-widget-top-left .normally-widget-content {
    top: 70px;
    left: 0;
}

/* Open state */
#normally-widget.is-open .normally-widget-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    animation: widgetPulse 4s ease-in-out infinite;
}

#normally-widget.is-open .normally-widget-toggle {
    animation: toggleRotate 20s linear infinite;
}

@keyframes toggleRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Unset inert for compatible browsers - allow scrolling but block other interactions */
[inert] { 
    pointer-events: none; 
}
[inert]::-webkit-scrollbar {
    pointer-events: auto;
}
/* Allow scroll on inert elements */
[inert] {
    overflow: auto !important;
}

/* Header */
.normally-widget-header {
    background: linear-gradient(135deg, var(--normally-accent, var(--accent)) 0%, color-mix(in oklab, var(--normally-accent, var(--accent)) 90%, black) 100%);
    color: white;
    padding: 20px 18px 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.normally-widget-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.normally-widget-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.01em;
    position: relative;
    z-index: 1;
}

.normally-widget-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.normally-widget-close::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.normally-widget-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}

.normally-widget-close:hover::before {
    width: 100%;
    height: 100%;
}

.normally-widget-close:active {
    transform: rotate(90deg) scale(0.9);
}

/* Body */
.normally-widget-body {
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Feature group title */
.feature-group-title {
    margin: 10px 0 6px 2px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--text-muted);
}

/* Headings panel */
.normally-headings-panel {
    position: relative;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    padding: 0;
    max-height: 40vh;
    overflow: auto;
    margin-top: 10px;
}
.normally-headings-panel-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 8px 12px;
}
.normally-headings-panel-body { padding: 8px 12px; }
.normally-widget-theme-dark .normally-headings-panel {
    background: #121212;
    color: #eaeaea;
    border-color: #2a2a2a;
}
.normally-headings-panel-header{
    display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;
}
.normally-headings-list{
    list-style: none;
    padding: 0;
    margin: 0;
}
.normally-headings-list li{padding:6px 4px;border-bottom:1px dashed #eee;cursor:pointer}
.normally-headings-list li:hover{background:#e3f2fd}
.normally-widget-theme-dark .normally-headings-list li:hover{background:#1b2a38}
.normally-no-headings{padding:8px 4px;color:#666}
.normally-headings-list li .lvl { font-size: 11px; color: #64748b; margin-right: 6px; }
.normally-headings-list li.warning { background: #fff7ed; border-color: #fed7aa; }

/* Make single last item span full width to avoid holes */
.feature-group > *:last-child:nth-child(odd) { grid-column: 1 / -1; }
/* Ensure profiles block spans full width */
.feature-group .normally-widget-profiles-wrap { grid-column: 1 / -1; }

/* Make speech button span full width */
.feature-group [data-feature="speech-cyclique"] { grid-column: 1 / -1; }

/* Speech controls */
.normally-speech-controls { 
    display: none; 
    margin-top: 12px; 
    padding: 12px; 
    border: 1px solid var(--border); 
    border-radius: 10px; 
    background: var(--surface-2);
    width: 100%;
    box-sizing: border-box;
}
.normally-speech-controls.is-visible { 
    display: block;
}
.normally-speech-controls .row { 
    display: flex; 
    gap: 8px; 
    align-items: center; 
    margin: 8px 0; 
}
.normally-speech-controls label { 
    font-size: 12px; 
    color: var(--text-muted); 
    min-width: 60px; 
    flex-shrink: 0;
}
.normally-speech-controls select, 
.normally-speech-controls input[type="range"] { 
    flex: 1; 
}
.normally-speech-stop {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    width: 100%;
}
.normally-speech-stop:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Font controls */
.normally-widget-font-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}

.normally-widget-font-controls:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.normally-widget-font-controls-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.normally-widget-font-controls-item:first-child{flex:1}
.normally-widget-font-controls-item:last-child{justify-content:center}
.normally-widget-font-label{
    min-width:60px;
    text-align:center;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.normally-widget-font-decrease,
.normally-widget-font-increase,
.normally-widget-zoom-out,
.normally-widget-zoom-in {
    width: 36px;
    height: 36px;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.normally-widget-font-decrease::before,
.normally-widget-font-increase::before,
.normally-widget-zoom-out::before,
.normally-widget-zoom-in::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--normally-accent, #1698B5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
    opacity: 0.1;
}

.normally-widget-font-decrease:hover,
.normally-widget-font-increase:hover,
.normally-widget-zoom-out:hover,
.normally-widget-zoom-in:hover {
    background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%);
    color: var(--normally-accent, #1698B5);
    border-color: var(--normally-accent, #1698B5);
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.normally-widget-font-decrease:hover::before,
.normally-widget-font-increase:hover::before,
.normally-widget-zoom-out:hover::before,
.normally-widget-zoom-in:hover::before {
    width: 100%;
    height: 100%;
    opacity: 0.1;
}

.normally-widget-font-decrease:active,
.normally-widget-font-increase:active,
.normally-widget-zoom-out:active,
.normally-widget-zoom-in:active {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.normally-widget-zoom-level {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--accent);
}

/* Feature grid */
.feature-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
    grid-auto-rows: 1fr;
}

/* Feature buttons */
.normally-feature-button {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 16px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 90px;
    height: 100%;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: #374151;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.05),
        0 1px 2px rgba(0, 0, 0, 0.1);
    transform-style: preserve-3d;
    perspective: 1000px;
}

@keyframes featureShimmer {
    0% { transform: translateX(-100%) translateZ(0); }
    100% { transform: translateX(100%) translateZ(0); }
}

.normally-feature-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    transform: translateX(-100%) translateZ(0);
    transition: none;
}

.normally-feature-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(0, 0, 0, 0.02) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.normally-feature-button span {
    white-space: nowrap;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
    position: relative;
    z-index: 1;
}

.normally-feature-button:hover {
    background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%);
    border-color: var(--normally-accent, #1698B5);
    transform: translateY(-4px) translateZ(20px) rotateX(-5deg);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.15),
        0 5px 10px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.normally-feature-button:hover::before {
    opacity: 1;
}

.normally-feature-button:hover::after {
    animation: featureShimmer 0.8s ease-out;
}

.normally-feature-button:focus {
    outline: 2px solid var(--normally-accent, #1698B5);
    outline-offset: 2px;
}

.normally-feature-button.is-active,
.normally-feature-button[aria-checked="true"] {
    background: linear-gradient(135deg, var(--normally-accent, #1698B5) 0%, color-mix(in oklab, var(--normally-accent, #1698B5) 85%, black) 100%);
    border-color: var(--normally-accent, #1698B5);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.normally-feature-button.is-active::after,
.normally-feature-button[aria-checked="true"]::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.normally-feature-button svg {
    width: 22px;
    height: 22px;
    position: relative;
    z-index: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1) translateY(0); }
    25% { transform: scale(1.2) translateY(-2px); }
    75% { transform: scale(0.95) translateY(1px); }
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-3px) rotate(5deg); }
}

.normally-feature-button:hover svg {
    animation: iconBounce 0.6s ease-out;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.normally-feature-button.is-active svg,
.normally-feature-button[aria-checked="true"] svg {
    animation: iconFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Step dots (3-step indicators) */
.normally-step-dots {
    display: inline-flex;
    gap: 6px;
    margin-top: 4px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
}

.normally-feature-button .normally-step-dots {
    margin-top: auto;
}

.normally-step-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    display: inline-block;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.8; }
}

.normally-step-dots span::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--normally-accent, #1698B5);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.3s ease;
}

.normally-feature-button.step-0 .normally-step-dots span:nth-child(1),
.normally-feature-button.step-1 .normally-step-dots span:nth-child(-n+2),
.normally-feature-button.step-2 .normally-step-dots span:nth-child(-n+3),
.normally-feature-button.step-3 .normally-step-dots span:nth-child(-n+4) {
    background: var(--normally-accent, #1698B5);
    animation: dotPulse 2s ease-in-out infinite;
}

.normally-feature-button.step-1 .normally-step-dots span:nth-child(2) { animation-delay: 0.2s; }
.normally-feature-button.step-2 .normally-step-dots span:nth-child(2) { animation-delay: 0.2s; }
.normally-feature-button.step-2 .normally-step-dots span:nth-child(3) { animation-delay: 0.4s; }
.normally-feature-button.step-3 .normally-step-dots span:nth-child(2) { animation-delay: 0.2s; }
.normally-feature-button.step-3 .normally-step-dots span:nth-child(3) { animation-delay: 0.4s; }
.normally-feature-button.step-3 .normally-step-dots span:nth-child(4) { animation-delay: 0.6s; }

/* Profiles */
.normally-widget-profiles-wrap {
    margin-bottom: 16px;
}

.normally-widget-profiles-toggle {
    width: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.normally-widget-profiles-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, 
        #4285f4 0%, 
        #34a853 25%, 
        #fbbc04 50%, 
        #ea4335 75%, 
        #9c27b0 100%
    );
    opacity: 0.8;
}

.normally-widget-profiles-toggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.normally-widget-profiles-toggle span {
    flex: 1;
    text-align: left;
}

.normally-widget-profiles-toggle::after {
    content: '▼';
    font-size: 10px;
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.normally-widget-profiles-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
}

.normally-widget-profiles-toggle:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
    border-color: var(--normally-accent, #1698B5);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.normally-widget-profiles-menu {
    margin-top: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    display: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.normally-profile-btn {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
}

.normally-profile-btn:hover {
    background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%);
    border-color: var(--normally-accent, #1698B5);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.normally-profile-btn.active {
    background: var(--normally-accent, #1698B5);
    color: white;
    border-color: var(--normally-accent, #1698B5);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.normally-profile-btn.active::before {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    background: white;
    color: var(--normally-accent, #1698B5);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: checkmarkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkmarkPop {
    0% { transform: scale(0) rotate(-180deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Add glow effect to active profile */
.normally-profile-btn.active {
    animation: profileGlow 2s ease-in-out infinite alternate;
}

@keyframes profileGlow {
    0% { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
    100% { box-shadow: 0 2px 12px var(--normally-accent-shadow, rgba(22, 152, 181, 0.4)); }
}

/* Reset button */
.normally-widget-reset {
    width: 100%;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #f87171;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    color: #991b1b;
    font-size: 14px;
    line-height: 1.4;
    min-height: 44px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.1);
}

.normally-widget-reset::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.normally-widget-reset span {
    position: relative;
    z-index: 1;
}

.normally-widget-reset:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 38, 38, 0.2);
    color: white;
    border-color: #dc2626;
}

.normally-widget-reset:hover::before {
    opacity: 1;
    color: white;
}

.normally-widget-reset:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.2);
}

.normally-widget-reset svg {
    width: 18px;
    height: 18px;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.normally-widget-reset:hover svg {
    transform: rotate(-360deg);
}

/* Toast */
#normally-widget-toast {
    position: fixed;
    z-index: 10000;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.8) 100%);
    color: white;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    max-width: 300px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.3),
        0 5px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

#normally-widget-toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

#normally-widget-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

#normally-widget-toast.is-visible::before {
    left: 100%;
}

@keyframes toastShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.toast-bottom-right {
    bottom: 80px;
    right: 24px;
}

.toast-bottom-left {
    bottom: 80px;
    left: 24px;
}

.toast-top-right {
    top: 80px;
    right: 24px;
}

.toast-top-left {
    top: 80px;
    left: 24px;
}

/* Loading effect */
@keyframes loadingPulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.normally-widget-content.is-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        transparent 25%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 75%
    );
    background-size: 200% 200%;
    animation: loadingSweep 1.5s linear infinite;
    pointer-events: none;
}

@keyframes loadingSweep {
    0% { background-position: 200% 200%; }
    100% { background-position: -200% -200%; }
}

/* Particle effects */
@keyframes particleFloat {
    0% { transform: translateY(0) translateX(0) scale(0); opacity: 0; }
    10% { transform: translateY(-10px) translateX(5px) scale(1); opacity: 1; }
    90% { transform: translateY(-100px) translateX(20px) scale(0.5); opacity: 0.5; }
    100% { transform: translateY(-120px) translateX(25px) scale(0); opacity: 0; }
}

.normally-feature-button::after {
    animation-duration: 2s;
    animation-timing-function: ease-out;
}

/* Accessibility classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.normally-hidden-media {
    visibility: hidden;
}

.normally-highlighted {
    outline: 3px solid #ff6b35;
    outline-offset: 2px;
    background: rgba(255, 107, 53, 0.1);
}
.normally-weak-link{outline:2px dashed #ff6b35;outline-offset:2px}

/* TTS highlight */
/* TTS Highlight styles */
.normally-tts-highlight { 
    background: #fff3c4 !important; 
    outline: 3px solid #f59e0b !important; 
    outline-offset: 2px !important;
    border-radius: 4px !important;
    position: relative !important;
    z-index: 100 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4) !important;
}

/* Animation for highlight */
@keyframes highlightPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.normally-tts-highlight {
    animation: highlightPulse 2s ease-in-out infinite !important;
}

/* Reading mask */
#normally-reading-mask-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    clip-path: polygon(
        0 0, 
        100% 0, 
        100% var(--mask-top, 45vh), 
        0 var(--mask-top, 45vh),
        0 var(--mask-bottom, 55vh),
        100% var(--mask-bottom, 55vh),
        100% 100%, 
        0 100%
    );
}

/* Feature applications */
#normally-accessibility-wrapper.normally-contrast-dark {
    background: #000;
    color: #fff;
}

/* Zoom via CSS var */
/* Removed transform scale from wrapper to avoid breaking position:fixed elements */
#normally-accessibility-wrapper { 
    /* Zoom is now handled via document.body.style.zoom in JavaScript */
}

#normally-accessibility-wrapper.normally-contrast-dark *:not([class*="normally-"]) {
    background: #000;
    color: #fff;
    border-color: #444;
}

#normally-accessibility-wrapper.normally-contrast-yellow-black {
    background: #ffff00;
    color: #000;
}

#normally-accessibility-wrapper.normally-contrast-invert {
    filter: invert(1) hue-rotate(180deg);
}

#normally-accessibility-wrapper.normally-dyslexic-font * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', cursive;
}

#normally-accessibility-wrapper.normally-focus-highlight *:focus {
    outline: 3px solid #ff6b35;
    outline-offset: 2px;
}

#normally-accessibility-wrapper.normally-underline-links a {
    text-decoration: underline;
}

#normally-accessibility-wrapper.normally-underline-headings h1,
#normally-accessibility-wrapper.normally-underline-headings h2,
#normally-accessibility-wrapper.normally-underline-headings h3,
#normally-accessibility-wrapper.normally-underline-headings h4,
#normally-accessibility-wrapper.normally-underline-headings h5,
#normally-accessibility-wrapper.normally-underline-headings h6 {
    text-decoration: underline;
}

body.normally-reading-mask-enabled #normally-reading-mask-overlay {
    display: block;
}

#normally-accessibility-wrapper.normally-grayscale {
    filter: grayscale(1);
}

#normally-accessibility-wrapper.normally-reduce-motion * {
    animation: none !important;
    transition: none !important;
}

/* Magnifier */
.normally-magnifier {
    position: fixed;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    border: 2px solid rgba(255,255,255,0.8);
    pointer-events: none;
    z-index: 10050;
    background-repeat: no-repeat;
    background-size: 200% 200%;
    overflow: hidden;
    display: none;
    backdrop-filter: none;
}

/* Themes for widget shell */
.normally-widget-theme-dark .normally-widget-content {
    background: #121212;
    color: #eaeaea;
    border-color: #2a2a2a;
}
.normally-widget-theme-dark .normally-widget-header {
    background: #0e0e0e;
}
.normally-widget-theme-light .normally-widget-content {
    background: #ffffff;
    color: #222;
}

/* Responsive */
@media (max-width: 640px) {
    .normally-widget-content {
        width: calc(100vw - 24px);
    }
    
    .feature-group {
        grid-template-columns: 1fr;
    }
    
    .normally-widget-font-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .normally-widget-profiles-menu {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .normally-widget-toggle {
        width: 48px;
        height: 48px;
    }
    
    .normally-widget-toggle svg {
        width: 20px;
        height: 20px;
    }
}