.game-trade-rank,
.game-rank-marks {
  display: inline-flex;
  min-width: 0;
  align-items: center;
}

.game-rank-marks {
  min-height: 18px;
  gap: 2px;
}

.game-rank-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: none;
  background-image: var(--rank-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 1px 1px rgb(20 29 37 / 28%));
}

.family-silver-star { --rank-image: url("icon/rank-levels/rank-silver-star.png"); }
.family-gold-star { --rank-image: url("icon/rank-levels/rank-gold-star.png"); }
.family-heart { --rank-image: url("icon/rank-levels/rank-heart.png"); }
.family-shield { --rank-image: url("icon/rank-levels/rank-shield.png"); }
.family-crown { --rank-image: url("icon/rank-levels/rank-crown.png"); }

.mini-level.game-trade-rank {
  min-height: 20px;
  padding: 1px 4px;
  margin: 0 4px !important;
  gap: 1px;
  border: 1px solid #dbe4eb;
  border-radius: 3px;
  background: #f8fafc;
  vertical-align: middle;
}

.mini-level.game-trade-rank .game-rank-marks { gap: 1px; }
.mini-level.game-trade-rank .game-rank-icon { width: 15px; height: 15px; }

.shop-level.game-trade-rank {
  display: flex;
  margin: 5px 0 8px;
  align-items: center;
  gap: 7px;
}

.shop-level.game-trade-rank b {
  color: #fff;
  font-size: 12px;
}

.shop-level.game-trade-rank em {
  padding: 2px 5px;
  border: 1px solid #ffffff44;
  border-radius: 3px;
  color: #c9d6e4;
  font-size: 10px;
  font-style: normal;
}

.shop-level.game-trade-rank .game-rank-icon { width: 17px; height: 17px; }

.buyer-level .game-rank-marks {
  padding: 0;
  border: 0;
  background: transparent;
}

.buyer-level [data-rank-guide-role],
.seller-dashboard-rank [data-rank-guide-role] {
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  transition: background-color .16s ease, box-shadow .16s ease;
}

.buyer-level [data-rank-guide-role]:hover,
.buyer-level [data-rank-guide-role]:focus-visible {
  background: rgb(209 167 65 / 12%);
  box-shadow: 0 0 0 3px rgb(209 167 65 / 12%);
}

.seller-dashboard-rank [data-rank-guide-role]:hover,
.seller-dashboard-rank [data-rank-guide-role]:focus-visible {
  background: rgb(255 255 255 / 10%);
  box-shadow: 0 0 0 3px rgb(255 255 255 / 8%);
}

.buyer-level .game-rank-icon { width: 20px; height: 20px; }
.buyer-level b { margin-top: 1px; }

.seller-dashboard-rank {
  display: flex;
  min-width: 0;
  margin-top: 6px;
  align-items: center;
  gap: 5px;
}

.seller-dashboard-rank .game-rank-marks {
  flex: none;
  gap: 1px;
}

.seller-dashboard-rank .game-rank-icon { width: 15px; height: 15px; }

.seller-dashboard-rank b {
  min-width: 0;
  overflow: hidden;
  color: #aebdd0;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-rank-progress {
  display: grid;
  padding: 14px 16px;
  margin: -8px 0 20px;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 13px;
  border-top: 1px solid #e3e9ef;
  border-bottom: 1px solid #e3e9ef;
  background: #f8fafc;
}

