@view-transition {
    navigation: auto;
}

:root {
    --primary: #005B96;
    /* Synonymer Deep Blue */
    --primary-hover: #004a7a;
    --accent: #33A1FD;
    /* Synonymer Bright Blue (Card Border) */
    --background: #F9FAFB;
    /* Clean White/Gray from image */
    --surface: #ffffff;
    --surface-secondary: #EDF7FF;
    /* Very faint blue for secondary */
    --text-main: #2C3E50;
    /* Dark Blue-Gray */
    --text-secondary: #586e82;
    --border: #e5e7eb;
    --shadow: 0 2px 8px rgba(0, 91, 150, 0.1);
    /* Subtle blue shadow */
    --radius: 1rem;
    --header-font: 'Inter', sans-serif;
    --body-font: 'Inter', sans-serif;
    --arabic-font: 'Tajawal', sans-serif;
}

[data-theme="dark"] {
    /* Primary Colors - More vibrant */
    --primary: #6366F1;
    --primary-hover: #818cf8;
    --accent: #38BDF8;

    /* Backgrounds - Darker, more neutral */
    --background: #0F172A;
    --surface: #1E293B;
    --surface-raised: #334155;
    --surface-hover: #475569;

    /* Text - Improved contrast */
    --text-main: #F1F5F9;
    --text-secondary: #38BDF8;
    --text-tertiary: #94a3b8;
    --text-disabled: #64748b;

    /* Borders */
    --border: #475569;
    --border-subtle: #334155;
    --border-focus: #818cf8;

    /* States */

    /* Shadows */
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
    padding: 0;
}

/* Expert Touch: Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Expert Touch: Tactile Feedback */
button:active,
.action-btn:active,
.menu-item:active,
.nav-btn:active,
.game-btn:active {
    transform: scale(0.95);
}

/* Clear Button */
.clear-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.clear-btn:hover {
    color: var(--primary);
}

body {
    font-family: var(--body-font);
    background: var(--background);
    /* Solid color from image */
    /* Light blue gradient */
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem;
    overflow-x: hidden;
    /* Prevent scrollbar from orbs */
    position: relative;
}

/* Ambient Background */
body::before,
body::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.4;
    animation: float-orb 20s infinite alternate;
}

body::before {
    background: var(--primary);
    top: -100px;
    left: -100px;
}

body::after {
    background: var(--accent);
    bottom: -100px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes float-orb {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(100px, 50px) rotate(20deg);
    }
}

[data-theme="dark"] body::before {
    opacity: 0.2;
    background: #4f46e5;
}

[data-theme="dark"] body::after {
    opacity: 0.2;
    background: #0ea5e9;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

/* iPhone View Simulation */
body.iphone-view {
    max-width: 393px;
    margin: 2rem auto;
    border: 12px solid #333;
    border-radius: 50px;
    min-height: calc(100vh - 4rem);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    overflow-x: hidden;
    position: relative;
}

body.iphone-view::before {
    /* Notch / Dynamic Island Simulation */
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 35px;
    background-color: #000;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    z-index: 1000;
    pointer-events: none;
}

/* iPhone View specific navigation fixes */
body.iphone-view .top-nav {
    padding: 0.5rem 0.25rem;
}

body.iphone-view .nav-right,
body.iphone-view .nav-left {
    max-width: 45px;
}

body.iphone-view .game-btn,
body.iphone-view .theme-toggle {
    width: 38px;
    height: 38px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Header & Search */
header {
    text-align: center;
    margin-bottom: 0.5rem;
    /* Reduced further */
    animation: fadeIn 0.8s ease-out;
    position: relative;
    padding-top: 7.5rem;
    /* Increased for stacked buttons */
    backdrop-filter: blur(5px);
    /* Slight blur for header area */
}

.main-title-text {
    font-size: 1.5rem;
    font-weight: 900;
    margin: 0;
    line-height: 1.5;
    /* Gradient: Red, Green, White */
    background: linear-gradient(to right, #EF4444 0%, #10B981 50%, #FFFFFF 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;

    /* Gradient Flow Setup */
    background-size: 200% auto;

    /* Static Gradient for stability */
    background: linear-gradient(to right, #EF4444, #10B981, #EF4444);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;

    /* Shadow for Light Mode (Dark shadow) */
    filter: drop-shadow(1px 1px 0px rgba(0, 0, 0, 0.5)) drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.3));
}

/* Dark Mode Shadow (Lighter shadow/glow for contrast) */
[data-theme="dark"] .main-title-text {
    filter: drop-shadow(1px 1px 0px rgba(255, 255, 255, 0.3)) drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
}

.subtitle-delay {
    animation-delay: 1s;
    /* Staggered animation like in details view */
    margin-top: -0.5rem;
    /* Pull closer to the first line */
}

.main-title-text:hover {
    animation-play-state: paused;
    filter: drop-shadow(2px 2px 0px rgba(0, 0, 0, 0.6));
}

/* Fun Animation for Details Page */
.details-anim {
    background-size: 200% auto;
    animation: gradient-flow 3s linear infinite, fun-bounce 2s ease-in-out infinite;
}

@keyframes gradient-flow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes fun-bounce {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-5px) rotate(-2deg);
    }

    50% {
        transform: translateY(0) rotate(0deg);
    }

    75% {
        transform: translateY(-3px) rotate(2deg);
    }
}

/* Opposite Animation for Subtitle */
.subtitle-anim {
    /* Gradient: Blue, Yellow */
    background: linear-gradient(to right, #3B82F6 0%, #EAB308 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    background-size: 200% auto;
    font-weight: 700;

    /* Reverse Gradient Flow + Exact Counter Bounce */
    animation: reverse-gradient-flow 3s linear infinite, counter-bounce 2s ease-in-out infinite;
    animation-delay: 0s !important;

    display: inline-block;
}

@keyframes reverse-gradient-flow {
    0% {
        background-position: 100% 50%;
    }

    50% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 100% 50%;
    }
}

