/*========================================================
 *  圈游戏 - 统一UI设计系统
 *  适用于所有页面的公共样式
 *========================================================*/

/* === CSS 变量 - 设计令牌 === */
:root {
    /* ---- 背景色 ---- */
    --bg-page:       #f9e9b3;   /* 主页面背景（浅黄） */
    --bg-page-alt:   #f9e9b3;   /* 首页备用背景（浅黄亮） */
    --bg-card:       #ffffff;   /* 卡片背景 */
    --bg-secondary:  #f5f5f5;   /* 次要背景 */

    /* ---- 功能色 ---- */
    --color-blue:    #88cefa;   /* 蓝色：返回/退出/选中标签 */
    --color-green:   #b9ffa1;   /* 绿色：保存/开始/确认 */
    --color-purple:  #b19bd9;   /* 紫色：编辑/新建/标题 */
    --color-red:     #f75655;   /* 红色：删除/危险/惩罚 */
    --color-pink:    #ff68b5;   /* 粉色：详情/导入/分享 */
    --color-yellow:  #fed787;   /* 黄色：游戏名栏 */
    --color-orange:  #ff7e4f;   /* 橙色：类型栏 */
    --color-peach:   #fedbc7;   /* 桃色：容器背景 */

    /* ---- 文字色 ---- */
    --text-primary:   #333333;
    --text-secondary: #666666;
    --text-muted:     #999999;
    --text-black:     #000000;

    /* ---- 边框 ---- */
    --border-color:   #000000;
    --border-width:   2px;
    --border-style:   2px solid #000000;
    --border-radius:  10px;

    /* ---- 阴影 ---- */
    --shadow-card:  0 2px 8px rgba(136,206,250,0.2);
    --shadow-toast: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-modal: 0 4px 12px rgba(0,0,0,0.15);

    /* ---- 字号 ---- */
    --font-xs:  14px;
    --font-sm:  16px;
    --font-md:  18px;
    --font-lg:  20px;
    --font-xl:  22px;
    --font-huge: 24px;

    /* ---- 间距 ---- */
    --spacing-xs:  4px;
    --spacing-sm:  8px;
    --spacing-md:  12px;
    --spacing-lg:  16px;
    --spacing-xl:  20px;
    --spacing-xxl: 24px;

    /* ---- 动画 ---- */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* === 全局重置 === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: sans-serif;
}

/* iOS按钮样式重置 */
button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

/* 基础页面结构 */
html, body {
    height: 100%;
    background-color: var(--bg-page);
}

body {
    display: flex;
    flex-direction: column;
}

/* 隐藏广告头部 */
.header {
    display: none;
}

/* === 通用页面标题栏 === */
.page-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    position: relative;
    font-size: var(--font-huge);
    flex-shrink: 0;
    background: transparent;
    border-bottom: none;
    min-height: 60px;
    color: var(--text-primary);
}

.title-left,
.title-right {
    width: 80px;
    display: flex;
    align-items: center;
}

.title-center {
    flex: 1;
    text-align: center;
    font-weight: bold;
}

/* === 返回/退出按钮 === */
.back-btn,
.exit-btn {
    border: var(--border-style);
    background: var(--color-blue);
    border-radius: var(--border-radius);
    padding: 8px 16px;
    font-size: var(--font-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-black);
    transition: all var(--transition-fast);
}

.back-btn:active,
.exit-btn:active {
    background: var(--color-blue);
    color: #fff;
}

/* === 滚动容器 === */
.scroll-container {
    flex: 1;
    overflow-y: auto;
    background: transparent;
}

/* === Toast 提示（统一） === */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    display: none;
    z-index: 99999;
    font-size: var(--font-sm);
}

