body {
    margin: 0;
    padding: 0;
    background-color: #222;
    color: #eee;
    font-family: sans-serif;
    overflow-x: hidden; /* Prevent horizontal scroll only */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-nav {
    background: #111;
    padding: 10px 20px;
    display: flex;
    flex-wrap: wrap; /* allow wrapping on mobile */
    gap: 20px;
    justify-content: space-between; /* Space out links and lang selector */
    align-items: center;
    border-bottom: 1px solid #333;
    z-index: 20;
}

.nav-links {
    display: flex;
    gap: 15px;
}

.nav-lang select {
    background: #222;
    padding: 5px;
    font-size: 0.9rem;
}

.main-nav a {
    color: #aaa;
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9rem;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.main-nav a:hover {
    color: #fff;
    background: #333;
}

.prose-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    line-height: 1.6;
}

.prose-container h1 { color: #3498db; margin-bottom: 10px; }
.prose-container h2 { color: #ddd; margin-top: 30px; border-bottom: 1px solid #444; padding-bottom: 5px; }
.prose-container p { color: #ccc; margin-bottom: 15px; }

.research-box {
    background: #333;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

.research-box h3 { margin-top: 0; color: #fff; }

.btn-primary {
    display: inline-block;
    background: #3498db;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 20px;
    font-weight: bold;
}

.btn-primary:hover { background: #2980b9; }

.actions { margin-top: 40px; text-align: center; }

.controls {
    padding: 20px;
    padding-top: env(safe-area-inset-top, 20px);  /* Safe area for iPhone notch */
    background-color: #333;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    transition: opacity 0.5s;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

/* Specific iPhone/mobile touches */
@media (max-width: 600px) {
    .controls {
        gap: 10px;
        padding: 10px;
        padding-top: env(safe-area-inset-top, 10px);
    }
    
    .control-group {
        flex: 1 1 40%; /* Take up nearly half width */
        min-width: 120px;
    }
    
    h1 {
        width: 100%;
        text-align: center;
        font-size: 1.2rem;
        margin: 5px 0;
    }

    button {
        padding: 12px; /* Easier to tap */
        flex: 1;
    }
}

.controls.hidden {
    opacity: 0;
    pointer-events: none;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

button {
    padding: 8px 16px;
    cursor: pointer;
    background-color: #555;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
}

button:hover {
    background-color: #666;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

select {
    padding: 8px;
    background-color: #555;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

select:hover {
    background-color: #666;
}

.container {
    flex-grow: 1;
    position: relative;
    width: 100%;
    display: flex;
    align-items: center; /* Vertically center */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.moving-element {
    position: absolute;
    left: 0; /* Start position */
    will-change: transform;
    display: flex;
    justify-content: center;
    align-items: center;
}

.placeholder-circle {
    width: 50px;
    height: 50px;
    background-color: #3498db;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.8);
}

.moving-element img {
    width: 200px; /* Default size */
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

/* Animation class - will be controlled via JS for duration */
.animating {
    animation-name: moveSideToSide;
    animation-timing-function: linear; /* or ease-in-out for smoother turns */
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

@keyframes moveSideToSide {
    0% {
        transform: translateX(0); /* Left edge */
    }
    100% {
        transform: translateX(calc(100vw - 100%)); /* Right edge minus element width */
    }
}

/* Mobile Layout Adjustments */
@media (max-width: 600px) {
    .container {
        padding-bottom: 25vh; /* Push element up to leave space for thumbs/controls */
    }
}
