@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&display=swap');

:root {
    --primary: #58cc02;
    --primary-alt: #46a302;
    --secondary: #1cb0f6;
    --secondary-alt: #1899d6;
    --warning: #ffc800;
    --warning-alt: #e5b400;
    --danger: #ff4b4b;
    --danger-alt: #e54343;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.9);
    --bg-color: #f7f7f7;
    --text-main: #4b4b4b;
    --text-muted: #777777;
    --border-color: #e5e5e5;
    --card-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Layout */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

/* Header & Progress */
header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.close-btn {
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
}

.progress-bar-outer {
    flex-grow: 1;
    height: 16px;
    background-color: var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.progress-bar-inner {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    border-radius: 20px;
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.progress-bar-inner::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 10px;
    right: 10px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* Scenes */
.scene {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.scene.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 16px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    transition: all 0.1s;
    user-select: none;
    text-align: center;
    width: 100%;
    margin-bottom: 20px;
    font-size: 16px;
    letter-spacing: 0.8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 0 var(--primary-alt);
}

.btn-primary:active {
    box-shadow: 0 0 0 var(--primary-alt);
    transform: translateY(4px);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
    box-shadow: 0 4px 0 var(--secondary-alt);
}

.btn-secondary:active {
    box-shadow: 0 0 0 var(--secondary-alt);
    transform: translateY(4px);
}

.btn-disabled {
    background-color: var(--border-color);
    color: var(--text-muted);
    box-shadow: 0 4px 0 #cccccc;
    cursor: not-allowed;
}

/* Dashboard Grid */
.levels-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px 0;
}

.level-card {
    aspect-ratio: 1;
    background: white;
    border: 3px solid var(--border-color);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    box-shadow: var(--card-shadow);
}

.level-card.locked {
    background: #f0f0f0;
    cursor: not-allowed;
}

.level-card.locked i {
    opacity: 0.5;
}

.level-card.active {
    border-color: var(--primary);
    background: #eef9e5;
}

.level-number {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
}

.level-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Learning Screen */
.learn-display {
    text-align: center;
    padding: 40px 0;
}

.table-row {
    font-size: 32px;
    font-weight: 700;
    margin: 15px 0;
    padding: 15px;
    background: white;
    border-radius: 16px;
    border: 2px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.table-row:hover {
    transform: scale(1.05);
    border-color: var(--secondary);
}

/* Quiz Screen */
.quiz-question {
    font-size: 48px;
    font-weight: 800;
    text-align: center;
    margin: 40px 0;
    color: var(--text-main);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.option-btn {
    background: white;
    border: 3px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: var(--card-shadow);
}

.option-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

.option-btn.selected {
    border-color: var(--secondary);
    background-color: #e3f6ff;
}

.option-btn.correct {
    border-color: var(--primary);
    background-color: #eef9e5;
    color: var(--primary-alt);
}

.option-btn.wrong {
    border-color: var(--danger);
    background-color: #fff1f1;
    color: var(--danger-alt);
}

/* Feedback Overlay */
.feedback-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    background-color: var(--white);
    border-top: 2px solid var(--border-color);
    z-index: 100;
    max-width: 600px;
    margin: 0 auto;
}

.feedback-footer.active {
    transform: translateY(0);
}

.feedback-content {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.feedback-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.feedback-text {
    flex-grow: 1;
}

.feedback-title {
    font-weight: 800;
    font-size: 20px;
}

.feedback-footer.correct {
    background-color: #d7ffb8;
    color: var(--primary-alt);
}

.feedback-footer.wrong {
    background-color: #ffdfe0;
    color: var(--danger-alt);
}

/* Mascot SVG Styling */
.mascot-container {
    height: 150px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Success Screen */
.success-card {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 80px;
    color: var(--warning);
    margin-bottom: 20px;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 24px 24px 0 0;
    padding: 30px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

.modal-header h3 {
    font-size: 24px;
    font-weight: 800;
}

/* Settings Items */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.settings-info {
    flex-grow: 1;
    padding-right: 20px;
}

.settings-label {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 4px;
}

.settings-desc {
    font-size: 14px;
    color: var(--text-muted);
}

/* Custom Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}