@keyframes counter-bounce {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(5px) rotate(2deg);
    }

    /* Exact inverse of -5px, -2deg */
    50% {
        transform: translateY(0) rotate(0deg);
    }

    75% {
        transform: translateY(3px) rotate(-2deg);
    }

    /* Exact inverse of -3px, 2deg */
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    5% {
        transform: scale(1.1);
    }

    10% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.1);
    }

    20% {
        transform: scale(1);
    }

    100% {
        transform: scale(1);
    }
}

.header-center {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    padding-top: max(1rem, env(safe-area-inset-top));
    /* Safe area for Notch/Dynamic Island */
    z-index: 10;
}

.header-left-controls {
    display: flex;
    flex-direction: row;
    /* Changed from column to row */
    gap: 0.5rem;
    pointer-events: auto;
}

.header-right-controls {
    display: flex;
    flex-direction: row;
    /* Changed to row for consistency */
    gap: 0.5rem;
    align-items: center;
    pointer-events: auto;
    z-index: 20;
}

.theme-toggle {
    background-color: var(--surface);
    border: 2px solid transparent;
    cursor: pointer;
    color: var(--text-main);
    padding: 0;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    width: 45px;
    height: 45px;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Game Buttons (Matching Settings Button) */
.game-btn {
    background-color: var(--surface);
    border: 2px solid transparent;
    cursor: pointer;
    color: var(--text-main);
    padding: 0;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    width: 45px;
    height: 45px;
    box-shadow: var(--shadow);
    text-decoration: none;
}

.game-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

[data-theme="dark"] .game-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Add Button in Header */
.add-button {
    /* Removed absolute positioning */
    color: var(--text-main);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    /* Re-enable clicks */
}

.add-button:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .add-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

[data-theme="dark"] .sun-icon {
    display: block;
}

[data-theme="dark"] .moon-icon {
    display: none;
}

/* Action Buttons (Export/Import) */
.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    color: var(--text-main);
}

.export-btn {
    color: #3b82f6;
    /* Blue */
    border-color: rgba(59, 130, 246, 0.2);
    background-color: rgba(59, 130, 246, 0.05);
}

.import-btn {
    color: #10b981;
    /* Green */
    border-color: rgba(16, 185, 129, 0.2);
    background-color: rgba(16, 185, 129, 0.05);
}

.export-btn:hover {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.import-btn:hover {
    background-color: #10b981;
    color: white;
    border-color: #10b981;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

[data-theme="dark"] .export-btn:hover {
    background-color: rgba(59, 130, 246, 0.2);
}

[data-theme="dark"] .import-btn:hover {
    background-color: rgba(16, 185, 129, 0.2);
}

/* Settings Dropdown */
.settings-dropdown {
    position: relative;
}

.settings-menu {
    position: absolute;
    top: 120%;
    left: 0;
    width: 220px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 1rem;
    padding: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: slideDown 0.2s ease-out;
}

[data-theme="dark"] .settings-menu {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    color: var(--text-main);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
}

.menu-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0.5rem;
}

/* Top Navigation Bar */
.top-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    z-index: 50;
    pointer-events: none;
    /* Let clicks pass through empty space */
}

.nav-left {
    display: flex;
    gap: 0.5rem;
    pointer-events: auto;
    flex: 0 0 88px;
    /* Fixed width for perfect balance */
    justify-content: flex-start;
}

.nav-center {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    /* Let clicks pass */
    text-align: center;
}

.nav-right {
    display: flex;
    flex-direction: column;
    /* Stack buttons vertically */
    gap: 0.5rem;
    pointer-events: auto;
    flex: 0 0 88px;
    /* Fixed width for perfect balance */
    align-items: flex-end;
    /* Align to the right */
    justify-content: center;
}

.nav-center .main-title-text {
    font-size: 1rem;
    /* Smaller base size */
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    -webkit-background-clip: text;
    background-clip: text;
    /* Standard property */
    -webkit-text-fill-color: transparent;
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    /* Force single line */
    text-align: center;
}

@media (max-width: 400px) {
    .nav-center .main-title-text {
        font-size: 0.8rem;
        /* Even smaller on mobile to fit */
    }

    .top-nav {
        padding: 0.5rem;
        /* Reduce padding on small screens */
    }

    /* Fix right buttons to stay within screen */
    .nav-right {
        flex: 0 0 auto;
        max-width: 45px;
        align-items: center;
        margin-right: 0;
        padding-right: 0;
    }

    .nav-left {
        flex: 0 0 auto;
        max-width: 45px;
        margin-left: 0;
        padding-left: 0;
    }

    /* Ensure buttons fit */
    .game-btn,
    .theme-toggle {
        width: 40px;
        height: 40px;
    }
}

.nav-center .subtitle-delay {
    font-size: 1rem;
    /* Match main title */
    opacity: 1;
    display: block;
    margin-top: 0.1rem;
    white-space: nowrap;
    /* Force single line */

    /* Contrast & Color Update */
    background: none;
    -webkit-text-fill-color: initial;
    color: #2563EB;
    /* Darker Blue (WCAG AA Compliant) */
    text-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
    /* Soft glow/shadow */
    font-weight: 800;
}

@media (max-width: 400px) {
    .nav-center .subtitle-delay {
        font-size: 0.8rem;
    }
}

#stats {
    margin-bottom: 1rem;
    /* Breathing room */
    display: block;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Hide subtitle on very small screens if needed, or keep stacked */
@media (max-width: 360px) {
    .nav-center .subtitle-delay {
        display: none;
    }
}

.menu-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.5rem 1rem 0.25rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sort-wrapper-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.menu-select {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
    /* Cleaner look */
    border-radius: 0.5rem;
    background-color: var(--surface-secondary);
    /* Ice Blue */
    color: var(--text-main);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23205E8E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    transition: background-color 0.2s;
}

.menu-select:focus {
    outline: none;
    border-color: var(--primary);
}

[data-theme="dark"] .menu-select {
    background-color: rgba(30, 41, 59, 0.8);
    border-color: var(--border);
    color: var(--text-main);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Sticky Header for Search */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(243, 244, 246, 0.85);
    /* Matches light theme background */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 0 0.5rem 0;
    margin: 0 -2rem;
    /* Extend to edges */
    padding-left: 2rem;
    padding-right: 2rem;
    transition: background 0.3s ease;
}

