/* ===== CSS变量定义 ===== */
:root {
    --primary: #4a6bdf;           /* 主色调：蓝色 */
    --secondary: #5cb85c;         /* 次要色调：绿色 */
    --success: #5cb85c;           /* 成功状态色：绿色 */
    --danger: #d9534f;            /* 危险/错误状态色：红色 */
    --light: #f8f9fa;             /* 浅色背景 */
    --dark: #343a40;              /* 深色文字 */
    --brand: #4a6bdf;             /* 品牌主色：蓝色 */
    --brand-light: #6c8eff;       /* 品牌亮色：浅蓝色 */
    --brand-dark: #3a56b4;        /* 品牌暗色：深蓝色 */
    --text-primary: #495057;      /* 主要文字颜色 */
}

/* ===== 全局样式重置 ===== */
* {
    box-sizing: border-box;       /* 盒模型设置为border-box */
    margin: 0;                    /* 清除默认外边距 */
    padding: 0;                   /* 清除默认内边距 */
}

/* ===== 页面主体样式 ===== */
body {
    font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif; /* 中文字体栈 */
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%); /* 渐变背景 */
    min-height: 100vh;            /* 最小高度为视口高度 */
    margin: 0;
    padding: 1rem;
    color: var(--text-primary);   /* 使用变量设置文字颜色 */
    line-height: 1.6;             /* 行高设置 */
}

/* ===== 主容器样式 ===== */
.container {
    max-width: 800px;             /* 最大宽度限制 */
    margin: 1rem auto;            /* 上下边距1rem，水平居中 */
    background: white;            /* 白色背景 */
    border-radius: 16px;          /* 圆角边框 */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08); /* 阴影效果 */
    padding: 2rem;                /* 内边距 */
    position: relative;           /* 相对定位 */
    overflow: hidden;             /* 隐藏溢出内容 */
    transition: all 0.3s ease;    /* 过渡动画效果 */
    border: 1px solid rgba(0,0,0,0.05); /* 细边框 */
}

/* 容器悬停效果 */
.container:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12); /* 加深阴影 */
}

/* 容器顶部装饰条 */
.container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, var(--brand), var(--secondary)); /* 品牌色渐变 */
}

/* ===== 品牌头部样式 ===== */
.brand-header {
    text-align: center;           /* 文本居中 */
    margin-bottom: 1.5rem;        /* 底部外边距 */
    position: relative;           /* 相对定位 */
}

/* 主标题样式 */
h1 {
    color: var(--brand);          /* 使用品牌色 */
    text-align: center;           /* 文本居中 */
    margin-bottom: 1rem;          /* 底部外边距 */
    font-weight: 700;             /* 字体粗细 */
    font-size: 1.8rem;            /* 字体大小 */
    position: relative;           /* 相对定位 */
    display: inline-block;        /* 内联块显示 */
}

/* 标题下方装饰线 */
h1::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);  /* 水平居中 */
    width: 60px;
    height: 3px;
    background: var(--secondary); /* 使用次要色调 */
    border-radius: 3px;           /* 轻微圆角 */
}

/* ===== 卡片样式 ===== */
.card {
    background: white;            /* 白色背景 */
    border-radius: 12px;          /* 圆角边框 */
    padding: 1.8rem;              /* 内边距 */
    margin-bottom: 2rem;          /* 底部外边距 */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05); /* 阴影效果 */
    border: none;                 /* 无边框 */
    position: relative;           /* 相对定位 */
    overflow: hidden;             /* 隐藏溢出内容 */
    transition: all 极速响应，请稍等
0.3s ease;    /* 过渡动画效果 */
}

/* 卡片悬停效果 */
.card:hover {
    transform: translateY(-3px);  /* 上移效果 */
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.1); /* 加深阴影 */
}

