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

:root {
    --primary-color: #4A90E2;
    --primary-hover: #357ABD;
    --success-color: #5CB85C;
    --error-color: #D9534F;
    --text-color: #333;
    --text-secondary: #666;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --border-color: #e1e8ed;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 600px;
    width: 100%;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 32px;
    position: relative;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.lang-btn:hover {
    background: var(--bg-color);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 28px;
    margin-bottom: 12px;
    color: var(--text-color);
    font-weight: 600;
}

header p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Form */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 15px;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--card-bg);
    color: var(--text-color);
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

textarea {
    resize: vertical;
    min-height: 150px;
}

small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

#char-counter {
    text-align: right;
}

/* Submit Button */
button[type="submit"] {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

button[type="submit"]:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

button[type="submit"]:active {
    transform: translateY(0);
}

button[type="submit"]:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

/* Message */
.message {
    padding: 16px;
    border-radius: 8px;
    margin-top: 24px;
    text-align: center;
    font-size: 15px;
}

.message.hidden {
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Footer */
footer {
    margin-top: 32px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Level Cards */
.level-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.level-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--card-bg);
    position: relative;
}

.level-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
    transform: translateY(-2px);
}

.level-card.selected {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.05);
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.level-number {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.level-card input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.level-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 600;
}

.level-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.level-card ul {
    list-style: none;
    padding-left: 0;
}

.level-card ul li {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 4px 0;
    padding-left: 20px;
    position: relative;
}

.level-card ul li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .container {
        padding: 24px 20px;
    }

    h1 {
        font-size: 24px;
    }

    header p {
        font-size: 15px;
    }

    .language-selector {
        justify-content: center;
    }

    .lang-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .level-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 20px 16px;
        border-radius: 12px;
    }

    h1 {
        font-size: 22px;
    }

    input[type="text"],
    textarea {
        padding: 10px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    button[type="submit"] {
        padding: 12px 20px;
    }

    .tab-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}
