/* 小海豹TO签 - 分步交互样式 */

:root {
    --primary: #5a5d6a;
    --white: #ffffff;
    --pink: #ffd6f4;
    --pink-deep: #f5a0d8;
    --blue: #9be2ff;
    --blue-deep: #6cc8f0;
    --blue-bg: #7dd4f5;
    --gray: #c8c8c8;
    --gray-light: #e8e8e8;
    --bg: #7dd4f5;
    --card: rgba(255, 255, 255, 0.65);
    --shadow: rgba(90, 93, 106, 0.12);
}

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

body {
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--blue-bg);
    min-height: 100vh;
    color: var(--primary);
    overflow-x: hidden;

    /* 蓝色背景 + 粉色&白色波点 */
    background-color: var(--blue-bg);
    background-image: radial-gradient(circle, var(--pink) 3px, transparent 3px);
    background-size: 40px 40px;
}

/* ===== 通用步骤页 ===== */
.step-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    animation: fadeIn 0.5s ease;
}
.step-page.hidden { display: none; }

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

/* 半透明白色卡片框 */
.step-inner {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--card);
    border-radius: 24px;
    padding: 32px 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.step-heading {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
}

.step-hint {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 28px;
    text-align: center;
}

/* ===== 标题 ===== */
.app-title {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    text-shadow: 0 2px 8px rgba(255,255,255,0.8);
    line-height: 1.3;
}

.title-line1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
    display: block;
}

.title-line2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    display: block;
    text-align: center;
}
.title-deco {
    position: absolute;
    object-fit: contain;
}
.title-deco-left {
    width: 72px;
    height: auto;
    left: 50%;
    margin-left: -180px;
    top: 50%;
    transform: translateY(-50%);
}
.title-deco-right {
    width: 45px;
    height: auto;
    right: 50%;
    margin-right: -170px;
    top: 50%;
    transform: translateY(-50%);
}
.title-text-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
    padding: 0 90px;
}

/* ===== 第1步：开场动画（底层GIF + 上层透明MOV）====== */
#stepVideo {
    position: relative;
}
#stepVideo .video-card {
    background: transparent;
    border-radius: 24px;
    padding: 0;
    box-shadow: none;
}

/* 开场动画：上下排列容器 */
.intro-stack {
    position: relative;
    width: 100%;
    max-width: 380px;
    margin: -60px auto 0;  /* 整体上移，靠近标题 */
}

/* 上层：对话框 APNG（透明背景）*/
.intro-overlay {
    display: block;
    width: 100%;
    height: auto;
    z-index: 2;
    position: relative;
}

/* 下层：猫猫豹 GIF — 绝对定位紧贴对话框尖尖下方 */
.intro-base {
    position: absolute;
    top: 36%;  /* 海豹紧贴对话框尖尖下方 */
    left: 0;
    width: 100%;
    z-index: 1;
}
.skip-btn {
    position: absolute;
    bottom: 40px;
    right: 24px;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(90,93,106,0.2);
    color: var(--primary);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.2s;
}
.skip-btn:hover { background: rgba(255,255,255,0.95); }

/* ===== 第2步：模版选择 ===== */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}
.template-item {
    aspect-ratio: 1;
    border: 3px solid var(--gray-light);
    border-radius: 14px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.25s;
    background: var(--white);
    position: relative;
}
.template-item:hover {
    border-color: var(--blue);
    transform: scale(1.03);
}
.template-item.selected {
    border-color: var(--pink-deep);
    box-shadow: 0 0 0 3px var(--pink);
    transform: scale(1.05);
}
.template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.template-item .template-num {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: var(--primary);
    color: var(--white);
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 8px;
}

/* ===== 第3步：场景选择 ===== */
.scene-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}
.scene-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    border: 2px solid var(--gray-light);
    border-radius: 20px;
    background: var(--white);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.25s;
    color: var(--primary);
    min-width: 80px;
}
.scene-btn:hover {
    border-color: var(--blue);
    background: var(--blue);
}
.scene-btn.selected {
    border-color: var(--pink-deep);
    background: var(--pink);
    font-weight: 600;
    transform: scale(1.05);
}
.scene-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

