:root {
  --blue: #0b47c4;
  --blue-dark: #062f8d;
  --gold: #e8b830;
  --gold-light: #ffe9a0;
  --gold-deep: #a9761a;
  --panel: #101010;
  --panel-2: #1c1608;
  --text: #f4e9cf;
  --text-muted: #9b9384;
  --radius: 20px;
  --gold-line: rgba(232, 184, 48, .38);
  --gold-text: linear-gradient(180deg, #fff8d8 0%, #ffdf83 38%, #e0a71c 68%, #ffe9a0 100%);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 18px 14px 40px;
  font-family: Kanit, "Noto Sans Thai", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background-color: var(--blue);
  background-image:
    repeating-linear-gradient(115deg,
      rgba(255, 255, 255, .055) 0 3px,
      rgba(255, 255, 255, 0) 3px 9px),
    radial-gradient(120% 90% at 50% 0%, #2f6df0 0%, var(--blue) 45%, var(--blue-dark) 100%);
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- การ์ดพื้นฐาน ---------- */
.card {
  position: relative;
  padding: 18px 16px;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(232, 184, 48, .12) 0%, rgba(232, 184, 48, 0) 55%),
    linear-gradient(165deg, #171717 0%, var(--panel) 40%, #0a0a0a 100%);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, .45),
    inset 0 1px 0 rgba(255, 255, 255, .06);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card__title--center { text-align: center; font-size: 1.15rem; }

/* ---------- สมัครสมาชิก ---------- */
.card--register { padding: 22px 18px 18px; text-align: center; }

.heading-gold {
  margin: 0;
  font-size: clamp(1.5rem, 6.4vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 6px rgba(232, 184, 48, .28));
}

.pill {
  display: inline-block;
  margin: 12px 0 0;
  padding: 4px 16px;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(232, 184, 48, .16), rgba(232, 184, 48, .04));
  font-size: .68rem;
  letter-spacing: .04em;
  color: var(--gold-light);
}

.brand {
  display: block;
  width: min(100%, 300px);
  height: auto;
  margin: 14px auto 20px;
  /* ดันพื้นหลังของไฟล์โลโก้ให้เป็นดำสนิทแล้วเบลนด์ทิ้ง เหลือเฉพาะตัวอักษรทอง */
  filter: contrast(1.4) saturate(1.05);
  mix-blend-mode: screen;
}

.form { display: flex; flex-direction: column; gap: 14px; }

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 52px;
  border: 1px solid rgba(232, 184, 48, .28);
  border-radius: 14px;
  background: linear-gradient(180deg, #0d0d0d, #050505);
  transition: border-color .2s, box-shadow .2s;
}

.field:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232, 184, 48, .16);
}

.field--error { border-color: #e0564a; }

.field__icon {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  fill: var(--gold);
  opacity: .85;
}

.field__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: .98rem;
  letter-spacing: .02em;
  outline: none;
}

.field__input::placeholder { color: #6f6a61; }

.btn-gold {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 54px;
  border: 1px solid #ffe9a0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffeda6 0%, var(--gold) 48%, #c8901c 100%);
  color: #2a1c00;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    0 10px 24px rgba(232, 184, 48, .3),
    inset 0 1px 0 rgba(255, 255, 255, .55);
  transition: transform .15s, box-shadow .2s, filter .2s;
}

.btn-gold:hover { filter: brightness(1.05); }
.btn-gold:active { transform: translateY(1px); box-shadow: 0 4px 12px rgba(232, 184, 48, .28); }
.btn-gold[disabled] { opacity: .65; cursor: progress; }

.btn-gold__arrow { width: 18px; height: 18px; fill: currentColor; }

.form-msg {
  margin: -4px 0 0;
  font-size: .8rem;
  color: #ff9c92;
}

.form-msg--ok { color: #6ee7a8; }

.fineprint {
  margin: 2px 0 0;
  font-size: .68rem;
  line-height: 1.7;
  color: var(--text-muted);
}

/* ---------- ออนไลน์ตอนนี้ ---------- */
.card--online {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: .88rem;
  color: var(--gold-light);
}

.card--online .num { color: #fff; font-weight: 600; }

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 10px #3ddc84;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}

/* ---------- รายการถอนล่าสุด ---------- */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(61, 220, 132, .35);
  border-radius: 999px;
  background: rgba(61, 220, 132, .1);
  font-size: .68rem;
  color: #7ff0ae;
}

.badge-live i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3ddc84;
  animation: pulse 1.6s ease-in-out infinite;
}

.ticker {
  height: 216px;
  overflow: hidden;
  mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 92%, transparent 100%);
}

.ticker__track {
  margin: 0;
  padding: 0;
  list-style: none;
  animation: scroll-up var(--ticker-duration, 26s) linear infinite;
}

@keyframes scroll-up {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.feed-item__avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

.feed-item__avatar svg { width: 17px; height: 17px; fill: #fff; opacity: .95; }
.feed-item__avatar--a { background: linear-gradient(160deg, #8b5cf6, #4c1d95); }
.feed-item__avatar--b { background: linear-gradient(160deg, #38bdf8, #1e3a8a); }
.feed-item__avatar--c { background: linear-gradient(160deg, #fbbf24, #b45309); }
.feed-item__avatar--d { background: linear-gradient(160deg, #34d399, #065f46); }

.feed-item__info { flex: 1 1 auto; min-width: 0; }

.feed-item__name {
  display: block;
  font-size: .86rem;
  font-weight: 600;
  color: #f0e7d5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-item__meta {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
}

.feed-item__amount {
  flex: 0 0 auto;
  font-size: .95rem;
  font-weight: 600;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- สถิติ ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  padding: 16px 8px 14px;
  border: 1px solid var(--gold-line);
  border-radius: 18px;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(232, 184, 48, .13) 0%, rgba(232, 184, 48, 0) 60%),
    linear-gradient(165deg, #171717, #0a0a0a);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .05);
  text-align: center;
}

.stat__icon { width: 22px; height: 22px; fill: var(--gold); }

.stat__value {
  margin: 8px 0 2px;
  font-size: clamp(.95rem, 4.2vw, 1.15rem);
  font-weight: 600;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat__label { margin: 0; font-size: .68rem; color: var(--text-muted); }

/* ---------- เงินรางวัลรวม ---------- */
.card--jackpot { padding: 20px 16px 18px; }

.jackpot {
  margin: 10px 0 4px;
  text-align: center;
  font-size: clamp(2rem, 9vw, 2.6rem);
  font-weight: 700;
  letter-spacing: .01em;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 12px rgba(232, 184, 48, .3));
}

.updated {
  margin: 0 0 16px;
  text-align: center;
  font-size: .7rem;
  color: var(--text-muted);
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mini {
  padding: 12px 10px;
  border: 1px solid rgba(232, 184, 48, .3);
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(232, 184, 48, .08), rgba(0, 0, 0, .5));
  text-align: center;
}

.mini__icon { width: 18px; height: 18px; fill: var(--gold); opacity: .9; }
.mini__label { margin: 4px 0 2px; font-size: .68rem; color: var(--text-muted); }

.mini__value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  background: var(--gold-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .ticker__track,
  .live-dot,
  .badge-live i { animation: none; }
  .ticker { height: auto; max-height: 216px; overflow-y: auto; }
}
