:root {
  --app-bg: #0b1020;
  --app-bg-2: #121a30;
  --app-card: #141c33;
  --app-text: #f3f5fb;
  --app-hint: #8d97b5;
  --app-line: rgba(255, 255, 255, 0.07);
  --app-accent: #ffb23f;
  --app-accent-text: #2a1600;
  --hdr-bg: #0b1020;
  --gold: #ffc94a;
  --orange: #ff8a3d;
  --violet: #7c5cff;
  --stage-bg: radial-gradient(60% 70% at 25% 40%, rgba(124, 92, 255, 0.28), transparent 60%),
    radial-gradient(50% 60% at 80% 70%, rgba(255, 138, 61, 0.18), transparent 60%), #070a14;
}

body {
  background: var(--stage-bg);
}

.hint {
  color: var(--app-hint);
  font-size: 13px;
}

.card {
  position: relative;
  border-radius: 20px;
  background: var(--app-card);
  border: 1px solid var(--app-line);
}

h1,
h2 {
  letter-spacing: -0.01em;
}

.view {
  display: none;
  padding: 14px 16px 8px;
  animation: viewIn 0.28s ease;
}

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

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ——— Profile ——— */
.profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), #ff4fa3);
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 0 0 2px var(--app-bg), 0 0 0 4px rgba(255, 201, 74, 0.6);
}

.profile__who {
  flex: 1;
  min-width: 0;
}

.profile__hi {
  font-weight: 700;
  font-size: 17px;
}

.profile__lvl {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--app-hint);
  font-size: 13px;
}

.lvl {
  padding: 1px 7px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--gold), var(--orange));
  color: #2a1600;
  font-weight: 800;
  font-size: 11px;
}

.balance {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 8px;
  border-radius: 999px;
  background: rgba(255, 201, 74, 0.12);
  border: 1px solid rgba(255, 201, 74, 0.3);
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  transition: transform 0.2s ease;
}

.balance svg {
  width: 22px;
  height: 22px;
}

.balance.is-bump {
  animation: bump 0.4s ease;
}

@keyframes bump {
  40% {
    transform: scale(1.12);
  }
}

/* ——— XP ——— */
.xp {
  margin: 14px 0 16px;
}

.xp__row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--app-hint);
  font-size: 12px;
  font-weight: 600;
}

.xp__bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.xp__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), #ff4fa3, var(--gold));
}

/* ——— Daily reward ——— */
.daily {
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 138, 61, 0.25), transparent 60%),
    linear-gradient(160deg, #1b2445, #121a30);
}

.daily__glow {
  position: absolute;
  top: -60px;
  right: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 201, 74, 0.35), transparent 70%);
  pointer-events: none;
}

.daily__head {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.daily h2 {
  font-size: 19px;
  font-weight: 800;
}

.streak {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 138, 61, 0.18);
  color: #ffb27a;
  font-weight: 800;
  font-size: 13px;
}

.days {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 14px 0;
  list-style: none;
}

.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 0 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 700;
  color: var(--app-hint);
}

.day svg {
  width: 20px;
  height: 20px;
}

.day b {
  color: var(--app-text);
  font-size: 11px;
}

.day.is-claimed {
  background: rgba(52, 199, 89, 0.12);
  color: #58d68d;
}

.day.is-claimed b {
  color: #8ce6b0;
}

.day__check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #34c759;
  color: #0b1020;
}

.day__check svg {
  width: 13px;
  height: 13px;
}

.day.is-today {
  background: rgba(255, 201, 74, 0.14);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 18px rgba(255, 201, 74, 0.3);
  animation: todayPulse 1.6s ease-in-out infinite;
}

@keyframes todayPulse {
  50% {
    box-shadow: 0 0 4px rgba(255, 201, 74, 0.1);
  }
}

.day.is-big svg {
  width: 24px;
  height: 24px;
}

/* ——— Buttons ——— */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 16px;
  transition: transform 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn svg {
  width: 22px;
  height: 22px;
}

.btn--gold {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, var(--gold), var(--orange));
  color: #2a1600;
  box-shadow: 0 8px 22px rgba(255, 138, 61, 0.35);
}

.btn--gold::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 35%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-20deg);
  animation: shine 2.6s ease-in-out infinite;
}

@keyframes shine {
  0%,
  60% {
    left: -50%;
  }
  100% {
    left: 130%;
  }
}

.btn--gold:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--app-hint);
  box-shadow: none;
  cursor: default;
  font-variant-numeric: tabular-nums;
}

