/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: hidden;
}

body {
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.container {
    width: min(960px, 100%);
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* 头部样式 */
.header {
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: 100%;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    letter-spacing: 0.04em;
    margin: 0;
}

.header-subtitle {
    font-size: 0.9rem;
    opacity: 0.85;
    white-space: nowrap;
}

/* 主要内容区域 */
.main-content {
    padding: 1.5rem 1rem 2rem;
    max-width: 640px;
    margin: 0 auto;
}

/* 步骤样式 */
.step {
    background: white;
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 14px 36px rgba(103, 126, 234, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.step h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
}

.step h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* 上传区域样式 */
.upload-area {
    border: 2px dashed #667eea;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: #764ba2;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: #667eea;
    margin-bottom: 1rem;
}

.upload-placeholder p {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.9rem;
    color: #666;
}

.upload-guideline {
    font-size: 0.9rem;
    color: #555;
    margin-top: 0.75rem;
    line-height: 1.5;
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* 模板网格样式 */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.example-section {
    margin-bottom: 1.5rem;
}

.section-intro {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
    text-align: center;
}

.example-original {
    display: flex;
    justify-content: center;
}

.section-copy {
    max-width: 320px;
    font-size: 0.95rem;
    color: #5b5f92;
    line-height: 1.6;
}

.section-copy-inline {
    white-space: nowrap;
}

.original-card {
    position: relative;
    max-width: 150px;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 30px rgba(24, 32, 74, 0.28);
    background: rgba(18, 26, 66, 0.9);
}

.original-card img {
    width: 100%;
    display: block;
    object-fit: cover;
    aspect-ratio: 3 / 4;
}

.original-caption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 1.1rem 1.4rem;
    background: linear-gradient(180deg, rgba(12, 18, 48, 0) 0%, rgba(12, 18, 48, 0.9) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.caption-title {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.95rem;
}

.caption-tip {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

.example-slider {
    position: relative;
    padding: 0 2.75rem;
    margin-bottom: 1.4rem;
}

.slider-viewport {
    position: relative;
    width: min(360px, 90vw);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding: 0.75rem 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0 auto;
}

.slider-viewport::-webkit-scrollbar {
    display: none;
}

.slider-track {
    display: flex;
    gap: 0;
    padding: 0;
}

.example-item {
    scroll-snap-align: center;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.85), rgba(206, 213, 255, 0.82));
    border-radius: 24px;
    padding: 1.75rem 1.4rem;
    text-align: center;
    width: 100%;
    flex: 0 0 100%;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow:
        0 18px 40px rgba(102, 126, 234, 0.18),
        0 26px 60px rgba(118, 75, 162, 0.12);
    backdrop-filter: blur(10px);
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease, background 0.35s ease;
    position: relative;
}

.example-item::before {
    content: '';
    position: absolute;
    inset: -30% -5%;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.4), transparent 60%);
    opacity: 0.5;
    transform: rotate(12deg);
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.example-item::after {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.example-item img {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: 18px;
    margin-bottom: 0.9rem;
    box-shadow: 0 16px 26px rgba(102, 126, 234, 0.22);
}

.example-item h4 {
    font-size: 1.15rem;
    color: #25274e;
    margin-bottom: 1rem;
    font-weight: 700;
}

.example-item .btn-small {
    padding: 0.55rem 1.4rem;
    font-size: 0.95rem;
    border-radius: 999px;
    box-shadow: 0 12px 22px rgba(102, 126, 234, 0.28);
    width: auto;
    margin: 0 auto;
}

.example-item:hover {
    transform: translateY(-12px) scale(1.04);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.4),
        0 18px 40px rgba(102, 126, 234, 0.24),
        0 28px 60px rgba(118, 75, 162, 0.22);
    animation: pulseGlow 1.4s ease-out;
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.9), rgba(187, 197, 255, 0.86));
}

.example-item:hover::before {
    opacity: 0.9;
}

.example-item:hover::after,
.example-item.selected::after {
    opacity: 1;
}

.example-item.selected {
    border-color: rgba(255, 255, 255, 0.65);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.55),
        0 22px 48px rgba(118, 75, 162, 0.28),
        0 30px 60px rgba(102, 126, 234, 0.38);
    transform: translateY(-10px) scale(1.03);
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(177, 188, 255, 0.9));
}