/* ===== 按钮样式 ===== */
.btn {
    display: inline-block;        /* 内联块显示 */
    font-weight: 500;             /* 字体粗细 */
    text-align: center;           /* 文本居中 */
    white-space: nowrap;          /* 不换行 */
    vertical-align: middle;       /* 垂直居中 */
    user-select: none;            /* 禁止文本选择 */
    border: 1px solid transparent; /* 透明边框 */
    padding: 0.8rem 1.5rem;       /* 内边距 */
    font-size: 1rem;              /* 字体大小 */
    line-height: 1.5;             /* 行高 */
    border-radius: 50px;          /* 圆形边框 */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); /* 过渡动画 */
    cursor: pointer;              /* 手型光标 */
    position: relative;           /* 相对定位 */
    overflow: hidden;             /* 隐藏溢出内容 */
}

/* 按钮流光效果 */
.btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); /* 渐变效果 */
    transition: all 0.5s;         /* 过渡动画 */
}

/* 按钮悬停时的流光效果 */
.btn:hover::before {
    left: 100%;                   /* 流光划过效果 */
}

/* 主要按钮样式 */
.btn-primary {
    color: white;                 /* 白色文字 */
    background: linear-gradient(135deg, var(--brand), var(--brand-dark)); /* 品牌色渐变 */
    border: none;                 /* 无边框 */
    box-shadow: 0 4极速响应，请稍等
px 15px rgba(74, 107, 223, 0.3); /* 阴影效果 */
}

/* 主要按钮悬停效果 */
.btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-light), var(--brand)); /* 渐变背景 */
    transform: translateY(-2px);  /* 上移效果 */
    box-shadow: 0 6px 20px rgba(74, 107, 223, 0.4); /* 加深阴影 */
}

/* 成功按钮样式 */
.btn-success {
    color: white;                 /* 白色文字 */
    background: linear-gradient(135deg, var(--success), #449d44); /* 成功色渐变 */
    border: none;                 /* 无边框 */
    box-shadow: 0 4px 15px rgba(92, 184, 92, 0.3); /* 阴影效果 */
    text-decoration: none !important; /* 去除下划线 */
    display: inline-flex;         /* 内联弹性布局 */
    align-items: center;          /* 垂直居中 */
    justify-content: center;      /* 水平居中 */
}

/* 成功按钮悬停效果 */
.btn-success:hover {
    background: linear-gradient(135deg, #68c468, var(--success)); /* 渐变背景 */
    transform: translateY(-2px);  /* 上移效果 */
    box-shadow: 0 6px 20px rgba(92, 184, 92, 0.4); /* 加深阴影 */
    text-decoration: none !important; /* 去除下划线 */
    color: white !important;      /* 白色文字 */
}

/* 块级按钮样式 */
.btn-block {
    display: block;               /* 块级显示 */
    width: 100%;                  /* 全宽 */
}

/* 按钮组样式 */
.btn-group {
    display: flex;                /* 弹性布局 */
    gap: 15px;                    /* 元素间距 */
    margin: 1.5rem 0;             /* 外边距 */
    flex-wrap: wrap;              /* 允许换行 */
}

/* 按钮组内的按钮样式 */
.btn-group .btn {
    flex: 1;                      /* 弹性扩展 */
    min-width: 140px;             /* 最小宽度 */
    display: flex;                /* 弹性布局 */
    align-items: center;          /* 垂直居中 */
    justify-content: center;      /* 水平居中 */
    text-decoration: none !important; /* 去除下划线 */
}

/* ===== 二维码容器样式 ===== */
#qrcode-container {
    display: flex;                /* 弹性布局 */
    justify-content: center;      /* 水平居中 */
    margin: 2rem 0;               /* 外边距 */
}

/* 二维码样式 */
#qrcode {
    background: white;            /* 白色背景 */
    padding: 15px;                /* 内边距 */
    border-radius: 12px;          /* 圆角边框 */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); /* 阴影效果 */
    width: 60%;                   /* 宽度百分比 */
    max-width: 300px;             /* 最大宽度 */
}

/* 二维码图片样式 */
#qrcode img {
    width: 100%;                  /* 全宽 */
    height: auto;                 /* 高度自适应 */
    border-radius: 8px;           /* 圆角边框 */
}

