.aiMatchHistorySummary {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(25, 118, 210, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.aiMatchHistoryStats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.aiMatchDifficultyRates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.aiMatchDifficultyRate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid rgba(25, 118, 210, 0.12);
  background: rgba(235, 248, 255, 0.88);
  color: #23506f;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.aiMatchRecentList {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  max-height: 240px;
  overflow: auto;
  padding-right: 2px;
}

.aiMatchRecentRow {
  display: grid;
  grid-template-columns: minmax(64px, 0.85fr) minmax(74px, 0.9fr) minmax(92px, 1fr) minmax(90px, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(18, 83, 145, 0.08);
  color: #223848;
  font-size: 12px;
  font-weight: 800;
}

.aiMatchRecentResult {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-height: 24px;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
}

.aiMatchRecentResult.win { background: #16845d; }
.aiMatchRecentResult.loss { background: #c8485d; }
.aiMatchRecentResult.draw { background: #64748b; }

.aiMatchRecentMeta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aiMatchHistoryEmpty {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  color: #587083;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

body.dark-mode .aiMatchHistorySummary,
body.ghost-mode-lock .aiMatchHistorySummary {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.58);
}

body.dark-mode .aiMatchDifficultyRate,
body.ghost-mode-lock .aiMatchDifficultyRate {
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.88);
  color: #e5f0ff;
}

body.dark-mode .aiMatchRecentRow,
body.ghost-mode-lock .aiMatchRecentRow,
body.dark-mode .aiMatchHistoryEmpty,
body.ghost-mode-lock .aiMatchHistoryEmpty {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.72);
  color: #edf5ff;
}

@media (max-width: 720px) {
  .aiMatchHistoryStats,
  .aiMatchRecentRow {
    grid-template-columns: 1fr;
  }

  .aiMatchRecentRow {
    gap: 5px;
  }
}

#matchSelectWrap > .localMatchSplitCard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  grid-column: 1 / -1;
  min-width: 0;
}

#lobby .lobbyCard #matchSelectWrap > .localMatchSplitCard {
  width: 100%;
}

#lobby .lobbyCard #matchSelectWrap .localMatchSplitCard .matchButton {
  min-height: 72px !important;
}

#lobby .lobbyCard #matchSelectWrap .localMatchSplitCard .matchButton strong {
  font-size: 18px;
}

.aiRecordPopup {
  width: min(760px, calc(100vw - 28px));
}

.aiRankingPanel {
  gap: 12px;
}

.aiRankingMine {
  border: 2px solid rgba(37, 99, 235, 0.28);
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(255, 255, 255, 0.88)),
    radial-gradient(circle at 16% 20%, rgba(59, 130, 246, 0.18), transparent 36%);
}

.aiRankingMineIcon {
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  color: #fff;
}

.aiRankingMineMain strong {
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.aiRankingMineBest span {
  font-size: 15px;
}

.aiLevelPanel {
  position: relative;
  display: grid;
  gap: 11px;
  overflow: hidden;
  padding: 15px 16px 14px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 92% 8%, rgba(255, 209, 102, 0.34), transparent 28%),
    radial-gradient(circle at 8% 16%, rgba(20, 184, 166, 0.22), transparent 32%),
    linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(255, 255, 255, 0.92));
  box-shadow:
    0 14px 30px rgba(37, 99, 235, 0.10),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.aiLevelPanel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #14b8a6, #2563eb, #ffd166);
}

.aiLevelPanel::after {
  content: "XP";
  position: absolute;
  right: 14px;
  top: 12px;
  color: rgba(15, 23, 42, 0.07);
  font-size: 40px;
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
}

.aiLevelHeader,
.aiLevelMeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.aiLevelHeader span,
.aiLevelMeta span,
.aiLevelRecentXp {
  color: #315164;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.aiLevelHeader strong {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  min-width: 76px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f766e, #2563eb);
  color: #fff;
  font-size: 23px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0;
  box-shadow:
    0 10px 20px rgba(37, 99, 235, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.34);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.aiLevelHeader span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #0f766e;
  font-size: 13px;
  font-weight: 950;
}

.aiLevelHeader span::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, #14b8a6, #ffd166);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

.aiLevelProgress {
  position: relative;
  z-index: 1;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(15, 118, 110, 0.08),
    inset 0 2px 5px rgba(15, 23, 42, 0.08);
}

