:root {
    --bg-color: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --header-bg: rgba(15, 23, 42, 0.8);
    --base-font-size: 16px;
}

body.theme-en-fr {
    --primary-color: #3b82f6; /* Blue */
    --accent-color: #d946ef; /* Fuchsia */
    --card-front-bg: linear-gradient(135deg, rgba(30, 58, 138, 0.8), rgba(30, 64, 175, 0.8)); /* Dark Blue */
    --card-back-bg: linear-gradient(135deg, rgba(134, 25, 143, 0.9), rgba(192, 38, 211, 0.9)); /* Bright Fuchsia */
    --card-back-border: rgba(232, 121, 249, 0.6);
}

body.theme-fr-en {
    --primary-color: #10b981; /* Emerald */
    --accent-color: #f59e0b; /* Amber */
    --card-front-bg: linear-gradient(135deg, rgba(6, 78, 59, 0.8), rgba(4, 120, 87, 0.8)); /* Dark Green */
    --card-back-bg: linear-gradient(135deg, rgba(146, 64, 14, 0.9), rgba(217, 119, 6, 0.9)); /* Bright Orange */
    --card-back-border: rgba(252, 211, 77, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    color: var(--text-color);
    font-size: var(--base-font-size);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: background 0.3s ease;
}

/* Tabs */
.tabs {
    flex-shrink: 0;
    display: flex;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    z-index: 10;
}

.tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 1.2rem;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab.active {
    color: var(--text-color);
    border-bottom: 3px solid var(--primary-color);
    background: rgba(255, 255, 255, 0.05);
}

/* Carousel */
#carousel-container {
    flex: 1;
    position: relative;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#carousel-container::-webkit-scrollbar {
    display: none;
}

.swipe-hint {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 100;
    animation: pulseHint 2s infinite, fadeOutHint 0.5s 4s forwards;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
}

@keyframes pulseHint {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
}
@keyframes fadeOutHint {
    to { opacity: 0; visibility: hidden; }
}

.page {
    min-width: 100vw;
    scroll-snap-align: start;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
    gap: 1rem;
    align-content: stretch;
    overflow-y: hidden;
}

/* Flip Cards */
.card-container {
    perspective: 1000px;
    width: 100%;
    min-height: 6em;
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(8px);
    font-weight: 600;
    line-height: 1.3;
}

.card-front {
    background: var(--card-front-bg);
}

.card-back {
    transform: rotateY(180deg);
    background: var(--card-back-bg);
    border-color: var(--card-back-border);
}

.card-text {
    flex: 1;
}

.card-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Active indicator for sound playing */
.card.playing .card-face {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
}

/* Bottom Bar */
.bottom-bar {
    flex-shrink: 0;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--card-border);
    position: relative;
    z-index: 20;
}

.progress-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    padding-bottom: max(0.8rem, env(safe-area-inset-bottom));
}

.font-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 50%;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.control-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

.pagination-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.toggles {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.toggle-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}
