* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 100%;
    position: relative;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 10px;
    font-size: 28px;
}

.instructions {
    text-align: center;
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
}

.study-view {
    display: block;
}

.quiz-view {
    display: none;
}

.study-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.study-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.study-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.study-card .term {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 12px;
    border: none;
}

.study-card .definition {
    font-size: 16px;
    color: #495057;
    line-height: 1.5;
    border: none;
}

.start-quiz-container {
    text-align: center;
    margin-top: 30px;
}

.start-quiz-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.start-quiz-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.view-transition {
    animation: fadeIn 0.5s ease;
}

.game-area {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
}

.column {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    cursor: default;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    user-select: none;
}

.item:hover {
    background: #e9ecef;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.term {
    border-left: 4px solid #667eea;
}

.definition {
    border-right: 4px solid #764ba2;
}

.item.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.item.matched {
    background: #e9ecef;
    color: inherit;
    border-color: #adb5bd;
    cursor: default;
}

.item.matched:hover {
    transform: none;
}

.item.correct {
    background: #51cf66;
    color: white;
    border-color: #51cf66;
    animation: pulse 0.6s ease;
}

.item.incorrect {
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

.connect-point {
    position: absolute;
    width: 24px;
    height: 24px;
    background: #667eea;
    border-radius: 50%;
    cursor: grab;
    transition: all 0.2s ease;
    z-index: 10;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.term .connect-point {
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
}

.definition .connect-point {
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
}

.connect-point:active {
    cursor: grabbing;
}

.connect-point:hover {
    transform: translateY(-50%) scale(1.3);
    background: #764ba2;
}

.item.matched .connect-point {
    background: #adb5bd;
}

.item.correct .connect-point {
    background: #51cf66;
}

.item.incorrect .connect-point {
    background: #ff6b6b;
}

svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.line {
    stroke-width: 3;
    fill: none;
    stroke: #667eea;
    opacity: 0.6;
}

.line.matched {
    stroke: #51cf66;
    opacity: 0.8;
    stroke-width: 4;
}

.line.incorrect {
    stroke: #ff6b6b;
    opacity: 0.8;
    stroke-width: 4;
}

.line.dragging {
    stroke: #ffd43b;
    opacity: 0.8;
    stroke-width: 3;
    stroke-dasharray: 5, 5;
}

#message {
    text-align: center;
    margin-top: 30px;
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    min-height: 30px;
    animation: fadeIn 0.5s ease;
}

#progress {
    text-align: center;
    margin-top: 15px;
    font-size: 16px;
    color: #667eea;
    font-weight: 500;
}

.celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    animation: celebrate 1s ease-out;
    pointer-events: none;
    z-index: 1000;
}

@keyframes celebrate {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotate(360deg);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes matchSuccess {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.item.success-animation {
    animation: matchSuccess 0.5s ease;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.btn {
    padding: 12px 30px;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.check-btn {
    background: #51cf66;
}

.check-btn:hover {
    background: #40c057;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.check-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
}

.reset-btn {
    background: #667eea;
}

.reset-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
