* {
    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;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
            repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px),
            repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(255,255,255,0.03) 2px, rgba(255,255,255,0.03) 4px);
    pointer-events: none;
    z-index: 1;
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

header {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.2),
            0 0 60px rgba(102, 126, 234, 0.3),
            inset 0 0 20px rgba(102, 126, 234, 0.1);
    margin-bottom: 30px;
    text-align: center;
    animation: slideDown 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 3px solid transparent;
    background-image:
            linear-gradient(white, white),
            linear-gradient(135deg, #667eea, #764ba2, #667eea);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100px) scale(0.5) rotate(-360deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

h1 {
    color: #333;
    font-size: 2em;
}

.glitch {
    position: relative;
    animation: glitchText 3s infinite, colorShift 5s infinite;
}

@keyframes glitchText {
    0%, 90%, 100% {
        text-shadow: none;
    }
    92% {
        text-shadow:
                3px 3px #ff00de,
                -3px -3px #00fff9,
                5px -5px #ff0000,
                -5px 5px #00ff00;
        transform: skew(-5deg);
    }
    94% {
        text-shadow:
                -3px 3px #ff00de,
                3px -3px #00fff9,
                -5px 5px #ffff00,
                5px -5px #0000ff;
        transform: skew(5deg);
    }
}

@keyframes colorShift {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(360deg); }
}

.add-student {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.2),
            0 0 60px rgba(118, 75, 162, 0.3);
    margin-bottom: 30px;
    animation: slideRight 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.2s backwards;
    border: 3px solid transparent;
    background-image:
            linear-gradient(white, white),
            linear-gradient(135deg, #764ba2, #667eea, #764ba2);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-100px) rotate(-360deg) scale(0);
    }
    to {
        opacity: 1;
        transform: translateX(0) rotate(0) scale(1);
    }
}

.add-student h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

#studentForm {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#studentForm input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s;
}

#studentForm input:focus {
    outline: none;
    border-color: #667eea;
    transform: scale(1.05) rotate(2deg);
    box-shadow:
            0 0 20px rgba(102, 126, 234, 0.4),
            0 0 40px rgba(102, 126, 234, 0.2),
            inset 0 0 10px rgba(102, 126, 234, 0.1);
    animation: inputPulse 1s infinite;
}

@keyframes inputPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 0 40px rgba(102, 126, 234, 0.8); }
}

.mlg-button {
    position: relative;
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    overflow: visible;
    transition: all 0.3s;
    box-shadow:
            0 5px 15px rgba(102, 126, 234, 0.4),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.mlg-button span {
    position: relative;
    z-index: 2;
    display: block;
}

.mlg-button:hover {
    transform: scale(1.15) rotate(-5deg);
    box-shadow:
            0 15px 40px rgba(102, 126, 234, 0.8),
            0 0 60px rgba(102, 126, 234, 0.6),
            inset 0 0 30px rgba(255, 255, 255, 0.2);
    animation: buttonGlitch 0.3s infinite;
}

@keyframes buttonGlitch {
    0%, 100% { filter: hue-rotate(0deg); }
    25% { filter: hue-rotate(90deg); }
    50% { filter: hue-rotate(180deg); }
    75% { filter: hue-rotate(270deg); }
}

.mlg-button:active {
    animation: button360 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes button360 {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.3) rotate(90deg);
    }
    50% {
        transform: scale(0.8) rotate(180deg);
    }
    75% {
        transform: scale(1.3) rotate(270deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
    }
}

.mlg-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.8), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.mlg-button:active::before {
    width: 400px;
    height: 400px;
}

.mlg-button::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

.button-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.student-list {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.2),
            0 0 60px rgba(102, 126, 234, 0.3);
    animation: slideLeft 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.4s backwards;
    border: 3px solid transparent;
    background-image:
            linear-gradient(white, white),
            linear-gradient(135deg, #667eea, #764ba2, #667eea);
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(100px) rotate(360deg) scale(0);
    }
    to {
        opacity: 1;
        transform: translateX(0) rotate(0) scale(1);
    }
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.controls h2 {
    color: #333;
    font-size: 1.3em;
}

.counter {
    display: inline-block;
    animation: counterPulse 1.5s infinite;
}

@keyframes counterPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        color: inherit;
    }
    25% {
        transform: scale(1.3) rotate(-10deg);
        color: #ff00de;
    }
    50% {
        transform: scale(1.5) rotate(0deg);
        color: #00fff9;
    }
    75% {
        transform: scale(1.3) rotate(10deg);
        color: #ffff00;
    }
}

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

.sort-btn {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    font-size: 0.95em;
}

.sort-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    animation: sort360 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes sort360 {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.5); }
    100% { transform: rotate(360deg) scale(1); }
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
            45deg,
            transparent,
            rgba(255,255,255,0.3),
            transparent
    );
    animation: statShine 3s infinite;
}

@keyframes statShine {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.stat-card:hover {
    transform: translateY(-10px) rotate(10deg) scale(1.1);
    box-shadow:
            0 20px 50px rgba(102, 126, 234, 0.8),
            0 0 80px rgba(102, 126, 234, 0.6);
    animation: statWobble 0.5s infinite;
}

@keyframes statWobble {
    0%, 100% { transform: translateY(-10px) rotate(10deg) scale(1.1); }
    25% { transform: translateY(-15px) rotate(5deg) scale(1.15); }
    50% { transform: translateY(-10px) rotate(15deg) scale(1.1); }
    75% { transform: translateY(-15px) rotate(10deg) scale(1.15); }
}

.stat-card:active {
    animation: stat360 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes stat360 {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.5); }
    50% { transform: rotate(180deg) scale(2); }
    75% { transform: rotate(270deg) scale(1.5); }
    100% { transform: rotate(360deg) scale(1); }
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 5px;
    z-index: 1;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    animation: numberPop 0.5s ease;
    z-index: 1;
}