/* ===== 状态提示样式 ===== */
#status {
    text-align: center;           /* 文本居中 */
    font-size: 1.1rem;            /* 字体大小 */
    margin: 1.5rem 0;             /* 外边距 */
    color: var(--dark);           /* 文字颜色 */
    font-weight: 500;             /* 字体粗细 */
    padding: 0.8rem;              /* 内边距 */
    border-radius: 8px;           /* 圆角边框 */
    background: rgba(92, 184, 92, 0.1); /* 半透明背景 */
    border-left: 4px solid var(--secondary); /* 左侧边框 */
}

/* ===== 文本区域样式 ===== */
textarea {
    width: 100%;                  /* 全宽 */
    min-height: 120px;            /* 最小高度 */
    padding: 1rem;                /* 内边距 */
    border: 1px solid #e0e0e0;    /* 边框样式 */
    border-radius: 12px;          /* 圆角边框 */
    font-family: 'Courier New', monospace; /* 等宽字体 */
    margin-bottom: 1.5rem;        /* 底部外边距 */
    resize: none;                 /* 禁止调整大小 */
    transition: all 0.3s;         /* 过渡动画 */
}

/* 文本区域聚焦效果 */
textarea:focus {
    border-color: var(--brand);   /* 边框颜色变化 */
    box-shadow: 0 0 0 3px rgba(74, 107, 223, 0.2); /* 聚焦阴影 */
    outline: none;                /* 去除默认轮廓 */
}

/* ===== 安全说明样式 ===== */
.security-notice {
    background: rgba(248, 249, 250, 0.8); /* 半透明背景 */
    border-left: 4px solid var(--brand); /* 左侧边框 */
    padding: 1.5rem;              /* 内边距 */
    margin: 1.5rem 0;             /* 外边距 */
    font-size: 0.95rem;           /* 字体大小 */
    border-radius: 0 12px 12px 0; /* 圆角边框（仅右侧） */
    position: relative;           /* 相对定位 */
}

/* 安全说明图标 */
.security-notice::before {
    content: "🔒";                /* 锁图标 */
    position: absolute;
    left: 1rem;
    top: -15px;
    font-size: 1.5rem;
    background: white;
    padding: 0 10px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* 阴影效果 */
}

/* 安全说明标题 */
.security-notice h4 {
    color: var(--brand);          /* 品牌色 */
    margin-bottom: 0.8rem;        /* 底部外边距 */
    font-size: 1.1rem;            /* 字体大小 */
}

/* 安全说明列表 */
.security-notice ul {
    padding-left: 1.2rem;         /* 左侧内边距 */
    margin: 0.8rem 0;             /* 外边距 */
}

/* 安全说明列表项 */
.security-notice li {
    margin-bottom: 0.5rem;        /* 底部外边距 */
}

/* ===== 调试日志样式 ===== */
.debug-log {
    font-family: 'Courier New', monospace; /* 等宽字体 */
    font-size: 0.85rem;           /* 字体大小 */
    background: #f5f5f5;          /* 背景色 */
    border-radius: 12px;          /* 圆角边框 */
    padding: 1.2rem;              /* 内边距 */
   极速响应，请稍等
 max-height: 300px;             /* 最大高度 */
    overflow-y: auto;             /* 垂直滚动 */
    margin-top: 1.5rem;           /* 顶部外边距 */
    border: 1px solid #eee;       /* 边框 */
}

/* 日志条目 */
.log-entry {
    margin-bottom: 0.5rem;        /* 底部外边距 */
    padding-bottom: 0.5rem;       /* 底部内边距 */
    border-bottom: 1px dashed #ddd; /* 底部虚线边框 */
}

/* 日志时间 */
.log-time {
    color: #666;                  /* 文字颜色 */
    font-size: 0.8em;             /* 字体大小 */
}

