/* ============================================================================
   CAMPAIGN.SCSS — port nguyên các class giao diện từ prototype đã duyệt 22/09
   (Salemans - Prototype (gui khach).html). Chỉ lấy phần MÀN ĐIỆN THOẠI; đã bỏ
   khung review (sidebar, .stage, .ph, .desk, .tokens) vì đó là công cụ trình bày.
   Ảnh nền + KV nạp qua import TS và gán inline (tránh gotcha url() của Vite+Sass);
   ở đây chỉ giữ background-color mép + lớp scrim. Biến màu lấy từ generated/tokens.
   ========================================================================= */

/* ---- Khung một màn: tương đương .scr của prototype nhưng co giãn theo viewport ---- */
.screen, .lg-screen {
  position: relative; flex: 1; min-height: 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bgApp);
}
.screen > *:not(.bgl), .lg-screen > *:not(.bgl) { position: relative; z-index: 1; }

/* ---- Thanh tiêu đề (app bar). Đã bỏ status-bar giả "09:41" của prototype
        vì đó là giả lập chrome hệ điều hành, không thuộc web app thật. ---- */
.nav {
  height: 52px; background: transparent; color: var(--gold-pale);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; flex: none; position: relative;
}
.body { flex: 1; overflow: auto; display: flex; flex-direction: column; position: relative; background: transparent; }
.body > * { position: relative; z-index: 1; }
.pad { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 14px; flex: 1; }

/* ================= HỆ NỀN MÀN HÌNH ================= */
.bgl {
  position: absolute; top: -1px; right: -1px; bottom: -1px; left: -1px;
  z-index: 0; pointer-events: none;
  background-repeat: no-repeat; background-size: cover; background-position: center center;
}
.bgl::after { content: ""; position: absolute; inset: 0; pointer-events: none; }

.bg-login  { background-color: var(--bgEdgeLogin); }
.bg-wheel  { background-color: var(--bgEdgeWheel); }
.bg-5m     { background-color: var(--bgEdge5m); }
.bg-500k   { background-color: var(--bgEdge500k); }
.bg-lose   { background-color: var(--bgEdgeLose); }

/* Màn đỏ — scrim nhẹ, chỉ giữ dải đỉnh cho tiêu đề đọc được trên pháo hoa. */
.bg-login::after, .bg-wheel::after {
  background: linear-gradient(180deg,
    rgba(var(--ink-rgb), .34) 0%, rgba(var(--ink-rgb), .22) 11%,
    rgba(var(--ink-rgb), .02) 24%, rgba(var(--ink-rgb), .02) 58%,
    rgba(var(--ink-rgb), .05) 80%, rgba(var(--ink-rgb), .06) 100%);
}
/* Màn trúng thưởng — giữ lớp tối ở dải có đoạn văn (46–73%), rồi hạ mạnh. */
.bg-5m::after, .bg-500k::after {
  background: linear-gradient(180deg,
    rgba(var(--ink-rgb), .34) 0%, rgba(var(--ink-rgb), .22) 11%,
    rgba(var(--ink-rgb), .02) 24%, rgba(var(--ink-rgb), .10) 46%,
    rgba(var(--ink-rgb), .30) 66%, rgba(var(--ink-rgb), .28) 73%,
    rgba(var(--ink-rgb), .08) 82%, rgba(var(--ink-rgb), .06) 100%);
}
/* Màn sáng — lớp kem tăng nhẹ ở đỉnh cho chrome đọc được. */
.bg-lose::after {
  background: linear-gradient(180deg,
    rgba(var(--cream-rgb), .26) 0%, rgba(var(--cream-rgb), .20) 9%,
    rgba(var(--cream-rgb), 0) 26%, rgba(var(--cream-rgb), 0) 100%);
}

/* Tông chữ chrome + text-shadow theo nền. */
.tone-dark .ctr, .tone-dark .lg-top, .tone-dark .res h3, .tone-dark .res p, .tone-dark .spinnote {
  text-shadow: 0 1px 3px rgba(var(--ink-rgb), .72), 0 0 12px rgba(var(--ink-rgb), .5);
}
.tone-dark .res .amt { filter: drop-shadow(0 2px 0 rgba(var(--ink-rgb), .55)) drop-shadow(0 0 10px rgba(var(--ink-rgb), .55)); }
.tone-dark .nav, .tone-dark .lg-top {
  -webkit-text-stroke: .7px var(--ink); paint-order: stroke fill;
  text-shadow: 0 1px 3px rgba(var(--ink-rgb), .85), 0 0 10px rgba(var(--ink-rgb), .7);
}
.tone-light .nav { -webkit-text-stroke: .7px var(--cream); paint-order: stroke fill; color: var(--ink);
  text-shadow: 0 1px 3px rgba(var(--cream-rgb), .95), 0 0 10px rgba(var(--cream-rgb), .85); }
