:root { --ink: #343e34; --muted: #777765; --paper: #f7efdc; --cream: #fffbef; --green: #385b45; --line: #d5cbb4; --gold: #ffdb70; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background-image: radial-gradient(#ad947230 .6px, transparent .6px); background-size: 6px 6px; z-index: -1; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
a:focus-visible, summary:focus-visible { outline: 3px solid #537a61; outline-offset: 5px; }
[hidden] { display: none !important; }
.library { width: min(100% - 64px, 1040px); margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom)); }
.library-nav { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.back { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; }
.back:hover { color: var(--green); text-decoration: underline; text-underline-offset: 5px; }
.nav-brand { display: inline-flex; align-items: center; gap: 9px; font-size: 12px; color: #686c59; }
.nav-brand img { border: 1px solid #c2b49b; border-radius: 50%; }
.library-heading { display: flex; align-items: flex-end; justify-content: space-between; margin: 34px 0 26px; gap: 12px; }
.eyebrow { margin: 0 0 8px; color: #7c8268; font: 11px Georgia, serif; letter-spacing: 3px; }
h1 { margin: 0; font-size: clamp(26px, 4vw, 38px); line-height: 1.35; letter-spacing: -1px; }
.heading-star { display: inline-block; margin-left: 12px; color: #b18b41; font-size: 23px; vertical-align: middle; }
.game-count { padding-bottom: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.featured-game { display: grid; grid-template-columns: 1.08fr 1fr; border: 2px solid var(--ink); background: var(--cream); box-shadow: 6px 6px 0 #c7bfa8; }
.game-art { position: relative; min-height: 376px; overflow: hidden; background: #c5d6b9; background-image: linear-gradient(#edf4dc40 1px, transparent 1px), linear-gradient(90deg, #edf4dc40 1px, transparent 1px); background-size: 30px 30px; border-right: 2px solid var(--ink); }
.edition { position: absolute; left: 22px; top: 22px; z-index: 2; padding: 6px 8px; background: #f7efdc; border: 1px solid #7c8f71; font: 11px Georgia, serif; letter-spacing: 2px; }
.art-floor { position: absolute; inset: 78% 0 0; border-top: 2px solid #a8b794; background: repeating-conic-gradient(#dae1bf 0% 25%, #e7eacb 0% 50%) 50% / 40px 40px; }
.avatar-shadow { position: absolute; width: 85px; height: 13px; bottom: 47px; left: 50%; transform: translateX(-50%); border-radius: 50%; background: #596c5136; }
.art-character { position: absolute; width: 296px; height: 296px; object-fit: contain; bottom: 43px; left: 50%; transform: translateX(-50%); image-rendering: pixelated; }
.art-gift { position: absolute; display: grid; justify-items: center; z-index: 2; }
.art-gift img { display: block; width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(3px 4px 0 #53694828); }
.art-gift span:not(:empty) { font: bold 12px Georgia, serif; background: var(--cream); border: 1px solid #9aa783; padding: 3px 8px; margin-top: 4px; }
.gift-lamp { left: 12%; top: 26%; transform: rotate(-9deg); }
.gift-carnival { right: 12%; top: 14%; transform: rotate(8deg); }
.gift-carnival img { width: 76px; height: 76px; }
.gift-box { left: 14%; bottom: 14%; transform: rotate(-10deg); }
.gift-box img { width: 46px; height: 46px; }
.art-spark { position: absolute; color: #f7f2da; font-size: 33px; }
.spark-one { right: 13%; bottom: 26%; }.spark-two { left: 43%; top: 9%; font: 27px Georgia, serif; }
.art-caption { position: absolute; bottom: 17px; left: 0; right: 0; text-align: center; font: 10px Georgia, serif; letter-spacing: 4px; color: #768163; }
.game-info { padding: 34px 36px 26px; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.game-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.game-tags span { border: 1px solid #cbd4ba; padding: 4px 8px; font-size: 11px; background: #f0f2e3; color: #627653; }
h2 { margin: 20px 0 9px; font-size: clamp(28px, 3vw, 36px); letter-spacing: -1px; }
.game-description { margin: 0; color: var(--muted); font-size: 13px; }
.personal-record { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 24px 0; padding-top: 19px; border-top: 1px dashed var(--line); }
.record-label { font-size: 11px; color: var(--muted); }
.record-number { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 0; }
.record-number strong { font-size: 32px; font-variant-numeric: tabular-nums; line-height: 1.25; overflow-wrap: anywhere; }
.record-number span { font-size: 12px; color: var(--muted); }
.last-record { display: grid; gap: 8px; text-align: right; flex-shrink: 0; }
.last-record strong { font-size: 13px; font-weight: 500; }
.play-button { min-height: 49px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); background: var(--gold); font-size: 16px; font-weight: 700; transition: background .15s; }
.play-button:hover { background: #ffe79e; }.play-button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.record-note { margin: 12px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.game-controls { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 15px; flex-wrap: wrap; padding: 16px 24px; border-top: 2px solid var(--ink); background: #f3efdf; }
.game-controls span { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: #737561; }.game-controls b { color: #5e7558; font-size: 16px; }
.gift-guide { margin-top: 27px; border: 1px solid var(--line); background: #fffbef90; }
.gift-guide summary { min-height: 57px; padding: 16px 22px; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; font-size: 13px; gap: 12px; }
.gift-guide summary::-webkit-details-marker { display: none; }.guide-subtitle { margin-left: 16px; color: var(--muted); font-size: 11px; }.expand-icon { font-size: 22px; line-height: 1; }.gift-guide[open] .expand-icon { transform: rotate(45deg); }
.guide-body { padding: 0 22px 20px; }.gift-list { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; }
.gift-list li { min-width: 0; display: grid; justify-items: center; gap: 6px; text-align: center; padding: 14px 5px; background: #f4efdc; border: 1px solid #e3dac2; font-size: 11px; }.gift-list img { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; }.gift-list strong { color: var(--green); font-size: 15px; }.gift-list small { color: var(--muted); font-size: 10px; }.gift-list li.is-rare { background: #f9edc9; border-color: #d6bc76; }
.guide-note { font-size: 11px; color: var(--muted); line-height: 1.8; margin: 15px 0; }.hazards { display: flex; gap: 12px 25px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 10px; }.hazards span { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: #7e6658; }
.library-footer { display: flex; justify-content: space-between; gap: 12px; padding-top: 27px; color: #858674; font-size: 10px; }
@media (max-width: 760px) {
  .library { width: calc(100% - 36px); padding-top: 12px; }.library-heading { margin-top: 25px; }.featured-game { grid-template-columns: 1fr; }.game-art { min-height: 250px; border-right: 0; border-bottom: 2px solid var(--ink); }.art-character { width: 224px; height: 224px; bottom: 16px; }.avatar-shadow { bottom: 20px; width: 68px; height: 9px; }.art-caption { bottom: 6px; font-size: 8px; }.edition { top: 15px; left: 15px; }.gift-lamp { top: 24%; left: 15%; }.gift-carnival { right: 14%; top: 10%; }.gift-box { bottom: 11%; }.art-gift img { width: 49px; height: 49px; }.gift-carnival img { width: 63px; height: 63px; }.gift-box img { width: 39px; height: 39px; }.game-info { padding: 23px 24px; }.game-info h2 { margin-top: 14px; }.personal-record { margin: 18px 0; padding-top: 14px; }.game-controls { padding: 12px 20px; gap: 6px 16px; }.gift-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }.nav-brand { font-size: 11px; }.library-nav { padding-bottom: 10px; }
}
@media (max-width: 400px) {
  .game-art { min-height: 212px; }.art-character { width: 195px; height: 195px; bottom: 12px; }.art-gift img { width: 44px; height: 44px; }.gift-carnival img { width: 56px; height: 56px; }.gift-box img { width: 34px; height: 34px; }.gift-lamp { left: 10%; }.gift-carnival { right: 9%; }.game-info { padding: 20px; }.guide-body { padding: 0 12px 16px; }.gift-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }.guide-subtitle { margin-left: 8px; }.game-count { font-size: 10px; }.heading-star { margin-left: 7px; font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { .play-button { transition: none; } }

.game-title { display: flex; align-items: center; gap: 12px; }
.game-icon { flex: 0 0 auto; object-fit: contain; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid #537a61; outline-offset: 3px; }
button:disabled { opacity: .55; cursor: wait; }
.leaderboard-button { display: flex; justify-content: space-between; align-items: center; min-height: 44px; margin-top: 12px; padding: 10px 17px; border: 1px solid #8b9b7f; background: #e8eedc; font-size: 14px; }
.leaderboard-button:hover { background: #dbe6cc; }
body:has(.leaderboard-dialog[open]) { overflow: hidden; }
.leaderboard-dialog { width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 40px); padding: 0; color: var(--ink); background: var(--cream); border: 2px solid var(--ink); box-shadow: 6px 6px 0 #222b2466; }
.leaderboard-dialog[open] { display: flex; flex-direction: column; }
.leaderboard-dialog::backdrop { background: #242d2966; }
.leaderboard-header { display: flex; align-items: center; gap: 12px; padding: 20px; border-bottom: 1px solid var(--line); }
.leaderboard-header div { min-width: 0; flex: 1; }
.leaderboard-header small { font-size: 11px; color: var(--muted); }
.leaderboard-header h2 { margin: 3px 0 0; font-size: 22px; letter-spacing: 0; overflow-wrap: anywhere; }
.close-button { width: 40px; height: 40px; flex-shrink: 0; border: 1px solid var(--line); background: var(--paper); font-size: 25px; }
.leaderboard-me { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 16px 20px 0; padding: 14px; border-left: 4px solid var(--green); background: #e8eedc; }
.leaderboard-me > span:first-child { grid-column: 1 / -1; font-size: 12px; color: var(--green); }
.leaderboard-me strong { font-size: 23px; font-variant-numeric: tabular-nums; }
.leaderboard-me > span:last-child { align-self: center; font-size: 13px; }
.leaderboard-status { min-height: 18px; margin: 12px 20px 8px; color: var(--muted); font-size: 12px; }
.leaderboard-scroll { overflow: auto; min-height: 70px; padding: 0 20px; }
.leaderboard-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; font-variant-numeric: tabular-nums; }
.leaderboard-table th { position: sticky; top: 0; background: var(--cream); text-align: left; font-size: 11px; color: var(--muted); font-weight: 400; }
.leaderboard-table th, .leaderboard-table td { padding: 12px 6px; border-bottom: 1px solid #e6dfcc; }
.leaderboard-table th:first-child { width: 58px; }.leaderboard-table th:last-child { width: 90px; }
.leaderboard-table td:nth-child(2) { overflow-wrap: anywhere; }.leaderboard-table td:last-child, .leaderboard-table th:last-child { text-align: right; }
.leaderboard-table .is-me { background: #eef2e2; }.leaderboard-table td small { display: inline-block; margin-left: 6px; padding: 1px 4px; background: var(--green); color: white; font-size: 10px; }
.leaderboard-footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; gap: 8px; }
.leaderboard-footer small { color: var(--muted); font-size: 11px; }.leaderboard-footer button { min-height: 40px; border: 1px solid #8b9b7f; background: #e8eedc; padding: 8px 12px; font-size: 12px; }
@media (max-width: 400px) { .game-title { gap: 8px; }.game-title .game-icon { width: 36px; height: 36px; }.game-title span { font-size: 27px; }.leaderboard-header { padding: 14px; }.leaderboard-header h2 { font-size: 19px; } }
