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

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 40px 16px;
    background: linear-gradient(135deg, #0a1628, #1a1a5e, #6b21a8);
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    position: relative;
}

.bg-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.bg-overlay.active {
    opacity: 1;
}

.card {
    background: #fff;
    border-radius: 20px;
    padding: 50px 40px 40px;
    width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35),
                0 8px 20px rgba(107, 33, 168, 0.2);
    position: relative;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid #e0d4f7;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar:hover {
    transform: rotate(360deg);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.name {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
    cursor: pointer;
}

.quote {
    font-size: 14px;
    color: #7c3aed;
    opacity: 0;
    transition: opacity 0.5s ease;
    margin-bottom: 8px;
    min-height: 0;
}

.quote.show {
    opacity: 1;
}

.title {
    font-size: 16px;
    color: #7c3aed;
    font-weight: 500;
    margin-bottom: 20px;
}

.motto {
    font-size: 14px;
    color: #64748b;
    font-style: italic;
    line-height: 1.6;
    padding: 16px 20px;
    border-top: 1px solid #f1e8ff;
    border-bottom: 1px solid #f1e8ff;
    margin-bottom: 28px;
}

.icons {
    display: flex;
    justify-content: center;
    gap: 28px;
}

.icons a {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.icons a:hover {
    transform: translateY(-4px);
    border-color: #3b82f6;
}

.icons a:hover svg {
    fill: #3b82f6;
}

.icons svg {
    width: 22px;
    height: 22px;
    fill: #4b5563;
    transition: fill 0.3s ease;
}

.theme-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: none;
    border: 1.5px solid #cbd5e1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.theme-btn:hover {
    border-color: #3b82f6;
    transform: rotate(30deg);
}

.theme-btn svg {
    width: 20px;
    height: 20px;
    fill: #64748b;
    transition: fill 0.3s ease;
}

.theme-btn:hover svg {
    fill: #3b82f6;
}

/* 留言表单 */
.form-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 40px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35),
                0 8px 20px rgba(107, 33, 168, 0.2);
}

.form-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 20px;
    text-align: center;
}

.form-card label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 6px;
}

.form-card input,
.form-card textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a2e;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 16px;
}

.form-card input:focus,
.form-card textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-card textarea {
    resize: vertical;
    min-height: 80px;
}

.form-card button[type="submit"] {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.form-card button[type="submit"]:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.form-card button[type="submit"]:active {
    transform: translateY(0);
}

.form-card button[type="submit"].loading {
    pointer-events: none;
    opacity: 0.85;
}

.form-card button[type="submit"] .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto;
}

.form-card button[type="submit"].loading .spinner {
    display: block;
}

.form-card button[type="submit"].loading .btn-text {
    display: none;
}

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

.form-toast {
    text-align: center;
    font-size: 13px;
    color: #16a34a;
    margin-top: 12px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.form-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.form-card input.error,
.form-card textarea.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.form-card input.error:focus,
.form-card textarea.error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.field-error {
    font-size: 12px;
    color: #ef4444;
    margin-top: -12px;
    margin-bottom: 12px;
    text-align: left;
    display: none;
}

.field-error.show {
    display: block;
}

/* 技能展示 */
.skills-card {
    background: #fff;
    border-radius: 20px;
    padding: 28px 40px;
    width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35),
                0 8px 20px rgba(107, 33, 168, 0.2);
}

.skills-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 18px;
}

.skills-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.skill-tag {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
    user-select: none;
}

.skill-tag:hover {
    transform: scale(1.12);
    filter: brightness(0.85);
}

.skill-tag.active {
    border-color: currentColor;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.08);
}

.skill-tag:nth-child(1) { background: #dbeafe; color: #1d4ed8; }
.skill-tag:nth-child(2) { background: #fce7f3; color: #be185d; }
.skill-tag:nth-child(3) { background: #d1fae5; color: #047857; }
.skill-tag:nth-child(4) { background: #fef3c7; color: #b45309; }

/* 项目展示 */
.projects-card {
    background: #fff;
    border-radius: 20px;
    padding: 28px 40px;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35),
                0 8px 20px rgba(107, 33, 168, 0.2);
}

.projects-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 18px;
    text-align: center;
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.project-item {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px 18px;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.project-item h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.project-item p {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 10px;
    line-height: 1.5;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.project-tags span {
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.project-tags .t-blue { background: #dbeafe; color: #1d4ed8; }
.project-tags .t-pink { background: #fce7f3; color: #be185d; }
.project-tags .t-green { background: #d1fae5; color: #047857; }
.project-tags .t-orange { background: #fef3c7; color: #b45309; }
.project-tags .t-purple { background: #ede9fe; color: #6d28d9; }
.project-tags .t-cyan { background: #cffafe; color: #0e7490; }

.filter-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.filter-btn {
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: #7c3aed;
    color: #7c3aed;
}

.filter-btn.active {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

.project-count {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 14px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.project-item.fade-in {
    animation: fadeIn 0.35s ease both;
}

/* 平板 (768px - 1024px) */
@media (max-width: 1024px) {
    .card, .form-card, .skills-card, .projects-card {
        width: 420px;
    }
    .card, .form-card {
        padding: 44px 36px 36px;
    }
}

/* 手机 (<768px) */
@media (max-width: 767px) {
    body {
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    .card, .form-card, .skills-card, .projects-card {
        width: 90%;
    }

    .card {
        padding: 40px 24px calc(32px + env(safe-area-inset-bottom, 20px));
    }

    .form-card {
        padding: 28px 24px;
    }

    .skills-card {
        padding: 24px;
    }

    .skills-list {
        gap: 10px;
    }

    .skill-tag {
        padding: 7px 16px;
        font-size: 13px;
    }

    .avatar {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }

    .avatar img {
        width: 100%;
        height: 100%;
    }

    .name {
        font-size: 24px;
    }

    .title {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .motto {
        font-size: 13px;
        padding: 12px 16px;
        margin-bottom: 24px;
    }

    .quote {
        font-size: 13px;
    }

    .icons {
        display: flex;
        flex-wrap: nowrap;
        justify-content: center;
        gap: 16px;
    }

    .icons a {
        width: 52px;
        height: 52px;
    }

    .icons svg {
        width: 22px;
        height: 22px;
    }

    .theme-btn {
        width: 32px;
        height: 32px;
        top: 10px;
        right: 10px;
    }

    .theme-btn svg {
        width: 18px;
        height: 18px;
    }
}