.tone-light .res h3, .tone-light .res p { text-shadow: 0 1px 3px rgba(var(--cream-rgb), .95), 0 0 10px rgba(var(--cream-rgb), .85); }
.tone-light .res.lose p { color: var(--ink); }
.tone-light .medal.grey { background: rgba(var(--white-rgb), .86); border-color: var(--gold-deep); }
.tone-light .btn.ghost { background: rgba(var(--white-rgb), .82); color: var(--r-primary); border-color: var(--r-primary); }

/* ================= LOGIN ================= */
.lg-top { flex: none; display: flex; align-items: center; justify-content: center; padding: 3px 18px 0; min-height: 42px; }
.lg-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.2; color: var(--cream); }
.lg-main { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-start; gap: 16px; padding: 6px 0 18px; }

.kv {
  flex: none; margin: 0; aspect-ratio: 1000 / 328; position: relative; overflow: hidden;
  background-color: transparent; background-size: cover; background-position: center; background-repeat: no-repeat;
  -webkit-mask-image: radial-gradient(122% 132% at 50% 44%, #000 52%, rgba(0,0,0,.62) 78%, transparent 100%);
          mask-image: radial-gradient(122% 132% at 50% 44%, #000 52%, rgba(0,0,0,.62) 78%, transparent 100%);
}

.lg-card {
  flex: none; margin: 0 16px; border-radius: 24px; padding: 20px 16px 18px;
  background: linear-gradient(180deg, rgba(var(--ink-rgb), .10) 0%, rgba(var(--ink-rgb), .24) 55%, rgba(var(--ink-rgb), .34) 100%);
  border: 1px solid rgba(var(--gold-rgb), .45);
  box-shadow: 0 14px 34px rgba(var(--ink-rgb), .30), inset 0 1px 0 rgba(var(--white-rgb), .14);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.lg-field { margin-bottom: 15px; }
.lbl { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; color: var(--cream); margin-bottom: 6px; }
.lbl svg { width: 13px; height: 13px; flex: none; fill: var(--gold-pale); }

.inp {
  width: 100%; height: 46px; border: 1px solid rgba(var(--gold-deep-rgb), .30); border-radius: 12px; padding: 0 13px;
  font-size: 15.5px; font-family: inherit; background: var(--white); color: var(--ink); display: flex; align-items: center;
}
.inp.ph-val { letter-spacing: .3px; }
input.inp { display: block; box-sizing: border-box; -webkit-appearance: none; appearance: none; outline: none; line-height: normal; margin: 0; border-radius: 12px; }
input.inp::placeholder { color: rgba(var(--ink-rgb), .34); opacity: 1; }
input.inp:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(var(--gold-rgb), .26); }
input.inp.err:focus { border-color: var(--dangSolid); box-shadow: 0 0 0 3px rgba(var(--r-primary-light-rgb), .24); }
.inp.err { border-color: var(--dangSolid); background: var(--dangBg); color: var(--r-primary); font-weight: 600; }

.lg-err[hidden] { display: none; }
.lg-err { display: flex; gap: 7px; align-items: flex-start; margin-top: 7px; font-size: 11.5px; line-height: 1.5; font-weight: 600; color: var(--gold-pale); }
.lg-err i { flex: none; width: 15px; height: 15px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center;
  background: var(--dangSolid); color: var(--white); font-size: 10.5px; font-weight: 800; font-style: normal; line-height: 1; }

.lg-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 3px; padding-top: 14px;
  border-top: 1px solid rgba(var(--gold-rgb), .30); font-size: 11.5px; line-height: 1.55; color: var(--onRedDim); }
.lg-note i { flex: none; width: 15px; height: 15px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--r-primary-dark); font-size: 10.5px; font-weight: 800; font-style: normal; line-height: 1; }

.lg-card .btn { height: 47px; border-radius: 999px; font-size: 16.5px; margin-top: 18px; }
.lg-card .btn.gold { border: 1px solid var(--gold-deep);
  box-shadow: 0 6px 16px rgba(var(--ink-rgb), .30), inset 0 1px 0 rgba(var(--white-rgb), .62), inset 0 -1px 0 rgba(var(--gold-deep-rgb), .32); }
