* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #0f172a;
    --light-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* ============ Login/Registration Page ============ */

.login-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    margin: 50px auto;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1em;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.form-group input {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.terms-section {
    text-align: center;
}

.btn-terms {
    background: var(--light-bg);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-terms:hover {
    background: var(--border-color);
    border-color: var(--primary-color);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label {
    cursor: pointer;
    color: var(--text-dark);
    font-size: 0.95em;
}

.btn-primary {
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 12px 24px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--light-bg);
    color: var(--text-dark);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--border-color);
}

.error-message,
.success-message {
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #fecaca;
}

.success-message {
    background: #dcfce7;
    color: #166534;
    border: 2px solid #86efac;
}

.error-message.show,
.success-message.show {
    display: flex;
}

/* ============ Modal ============ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 25px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 1.8em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 25px;
    flex-grow: 1;
    overflow-y: auto;
}

.modal-body h3 {
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.modal-body p {
    color: var(--text-dark);
    margin-bottom: 10px;
    line-height: 1.7;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.modal-body li {
    margin-bottom: 8px;
    color: var(--text-dark);
}

.modal-body ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.highlight-text {
    background: #fef3c7;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--warning-color);
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ============ Game Page ============ */

.game-container {
    padding: 30px 0;
}

.game-header {
    background: var(--card-bg);
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info h2 {
    color: var(--primary-color);
    font-size: 1.8em;
}

.btn-logout {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: var(--danger-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.game-section,
.progress-section {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.section-title {
    text-align: center;
    color: var(--primary-color);
    font-size: 1.8em;
    margin-bottom: 30px;
}

.wheel-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
}

#wheelCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
}

.btn-spin {
    padding: 15px 50px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-size: 1.3em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
    min-width: 200px;
}

.btn-spin:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.4);
}

.btn-spin:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spin-message {
    text-align: center;
    font-size: 1.3em;
    font-weight: 700;
    padding: 20px;
    border-radius: 10px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spin-message.sorry {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #fecaca;
}

.spin-message.spin-again {
    background: #fef3c7;
    color: #92400e;
    border: 2px solid #fcd34d;
}

.spin-message.won {
    background: #dcfce7;
    color: #166534;
    border: 2px solid #86efac;
}

.spin-again-container {
    text-align: center;
    padding: 20px;
}

.btn-spin-again {
    padding: 12px 40px;
    border: none;
    border-radius: 8px;
    background: var(--warning-color);
    color: white;
    font-weight: 600;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-spin-again:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.4);
}

.btn-spin-again:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============ Progress Bar ============ */

.progress-section {
    display: none;
}

.progress-section.show {
    display: block;
}

.progress-info {
    text-align: center;
    margin-bottom: 30px;
}

.progress-text {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 15px 0;
}

.progress-bar {
    width: 100%;
    height: 40px;
    background: var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    margin: 20px 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9em;
}

.progress-note {
    color: var(--text-light);
    font-size: 0.95em;
    margin-top: 15px;
}

/* ============ Referral Section ============ */

.referral-section {
    background: var(--light-bg);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    border: 2px solid var(--border-color);
}

.referral-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.link-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.referral-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-family: monospace;
    font-size: 0.9em;
    word-break: break-all;
}

.btn-copy {
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-copy:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.share-info {
    color: var(--text-light);
    font-size: 0.95em;
    font-style: italic;
}

/* ============ Share Buttons ============ */

.share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.btn-share {
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.btn-whatsapp {
    background: #25d366;
}

.btn-whatsapp:hover {
    background: #20ba5a;
    transform: translateY(-3px);
}

.btn-facebook {
    background: #1877f2;
}

.btn-facebook:hover {
    background: #0a66c2;
    transform: translateY(-3px);
}

.btn-twitter {
    background: #1da1f2;
}

.btn-twitter:hover {
    background: #1a8cd8;
    transform: translateY(-3px);
}

.btn-copy-link {
    background: var(--primary-color);
}

.btn-copy-link:hover {
    background: var(--secondary-color);
    transform: translateY(-3px);
}

.referral-count {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-radius: 10px;
    font-size: 1.2em;
    color: var(--text-dark);
}

.referral-count strong {
    color: var(--primary-color);
    font-size: 1.5em;
}

/* ============ Hidden State ============ */

.hidden {
    display: none !important;
}

/* ============ Responsive Design ============ */

@media (max-width: 768px) {
    .login-card {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .game-section,
    .progress-section {
        padding: 25px 15px;
    }

    .section-title {
        font-size: 1.5em;
    }

    .user-info {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .btn-logout {
        width: 100%;
        text-align: center;
    }

    .share-buttons {
        grid-template-columns: 1fr;
    }

    .link-container {
        flex-direction: column;
    }

    .btn-copy {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 15px 20px;
        flex-direction: column-reverse;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .login-card {
        padding: 20px;
        margin: 20px auto;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .game-container {
        padding: 15px 0;
    }

    .game-section,
    .progress-section {
        padding: 20px 15px;
        border-radius: 10px;
    }

    .section-title {
        font-size: 1.2em;
        margin-bottom: 20px;
    }

    #wheelCanvas {
        width: 100%;
        height: auto;
    }

    .progress-text {
        font-size: 1.2em;
    }

    .modal-header h2 {
        font-size: 1.4em;
    }
}
