#screen-home .home-reward-row,
.website-reward-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#screen-home .home-xp,
.website-xp-button {
  border: 0;
  min-width: 92px;
  height: 42px;
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 8px 24px rgba(20,40,60,0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #17212B;
  font-size: 14px;
  font-weight: 900;
  padding: 10px 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.view-miniapp #screen-home .home-xp,
body.mobile-browser-view #screen-home .home-xp {
  min-width: 74px;
  height: 40px;
  padding: 8px 10px;
  gap: 6px;
}

.home-xp-label,
.website-xp-label {
  color: #f59e0b;
  letter-spacing: 0;
}

.xp-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10005;
  background: rgba(17,24,39,0.28);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 12px calc(18px + env(safe-area-inset-bottom, 0px));
}

.xp-sheet {
  width: min(100%, 430px);
  max-height: 78vh;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 24px;
  background: #ffffff;
  color: #17212B;
  padding: 16px 16px 20px;
  box-shadow: 0 -14px 40px rgba(20,40,60,0.20);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (min-width: 700px) {
  .xp-sheet-backdrop {
    align-items: flex-start;
    justify-content: flex-end;
    padding: 92px 24px 24px;
  }

  .xp-sheet {
    max-height: min(720px, 78vh);
  }
}

.xp-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.xp-title {
  margin: 0;
  font-size: 21px;
  font-weight: 950;
}

.xp-total {
  margin: 5px 0 0;
  color: #607080;
  font-size: 13px;
  font-weight: 800;
}

.xp-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 14px;
  background: #f4f8fb;
  color: #526273;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.xp-history {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
}

.xp-history-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.xp-history-title,
.xp-settings-title,
.xp-leaderboard-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 900;
  color: #17212B;
}

.xp-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 16px;
  background: #f6fbfe;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

.xp-history-reason {
  color: #526273;
  font-weight: 750;
}

.xp-history-amount {
  flex: 0 0 auto;
  color: #00a3e0;
  font-weight: 950;
}

.xp-empty {
  margin: 0;
  border-radius: 16px;
  background: #f6fbfe;
  padding: 12px;
  color: #607080;
  font-size: 13px;
  font-weight: 750;
}

.xp-link {
  display: inline-block;
  margin: 16px 0 0;
  border: 0;
  background: transparent;
  color: #00a3e0;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.xp-settings {
  margin-top: 18px;
  border-top: 1px solid rgba(20,40,60,0.08);
  padding-top: 14px;
}

.xp-nickname-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.xp-settings #xp-nickname {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(20,40,60,0.12);
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
}

.xp-nickname-save {
  min-width: 40px;
  height: 24px;
  border: 0;
  border-radius: 9px;
  background: #17212B;
  color: #ffffff;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0 8px;
}

.xp-nickname-save:disabled {
  opacity: 0;
  pointer-events: none;
}

.xp-settings-message {
  margin: 8px 0 0;
  color: #ef4444;
  font-size: 12px;
  font-weight: 850;
}

.xp-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.xp-toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  border-radius: 15px;
  background: #f6fbfe;
  padding: 10px 12px;
  box-sizing: border-box;
  color: #526273;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 850;
}

.xp-toggle-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.xp-switch-label {
  min-width: 0;
}

.xp-switch-visual {
  order: 2;
  position: relative;
  width: 44px;
  height: 26px;
  flex: 0 0 44px;
  border-radius: 999px;
  background: #d9e4ec;
  box-shadow: inset 0 0 0 1px rgba(82,98,115,0.08);
  transition: background 160ms ease, box-shadow 160ms ease;
}

.xp-switch-visual::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 5px 12px rgba(20,40,60,0.18);
  transition: transform 160ms ease;
}

.xp-toggle-row input[type="checkbox"]:checked + .xp-switch-visual {
  background: #00a3e0;
  box-shadow: 0 8px 18px rgba(0,163,224,0.18);
}

.xp-toggle-row input[type="checkbox"]:checked + .xp-switch-visual::after {
  transform: translateX(18px);
}

.xp-toggle-row input[type="checkbox"]:focus-visible + .xp-switch-visual {
  outline: 3px solid rgba(0,163,224,0.24);
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .xp-toggle-group {
    grid-template-columns: 1fr;
  }
}

.xp-leaderboard {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.xp-leaderboard-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 28px auto;
  align-items: center;
  gap: 10px;
  border-radius: 15px;
  background: #f7fbfe;
  padding: 10px 12px;
  font-size: 14px;
}

.xp-leaderboard-row.xp-rank-gold {
  background: linear-gradient(135deg, #fff4cf 0%, #ffffff 72%);
  box-shadow: 0 10px 26px rgba(245,158,11,0.16);
}

.xp-leaderboard-row.xp-rank-silver {
  background: linear-gradient(135deg, #d8dee7 0%, #f8fafc 58%, #ffffff 100%);
  box-shadow: 0 10px 26px rgba(100,116,139,0.22), inset 0 0 0 1px rgba(148,163,184,0.28);
}

.xp-leaderboard-row.xp-rank-bronze {
  background: linear-gradient(135deg, #ffe6d2 0%, #ffffff 74%);
  box-shadow: 0 8px 22px rgba(180,83,9,0.12);
}

.xp-leaderboard-row.is-current-user {
  box-shadow: 0 10px 24px rgba(0,163,224,0.12), inset 0 0 0 2px rgba(0,163,224,0.22);
}

.xp-leaderboard-gap {
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 22px;
  color: #8a99a8;
  font-size: 20px;
  font-weight: 950;
  letter-spacing: 2px;
}

.xp-leaderboard-row.xp-rank-gold .xp-rank::before {
  content: "♛";
  margin-right: 4px;
  color: #d97706;
}

.xp-leaderboard-row.xp-rank-gold .xp-rank {
  color: #b45309;
}

.xp-leaderboard-row.xp-rank-silver .xp-rank {
  color: #64748b;
}

.xp-leaderboard-row.xp-rank-bronze .xp-rank {
  color: #b45309;
}

.xp-rank {
  color: #8a99a8;
  font-weight: 900;
}

.xp-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.xp-leaderboard-badge {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.xp-leaderboard-badge img {
  max-width: 24px;
  max-height: 24px;
  object-fit: contain;
  display: block;
}

.xp-score {
  color: #00a3e0;
  font-weight: 950;
}
