* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    text-align: center;
    padding: 30px 20px;
}

header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 600;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    padding: 30px;
}

.instruction-panel {
    background: #f8f9ff;
    border: 2px solid #e3e8ff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.instruction {
    font-size: 1.2rem;
    font-weight: 500;
    color: #4338ca;
}

.phrase-container {
    background: #fff;
    border: 3px solid #e5e7eb;
    border-radius: 15px;
    padding: 40px 20px;
    margin-bottom: 30px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phrase {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    font-size: 1.8rem;
    font-weight: 500;
}

.word {
    position: relative;
    padding: 12px 18px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 60px;
    text-align: center;
    user-select: none;
}

.word:hover {
    border-color: #6366f1;
    background: #eef2ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.word.primary {
    border-color: #dc2626;
    background: #fef2f2;
    color: #dc2626;
}

.word.primary::after {
    content: '●';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.word.anchor {
    border-color: #2563eb;
    background: #eff6ff;
    color: #2563eb;
}

.word.anchor::after {
    content: '◯';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #2563eb;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.word.correct {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #16a34a;
    animation: correctPulse 0.6s ease-out;
}

.word.incorrect {
    border-color: #dc2626;
    background: #fef2f2;
    color: #dc2626;
    animation: incorrectShake 0.6s ease-out;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #4f46e5;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #4338ca;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.feedback-panel {
    margin-bottom: 30px;
}

.feedback {
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.feedback.success {
    background: #f0fdf4;
    border: 2px solid #16a34a;
    color: #16a34a;
}

.feedback.error {
    background: #fef2f2;
    border: 2px solid #dc2626;
    color: #dc2626;
}

.feedback.hidden {
    display: none;
}

.progress-panel {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 500;
    color: #4b5563;
}

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

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    width: 0%;
    transition: width 0.5s ease;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #4b5563;
}

.symbol {
    font-size: 1.5rem;
    font-weight: bold;
}

.primary-symbol {
    color: #dc2626;
}

.anchor-symbol {
    color: #2563eb;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    header p {
        font-size: 1rem;
    }

    main {
        padding: 20px;
    }

    .phrase {
        font-size: 1.5rem;
        gap: 10px;
    }

    .word {
        padding: 10px 14px;
        min-width: 50px;
    }

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

    .btn {
        width: 100%;
        max-width: 200px;
    }

    .progress-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .legend {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .phrase {
        font-size: 1.3rem;
        gap: 8px;
    }

    .word {
        padding: 8px 12px;
        min-width: 40px;
        font-size: 1.3rem;
    }

    .instruction {
        font-size: 1.1rem;
    }
}