* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #16c6eb;
  color: #17191f;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
}

[hidden] {
  display: none !important;
}

.app {
  position: relative;
  width: 100%;
  max-width: 375px;
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: hidden;
  background: #16c6eb;
}

.screen {
  display: none;
  min-height: 100vh;
  background: #16c6eb;
}

.screen.is-active {
  display: block;
}

.floating-back-button {
  position: absolute;
  left: 15px;
  top: 16px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 10px rgba(0, 123, 176, 0.16);
  cursor: pointer;
}

.floating-back-button::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 11px;
  width: 13px;
  height: 13px;
  border: solid #2b3038;
  border-width: 0 0 2px 2px;
  transform: rotate(45deg);
}

.activity-main {
  position: relative;
  min-height: 100vh;
  padding: 274px 15px 26px;
  background: #18c8ec url("./assets/bg-water.webp") center -94px / 100% auto no-repeat;
}

.hero-time {
  position: absolute;
  top: 190px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 225px;
  height: 31px;
  border: 3px solid #fff;
  border-radius: 18px;
  background: #1ebdf4;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  transform: translateX(-50%) rotate(-2deg);
  text-shadow: 0 1px 0 rgba(0, 122, 188, 0.2);
}

.history-entry {
  position: absolute;
  top: 158px;
  right: 0;
  z-index: 2;
  width: 25px;
  height: 70px;
  cursor: pointer;
}

.history-entry img {
  display: block;
  width: 100%;
  height: 100%;
}

.panel {
  position: relative;
  border: 2px solid rgba(221, 252, 255, 0.95);
  border-radius: 18px;
  background: #fff;
}

.section-title {
  position: absolute;
  left: 50%;
  top: -25px;
  display: block;
  transform: translateX(-50%);
  pointer-events: none;
}

.title-invite {
  width: 230px;
  height: auto;
}

.invite-card {
  padding: 32px 24px 10px;
  min-height: 214px;
}

.bubble-wrap {
  position: relative;
  width: 286px;
  height: 69px;
  margin: 0 auto;
}

.bubble-wrap img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.bubble-wrap p {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 12px 17px 0;
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.17;
  letter-spacing: 0;
  word-break: break-all;
}