.game-rank-current { display: flex; align-items: center; gap: 7px; }
.game-rank-current .game-rank-icon { width: 22px; height: 22px; }
.game-rank-current b,
.game-rank-current small { display: block; }
.game-rank-current b { color: #314559; font-size: 11px; }
.game-rank-current small { margin-top: 3px; color: #8b98a6; font-size: 9px; }
.game-rank-track { height: 6px; overflow: hidden; border-radius: 3px; background: #e3e9ef; }
.game-rank-track i { display: block; height: 100%; border-radius: inherit; background: var(--blue, #2357e8); }
.game-rank-next { color: #7d8b9a; font-size: 9px; text-align: right; }
.game-rank-next b { display: block; margin-bottom: 3px; color: #43566a; font-size: 11px; }

.game-rank-legend {
  display: grid;
  margin: -8px 0 22px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
}

.game-rank-legend > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: #7f8d9c;
  font-size: 9px;
  white-space: nowrap;
}

.game-rank-legend .game-rank-icon { width: 17px; height: 17px; }

body.rank-guide-open { overflow: hidden !important; }

.rank-guide-backdrop {
  position: fixed;
  z-index: 130;
  inset: 0;
  display: grid;
  padding: 18px;
  place-items: center;
  overscroll-behavior: contain;
  touch-action: none;
  background: rgb(9 15 24 / 66%);
  backdrop-filter: blur(3px);
}

.rank-guide-backdrop[hidden] { display: none; }

.rank-guide-dialog {
  display: flex;
  width: min(720px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: hidden;
  flex-direction: column;
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  color: #25374a;
  background: #fff;
  box-shadow: 0 28px 80px rgb(4 12 24 / 30%);
  touch-action: pan-y;
}

.rank-guide-head {
  display: flex;
  min-height: 76px;
  padding: 17px 20px;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e1e7ec;
  background: #101822;
}

.rank-guide-head small,
.rank-guide-head h2 { display: block; margin: 0; letter-spacing: 0; }
.rank-guide-head small { margin-bottom: 4px; color: #d1a741; font-size: 10px; font-weight: 700; }
.rank-guide-head h2 { color: #fff; font-size: 20px; }

.rank-guide-close {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  flex: none;
  place-items: center;
  border: 1px solid #ffffff2b;
  border-radius: 50%;
  color: #fff;
  background: #ffffff0d;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.rank-guide-close:hover,
.rank-guide-close:focus-visible { border-color: #d1a741; color: #d1a741; outline: none; }

.rank-guide-scroll {
  min-height: 0;
  padding: 18px 20px 22px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.rank-guide-summary {
  display: grid;
  padding: 15px 16px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  border: 1px solid #e0e6eb;
  border-radius: 6px;
  background: #f7f9fb;
}

.rank-guide-current-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #e0c77f;
  border-radius: 50%;
  background: #fff9ea;
}

.rank-guide-current-icon .game-rank-marks { max-width: 36px; flex-wrap: wrap; justify-content: center; gap: 0; }
.rank-guide-current-icon .game-rank-icon { width: 16px; height: 16px; }
.rank-guide-current-copy span,
.rank-guide-current-copy strong,
.rank-guide-current-copy small,
.rank-guide-next span,
.rank-guide-next strong { display: block; }
.rank-guide-current-copy span,
.rank-guide-next span { color: #8794a2; font-size: 10px; }
.rank-guide-current-copy strong { margin: 3px 0; color: #243649; font-size: 15px; }
.rank-guide-current-copy small { color: #9a721f; font-size: 11px; font-weight: 700; }
.rank-guide-next { text-align: right; }
.rank-guide-next strong { margin-top: 4px; color: #9a721f; font-size: 15px; }
.rank-guide-summary-track { height: 5px; overflow: hidden; grid-column: 1 / -1; border-radius: 3px; background: #e3e8ed; }
.rank-guide-summary-track i { display: block; height: 100%; border-radius: inherit; background: #d1a741; }

.rank-guide-section { margin-top: 22px; }
.rank-guide-section h3 { margin: 0 0 11px; color: #243649; font-size: 14px; letter-spacing: 0; }
.rank-guide-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rank-guide-section-title span { color: #98a3ae; font-size: 9px; }
.rank-guide-families { overflow: hidden; border: 1px solid #e0e6eb; border-radius: 6px; }
.rank-guide-family { display: grid; min-height: 54px; padding: 9px 11px; grid-template-columns: 145px minmax(0, 1fr); align-items: center; gap: 12px; border-bottom: 1px solid #e9edf1; }
.rank-guide-family:last-child { border-bottom: 0; }
.rank-guide-family.is-current-family { background: #fffbf1; }
.rank-guide-family-name { display: flex; min-width: 0; align-items: center; gap: 8px; }
.rank-guide-family-name .game-rank-icon { width: 21px; height: 21px; }
.rank-guide-family-name b { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.rank-guide-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.rank-guide-level { display: flex; min-width: 0; min-height: 35px; padding: 4px 2px; align-items: center; justify-content: center; flex-direction: column; border: 1px solid #e1e7ec; border-radius: 4px; background: #fff; }
.rank-guide-level b { color: #526477; font-size: 9px; }
.rank-guide-level small { display: flex; min-width: 0; margin-top: 2px; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0 2px; color: #8996a3; font-size: 8px; line-height: 1.12; text-align: center; }
.rank-guide-level small span { min-width: 0; }
.rank-guide-level small i { font-style: normal; }
.rank-guide-level.is-current { border-color: #d1a741; color: #725514; background: #fff5d9; box-shadow: inset 0 0 0 1px #d1a74133; }
.rank-guide-level.is-current b,
.rank-guide-level.is-current small { color: #725514; font-weight: 800; }

.rank-guide-sources { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rank-guide-sources > div { display: flex; min-height: 72px; padding: 10px 11px; align-items: flex-start; justify-content: space-between; flex-direction: column; gap: 4px; border: 1px solid #e0e6eb; border-radius: 5px; background: #fafbfc; }
.rank-guide-sources span { color: #657587; font-size: 10px; line-height: 1.45; }
.rank-guide-sources b { color: #9a721f; font-size: 12px; }
.rank-guide-sources small { color: #98a3ae; font-size: 9px; }
.rank-guide-rules { display: grid; padding: 0; margin: 0; gap: 8px; list-style: none; counter-reset: rank-rule; }
.rank-guide-rules li { position: relative; min-height: 24px; padding-left: 31px; color: #667587; font-size: 10px; line-height: 1.65; counter-increment: rank-rule; }
.rank-guide-rules li::before { position: absolute; top: 0; left: 0; display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: #8a671d; background: #f7edcf; font-size: 9px; font-weight: 800; content: counter(rank-rule); }

@media (max-width: 620px) {
  .game-rank-progress { grid-template-columns: 1fr auto; }
  .game-rank-track { grid-column: 1 / -1; grid-row: 2; }
  .game-rank-legend { grid-template-columns: 1fr 1fr; }
  .game-rank-legend > span:last-child { grid-column: 1 / -1; }
  .rank-guide-backdrop { padding: 10px; align-items: end; }
  .rank-guide-dialog { width: 100%; max-height: calc(100dvh - 20px); border-radius: 8px 8px 0 0; }
  .rank-guide-head { min-height: 68px; padding: 14px 15px; }
  .rank-guide-head h2 { font-size: 17px; }
  .rank-guide-scroll { padding: 14px 14px calc(22px + env(safe-area-inset-bottom)); scrollbar-gutter: auto; }
  .rank-guide-summary { padding: 12px; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
  .rank-guide-current-icon { width: 42px; height: 42px; }
  .rank-guide-next { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; text-align: left; }
  .rank-guide-next strong { margin: 0; }
  .rank-guide-family { padding: 10px; grid-template-columns: 1fr; gap: 8px; }
  .rank-guide-family-name b { font-size: 12px; }
  .rank-guide-levels { gap: 4px; }
  .rank-guide-level { min-height: 38px; }
  .rank-guide-level small { font-size: 7px; }
  .rank-guide-sources { grid-template-columns: 1fr; }
  .rank-guide-sources > div { min-height: 0; align-items: center; flex-direction: row; }
}