[data-theme="dark"] .sticky-header {
    background: rgba(15, 23, 42, 0.85);
    /* Matches dark theme background */
}

/* Adjust search container within sticky header */
.search-container {
    margin-bottom: 0.5rem;
}

.main-actions>button,
.main-actions>a {
    width: 40px !important;
    height: 40px !important;
    padding: 0;
}

.main-actions svg {
    width: 20px;
    height: 20px;
}

h1 {
    font-family: var(--header-font);
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary);
    /* Purple color */
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    animation: float 6s ease-in-out infinite;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    font-family: 'Noto Sans Arabic', sans-serif;
    animation: float 6s ease-in-out infinite;
    animation-delay: 1s;
    /* Slight delay for wave effect */
}

.search-container {
    position: relative;
    max-width: 700px;
    margin: 0 auto 1.5rem auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.search-wrapper {
    position: relative;
    flex-grow: 1;
    transition: transform 0.3s ease;
}

.search-wrapper:focus-within {
    transform: scale(1.02);
}

.search-wrapper:focus-within input {
    animation: pulse-border 2s infinite;
    border-color: var(--primary);
}

.search-icon {
    position: absolute;
    right: 1.2rem;
    /* Moved to right */
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    /* Deep Blue Icon */
    pointer-events: none;
    transition: color 0.3s ease;
}

#searchInput {
    width: 100%;
    padding: 1rem 4rem 1rem 1.5rem;
    /* More padding on right for icon */
    font-size: 1.1rem;
    border: 2px solid var(--accent);
    /* Swapped: Bright Blue Border */
    border-radius: 50px;
    background-color: #FFFFFF;
    color: var(--text-main);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 91, 150, 0.1);
}

#searchInput:focus {
    outline: none;
    box-shadow: 0 6px 20px rgba(0, 91, 150, 0.2);
    transform: translateY(-1px);
}

[data-theme="dark"] #searchInput {
    background-color: var(--surface);
    border-color: var(--border-focus);
    color: var(--text-main);
    box-shadow: var(--shadow);
}

[data-theme="dark"] .search-icon {
    color: var(--text-secondary);
}

/* Removed sort-wrapper from here as it is moved to top-nav */

/* Select styles moved to generic block above */

#sortSelect:focus,
#searchMode:focus,
#typeSelect:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

#sortSelect:hover,
#searchMode:hover,
#typeSelect:hover {
    border-color: var(--primary);
}

/* Mobile Tweaks */
/* Mobile Tweaks (Consolidated & Polished) */
@media (max-width: 800px) {
    body {
        padding: 1rem;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 0.25rem;
    }

    .main-title-text {
        white-space: nowrap;
        font-size: 1.1rem;
        /* Adjusted to fit on one line */
    }

    .subtitle {
        font-size: 1rem;
    }

    .header-center {
        padding: 0.5rem;
        padding-top: max(3.5rem, env(safe-area-inset-top));
        /* More space for top nav */
    }

    .sticky-header {
        margin: 0 -1rem;
        /* Match mobile body padding */
        padding-left: 1rem;
        padding-right: 1rem;
        top: 0;
    }

    .search-container {
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 0;
    }

    .sort-wrapper {
        gap: 0.25rem;
    }

    #sortSelect,
    #searchMode,
    #typeSelect {
        font-size: 0.75rem;
        padding: 0.3rem 1.2rem 0.3rem 0.5rem;
        max-width: 100px;
        /* Force compact on mobile */
    }

    .search-wrapper,
    .sort-wrapper,
    #sortSelect,
    #searchMode,
    #typeSelect {
        width: 100%;
        min-height: 50px;
        /* Larger touch target */
    }

    #sortSelect,
    #searchMode,
    #typeSelect {
        font-size: 0.8rem;
        padding: 0.6rem 1.75rem 0.6rem 0.65rem;
        min-width: 0;
        flex: 1;
    }

    #searchInput {
        padding: 1rem 3rem 1rem 1.25rem;
        font-size: 1.1rem;
    }

    /* Card Polish on Mobile */
    .card {
        padding: 1rem;
        border-radius: 0.75rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    }

    .word-swe {
        font-size: 1.25rem;
    }

    .word-arb {
        font-size: 1.2rem;
        margin: 0.5rem 0 1rem 0;
    }

    .word-type {
        font-size: 0.65rem;
        padding: 0.2rem 0.6rem;
    }

    .def-swe,
    .def-arb {
        font-size: 0.9rem;
    }

    .definitions {
        margin-bottom: 1rem;
    }
}

/* Add Word Form */
.add-form {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    background: var(--background);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
    appearance: none;
    /* Remove default arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.submit-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.submit-btn:active {
    transform: translateY(0);
}

.stats {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: var(--text-tertiary);
    font-family: 'Inter', 'Noto Sans Arabic', sans-serif;
}

/* Results Area */
#resultsArea {
    display: grid;
    gap: 1.5rem;
    animation: slideUp 0.5s ease-out;
}

.placeholder-mes.stats {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.results-area {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card {
    background: var(--surface);
    border-radius: 0.75rem;
    padding: 0.75rem;
    /* Reduced padding */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    border: 2px solid var(--primary);
    /* Swapped: Deep Blue Border */
    content-visibility: auto;
    contain: layout paint style;
    /* Removed dazzle animation for cleaner look */
}

@keyframes dazzle-pulse {
    0% {
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
        border-color: rgba(99, 102, 241, 0.1);
    }

    50% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.25);
        border-color: rgba(99, 102, 241, 0.3);
    }

    100% {
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
        border-color: rgba(99, 102, 241, 0.1);
    }
}

[data-theme="dark"] .card {
    border-color: var(--border-subtle);
}

.card-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-number {
    font-size: 0.85rem;
    /* Increased from 0.75rem */
    color: var(--text-secondary);
    opacity: 0.5;
    font-family: var(--body-font);
    font-weight: 500;
}

.card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #33A1FD;
    /* Bright Sky Blue on Hover */
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.25rem;
    /* Minimal margin */
}

