:root {
    /* Primary Colors - Warm Orange-Red inspired by user's poster */
    --primary-50: #FFF5F0;
    --primary-100: #FFE8DB;
    --primary-200: #FFD0B8;
    --primary-300: #FFAB85;
    --primary-400: #FF7A4D;
    --primary-500: #FF5722;
    --primary-600: #E64A19;
    --primary-700: #D84315;
    --primary-800: #BF360C;
    --primary-900: #870000;
    
    /* Accent Colors */
    --accent-gold: #FFB800;
    --accent-gold-light: #FFD54F;
    --accent-red: #E53935;
    --accent-green: #43A047;
    --accent-blue: #1E88E5;
    
    /* Neutral Colors */
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F5;
    --gray-200: #EEEEEE;
    --gray-300: #E0E0E0;
    --gray-400: #BDBDBD;
    --gray-500: #9E9E9E;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    
    /* Semantic Colors */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    --text-inverse: #FFFFFF;
    
    --bg-primary: #FFFFFF;
    --bg-secondary: var(--gray-50);
    --bg-tertiary: var(--gray-100);
    
    /* Spacing System */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --shadow-glow: 0 0 20px rgba(255,87,34,0.15);
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* Links */
a {
    color: inherit;
    text-decoration: none;
}

.link-primary {
    color: var(--primary-500);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.link-primary:hover {
    color: var(--primary-600);
}

/* Buttons */
.btn-submit {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: var(--text-inverse);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Form Elements */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.label-icon {
    font-size: 16px;
}

.input-wrapper {
    position: relative;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-primary);
    transition: all var(--transition-base);
    outline: none;
    color: var(--text-primary);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(255,87,34,0.1);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239E9E9E' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* Error States */
.error-msg {
    display: block;
    font-size: 12px;
    color: var(--accent-red);
    margin-top: var(--space-xs);
    min-height: 18px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
}

.error-msg.show {
    opacity: 1;
    transform: translateY(0);
}

.hint-text {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

/* Checkbox */
.agreement-label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.agreement-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    margin-top: 1px;
}

.checkmark svg {
    width: 12px;
    height: 12px;
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-bounce);
}

.agreement-checkbox:checked + .checkmark {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.agreement-checkbox:checked + .checkmark svg {
    opacity: 1;
    transform: scale(1);
}

/* Code Button */
.btn-code {
    padding: 10px 16px;
    border: 2px solid var(--primary-400);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--primary-500);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    min-width: 110px;
}

.btn-code:disabled {
    border-color: var(--gray-300);
    color: var(--gray-400);
    cursor: not-allowed;
}

.btn-code:not(:disabled):hover {
    background: var(--primary-50);
}

.code-wrapper {
    display: flex;
    gap: var(--space-sm);
}

.code-wrapper .form-input {
    flex: 1;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-xl);
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-bounce);
}

.modal-overlay.show .modal-content {
    transform: scale(1) translateY(0);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.modal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.modal-sub {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-xl);
}

.btn-modal {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* Success Animation */
.success-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
}

.success-circle svg {
    width: 100%;
    height: 100%;
}

/* Hide utility */
.hide {
    display: none !important;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-around;
    padding: var(--space-sm) 0 calc(var(--space-sm) + env(safe-area-inset-bottom));
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-xs) var(--space-md);
    color: var(--gray-500);
    transition: color var(--transition-fast);
}

.nav-item.active {
    color: var(--primary-500);
}

.nav-icon {
    font-size: 22px;
    line-height: 1;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

/* Page padding for bottom nav */
.page-dashboard .app-container,
.page-data .app-container,
.page-withdraw .app-container,
.page-profile .app-container {
    padding-bottom: 70px;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--gray-800);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (min-width: 431px) {
    body {
        background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    }
    
    .app-container {
        box-shadow: 0 0 40px rgba(0,0,0,0.1);
        min-height: 100vh;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #121212;
        --text-primary: #ffffff;
        --text-secondary: #b0b0b0;
        --text-tertiary: #808080;
        --gray-100: #2a2a2a;
        --gray-200: #333333;
        --gray-300: #444444;
    }
}
