:root {
    --primary-color: #6C63FF;
    --secondary-color: #FF6584;
    --background-dark: #1a1a2e;
    --background-light: #16213e;
    --text-color: #ffffff;
    --text-muted: #a0a0a0;
    --success-color: #00b894;
    --error-color: #d63031;
    --warning-color: #fdcb6e;
    --card-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --font-family: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--background-dark) 0%, var(--background-light) 100%);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 480px;
    /* Mobile width constraint */
    height: 100%;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: scale(0.95);
}

.screen.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

.hidden {
    display: none;
}

.content-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

.input-group {
    width: 100%;
    margin-bottom: 20px;
}

input {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--primary-color);
}

.btn {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
    margin-bottom: 15px;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
}

.btn-success {
    background: var(--success-color);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.btn-warning {
    background: var(--warning-color);
    color: #2d3436;
    box-shadow: 0 4px 15px rgba(253, 203, 110, 0.4);
}

/* Home Screen */
.user-profile {
    margin-bottom: 50px;
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

#user-welcome {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.coin-balance {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    color: var(--warning-color);
    border: 1px solid var(--glass-border);
}

.stats-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 15px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.home-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-lg {
    padding: 20px;
    font-size: 1.3rem;
}

.icon {
    margin-right: 10px;
}

/* Quiz Screen */
.quiz-header {
    margin-bottom: 30px;
}

.timer-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 15px;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: var(--secondary-color);
    width: 100%;
    transition: width 1s linear;
}

.quiz-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-info {
    display: flex;
    flex-direction: column;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: left;
}

.lifelines {
    display: flex;
    gap: 10px;
}

.lifeline-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lifeline-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-color);
    color: white;
    font-size: 0.6rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid white;
}

.lifeline-btn:active {
    transform: scale(0.9);
}

.lifeline-btn.used {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.2);
    text-decoration: line-through;
}

.question-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

#question-text {
    font-size: 1.5rem;
    line-height: 1.4;
    text-align: center;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.option-btn {
    padding: 18px;
    border-radius: 12px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    color: white;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.option-btn.correct {
    background: var(--success-color);
    border-color: var(--success-color);
}

.option-btn.wrong {
    background: var(--error-color);
    border-color: var(--error-color);
}

/* Results Screen */
.score-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    background: rgba(108, 99, 255, 0.1);
    box-shadow: 0 0 30px rgba(108, 99, 255, 0.2);
}

#final-score {
    font-size: 3.5rem;
    font-weight: 700;
}

/* Leaderboard */
.leaderboard-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 20px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--card-bg);
    margin-bottom: 10px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}

.rank {
    font-weight: bold;
    color: var(--secondary-color);
    width: 30px;
}

.user-info {
    flex: 1;
    text-align: left;
}

.score {
    font-weight: bold;
    color: var(--success-color);
}

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

.icon-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Loader */
.loader {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Categories */
.category-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 10px 0;
}

.category-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.category-card:active {
    transform: scale(0.95);
}

.cat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    display: block;
}

.cat-name {
    font-weight: 600;
}

/* Shop */
.shop-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.shop-item {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.item-icon {
    font-size: 2rem;
    width: 50px;
    text-align: center;
}

.item-details {
    flex: 1;
    text-align: left;
}

.item-details h3 {
    font-size: 1rem;
    margin-bottom: 5px;
}

.item-details p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-buy {
    background: var(--warning-color);
    color: #2d3436;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.btn-buy:active {
    transform: scale(0.95);
}

.header-coins {
    margin-left: auto;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}