.word-swe {
    font-size: 1.25rem;
    /* Increased from 1rem */
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    direction: ltr;
}

.word-type {
    font-size: 0.8rem;
    /* Increased from 0.7rem */
    text-transform: capitalize;
    letter-spacing: 0.03em;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-weight: 600;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.word-arb {
    font-family: var(--arabic-font);
    font-size: 1.1rem;
    /* Increased from 0.9rem */
    color: #111827;
    /* Darker Arabic Text */
    text-align: right;
    margin: 0;
    /* No margin */
    font-weight: 700;
    /* Bolder */
    line-height: 1.4;
    direction: rtl;
}

[data-theme="dark"] .word-arb {
    color: var(--accent);
}

.definitions {
    margin-bottom: 0.5rem;
    /* Tighter spacing */
}

.def-row {
    margin-bottom: 0.5rem;
}

.def-swe {
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.def-arb {
    font-family: var(--arabic-font);
    color: #374151;
    /* Darker than before */
    text-align: right;
    font-weight: 600;
}

.examples {
    background: var(--background);
    padding: 0.75rem;
    /* Compact padding */
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    /* Tighter spacing */
}

.ex-label {
    display: block;
    font-size: 0.75rem;
    /* Increased from 0.7rem */
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    /* Tighter spacing */
    font-weight: 600;
    letter-spacing: 0.05em;
}

.ex-item {
    margin-bottom: 0.5rem;
}

.ex-item:last-child {
    margin-bottom: 0;
}

.ex-swe {
    color: var(--text-main);
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
    /* Added explicit size */
}

.ex-arb {
    font-family: var(--arabic-font);
    color: #374151;
    /* Darker than before */
    text-align: right;
    font-size: 0.95rem;
    font-weight: 600;
    /* Added explicit size */
}

.placeholder-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 4rem 2rem;
    font-size: 1.1rem;
}

/* Animations */
/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    display: inline-block;
}

/* Staggered Animation Base for Cards */
.card-link {
    opacity: 1;
    /* visible by default */
    /* animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; */
}

/* Utility Animations */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Header Animations */
/* header { animation: fadeIn 1s ease-out; } */

/* h1 { animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; } */
/* Optional: To add float after slideUp, we'd need a wrapper or JS. 
   For now, a clean entrance is more premium. */

.subtitle {
    opacity: 1;
    /* animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.2s; */
}

.search-container {
    opacity: 1;
    /* animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.4s; */
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}



.back-button {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--surface);
    color: var(--primary);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.back-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Make cards clickable in list view */
.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* ... existing animations ... */

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }

    14% {
        transform: scale(1.15);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.15);
    }

    70% {
        transform: scale(1);
    }
}

@keyframes wave-float {

    0%,
    100% {
        transform: rotate(0deg) translateY(0);
    }

    25% {
        transform: rotate(-10deg) translateY(-2px);
    }

    75% {
        transform: rotate(10deg) translateY(2px);
    }
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
        transform: scale(1);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
        transform: scale(1);
    }
}

/* Apply Animations */
.favorites-toggle {
    animation: heartbeat 3s infinite ease-in-out;
}

.favorites-toggle:hover {
    animation: none;
    /* Stop on hover to allow scale effect */
}

.theme-toggle {
    animation: wave-float 5s ease-in-out infinite;
    transform-origin: center;
}

.add-button {
    animation: pulse-glow 2s infinite;
}

/* PWA Install Button */
#installApp {
    display: none;
    /* Hidden by default, shown via JS */
}

/* iOS Install Prompt */
.ios-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem 1rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .ios-prompt {
    background: rgba(31, 41, 55, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ios-prompt.visible {
    transform: translateY(0);
}

.ios-prompt-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.ios-prompt p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.ios-prompt img {
    display: inline-block;
    margin: 0 4px;
}

#closeIosPrompt {
    margin-top: 1rem;
    padding: 0.5rem 2rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 2rem;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Share Button */
.share-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 1rem;
    top: 1.5rem;
}

.share-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary);
    transform: scale(1.1);
}

[data-theme="dark"] .share-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Custom Actions (Details Page) */
.custom-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--surface);
    border-radius: 1rem;
    border: 1px solid var(--border-subtle);
}

.local-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
    background: rgba(99, 102, 241, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 50px;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

.edit-btn,
.delete-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    flex: 1;
    justify-content: center;
    max-width: 200px;
}

.edit-btn {
    background: var(--surface-raised);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.edit-btn:hover {
    background: var(--border);
}

.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

@media (max-width: 600px) {
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .edit-btn,
    .delete-btn {
        max-width: none;
    }
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: #10B981;
    /* Success Green */
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    font-weight: 600;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

.toast-notification.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Game Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease-out;
}

.game-card {
    background: var(--surface);
    width: 100%;
    max-width: 500px;
    border-radius: 1.5rem;
    padding: 2rem;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.game-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary);
}

.score-badge {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
}

.game-question-area {
    text-align: center;
    margin-bottom: 2rem;
}

.game-sentence {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.missing-word-slot {
    display: inline-block;
    width: 80px;
    border-bottom: 3px solid var(--primary);
    margin: 0 5px;
}

.game-hint {
    font-family: var(--arabic-font);
    color: var(--text-secondary);
    font-size: 1.1rem;
    direction: rtl;
}

.game-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option-btn {
    background: var(--surface);
    border: 2px solid var(--border);
    padding: 1rem;
    border-radius: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-2px);
}

.option-btn.correct {
    background: #10B981;
    border-color: #10B981;
    color: white;
    animation: pulse-glow 0.5s;
}

.option-btn.wrong {
    background: #EF4444;
    border-color: #EF4444;
    color: white;
    animation: shake 0.4s;
    opacity: 0.6;
}