.lg-card .btn.dis { border-color: transparent; box-shadow: none; }

/* ================= NÚT ================= */
.btn { height: 54px; border-radius: 999px; display: grid; place-items: center; font-size: 17px; font-weight: 800; width: 100%; letter-spacing: .2px; border: 0; font-family: inherit; }
.btn.gold { position: relative; overflow: hidden; isolation: isolate; cursor: pointer;
  background: var(--ctaGold); border: 2px solid var(--gold-deep); color: var(--r-primary-dark);
  box-shadow: 0 0 22px rgba(var(--r-primary-light-rgb), .72), 0 4px 14px rgba(var(--r-primary-dark-rgb), .45),
              inset 0 2px 0 rgba(var(--white-rgb), .72), inset 0 -2px 0 rgba(var(--gold-deep-rgb), .35); }
.btn.gold::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 52%; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(var(--white-rgb), .62), rgba(var(--white-rgb), 0));
  border-radius: 999px 999px 60% 60% / 999px 999px 26% 26%; }
.btn.gold::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(104deg, rgba(var(--white-rgb), 0) 38%, rgba(var(--white-rgb), .88) 48%, rgba(var(--white-rgb), .95) 52%, rgba(var(--white-rgb), 0) 62%);
  background-size: 260% 100%; background-repeat: no-repeat; animation: shimmer 2.6s ease-in-out infinite; }
.btn.gold span { position: relative; z-index: 3; }
.btn.gold:active { transform: translateY(1px); }
.btn.red { background: linear-gradient(180deg, var(--r-primary-light) 0%, var(--r-primary) 100%); color: var(--white); font-size: 15.5px; font-weight: 700;
  text-shadow: 0 1px 2px rgba(var(--r-primary-dark-rgb), .9); height: 48px; cursor: pointer; }
.btn.dis { background: var(--disBg); color: var(--disFg); box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--r-primary-mid); border: 1.5px solid var(--gold-deep); height: 48px; font-size: 15px; cursor: pointer; }
button.btn { }
@keyframes shimmer { 0% { background-position: -220px 0; } 55%, 100% { background-position: 220px 0; } }

/* ================= OTP ================= */
.otpbox { display: flex; gap: 10px; justify-content: center; position: relative; }
.otpbox i { width: 50px; height: 62px; border: 1.5px solid var(--bDefault); border-radius: 14px; display: grid; place-items: center;
  font-size: 27px; font-weight: 800; font-style: normal; color: var(--ink); background: var(--surf); }
.otpbox i.on { border-color: var(--gold); background: linear-gradient(180deg, var(--gold-pale), var(--gold-light)); color: var(--r-primary-dark); }
.otpbox i.cur { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(var(--gold-rgb), .45); }
.otpbox i.err { border-color: var(--dangSolid); background: var(--dangBg); color: var(--dangFg); }

/* OTP_ERR — §8.11. Vùng RIÊNG ngay dưới 6 ô nhập, không dùng chung chỗ với .note:
   §8.6 quy định dòng ghi chú thường trực không bị đè, không bị ẩn khi có lỗi. */
.otp-err { margin-top: 12px; text-align: center; font-size: 12.5px; line-height: 1.5;
  font-weight: 600; color: var(--gold-pale); min-height: 19px; }
.otpbox input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0;
  font-size: 16px; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }

.ctr { text-align: center; }
.hint { font-size: 12.5px; color: var(--onRedDim); line-height: 1.55; }