/* === 通用保存/确认按钮 === */
.save-btn,
.add-btn {
    width: 100%;
    max-width: 400px;
    background: var(--color-green);
    color: var(--text-black);
    border: var(--border-style);
    border-radius: var(--border-radius);
    padding: 12px 0;
    font-size: var(--font-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: opacity var(--transition-fast);
}

.save-btn:active,
.add-btn:active {
    opacity: 0.9;
}

.save-btn-container,
.add-btn-container {
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

/* === 通用卡片按钮 === */
.card-btn {
    color: var(--text-black);
    border: var(--border-style);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.card-btn:active {
    opacity: 0.8;
}

/* === 弹窗遮罩 === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.2);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

/* === 弹窗内容 === */
.modal-content {
    background: var(--bg-card);
    border: var(--border-style);
    border-radius: var(--border-radius);
    padding: var(--spacing-xxl);
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-modal);
}

.modal-content .modal-title {
    font-size: var(--font-lg);
    text-align: center;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: bold;
}

.modal-content textarea {
    width: 100%;
    height: 120px;
    margin: 10px 0;
    font-size: var(--font-sm);
    border: var(--border-style);
    border-radius: var(--border-radius);
    padding: 10px;
    resize: none;
    outline: none;
}

.modal-content textarea:focus {
    border-color: #5ab8f5;
    box-shadow: 0 0 0 2px rgba(136,206,250,0.2);
}

.modal-bottom-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: auto;
}

.modal-back-btn,
.modal-action-btn {
    border: var(--border-style);
    background: var(--color-blue);
    border-radius: var(--border-radius);
    padding: 8px 20px;
    font-size: var(--font-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-black);
    min-width: 100px;
    transition: all var(--transition-fast);
}

.modal-action-btn {
    background: var(--color-pink);
}

.modal-back-btn:active,
.modal-action-btn:active {
    opacity: 0.8;
}

/* === 输入框通用样式 === */
input[type="text"],
textarea,
select {
    font-size: var(--font-md);
    outline: none;
    color: var(--text-primary);
}

input[type="text"]:focus,
textarea:focus {
    border-color: var(--color-blue);
}

/* === 多选下拉组件（通用） === */
.multi-select {
    position: relative;
    width: 100%;
    margin: 0;
    font-size: var(--font-lg);
    border: var(--border-style);
    border-radius: var(--border-radius);
    background: var(--bg-card);
}

.select-trigger {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    min-height: 40px;
    max-height: 90px;
    overflow-y: auto;
    transition: none;
}

.placeholder {
    color: var(--text-muted);
    line-height: 24px;
    font-size: var(--font-lg);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.tag {
    display: inline-flex;
    align-items: center;
    max-width: 140px;
    padding: 2px 8px;
    background: var(--color-blue);
    color: var(--text-black);
    border-radius: 4px;
    font-size: var(--font-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag .remove {
    display: none;
}

.arrow {
    margin-left: auto;
    transition: transform var(--transition-fast);
    color: var(--text-secondary);
    flex-shrink: 0;
    line-height: 24px;
    font-size: var(--font-lg);
}

.arrow.open {
    transform: rotate(180deg);
}

/* 多选遮罩 */
.multi-mask {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.multi-mask.show {
    display: block;
    opacity: 1;
}

/* 多选底部面板 */
.multi-sheet-panel {
    position: fixed;
    left: 0;
    right: 0;
    top: 50%;
    bottom: 0;
    background: var(--bg-card);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.multi-sheet-panel.show {
    transform: translateY(0);
}

.multi-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.multi-sheet-title {
    font-size: var(--font-lg);
    font-weight: 500;
    color: var(--text-primary);
}

.multi-sheet-close {
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.multi-sheet-close:hover {
    color: var(--text-primary);
}

.multi-sheet-body {
    flex: 1;
    overflow-y: auto;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f9f9f9;
}

.option-item:last-child {
    border-bottom: none;
}

.option-label {
    display: flex;
    align-items: center;
    flex: 1;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.option-label input[type="checkbox"] {
    margin-right: 10px;
    flex-shrink: 0;
    accent-color: #409eff;
    width: 18px;
    height: 18px;
}

/* === 右侧固定「支持我」按钮 === */
.support-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background-color: #8f69e3;
    color: #fff;
    border: none;
    padding: 12px 16px;
    font-size: var(--font-sm);
    font-family: sans-serif;
    cursor: pointer;
    z-index: 999;
    text-decoration: none;
    border-radius: 8px 0 0 8px;
    writing-mode: vertical-rl;
    letter-spacing: 4px;
}

.support-btn:hover {
    opacity: 0.85;
}

@media (max-width: 768px) {
    .support-btn {
        padding: 10px 12px;
        font-size: var(--font-xs);
        letter-spacing: 2px;
    }
}

/* === 移动端适配（公共） === */
@media screen and (max-width: 480px) {
    .page-title-bar {
        font-size: var(--font-lg);
        min-height: 50px;
    }
    
    .back-btn,
    .exit-btn {
        padding: 6px 12px;
        font-size: var(--font-sm);
    }
    
    .title-left,
    .title-right {
        width: 70px;
    }
    
    .save-btn,
    .add-btn {
        font-size: var(--font-md);
    }
}