.btn--gold:disabled::after {
  display: none;
}

/* ——— Event banner ——— */
.event {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  text-align: left;
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.25), rgba(124, 92, 255, 0.06));
}

.event__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(124, 92, 255, 0.3);
  font-size: 22px;
}

.event__text {
  flex: 1;
  min-width: 0;
}

.event__text b {
  display: block;
  font-size: 15px;
}

.event__text span {
  color: var(--app-hint);
  font-size: 12.5px;
}

.event__text em {
  color: #b9a8ff;
  font-style: normal;
  font-weight: 700;
}

.chev {
  color: var(--app-hint);
  font-size: 24px;
  line-height: 1;
}

/* ——— Shop ——— */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 0 10px;
}

.section-head h2 {
  font-size: 18px;
  font-weight: 800;
}

.shop {
  display: flex;
  gap: 10px;
  margin: 0 -16px;
  padding: 0 16px 4px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.shop::-webkit-scrollbar {
  display: none;
}

.item {
  flex: 0 0 148px;
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-radius: 18px;
  background: var(--app-card);
  border: 1px solid var(--app-line);
  scroll-snap-align: start;
}

.item__art {
  display: grid;
  place-items: center;
  height: 84px;
  margin-bottom: 10px;
  border-radius: 14px;
  font-size: 40px;
}

.item b {
  font-size: 14px;
  line-height: 1.25;
}

.item__price {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 6px 0 10px;
  color: var(--gold);
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.item__price svg {
  width: 16px;
  height: 16px;
}

.item button {
  margin-top: auto;
  min-height: 36px;
  border-radius: 10px;
  background: rgba(255, 201, 74, 0.15);
  color: var(--gold);
  font-weight: 800;
  font-size: 13px;
}

.item button:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: var(--app-hint);
  cursor: default;
}

/* ——— Pages ——— */
.page-head {
  margin: 4px 0 14px;
}

.page-head h1 {
  font-size: 26px;
  font-weight: 800;
}

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.seg__btn {
  min-height: 34px;
  border-radius: 9px;
  color: var(--app-hint);
  font-weight: 700;
  font-size: 14px;
  transition: background 0.2s ease, color 0.2s ease;
}

.seg__btn.is-active {
  background: var(--app-card);
  color: var(--app-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ——— Tasks ——— */
.tasks {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  list-style: none;
}

.task {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--app-card);
  border: 1px solid var(--app-line);
  animation: viewIn 0.3s ease both;
}

.task__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 22px;
}

.task__main {
  flex: 1;
  min-width: 0;
}

.task__main b {
  display: block;
  font-size: 14.5px;
  line-height: 1.25;
}

.task__reward {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  color: var(--gold);
  font-weight: 800;
  font-size: 13px;
}

.task__reward svg {
  width: 15px;
  height: 15px;
}

.task__progress {
  height: 5px;
  margin-top: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.task__progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--violet), #ff4fa3);
}

.task__btn {
  flex-shrink: 0;
  min-width: 70px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--app-accent);
  color: #2a1600;
  font-weight: 800;
  font-size: 13px;
}

.task__btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--app-text);
}

.task__btn--claim {
  background: linear-gradient(90deg, var(--gold), var(--orange));
  animation: todayPulse 1.4s ease-in-out infinite;
}

.task__btn.is-loading {
  color: transparent;
  position: relative;
}

.task__btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2.5px solid var(--app-text);
  border-right-color: transparent;
  border-radius: 50%;
  animation: kit-spin 0.7s linear infinite;
}

.task__done {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(52, 199, 89, 0.18);
  color: #34c759;
}

.task__done svg {
  width: 18px;
  height: 18px;
}

.task.is-done {
  opacity: 0.6;
}

/* ——— Leaderboard ——— */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: 8px;
  margin: 22px 0 12px;
}

.place {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: viewIn 0.35s ease both;
}

.place .avatar {
  width: 54px;
  height: 54px;
  font-size: 18px;
}

.place--1 .avatar {
  width: 66px;
  height: 66px;
  font-size: 22px;
  box-shadow: 0 0 0 2px var(--app-bg), 0 0 0 4px var(--gold), 0 0 26px rgba(255, 201, 74, 0.45);
}

.place__crown {
  height: 22px;
  font-size: 20px;
  line-height: 1;
}

.place__name {
  max-width: 100%;
  margin-top: 6px;
  overflow: hidden;
  font-weight: 700;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place__score {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--gold);
  font-weight: 800;
  font-size: 12px;
}

.place__score svg {
  width: 13px;
  height: 13px;
}