@keyframes pulseGlow {
    0% {
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.35),
            0 12px 30px rgba(102, 126, 234, 0.18),
            0 20px 45px rgba(118, 75, 162, 0.16);
    }
    60% {
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.55),
            0 26px 55px rgba(118, 75, 162, 0.3),
            0 42px 70px rgba(102, 126, 234, 0.35);
    }
    100% {
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.45),
            0 18px 40px rgba(102, 126, 234, 0.24),
            0 26px 55px rgba(118, 75, 162, 0.22);
    }
}

.template-option {
    cursor: pointer;
}

.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95), rgba(118, 75, 162, 0.95));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 18px 32px rgba(102, 126, 234, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
    z-index: 2;
}

.slider-nav svg {
    width: 20px;
    height: 20px;
}

.slider-nav:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 18px 38px rgba(118, 75, 162, 0.4);
}

.slider-nav:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

.slider-nav-prev {
    left: 0.75rem;
}

.slider-nav-next {
    right: 0.75rem;
}

.slider-glow {
    position: absolute;
    top: 50%;
    width: 140px;
    height: 110%;
    pointer-events: none;
    transform: translateY(-50%);
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0) 70%);
    mix-blend-mode: screen;
    opacity: 0.65;
    z-index: 1;
}

.slider-glow-left {
    left: 1.25rem;
}

.slider-glow-right {
    right: 1.25rem;
}

.slider-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.slider-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(102, 126, 234, 0.3);
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.slider-dot:hover {
    transform: scale(1.2);
    background: rgba(118, 75, 162, 0.55);
}

.slider-dot.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    transform: scale(1.6);
    box-shadow: 0 0 14px rgba(118, 75, 162, 0.55);
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 999px;
}

/* 邀请码输入样式 */
.invite-input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

#invite-code {
    flex: 1;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1.1rem;
    text-align: center;
    text-transform: uppercase;
    transition: border-color 0.3s ease;
}

#invite-code:focus {
    outline: none;
    border-color: #667eea;
}

.invite-hint {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

/* 按钮样式 */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

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

/* 结果容器样式 */
.result-container {
    text-align: center;
}

.loading {
    padding: 3rem 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.5rem;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 90%;
    width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: #333;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: #666;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .section-intro {
        gap: 0.5rem;
    }

    .section-copy {
        font-size: 0.875rem;
    }

    .header {
        padding: 0.6rem 0.75rem;
    }

    .header-content {
        gap: 0.4rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header-subtitle {
        font-size: 0.8rem;
    }

    .main-content {
        padding: 1.25rem 1rem 1.75rem;
    }

    .step {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .example-original {
        margin-bottom: 0.75rem;
    }

    .original-card {
        max-width: 160px;
    }

    .example-slider {
        padding: 0 2.4rem;
    }

    .slider-nav {
        width: 38px;
        height: 38px;
    }

    .slider-nav-prev {
        left: 0.5rem;
    }

    .slider-nav-next {
        right: 0.5rem;
    }

    .slider-viewport {
        padding: 0.5rem 0;
        width: min(300px, 92vw);
    }

    .slider-track {
        gap: 0;
        padding: 0;
    }

    .example-item {
        width: 100%;
        padding: 1.4rem 1.05rem;
        border-radius: 20px;
    }

    .example-item img {
        max-height: 210px;
        border-radius: 16px;
    }

    .slider-glow {
        display: none;
    }

    .slider-dots {
        gap: 0.4rem;
    }

    .invite-input-group {
        flex-direction: column;
    }

    .result-actions {
        flex-direction: column;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step {
    animation: fadeIn 0.5s ease-out;
}

/* 成功状态 */
.success {
    color: #4caf50;
}

.error {
    color: #f44336;
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .header {
        padding: 0.5rem 0.5rem;
    }

    .header-content {
        gap: 0.3rem;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .header-subtitle {
        font-size: 0.75rem;
    }
}
