:root {
    --bg-gradient: linear-gradient(135deg, #4f46e5, #ec4899);
    --card-bg: #ffffff;
    --card-border-radius: 16px;
    --card-shadow: 0 10px 25px rgba(0,0,0,0.15);
    --btn-radius: 999px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: rgba(15, 23, 42, 0.9);
    color: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 10;
}

header strong {
    font-size: 1.1rem;
}

header a {
    color: #e5e7eb;
    text-decoration: none;
    margin-left: 15px;
    font-size: 0.95rem;
    position: relative;
}

header a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 2px;
    background: #a5b4fc;
    transition: width 0.2s ease;
}

header a:hover::after {
    width: 100%;
}

main {
    max-width: 960px;
    width: 100%;
    margin: 24px auto;
    background: rgba(255,255,255,0.95);
    padding: 24px;
    border-radius: 18px;
    box-shadow: 0 20px 40px rgba(15,23,42,0.25);
    animation: card-pop 0.4s ease-out;
}

@keyframes card-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

h1, h2, h3 {
    margin-top: 0;
    color: #111827;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
}

th, td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
    font-size: 0.95rem;
}

th {
    background: #f3f4f6;
    text-align: left;
}

tr:last-child td {
    border-bottom: none;
}

/* Boutons */

.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: var(--btn-radius);
    border: none;
    text-decoration: none;
    cursor: pointer;
    background: #4f46e5;
    color: #fff;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(79,70,229,0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(79,70,229,0.6);
    background: #4338ca;
}

.btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 8px rgba(79,70,229,0.5);
}

.btn-secondary {
    background: #6b7280;
    box-shadow: 0 4px 12px rgba(107,114,128,0.4);
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-danger {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(220,38,38,0.45);
}

/* Alertes */

.alert {
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Badges */

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #22c55e;
    color: #ecfdf5;
}

.badge-fail {
    background: #ef4444;
    color: #fef2f2;
}

/* Inputs */

textarea,
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    transition: border 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.25);
}

/* Carte question / réponse */

.card-wrapper {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.card {
    width: 100%;
    max-width: 540px;
    height: 260px;
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: left;
    transition: transform 0.7s;
    transform-style: preserve-3d;
}

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

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: radial-gradient(circle at top left, #eef2ff, #ffffff);
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(148,163,184,0.2);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-front {
    transform: rotateY(0deg);
}

.card-back {
    transform: rotateY(180deg);
    background: radial-gradient(circle at top left, #ecfdf5, #ffffff);
}

.card-question-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 4px;
}

.card-question {
    font-size: 1.05rem;
    color: #111827;
    white-space: pre-wrap;
}

.card-answer-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #16a34a;
    margin-bottom: 4px;
}

.card-answer {
    font-size: 1.05rem;
    color: #064e3b;
    white-space: pre-wrap;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #6b7280;
}

.chip {
    border-radius: 999px;
    padding: 4px 10px;
    background: rgba(15,23,42,0.06);
    font-size: 0.8rem;
}

.chip-correct {
    background: rgba(22,163,74,0.1);
    color: #15803d;
}

.chip-wrong {
    background: rgba(220,38,38,0.1);
    color: #b91c1c;
}

/* Animations simples */

.fade-in {
    animation: fade-in 0.35s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Barre de progression */

.progress-container {
    margin: 10px 0 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #4b5563;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4f46e5, #6366f1);
    width: 0;
    transition: width 0.3s ease-out;
}

/* Carte verte / rouge selon succès */

.card-success .card-back {
    background: radial-gradient(circle at top left, #dcfce7, #ffffff);
    border-color: #bbf7d0;
    box-shadow: 0 12px 30px rgba(22,163,74,0.35);
}

.card-fail .card-back {
    background: radial-gradient(circle at top left, #fee2e2, #ffffff);
    border-color: #fecaca;
    box-shadow: 0 12px 30px rgba(220,38,38,0.35);
}


.answer-label {
    display: block;
    font-size: 0.95rem;
    color: #111827;
    margin-bottom: 8px;
}

.answer-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(15,23,42,0.06);
    transition: border 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.answer-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.25),
                0 8px 18px rgba(15,23,42,0.12);
    transform: translateY(-1px);
}


.results-badges {
    margin-bottom: 20px;
}

.results-badges h2 {
    margin-bottom: 4px;
}

.results-badges-sub {
    margin: 0 0 8px;
    font-size: 0.9rem;
    color: #4b5563;
}

.results-badges-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.badge-icon {
    height: 40px;
    width: auto;
    border-radius: 999px;
    box-shadow: 0 4px 10px rgba(15,23,42,0.25);
    background: #f9fafb;
}

.results-badges-empty {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 16px;
}





.drill-panel {
    margin: 10px auto 20px;
    max-width: 800px;
    padding: 10px 15px;
    border-radius: 8px;
    background: #f3f3f3;
    font-style: italic;
}



/* --- DRILL PANEL --- */

.drill-panel {
    background: #fdfdfd;
    border-radius: 10px;
    padding: 20px 25px;
    margin: 10px auto;
    max-width: 700px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
    animation: fadeInDrill 0.3s ease-out;
}

@keyframes fadeInDrill {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Punchlines */
.drill-punchlines {
    margin-bottom: 15px;
}

.drill-line {
    display: flex;
    align-items: center;
    background: #fffaf2;
    border-left: 4px solid #ffb74d;
    padding: 10px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    font-size: 1.05rem;
    color: #444;
}

.drill-sep {
    margin: 15px auto;
    border: 0;
    border-top: 1px solid #ddd;
    width: 80%;
}

/* Icons */
.drill-icon {
    margin-right: 8px;
    font-size: 1.2rem;
}

/* Infos + titres */
.drill-info h3 {
    margin-top: 15px;
    margin-bottom: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
}

.drill-info h3 .drill-icon {
    font-size: 1.3rem;
    margin-right: 6px;
}

.drill-intro {
    background: #f2faff;
    border-left: 4px solid #42a5f5;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* Listes */
.drill-list {
    margin: 0 0 12px 5px;
    padding-left: 20px;
}

.drill-list li {
    margin-bottom: 5px;
}
