/* ============================================
   摸鱼小游戏 - 样式文件 style.css
   包含：全局变量、布局容器、卡片组件、
         游戏列表、搜索框、游戏画面、
         页脚、手机端游戏弹窗、响应式媒体查询
   ============================================ */

/* ---------- CSS 变量（主题色/间距/阴影等全局配置） ---------- */
:root {
    --bg-primary: #f5f5f5;                    /* 主背景色（灰） */
    --bg-secondary: #ffffff;                  /* 卡片背景色（白） */
    --text-primary: #333333;                  /* 主文字色 */
    --text-secondary: #666666;                /* 次要文字色 */
    --border-color: #d0d0d0;                  /* 边框描边色 */
    --hover-color: #f0f0f0;                   /* hover 背景色 */
    --accent: #07C160;                        /* 主题色（微信绿，选中高亮） */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);  /* 卡片阴影 */
    --game-ease-elastic: cubic-bezier(0.175, 0.885, 0.32, 1.4); /* 弹窗弹性动画曲线 */
    --game-text-primary: #1d1d1f;             /* 弹窗标题文字色 */
    --game-glass-base: rgba(255, 255, 255, 0.75); /* 弹窗顶栏半透明毛玻璃底 */
    --game-topbar-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 12px rgba(0, 0, 0, 0.2); /* 弹窗顶栏阴影 */
}

/* ---------- 全局重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---------- 页面主体 ---------- */
body {
    font-family: 'Microsoft YaHei', 'Arial', sans-serif;
    background-color: #ffffff;   /* 纯白背景 */
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 20px 0;           /* 上下留 20px 留白，两侧自适应 */
    box-sizing: border-box;
}

/* ---------- 主容器（左右两栏） ---------- */
.container {
    display: flex;
    gap: 20px;
    width: 80%;
    max-width: 1200px;
    margin: 0 auto;            /* 居中 */
    height: calc(100vh - 40px);/* 视口高度减去 body 的上下 padding */
}

/* 左侧栏：游戏列表（占 2 份） */
.left-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 右侧栏：游戏画面（占 1 份） */
.right-panel {
    flex: 1;
}

/* ---------- 通用卡片样式 ---------- */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);   /* 灰色描边 */
    overflow: hidden;
}

/* 站点名称（预留） */
.site-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 搜索区容器（预留） */
.search-section {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* 通用搜索框（顶部旧样式，当前未使用） */
.search-box {
    width: 100%;
    max-width: 300px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    background: var(--bg-primary);
    transition: all 0.2s;
}
.search-box:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
}

/* ---------- 游戏列表卡片（左侧主卡片） ---------- */
.game-list-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;    /* 内容过长整张卡片滚动 */
    overflow-x: hidden;
    padding: 25px;        /* 卡片内边距（留白） */
    box-sizing: border-box;
}
/* 自定义滚动条（卡片整体） */
.game-list-card::-webkit-scrollbar { width: 6px; }
.game-list-card::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 3px; }
.game-list-card::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
.game-list-card::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }

/* ---------- 标题包装器：标题 + 搜索框 ---------- */
.section-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;       /* 用于定位 ::before 渐变下划线 */
}
/* 左侧绿色渐变装饰下划线 */
.section-title-wrapper::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, #07C160, #10B981);
    border-radius: 2px;
}

/* 主标题：摸鱼小游戏 */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* ---------- 游戏搜索框（带放大镜图标） ---------- */
.game-search-box {
    position: relative;
    flex-shrink: 0;   /* 搜索框不被挤压 */
}
.game-search-input {
    padding: 8px 32px 8px 12px;   /* 右侧留空给 🔍 图标 */
    border: 1px solid #07C160;    /* 微信绿边框 */
    border-radius: 20px;
    font-size: 14px;
    width: 180px;
    outline: none;
    transition: all 0.3s ease;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
    color: #333;
}
.game-search-input:focus {
    border-color: #07C160;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.15);
}
.game-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
    pointer-events: none;   /* 图标不拦截点击 */
}

/* ---------- 说明文案区域 ---------- */
.section-content {
    font-size: 14px;
    color: #666;
    line-height: 1.8;
    margin: 0 0 20px 0;
}
.section-content p {
    margin: 0 0 12px 0;
}
.section-content p:last-child {
    margin-bottom: 0;
}