.next-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.next-btn:hover {
    transform: translateY(-2px);
    background: var(--primary-hover);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Mobile Responsiveness (iPhone 16 Pro & others) */
@media (max-width: 450px) {
    .game-card {
        padding: 1.5rem;
        max-width: 95%;
        margin: 0 auto;
    }

    .game-sentence {
        font-size: 1.2rem;
    }

    .game-hint {
        font-size: 1rem;
    }

    .game-options {
        gap: 0.75rem;
    }

    .option-btn {
        padding: 0.8rem;
        font-size: 1rem;
    }

    .missing-word-slot {
        width: 60px;
    }
}

/* PWA Install Prompt */
.pwa-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: var(--card-bg-light);
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 1rem;
    z-index: 2000;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.dark-mode .pwa-prompt {
    background: var(--card-bg-dark);
    border-color: rgba(255, 255, 255, 0.1);
}

.pwa-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pwa-content p {
    margin: 0;
    text-align: center;
    font-weight: 500;
    color: var(--text-main);
}

body.dark-mode .pwa-content p {
    color: var(--text-main);
}

.pwa-buttons {
    display: flex;
    gap: 0.5rem;
}

.pwa-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.25rem;
}

.pwa-btn.primary {
    background: #6366f1;
    color: white;
}

.pwa-btn.primary:hover {
    background: #4f46e5;
}

.pwa-btn.secondary {
    background: transparent;
    border: 1px solid #e5e7eb;
    color: var(--text-main);
}

body.dark-mode .pwa-btn.secondary {
    border-color: #4b5563;
    color: var(--text-main);
}

.pwa-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .pwa-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    top: 50%;
    /* Center vertically */
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    /* Start slightly smaller */
    background: var(--surface);
    color: var(--text-main);
    padding: 1.5rem 2.5rem;
    /* Larger padding */
    border-radius: 1rem;
    /* More rounded rect than pill */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    /* Max visibility */
    font-weight: 700;
    font-size: 1.2rem;
    /* Larger text */
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 90%;
    text-align: center;
    line-height: 1.5;
    pointer-events: none;
}

.toast-notification.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.toast-notification.success {
    background: #10b981;
    color: white;
    border-color: #059669;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
}

.toast-notification.error {
    background: #ef4444;
    color: white;
    border-color: #b91c1c;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.5);
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate(-50%, -50%) translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate(-50%, -50%) translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate(-50%, -50%) translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate(-50%, -50%) translate3d(4px, 0, 0);
    }
}

/* Favorite Button */
.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    /* Ensure clickable above card link */
    position: relative;
    /* For z-index to work */
}

.fav-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

.fav-btn.active {
    color: #F59E0B;
    /* Amber/Gold */
}

.fav-btn svg {
    width: 24px;
    height: 24px;
}

[data-theme="dark"] .fav-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Flashcard Mode */
body.flashcard-active .word-arb,
body.flashcard-active .def-arb,
body.flashcard-active .ex-arb,
body.flashcard-active .idiom-arb {
    filter: blur(8px);
    user-select: none;
    cursor: pointer;
    transition: filter 0.3s ease;
    opacity: 0.7;
}

body.flashcard-active .word-arb:hover,
body.flashcard-active .def-arb:hover,
body.flashcard-active .ex-arb:hover {
    filter: blur(4px);
    opacity: 0.9;
}

body.flashcard-active .revealed {
    filter: none !important;
    cursor: default;
    opacity: 1 !important;
}

/* Flashcard Button Active State */
.flashcard-btn.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

/* Back Button Top */
.back-btn-top {
    position: absolute;
    left: 1rem;
    top: 1rem;
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.back-btn-top:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateX(-3px);
}

/* Magic Particles */
.particle {
    position: fixed;
    pointer-events: none;
    width: 6px;
    height: 6px;
    background: #F59E0B;
    border-radius: 50%;
    animation: particle-explode 0.8s ease-out forwards;
    z-index: 9999;
}

@keyframes particle-explode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

@keyframes particle-anim {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Combo Streak Effects - Enhanced (Blue Theme) */
.streak-3 #quizModal .modal-content {
    border: 2px solid #0ea5e9;
    box-shadow: 0 30px 80px rgba(14, 165, 233, 0.6), 0 0 50px rgba(14, 165, 233, 0.4), 0 0 0 2px rgba(14, 165, 233, 0.2) inset;
    animation: pulse-glow-blue 1.5s ease-in-out infinite;
}

.streak-5 #quizModal .modal-content {
    border: 3px solid #0284c7;
    box-shadow: 0 30px 80px rgba(2, 132, 199, 0.7), 0 0 60px rgba(2, 132, 199, 0.5), 0 0 0 3px rgba(2, 132, 199, 0.3) inset;
    animation: pulse-glow-cyan 1.2s ease-in-out infinite, shake-modal 0.5s cubic-bezier(.36, .07, .19, .97);
}

