/* 全局样式 */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
}

/* 会员容器样式 */
.member-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 语言按钮样式 */
.lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid currentColor;
    padding: 0;
    background: transparent;
}

/* 语言文本样式 */
#lang-text {
    font-size: 12px;
    font-weight: 500;
}

/* 会员头像链接样式 */
#member-avatar {
    display: flex;
    align-items: center;
}

/* 颜色点样式 */
.color-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #000;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

/* SVG元素过渡效果 */
#skin,
#line,
#eyes3,
#eyes2,
#eyes,
rect {
    transition: fill 0.5s ease, stroke 0.5s ease;
}

/* 滑块过渡效果 */
.color-slider-input {
    transition: all 0.2s ease;
}

/* 肤色点初始颜色 */
.skin-dot {
    background-color: #fff;
}

/* 描边点初始颜色 */
.stroke-dot {
    background-color: #000;
}

/* 背景点初始颜色 */
.background-dot {
    background-color: #404040;
}

/* 眼睛点初始颜色 */
.eye-dot {
    background-color: #ffa500;
}

/* 深色模式下的颜色点样式 */
@media (prefers-color-scheme: dark) {
    .color-dot {
        border: 2px solid #fff;
    }
}

main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding-top: clamp(60px, 10vh, 100px);
    padding-bottom: clamp(60px, 10vh, 100px);
    box-sizing: border-box;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

/* 渐显动画 */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* 左边正方形画面动画 */
.avatar-container {
    opacity: 0;
    animation: fadeInLeft 0.8s ease forwards;
    animation-delay: 0.2s;
}

@keyframes fadeInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 右边内容部分动画 */
.editor-info {
    opacity: 0;
    transform: scale(0.8);
    animation: fadeInScale 0.8s ease forwards;
    animation-delay: 0.6s;
}

