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

:root {
    --bg: #e8f0e4;
    --surface: #ffffff;
    --surface2: #c8dbbe;
    --primary: #2d6a1e;
    --primary-hover: #3d8a2e;
    --text: #1a2e12;
    --text-muted: #5a7a4a;
    --success: #2d6a1e;
    --danger: #b33a2a;
    --warning: #c87e14;
    --radius: 12px;
}

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

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.hidden {
    display: none;
}

.hidden {
    display: none !important;
}

.logo {
    font-size: 80px;
    margin-bottom: 10px;
}

.logo-small {
    font-size: 28px;
}

h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

h2 {
    font-size: 1.3rem;
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
    width: 100%;
    max-width: 320px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="date"],
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--surface2);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

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

.form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.form-row input {
    flex: 1;
    min-width: 0;
}

.gender-select {
    width: auto;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
    background: var(--surface2);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-large {
    padding: 16px 40px;
    font-size: 1.3rem;
    font-weight: bold;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* Profile list */
.profile-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
    max-width: 500px;
}

.profile-btn {
    padding: 16px 28px;
    border: 2px solid var(--surface2);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-btn:hover {
    border-color: var(--primary);
    background: var(--surface2);
}

.muted {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 12px;
}

.error {
    color: var(--danger);
    margin-top: 10px;
}

/* Header */
header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--surface2);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-badge {
    background: var(--surface2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Main screen */
#main-screen, #admin-screen {
    justify-content: flex-start;
    padding: 0;
}

.main-content {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

/* Today card */
.today-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
}

.squats-number {
    font-size: 5rem;
    font-weight: 900;
    color: var(--warning);
    line-height: 1;
    margin: 10px 0;
    transition: color 0.3s ease;
}

.squats-number.done {
    color: var(--primary);
}

.today-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    transition: box-shadow 0.3s ease;
}

.today-card.pending {
    box-shadow: 0 0 0 3px var(--warning), 0 4px 12px rgba(200, 126, 20, 0.2);
}

.today-card.done {
    box-shadow: 0 0 0 3px var(--success), 0 4px 12px rgba(45, 106, 30, 0.2);
}

.squats-label {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.success-msg {
    color: var(--success);
    font-size: 1.2rem;
    font-weight: bold;
    padding: 10px;
}

.eliminated-msg {
    color: var(--danger);
    font-size: 1.1rem;
    font-weight: bold;
    padding: 10px;
}

/* Lives display */
.lives-display {
    font-size: 1.3rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

/* Overdue card */
.overdue-card {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border: 2px solid var(--warning);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
}

.overdue-card h3 {
    color: #e65100;
}

.overdue-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.overdue-squats {
    font-weight: 700;
    color: #e65100;
}

.overdue-total {
    font-weight: 700;
    color: #e65100;
    margin: 12px 0;
    font-size: 1rem;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #b36e0f;
}

.overdue-day-btn {
    display: block;
    width: 100%;
    margin-bottom: 8px;
}

#overdue-buttons {
    margin-top: 12px;
}

/* Trivia */
.trivia-card {
    background: linear-gradient(135deg, #d4e8c2, #f0f7ea);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.trivia-card p {
    color: var(--text-muted);
    line-height: 1.5;
}

/* Bonus Trivia */
.bonus-trivia {
    background: linear-gradient(135deg, #fff8dc, #fffacd);
    border: 2px solid #ffd700;
    position: relative;
    overflow: hidden;
}

.bonus-trivia::before {
    content: '🍌';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    opacity: 0.3;
}

.bonus-trivia h3 {
    color: #b8860b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bonus-locked {
    text-align: center;
    padding: 20px 10px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    border: 2px dashed #ffd700;
}

.bonus-hint {
    color: #b8860b;
    font-weight: 600;
    margin: 0;
}

.bonus-unlocked {
    animation: bonusReveal 0.6s ease-out;
}

@keyframes bonusReveal {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

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

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Charts */
.chart-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.chart-section canvas {
    width: 100% !important;
}

/* Leaderboard */
.leaderboard-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.leaderboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
}

.leaderboard-row:nth-child(odd) {
    background: rgba(45,106,30,0.06);
}

.leaderboard-row.eliminated {
    opacity: 0.5;
    text-decoration: line-through;
}

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

.leaderboard-stats {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Admin */
.admin-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.admin-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--surface2);
}

.admin-user-row:last-child {
    border-bottom: none;
}

/* Confetti overlay */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Notification button */
.btn-notif {
    font-size: 1.1rem;
    padding: 6px 10px;
    line-height: 1;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.modal-step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.step-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.95rem;
}

.step-body h4 {
    margin-bottom: 6px;
    font-size: 1rem;
}

.step-body p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

.store-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.store-links a {
    text-decoration: none;
}

.topic-copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.topic-code {
    background: var(--bg);
    border: 1px solid var(--surface2);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.85rem;
    flex: 1;
    word-break: break-all;
    font-family: monospace;
}

.step-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 14px;
    margin-bottom: 6px;
    font-weight: 600;
}

.step-hint-small {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.btn-subscribe {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    width: 100%;
}

/* Notification tabs */
.notif-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--surface2);
    padding-bottom: 0;
}

.notif-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.notif-tab:hover {
    color: var(--text);
}

.notif-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .squats-number {
        font-size: 3.5rem;
    }

    header {
        flex-direction: column;
        gap: 10px;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row input,
    .form-row select,
    .form-row .gender-select {
        width: 100%;
    }
}