.place__stand {
  display: grid;
  place-items: center;
  width: 100%;
  margin-top: 8px;
  border-radius: 12px 12px 4px 4px;
  font-weight: 900;
  font-size: 22px;
}

.place--1 .place__stand {
  height: 86px;
  background: linear-gradient(180deg, rgba(255, 201, 74, 0.45), rgba(255, 201, 74, 0.08));
  color: var(--gold);
}

.place--2 .place__stand {
  height: 62px;
  background: linear-gradient(180deg, rgba(197, 207, 230, 0.35), rgba(197, 207, 230, 0.05));
  color: #d5dcef;
}

.place--3 .place__stand {
  height: 48px;
  background: linear-gradient(180deg, rgba(255, 138, 61, 0.35), rgba(255, 138, 61, 0.05));
  color: #ffb27a;
}

.board {
  display: grid;
  gap: 6px;
  list-style: none;
  padding-bottom: 76px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--app-card);
}

.row__rank {
  width: 22px;
  color: var(--app-hint);
  font-weight: 800;
  font-size: 14px;
  text-align: center;
}

.row .avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
  box-shadow: none;
}

.row__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__score {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.row__score svg {
  width: 15px;
  height: 15px;
}

.me-row {
  position: sticky;
  bottom: 8px;
  margin-top: -64px;
}

.me-row .row {
  background: linear-gradient(90deg, #2a2160, #1b2445);
  border: 1px solid rgba(124, 92, 255, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.me-row .row__rank {
  color: #b9a8ff;
}

/* ——— Friends ——— */
.invite {
  padding: 22px 16px 16px;
  text-align: center;
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(124, 92, 255, 0.35), transparent 70%),
    var(--app-card);
}

.invite__art {
  font-size: 54px;
  line-height: 1;
  filter: drop-shadow(0 8px 18px rgba(124, 92, 255, 0.5));
  animation: floaty 3s ease-in-out infinite;
}

@keyframes floaty {
  50% {
    transform: translateY(-6px) rotate(-4deg);
  }
}

.invite h1 {
  margin: 10px 0 4px;
  font-size: 24px;
  font-weight: 800;
}

.invite .hint {
  font-size: 14px;
}

.invite .hint b {
  color: var(--gold);
}

.reflink {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 12px;
  padding: 6px 6px 6px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  text-align: left;
}

.reflink span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reflink button {
  padding: 8px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 700;
  font-size: 13px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.stats div {
  padding: 12px 8px;
  border-radius: 14px;
  background: var(--app-card);
  text-align: center;
}

.stats b {
  display: block;
  font-size: 18px;
  font-weight: 800;
}

.stats span {
  color: var(--app-hint);
  font-size: 12px;
}

.friends {
  display: grid;
  gap: 6px;
  list-style: none;
  padding-bottom: 12px;
}

.friend__earn {
  color: #58d68d;
  font-weight: 800;
  font-size: 13px;
  text-align: right;
}

.friend__earn small {
  display: block;
  color: var(--app-hint);
  font-weight: 500;
  font-size: 11px;
}

/* ——— Tab bar ——— */
.tabbar {
  position: relative;
  z-index: 5;
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px 10px;
  background: rgba(11, 16, 32, 0.96);
  border-top: 1px solid var(--app-line);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  border-radius: 12px;
  color: var(--app-hint);
  font-weight: 600;
  font-size: 11px;
  transition: color 0.2s ease;
}

.tab svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.tab.is-active {
  color: var(--gold);
}

.tab.is-active svg {
  filter: drop-shadow(0 0 8px rgba(255, 201, 74, 0.5));
}

.badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 6px);
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff3b5c;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 17px;
}

.badge[hidden] {
  display: none;
}

@media (max-width: 880px) {
  .tabbar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

/* ——— Flying coins ——— */
.fly {
  position: fixed;
  z-index: 100;
  width: 24px;
  height: 24px;
  pointer-events: none;
  transition: transform 0.75s cubic-bezier(0.5, -0.2, 0.7, 1), opacity 0.75s ease;
}

/* ——— Sheet content ——— */
.redeem {
  text-align: center;
}

.redeem__art {
  font-size: 56px;
  line-height: 1.1;
}

.redeem h2 {
  margin: 8px 0 4px;
  font-size: 21px;
  font-weight: 800;
}

.redeem .item__price {
  justify-content: center;
  font-size: 16px;
}

.redeem .btn + .btn {
  margin-top: 8px;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.07);
  color: var(--app-text);
}