.streak-10 #quizModal .modal-content {
    border: 4px solid transparent;
    background-image: linear-gradient(135deg, #005B96 0%, #0ea5e9 100%),
        linear-gradient(to right, #0ea5e9, #06b6d4, #14b8a6, #10b981, #22c55e, #84cc16, #eab308);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 30px 100px rgba(14, 165, 233, 0.8), 0 0 80px rgba(16, 185, 129, 0.6), 0 0 100px rgba(6, 182, 212, 0.4);
    animation: rainbow-pulse 2s linear infinite, shake-celebration 0.8s ease-out;
}

@keyframes pulse-glow-blue {

    0%,
    100% {
        box-shadow: 0 30px 80px rgba(14, 165, 233, 0.6), 0 0 50px rgba(14, 165, 233, 0.4);
    }

    50% {
        box-shadow: 0 35px 90px rgba(14, 165, 233, 0.8), 0 0 70px rgba(14, 165, 233, 0.6);
    }
}

@keyframes pulse-glow-cyan {

    0%,
    100% {
        box-shadow: 0 30px 80px rgba(2, 132, 199, 0.7), 0 0 60px rgba(2, 132, 199, 0.5);
    }

    50% {
        box-shadow: 0 35px 100px rgba(2, 132, 199, 0.9), 0 0 80px rgba(2, 132, 199, 0.7);
    }
}

@keyframes shake-modal {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

@keyframes shake-celebration {

    0%,
    100% {
        transform: rotate(0deg);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: rotate(-2deg);
    }

    20%,
    40%,
    60%,
    80% {
        transform: rotate(2deg);
    }
}

@keyframes rainbow-pulse {
    0% {
        filter: hue-rotate(0deg) brightness(1.1);
    }

    100% {
        filter: hue-rotate(360deg) brightness(1.1);
    }
}

/* Physics Logo Characters */
.physics-char {
    display: inline-block;
    transition: transform 0.1s ease-out, color 0.2s;
    cursor: default;
}

/* Word of the Day - Premium Design */
.word-of-day-card {
    background: linear-gradient(135deg, #005B96 0%, #0284c7 50%, #0ea5e9 100%);
    color: white;
    padding: 2rem;
    border-radius: 2rem;
    margin: 1.5rem 0;
    width: 100%;
    max-width: none;
    box-shadow: 0 20px 60px rgba(0, 91, 150, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    border: none;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.word-of-day-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate-glow 20s linear infinite;
    pointer-events: none;
}

.word-of-day-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 70px rgba(0, 91, 150, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

@keyframes rotate-glow {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.wod-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.wod-header span {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.wod-save-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    margin-top: 1rem;
}

.wod-save-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.wod-save-btn.saved {
    background: rgba(16, 185, 129, 0.9);
    border-color: rgba(16, 185, 129, 1);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.wod-save-btn.saved:hover {
    background: rgba(16, 185, 129, 1);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Quiz Success Shake */
@keyframes success-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px) rotate(-2deg);
    }

    75% {
        transform: translateX(3px) rotate(2deg);
    }
}

.correct-shake {
    animation: success-shake 0.4s ease-in-out;
}



.wod-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.wod-content {
    position: relative;
    z-index: 1;
}

.wod-main-words {
    text-align: center;
    margin-bottom: 1.5rem;
}

.wod-swe {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    color: white;
    letter-spacing: -0.02em;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 255, 255, 0.2);
    line-height: 1.2;
    animation: float-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
    -webkit-hyphens: none;
}

/* Dynamic font sizing for long Swedish words */
.wod-swe.long-text {
    font-size: 2.4rem;
}

.wod-swe.very-long-text {
    font-size: 1.9rem;
}

.wod-swe.extra-long-text {
    font-size: 1.5rem;
    word-break: keep-all;
}

.wod-arb {
    font-size: 1.8rem;
    font-family: var(--arabic-font);
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.95);
    direction: rtl;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
    animation: float-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s backwards;
}


/* Preview Sections */
.wod-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.wod-def-preview,
.wod-example-preview {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.25rem;
    padding: 1.25rem;
    animation: slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.wod-def-preview {
    animation-delay: 0.4s;
}

.wod-example-preview {
    animation-delay: 0.5s;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.9);
}

.preview-icon {
    font-size: 1.1rem;
}

.wod-def-text,
.wod-example-text {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    text-align: left;
}

.wod-def-text {
    font-weight: 500;
}

.wod-example-text {
    font-style: italic;
    font-weight: 400;
}

@keyframes float-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wod-action {
    display: block;
    text-align: center;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 100%;
    padding: 1.25rem;
    border-radius: 1.25rem;
    cursor: pointer;
    font-weight: 800;
    font-size: 1.05rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin-top: 1.5rem;
}

.wod-action::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.wod-action:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.wod-action:hover::before {
    width: 300px;
    height: 300px;
}

.wod-action:active {
    transform: translateY(-1px);
}

/* Word Type Badge - Premium Design */
.wod-type-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: float-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s backwards;
}

.wod-type-badge:empty {
    display: none;
}

/* Forms Preview Section */
.wod-forms-preview {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.25rem;
    padding: 1.25rem;
    animation: slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.35s backwards;
}

.wod-forms-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.wod-form-chip {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.4rem 0.9rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
}

.wod-form-chip:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Definitions Preview - Bilingual */
.wod-definitions-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.wod-def-arb-preview {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.25rem;
    padding: 1.25rem;
    animation: slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.45s backwards;
}

.wod-def-arb-text {
    font-family: var(--arabic-font);
    text-align: right;
    line-height: 1.8;
}

/* Examples Preview - Bilingual */
.wod-examples-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.wod-example-arb-preview {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.25rem;
    padding: 1.25rem;
    animation: slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.55s backwards;
}

.wod-ex-swe {
    font-style: italic;
}

.wod-ex-arb {
    font-family: var(--arabic-font);
    text-align: right;
    line-height: 1.8;
    font-style: italic;
}

/* Idioms Preview - Bilingual */
.wod-idioms-preview {
    margin-top: 1rem;
}

.wod-idiom-preview {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15) 0%, rgba(255, 165, 0, 0.1) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 1.25rem;
    padding: 1.25rem;
    animation: slide-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.6s backwards;
}

.wod-idiom-swe {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.wod-idiom-arb {
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--arabic-font);
    color: rgba(255, 255, 255, 0.9);
    text-align: right;
    line-height: 1.8;
    font-style: italic;
}

[data-theme="dark"] .fav-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}


/* Word of the Day - Dark Mode */
[data-theme="dark"] .word-of-day-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

[data-theme="dark"] .word-of-day-card:hover {
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

[data-theme="dark"] .wod-swe,
[data-theme="dark"] .wod-arb {
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .wod-swe {
        font-size: 2.2rem;
    }

    .wod-arb {
        font-size: 1.5rem;
    }

    .word-of-day-card {
        padding: 1.5rem;
    }

    .wod-def-text,
    .wod-example-text {
        font-size: 0.95rem;
    }
}

/* WOD Modal Body */
.wod-modal-body {
    padding: 0;
    max-height: 80vh;
    overflow-y: auto;
}

.wod-modal-body::-webkit-scrollbar {
    width: 8px;
}

.wod-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.wod-modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 91, 150, 0.5);
    border-radius: 10px;
}

.wod-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 91, 150, 0.7);
}

