/* =======================================================
   游戏大厅 · WZA ARCADE
   参考 Poki 风格：亮色背景、扁平彩色卡片、大圆角、少解释
   ======================================================= */

body.games-page {
    --arcade-purple: #2f6bff;
    --arcade-purple-dark: #1e4ed8;
    --arcade-yellow: #ffd84d;
    --arcade-pink: #ff5f9e;
    --arcade-bg: #f5f5fa;
    --arcade-card: #ffffff;
    --arcade-ink: #1f1d2b;
    --arcade-muted: #777386;
    --arcade-border: #e8e6ef;
    background: var(--arcade-bg);
    color: var(--arcade-ink);
    font-family: "Trebuchet MS", "Microsoft YaHei", "PingFang SC", sans-serif;
}

body.theme-dark.games-page {
    --arcade-bg: #111019;
    --arcade-card: #1c1a27;
    --arcade-ink: #f6f3ff;
    --arcade-muted: #a8a3b9;
    --arcade-border: #302d40;
}

.games-page .container {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
}

/* ---------- Hero ---------- */
.games-hero {
    padding: 120px 0 12px;
}

.games-hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 296px;
    align-items: center;
    gap: 36px;
    overflow: hidden;
    padding: 38px;
    color: var(--arcade-ink);
    background: linear-gradient(132deg, #ffe56a 0%, #ffd54b 58%, #ffc83d 100%);
    border-radius: 30px;
    box-shadow: 0 18px 45px rgba(154, 115, 20, 0.16);
}

.games-hero-inner::before,
.games-hero-inner::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.games-hero-inner::before {
    width: 280px;
    height: 280px;
    right: 18%;
    bottom: -220px;
    background: rgba(255, 255, 255, 0.20);
}

.games-hero-inner::after {
    width: 190px;
    height: 190px;
    top: -130px;
    left: 44%;
    background: rgba(255, 95, 158, 0.13);
}

.games-hero-copy {
    position: relative;
    z-index: 1;
}

.games-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    color: #51451e;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(81, 69, 30, 0.18);
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.12em;
}

.games-hero h1 {
    margin: 15px 0 0;
    color: var(--arcade-ink);
    font-size: clamp(2.35rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.03;
    letter-spacing: -0.055em;
}

.games-hero h1 span {
    color: var(--arcade-purple);
}

.games-lead {
    max-width: 470px;
    margin: 14px 0 0;
    color: #655a37;
    font-size: 0.9rem;
    line-height: 1.7;
}

.games-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 23px;
}

.games-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 43px;
    padding: 0 17px;
    color: #fff;
    background: var(--arcade-ink);
    border-radius: 11px;
    box-shadow: 0 5px 0 rgba(63, 53, 24, 0.2);
    font-size: 0.8rem;
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.games-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 rgba(63, 53, 24, 0.16);
}