.aiLevelProgressFill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.34), transparent 38%),
    linear-gradient(90deg, #14b8a6, #2563eb 64%, #ffd166);
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.24);
  transition: width 0.32s ease;
}

.aiLevelMeta {
  position: relative;
  z-index: 1;
}

.aiLevelMeta span {
  color: #3f5f74;
  font-size: 11px;
}

.aiLevelRecentXp {
  position: relative;
  z-index: 1;
  min-height: 26px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  color: #0f766e;
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.12);
}

.aiLevelRecentXp::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: rgba(255, 209, 102, 0.34);
  color: #8a5b00;
  font-size: 13px;
  font-weight: 950;
}

.aiLevelResultXp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.16), rgba(37, 99, 235, 0.13));
  color: #0f766e;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.25;
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.18);
}

.guestAuthNicknameLine {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.guestAuthLevelBadge {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 50px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.20), rgba(37, 99, 235, 0.16));
  color: #0f766e;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  text-align: center;
  white-space: nowrap;
  transform: translateY(1px);
  box-shadow: inset 0 0 0 1px rgba(20, 184, 166, 0.16);
}

.guestAuthNicknameLine strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aiRankingTable {
  border-radius: 8px;
  overflow: hidden;
}

.aiRankingTableHead,
.aiRankingRow {
  grid-template-columns: 72px minmax(150px, 1.35fr) minmax(104px, 0.9fr) minmax(86px, 0.75fr);
}

.aiRankingTableHead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.aiRankingList {
  max-height: min(54vh, 560px);
}

.aiRankingRow {
  min-height: 42px;
}

.aiRankingRow.mine {
  position: relative;
  border-color: rgba(37, 99, 235, 0.62);
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.98), rgba(240, 253, 250, 0.92));
  box-shadow: inset 4px 0 0 #2563eb, 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.aiRankingRow.mine::after {
  content: "ME";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 7px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
}

body.dark-mode .aiRankingMine,
body.ghost-mode-lock .aiRankingMine {
  border-color: rgba(147, 197, 253, 0.34);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.88)),
    radial-gradient(circle at 16% 20%, rgba(59, 130, 246, 0.24), transparent 36%);
}

body.dark-mode .aiLevelPanel,
body.ghost-mode-lock .aiLevelPanel {
  border-color: rgba(96, 165, 250, 0.28);
  background:
    radial-gradient(circle at 92% 8%, rgba(255, 209, 102, 0.18), transparent 28%),
    radial-gradient(circle at 8% 16%, rgba(45, 212, 191, 0.20), transparent 32%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.88));
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

body.dark-mode .aiLevelHeader span,
body.dark-mode .aiLevelMeta span,
body.dark-mode .aiLevelRecentXp,
body.ghost-mode-lock .aiLevelHeader span,
body.ghost-mode-lock .aiLevelMeta span,
body.ghost-mode-lock .aiLevelRecentXp {
  color: #d8f7ff;
}

body.dark-mode .aiLevelHeader strong,
body.ghost-mode-lock .aiLevelHeader strong {
  color: #fff;
}

body.dark-mode .aiLevelRecentXp,
body.ghost-mode-lock .aiLevelRecentXp {
  background: rgba(15, 23, 42, 0.72);
  color: #d8f7ff;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.16);
}

body.dark-mode .aiLevelResultXp,
body.ghost-mode-lock .aiLevelResultXp {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.18), rgba(96, 165, 250, 0.15));
  color: #5eead4;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.18);
}

body.dark-mode .guestAuthLevelBadge,
body.ghost-mode-lock .guestAuthLevelBadge {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.20), rgba(96, 165, 250, 0.18));
  color: #5eead4;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.18);
}

body.dark-mode .aiRankingRow.mine,
body.ghost-mode-lock .aiRankingRow.mine {
  border-color: rgba(147, 197, 253, 0.62);
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.34), rgba(20, 83, 45, 0.20));
  box-shadow: inset 4px 0 0 #93c5fd, 0 0 0 2px rgba(147, 197, 253, 0.14);
}

@media (max-width: 720px) {
  .aiRankingMine {
    grid-template-columns: auto 1fr;
  }

  .aiRankingMineBest {
    grid-column: 1 / -1;
  }

  .aiRankingTableHead,
  .aiRankingRow {
    grid-template-columns: 54px minmax(104px, 1fr) 78px 66px;
  }
}
