:root {
    --primary: #7c4dff;
    --bg-gray: #f2f2f7;
    --text-dark: #1c1c1e;
    --text-muted: #8e8e93;
    --correct: #4caf50;
    --present: #ff9800;
    --absent: #78909c;
    --tile-bg: #ffffff;
    --border: #e5e5ea;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
    background-color: var(--bg-gray);
    color: var(--text-dark);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.app-wrapper {
    width: 100%;
    max-width: 480px;
    background-color: var(--bg-gray);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* User Profile Header */
.user-header {
    background: white;
    padding: 24px 20px 10px;
}

.level-section {
    margin-bottom: 15px;
}

.level-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.level-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 5px 0;
}

.level-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
}

.points {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.progress-container {
    width: 100%;
    height: 6px;
    background: #efeff4;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    width: 65%;
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
}

.profile-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.welcome h2 {
    font-size: 28px;
    font-weight: 800;
}

.tag {
    display: inline-block;
    background: #f3f0ff;
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 5px;
}

.avatar-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    overflow: hidden;
}

/* Game Controls */
.game-controls {
    padding: 20px;
}

.section-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.tabs-row {
    display: flex;
    background: #e5e5ea;
    padding: 4px;
    border-radius: 14px;
}

.tab-btn {
    flex: 1;
    border: none;
    background: none;
    padding: 10px;
    font-weight: 700;
    color: var(--text-muted);
    border-radius: 11px;
    cursor: pointer;
    font-size: 14px;
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Gameplay Board */
.game-board-container {
    background: white;
    margin: 0 20px 20px;
    padding: 30px 20px;
    border-radius: 30px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    display: flex;
    gap: 8px;
}

.tile {
    width: 52px;
    height: 52px;
    border: 2px solid #d1d1d6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    text-transform: uppercase;
    background: white;
}

.tile[data-state='active'] { border-color: var(--primary); }
.tile[data-state='correct'] { background: var(--correct); color: white; border-color: var(--correct); }
.tile[data-state='present'] { background: var(--present); color: white; border-color: var(--present); }
.tile[data-state='absent'] { background: var(--absent); color: white; border-color: var(--absent); }

/* Keyboard */
.keyboard-section {
    margin-top: auto;
    padding: 20px;
    width: 100%;
}

#keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.kb-key {
    background: #e5e5ea;
    border: none;
    border-radius: 8px;
    padding: 14px 6px;
    min-width: 32px;
    font-weight: 700;
    color: var(--text-dark);
    font-size: 14px;
    cursor: pointer;
}

.kb-key.wide { min-width: 52px; font-size: 11px; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

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

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    width: 90%;
    max-width: 380px;
}

.btn-continue {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 12px;
    font-weight: 800;
    margin-top: 20px;
    cursor: pointer;
}

/* Bottom Nav */
.bottom-nav {
    background: white;
    border-top: 1px solid #e5e5ea;
    display: flex;
    justify-content: space-around;
    padding: 10px 0 25px;
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #a1a1a6;
    font-size: 10px;
    font-weight: 700;
}

.nav-btn.active { color: var(--primary); }
.nav-btn svg { width: 22px; height: 22px; margin-bottom: 4px; }