.note { background: rgba(var(--ink-rgb), .82); border: 1px solid rgba(var(--gold-rgb), .55); border-radius: 14px; padding: 12px 14px;
  font-size: 12.5px; color: var(--onRed); line-height: 1.6; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.note.onlight { background: rgba(var(--cream-rgb), .95); border-color: var(--bSubtle); color: var(--ink-mid); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.badge.ok { background: var(--okBg); color: var(--okFg); }
.badge.warn { background: var(--warnBg); color: var(--warnFg); }
.badge.neu { background: var(--neuBg); color: var(--neuFg); }
.badge.gold { background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: var(--r-primary-dark); }
.badge.onred { background: rgba(var(--ink-rgb), .55); color: var(--gold-pale); border: 1px solid rgba(var(--gold-rgb), .5); }
button.badge { font-family: inherit; cursor: pointer; }
button.badge[disabled] { cursor: default; }

.spinnote { font-size: 13px; font-weight: 600; color: var(--white); text-align: center;
  -webkit-text-stroke: 1.6px var(--ink); paint-order: stroke fill; text-shadow: 0 1px 2px rgba(var(--ink-rgb), .9); }

/* ================= KẾT QUẢ ================= */
.res { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 28px 26px; text-align: center; position: relative; }
.res.win, .res.lose { background: transparent; }
.medal { width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center; font-size: 48px; flex: none; animation: popIn .5s cubic-bezier(.2,1.5,.4,1) both; }
.medal.gold { background: radial-gradient(circle at 35% 30%, var(--cream), var(--gold)); border: 5px solid var(--gold-deep); box-shadow: 0 0 0 9px rgba(var(--gold-rgb), .24); }
.medal.silver { background: radial-gradient(circle at 35% 30%, var(--white), var(--kv-peach)); border: 5px solid var(--kv-coral); box-shadow: 0 0 0 9px rgba(var(--kv-coral-rgb), .24); }
.medal.grey { background: var(--surfSunk); border: 5px solid var(--bDefault); }
.res h3 { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.24; animation: riseIn .45s .1s ease-out both; }
.res .amt { font-size: 40px; font-weight: 800; letter-spacing: -.5px; line-height: 1;
  background: var(--goldTextGrad); background-size: 320% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(var(--ink-rgb), .45)); animation: riseIn .45s .18s ease-out both, goldShine 2.8s linear infinite; }
.res p { margin: 0; font-size: 15px; line-height: 1.62; max-width: 300px; animation: riseIn .45s .26s ease-out both; }
.res > div.note { animation: riseIn .45s .34s ease-out both; }
.res.win h3 { color: var(--gold-pale); }
.res.win p { color: var(--onRedDim); }
.res.lose h3 { color: var(--ink); }
.res.lose p { color: var(--ink-secondary); }
.tick { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.res > *:not(.tick) { position: relative; z-index: 1; }
.tick i { position: absolute; width: 9px; height: 14px; border-radius: 2px; top: -24px; animation: fall linear infinite; }

/* ================= TRANG NỘI DUNG (thể lệ / giải / FAQ) — GAP theo SOW ================= */
.doc { flex: 1; overflow: auto; padding: 4px 20px 24px; color: var(--cream); }
.doc h4 { margin: 18px 0 8px; font-size: 13px; font-weight: 800; letter-spacing: .04em; color: var(--gold-pale); text-transform: uppercase; }
.doc h4:first-child { margin-top: 6px; }
.doc p, .doc li { font-size: 13.5px; line-height: 1.6; color: var(--onRedDim); }
.doc ul, .doc ol { margin: 6px 0; padding-left: 20px; }
.doc li { margin-bottom: 5px; }
.doc .prizes { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.doc .prizes > div { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: 12px;
  background: rgba(var(--ink-rgb), .30); border: 1px solid rgba(var(--gold-rgb), .4); }
.doc .prizes b { color: var(--gold-pale); font-weight: 800; }
.doc details { border-top: 1px solid rgba(var(--gold-rgb), .22); padding: 10px 0; }
.doc summary { font-size: 13.5px; font-weight: 700; color: var(--cream); cursor: pointer; list-style: none; }
.doc summary::-webkit-details-marker { display: none; }
.doc summary::before { content: "＋"; color: var(--gold); margin-right: 8px; font-weight: 800; }
.doc details[open] summary::before { content: "－"; }

/* ================= TRẠNG THÁI TẢI / LỖI — GAP theo SOW ================= */
.state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 28px; text-align: center; }
.state .spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(var(--gold-pale-rgb), .3); border-top-color: var(--gold); animation: spin 1s linear infinite; }
.state h3 { margin: 0; font-size: 18px; font-weight: 800; color: var(--gold-pale); }
.state p { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--onRedDim); max-width: 300px; }

@keyframes goldShine { 0% { background-position: 200% 0; } 100% { background-position: -100% 0; } }
@keyframes popIn { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes riseIn { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fall { 0% { transform: translate3d(0,-40px,0) rotate(0deg); opacity: 0; } 12% { opacity: 1; } 100% { transform: translate3d(14px,860px,0) rotate(520deg); opacity: .9; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .medal, .res h3, .res .amt, .res p, .res > div.note { animation: none !important; }
  .tick { display: none; }
  .state .spinner { animation-duration: .01ms; }
}
