:root {
    --primary-color: #ff7043;
    --secondary-color: #ffa07a;
    --accent-color: #ffc107;
    --background-color: #fff8f0;
    --text-color: #333;
    --light-text: #6c757d;
    --success-color: #28a745;
    --error-color: #f44336;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 2rem 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow-y: auto;
}

.container {
    width: 90%;
    max-width: 800px;
    background: var(--background-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    border: 4px solid #ffcccb;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

h1 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.api-key-section {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #fefefe;
    border-radius: var(--border-radius);
    border: 1px solid #eee;
}

.api-key-section h3 {
    margin-top: 0;
}

select, input {
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
    background-color: white;
    font-size: 0.9rem;
}

input[type="text"] {
    width: 100%;
    margin-bottom: 0.5rem;
}

.quiz-section {
    margin-bottom: 2rem;
}

.question-card {
    overflow: hidden; /* prevents child overflow */
    padding: 1rem; /* slightly smaller padding */
  }
  
  textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 1.2rem;
    resize: vertical;
    margin: 0.5rem 0;
  }
  

.question-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.answer-section {
    margin-bottom: 1.5rem;
}



.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

button {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

button:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}

button:active {
    transform: scale(1);
}

button:disabled {
    background-color: var(--light-text);
    cursor: not-allowed;
    transform: none;
}

button.secondary {
    background-color: var(--light-text);
}

button.success {
    background-color: var(--success-color);
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
}

.feedback {
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
    font-size: 1.2rem;
    border-left: 6px solid var(--accent-color);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
}

.feedback.correct {
    border-left-color: var(--success-color);
}

.feedback.incorrect {
    border-left-color: var(--error-color);
}

.percentage {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.note {
    color: var(--light-text);
}

.progress-bar {
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.results {
    text-align: center;
}

.score {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 1rem 0;
}

.score-text {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.hidden {
    display: none;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeIn 0.3s ease forwards;
}

/* Mobile */
@media (max-width: 600px) {
    .container {
        width: 95%;
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .button-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

button:focus, textarea:focus, select:focus, input:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}
