/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px 20px 40px 20px;
    transition: background 0.8s ease;
    overflow-x: hidden;
}

body.menu-open {
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 800px;
    min-height: calc(100vh - 80px);
    min-height: calc(100dvh - 80px); /* Dynamic viewport height for mobile */
    display: flex;
    flex-direction: column;
    position: relative;
    padding-top: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    margin-bottom: 30px;
    position: relative;
    z-index: 10;
}

.turtle-logo {
    cursor: pointer;
    transition: transform 0.3s ease;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-image {
    height: 32px;
    width: auto;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease;
}

.turtle-logo:hover {
    transform: scale(1.1) rotate(5deg);
}

.settings-icon {
    cursor: pointer;
    padding: 8px;
    transition: transform 0.3s ease;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-icon svg {
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.settings-icon:hover {
    transform: scale(1.15);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 0;
    padding-top: 20px;
}

.question-container {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px 30px;
    margin-bottom: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 600px;
}

.question-text {
    font-size: 1.8rem;
    font-weight: 500;
    line-height: 1.4;
    color: #333333;
    transition: opacity 0.3s ease;
    margin-bottom: 20px;
}

.question-counter {
    font-size: 0.9rem;
    color: rgba(51, 51, 51, 0.7);
    font-weight: 300;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.action-buttons button {
    padding: 15px 25px;
    border: none;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 140px;
}

.action-buttons button:hover {
    /* Removed transform and shadow for cleaner look */
}

.heart-icon {
    font-size: 1.3rem;
    color: transparent;
    -webkit-text-stroke: 2px #333333;
    text-stroke: 2px #333333;
    transition: all 0.3s ease;
}

.favorite-btn.favorited .heart-icon {
    color: #333333;
    -webkit-text-stroke: 2px #333333;
    text-stroke: 2px #333333;
}

.shuffle-btn {
    font-size: 1.1rem;
    padding: 18px 30px;
}

/* Settings Menu */
.settings-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.settings-menu.active {
    right: 0;
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    pointer-events: none;
}

.settings-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.settings-content {
    padding: 30px;
    color: #333;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.settings-content h3 {
    font-size: 1.8rem;
    margin: 0;
    color: #2c3e50;
}

.close-settings-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-settings-btn:hover {
    color: #333;
}

.filter-section {
    margin-bottom: 30px;
}

.filter-section h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #34495e;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    background: white;
    color: #666;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.settings-actions {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.reset-btn, .favorites-btn, .install-btn {
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn {
    background: #e74c3c;
    color: white;
}

.reset-btn:hover {
    background: #c0392b;
}

.favorites-btn {
    background: #3498db;
    color: white;
}

.favorites-btn:hover {
    background: #2980b9;
}

.install-btn {
    background: #27ae60;
    color: white;
}

.install-btn:hover {
    background: #229954;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

.modal h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.8rem;
}

.modal p {
    line-height: 1.6;
    color: #666;
    margin-bottom: 15px;
}

.modal a {
    color: #667eea;
    text-decoration: none;
}

.modal a:hover {
    text-decoration: underline;
}

/* Favorites */
.favorite-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.favorite-text {
    margin-bottom: 10px;
    color: #2c3e50;
    font-weight: 500;
}

.remove-favorite {
    padding: 5px 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s ease;
}

.remove-favorite:hover {
    background: #c0392b;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 0.9rem;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 15px 15px 30px 15px;
        align-items: flex-start;
        padding-top: 20px;
    }

    #app {
        padding-top: 10px;
    }

    .header {
        padding: 0;
        margin-bottom: 20px;
    }
    
    .main-content {
        justify-content: flex-start;
        padding-top: 40px;
    }

    .turtle-logo {
        font-size: 2rem;
    }

    .settings-icon {
        font-size: 1.5rem;
        padding: 8px;
    }

    .question-container {
        padding: 30px 20px;
        margin-bottom: 30px;
        border-radius: 15px;
    }

    .question-text {
        font-size: 1.6rem;
        line-height: 1.4;
        margin-bottom: 15px;
    }

    .question-counter {
        font-size: 0.9rem;
    }

    .action-buttons {
        gap: 10px;
    }

    .action-buttons button {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-width: 120px;
    }

    .shuffle-btn {
        font-size: 1rem;
        padding: 15px 25px;
    }

    .settings-menu {
        max-width: 100%;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height */
        display: flex;
        flex-direction: column;
    }

    .settings-content {
        padding: 20px;
        flex: 1;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        max-height: calc(100vh - 40px);
        max-height: calc(100dvh - 40px);
    }
    
    .settings-actions {
        margin-top: auto;
        padding-top: 20px;
    }

    .settings-header {
        margin-bottom: 20px;
    }

    .settings-content h3 {
        font-size: 1.5rem;
        margin: 0;
    }
    
    .close-settings-btn {
        font-size: 1.8rem;
        width: 28px;
        height: 28px;
    }

    .filter-section h4 {
        font-size: 1.1rem;
    }

    .filter-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .modal-content {
        padding: 25px 20px;
        border-radius: 10px;
    }

    .modal h2 {
        font-size: 1.5rem;
    }

    .close {
        top: 10px;
        right: 15px;
        font-size: 1.8rem;
    }

    .toast {
        bottom: 20px;
        padding: 12px 20px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .question-text {
        font-size: 1.5rem;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .action-buttons button {
        width: 100%;
        max-width: 280px;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .filter-btn {
        width: 100%;
        text-align: center;
    }

    .settings-actions {
        margin-top: 30px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10% { transform: rotate(-2deg) scale(1.02); }
    20% { transform: rotate(2deg) scale(0.98); }
    30% { transform: rotate(-3deg) scale(1.01); }
    40% { transform: rotate(3deg) scale(0.99); }
    50% { transform: rotate(-2deg) scale(1.01); }
    60% { transform: rotate(2deg) scale(0.99); }
    70% { transform: rotate(-1deg) scale(1.005); }
    80% { transform: rotate(1deg) scale(0.995); }
    90% { transform: rotate(-0.5deg) scale(1.002); }
}

.question-container.wiggle {
    animation: wiggle 0.6s ease-in-out;
}

.question-container {
    /* Removed fadeIn animation to avoid competing with wiggle */
}

.action-buttons button {
    animation: fadeIn 0.6s ease-out;
}

.action-buttons button:nth-child(1) {
    animation-delay: 0.1s;
}

.action-buttons button:nth-child(2) {
    animation-delay: 0.2s;
}

.action-buttons button:nth-child(3) {
    animation-delay: 0.3s;
}

/* Focus states for accessibility */
button:focus,
.turtle-logo:focus,
.settings-icon:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.filter-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .question-container,
    .action-buttons button,
    .settings-icon {
        border: 2px solid rgba(255, 255, 255, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body {
        transition: none;
    }
    
    .question-text {
        transition: none;
    }
}