/* 信息级别日志 */
.log-info { color: #17a2b8; }

/* 成功级别日志 */
.log-success { color: var(--success); }

/* 错误级别日志 */
.log-error { color: var(--danger); }

/* ===== 隐藏元素样式 ===== */
.hidden {
    display: none;                /* 隐藏元素 */
}

/* ===== 页脚样式 ===== */
.footer {
    text-align: center;           /* 文本居中 */
    margin-top: 3rem;             /* 顶部外边距 */
    padding-top: 1.5rem;          /* 顶部内边距 */
    border-top: 1px solid rgba(0, 0, 0, 0.1); /* 顶部边框 */
    font-size: 0.85rem;           /* 字体大小 */
    color: #666;                  /* 文字颜色 */
}

/* 页脚链接 */
.footer a {
    color: var(--brand);          /* 品牌色 */
    text-decoration: none;        /* 去除下划线 */
    margin: 0 0.5rem;             /* 左右外边距 */
    transition: all 0.3s;         /* 过渡动画 */
}

/* 页脚链接悬停效果 */
.footer a:hover {
    color: var(--brand-dark);     /* 品牌暗色 */
    text-decoration: underline;   /* 下划线 */
}

/* 页脚图标容器 */
.footer-icons {
    display: flex;                /* 弹性布局 */
    justify-content: center;      /* 水平居中 */
    align-items: center;          /* 垂直居中 */
    flex-wrap: wrap;              /* 允许换行 */
    gap: 1rem;                    /* 元素间距 */
    margin-bottom: 1rem;          /* 底部外边距 */
}

/* 页脚图标 */
.footer-icon {
    width: 18px;                  /* 宽度 */
    height: 18px;                 /* 高度 */
    vertical-align: middle;       /* 垂直居中 */
    margin-right: 0.3rem;         /* 右侧外边距 */
    transition: all 0.3s;         /* 过渡动画 */
}

/* 页脚链接悬停时图标效果 */
.footer a:hover .footer-icon {
    transform: translateY(-2px);  /* 上移效果 */
}

/* ===== Select2下拉选择框样式 ===== */

/* 默认选择框 */
.select2-container--default .select2-selection--single {
    height: 48px;                 /* 高度 */
    border: 1px solid #e0e0e0;    /* 边框 */
    border-radius: 12px;          /* 圆角边框 */
    transition: all 0.3s;         /* 过渡动画 */
    background-color: white;      /* 背景色 */
}

/* 选择框悬停效果 */
.select2-container--default .select2-selection--single:hover {
    border-color: var(--brand);   /* 边框颜色变化 */
}

/* 选择框文本 */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 46px;            /* 行高 */
    padding-left: 15px;           /* 左侧内边距 */
    color: var(--dark);           /* 文字颜色 */
    font-size: 1rem;              /* 字体大小 */
}

/* 选择框箭头 */
.select2-container--default .select2-selection--single .极速响应，请稍等
select2-selection__arrow {
    height: 46px;                 /* 高度 */
    right: 12px;                  /* 右侧位置 */
}

/* 选择框箭头图标 */
.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: #888 transparent transparent transparent; /* 箭头颜色 */
    border-style: solid;          /* 实线边框 */
    border-width: 5px 4px 0 4px;  /* 箭头大小 */
}

/* 展开状态下的箭头图标 */
.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #888 transparent; /* 箭头颜色反转 */
    border-width: 0 4px 5px 4px;  /* 箭头大小 */
}

/* 下拉菜单 */
.select2-dropdown {
    border: 1px solid #e0e0e0;    /* 边框 */
    border-radius: 12px;          /* 圆角边框 */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); /* 阴影效果 */
    overflow: hidden;             /* 隐藏溢出内容 */
}

/* 下拉选项 */
.select2-results__option {
    padding: 10px 15px;           /* 内边距 */
}

/* 高亮选项 */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--brand); /* 品牌色背景 */
    color: white;                 /* 白色文字 */
}

/* 已选择选项 */
.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #f8f9fa;    /* 浅灰色背景 */
    color: var(--dark);           /* 深色文字 */
}

/* 搜索框 */
.select2-search--dropdown .select2-search__field {
    border: 1px solid #e0e0e0;    /* 边框 */
    border-radius: 8px;           /* 圆角边框 */
    padding: 8px 12px;            /* 内边距 */
}

