/* Base reset & variables */
:root {
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-500: #6B7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }

/* Layout */
.page { max-width: 480px; margin: 0 auto; padding: 0 16px; min-height: 100vh; }
.page-wide { max-width: 780px; }

/* Header */
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0; border-bottom: 1px solid var(--gray-200);
}
.header-title { font-size: 18px; font-weight: 600; }
.header-back { font-size: 14px; color: var(--gray-500); cursor: pointer; }

/* Cards */
.card {
    background: #fff; border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow); margin-bottom: 16px;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 24px; border-radius: 8px; font-size: 15px; font-weight: 500;
    border: none; cursor: pointer; transition: all .2s; width: 100%;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 13px; width: auto; }
.btn-danger { background: var(--danger); color: #fff; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--gray-700); }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300);
    border-radius: 8px; font-size: 15px; outline: none; transition: border .2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { resize: vertical; min-height: 80px; }

/* Phone input row */
.phone-row { display: flex; gap: 10px; }
.phone-row .form-input { flex: 1; }
.phone-row .btn { width: 120px; flex-shrink: 0; font-size: 13px; padding: 10px 8px; }

/* Scene grid */
.scene-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.scene-card {
    background: #fff; border: 2px solid var(--gray-200); border-radius: var(--radius);
    padding: 16px; text-align: center; cursor: pointer; transition: all .2s;
}
.scene-card:hover { border-color: var(--primary-light); }
.scene-card.active { border-color: var(--primary); background: #EEF2FF; }
.scene-card .icon { font-size: 28px; margin-bottom: 6px; }
.scene-card .name { font-size: 14px; font-weight: 500; }
.scene-card .desc { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* Upload area */
.upload-area {
    border: 2px dashed var(--gray-300); border-radius: var(--radius);
    padding: 32px; text-align: center; cursor: pointer; transition: all .2s;
    color: var(--gray-500); font-size: 14px;
}
.upload-area:hover { border-color: var(--primary); color: var(--primary); }
.upload-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.upload-preview img {
    width: 80px; height: 80px; object-fit: cover; border-radius: 8px;
    border: 1px solid var(--gray-200);
}

/* Progress */
.progress-bar { width: 100%; height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width .5s ease; }
.progress-text { font-size: 13px; color: var(--gray-500); margin-top: 6px; text-align: center; }

/* Step indicator */
.step-label { font-size: 14px; color: var(--gray-700); font-weight: 500; margin-bottom: 8px; }

/* Result cards */
.plan-card { background: #fff; border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; box-shadow: var(--shadow); }
.plan-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.plan-card .plan-body { padding: 16px; }
.plan-card .plan-name { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.plan-card .plan-concept { font-size: 14px; color: var(--gray-500); line-height: 1.5; }
.plan-card .plan-points { margin-top: 10px; padding-left: 18px; }
.plan-card .plan-points li { font-size: 13px; color: var(--gray-700); margin-bottom: 4px; }

/* Bottom nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; border-top: 1px solid var(--gray-200);
    display: flex; justify-content: space-around; padding: 8px 0 env(safe-area-inset-bottom, 8px);
    z-index: 100;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center;
    font-size: 11px; color: var(--gray-500); cursor: pointer; padding: 4px 12px;
}
.nav-item.active { color: var(--primary); }
.nav-item .nav-icon { font-size: 22px; margin-bottom: 2px; }

/* Profile */
.profile-header { text-align: center; padding: 32px 0 16px; }
.profile-avatar {
    width: 64px; height: 64px; border-radius: 50%; background: var(--primary-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: #fff; margin: 0 auto 12px;
}
.profile-phone { font-size: 18px; font-weight: 600; }
.profile-credits { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.credits-badge { color: var(--warning); font-weight: 600; }

/* Recharge packages */
.pkg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pkg-card {
    background: #fff; border: 2px solid var(--gray-200); border-radius: var(--radius);
    padding: 16px; text-align: center; cursor: pointer; transition: all .2s; position: relative;
}
.pkg-card:hover { border-color: var(--primary-light); }
.pkg-card.active { border-color: var(--primary); background: #EEF2FF; }
.pkg-card .pkg-credits { font-size: 24px; font-weight: 700; color: var(--primary); }
.pkg-card .pkg-unit { font-size: 13px; color: var(--gray-500); }
.pkg-card .pkg-price { font-size: 16px; font-weight: 600; margin-top: 6px; }
.pkg-card .pkg-tag {
    position: absolute; top: -8px; right: -8px; background: var(--danger);
    color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px;
}

/* Toast */
.toast {
    position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
    background: var(--gray-900); color: #fff; padding: 10px 24px;
    border-radius: 8px; font-size: 14px; z-index: 9999;
    opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* Loading overlay */
.loading-overlay {
    position: fixed; inset: 0; background: rgba(255,255,255,.7);
    display: flex; align-items: center; justify-content: center; z-index: 9998;
}
.spinner {
    width: 36px; height: 36px; border: 3px solid var(--gray-200);
    border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Task list */
.task-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0; border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
}
.task-item:last-child { border-bottom: none; }
.task-info { flex: 1; }
.task-title { font-size: 14px; font-weight: 500; }
.task-meta { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.task-status {
    font-size: 12px; padding: 4px 10px; border-radius: 12px; font-weight: 500;
}
.task-status.pending { background: var(--gray-100); color: var(--gray-500); }
.task-status.processing { background: #DBEAFE; color: #1D4ED8; }
.task-status.completed { background: #D1FAE5; color: #065F46; }
.task-status.failed { background: #FEE2E2; color: #991B1B; }

/* Culture research block */
.research-block {
    background: var(--gray-50); border-radius: 8px; padding: 14px;
    font-size: 14px; line-height: 1.7; color: var(--gray-700);
    white-space: pre-wrap; max-height: 300px; overflow-y: auto;
}

/* Utility */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-80 { margin-bottom: 80px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-gray { color: var(--gray-500); }
.hidden { display: none !important; }
