:root {
  --orange: #FC6508;
  --orange-soft: #FFE3CF;
  --orange-mid: #FFA463;
  --ink: #020617;
  --ink-2: #475569;
  --dark: #1F1F1F;
  --bg: #FFF8F2;
  --card: #FFFFFF;
  --line: #F1E4D8;
  --ok: #15803D;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(2, 6, 23, 0.07);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Manrope", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: var(--orange); }
code { font-family: ui-monospace, Menlo, monospace; background: var(--orange-soft); padding: 2px 6px; border-radius: 6px; font-weight: 700; }

.proto-banner { background: #000; color: #fff; font-size: 12px; text-align: center; padding: 6px 16px; }

.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--dark); padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.topbar .logo { height: 22px; width: auto; }
.stats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip { background: rgba(255,255,255,.1); color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.chip b { color: var(--orange-mid); }
.chip-ticket { background: var(--orange); }
.chip-ticket b { color: #fff; }

main { max-width: 560px; margin: 0 auto; padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
html { color-scheme: light; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--dark); }

.hero { display: grid; gap: 4px; text-align: center; padding: 8px 0 16px; }
.hero-welly { width: min(300px, 80%); margin: 0 auto; filter: drop-shadow(0 12px 24px rgba(252,101,8,.25)); }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--orange); }
h1 { margin: 4px 0 6px; font-size: clamp(30px, 8vw, 42px); font-weight: 800; letter-spacing: -.02em; }
.lead { margin: 0 auto; max-width: 420px; color: var(--ink-2); }
.pool-pills { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.pill { background: var(--orange-soft); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.pill b { color: var(--orange); }
.pill-dark { background: var(--dark); color: #fff; }
.pill-dark b { color: var(--orange-mid); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
h2 { margin: 0 0 12px; font-size: 22px; }
h3 { margin: 0 0 10px; font-size: 17px; }
h3.big { font-size: 28px; margin: 0; }
h4 { margin: 16px 0 6px; font-size: 15px; }
.fine { font-size: 12px; color: var(--ink-2); margin: 10px 0 0; }

.steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 14px; }
.steps li::marker { color: var(--orange); font-weight: 800; }
.steps p { margin: 0 0 8px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.row { display: flex; gap: 8px; align-items: center; }
.at { font-weight: 800; color: var(--orange); }
input {
  width: 100%; min-width: 0; font: inherit; font-size: 16px;
  padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--ink);
}
input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(252,101,8,.15); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
  border-radius: 12px; padding: 11px 16px; border: 1.5px solid transparent; transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ok { background: #E8F6EC; color: var(--ok); border-color: transparent; cursor: default; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

/* Wheel */
.wheel-card { text-align: center; }
.wheel-wrap { position: relative; width: min(320px, 100%); margin: 8px auto 4px; aspect-ratio: 1; }
#wheel { width: 100%; height: 100%; transition: transform 4.2s cubic-bezier(.12,.8,.12,1); filter: drop-shadow(0 10px 20px rgba(2,6,23,.15)); }
#wheel text { font-family: "Manrope", sans-serif; font-weight: 800; }
.pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid var(--dark);
}
.hub {
  position: absolute; inset: 0; margin: auto; width: 74px; height: 74px; border-radius: 50%;
  background: var(--dark); color: #fff; border: 4px solid #fff; font: inherit; font-weight: 800; font-size: 15px;
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.hub:disabled { background: #64748B; cursor: not-allowed; }
.spin-status { font-weight: 700; margin: 8px 0 12px; min-height: 1.5em; }
.convert { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.convert .btn { font-size: 13px; padding: 10px 8px; }
.convert-one { grid-template-columns: 1fr; }

/* Tabs */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.tabs button {
  flex: 0 0 auto; font: inherit; font-weight: 700; font-size: 14px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer;
}
.tabs button.active { background: var(--dark); color: #fff; border-color: var(--dark); }

.missions { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.mission { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.mission .m-text { min-width: 0; }
.mission .m-title { font-weight: 700; font-size: 15px; }
.mission .m-sub { font-size: 12px; color: var(--ink-2); }
.mission .m-reward { color: var(--orange); font-weight: 800; font-size: 13px; }
.mission .m-act { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.mission.wide { flex-direction: column; align-items: stretch; }
.mission.wide .m-act { flex-direction: row; flex-wrap: wrap; align-items: center; }
.mission.wide .m-act input { flex: 1 1 100%; order: -1; }
.mission.wide .m-act .btn { flex: 1 1 0; }

.rewards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.reward { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: var(--bg); }
.reward .r-code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.badge { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.pending { background: #FFF4D6; color: #8A5A00; }
.badge.ready { background: #E8F6EC; color: var(--ok); }
.badge.used { background: #EEE; color: #666; }
.empty { color: var(--ink-2); text-align: center; padding: 16px 0; }

.pool-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pool-welly { width: 84px; }
.prize-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 15px; }
.prize-table th, .prize-table td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.prize-table td:first-child { font-weight: 800; color: var(--orange); }
.plain { padding-left: 18px; margin: 6px 0; }
.plain li { margin: 4px 0; }
.rules-intro { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }
.rules-draft { display: inline-block; margin-left: 4px; font-size: 11px; font-weight: 700; background: #F1F5F9; color: var(--ink-2); padding: 2px 8px; border-radius: 999px; }
.rules-block { border-top: 1px solid var(--line); padding-block: 12px; }
.rules-block h4 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.rules-block p { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); }
.rules-block ul { margin: 0 0 6px; padding-left: 18px; font-size: 14px; color: var(--ink-2); display: grid; gap: 5px; }
.rules-block b { color: var(--ink); }

.dev summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin-top: 12px; }
.dev-grid button { font: inherit; font-size: 13px; padding: 8px; border-radius: 10px; border: 1px dashed #CBD5E1; background: #F8FAFC; cursor: pointer; }
.dev-grid .danger { color: #B91C1C; }
.log { list-style: none; padding: 0; margin: 12px 0 0; font-size: 12px; color: var(--ink-2); max-height: 180px; overflow: auto; }

/* Footer theo wealify.com */
.foot { background: var(--dark); color: #A3A3A3; font-size: 14px; }
.foot a { color: inherit; text-decoration: none; }
.foot-cta { position: relative; overflow: hidden; text-align: center; padding-block: 44px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid rgba(255,255,255,.08); }
.foot-watermark { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-weight: 800;
  font-size: clamp(64px, 18vw, 200px); letter-spacing: .06em; color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,.06);
  white-space: nowrap; pointer-events: none; user-select: none; }
.foot-mark { position: relative; display: block; width: 56px; height: 56px; margin: 0 auto 10px; }
.foot-mark img { width: 56px; height: 56px; } /* logo chữ W gốc (favicon wealify.com) */
.foot-tagline { position: relative; margin: 0 auto 18px; max-width: 30ch; color: #fff; font-weight: 800; font-size: clamp(18px, 4.6vw, 24px); line-height: 1.3; text-wrap: balance; }
.foot .foot-btn { position: relative; border-radius: 999px; padding: 12px 24px; color: #fff; }
.foot-inner { max-width: 760px; margin: 0 auto; padding-block: 28px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.foot-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px 16px; margin-bottom: 24px; }
.foot-cols div { display: grid; gap: 8px; align-content: start; }
.foot-h { margin: 0 0 2px; font-size: 12px; color: #8A8A8A; }
.foot-cols a { color: #fff; font-weight: 700; font-size: 13px; }
.foot-cols a:hover, .foot-cols a:focus-visible { color: var(--orange-mid); }
.foot-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: #2A2A2A; border-radius: 16px; padding: 14px 18px; }
.foot-social { display: flex; gap: 8px; }
.foot-social a { width: 34px; height: 34px; border-radius: 9px; background: var(--orange); display: grid; place-items: center; }
.foot-social a:hover, .foot-social a:focus-visible { background: #E35400; }
.foot-social svg { width: 18px; height: 18px; fill: #fff; }
.foot-copy { margin: 0; font-size: 12px; color: #A3A3A3; }
.foot-logo img { height: 20px; width: auto; }
@media (max-width: 560px) {
  .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-bar { flex-direction: column; text-align: center; }
}

.modal { position: fixed; inset: 0; background: rgba(2,6,23,.55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 22px; padding: 24px; max-width: 360px; width: 100%; text-align: center; animation: pop .25s ease-out; }
.modal-welly { width: 150px; margin: -96px auto 0; }
.modal-box h3 { font-size: 22px; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px);
  background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; max-width: calc(100% - 32px); z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #B91C1C; }

@media (prefers-reduced-motion: reduce) { #wheel { transition-duration: .01s; } }
.badge.demo { background: #FDE68A; color: #78350F; margin-left: 4px; }
.dev-grid button.on { background: #FDE68A; border-style: solid; border-color: #D97706; font-weight: 700; }

/* Tiến độ 3 task X */
.task-progress { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); }
.task-progress b { color: var(--ink); }
.progress { height: 8px; background: var(--orange-soft); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }
.progress span { display: block; height: 100%; width: 0; background: var(--orange); border-radius: 999px; transition: width .4s; }

/* Profile + túi quà */
.chip-profile { border: 0; font: inherit; cursor: pointer; }
.chip-profile b { color: var(--orange-mid); }
.profile-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.profile-welly { width: 64px; flex: 0 0 auto; }
.profile-head .big { font-size: 22px; }
.reward .r-main { min-width: 0; }
.code-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; justify-content: center; }
.reward .code-row { justify-content: flex-start; }
.code-row code { font-size: 15px; letter-spacing: .04em; }
.modal-box .fine { display: block; margin-top: 8px; }
.redeem { background: var(--orange-soft); border-radius: 14px; padding: 14px 16px; margin-top: 14px; }
.redeem h4 { margin: 0 0 6px; }
.redeem ol { margin: 0; padding-left: 20px; font-size: 14px; }
.redeem li { margin: 4px 0; }
