/* 游戏页公共布局：.container 居中定宽 + 内部「左主体 + 300px 右侧栏」两栏
   引用位置：<link rel="stylesheet" href="/css/game-layout.css"> 放在各游戏页自己的 style.css 之后、
   /css/site.css 之前；site.css 继续排最后，导航栏和页脚的样式没有被改动，这张表只管 header 之外的正文。
   只有 4 个游戏页引用；首页、about/privacy/terms/contact、blog、404 仍走 css/global.css 的 body 居中。

   注：css/home.css 里也有一条 .container（max-width 1120 + clamp 内边距），只被 index.html 引用，
   和这张表不会同时生效；将来若两张表合并，以这里的 1200 为准。 */

/* 解除 css/global.css 的 body{max-width:1200px;margin:0 auto;padding:0 20px}：
   居中定宽改由下面的 .container 负责，避免 body 和容器各缩一层导致左边对不齐。 */
body {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* 正文唯一的宽度容器：两栏主体和页脚放在它里面，标题左边缘和侧栏右边缘同一条线。
   header 不在里面——2026-11-23 起导航栏是 body 的直接子元素，版心完全由 css/site.css 的 .site-nav 定义，
   这里的 1200 / 24 怎么改都带动不了导航栏（改回 1120 也只影响正文）。 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* css/global.css 给 .site-head 写的 margin-inline:-20px 是为了顶出它 body 的 20px 内边距；
   本页 body 的 max-width 和内边距在上一条规则里已经清成 0，所以这里还原成 0，
   导航的左右留白就只剩 css/site.css .site-nav 的 24px，和上面 .container 的 24px 同一条线。 */
.site-head {
    margin-inline: 0;
}

.page-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 32px;
}

.main-col {
    min-width: 0;           /* 防止宽内容把 1fr 列撑破 */
}

/* 侧栏：More games 与 Latest 两个板块平铺在同一张卡片里，只用页面右侧那根滚动条——卡片自身
   没有 overflow/max-height，因此永远不会出现独立竖向滚动条。
   --head-h = css/site.css 导航静止时的实测高度 58px（14×2 上下内边距 + 30px M 圆标；滚动收紧后只有 42px，
   取大值才能保证任何时候都在头部下方）；--side-gap = 卡片与头部之间的留白；--side-title-h 是标题条高度（供脚本兜底，实际由脚本读 offsetHeight）。
   卡片自己的 top = min(头部高度 + 16, 100vh − 卡片实际高度 − 16)，由 js/sidebar-sticky.js 算好写进 --side-top：
   放得下时取前者，整张卡片固定在头部下方不动；放不下时取后者（是个负值），卡片底边停在视口底部上方 16px，
   内容随页面向上滚，两个标题靠自己的 sticky 叠着固定在头部下方，滚到底后卡片停住。
   圆角只写在外层这一条，板块内部一律不加 overflow:hidden——加了会把 .side-title 的 sticky 裁掉。 */
.sidebar {
    --head-h: 58px;
    --side-gap: 16px;
    --side-title-h: 44px;
    position: sticky;
    top: var(--side-top, calc(var(--head-h) + var(--side-gap)));
    align-self: start;
    min-width: 0;
    background: #F7F5FE;
    border: 1px solid #C9BDF0;
    border-radius: 16px;
}

/* 板块标题条：sticky 的 top 值由 js/sidebar-sticky.js 按顺序写成「头部高度 + 序号 × 标题高」，紧贴头部下沿，
   第 i 个标题正好贴在前面所有标题的下边缘，中间不留缝，所以不需要额外遮挡，内容也不会从缝里露出来；
   底色必须不透明，才盖得住从它背后滚上去的内容。高度只由下面这一条 height 决定，固定前后不变（不用投影、
   不加 padding、不用伪元素撑高，否则吸顶时会看起来突然变厚）。z-index 高于 .side-body（默认 auto）、低于导航的 10。 */
.side-title {
    position: sticky;
    z-index: 2;
    box-sizing: border-box;
    height: var(--side-title-h);
    margin: 0;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #D8CFF7;
    border-bottom: 1px solid #C2B5EE;
    color: #2A2058;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.side-title:focus-visible {
    outline: 2px solid #5B3FD0;
    outline-offset: -2px;
}

/* 向下的小箭头：板块内容还没被标题埋住时不占视线，滚过去之后由脚本加 .is-buried 淡入 */
.side-title .arrow {
    flex: none;
    color: #4A3C8C;
    opacity: 0;
    transition: opacity 0.2s;
}

.side-title.is-buried .arrow {
    opacity: 1;
}

.side-body {
    padding: 6px 18px 12px;
    font-size: 14px;
    line-height: 1.6;        /* 打字页 body 是 line-height:normal，其余三页 1.6：写死行高四页的侧栏才是一样高 */
    color: #2A2058;
}

.side-body a {
    display: block;
    padding: 9px 0;
    color: inherit;
    text-decoration: none;
}

.side-body a:hover {
    color: #5B3FD0;
}

/* Latest 板块（模板 partials/sidebar-latest.html）：一行「标签 + 标题」，最后一行是查看全部 */
.latest-list a {
    display: flex;
    align-items: center;
    gap: 9px;
    border-bottom: 1px solid #DDD6F5;
}

.latest-list a.side-more {
    display: block;
    border-bottom: none;
    margin-top: 4px;
    font-size: 13px;
    color: #5B3FD0;
}

.latest-list a.side-more:hover {
    text-decoration: underline;
}

/* 条目左侧的类型标签：宽 40px 让 Game / Blog 两列对齐（首页 .card .tag 在 css/home.css 里，两张表不会同时加载） */
.tag {
    flex: none;
    width: 40px;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 0;
    border-radius: 6px;
}

.tag-game {
    background: #FBE3B8;
    color: #7A4A00;
}

.tag-blog {
    background: #D3EFD9;
    color: #1D6234;
}

/* 窄屏：单列，侧栏落到主体下方；吸顶、标题叠放、箭头一并取消，脚本在这种情况下不写内联 top，点标题也不做事 */
@media (max-width: 900px) {
    .page-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        position: static;
    }

    .side-title {
        position: static;
        cursor: default;
    }

    .side-title .arrow {
        display: none;
    }
}