.games-cta i { font-size: 0.72rem; }
.games-hero-note { color: #75683f; font-size: 0.64rem; font-weight: 600; }

/* featured game card */
.games-featured {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 10px;
    align-items: center;
    padding: 13px;
    color: var(--arcade-ink);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 14px 0 rgba(50, 36, 120, 0.14);
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.games-featured:hover {
    transform: translateY(-4px) rotate(-1deg);
    box-shadow: 0 18px 0 rgba(50, 36, 120, 0.12);
}

.games-featured-tag {
    grid-column: 1 / -1;
    width: fit-content;
    padding: 3px 7px;
    color: var(--arcade-purple);
    background: #eaf1ff;
    border-radius: 5px;
    font-size: 0.52rem;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.games-featured-art {
    display: grid;
    place-items: center;
    width: 100%;
    height: 120px;
    grid-column: 1 / -1;
    margin-top: 3px;
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.8), transparent 20%),
        linear-gradient(145deg, #b9f3d1, #72d5aa);
    border-radius: 13px;
    font-size: 4.2rem;
    line-height: 1;
}

.games-featured-copy h2 {
    margin: 8px 0 1px;
    color: #1f1d2b;
    font-size: 1.08rem;
    letter-spacing: -0.03em;
}

.games-featured-copy p {
    margin: 0;
    color: #777386;
    font-size: 0.65rem;
}

.games-featured-play {
    display: grid;
    place-items: center;
    width: 35px;
    height: 35px;
    color: #fff;
    background: var(--arcade-purple);
    border-radius: 50%;
    font-size: 0.68rem;
}

/* ---------- Library ---------- */
.games-library {
    padding: 34px 0 66px;
}

.games-library-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.games-kicker {
    margin: 0 0 4px;
    color: var(--arcade-purple);
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.13em;
}

.games-library h2 {
    margin: 0;
    color: var(--arcade-ink);
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.045em;
}

.games-count {
    padding: 6px 9px;
    color: var(--arcade-muted);
    background: var(--arcade-card);
    border: 1px solid var(--arcade-border);
    border-radius: 7px;
    font-size: 0.62rem;
    font-weight: 700;
    white-space: nowrap;
}

.games-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.games-search {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(300px, 100%);
    min-height: 40px;
    padding: 0 12px;
    background: var(--arcade-card);
    border: 1px solid var(--arcade-border);
    border-radius: 10px;
    box-shadow: 0 3px 0 rgba(31, 29, 43, 0.03);
}

.games-search:focus-within {
    border-color: var(--arcade-purple);
    box-shadow: 0 0 0 3px rgba(47, 107, 255, 0.12);
}

.games-search > i { color: var(--arcade-muted); font-size: 0.75rem; }
.games-search input {
    flex: 1;
    min-width: 0;
    padding: 8px 0;
    color: var(--arcade-ink);
    background: transparent;
    border: 0;
    outline: 0;
    font: inherit;
    font-size: 0.7rem;
}
.games-search input::placeholder { color: var(--arcade-muted); }

.games-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.games-chip {
    min-height: 34px;
    padding: 0 12px;
    color: var(--arcade-muted);
    background: var(--arcade-card);
    border: 1px solid var(--arcade-border);
    border-radius: 9px;
    cursor: pointer;
    font: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.games-chip:hover { color: var(--arcade-purple); border-color: var(--arcade-purple); }
.games-chip.is-active { color: #fff; background: var(--arcade-purple); border-color: var(--arcade-purple); }

/* ---------- Game cards ---------- */
.games-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    scroll-margin-top: 110px;
}

.game-card {
    display: block;
    padding: 7px;
    color: inherit;
    background: var(--arcade-card);
    border: 1px solid var(--arcade-border);
    border-radius: 16px;
    box-shadow: 0 3px 0 rgba(31, 29, 43, 0.035);
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.game-card:hover {
    transform: translateY(-4px);
    border-color: rgba(47, 107, 255, 0.28);
    box-shadow: 0 13px 25px rgba(31, 29, 43, 0.11);
}

.game-card[hidden] { display: none; }

.game-thumb {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 11px;
    isolation: isolate;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.game-thumb::before {
    content: "";
    position: absolute;
    z-index: 0;
    width: 62%;
    aspect-ratio: 1;
    top: -32%;
    right: -12%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.game-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.25) 1px, transparent 1px);
    background-size: 15px 15px;
    opacity: 0.38;
}

.game-thumb--puzzle {
    background:
        radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.32), transparent 23%),
        radial-gradient(circle at 84% 88%, rgba(255, 216, 77, 0.34), transparent 33%),
        linear-gradient(140deg, #3679ff 0%, #2459e5 48%, #1839b6 100%);
}

.game-thumb--casual {
    background:
        radial-gradient(circle at 85% 12%, rgba(255, 238, 123, 0.65), transparent 25%),
        radial-gradient(circle at 12% 90%, rgba(79, 122, 58, 0.32), transparent 38%),
        linear-gradient(140deg, #46dca2 0%, #14b8a8 52%, #0787c4 100%);
}

.game-thumb--lab {
    background:
        radial-gradient(circle at 16% 16%, rgba(255, 255, 255, 0.34), transparent 24%),
        radial-gradient(circle at 86% 86%, rgba(255, 77, 128, 0.45), transparent 35%),
        linear-gradient(140deg, #ffb83d 0%, #ff8059 52%, #ef4f87 100%);
}

/* 卡片内的迷你游戏画面 */
.game-scene {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    pointer-events: none;
}

/* Emoji 消消乐：2×2 糖果格 */
.game-scene--match {
    --match-tile: clamp(42px, 5.1vw, 57px);
    grid-template-columns: repeat(2, var(--match-tile));
    grid-template-rows: repeat(2, var(--match-tile));
    gap: 7px;
    transform: rotate(-4deg);
}

.match-tile {
    display: grid;
    place-items: center;
    width: var(--match-tile);
    height: var(--match-tile);
    background: rgba(255, 255, 255, 0.94);
    border: 2px solid rgba(255, 255, 255, 0.78);
    border-radius: 13px;
    box-shadow: 0 7px 13px rgba(7, 25, 89, 0.22);
    font-size: calc(var(--match-tile) * 0.49);
    transition: transform 0.2s ease;
}

.match-tile--2 { transform: translateY(-5px) rotate(3deg); }
.match-tile--3 { transform: translateY(3px) rotate(-3deg); }
.match-tile--4 { transform: translateY(-2px) rotate(2deg); }

.scene-spark {
    position: absolute;
    z-index: 2;
    color: #ffe27a;
    font-size: 1rem;
    line-height: 1;
    text-shadow: 0 2px 5px rgba(31, 39, 100, 0.3);
}
.scene-spark--1 { top: 17%; left: 22%; transform: rotate(-12deg); }
.scene-spark--2 { right: 20%; bottom: 18%; color: #fff3af; font-size: 0.72rem; }

/* 植物杀手：一块小菜地 */
.game-scene--garden {
    --garden-cell: clamp(29px, 3.7vw, 40px);
}

.garden-plot {
    display: grid;
    grid-template-columns: repeat(3, var(--garden-cell));
    gap: 4px;
    padding: 8px;
    background: linear-gradient(145deg, #986544, #66422d);
    border: 2px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    box-shadow: 0 10px 18px rgba(9, 65, 66, 0.23);
    transform: rotate(-2deg);
}

.garden-cell {
    display: grid;
    place-items: center;
    width: var(--garden-cell);
    height: var(--garden-cell);
    background: linear-gradient(145deg, #87583c, #744730);
    border: 1px solid rgba(255, 226, 174, 0.17);
    border-radius: 6px;
    box-shadow: inset 0 -2px 0 rgba(45, 25, 17, 0.18);
    font-size: calc(var(--garden-cell) * 0.57);
}

.garden-sun {
    position: absolute;
    top: 14%;
    left: 16%;
    font-size: 1.7rem;
    filter: drop-shadow(0 3px 5px rgba(74, 56, 12, 0.18));
}

.garden-water {
    position: absolute;
    top: 17%;
    right: 16%;
    font-size: 1.25rem;
    transform: rotate(13deg);
    filter: drop-shadow(0 3px 4px rgba(8, 70, 81, 0.18));
}

/* 水果合成：一小堆水果 */
.game-scene--fruit {
    position: absolute;
}

.fruit-ball {
    position: absolute;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.93);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 7px 14px rgba(111, 33, 41, 0.2);
    line-height: 1;
    transition: transform 0.2s ease;
}

.fruit-ball--1 {
    top: 18%;
    left: 18%;
    width: 52px;
    height: 52px;
    font-size: 1.55rem;
    transform: rotate(-8deg);
}

.fruit-ball--2 {
    top: 19%;
    right: 17%;
    width: 44px;
    height: 44px;
    font-size: 1.18rem;
    transform: rotate(9deg);
}

.fruit-ball--3 {
    bottom: 18%;
    left: 22%;
    width: 43px;
    height: 43px;
    font-size: 1.16rem;
    transform: rotate(-5deg);
}

.fruit-ball--4 {
    bottom: 12%;
    left: 50%;
    z-index: 2;
    width: clamp(72px, 9vw, 94px);
    height: clamp(72px, 9vw, 94px);
    font-size: clamp(2.6rem, 3.8vw, 3.4rem);
    transform: translateX(-50%) rotate(3deg);
}

.fruit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(75%, 170px);
    aspect-ratio: 1;
    border: 2px dashed rgba(255, 255, 255, 0.42);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.game-card:hover .match-tile--1 { transform: translate(-2px, -2px) rotate(-4deg); }
.game-card:hover .match-tile--2 { transform: translate(2px, -7px) rotate(5deg); }
.game-card:hover .match-tile--3 { transform: translate(-2px, 5px) rotate(-5deg); }
.game-card:hover .match-tile--4 { transform: translate(3px, -4px) rotate(4deg); }
.game-card:hover .fruit-ball--1 { transform: translate(-3px, -3px) rotate(-12deg); }
.game-card:hover .fruit-ball--2 { transform: translate(3px, -2px) rotate(13deg); }
.game-card:hover .fruit-ball--3 { transform: translate(-2px, 2px) rotate(-8deg); }
.game-card:hover .fruit-ball--4 { transform: translateX(-50%) translateY(-5px) rotate(7deg); }

.game-status {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    padding: 4px 7px;
    color: #fff;
    background: rgba(20, 16, 35, 0.5);
    border-radius: 5px;
    font-size: 0.48rem;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.game-status--live { color: var(--arcade-purple-dark); background: #fff; }

.game-play {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    background: rgba(25, 18, 46, 0.16);
    opacity: 0;
    transition: opacity 0.16s ease;
}

.game-play i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding-left: 3px;
    color: var(--arcade-purple);
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 7px 16px rgba(20, 12, 35, 0.2);
    font-size: 0.82rem;
}

.game-card--live:hover .game-play,
.game-card--live:focus-visible .game-play { opacity: 1; }

.game-info { padding: 9px 5px 4px; }
.game-info h3 { margin: 0 0 2px; color: var(--arcade-ink); font-size: 0.82rem; font-weight: 800; }
.game-info p { margin: 0; color: var(--arcade-muted); font-size: 0.62rem; }

.game-new {
    display: inline-block;
    margin-left: 3px;
    padding: 2px 5px;
    color: #fff;
    background: var(--arcade-pink);
    border-radius: 4px;
    font-size: 0.45rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    vertical-align: 2px;
}

.games-empty {
    max-width: 480px;
    margin: 26px auto 0;
    padding: 26px 18px;
    text-align: center;
    background: var(--arcade-card);
    border: 1px dashed var(--arcade-border);
    border-radius: 16px;
}
.games-empty[hidden] { display: none; }
.games-empty-icon { display: block; margin-bottom: 6px; font-size: 2rem; }
.games-empty h3 { margin: 0 0 4px; color: var(--arcade-ink); font-size: 0.95rem; }
.games-empty p { margin: 0; color: var(--arcade-muted); font-size: 0.7rem; }

.games-note { margin: 18px 0 0; color: var(--arcade-muted); font-size: 0.65rem; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .games-hero-inner { grid-template-columns: minmax(0, 1fr) 250px; gap: 22px; padding: 28px; }
    .games-featured-art { height: 96px; font-size: 3.4rem; }
    .games-library { padding-top: 27px; }
}

@media (max-width: 760px) {
    .games-hero { padding-top: 105px; }
    .games-hero-inner { grid-template-columns: 1fr; gap: 23px; padding: 25px 22px; border-radius: 23px; }
    .games-hero h1 { font-size: clamp(2.1rem, 8vw, 3rem); }
    .games-lead { font-size: 0.82rem; }
    .games-featured { grid-template-columns: 86px 1fr auto; gap: 10px; align-items: center; }
    .games-featured-tag { grid-column: 1 / -1; }
    .games-featured-art { grid-column: auto; width: 86px; height: 86px; margin: 0; font-size: 3rem; }
    .games-featured-copy h2 { margin-top: 0; }
    .games-library-head { align-items: flex-start; flex-direction: column; gap: 8px; }
    .games-toolbar { align-items: stretch; flex-direction: column; gap: 9px; }
    .games-search { width: 100%; }
    .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
}

@media (max-width: 560px) {
    .games-page .container { width: calc(100% - 24px); }
    .games-hero { padding-top: 98px; }
    .games-hero-inner { padding: 22px 18px; border-radius: 20px; }
    .games-hero-actions { margin-top: 18px; }
    .games-hero-note { display: none; }
    .games-cta { width: 100%; justify-content: center; }
    .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; scroll-margin-top: 90px; }
    .game-card { padding: 5px; border-radius: 13px; }
    .game-thumb { border-radius: 9px; }
    .match-tile { border-radius: 10px; }
    .game-status { top: 5px; right: 5px; padding: 3px 5px; font-size: 0.42rem; }
    .game-info { padding: 7px 4px 3px; }
    .game-info h3 { font-size: 0.7rem; }
    .game-info p { font-size: 0.56rem; }
    .game-play i { width: 36px; height: 36px; }
    .games-chip { min-height: 32px; padding: 0 10px; font-size: 0.62rem; }
    .games-library h2 { font-size: 1.4rem; }
    .games-library { padding-bottom: 48px; }
}

@media (max-width: 370px) {
    .games-grid { grid-template-columns: 1fr; }
}

/* 五大赛道 3D 赛车 */
.game-thumb--racing {
    background:
        radial-gradient(circle at 78% 18%, rgba(255, 195, 105, 0.78), transparent 22%),
        radial-gradient(circle at 18% 84%, rgba(69, 212, 222, 0.36), transparent 38%),
        linear-gradient(145deg, #1a4e63 0%, #10273c 48%, #070d16 100%);
}
.game-scene--racing { overflow: hidden; }
.race-mini-sun {
    position: absolute;
    top: 16%;
    right: 17%;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe5a0 0%, #ffb666 45%, rgba(255, 151, 84, 0) 72%);
    filter: blur(0.4px);
}
.race-mini-road {
    position: absolute;
    left: -12%;
    right: -12%;
    bottom: -10%;
    height: 48%;
    background:
        linear-gradient(90deg, transparent 47%, rgba(255, 236, 179, 0.82) 48%, rgba(255, 236, 179, 0.82) 52%, transparent 53%) center / 100% 7px no-repeat,
        linear-gradient(170deg, transparent 35%, #20262a 36%, #20262a 100%);
    transform: perspective(120px) rotateX(34deg);
    opacity: 0.85;
}
.race-mini-car {
    position: relative;
    z-index: 2;
    margin-top: 35px;
    font-size: clamp(2.4rem, 4.4vw, 3.7rem);
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.48));
    transform: rotate(-8deg);
    transition: transform 0.22s ease;
}
.race-mini-label {
    position: absolute;
    top: 14px;
    left: 15px;
    color: rgba(194, 255, 255, 0.86);
    font-family: Consolas, monospace;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.16em;
}
.game-card:hover .race-mini-car { transform: translate(7px, -7px) rotate(-3deg) scale(1.06); }
