:root {
  --ink: #0a0a0a;
  --paper: #f5f5f2;
  --white: #fff;
  --line: #d8d8d3;
  --muted: #74746f;
  --soft: #eaeae6;
  --green: #c7ff3d;
  --radius: 20px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .13);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.drawer-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.page-noise {
  position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: .022;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}
.wrap { width: min(1440px, calc(100% - 80px)); margin-inline: auto; }

.topbar {
  position: sticky; top: 0; z-index: 15; height: 82px; padding: 0 40px;
  display: grid; grid-template-columns: 1fr minmax(300px, 520px) 1fr; gap: 32px; align-items: center;
  color: var(--white); background: rgba(10, 10, 10, .96); backdrop-filter: blur(18px);
  border-bottom: 1px solid #292929;
}
.brand { display: inline-flex; align-items: center; gap: 12px; width: max-content; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border: 2px solid var(--green); border-radius: 50%; background: white; box-shadow: 0 0 0 1px rgba(255,255,255,.16), 0 0 18px rgba(199,255,61,.16); }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; animation: avatar-spin 12s linear infinite; }
@keyframes avatar-spin { to { transform: rotate(360deg); } }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; letter-spacing: .13em; }
.brand small { margin-top: 3px; color: #8b8b88; font-size: 10px; letter-spacing: .12em; }
.search-box { height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 10px; border: 1px solid #3d3d3d; border-radius: 999px; background: #171717; transition: border-color .2s, background .2s; }
.search-box:focus-within { border-color: #777; background: #1d1d1d; }
.search-box svg { width: 18px; fill: none; stroke: #aaa; stroke-width: 1.8; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: white; background: transparent; }
.search-box input::placeholder { color: #777; }
.search-box kbd { padding: 2px 7px; color: #777; border: 1px solid #3c3c3c; border-radius: 6px; font-size: 11px; }
.topbar-meta { justify-self: end; color: #9a9a96; font-size: 12px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.mobile-search-button { display: none; }

.hero { min-height: 650px; padding-block: 84px 76px; display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(50px, 8vw, 140px); align-items: center; }
.eyebrow { margin: 0 0 28px; display: flex; gap: 20px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .18em; }
.hero .eyebrow { justify-content: space-between; max-width: 610px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.hero h1 { margin: 0; font-size: clamp(66px, 7.2vw, 116px); line-height: .92; letter-spacing: -.075em; font-weight: 850; }
.hero h1 em { color: transparent; -webkit-text-stroke: 1.7px var(--ink); font-style: normal; }
.hero-intro { max-width: 560px; margin: 36px 0; color: #53534e; font-size: 17px; line-height: 1.85; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.button { min-height: 48px; padding: 0 22px; display: inline-flex; align-items: center; justify-content: center; gap: 28px; border: 1px solid var(--ink); border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 13px; transition: transform .2s, box-shadow .2s, background .2s; }
.button:hover { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(0,0,0,.12); }
.button-dark { color: white; background: var(--ink); }
.button-light { color: var(--ink); background: transparent; }

.hero-panel { position: relative; min-height: 480px; padding: 30px; overflow: hidden; color: white; background: var(--ink); border-radius: 36px; box-shadow: var(--shadow); }
.hero-panel::after { content: ""; position: absolute; inset: auto -8% -30% 15%; height: 65%; transform: skewY(-10deg); background: linear-gradient(110deg, #1c1c1c, #0e0e0e); }
.hero-panel-label { position: relative; z-index: 2; display: flex; justify-content: space-between; color: #777; font-size: 10px; letter-spacing: .22em; }
.hero-total { position: absolute; z-index: 3; left: 34px; bottom: 120px; display: flex; align-items: end; gap: 12px; }
.hero-total strong { font-size: clamp(82px, 9vw, 132px); letter-spacing: -.08em; line-height: .75; }
.hero-total span { color: var(--green); font-size: 10px; line-height: 1.4; letter-spacing: .12em; }
.hero-stats { position: absolute; z-index: 3; left: 34px; right: 34px; bottom: 30px; padding-top: 20px; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid #333; }
.hero-stats div { display: flex; flex-direction: column; gap: 4px; }
.hero-stats strong { font-size: 19px; }
.hero-stats span { color: #777; font-size: 11px; }
.hero-orbit { position: absolute; width: 360px; height: 360px; top: 20px; right: -55px; }
.hero-orbit i { position: absolute; inset: 0; border: 1px solid #323232; border-radius: 50%; animation: orbit 14s linear infinite; }
.hero-orbit i:nth-child(2) { inset: 50px; border-color: #444; animation-direction: reverse; }
.hero-orbit i:nth-child(3) { inset: 110px; background: var(--green); border: 0; box-shadow: 0 0 60px rgba(199,255,61,.18); }
.hero-orbit i:first-child::after { content: ""; position: absolute; width: 12px; height: 12px; top: 43px; left: 43px; border-radius: 50%; background: white; }
@keyframes orbit { to { transform: rotate(360deg); } }

.marquee { overflow: hidden; padding: 15px 0; color: white; background: var(--ink); font-weight: 800; font-size: 11px; letter-spacing: .2em; white-space: nowrap; }
.marquee div { width: max-content; animation: marquee 22s linear infinite; }
@keyframes marquee { to { transform: translateX(-50%); } }

.library { padding-block: 98px 120px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 50px; padding-bottom: 24px; border-bottom: 1px solid var(--ink); }
.section-heading .eyebrow { margin-bottom: 10px; }
.section-heading h2 { margin: 0; font-size: clamp(42px, 5vw, 68px); letter-spacing: -.055em; line-height: 1; }
.section-heading > p { margin: 0; color: var(--muted); font-size: 13px; }
.section-heading > p span { color: var(--ink); font-weight: 800; }
.toolbar { min-height: 50px; margin-bottom: 34px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; }
.filter-panel { min-width: 0; }
.genre-scroller { min-width: 0; max-height: 124px; display: flex; flex-wrap: wrap; gap: 8px; overflow: hidden; transition: max-height .42s cubic-bezier(.2,.8,.2,1); }
.filter-chip { flex: 0 0 auto; min-height: 36px; padding: 6px 7px 6px 14px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; color: #5d5d58; background: rgba(255,255,255,.34); cursor: pointer; font-size: 12px; white-space: nowrap; transition: transform .18s, border-color .18s, color .18s, background .18s; }
.genre-scroller:not(.expanded) .filter-chip.active { order: -1; }
.genre-scroller:not(.expanded) .filter-chip.filter-all { order: -2; }
.filter-chip:hover { border-color: var(--ink); color: var(--ink); }
.filter-chip.active { color: white; border-color: var(--ink); background: var(--ink); }
.filter-chip:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.filter-count { min-width: 23px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 999px; color: #6f6f69; background: var(--soft); font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; }
.filter-chip:hover .filter-count { color: var(--ink); background: #deded9; }
.filter-chip.active .filter-count { color: var(--ink); background: var(--green); }
.tag-toggle { margin-top: 12px; padding: 8px 12px; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 9px; color: #575752; background: var(--soft); cursor: pointer; font-size: 11px; font-weight: 750; transition: color .18s, background .18s; }
.tag-toggle[hidden] { display: none; }
.tag-toggle:hover { color: white; background: var(--ink); }
.tag-toggle i { font-style: normal; transition: transform .3s; }
.tag-toggle.expanded i { transform: rotate(180deg); }
.sort-control { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.sort-control select { padding: 9px 32px 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--white); outline: none; }
.active-query { margin: -12px 0 28px; padding: 10px 14px; width: max-content; max-width: 100%; align-items: center; gap: 18px; color: #555; background: var(--soft); border-radius: 10px; font-size: 12px; }
.active-query:not([hidden]) { display: flex; }
.active-query button { border: 0; color: var(--ink); background: transparent; cursor: pointer; font-weight: 700; }

.game-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 18px; row-gap: 42px; }
.game-card { min-width: 0; outline: none; cursor: pointer; opacity: 0; transform: translateY(14px); animation: card-in .45s ease forwards; }
@keyframes card-in { to { opacity: 1; transform: none; } }
.game-card:focus-visible { box-shadow: 0 0 0 3px var(--green); border-radius: var(--radius); }
.card-cover { position: relative; aspect-ratio: 2.14 / 1; overflow: hidden; border-radius: var(--radius); background: #151515; }
.card-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.42)); opacity: .6; transition: opacity .35s; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .55s cubic-bezier(.2,.7,.2,1), filter .35s; }
.game-card:hover .card-cover img { transform: scale(1.045); }
.game-card:hover .card-cover::after { opacity: 1; }
.card-number { position: absolute; z-index: 2; top: 14px; left: 14px; padding: 5px 8px; color: white; background: rgba(0,0,0,.72); backdrop-filter: blur(8px); border-radius: 7px; font-size: 9px; letter-spacing: .08em; }
.card-arrow { position: absolute; z-index: 2; right: 14px; bottom: 12px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--ink); background: var(--green); border-radius: 50%; font-size: 16px; opacity: 0; transform: translate(7px, 7px) rotate(-15deg); transition: .25s; }
.game-card:hover .card-arrow { opacity: 1; transform: none; }
.card-body { padding: 16px 2px 0; }
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.card-tags span { padding: 4px 8px; color: #5b5b56; background: var(--soft); border-radius: 5px; font-size: 9px; font-weight: 700; }
.card-body h3 { margin: 12px 0 2px; font-size: 19px; line-height: 1.32; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.english-name { height: 17px; margin: 0; color: #999994; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-metrics { margin-top: 14px; padding-top: 12px; display: flex; justify-content: space-between; color: #63635e; border-top: 1px solid var(--line); font-size: 11px; }
.card-metrics span:first-child { color: var(--ink); font-weight: 750; }
.empty-state { padding: 80px 20px; text-align: center; border: 1px dashed #bbb; border-radius: var(--radius); }
.empty-state span { color: #d1d1cd; font-size: 88px; font-weight: 900; letter-spacing: -.08em; }
.empty-state h3 { margin: -10px 0 8px; font-size: 26px; }
.empty-state p { color: var(--muted); }
.empty-state .button { margin-top: 15px; }
.load-more { width: 100%; margin-top: 52px; padding: 19px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: transparent; cursor: pointer; font-weight: 700; transition: .2s; }
.load-more:hover { border-color: var(--ink); background: white; }

.footer { padding-block: 34px 45px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--ink); color: var(--muted); font-size: 11px; }
.footer-brand { color: var(--ink); }
.footer a { color: var(--ink); font-weight: 700; }

.drawer-backdrop { position: fixed; z-index: 29; inset: 0; background: rgba(0,0,0,.42); backdrop-filter: blur(5px); opacity: 0; pointer-events: none; transition: opacity .35s; }
.game-drawer { position: fixed; z-index: 30; top: 0; right: 0; width: min(680px, 100%); height: 100dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--paper); box-shadow: -20px 0 70px rgba(0,0,0,.2); transform: translateX(102%); transition: transform .42s cubic-bezier(.2,.8,.2,1); }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
body.drawer-open .game-drawer { transform: none; }
.drawer-close { position: fixed; z-index: 3; top: 20px; right: 22px; color: white; background: rgba(0,0,0,.72); backdrop-filter: blur(10px); }
.icon-button { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; }
.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.drawer-hero { position: relative; min-height: 330px; padding: 34px; display: flex; align-items: end; overflow: hidden; color: white; background: #111; }
.drawer-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.62); }
.drawer-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.82)); }
.drawer-hero-copy { position: relative; z-index: 1; width: 100%; }
.drawer-index { margin-bottom: 16px; color: var(--green); font-size: 10px; letter-spacing: .17em; font-weight: 700; }
.drawer-hero h2 { max-width: 540px; margin: 0; font-size: clamp(35px, 6vw, 54px); line-height: 1.03; letter-spacing: -.05em; }
.drawer-english { margin: 8px 0 0; color: #c5c5c2; font-size: 13px; }
.drawer-tags { margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; }
.drawer-tags span { padding: 6px 10px; color: #ddd; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; font-size: 10px; }
.drawer-body { padding: 32px 34px 60px; }
.drawer-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 16px; background: white; }
.drawer-stats div { padding: 18px; border-right: 1px solid var(--line); }
.drawer-stats div:last-child { border: 0; }
.drawer-stats strong, .drawer-stats span { display: block; }
.drawer-stats strong { font-size: 19px; }
.drawer-stats span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.replay-heading { margin: 38px 0 18px; display: flex; justify-content: space-between; align-items: end; }
.replay-heading h3 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.replay-heading span { color: var(--muted); font-size: 11px; }
.replay-list { display: grid; gap: 10px; }
.replay-item { padding: 16px; display: grid; grid-template-columns: 74px minmax(0, 1fr) 40px; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: white; transition: transform .2s, border-color .2s, box-shadow .2s; }
.replay-item:hover { transform: translateY(-2px); border-color: #aaa; box-shadow: 0 12px 25px rgba(0,0,0,.06); }
.replay-time { color: var(--ink); font-size: 12px; font-weight: 800; }
.replay-time small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 500; }
.replay-main { min-width: 0; }
.replay-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.replay-main p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.replay-go { width: 36px; height: 36px; display: grid; place-items: center; color: white; background: var(--ink); border-radius: 50%; transition: background .2s, color .2s; }
.replay-item:hover .replay-go { color: var(--ink); background: var(--green); }
.drawer-note { margin-top: 20px; color: var(--muted); font-size: 10px; line-height: 1.6; }

@media (max-width: 1100px) {
  .game-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero { gap: 50px; }
  .topbar { grid-template-columns: 1fr minmax(280px, 430px); }
  .topbar-meta { display: none; }
}
@media (max-width: 780px) {
  .wrap { width: min(100% - 32px, 680px); }
  .topbar { height: 68px; padding: 0 16px; display: flex; justify-content: space-between; }
  .topbar .brand small { display: none; }
  .topbar .search-box { position: fixed; z-index: 50; top: 76px; left: 16px; right: 16px; display: none; box-shadow: var(--shadow); }
  .topbar.searching .search-box { display: flex; }
  .mobile-search-button { display: grid; color: white; background: #1c1c1c; }
  .hero { min-height: auto; padding-block: 60px; grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(58px, 17vw, 88px); }
  .hero-panel { min-height: 390px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 32px; }
  .toolbar { grid-template-columns: 1fr; }
  .genre-scroller { width: 100%; }
  .sort-control { align-self: end; }
  .footer { align-items: start; gap: 28px; flex-direction: column; }
  .footer > p { margin: 0; }
}
@media (max-width: 520px) {
  .hero-panel { min-height: 350px; border-radius: 24px; }
  .hero-orbit { width: 300px; height: 300px; right: -90px; }
  .hero-total { bottom: 110px; }
  .hero-total strong { font-size: 78px; }
  .hero-stats { left: 24px; right: 24px; }
  .library { padding-block: 72px 90px; }
  .section-heading { align-items: start; gap: 12px; flex-direction: column; }
  .game-grid { grid-template-columns: 1fr; }
  .card-body h3 { font-size: 21px; }
  .drawer-hero { min-height: 290px; padding: 24px; }
  .drawer-body { padding: 24px 18px 50px; }
  .drawer-stats div { padding: 14px 10px; }
  .replay-item { grid-template-columns: 64px minmax(0, 1fr) 36px; padding: 13px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
