/* ========== VARIABLES & RESET ========== */
:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #8B85FF;
    --success: #2ECC71;
    --success-dark: #27AE60;
    --danger: #E74C3C;
    --danger-dark: #C0392B;
    --warning: #F39C12;
    --info: #3498DB;
    --bg: #F0F2F5;
    --card-bg: #FFFFFF;
    --text: #2C3E50;
    --text-light: #7F8C8D;
    --border: #E0E0E0;
    --shadow: 0 4px 15px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-height: 70px;
    --header-height: 60px;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

body::before {
    content: '+ × − ÷ = 1 2 3 4 5 6 7 8 9 × + − ÷ = 3 × 7 = 21   5 + 3 = 8   12 − 4 = 8   9 × 6 = 54   7 + 5 = 12   8 × 3 = 24   15 − 9 = 6   4 × 4 = 16   + × − ÷ = 1 2 3 × 5 6 + 7 − 8 ÷ 9 = 10 × 11 + 12 − 6 ÷ 3 = 2 × 8 = 16   7 + 9 = 16   11 × 3 = 33   6 − 2 = 4   × + − ÷ = 4 × 9 = 36   12 + 8 = 20   3 × 11 = 33   15 − 7 = 8   2 × 6 = 12   + × − ÷ 1 2 3 4 5 6 7 8 9 10 11 12 × + − ÷ = 5 × 5 = 25   8 + 4 = 12   10 × 2 = 20   9 − 3 = 6';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-size: 1.3rem;
    font-weight: 700;
    color: rgba(108, 99, 255, 0.06);
    z-index: 0;
    pointer-events: none;
    word-break: break-all;
    line-height: 2.2;
    letter-spacing: 6px;
    padding: 20px;
    overflow: hidden;
}

html {
    height: -webkit-fill-available;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* ========== HEADER ========== */
.app-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    box-shadow: 0 2px 10px rgba(108, 99, 255, 0.3);
}

.app-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header-stats {
    display: flex;
    gap: 12px;
}

