:root {
  --accent: var(--tap-cyan);
  --accent-strong: var(--tap-cyan-strong);
  --accent-soft: var(--tap-cyan-soft);
  --orange: var(--tap-orange);
  --blue: var(--tap-blue);
  --radius: var(--radius-md);
}

body { min-height: 100vh; line-height: 1.5; }
.rank-container { width: min(calc(100% - 40px), 1400px); margin: 0 auto; }
.rank-refresh { margin-left: -12px; }

.rank-intro {
  padding: 38px 0 25px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
}
.rank-intro h1 { margin: 0; font: 760 32px/1.2 var(--display); }
.rank-intro p { max-width: 720px; margin: 9px 0 0; color: var(--text-2); font-size: 13px; }
.rank-freshness { display: grid; justify-items: end; gap: 4px; color: var(--text-3); font-size: 10px; }
.rank-freshness strong { color: var(--text-2); font-size: 12px; }
.rank-freshness small { font-size: 9px; }

.rank-controls {
  position: sticky;
  top: 68px;
  z-index: 20;
  padding: 11px 0;
  display: flex;
  align-items: center;
  gap: 18px;
  border-block: 1px solid var(--line);
  background: var(--surface);
}
.plat-bar { flex: 0 0 auto; display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); }
.plat-btn { min-height: 36px; padding: 7px 14px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); cursor: pointer; font-size: 12px; }
.plat-btn:hover { color: var(--text); }
.plat-btn.active { border-color: var(--line); background: var(--surface); color: var(--text); font-weight: 700; }
.tabs-wrap { min-width: 0; flex: 1; overflow: hidden; }
.tabs { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
.tab { min-height: 42px; flex: 0 0 auto; padding: 8px 11px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-3); cursor: pointer; font-size: 11px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { border-bottom-color: var(--tap-cyan); color: var(--text); font-weight: 700; }

.rank-results { padding-top: 26px; }
.result-head { padding-bottom: 15px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.result-head h2 { margin: 0; font: 740 20px/1.3 var(--display); }
.result-head p { margin: 5px 0 0; color: var(--text-3); font-size: 11px; }
.result-total { color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.search-shell { min-height: 58px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border-block: 1px solid var(--line); }
.search-bar { position: relative; }
.search-bar::before { content: ""; position: absolute; left: 12px; top: 50%; width: 12px; height: 12px; border: 1.5px solid var(--text-3); border-radius: 50%; transform: translateY(-58%); pointer-events: none; }
.search-bar::after { content: ""; position: absolute; left: 22px; top: 31px; width: 6px; height: 1.5px; background: var(--text-3); transform: rotate(45deg); transform-origin: left center; pointer-events: none; }
.search-bar input { width: 100%; min-height: 40px; padding: 9px 12px 9px 34px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: 12px; }
.search-bar input::placeholder { color: var(--text-3); }
.search-count { min-width: 112px; color: var(--text-3); font-size: 11px; text-align: right; }

.game-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 1px solid var(--line); }
.game-card {
  width: 100%;
  min-width: 0;
  min-height: 78px;
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 30px 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.game-card:hover { background: var(--surface-2); }
.game-card .rank { color: var(--text-3); font: 760 16px/1 var(--display); text-align: center; font-variant-numeric: tabular-nums; }
.game-card .rank.top1 { color: #9b6500; }
.game-card .rank.top2 { color: #526064; }
.game-card .rank.top3 { color: #9a4f21; }
.gicon { width: 50px; height: 50px; border-radius: var(--radius-md); background: var(--surface-3); object-fit: cover; }
.image-error { background: var(--surface-3); }
.info { min-width: 0; }
.line1 { min-width: 0; display: flex; align-items: center; gap: 7px; }
.gtitle { overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.ghint { flex: 0 0 auto; color: var(--orange); font-size: 9px; }
.line2 { margin-top: 5px; display: flex; align-items: center; gap: 6px; overflow: hidden; color: var(--text-3); font-size: 9px; white-space: nowrap; }
.gscore { color: var(--text-2); }
.gtag { padding: 2px 5px; border-radius: var(--radius-xs); background: var(--surface-3); }
.gplat { display: inline-flex; }
.gcount { min-width: 76px; text-align: right; }
.gcount-v { display: block; color: var(--accent-strong); font-size: 16px; font-weight: 740; font-variant-numeric: tabular-nums; }
.gcount-l { display: block; margin-top: 2px; color: var(--text-3); font-size: 9px; }

.state-message { grid-column: 1 / -1; padding: 70px 24px; color: var(--text-2); text-align: center; }
.state-message strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 15px; }
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); }
.skeleton::after { content: ""; position: absolute; inset-block: 0; left: -35%; width: 35%; background: rgba(255, 255, 255, .72); animation: rank-skeleton 1.4s infinite; }
.skeleton-toolbar { height: 72px; }
.skeleton-card { height: 86px; border-bottom: 1px solid var(--line); }

.game-modal-bg { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 18px; border: 0; background: transparent; color: var(--text); }
.game-modal-bg:not([open]) { display: none; }
.game-modal-bg[open] { display: grid; place-items: center; }
.game-modal-bg::backdrop { background: rgba(19, 29, 31, .42); }
.game-modal { position: relative; width: min(480px, 100%); max-height: 88vh; overflow: auto; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); transform: translateY(8px); opacity: 0; transition: transform var(--motion-base) ease, opacity var(--motion-base) ease; }
.game-modal-bg.show .game-modal { transform: none; opacity: 1; }
.gm-head { padding: 22px; display: flex; gap: 15px; border-bottom: 1px solid var(--line); }
.gm-icon { width: 72px; height: 72px; border-radius: var(--radius-md); background: var(--surface-3); object-fit: cover; }
.gm-info { min-width: 0; padding-right: 24px; }
.gm-title { font: 740 19px/1.3 var(--display); }
.gm-score { margin-top: 6px; color: var(--orange); font-weight: 700; }
.gm-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.gm-tag { padding: 3px 6px; border-radius: var(--radius-xs); background: var(--surface-3); color: var(--text-2); font-size: 10px; }
.gm-hint { margin-top: 9px; color: var(--orange); font-size: 10px; }
.gm-body { padding: 12px 22px; }
.gm-row { padding: 10px 0; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); font-size: 12px; }
.gm-row span:first-child { color: var(--text-3); }
.gm-row span:last-child { font-weight: 650; text-align: right; }
.gm-link { min-height: 42px; margin: 5px 22px 22px; padding: 10px 12px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--accent-strong); color: #ffffff; font-size: 12px; font-weight: 700; }
.gm-close { position: absolute; top: 13px; right: 13px; z-index: 1; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); cursor: pointer; }
.gm-close:hover { background: var(--surface-2); color: var(--text); }
.rank-footer { margin-top: 42px; padding: 24px 0 34px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 10px; }
.rank-footer a { color: var(--accent-strong); font-weight: 650; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

@keyframes rank-skeleton { to { transform: translateX(390%); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .game-list { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .rank-container { width: min(calc(100% - 24px), 1400px); }
  .rank-intro { padding: 27px 0 20px; grid-template-columns: 1fr; gap: 13px; }
  .rank-intro h1 { font-size: 28px; }
  .rank-freshness { justify-items: start; }
  .rank-controls { position: relative; top: auto; align-items: flex-start; flex-direction: column; gap: 9px; }
  .tabs-wrap { width: 100%; }
  .search-shell { grid-template-columns: 1fr; gap: 7px; padding: 9px 0; }
  .search-count { min-width: 0; padding-left: 2px; text-align: left; }
}

@media (max-width: 520px) {
  .rank-refresh { display: none !important; }
  .rank-intro p { font-size: 12px; line-height: 1.6; }
  .plat-bar { width: 100%; }
  .plat-btn { min-width: 0; }
  .tab { padding: 7px 9px; }
  .game-card { grid-template-columns: 26px 46px minmax(0, 1fr); min-height: 74px; padding: 10px 9px; gap: 9px; }
  .gicon { width: 46px; height: 46px; }
  .gtitle { font-size: 13px; }
  .gcount { grid-column: 3; min-width: 0; display: flex; align-items: baseline; gap: 5px; text-align: left; }
  .gcount-l { margin: 0; }
  .gtag:nth-of-type(n+3), .ghint { display: none; }
  .game-modal-bg { padding: 0; }
  .game-modal { width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
  .rank-footer { align-items: flex-start; flex-direction: column; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
