:root {
    --brand: #0FDC78;
    --brand-dark: #00B85C;
    --brand-glow: rgba(15, 220, 120, 0.35);

    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --bg-elevated: #3a3a3c;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;
    --accent-blue: #2997ff;
    --accent-purple: #bf5af2;
    --accent-green: #30d158;
    --accent-red: #ff453a;
    --accent-orange: #ff9f0a;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.12);
    --glass-bg: rgba(28, 28, 30, 0.72);
    --glass-border: rgba(255, 255, 255, 0.08);
    --surface: rgba(255, 255, 255, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'PingFang SC', 'Helvetica Neue', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    line-height: 1.47;
    overflow-x: hidden;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

.hidden { display: none !important; }

/* ============ Nav ============ */
.nav-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    background: rgba(0, 0, 0, 0.72);
    border-bottom: 0.5px solid var(--border-subtle);
}
.nav-inner {
    max-width: 1080px;
    margin: 0 auto;
    height: 48px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-brand {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
}
.nav-brand .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 10px var(--brand-glow);
}
.nav-links { display: flex; gap: 28px; align-items: center; margin-right: 20px; }
.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.25s var(--ease);
}
.nav-links a:hover { color: var(--text-primary); }
.nav-cta { display: flex; gap: 10px; align-items: center; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.points-badge {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: #003d1f;
    letter-spacing: 0.02em;
}

/* ============ Buttons ============ */
.btn {
    background: var(--brand);
    color: #003d1f;
    border: none;
    padding: 10px 20px;
    border-radius: 100px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s var(--ease);
    letter-spacing: 0.01em;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}
.btn:hover { background: #3ce88f; transform: scale(1.02); }
.btn:active { transform: scale(0.98); }
.btn:disabled {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
}
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}
.btn-large { padding: 16px 32px; font-size: 16px; font-weight: 600; }
.btn-sm { padding: 7px 16px; font-size: 13px; }

/* ============ Hero ============ */
.hero { text-align: center; padding: 140px 0 80px; position: relative; }
.hero-eyebrow {
    font-size: 13px;
    font-weight: 500;
    color: var(--brand);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 20px;
}
.hero h1 {
    font-size: 72px;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.05;
    margin-bottom: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #a1a1a6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero h1 .accent {
    background: linear-gradient(135deg, var(--brand), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    color: var(--text-secondary);
    font-size: 21px;
    font-weight: 400;
    line-height: 1.4;
    max-width: 560px;
    margin: 0 auto 36px;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 28px; color: var(--text-tertiary); font-size: 13px; }

/* ============ Features ============ */
.features { padding: 80px 0; }
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    transition: all 0.35s var(--ease);
}
.feature-card:hover { border-color: var(--border-medium); transform: translateY(-3px); }
.feature-icon { font-size: 32px; margin-bottom: 16px; }
.feature-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.01em; }
.feature-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* ============ Pricing ============ */
.pricing { padding: 80px 0; }
.section-head { text-align: center; margin-bottom: 48px; }
.section-eyebrow {
    font-size: 13px;
    color: var(--brand);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
}
.section-title {
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 12px;
}
.section-desc { color: var(--text-secondary); font-size: 17px; max-width: 520px; margin: 0 auto; }
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    max-width: 720px;
    margin: 0 auto;
}
.price-card {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    transition: all 0.35s var(--ease);
}
.price-card:hover { border-color: var(--brand); box-shadow: 0 0 40px -10px var(--brand-glow); }
.price-amount {
    font-size: 40px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}
.price-amount span { font-size: 18px; }
.price-points { font-size: 15px; color: var(--text-secondary); margin-bottom: 20px; }
.price-name { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

/* ============ Generator ============ */
.generator-section { padding: 90px 0 40px; }
.page-head { padding: 100px 0 20px; text-align: center; }
.page-head h1 { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 8px; }
.page-head p { color: var(--text-secondary); font-size: 15px; }

.generation-box {
    background: var(--glass-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 0.5px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: var(--shadow-md);
}
.prompt-input {
    width: 100%;
    min-height: 140px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    resize: vertical;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    line-height: 1.6;
    font-family: inherit;
}
.prompt-input::placeholder { color: var(--text-tertiary); }
.prompt-input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--brand-glow);
}
.hint-text {
    color: var(--text-tertiary);
    font-size: 12px;
    margin-bottom: 16px;
    margin-top: -8px;
    letter-spacing: 0.01em;
}
.options { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.select {
    padding: 10px 36px 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a1a1a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    min-width: 130px;
    font-family: inherit;
}
.select:hover { background-color: var(--bg-elevated); border-color: rgba(255, 255, 255, 0.18); }
.select:focus {
    outline: none;
    border-color: var(--brand);
    background-color: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--brand-glow);
}
.generate-btn {
    width: 100%;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 16px;
}
.login-prompt { text-align: center; padding: 60px 20px; }
.login-prompt h3 { font-size: 22px; font-weight: 600; margin-bottom: 10px; }
.login-prompt p { color: var(--text-secondary); margin-bottom: 24px; }