.stat-badge {
    background: rgba(255,255,255,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
}

/* ========== NAVIGATION ========== */
.main-nav {
    display: flex;
    background: var(--card-bg);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: var(--header-height);
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.nav-btn {
    flex: 1;
    padding: 10px 4px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: var(--transition);
    color: var(--text-light);
    position: relative;
    font-family: 'Nunito', sans-serif;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    width: 60%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.nav-icon {
    font-size: 1.4rem;
}

.nav-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== VIEWS ========== */
.views-container {
    flex: 1;
    padding: 20px;
    padding-bottom: 40px;
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

.hidden {
    display: none !important;
}

/* ========== HOME VIEW ========== */
.home-hero {
    text-align: center;
    padding: 30px 20px;
}

.hero-emoji {
    font-size: 4rem;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.home-hero h2 {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 8px;
}

.home-hero p {
    color: var(--text-light);
    font-size: 1.05rem;
}

.home-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}

.home-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    border: 2px solid transparent;
}

.home-card:hover, .home-card:active {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-practice { border-left: 4px solid var(--primary); }
.card-quiz { border-left: 4px solid var(--warning); }
.card-table { border-left: 4px solid var(--success); }
.card-stats { border-left: 4px solid var(--info); }

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.home-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.home-card p {
    font-size: 0.85rem;
    color: var(--text-light);
}

.home-difficulty {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.home-difficulty h3 {
    text-align: center;
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.diff-btn {
    padding: 16px 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    transition: var(--transition);
    text-align: center;
    line-height: 1.4;
}

.diff-btn.active {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.08);
    color: var(--primary);
}

.diff-btn small {
    font-weight: 600;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ========== PRACTICE VIEW ========== */
.practice-select h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.table-select-btn {
    padding: 20px 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    transition: var(--transition);
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
}

.table-select-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.table-select-btn .mastery-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.75rem;
}

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

.back-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.practice-progress {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-light);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin-bottom: 24px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.question-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 40px 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.question-text {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 24px;
    letter-spacing: 2px;
}

.answer-input {
    width: 200px;
    padding: 16px;
    font-size: 2rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    text-align: center;
    border: 3px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
    -moz-appearance: textfield;
}

.answer-input::-webkit-outer-spin-button,
.answer-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.answer-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.15);
}

.answer-input.correct {
    border-color: var(--success);
    background: rgba(46, 204, 113, 0.08);
}

.answer-input.wrong {
    border-color: var(--danger);
    background: rgba(231, 76, 60, 0.08);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.question-feedback {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 12px 0;
}

.feedback-correct {
    color: var(--success);
}

.feedback-wrong {
    color: var(--danger);
}

.submit-btn {
    padding: 14px 50px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

/* ========== RESULTS ========== */
.results-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s ease;
}

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

.results-card h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 2rem;
    font-weight: 900;
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.3);
}

.results-details {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.result-stat {
    font-size: 1rem;
    font-weight: 700;
}

.results-mistakes {
    background: rgba(231, 76, 60, 0.05);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 20px;
    text-align: left;
}

.results-mistakes h3 {
    margin-bottom: 10px;
    color: var(--danger);
}

.results-mistakes ul {
    list-style: none;
}

.results-mistakes li {
    padding: 6px 0;
    font-weight: 600;
    border-bottom: 1px solid rgba(231, 76, 60, 0.1);
}

.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.action-btn.secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.action-btn.danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    border: 2px solid rgba(231, 76, 60, 0.2);
}

.action-btn:hover {
    transform: translateY(-2px);
}

/* ========== QUIZ VIEW ========== */
.quiz-setup {
    text-align: center;
    padding: 20px;
}

.quiz-setup h2 {
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.quiz-setup > p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.quiz-options {
    margin-bottom: 30px;
}

.quiz-option label {
    font-weight: 700;
    display: block;
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.time-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.time-btn {
    padding: 12px 28px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.time-btn.active {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.08);
    color: var(--primary);
}

.start-quiz-btn {
    padding: 18px 60px;
    background: linear-gradient(135deg, var(--warning), #E67E22);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: 'Nunito', sans-serif;
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(243, 156, 18, 0.3);
    margin-bottom: 30px;
}

.start-quiz-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(243, 156, 18, 0.4);
}

.quiz-record {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: inline-block;
}

.quiz-record h3 {
    margin-bottom: 8px;
}

.record-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--warning);
}

/* Quiz Game */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.quiz-timer {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary);
    min-width: 80px;
}

.quiz-timer.warning {
    color: var(--warning);
    animation: pulse 0.5s infinite;
}

.quiz-timer.danger {
    color: var(--danger);
    animation: pulse 0.3s infinite;
}

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

.quiz-score {
    font-size: 1.3rem;
    font-weight: 800;
}

.timer-bar-container {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-bottom: 24px;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 3px;
    transition: width 1s linear;
    width: 100%;
}

.timer-bar.warning {
    background: linear-gradient(90deg, var(--warning), #F1C40F);
}

.timer-bar.danger {
    background: linear-gradient(90deg, var(--danger), #E74C3C);
}

.quiz-card {
    padding: 30px;
}

.quiz-card .question-text {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.quiz-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.quiz-option-btn {
    padding: 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    font-family: 'Nunito', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
}

.quiz-option-btn:hover {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.05);
}

.quiz-option-btn.correct {
    border-color: var(--success);
    background: rgba(46, 204, 113, 0.15);
    color: var(--success-dark);
}

.quiz-option-btn.wrong {
    border-color: var(--danger);
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger-dark);
}

.quiz-combo {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    margin-top: 16px;
    min-height: 30px;
    color: var(--warning);
}

.new-record {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--warning);
    margin: 16px 0;
    animation: pulse 0.6s infinite;
}

/* Quiz Results */
.quiz-results-card {
    background: var(--card-bg);
}

.quiz-score-circle {
    background: linear-gradient(135deg, var(--warning), #E67E22);
}

/* ========== TABLE VIEW ========== */
.table-container {
    text-align: center;
}

.table-container h2 {
    margin-bottom: 8px;
}

.table-instruction {
    color: var(--text-light);
    margin-bottom: 16px;
}

.table-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.table-ctrl-btn {
    padding: 10px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.table-ctrl-btn:hover {
    border-color: var(--primary);
}

.table-ctrl-btn.active {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.08);
    color: var(--primary);
}

.pythagorean-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
}

.pythagorean-table {
    border-collapse: collapse;
    margin: 0 auto;
    font-size: 1rem;
}

.pythagorean-table th,
.pythagorean-table td {
    width: 52px;
    height: 48px;
    text-align: center;
    border: 1px solid var(--border);
    font-weight: 700;
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
}

.pythagorean-table th {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 0.95rem;
    cursor: default;
}

.pythagorean-table th.corner {
    background: var(--primary-dark);
}

.pythagorean-table td {
    background: var(--card-bg);
    font-size: 0.95rem;
}

.pythagorean-table td:hover {
    background: rgba(108, 99, 255, 0.1);
    transform: scale(1.05);
}

.pythagorean-table td.revealed {
    background: rgba(46, 204, 113, 0.1);
    color: var(--text);
}

.pythagorean-table td.hidden-cell {
    color: transparent;
    background: rgba(108, 99, 255, 0.03);
}

.pythagorean-table td.highlight-row {
    background: rgba(108, 99, 255, 0.08);
}

.pythagorean-table td.highlight-col {
    background: rgba(108, 99, 255, 0.08);
}

.pythagorean-table td.highlight-cell {
    background: rgba(108, 99, 255, 0.2);
    transform: scale(1.1);
    font-weight: 900;
    box-shadow: 0 0 10px rgba(108, 99, 255, 0.3);
}

/* Table quiz mode input */
.cell-input {
    width: 40px;
    height: 36px;
    border: 2px solid var(--primary-light);
    border-radius: 6px;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    outline: none;
    -moz-appearance: textfield;
}

.cell-input::-webkit-outer-spin-button,
.cell-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.cell-input.cell-correct {
    border-color: var(--success);
    background: rgba(46, 204, 113, 0.15);
    color: var(--success-dark);
}

.cell-input.cell-wrong {
    border-color: var(--danger);
    background: rgba(231, 76, 60, 0.15);
    color: var(--danger-dark);
}

/* ========== STATS VIEW ========== */
.stats-container h2 {
    text-align: center;
    margin-bottom: 20px;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-tables {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.stats-tables h3 {
    margin-bottom: 16px;
    text-align: center;
}

.mastery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.mastery-item {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 14px 8px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.mastery-item .mastery-number {
    font-size: 1.3rem;
    font-weight: 900;
    margin-bottom: 4px;
}

.mastery-item .mastery-percent {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-light);
}

.mastery-item .mastery-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--primary);
    transition: width 0.5s ease;
}

.mastery-item.mastered {
    background: rgba(46, 204, 113, 0.1);
    border: 2px solid rgba(46, 204, 113, 0.3);
}

.mastery-item.mastered .mastery-bar {
    background: var(--success);
}

.stats-history {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.stats-history h3 {
    margin-bottom: 16px;
    text-align: center;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

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

.history-item:last-child {
    border-bottom: none;
}

.history-info {
    display: flex;
    flex-direction: column;
}

.history-title {
    font-weight: 700;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.history-score {
    font-weight: 800;
    font-size: 1.1rem;
}

.history-score.good { color: var(--success); }
.history-score.okay { color: var(--warning); }
.history-score.bad { color: var(--danger); }

.empty-history {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

.stats-actions {
    text-align: center;
    margin-top: 16px;
}

/* ========== CONFETTI ========== */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1000;
    animation: confetti-fall 1.5s ease-out forwards;
}

@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(400px) rotate(720deg); }
}

/* ========== RESPONSIVE - IPAD PRO OPTIMIZATIONS ========== */
@media (min-width: 768px) {
    .views-container {
        padding: 30px 40px;
    }

    .home-cards {
        grid-template-columns: repeat(4, 1fr);
    }

    .home-hero h2 {
        font-size: 2.2rem;
    }

    .hero-emoji {
        font-size: 5rem;
    }

    .question-text {
        font-size: 3.5rem;
    }

    .answer-input {
        width: 260px;
        font-size: 2.4rem;
        padding: 20px;
    }

    .table-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .quiz-options-grid {
        max-width: 500px;
    }

    .quiz-option-btn {
        padding: 24px;
        font-size: 1.6rem;
    }

    .pythagorean-table th,
    .pythagorean-table td {
        width: 65px;
        height: 56px;
        font-size: 1.1rem;
    }

    .stats-overview {
        grid-template-columns: repeat(4, 1fr);
    }

    .mastery-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .nav-btn {
        padding: 12px;
    }

    .nav-icon {
        font-size: 1.6rem;
    }

    .nav-label {
        font-size: 0.82rem;
    }

    .results-details {
        gap: 40px;
    }
}

@media (min-width: 1024px) {
    .home-cards {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .home-card {
        padding: 30px 24px;
    }

    .difficulty-buttons {
        max-width: 500px;
        margin: 0 auto;
    }

    .table-grid {
        grid-template-columns: repeat(6, 1fr);
        max-width: 600px;
        margin: 0 auto;
    }

    .question-card {
        max-width: 600px;
        margin: 0 auto;
    }

    .pythagorean-table th,
    .pythagorean-table td {
        width: 72px;
        height: 60px;
        font-size: 1.15rem;
    }
}

/* Landscape iPad optimizations */
@media (min-width: 768px) and (orientation: landscape) {
    .home-hero {
        padding: 20px;
    }

    .hero-emoji {
        font-size: 3.5rem;
    }

    .home-hero h2 {
        font-size: 1.8rem;
    }
}

/* Safe area for notch/home indicator */
@supports (padding: max(0px)) {
    .app-header {
        padding-top: max(14px, env(safe-area-inset-top));
    }

    .views-container {
        padding-bottom: max(40px, env(safe-area-inset-bottom));
    }
}
