:root {
  --bg: #07080c;
  --card: #141822;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f3f5fb;
  --muted: #8b93a7;
  --blue: #3d6bff;
  --blue-2: #8fb0ff;
  --yes: #22c55e;
  --yes-bg: rgba(34, 197, 94, 0.14);
  --no: #f43f5e;
  --no-bg: rgba(244, 63, 94, 0.14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: Inter, "PingFang SC", "Noto Sans SC", sans-serif;
  background: #05060a;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { max-width: 100%; }
.hidden { display: none !important; }

.stage { min-height: 100dvh; }

.phone {
  height: 100dvh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.notch { display: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 8px;
}

.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  object-fit: cover;
  display: block;
  background: #1b2030;
  flex: 0 0 auto;
}
.brand h1 { margin: 0; display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.03em; }
.brand span { display: block; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.chip {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #1b2030;
  font-size: 11px;
  font-weight: 600;
  max-width: 124px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip.ghost { background: rgba(255, 255, 255, 0.06); }
.chip.balance { background: linear-gradient(135deg, #2a46c9, #3d6bff); }

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 14px 92px;
  overscroll-behavior: contain;
}
.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 99px; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  background: #121622;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.search span { color: var(--muted); font-size: 18px; }
.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
}
.search input::placeholder { color: #6d768c; }
.search input::-webkit-search-cancel-button { display: none; }

.gift {
  margin-top: 12px;
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1a274d, #15203b);
  border: 1px solid rgba(61, 107, 255, 0.35);
}
.gift b { color: var(--blue-2); font-size: 13px; white-space: nowrap; }
.gift span { color: #d5dcf0; font-size: 12px; line-height: 1.35; }
.gift em {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  background: var(--blue);
  border-radius: 999px;
  padding: 6px 8px;
  white-space: nowrap;
}

.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 14px 0 8px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cats button {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #161b28;
  color: #c5ccdd;
  font-size: 13px;
  font-weight: 600;
}
.cats button.on { background: #fff; color: #0b0d12; }

.source, .muted, .hint, .fineprint { color: var(--muted); font-size: 12px; line-height: 1.5; }
.fineprint { margin: -2px 0 10px; font-size: 11px; }
.loading-note { text-align: center; margin: 4px 0 0; }
.hint { margin: 8px 0 0; }

.feed { display: grid; gap: 12px; padding-bottom: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
}
.card.sk {
  height: 148px;
  border-color: transparent;
  background: linear-gradient(90deg, #141822, #1b2130, #141822);
  background-size: 200% 100%;
  animation: shine 1.2s infinite;
}
@keyframes shine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.card-head { display: flex; gap: 10px; margin-bottom: 10px; }
.card-head img, .ph {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: #222838;
  flex: 0 0 auto;
}
.card-head h3, .sheet h3 { margin: 0; font-size: 15px; line-height: 1.35; }
.card-head p, .desc { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.rows { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.row .label { font-size: 13px; color: #d7dce8; }
.row.col { display: block; }
.row-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.btns { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btns button, .btn {
  height: 38px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.yes { background: var(--yes-bg); color: var(--yes); }
.no { background: var(--no-bg); color: var(--no); }
.btn { width: 100%; background: var(--blue); color: #fff; margin-top: 8px; }
.btn.ghost { background: #1b2130; }
.btn:disabled { opacity: 0.6; cursor: default; }

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(10, 12, 18, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  z-index: 5;
}
.tabbar button {
  color: #7f8798;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.tabbar button.on { color: #fff; }
.ico { width: 18px; height: 18px; display: block; }
button:focus-visible { outline: 2px solid rgba(143, 176, 255, 0.9); outline-offset: 2px; }

.mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  z-index: 20;
}
.sheet {
  width: 100%;
  max-height: 86%;
  overflow: auto;
  background: #12151e;
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  animation: rise 0.28s ease;
}
@keyframes rise {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.handle {
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: #2c3344;
  margin: 4px auto 12px;
}
.field { display: grid; gap: 6px; margin: 10px 0; font-size: 12px; color: var(--muted); }
.field input {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0d1018;
  padding: 0 12px;
  outline: none;
}
.field input:focus { border-color: rgba(61, 107, 255, 0.7); }
.captcha-row { display: flex; gap: 10px; align-items: end; }
.grow { flex: 1; }
.captcha {
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 10px;
}
.captcha canvas { display: block; }
.err { color: #ff7b8c; font-size: 12px; min-height: 1em; margin: 0; }
.link { width: 100%; margin-top: 10px; color: var(--blue-2); font-size: 13px; }
.claim { text-align: center; padding: 12px 0 8px; }
.coin {
  width: 72px;
  height: 72px;
  margin: 8px auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, #ffe08a, #d4a017);
  color: #3a2a00;
  font-weight: 800;
  font-size: 18px;
}
.pick {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: #1a2140;
  border-radius: 12px;
  padding: 12px;
  margin: 8px 0;
}
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick button {
  height: 34px;
  border-radius: 10px;
  background: #1b2130;
  font-size: 12px;
  font-weight: 700;
}
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.meta-grid div { background: #0f1320; border-radius: 12px; padding: 10px; }
.meta-grid span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.page-title { margin: 6px 0 12px; font-size: 22px; }
.section-label { margin: 16px 0 8px; font-size: 14px; }
.stat {
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.stat b { font-size: 20px; }
.profile-card { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.profile-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.stack { display: grid; gap: 8px; }
.empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.empty small { display: block; margin-top: 6px; }
.lang-list { display: grid; gap: 8px; margin-top: 12px; }
.lang-list button {
  height: 44px;
  border-radius: 12px;
  background: #1b2130;
  text-align: left;
  padding: 0 14px;
  font-weight: 600;
}
.lang-list button.on { background: var(--blue); }

.success-mask { align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.success {
  width: 100%;
  background: #12151e;
  border-radius: 22px;
  padding: 24px 18px 18px;
  text-align: center;
  animation: rise 0.28s ease;
}
.check {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--yes);
  color: #052e16;
  font-size: 28px;
  font-weight: 800;
}
.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  top: calc(18px + env(safe-area-inset-top));
  background: #22283a;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
  font-size: 13px;
  z-index: 30;
}

.welcome-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 20px;
}
.welcome-card {
  position: relative;
  width: 100%;
  background: linear-gradient(180deg, #1a2748, #12151e);
  border: 1px solid rgba(61, 107, 255, 0.35);
  border-radius: 22px;
  padding: 22px 18px 18px;
  text-align: center;
  animation: pop 0.28s ease;
}
.welcome-card.shrink { animation: shrink-away 0.26s ease forwards; }
@keyframes pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes shrink-away {
  to { transform: scale(0.18) translate(140px, 220px); opacity: 0; }
}
.welcome-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-size: 20px;
  color: #c5ccdd;
}
.welcome-card h3 { margin: 8px 0; font-size: 18px; }
.welcome-card .desc { font-size: 13px; line-height: 1.55; margin: 0 0 16px; }
.phone:has(.gift-mini:not(.hidden)) .content { padding-bottom: 132px; }
.phone:has(.mask:not(.hidden)) .gift-mini,
.phone:has(.welcome-mask:not(.hidden)) .gift-mini {
  visibility: hidden;
  pointer-events: none;
}
.gift-mini {
  position: absolute;
  right: 14px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 12;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2a46c9, #3d6bff);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(61, 107, 255, 0.4);
  animation: pop 0.28s ease;
}

input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
  box-shadow: 0 0 0 1000px #0d1018 inset;
}

@media (min-width: 540px) {
  .stage {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 50% 0%, #1a2450 0%, transparent 42%), #05060a;
  }
  .phone {
    width: 390px;
    height: min(844px, 96dvh);
    min-height: 0;
    border-radius: 40px;
    border: 10px solid #171717;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 0 0 1px #2a2a2a;
  }
  .notch {
    display: block;
    position: absolute;
    top: 8px;
    left: 50%;
    width: 118px;
    height: 22px;
    transform: translateX(-50%);
    background: #000;
    border-radius: 20px;
    z-index: 6;
  }
  .topbar { padding-top: 34px; }
  .toast { top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
