/* User Redeem Page Design System */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-soft: #eef2ff;

    --bg-main: #f9fafb;
    --bg-surface: #ffffff;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;

    --border-base: #e2e8f0;

    --success: #10b981;
    --success-soft: #ecfdf5;
    --danger: #ef4444;
    --danger-soft: #fef2f2;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --transition-base: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, inherit;
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    line-height: 1.5;
}

.container {
    max-width: 480px;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-muted);
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-base);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition-base);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Toast */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-base);
    display: none;
    z-index: 100;
}

.toast.show {
    display: block;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

/* Steps */
.step {
    display: none;
}

.step.active {
    display: block;
}

/* Result */
.result-success {
    text-align: center;
}

.result-error {
    text-align: center;
}

.result-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.result-message {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.result-details {
    background-color: var(--bg-main);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: left;
    margin-bottom: 2rem;
}

.result-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-base);
}

.result-detail-item:last-child {
    border-bottom: none;
}

.result-detail-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.result-detail-value {
    font-size: 0.875rem;
    font-weight: 600;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    body {
        padding: 1rem;
    }

    .header {
        margin-bottom: 1.5rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 1.5rem;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        top: 1rem;
    }

    .result-title {
        font-size: 1.25rem;
    }

    .team-bind-progress {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.header-user-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.daily-wechat-code-panel {
    display: none;
    margin-top: 14px;
    text-align: left;
}

.daily-wechat-code-panel.show {
    display: block;
}

.daily-wechat-code-inline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.daily-wechat-code-inline-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--primary);
}

.daily-wechat-code-inline-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: #eef1f5;
    border: 1px solid #dde3ea;
}

.daily-wechat-code-value {
    flex: 1;
    min-width: 0;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--text-main);
    word-break: break-all;
}

.daily-wechat-code-copy {
    width: auto;
    padding: 10px 14px;
    flex-shrink: 0;
}

.team-bind-card-hidden {
    display: none !important;
}

.wechat-entry,
.wechat-mini-action {
    border: 1px solid var(--border-base);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-main);
    border-radius: var(--radius-full);
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base), border-color var(--transition-base), background var(--transition-base), color var(--transition-base);
    cursor: pointer;
}

.wechat-entry:hover,
.wechat-mini-action:hover,
.wechat-entry-logged {
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(238, 242, 255, 0.92);
    transform: translateY(-1px);
}

.wechat-profile-link {
    max-width: 100%;
}

.wechat-entry-name {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wechat-entry-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    object-fit: cover;
}

.wechat-entry-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

.wechat-mini-action {
    font-size: 0.9rem;
}

.wechat-mini-action span {
    white-space: nowrap;
}

.wechat-mini-action:focus-visible,
.wechat-entry:focus-visible,
.qr-modal-close:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.wechat-state-hint {
    display: none;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.18);
}

.wechat-state-hint.show {
    display: block;
}

.qr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.66);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.qr-modal-overlay.show {
    display: flex;
}

.qr-modal-card {
    width: min(100%, 420px);
    background: #fff;
    border: 1px solid var(--border-base);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    position: relative;
    text-align: center;
}

.qr-modal-card h3 {
    font-size: 1.375rem;
    color: var(--text-main);
}

.qr-modal-subtitle {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.qr-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.75rem;
    cursor: pointer;
}

.qr-box {
    margin: 1rem auto 0.75rem;
    width: 260px;
    height: 260px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border-base);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.qr-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-muted);
}

.qr-spinner,
.spinning {
    animation: qrSpin 0.9s linear infinite;
}

.qr-spinner {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 3px solid rgba(99, 102, 241, 0.14);
    border-top-color: var(--primary);
}

.qr-status {
    color: var(--text-muted);
    font-size: 0.9rem;
}

@keyframes qrSpin {
    to {
        transform: rotate(360deg);
    }
}

.team-bind-card {
    margin-bottom: 1rem;
    text-align: center;
}

.team-bind-help {
    margin-top: -0.25rem;
    margin-bottom: 1rem;
}

.team-bind-progress {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 1rem;
    text-align: left;
}

.team-bind-progress-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 10px 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border-base);
    background: #f8fafc;
    color: var(--text-muted);
    min-height: 68px;
}

.team-bind-progress-item.active {
    border-color: rgba(99, 102, 241, 0.28);
    background: rgba(238, 242, 255, 0.92);
    color: var(--primary);
}

.team-bind-progress-item.success {
    border-color: rgba(34, 197, 94, 0.22);
    background: rgba(240, 253, 244, 0.95);
    color: var(--success);
}

.team-bind-progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.45;
}

.team-bind-progress-item.active .team-bind-progress-dot,
.team-bind-progress-item.success .team-bind-progress-dot {
    opacity: 1;
}

.team-bind-progress-label {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
}

.team-bind-qr-box {
    width: 240px;
    height: 240px;
    margin: 0 auto 0.85rem;
    border: 1px solid var(--border-base);
    border-radius: 18px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.team-bind-qr-box canvas,
.team-bind-qr-box img {
    max-width: 100%;
    max-height: 100%;
}

.team-bind-qr-box.team-bind-qr-box-claimed {
    display: none;
}

.team-bind-status-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.9rem;
}

.team-bind-status-text.success {
    color: var(--success);
}

.team-bind-status-text.error {
    color: var(--danger);
}

.team-bind-refresh {
    max-width: 220px;
    margin: 0 auto;
}