/* ---------- 右侧游戏画面卡片头部 ---------- */
.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 右侧卡片右上角三个装饰圆点（红/黄/蓝，仿 macOS 窗口） */
.dot-container { display: flex; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.blue { background: #2d7dd2; }

/* ---------- 游戏按钮容器（Flex 换行布局） ---------- */
.button-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

/* ---------- 旧版游戏项（game-item，预留兼容） ---------- */
.game-item {
    padding: 15px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    color: var(--text-primary);
    background: var(--bg-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.game-item:hover {
    background: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}
.game-item.active { background: var(--accent); color: white; }

/* ---------- 游戏按钮（实际使用的 styled-button） ---------- */
.styled-button {
    background-color: white;
    color: black;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); /* 卡片阴影浮起感 */
    width: calc((100% - 50px) / 6);         /* 桌面端 6 列：5 个 gap=10px 共 50px */
    box-sizing: border-box;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
}
.styled-button:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);              /* hover 上浮 1px */
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.styled-button.active {
    background: var(--accent);                /* 选中状态微信绿背景 */
    color: white;
}

/* ---------- 右侧游戏画面卡片 ---------- */
.game-frame-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 游戏 iframe */
.game-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: #f8f8f8;
}

/* 游戏未选中时的占位提示 */
.game-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    color: var(--text-secondary);
}
.game-placeholder-icon { font-size: 64px; margin-bottom: 20px; opacity: 0.5; }
.game-placeholder-text { font-size: 18px; font-weight: 500; }
.game-placeholder-hint { font-size: 14px; margin-top: 10px; opacity: 0.7; }

/* ---------- 右侧游戏画面卡片底部声明 ---------- */
.footer-card {
    padding: 15px 20px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   手机端游戏弹窗（点击遮罩关闭 / 新标签页 / 全屏）
   ============================================ */
.game-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.game-modal-overlay.is-open { opacity: 1; }

/* 弹窗外层壳子 */
.game-modal-shell {
    width: min(1080px, 92vw);
    height: min(85vh, 800px);
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.25s var(--game-ease-elastic), opacity 0.2s ease;
}
.game-modal-shell.is-open { transform: scale(1); opacity: 1; }
.game-modal-shell.is-closing {
    transform: scale(0.96);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.15s ease;
}
.game-modal-shell.is-fullscreen {  /* 全屏按钮点击后切换此 class */
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

/* 弹窗顶栏（毛玻璃） */
.game-modal-topbar {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: var(--game-glass-base);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--game-topbar-shadow);
    z-index: 10;
    position: relative;
}
.game-modal-title {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
    color: var(--game-text-primary);
    opacity: 0.9;
    margin: 0;
}
.game-modal-actions { display: flex; align-items: center; gap: 10px; }

/* 顶栏圆形按钮（新标签页 / 全屏 / 关闭） */
.game-modal-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    color: #333;
}
.game-modal-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}
.game-modal-btn.game-modal-close:hover {
    background: #ff4757;   /* 关闭按钮 hover 红底白叉 */
    border-color: #ff4757;
    color: #fff;
}

/* 弹窗主体（iframe 容器） */
.game-modal-body {
    flex: 1;
    position: relative;
    background: #fff;
    z-index: 1;
}
.game-modal-iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* ============================================
   响应式媒体查询 - 平板/手机端 (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
    /* 容器改为纵向单列，宽度铺满 */
    .container {
        flex-direction: column;
        height: auto;
        width: 100%;
        padding: 10px;
        gap: 10px;
    }
    body { padding: 0; }

    /* 手机端隐藏右侧游戏画面面板（仅显示游戏列表） */
    .right-panel { display: none; }

    /* 游戏列表卡片：去边框阴影、减小内边距 */
    .game-list-card {
        padding: 20px 15px;
        border: none;
        box-shadow: none;
    }

    .section-title { font-size: 16px; }
    .game-search-input { width: 120px; }   /* 手机端缩短搜索框 */
    .section-content { font-size: 13px; }

    .button-container { max-width: 100%; }

    /* 手机端游戏按钮：3 列一行 */
    .styled-button {
        width: calc((100% - 20px) / 3);  /* 3 列：2 个 gap 共 20px */
        flex: none;
        min-width: auto;
        padding: 12px 4px;
        font-size: 12px;
    }

    /* --- 手机端游戏弹窗样式：从底部滑入 --- */
    .game-modal-overlay { padding: 0; }
    .game-modal-shell {
        width: 100%;
        height: 90vh;
        border-radius: 20px 20px 0 0;   /* 顶部两个圆角、底部直角 */
        position: absolute;
        bottom: 0;                      /* 吸附屏幕底部 */
        transform: translateY(100%);
    }
    .game-modal-shell.is-open { transform: translateY(0); }
    .game-modal-shell.is-closing { transform: translateY(100%); }
    .game-modal-shell.is-fullscreen { height: 100vh; }
}

/* ---------- 小屏手机额外适配 (≤ 480px) ---------- */
@media (max-width: 480px) {
    .styled-button {
        width: calc((100% - 20px) / 3);  /* 同样保持 3 列 */
    }
}
