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

:root {
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-color: white;
    --text-color: #333;
    --card-bg: #f8f9fa;
    --border-color: #e9ecef;
    --upload-bg: #e9ecef;
    --upload-border: #adb5bd;
    --placeholder-bg: #f8f8f8;
    --placeholder-color: #999;
    --profile-border: #e0e0e0;
}

[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    --bg-color: #1a202c;
    --text-color: #e2e8f0;
    --card-bg: #2d3748;
    --border-color: #4a5568;
    --upload-bg: #2d3748;
    --upload-border: #4a5568;
    --placeholder-bg: #2d3748;
    --placeholder-color: #a0aec0;
    --profile-border: #4a5568;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-color);
    transition: all 0.3s ease;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-color);
    position: relative;
    transition: all 0.3s ease;
}

.screen {
    display: none;
    padding: 40px 30px;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Profile Screen */
.profile-section {
    text-align: center;
    margin-bottom: 40px;
}

.profile-picture {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    background: var(--placeholder-bg);
    border: 4px solid var(--profile-border);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-picture:hover {
    transform: scale(1.05);
}

.profile-picture img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--placeholder-bg);
    color: var(--placeholder-color);
    font-size: 14px;
}

.greeting {
    font-size: 22px;
    font-weight: 300;
    margin-bottom: 30px;
    color: var(--text-color);
    text-align: center;
}

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

.points-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 40px;
    transition: all 0.3s ease;
}

.points-display {
    text-align: center;
}

.points-available {
    font-size: 36px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
}

.points-total {
    font-size: 16px;
    color: var(--placeholder-color);
}

.upload-section {
    text-align: center;
    margin-bottom: 40px;
}

.upload-btn {
    background: var(--upload-bg);
    border: 2px dashed var(--upload-border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--placeholder-color);
}

.upload-btn:hover {
    background: #dee2e6;
    border-color: #667eea;
    color: #667eea;
}

.primary-btn {
    width: 100%;
    background: #667eea;
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
}

.primary-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.secondary-btn {
    width: 100%;
    background: #28a745;
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

/* Power-ups Screen */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #667eea;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.back-btn:hover {
    background: #f0f0f0;
}

.powerups-title {
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 30px;
    text-align: center;
}

.powerups-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.powerup-item {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.powerup-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.powerup-name {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-color);
}

.powerup-cost {
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
}

.hidden-input {
    display: none;
}

.dark-mode-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 26px;
    background: var(--border-color);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.dark-mode-toggle::before {
    content: '🌙';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: var(--bg-color);
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

[data-theme="dark"] .dark-mode-toggle {
    background: #667eea;
}

[data-theme="dark"] .dark-mode-toggle::before {
    content: '☀️';
    transform: translateX(24px);
}

@media (max-width: 480px) {
    .container {
        max-width: 100%;
    }

    .screen {
        padding: 30px 20px;
    }

    .greeting {
        font-size: 24px;
    }

    .points-available {
        font-size: 32px;
    }
}

/* ── Toasts ── */
.toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}

.toast {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    animation: toast-in 0.25s ease, toast-out 0.3s ease 2.7s forwards;
    max-width: 320px;
}

.toast--success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.toast--error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.toast--warning {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}

.toast--info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

[data-theme="dark"] .toast--info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.25);
}

[data-theme="dark"] .toast--success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.25);
}

[data-theme="dark"] .toast--error {
    background: rgba(220, 38, 38, 0.15);
    color: #f87171;
    border-color: rgba(220, 38, 38, 0.25);
}

[data-theme="dark"] .toast--warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.25);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(12px); }
}

.toast--dismiss {
    animation: toast-out 0.3s ease forwards;
}

/* ── Upload loading toast ── */
.toast--loading {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.25s ease;
}

.upload-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

.topnav {
    width: 100%;
    height: 52px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-sizing: border-box;
}

.topnav-brand {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: 0.01em;
    text-decoration: none;
}

.points-inline-icon {
    width: 1.1em;
    height: 1.1em;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: -0.15em;
    display: inline-block;
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topnav-user {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.topnav-points {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color);
}

.topnav-points-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.topnav-logout {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 10px;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.topnav-logout:hover {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

[data-theme="dark"] .topnav-logout {
    background: rgba(220, 38, 38, 0.15);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.4);
}

[data-theme="dark"] .topnav-logout:hover {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