/* ===== 第4步：输入 ===== */
.input-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 28px;
}
.nickname-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--gray-light);
    border-radius: 14px;
    font-size: 18px;
    transition: all 0.2s;
    outline: none;
    font-family: inherit;
    text-align: center;
}
.nickname-input:focus { border-color: var(--blue); }
.nickname-input::placeholder { color: var(--gray); }

.avatar-section { text-align: center; }
.avatar-label {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
}
.avatar-label-sub {
    font-size: 14px;
    color: var(--gray);
    text-align: center;
    margin-bottom: 20px;
}
.avatar-row {
    display: flex;
    gap: 24px;
    justify-content: center;
}
.avatar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px;
    border-radius: 14px;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.avatar-option.selected {
    border-color: var(--pink-deep);
    background: rgba(255, 214, 244, 0.2);
}
.fish-emoji {
    font-size: 40px;
    display: block;
    width: 64px;
    height: 64px;
    line-height: 64px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 2px 8px var(--shadow);
}
.avatar-upload-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px dashed var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--gray);
    overflow: hidden;
    background: var(--white);
    transition: all 0.2s;
}
.avatar-upload-circle:hover { border-color: var(--blue); }
.avatar-upload-circle.has-image { border-style: solid; border-color: var(--pink-deep); }
#avatarThumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-option-label {
    font-size: 12px;
    color: var(--gray);
}

/* 按钮 */
.next-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--pink), var(--blue));
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s;
}
.next-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow); }
.next-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== 第5步：结果 ===== */
.result-inner { gap: 16px; }
.result-card {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1;
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}
.result-card canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
    max-width: 400px;
}
.action-pill {
    padding: 10px 16px;
    border: 2px solid var(--gray-light);
    border-radius: 20px;
    background: var(--white);
    font-size: 14px;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}
.action-pill:hover { border-color: var(--blue); background: var(--blue); }
.action-pill.highlight {
    background: var(--pink);
    border-color: var(--pink-deep);
    font-weight: 600;
    opacity: 0.75;
    font-size: 13px;
}
.action-pill.highlight:hover { background: var(--pink-deep); color: #fff; }

.download-btn {
    width: 100%;
    max-width: 320px;
    padding: 14px;
    background: linear-gradient(135deg, var(--pink), var(--blue));
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
}
.download-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow); }

/* ===== 给猫猫豹写一张 ===== */
.wb-template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    margin-bottom: 20px;
}
.wb-form { width: 100%; margin-bottom: 20px; }
.wb-label { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.wb-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border 0.2s;
}
.wb-textarea:focus { border-color: var(--blue); }
.wb-nickname-preview {
    margin-top: 10px;
    font-size: 14px;
    color: var(--pink-deep);
    font-weight: 600;
    text-align: center;
}
.back-btn {
    background: none;
    border: 2px solid var(--gray-light);
    color: var(--gray);
    padding: 10px 20px;
    border-radius: 14px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}
.back-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 小红书提示 ===== */
.xhs-prompt {
    background: linear-gradient(135deg, #fff0f5, #fff5f0);
    border: 2px solid var(--pink);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    width: 100%;
    max-width: 360px;
}
.xhs-title { font-size: 16px; font-weight: 700; color: var(--pink-deep); margin-bottom: 6px; }
.xhs-desc { font-size: 13px; color: var(--gray); }

/* ===== 弹窗 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.modal-overlay.show { display: flex; }
.modal-card {
    background: var(--white);
    border-radius: 20px;
    padding: 28px;
    width: 90%;
    max-width: 380px;
}
.modal-card h3 { font-size: 18px; margin-bottom: 16px; text-align: center; }
.modal-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--gray-light);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
}
.modal-textarea:focus { border-color: var(--blue); }
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.modal-btn.cancel { background: var(--gray-light); color: var(--primary); }
.modal-btn.confirm { background: var(--pink); color: var(--primary); font-weight: 600; }
.modal-btn:hover { opacity: 0.8; }

/* ===== 响应式 ===== */
@media (max-width: 500px) {
    .template-grid, .wb-template-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .scene-btn { padding: 10px 14px; font-size: 13px; min-width: 70px; }
    .scene-icon { width: 40px; height: 40px; }
    .step-heading { font-size: 20px; }
    .step-inner { padding: 24px 16px; }
}