@keyframes numberPop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.5) rotate(0deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
    position: relative;
}

th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s;
}

th:hover::after {
    transform: scaleX(1);
}

td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}

tbody tr {
    animation: fadeInRow 0.5s ease backwards;
    transition: all 0.3s;
}

tbody tr:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1), rgba(102, 126, 234, 0.1));
    transform: scale(1.03) translateX(10px);
    box-shadow:
            0 5px 15px rgba(0, 0, 0, 0.1),
            -5px 0 20px rgba(102, 126, 234, 0.3);
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateX(-100px) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: translateX(0) rotate(0);
    }
}

.empty-state td {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px;
}

.appreciation {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    display: inline-block;
    animation: appreciationBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

@keyframes appreciationBounce {
    0% {
        transform: scale(0) rotate(-360deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.3) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.appreciation:hover {
    animation: appreciationSpin 0.5s linear infinite;
}

@keyframes appreciationSpin {
    from { transform: rotate(0deg) scale(1.1); }
    to { transform: rotate(360deg) scale(1.1); }
}

.appreciation.excellent {
    background: linear-gradient(135deg, #d4edda, #28a745);
    color: white;
    box-shadow:
            0 0 20px rgba(40, 167, 69, 0.5),
            0 0 40px rgba(40, 167, 69, 0.3);
}

.appreciation.bien {
    background: linear-gradient(135deg, #d1ecf1, #17a2b8);
    color: white;
    box-shadow:
            0 0 20px rgba(23, 162, 184, 0.5),
            0 0 40px rgba(23, 162, 184, 0.3);
}

.appreciation.moyen {
    background: linear-gradient(135deg, #fff3cd, #ffc107);
    color: #856404;
    box-shadow:
            0 0 20px rgba(255, 193, 7, 0.5),
            0 0 40px rgba(255, 193, 7, 0.3);
}

.appreciation.faible {
    background: linear-gradient(135deg, #f8d7da, #dc3545);
    color: white;
    box-shadow:
            0 0 20px rgba(220, 53, 69, 0.5),
            0 0 40px rgba(220, 53, 69, 0.3);
}

.delete-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.4);
}

.delete-btn::before {
    content: '💥';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 2em;
    opacity: 0;
    transition: all 0.3s;
}

.delete-btn:hover {
    transform: scale(1.2) rotate(-10deg);
    box-shadow:
            0 0 30px rgba(220, 53, 69, 0.8),
            0 0 60px rgba(220, 53, 69, 0.6);
    animation: deleteShake 0.2s infinite;
}

@keyframes deleteShake {
    0%, 100% { transform: scale(1.2) rotate(-10deg); }
    25% { transform: scale(1.2) rotate(-15deg) translateX(-2px); }
    75% { transform: scale(1.2) rotate(-5deg) translateX(2px); }
}

.delete-btn:active {
    animation: delete360 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes delete360 {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.5) rotate(-90deg);
    }
    50% {
        transform: scale(0.5) rotate(-180deg);
    }
    75% {
        transform: scale(1.5) rotate(-270deg);
    }
    100% {
        transform: scale(1) rotate(-360deg);
    }
}

.delete-btn:active::before {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
}

.explosion-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.explosion-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: explode 1.5s ease-out forwards;
    box-shadow: 0 0 10px currentColor;
}

@keyframes explode {
    to {
        transform: translate(var(--tx), var(--ty)) rotate(1080deg) scale(0);
        opacity: 0;
    }
}

#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

.mlg-text {
    animation: mlgRainbow 0.5s linear infinite, mlgZoom 0.5s infinite;
    font-weight: bold;
}

@keyframes mlgRainbow {
    0% { color: #ff0000; text-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000; }
    16% { color: #ff7f00; text-shadow: 0 0 20px #ff7f00, 0 0 40px #ff7f00; }
    33% { color: #ffff00; text-shadow: 0 0 20px #ffff00, 0 0 40px #ffff00; }
    50% { color: #00ff00; text-shadow: 0 0 20px #00ff00, 0 0 40px #00ff00; }
    66% { color: #0000ff; text-shadow: 0 0 20px #0000ff, 0 0 40px #0000ff; }
    83% { color: #8b00ff; text-shadow: 0 0 20px #8b00ff, 0 0 40px #8b00ff; }
    100% { color: #ff0000; text-shadow: 0 0 20px #ff0000, 0 0 40px #ff0000; }
}

@keyframes mlgZoom {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.5); }
}

.screen-shake {
    animation: screenShake 0.5s;
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-10px, -10px) rotate(-2deg); }
    20% { transform: translate(10px, 10px) rotate(2deg); }
    30% { transform: translate(-10px, 10px) rotate(-2deg); }
    40% { transform: translate(10px, -10px) rotate(2deg); }
    50% { transform: translate(-10px, -10px) rotate(-2deg); }
    60% { transform: translate(10px, 10px) rotate(2deg); }
    70% { transform: translate(-10px, 10px) rotate(-2deg); }
    80% { transform: translate(10px, -10px) rotate(2deg); }
    90% { transform: translate(-10px, -10px) rotate(-2deg); }
}

@media (max-width: 768px) {
    #studentForm {
        flex-direction: column;
    }

    #studentForm input {
        min-width: 100%;
    }

    .controls {
        flex-direction: column;
        align-items: flex-start;
    }

    table {
        font-size: 0.9em;
    }

    th, td {
        padding: 10px;
    }
}