/* Quiz Mode */
.modal-overlay {
    position: fixed;
    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(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Quiz Modal - Premium Redesign (Dark Top and Bottom) */
#quizModal .modal-content {
    background: linear-gradient(135deg, #2563EB 0%, #60A5FA 50%, #2563EB 100%);
    border: none;
    padding: 0;
    max-width: 600px;
    width: 95%;
    border-radius: 2rem;
    box-shadow: 0 30px 80px rgba(37, 99, 235, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset,
        0 10px 40px rgba(96, 165, 250, 0.2);
    overflow: hidden;
    position: relative;
}

#quizModal .modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,%3Csvg width="100" height="100" xmlns="http://www.w3.org/2000/svg"%3E%3Cdefs%3E%3Cpattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"%3E%3Cpath d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/%3E%3C/pattern%3E%3C/defs%3E%3Crect width="100" height="100" fill="url(%23grid)" /%3E%3C/svg%3E');
    opacity: 0.3;
    pointer-events: none;
}

[data-theme="dark"] #quizModal .modal-content {
    background: linear-gradient(135deg, #1E293B 0%, #334155 50%, #475569 100%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.modal-content.quiz-card {
    background: var(--surface);
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    border-radius: 1.5rem;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

.quiz-body {
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.modal-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    color: white;
    font-size: 1rem;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 3px 15px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.95;
}

.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    line-height: 1;
}

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

.score-display {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    margin-bottom: 2rem;
    text-align: center;
    justify-content: center;
    width: 100%;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.score-display::before {
    content: '🏆';
    font-size: 1.4rem;
}

.question-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
}

.question-card h3 {
    font-size: 2rem;
    font-weight: 800;
    text-align: center;
    margin: 0;
    color: white;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
    -webkit-hyphens: none;
    max-width: 100%;
    padding: 0 1rem;
}

/* Dynamic font sizing for long Swedish text */
.question-card h3.long-text {
    font-size: 1.7rem;
    line-height: 1.4;
}

.question-card h3.very-long-text {
    font-size: 1.3rem;
    line-height: 1.35;
}

.question-card h3.extra-long-text {
    font-size: 1rem;
    line-height: 1.3;
    word-break: keep-all;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

/* Quiz Header Compact */
.quiz-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quiz-score-inline {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.1rem;
    color: white;
    min-width: 40px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* Quiz Example Sentence */
.quiz-example {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    font-style: italic;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0.75rem;
    border-left: 3px solid rgba(255, 255, 255, 0.3);
    line-height: 1.5;
    text-align: left;
}

/* Quiz Favorite Button - Header Version */
.quiz-fav-btn-header {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.8);
}

.quiz-fav-btn-header:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.quiz-fav-btn-header.is-favorite {
    color: #F59E0B;
    background: rgba(245, 158, 11, 0.25);
}

.quiz-fav-btn-header.is-favorite:hover {
    background: rgba(245, 158, 11, 0.35);
}

/* Quiz End Screen */
.quiz-end-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    animation: fade-in 0.5s ease;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.end-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.end-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.end-score {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.end-score-value {
    font-size: 4rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.end-score-total {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}

.end-message {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    font-weight: 600;
}

#restartQuiz {
    min-width: 200px;
}

/* Quiz Word Info Tooltip */
.quiz-word-tooltip {
    position: fixed;
    z-index: 10001;
    background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    min-width: 220px;
    max-width: 320px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: tooltip-pop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes tooltip-pop {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tooltip-header {
    font-size: 1.3rem;
    font-weight: 800;
    color: #60A5FA;
    margin-bottom: 0.5rem;
    text-align: center;
}

.tooltip-arabic-def {
    font-size: 1.1rem;
    font-family: var(--arabic-font);
    color: white;
    text-align: right;
    direction: rtl;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
}

.tooltip-example {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    text-align: left;
    padding: 0.5rem;
    background: rgba(96, 165, 250, 0.1);
    border-radius: 0.5rem;
    border-left: 3px solid #60A5FA;
}

.tooltip-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    transition: all 0.2s;
}

.tooltip-close:hover {
    color: white;
    transform: scale(1.2);
}

/* Tooltip Arabic Word Display */
.tooltip-arabic-word {
    font-size: 1.4rem;
    font-family: var(--arabic-font);
    color: #FCD34D;
    text-align: center;
    direction: rtl;
    margin-bottom: 0.75rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.tooltip-arabic-def {
    font-size: 1rem;
    font-family: var(--arabic-font);
    color: white;
    text-align: right;
    direction: rtl;
    line-height: 1.7;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    border-right: 3px solid #FCD34D;
}

.tooltip-arabic-def .def-label {
    color: #FCD34D;
    font-weight: 700;
    font-size: 0.9rem;
    margin-left: 0.25rem;
}

.tooltip-example {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
    text-align: left;
    padding: 0.75rem;
    background: rgba(96, 165, 250, 0.15);
    border-radius: 0.5rem;
    border-left: 3px solid #60A5FA;
    line-height: 1.6;
    direction: ltr;
}

.tooltip-example .example-label {
    font-style: normal;
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.quiz-option {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 0.85rem 1.25rem;
    border-radius: 0.85rem;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--arabic-font);
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.5;
}

/* Dynamic font sizing for long options */
.quiz-option.long-text {
    font-size: 1.1rem;
    padding: 1rem 1.2rem;
}

.quiz-option.very-long-text {
    font-size: 0.95rem;
    padding: 0.9rem 1rem;
    line-height: 1.4;
}

.quiz-option::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;
}

.quiz-option:hover {
    transform: translateY(-3px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.quiz-option:hover::before {
    left: 100%;
}

.quiz-option:active {
    transform: translateY(-1px) scale(0.98);
}

.quiz-option.correct {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    border-color: #059669;
    color: white;
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.3) inset;
    animation: correct-pulse 0.6s ease-out;
}

.quiz-option.correct::after {
    content: '✓';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.8rem;
    animation: pop-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.quiz-option.wrong {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    border-color: #DC2626;
    color: white;
    opacity: 0.6;
    box-shadow: 0 5px 20px rgba(239, 68, 68, 0.4);
    animation: wrong-shake 0.5s ease-out;
}

.quiz-option.wrong::after {
    content: '✗';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.8rem;
}

@keyframes correct-pulse {

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

    50% {
        transform: scale(1.05);
    }
}

@keyframes wrong-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

@keyframes pop-in {
    0% {
        transform: translateY(-50%) scale(0);
        opacity: 0;
    }

    50% {
        transform: translateY(-50%) scale(1.3);
    }

    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

.quiz-feedback {
    text-align: center;
    padding: 1rem;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 1rem 0;
    animation: slide-up 0.4s ease-out;
}

.action-btn.primary,
#nextQuestion {
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    backdrop-filter: blur(10px);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 1rem;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.action-btn.primary::before,
#nextQuestion::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.action-btn.primary:hover,
#nextQuestion:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3), 0 0 30px rgba(255, 255, 255, 0.1);
}

.action-btn.primary:hover::before,
#nextQuestion:hover::before {
    width: 300px;
    height: 300px;
}

.action-btn.primary:active,
#nextQuestion:active {
    transform: translateY(-1px);
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Delight: Pulse Animation */
.pulse-on-load {
    animation: pulse-border 2s ease-out;
}

/* ====================================
   Word of the Day Modal Styles - Enhanced
   ==================================== */

#wodModal .modal-content {
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 1.5rem;
}

#wodModal .wod-modal-body {
    overflow-y: auto;
    padding: 0;
    flex: 1;
}

#wodModal .details-container {
    padding: 0;
}

/* Hero Section - Premium Design for Modal */
#wodModal .details-hero {
    background: linear-gradient(135deg, #005B96 0%, #0284c7 50%, #0ea5e9 100%);
    padding: 3rem 2rem;
    margin: 0;
    border-radius: 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 91, 150, 0.3);
}

#wodModal .details-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: rotate-glow 20s linear infinite;
}

@keyframes rotate-glow {
    0% {
        transform: rotate(0deg);
    }

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

#wodModal .details-hero-content {
    position: relative;
    z-index: 1;
}

#wodModal .word-swe-hero {
    font-size: 3rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 40px rgba(255, 255, 255, 0.2);
    margin: 0 0 1rem 0;
    line-height: 1.2;
    text-align: center;
}