@keyframes fadeInScale {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 光标闪烁动画 */
@keyframes blink {

    from,
    to {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* 打字机效果 */
.typewriter-title {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    margin: 0;
}

.typewriter-text {
    display: inline-block;
}

.typewriter-text::after {
    content: '|';
    position: absolute;
    right: -8px;
    animation: blink 0.7s step-end infinite;
}

/* 自定义头像编辑器样式 */
.avatar-editor {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin: auto;
    box-sizing: border-box;
    overflow: visible;
    padding: 2rem;
    padding-left: clamp(2rem, 5vw, 4rem);
    padding-right: clamp(2rem, 5vw, 4rem);
    width: auto;
    max-width: 1920px;
    position: relative;
}

/* 响应式调整比例 - 基于视口宽度和高度 */
@media (min-width: 1025px) {

    /* 电脑端布局 */
    .avatar-container {
        flex: 0 0 auto;
        width: clamp(200px, min(35vw, 40vh), 450px);
        max-width: min(35vw, 40vh);
        max-height: calc(100vh - 180px);
    }

    .editor-info {
        flex: 1;
        min-width: 300px;
        max-width: 500px;
        width: clamp(50%, 55vw, 60%);
    }
}

@media (max-width: 1200px) {
    .avatar-container {
        width: clamp(200px, min(40vw, 38vh), 420px);
        max-width: min(40vw, 38vh);
        max-height: calc(100vh - 180px);
    }

    .editor-info {
        width: clamp(55%, 60vw, 65%);
    }
}

@media (max-width: 1024px) {
    .avatar-editor {
        flex-direction: column;
        align-items: center;
        gap: clamp(1rem, 3vh, 2rem);
        padding: clamp(1rem, 2vh, 1.5rem);
        padding-left: clamp(1rem, 2vh, 1.5rem);
        padding-right: clamp(1rem, 2vh, 1.5rem);
    }

    .avatar-container {
        width: clamp(180px, min(50vw, 35vh), 380px);
        max-width: min(50vw, 35vh);
        max-height: calc(100vh - 220px);
    }

    .editor-info {
        width: 100%;
        text-align: center;
        align-items: center;
        margin-left: 0;
        padding: 0 !important;
    }
}

@media (max-width: 768px) {
    .avatar-container {
        width: clamp(160px, min(55vw, 32vh), 320px);
        max-width: min(55vw, 32vh);
        max-height: calc(100vh - 240px);
    }
}

@media (max-width: 480px) {
    .avatar-editor {
        padding: clamp(0.5rem, 2vh, 1rem);
        padding-left: clamp(0.5rem, 2vh, 1rem);
        padding-right: clamp(0.5rem, 2vh, 1rem);
        gap: clamp(0.5rem, 2vh, 1rem);
    }

    .avatar-container {
        width: clamp(150px, min(70vw, 30vh), 280px);
        max-width: min(70vw, 30vh);
        max-height: calc(100vh - 200px);
    }
}

.avatar-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    width: clamp(200px, min(45vw, 35vh), 500px);
    max-width: min(45vw, 35vh);
    max-height: calc(100vh - 200px);
    cursor: pointer;
    transition: transform 0.15s ease, width 0.3s ease, max-width 0.3s ease;
}

/* 点击动画效果 */
.avatar-container:active {
    transform: scale(0.98);
}

.avatar-preview {
    width: 100%;
    aspect-ratio: 1/1;
    background-color: transparent;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.5s ease;
}

.avatar-svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.color-controls {
    display: flex;
    margin: 1.5rem 0 1.5rem 0;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #000;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    color: #000;
}

.control-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.control-btn:hover {
    transform: scale(1.1);
}

.color-option-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.color-option-label {
    display: none;
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    .control-btn {
        border: 2px solid #fff;
        background-color: #333;
        color: #fff;
    }

    .control-btn svg {
        stroke: currentColor;
    }
}

.color-option {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.color-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #000;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.color-option:hover .color-dot {
    transform: scale(1.1);
}

.color-option.active .color-dot {
    transform: scale(1.2);
}

.color-label {
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    display: none;
}

.color-slider {
    position: absolute;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: column;
    gap: 0;
    background: rgb(250, 250, 250);
    padding: 0.5rem;
    border-radius: 12px;
    z-index: 10;
    min-width: 180px;
}

/* 颜色选择器箭头 */
.color-slider::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

/* 深色模式下的颜色选择器 */
@media (prefers-color-scheme: dark) {
    .color-slider::before {
        border-color: #333 transparent transparent transparent;
    }
}

.color-option.active .color-slider {
    display: flex;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.slider-container label {
    font-size: 12px;
    font-weight: 500;
    width: 15px;
    text-align: center;
    color: #333;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #000, #fff);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

/* 滑块轨道 */
.slider-container input[type="range"]::-webkit-slider-track {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #000, #fff);
    cursor: pointer;
    transition: all 0.2s ease;
}

/* 滑块thumb */
.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Firefox 滑块 */
.slider-container input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #000, #fff);
    cursor: pointer;
    transition: all 0.2s ease;
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #000;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;

}

.slider-container input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);

}

/* 为不同通道设置不同的渐变颜色 */
.slider-container:nth-child(1) input[type="range"] {
    background: linear-gradient(to right, #000, #ff0000);
}

.slider-container:nth-child(1) input[type="range"]::-webkit-slider-track {
    background: linear-gradient(to right, #000, #ff0000);
}

.slider-container:nth-child(1) input[type="range"]::-moz-range-track {
    background: linear-gradient(to right, #000, #ff0000);
}

.slider-container:nth-child(2) input[type="range"] {
    background: linear-gradient(to right, #000, #00ff00);
}

.slider-container:nth-child(2) input[type="range"]::-webkit-slider-track {
    background: linear-gradient(to right, #000, #00ff00);
}

.slider-container:nth-child(2) input[type="range"]::-moz-range-track {
    background: linear-gradient(to right, #000, #00ff00);
}

.slider-container:nth-child(3) input[type="range"] {
    background: linear-gradient(to right, #000, #0000ff);
}

.slider-container:nth-child(3) input[type="range"]::-webkit-slider-track {
    background: linear-gradient(to right, #000, #0000ff);
}

.slider-container:nth-child(3) input[type="range"]::-moz-range-track {
    background: linear-gradient(to right, #000, #0000ff);
}

.slider-container span {
    font-size: 12px;
    font-weight: 500;
    width: 35px;
    text-align: right;
    color: #333;
}

/* 深色模式下的滑块样式 */
@media (prefers-color-scheme: dark) {
    .slider-container label {
        color: #fff;
    }

    .slider-container input[type="range"] {
        background: #444;

    }

    .slider-container input[type="range"]::-webkit-slider-track {
        background: #444;
    }

    .slider-container input[type="range"]::-webkit-slider-thumb {
        background: #fff;
    }

    .slider-container input[type="range"]::-moz-range-track {
        background: #444;
    }

    .slider-container input[type="range"]::-moz-range-thumb {
        background: #fff;
    }

    .slider-container span {
        color: #fff;
    }
}

.editor-info {
    flex: 1;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0 0 0 5vw;
    box-sizing: border-box;
    width: clamp(40%, 55vw, 70%);
}

.editor-info h1 {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 700;
    margin: 0;
    color: #333;
    line-height: 1.5;
    letter-spacing: 1px;
    white-space: nowrap;
}

.editor-info h2 {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 600;
    margin: 0;
    color: #333;
    letter-spacing: 1px;
    line-height: 1;
    white-space: nowrap;
}

.action-buttons {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.download-btn {
    width: auto;
    height: auto;
    padding: clamp(8px, 2vw, 12px) clamp(16px, 4vw, 24px);
    border: none;
    border-radius: 25px;
    font-size: clamp(12px, 1.5vw, 14px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn-primary {
    background: #000;
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

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

/* 响应式设计 */
@media (max-width: 1024px) {
    .avatar-editor {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 0 1.5rem;
    }

    .avatar-container {

        max-width: 400px;
    }

    .avatar-preview {
        width: 100%;
        aspect-ratio: 1/1;
    }

    .editor-info {
        text-align: center;
        width: 100%;
        align-items: center;
    }

    .action-buttons {
        justify-content: center;
    }

    .color-controls {
        justify-content: center;
    }
}

/* 手机端颜色选择器改为RGB输入框样式 */
@media (max-width: 768px) {
    .color-option {
        position: relative;
    }

    .color-slider {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        bottom: auto;
        min-width: 280px;
        width: auto;
        max-width: 320px;
        border-radius: 16px;
        background: rgb(250, 250, 250);
        z-index: 10000;
    }

    /* 隐藏箭头 */
    .color-slider::before {
        display: none;
    }

    /* 确保弹窗在遮罩层之上 */
    .color-option.active .color-slider {
        z-index: 10001;
    }

    .slider-container {
        max-width: 400px;
    }

    .slider-container:last-child {
        margin-bottom: 0;
    }

    .slider-container input[type="range"] {
        height: 12px;
        border-radius: 6px;
    }

    .slider-container input[type="range"]::-webkit-slider-thumb {
        width: 15px;
        height: 15px;
    }

    .slider-container input[type="range"]::-moz-range-thumb {
        width: 15px;
        height: 15px;
    }

    .slider-container label {
        font-size: 14px;
        width: 20px;
    }

    .slider-container span {
        font-size: 14px;
        width: 40px;
    }
}

@media (max-width: 480px) {
    .avatar-container {
        max-width: 250px;
    }

    .avatar-preview {
        width: 100%;
        aspect-ratio: 1/1;
    }

    .editor-info h1 {
        font-size: 1rem;
    }

    .action-buttons {
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }

    .download-btn {
        width: auto;
        height: auto;
        padding: 10px 20px;
        font-size: 12px;
    }
}

/* 下载提示样式 */
.download-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 10px;
    font-size: 12px;
    color: #999;
    transition: all 0.3s ease;
}

.download-hint:hover {
    color: #666;
}

.up-arrow {
    transition: transform 0.3s ease;
}

.download-hint:hover .up-arrow {
    transform: translateY(-2px);
}

/* 消息输入框样式 */
.message-input {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

.input-field {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #000;
    border-radius: 25px;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    background: transparent;
    transition: all 0.3s ease;
}

.input-field::placeholder {
    color: #999;
}

.input-field:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.send-btn {
    padding: 10px 20px;
    border: 2px solid #000;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    background: #000;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {

    .editor-info h1,
    .editor-info h2 {
        color: #fff;
    }

    .editor-info p {
        color: #ccc;
    }

    .search-bar input {
        color: #fff;
    }

    .btn-secondary {
        background: #444;
        color: #fff;
        border-color: #555;
    }

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

    .color-slider {
        background: #333;
        color: #fff;
    }

    .color-dot {
        border: 2px solid #fff;
    }

    /* 深色模式下的输入框和按钮 */
    .input-field {
        border-color: #fff;
        color: #fff;
    }

    .input-field::placeholder {
        color: #777;
    }

    .input-field:focus {
        border-color: #ccc;
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
    }

    .send-btn {
        border-color: #fff;
        background: #fff;
        color: #000;
    }

    .send-btn:hover {
        box-shadow: 0 4px 8px rgba(255, 255, 255, 0.2);
    }

    /* 深色模式下的下载提示 */
    .download-hint {
        color: #777;
    }

    .download-hint:hover {
        color: #ccc;
    }

    /* 深色模式下的对话气泡 */
    .chat-bubble {
        background: #333;
        box-shadow: inset 0 0 0 2px #fff;
    }

    .bubble-tail {
        border-top: 10px solid #fff;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
    }

    .bubble-content {
        color: #fff;
    }
}

/* 对话气泡样式 */
.chat-bubble {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 12px;
    padding: 8px 12px;
    max-width: 280px;
    /* 固定最大宽度，不依赖父容器 */
    width: max-content;
    /* 内容宽度，但不超过max-width */
    min-width: 80px;
    /* 最小宽度 */
    text-align: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: inset 0 0 0 2px #000;
    margin-bottom: -10px;
    box-sizing: border-box;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.chat-bubble.show {
    opacity: 1;
}

.bubble-content {
    font-size: 12px;
    color: #333;
    line-height: 1.4;
    min-height: 18px;
    text-align: left;
    max-height: calc(1.4em * 3);
    /* 3行的高度 = 行高 × 3 */
    overflow-y: auto;
    /* 超出时显示滚动条 */
    padding-right: 4px;
    /* 给滚动条留出空间 */
    /* 隐藏滚动条 */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

/* 隐藏WebKit浏览器的滚动条 */
.bubble-content::-webkit-scrollbar {
    display: none;
}

.bubble-tail {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid #000;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
}

/* 响应式调整 */
@media (max-width: 1024px) {
    .chat-bubble {
        max-width: 220px;
    }
}

@media (max-width: 768px) {
    .chat-bubble {
        max-width: 180px;
        font-size: 12px;
        padding: 6px 10px;
    }
}