/* ============ Progress ============ */
.progress-container { display: none; margin-top: 28px; }
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin: 16px 0 12px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand), var(--accent-blue));
    transition: width 0.5s var(--ease);
    width: 0%;
    border-radius: 3px;
}
.progress-text { color: var(--text-secondary); font-size: 13px; }

/* ============ History ============ */
.history { padding: 40px 0 80px; }
.history h2 { margin-bottom: 24px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.history h2 span { color: var(--text-tertiary); font-size: 14px; font-weight: 400; margin-left: 8px; }
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.history-item {
    background: var(--bg-secondary);
    border: 0.5px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.35s var(--ease);
}
.history-item:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-md);
    border-color: var(--border-medium);
}
.history-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.history-item-info { padding: 12px 14px; }
.history-item-info p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.empty-tip {
    color: var(--text-tertiary);
    font-size: 14px;
    text-align: center;
    padding: 40px 0;
}

/* ============ Upload ============ */
.reference-upload-section {
    margin-bottom: 16px;
    padding: 28px;
    background: rgba(255, 255, 255, 0.02);
    border: 1.5px dashed var(--border-medium);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
}
.reference-upload-section:hover { border-color: var(--brand); background: rgba(15, 220, 120, 0.04); }
.reference-upload-section.dragover { border-color: var(--brand); background: rgba(15, 220, 120, 0.08); }
.upload-icon { font-size: 40px; margin-bottom: 8px; opacity: 0.7; }
.upload-text { color: var(--text-secondary); font-size: 14px; }
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.preview-item { position: relative; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 1; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .remove-btn {
    position: absolute; top: 6px; right: 6px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    color: white; border: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.preview-item .remove-btn:hover { background: var(--accent-red); }
.preview-item .loading-overlay {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 12px;
    flex-direction: column; gap: 6px;
}
.spinner {
    width: 24px; height: 24px;
    border: 2.5px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Modals ============ */
.modal-overlay {
    display: flex;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-panel {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 0.5px solid var(--border-subtle);
    animation: slideUp 0.3s var(--ease);
}
.modal-panel h2 {
    margin-bottom: 24px;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    letter-spacing: -0.02em;
}
.input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    font-family: inherit;
}
.input::placeholder { color: var(--text-tertiary); }
.input:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--brand-glow);
}
.tabs {
    display: flex;
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.tab {
    flex: 1;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}
.tab.active { background: var(--brand); color: #003d1f; }
.message {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 500;
}
.message.error { background: rgba(255, 69, 58, 0.12); color: var(--accent-red); border: 1px solid rgba(255, 69, 58, 0.2); }
.message.success { background: rgba(48, 209, 88, 0.12); color: var(--accent-green); border: 1px solid rgba(48, 209, 88, 0.2); }

/* ============ Payment ============ */
.package-list { display: flex; gap: 12px; margin-bottom: 24px; }
.package-item {
    flex: 1;
    padding: 20px 16px;
    background: var(--bg-tertiary);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
}
.package-item:hover { background: var(--bg-elevated); }
.package-item.selected { border-color: var(--brand); background: rgba(15, 220, 120, 0.08); }
.package-price {
    font-size: 24px;
    font-weight: 600;
    color: var(--brand);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.package-points { font-size: 13px; color: var(--text-secondary); }
.qrcode-container { display: flex; flex-direction: column; align-items: center; padding: 24px 0; }
.qrcode-img {
    width: 200px; height: 200px;
    border-radius: var(--radius-md);
    background: white;
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
.qrcode-img canvas, .qrcode-img img { display: block; }
.pay-tips { margin-top: 16px; color: var(--text-secondary); font-size: 13px; }
.countdown { color: var(--brand); font-size: 14px; font-weight: 600; margin-top: 12px; }

/* ============ Prompt Modal ============ */
.prompt-modal { max-width: 560px; width: 90%; }
.prompt-image { width: 100%; border-radius: var(--radius-md); margin-bottom: 16px; display: block; }
.prompt-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.prompt-tag {
    font-size: 12px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    color: var(--text-secondary);
}
.prompt-text {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 16px;
}
.prompt-actions { display: flex; gap: 10px; }
.prompt-actions .btn { flex: 1; }

.result-image { max-width: 100%; border-radius: var(--radius-lg); margin-top: 16px; }

/* ============ Footer ============ */
.footer {
    text-align: center;
    padding: 40px 0 60px;
    color: var(--text-tertiary);
    font-size: 12px;
    border-top: 0.5px solid var(--border-subtle);
}

@media (max-width: 640px) {
    .hero h1 { font-size: 44px; }
    .hero p { font-size: 17px; }
    .section-title { font-size: 30px; }
    .generation-box { padding: 20px; }
    .modal-panel { padding: 24px; }
    .nav-links { display: none; }
    .page-head h1 { font-size: 30px; }
}