#wodModal .word-arb-hero {
    font-size: 2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
    font-family: var(--arabic-font);
    direction: rtl;
    margin: 1rem 0;
    text-align: center;
}

#wodModal .type-badge-hero {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Content Sections - Premium Design */
#wodModal .details-section {
    background: var(--surface);
    border-radius: 1.5rem;
    padding: 2rem;
    margin: 1.5rem;
    margin-top: 0;
    border: 2px solid transparent;
    background-image: linear-gradient(var(--surface), var(--surface)),
        linear-gradient(135deg, #005B96 0%, #0ea5e9 100%);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#wodModal .details-section:first-of-type {
    margin-top: 1.5rem;
}

#wodModal .details-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0, 91, 150, 0.15);
}

#wodModal .section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

#wodModal .section-icon {
    font-size: 1.3rem;
}

/* Definition Styles */
#wodModal .def-item {
    padding: 1.25rem;
    background: var(--background);
    border-radius: 1rem;
    border-left: 4px solid #005B96;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
}

#wodModal .def-item:hover {
    transform: translateX(5px);
    border-left-color: #0ea5e9;
    box-shadow: 0 5px 15px rgba(0, 91, 150, 0.1);
}

#wodModal .def-swe-detail {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

#wodModal .def-arb-detail {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--arabic-font);
    color: var(--text-secondary);
    direction: rtl;
    line-height: 1.8;
}

/* Forms Section */
#wodModal .forms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

#wodModal .form-chip {
    background: linear-gradient(135deg, rgba(0, 91, 150, 0.1) 0%, rgba(14, 165, 233, 0.1) 100%);
    border: 2px solid rgba(0, 91, 150, 0.2);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--primary);
    transition: all 0.3s ease;
}

#wodModal .form-chip:hover {
    background: linear-gradient(135deg, rgba(0, 91, 150, 0.2) 0%, rgba(14, 165, 233, 0.2) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 91, 150, 0.2);
}

/* Examples & Idioms */
#wodModal .example-card {
    background: linear-gradient(135deg, rgba(0, 91, 150, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
    border-radius: 1.25rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 2px solid rgba(0, 91, 150, 0.1);
    position: relative;
    overflow: hidden;
}

#wodModal .example-card::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 10px;
    font-size: 5rem;
    color: rgba(0, 91, 150, 0.1);
    font-family: Georgia, serif;
    line-height: 1;
}

#wodModal .ex-swe-detail {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
    font-style: italic;
}

#wodModal .ex-arb-detail {
    font-size: 1.05rem;
    font-weight: 600;
    font-family: var(--arabic-font);
    color: var(--primary);
    direction: rtl;
    font-style: italic;
}

/* Action Button */
#wodModal .action-btn-premium {
    padding: 1.25rem;
    background: linear-gradient(135deg, #005B96 0%, #0ea5e9 100%);
    color: white;
    border: none;
    border-radius: 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(0, 91, 150, 0.3);
    position: relative;
    overflow: hidden;
}

#wodModal .action-btn-premium::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#wodModal .action-btn-premium:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 91, 150, 0.4);
}

#wodModal .action-btn-premium:hover::before {
    width: 300px;
    height: 300px;
}

/* Scrollbar Styling */
#wodModal .wod-modal-body::-webkit-scrollbar {
    width: 8px;
}

#wodModal .wod-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

#wodModal .wod-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #005B96 0%, #0ea5e9 100%);
    border-radius: 4px;
}

#wodModal .wod-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0ea5e9 100%);
}

/* Dark Mode Adjustments */
[data-theme="dark"] #wodModal .details-hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

[data-theme="dark"] #wodModal .word-swe-hero,
[data-theme="dark"] #wodModal .word-arb-hero {
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #wodModal .details-section {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] #wodModal .details-section:hover {
    box-shadow: 0 15px 40px rgba(14, 165, 233, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    #wodModal .modal-content {
        max-width: 95%;
    }

    #wodModal .word-swe-hero {
        font-size: 2.2rem;
    }

    #wodModal .word-arb-hero {
        font-size: 1.6rem;
    }

    #wodModal .details-hero {
        padding: 2rem 1.5rem;
    }

    #wodModal .details-section {
        padding: 1.5rem;
        margin: 1rem;
    }
}