/* 清除按钮 */
.select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 25px;           /* 右侧外边距 */
    color: #999;                  /* 文字颜色 */
    font-size: 1.2rem;            /* 字体大小 */
}

/* 清除按钮悬停效果 */
.select2-container--default .select2-selection--single .select2-selection__clear:hover {
    color: var(--danger);         /* 危险色 */
}

/* ===== 游戏选择器样式 ===== */
.game-selector {
    margin-bottom: 2rem;          /* 底部外边距 */
}

/* 游戏选择器标签 */
.game-selector label {
    display: block;               /* 块级显示 */
    margin-bottom: 0.8rem;        /* 底部外边距 */
    font-weight: 500;             /* 字体粗细 */
    color: var(--dark);           /* 文字颜色 */
    font-size: 1rem;              /* 字体大小 */
}

/* ===== 生成中按钮样式 ===== */
.btn-generating {
    background: linear-gradient(135deg, #cccccc, #999999) !important; /* 灰色渐变 */
    cursor: not-allowed !important; /* 禁用光标 */
}
.btn-generating:hover {
    transform: none !important;   /* 禁用悬停效果 */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important; /* 禁用阴影变化 */
}

/* ===== 脉冲动画 ===== */
.animate-pulse {
    animation: pulse 2s infinite; /* 脉冲动画 */
}

/* 脉冲动画关键帧 */
@keyframes pulse {
    0% { opacity: 1; }            /* 开始：完全不透明 */
    50% { opacity: 0.6; }         /* 中间：半透明 */
    100% { opacity: 1; }          /* 结束：完全不透明 */
}

/* ===== 链接按钮样式修复 ===== */

/* 链接按钮基础样式 */
a.btn {
    text-decoration: none !important; /* 去除下划线 */
    display: inline-flex;         /* 内联弹性布局 */
    align-items: center;          /* 垂直居中 */
    justify-content: center;      /* 水平居中 */
}

/* 链接按钮悬停状态 */
a.btn:hover,
a.btn:focus,
a.btn:active {
    text-decoration: none !important; /* 去除下划线 */
    color: white !important;      /* 白色文字 */
}

/* 按钮组中的链接按钮 */
.btn-group a.btn {
    text-decoration: none !important; /* 去除下划线 */
    display: flex;                /* 弹性布局 */
    align-items: center;          /* 垂直居中 */
    justify-content: center;      /* 水平居中 */
}

/* ===== 响应式设计 ===== */

/* 中等屏幕设备（平板等） */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;          /* 减少内边距 */
        margin: 0.5rem auto;      /* 调整外边距 */
        border-radius: 0;         /* 去除圆角 */
    }
    
    h1 {
        font-size: 1.5rem;        /* 减小字体大小 */
    }
    
    .card {
        padding: 1.2rem;          /* 减少内边距 */
    }
    
    .btn {
        padding: 0.7rem 1.2rem;   /* 调整按钮内边距 */
    }
    
    .btn-group {
        flex-direction: column;   /* 垂直排列按钮 */
        gap: 10px;                /* 按钮间距 */
    }
    
    .btn-group .btn {
        width: 100%;              /* 全宽按钮 */
        margin-bottom: 0.5rem;    /* 底部外边距 */
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;         /* 最后一个按钮无底部外边距 */
    }
    
    #qrcode {
        width: 80%;               /* 调整二维码宽度 */
    }
}

/* 小屏幕设备（手机等） */
@media (max-width: 480px) {
    body {
        padding: 0.5rem;          /* 减少内边距 */
    }
    
    .container {
        padding: 1rem;            /* 减少内边距 */
    }
    
    h1 {
        font-size: 1.3rem;        /* 减小字体大小 */
    }
    
    .security-notice {
        padding: 1rem;            /* 减少内边距 */
    }
    
    .footer-icons {
        flex-direction: column;   /* 垂直排列图标 */
        gap: 0.5rem;              /* 图标间距 */
    }
    
    #qrcode {
        width: 90%;               /* 调整二维码宽度 */
    }
}