.copy-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 176px;
  height: 39px;
  margin: 8px auto 9px;
  border-radius: 22px;
  background: linear-gradient(110deg, #e9ff00 0%, #49f1a3 100%);
  color: #07120c;
  font-size: 17px;
  font-weight: 800;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.invite-tip {
  margin: 0;
  color: #4b4e55;
  font-size: 13px;
  line-height: 1.55;
}

.platform-tip {
  margin-top: 4px;
  color: #f05b1f;
  font-size: 12px;
}

.ranking-section {
  position: relative;
  margin-top: 59px;
}

.tabbar {
  position: absolute;
  top: -37px;
  left: 9px;
  right: 9px;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 4px;
}

.tab-button {
  position: relative;
  height: 52px;
  cursor: pointer;
}

.tab-button img {
  display: block;
  width: 162px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.tab-panel {
  display: none;
  min-height: 367px;
  padding: 44px 17px 22px;
}

.tab-panel.is-active {
  display: block;
}

.rank-panel {
  padding: 38px 13px 14px;
}

.rank-row,
.history-row,
.my-rank {
  display: grid;
  grid-template-columns: 24px 38px minmax(0, 1fr) 50px;
  align-items: center;
  min-height: 52px;
  column-gap: 6px;
}

.rank-medal,
.rank-number {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5a7ac;
  font-size: 12px;
  font-weight: 800;
}

.rank-medal img {
  width: 21px;
  height: auto;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(145deg, #98e9ff, #0673f5);
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.user-meta,
.rank-count,
.history-prize {
  min-width: 0;
}

.user-name,
.history-prize-name {
  overflow: hidden;
  color: #151920;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-phone,
.metric-label {
  margin-top: 3px;
  color: #a6a8ae;
  font-size: 10px;
  line-height: 1.1;
}

.rank-count {
  text-align: right;
}

.metric-value {
  color: #181b21;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.1;
}

.empty-rank {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 310px;
  padding-top: 10px;
}

.empty-rank img {
  width: 168px;
  height: auto;
}

.empty-rank p {
  margin: 12px 0 0;
  color: #a6a8ae;
  font-size: 15px;
}

.my-rank {
  display: none;
  margin: 11px -15px 0;
  padding: 7px 15px 8px;
  min-height: 58px;
  border-radius: 18px 18px 0 0;
  background: #d9fbff;
  grid-template-columns: 52px 38px minmax(0, 1fr) 50px;
}

.rank-panel.is-active + .my-rank {
  display: grid;
}

.my-rank .own-label {
  color: #ff1a84;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.1;
}

.my-rank .own-sub {
  margin-top: 4px;
  color: #a4a8af;
  font-size: 10px;
}

.rules-panel {
  padding: 43px 21px 22px;
}

.rule-block {
  margin: 0 0 18px;
}

.rule-block h2 {
  margin: 0 0 8px;
  color: #11151c;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
}

.rule-block p {
  margin: 0 0 6px;
  color: #686d76;
  font-size: 12px;
  line-height: 1.6;
}

.rule-block .muted {
  color: #8b9098;
}

.prize-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px 8px;
}

.prize-card {
  min-width: 0;
  padding: 6px 4px 5px;
  border: 1px solid #2da7ff;
  border-radius: 6px;
  background: #fff;
  text-align: center;
}

.prize-card:nth-child(1),
.prize-card:nth-child(3),
.prize-card:nth-child(4) {
  border-color: #ffb22a;
}

.prize-card img {
  display: block;
  width: 70px;
  height: auto;
  margin: 0 auto 3px;
}

.prize-card span {
  display: block;
  padding: 2px 0 1px;
  border-radius: 3px;
  background: #1da7ff;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.prize-card:nth-child(1) span,
.prize-card:nth-child(3) span,
.prize-card:nth-child(4) span {
  background: #ffad19;
}

.notice {
  margin-bottom: 0;
}

.notice ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: notice;
}

.notice li {
  counter-increment: notice;
  margin: 0 0 12px;
  color: #6a6f78;
  font-size: 12px;
  line-height: 1.55;
}

.notice li::before {
  content: counter(notice) "、";
}

.history-main {
  padding-top: 274px;
}

.history-card {
  padding: 45px 14px 20px;
  min-height: 645px;
  background: #e7fbff;
}

.text-title {
  position: absolute;
  left: 50%;
  top: -34px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 178px;
  height: 51px;
  border-radius: 25px 25px 48% 48%;
  background:
    radial-gradient(circle at 19px 16px, #fff5b1 0 6px, transparent 7px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.38) 0 24%, transparent 24% 45%, rgba(255, 255, 255, 0.28) 45% 63%, transparent 63%),
    #fff1a6;
  box-shadow: 0 8px 0 #ffc526, 0 10px 0 rgba(0, 146, 215, 0.16);
  color: #ff4b10;
  font-size: 20px;
  font-weight: 900;
  transform: translateX(-50%);
}

.history-row {
  grid-template-columns: 24px 42px minmax(0, 1fr) 98px;
  min-height: 64px;
  column-gap: 7px;
}

.history-row .avatar {
  width: 42px;
  height: 42px;
}

.history-row .rank-medal img {
  width: 24px;
}

.history-row .user-name {
  font-size: 15px;
}

.history-prize {
  color: #11151c;
  text-align: right;
}

.history-prize-name {
  font-size: 14px;
}

.history-prize b {
  color: #ff1380;
}

.history-prize .metric-label {
  font-size: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(34px + env(safe-area-inset-bottom));
  z-index: 10;
  min-width: 132px;
  max-width: 280px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.76);
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 340px) {
  .activity-main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .invite-card {
    padding-left: 18px;
    padding-right: 18px;
  }

  .bubble-wrap {
    width: 272px;
  }

  .rank-row,
  .history-row {
    grid-template-columns: 22px 34px minmax(0, 1fr) 46px;
    column-gap: 5px;
  }

  .avatar {
    width: 33px;
    height: 33px;
  }

  .history-row {
    grid-template-columns: 22px 38px minmax(0, 1fr) 88px;
  }

  .history-row .avatar {
    width: 38px;
    height: 38px;
  }

  .user-name,
  .history-prize-name {
    font-size: 13px;
  }
}
