/* ============================================================
   หวย × CARD — Bright Premium theme (ivory + gold + ruby)
   ------------------------------------------------------------
   • Font: Prompt (geometric Thai sans)
   • Palette: warm ivory background, gold ornaments, royal ruby
     CTA, deep ink text — like a 5-star hotel lobby
     dressed in Thai filigree.
   ============================================================ */

:root {
  /* Brand */
  --thai-red: #A0252A;
  --thai-red-bright: #C8323A;
  --thai-red-deep: #6B1218;
  --deep-navy: #1A2238;       /* deep ink navy (for accents only) */
  --navy-deep: #0F1726;
  --gold: #C99A2C;            /* slightly deeper gold for contrast on white */
  --gold-bright: #F0C75E;
  --gold-dim: #8E6F1C;

  /* Surfaces — bright premium theme */
  --bg: #FBF5E6;               /* warm ivory backdrop */
  --bg-tint: #FFFAEC;
  --surface: #FFFFFF;          /* raised panels — clean white */
  --surface-2: #FFF7E2;        /* highlighted panels — soft cream */
  --surface-dark: #ECDFC0;     /* deepest, behind shell — antique cream */
  --ink: #1A1F2E;              /* primary text — deep ink */
  --ink-soft: #3B3F52;
  --muted: #8A7A54;            /* gold-tinted muted */
  --muted-2: #6B5E40;
  --line: rgba(201, 154, 44, 0.20);
  --line-strong: rgba(201, 154, 44, 0.45);

  /* Status */
  --success: #0E9F6E;
  --warning: #B7791F;
  --danger: #DC2626;

  /* Shape */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 6px 14px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 24px 48px -12px rgba(0,0,0,0.18);
  --shadow-red: 0 10px 28px -8px rgba(190,22,34,0.45);
  --shadow-gold: 0 10px 28px -8px rgba(224,180,69,0.55);
  --shadow-navy: 0 10px 28px -8px rgba(31,78,121,0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*, *::before, *::after { -webkit-tap-highlight-color: transparent; }

html, body {
  background:
    radial-gradient(circle at 0% 0%, rgba(201,154,44,0.10), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(190,22,34,0.06), transparent 55%),
    linear-gradient(180deg, #FBF5E6 0%, #F4E9CC 100%);
  color: var(--ink);
  font-family: 'Prompt', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  /* Bigger base size for legibility — Thai script benefits from a touch more
     scale than Latin, especially on tightly packed labels. */
  font-size: 16px;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

button {
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, color .15s ease, opacity .15s ease;
}

/* ============ PHONE SHELL ============ */
.phone-shell {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.phone-shell::before {
  /* warm ambient glow — gold + ruby on cream */
  content: '';
  position: absolute;
  inset: -40% -10% 60% -10%;
  background:
    radial-gradient(circle at 18% 4%, rgba(201,154,44,0.16), transparent 55%),
    radial-gradient(circle at 88% 12%, rgba(190,22,34,0.10), transparent 50%);
  pointer-events: none;
  z-index: 0;
}
.phone-shell > * { position: relative; z-index: 1; }

@media (min-width: 600px) {
  body {
    align-items: center;
    padding: 24px;
    background:
      radial-gradient(circle at 30% 20%, rgba(201,154,44,0.10), transparent 55%),
      linear-gradient(135deg, #F8EDD2 0%, #ECDDB1 100%);
  }
  .phone-shell {
    min-height: 820px;
    height: 92vh;
    max-height: 920px;
    border-radius: 44px;
    border: 14px solid #2A1F12;
    box-shadow:
      0 30px 80px rgba(40,28,8,0.35),
      0 0 0 2px rgba(201,154,44,0.30),
      inset 0 0 0 2px rgba(255,255,255,0.6);
  }
}

/* ============ STATUS BAR ============ */
.status-bar {
  padding: 16px 26px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Prompt', sans-serif;
  color: var(--ink);
  letter-spacing: 0.3px;
}
.status-right { display: flex; gap: 10px; align-items: center; }
.signal { color: var(--ink); letter-spacing: -1px; font-size: 10px; }

#screen-host {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  animation: screen-in 0.22s cubic-bezier(.2,.9,.3,1);
}
@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ============ HEADER ============ */
.app-header {
  padding: 14px 22px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.app-header .logo {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.3px;
  background: linear-gradient(135deg, var(--thai-red) 0%, var(--thai-red-bright) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.app-header.sub .title { font-size: 16px; font-weight: 700; color: var(--ink); }
.app-header.sub .back, .app-header.sub .spacer { width: 60px; font-size: 14px; color: var(--thai-red); font-weight: 600; }
.app-header.sub .back.invisible { visibility: hidden; }

.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--thai-red), var(--deep-navy));
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
.avatar-lg {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--thai-red), var(--deep-navy));
  margin: 0 auto;
  box-shadow: var(--shadow-lg), inset 0 0 0 4px rgba(255,255,255,0.4);
}
.icon-btn {
  font-size: 16px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: rgba(0,0,0,0.04);
}

.app-body {
  flex: 1;
  padding: 4px 22px 110px;
}

/* ============ TAB BAR ============ */
.tab-bar {
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--line);
  display: flex;
  padding: 10px 14px 22px;
  z-index: 10;
  gap: 4px;
}
.tab-bar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 4px 6px;
  border-radius: var(--r-md);
  position: relative;
}
.tab-bar .tab .tab-ico {
  font-size: 22px;
  filter: grayscale(0.6);
  opacity: 0.55;
  transition: filter .2s, opacity .2s, transform .2s;
}
.tab-bar .tab.active { color: var(--thai-red); background: rgba(190,22,34,0.08); }
.tab-bar .tab.active .tab-ico { opacity: 1; filter: none; transform: translateY(-2px); }

/* ============ HERO ============ */
.hero-banner {
  position: relative;
  background:
    linear-gradient(135deg, var(--thai-red) 0%, var(--thai-red-bright) 45%, var(--deep-navy) 100%);
  border-radius: var(--r-xl);
  padding: 22px 22px 24px;
  color: #fff;
  margin: 12px 0 6px;
  box-shadow: var(--shadow-red);
  overflow: hidden;
  isolation: isolate;
}
.hero-banner::before {
  content: '';
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.18), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(252,211,77,0.25), transparent 40%);
  animation: hero-shift 14s ease-in-out infinite;
  z-index: -1;
}
@keyframes hero-shift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(4%, -3%) rotate(8deg); }
}
.hero-meta { font-size: 11px; opacity: 0.9; font-weight: 500; letter-spacing: 0.3px; }
.hero-title { font-size: 26px; font-weight: 800; margin: 6px 0 8px; letter-spacing: -0.5px; }
.hero-sub { font-size: 13px; opacity: 0.95; font-weight: 500; }
.hero-sub b { font-weight: 700; }

/* ============ BALANCES ============ */
.balance-row { display: flex; gap: 12px; margin: 18px 0; }
.balance-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.balance-card .label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.balance-card .value {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 4px;
  letter-spacing: -0.5px;
}
.balance-card.gold {
  background: linear-gradient(135deg, #FFF8E1 0%, #FEF3C7 100%);
  border-color: rgba(224,180,69,0.45);
}
.balance-card.gold .value {
  background: linear-gradient(135deg, var(--gold), #D97706);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============ BUTTONS ============ */
.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  margin: 10px 0;
  letter-spacing: 0.2px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--thai-red) 0%, var(--thai-red-bright) 100%);
  color: #fff;
  box-shadow: var(--shadow-red);
}
.btn-primary:disabled {
  background: var(--line-strong); color: var(--muted-2);
  box-shadow: none; cursor: not-allowed;
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--ink);
  box-shadow: var(--shadow-gold);
}
.btn-ghost {
  background: transparent;
  color: var(--thai-red);
  border: 1.5px solid var(--thai-red);
}
.btn-link {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-decoration: underline;
}
.btn.small { padding: 12px; font-size: 13px; }
.btn.tiny { padding: 10px 18px; font-size: 13px; width: auto; margin: 0; border-radius: var(--r-sm); }

/* ============ TYPOGRAPHY HELPERS ============ */
.block { margin: 16px 0; }
.block-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin: 16px 0 8px;
}
.muted { color: var(--muted); }
.muted.center { text-align: center; font-size: 12px; }
.muted.small { font-size: 11px; }
.center { text-align: center; }
.small { font-size: 12px; }
.red { color: var(--thai-red); }
.big { font-size: 17px; font-weight: 800; }
.ok { color: var(--success); }

/* ============ PROGRESS ============ */
.progress {
  background: var(--line-strong);
  height: 8px;
  border-radius: var(--r-full);
  overflow: hidden;
  margin: 8px 0;
}
.progress .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--thai-red), var(--gold));
  border-radius: var(--r-full);
  transition: width .4s cubic-bezier(.2,.9,.3,1);
}

/* ============ NEWS FEED ============ */
.news { display: flex; flex-direction: column; gap: 8px; }
.news .item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.news .item .who { color: var(--ink); font-weight: 600; }
.news .item .what { color: var(--muted); font-weight: 500; }

/* ============ HOME LOTTERY STRIP (quick switch) ============ */
.lottery-strip {
  /* 3-per-row grid — fits all 5 lottery types in 2 rows on any phone */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 2px 8px;
  margin: 6px 0 10px;
}
.lottery-strip::-webkit-scrollbar { height: 0; }
.lot-chip {
  --accent: var(--thai-red);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, transform .08s, box-shadow .15s, background .15s;
}
.lot-chip:active { transform: scale(0.97); }
.lot-chip.selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, #FFFFFF 0%, #FFFAFA 100%);
  box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--accent) 50%, transparent);
}
.lot-chip { padding: 8px 6px; }
.lot-chip .lc-ico { font-size: 20px; line-height: 1; }
.lot-chip .lc-name { font-size: 11px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.lot-chip .lc-meta { font-size: 9px; color: var(--muted); font-weight: 600; }
.lot-chip.selected .lc-meta { color: var(--accent); }

/* ============ LOTTERY TYPE PICKER ============ */
.lottery-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 16px;
}
.lottery-card {
  --accent: var(--thai-red);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, transform .08s, box-shadow .15s, background .15s;
  cursor: pointer;
}
.lottery-card:active { transform: scale(0.99); }
.lottery-card.selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, #FFFFFF 0%, #FAFAFA 100%);
  box-shadow: 0 10px 28px -8px color-mix(in srgb, var(--accent) 55%, transparent);
}
.lottery-card .lot-ico {
  font-size: 28px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--accent) 12%, white);
  flex-shrink: 0;
}
.lottery-card .lot-body { flex: 1; min-width: 0; }
.lottery-card .lot-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--ink);
}
.lottery-card .lot-name .tag {
  font-size: 10px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--ink);
  padding: 2px 7px;
  border-radius: var(--r-sm);
  margin-left: 6px;
  font-weight: 700;
  vertical-align: middle;
}
.lottery-card .lot-meta {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
}
.lottery-card .lot-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.lottery-card .lot-src {
  font-size: 10.5px;
  color: var(--muted-2);
  margin-top: 4px;
  font-style: italic;
}
.lottery-card .lot-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--line-strong);
  color: transparent;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
  transition: all .15s;
}
.lottery-card.selected .lot-check {
  background: var(--accent);
  color: #fff;
}

/* Hero pill showing the active lottery */
.hero-banner .lottery-pill {
  display: inline-block;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--r-full);
  margin-right: 6px;
  letter-spacing: 0.2px;
  border: 1px solid rgba(255,255,255,0.28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ============ MODE CARD ============ */
.mode-card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin: 10px 0;
  transition: border-color .15s, background .15s, transform .08s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.mode-card:active { transform: scale(0.99); }
.mode-card.selected {
  border-color: var(--thai-red);
  background: linear-gradient(135deg, #FFF5F5 0%, #FFFAFA 100%);
  box-shadow: var(--shadow-red);
}
.mode-card .head {
  display: flex; justify-content: space-between; align-items: center;
}
.mode-card .title-row { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.mode-card .title-row .tag {
  font-size: 10px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--ink);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  margin-left: 8px;
  font-weight: 700;
  vertical-align: middle;
}
.mode-card .cost { font-size: 15px; color: var(--thai-red); font-weight: 800; }
.mode-card .desc { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

/* ============ RISK TOGGLE ============ */
.risk-toggle {
  display: flex;
  gap: 4px;
  background: var(--line-strong);
  border-radius: var(--r-md);
  padding: 4px;
  margin: 6px 0 14px;
}
.risk-toggle .risk-opt {
  flex: 1;
  padding: 11px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--r-sm);
  color: var(--muted);
  transition: all .2s;
}
.risk-toggle .risk-opt.active {
  background: linear-gradient(135deg, var(--thai-red), var(--thai-red-bright));
  color: #fff;
  box-shadow: var(--shadow-red);
}

/* ============ RTP STRIP (under mode cards) ============ */
.rtp-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin: 8px 0 4px;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.rtp-strip b { color: var(--thai-red); font-weight: 800; }

/* ============ REDEEM (shop) ============ */
.redeem-card {
  background: linear-gradient(135deg, #FFFBEB 0%, #FFF5F5 100%);
  border: 1.5px solid var(--gold);
  border-radius: var(--r-lg);
  padding: 18px;
  margin: 14px 0;
  box-shadow: var(--shadow-gold);
}
.redeem-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--ink);
  text-align: center;
}
.redeem-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.rf-col { display: flex; flex-direction: column; }
.rf-cap {
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 4px;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.redeem-input {
  width: 100%;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 12px;
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  text-transform: uppercase;
  color: var(--ink);
}
.redeem-input:focus {
  outline: none;
  border-color: var(--thai-red);
  box-shadow: 0 0 0 3px rgba(190,22,34,0.15);
}
.redeem-help { margin-top: 8px; text-align: center; }
.redeem-help code {
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.redeem-history { display: flex; flex-direction: column; gap: 6px; }
.rh-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-size: 12px;
}
.rh-code { font-family: 'JetBrains Mono', monospace; font-weight: 700; flex: 1; }
.rh-amt { color: var(--success); font-weight: 800; }
.rh-t { margin-left: 8px; }

/* ============ INSTALL GUIDE ============ */
.install-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
  padding: 12px;
  background: var(--bg-tint);
  border-radius: var(--r-md);
}
.ist-step { font-size: 13px; line-height: 1.55; }
.ist-step b { color: var(--thai-red); margin-right: 4px; }

/* ============ STATS / HISTORY ============ */
.stats-summary {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--bg-tint) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  margin: 8px 0 14px;
  box-shadow: var(--shadow-sm);
}
.ss-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.ss-row.tight {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}
.ss-row.tight b { color: var(--ink); margin-left: 4px; }
.ss-cell { flex: 1; text-align: center; }
.ss-cap { font-size: 11px; color: var(--muted); font-weight: 600; }
.ss-val { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; margin-top: 2px; }
.ss-val.ok  { color: var(--success); }
.ss-val.red { color: var(--danger); }
.ss-net {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(15,15,20,0.05);
  border-radius: var(--r-md);
}
.ss-net .ss-cap { font-size: 13px; }
.ss-net .ss-val { font-size: 22px; }

.lot-stats { display: flex; flex-direction: column; gap: 10px; }
.lot-stat-card {
  --accent: var(--thai-red);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.ls-head { display: flex; align-items: center; gap: 10px; }
.ls-ico {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent) 15%, white);
  display: grid; place-items: center;
  font-size: 18px; flex-shrink: 0;
}
.ls-name-wrap { flex: 1; min-width: 0; }
.ls-name { font-weight: 800; font-size: 14px; color: var(--ink); }
.ls-meta { margin-top: 1px; }
.ls-net { font-weight: 800; font-size: 16px; flex-shrink: 0; }
.ls-net.ok  { color: var(--success); }
.ls-net.red { color: var(--danger); }

.ls-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 10px 0 6px;
  padding: 10px 0;
  border-top: 1px dashed var(--line-strong);
  border-bottom: 1px dashed var(--line-strong);
}
.ls-kpi { text-align: center; min-width: 0; }
.ls-kpi .k { font-size: 9.5px; color: var(--muted); font-weight: 600; letter-spacing: 0.2px; }
.ls-kpi b {
  font-size: 11.5px;
  font-weight: 800;
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ls-kpi b.ok  { color: var(--success); }
.ls-kpi b.red { color: var(--danger); }

.lsm-head, .lsm-row {
  display: grid;
  grid-template-columns: 50px 1fr 1fr 1fr 1fr;
  gap: 4px;
  font-size: 11px;
  align-items: center;
  padding: 5px 2px;
}
.lsm-head {
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.lsm-row { border-bottom: 1px dashed var(--line); }
.lsm-row:last-child { border-bottom: 0; }
.lsm-mode { font-weight: 700; color: var(--ink); }
.lsm-bets { color: var(--muted); }
.lsm-wager { color: var(--danger); text-align: right; }
.lsm-won { color: var(--success); text-align: right; }
.lsm-net { font-weight: 700; text-align: right; }
.lsm-net.ok  { color: var(--success); }
.lsm-net.red { color: var(--danger); }

.play-history { display: flex; flex-direction: column; gap: 6px; }
.ph-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 12px;
}
.ph-row.jackpot { border-color: var(--gold); background: linear-gradient(135deg, #FFFBEB 0%, #FFFFFF 100%); }
.ph-row.match { border-color: rgba(31,78,121,0.3); }
.ph-row.near  { border-color: rgba(245,158,11,0.3); }
.ph-lot { font-size: 22px; line-height: 1; flex-shrink: 0; }
.ph-body { flex: 1; min-width: 0; }
.ph-top {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 8px;
}
.ph-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}
.ph-tag { font-size: 11px; font-weight: 700; color: var(--muted); }
.ph-bot { margin-top: 2px; }
.ph-amt { font-weight: 800; font-size: 14px; flex-shrink: 0; }
.ph-amt.ok  { color: var(--success); }
.ph-amt.red { color: var(--danger); }

#stats-reset { margin-top: 14px; opacity: 0.7; font-size: 12px; }

/* ============ OWNER DASHBOARD ============ */
.owner-banner {
  background: linear-gradient(135deg, var(--navy-deep), var(--deep-navy));
  color: #fff;
  border-radius: var(--r-xl);
  padding: 18px 20px;
  margin: 8px 0 14px;
  text-align: center;
}
.ob-label { font-size: 11px; opacity: 0.85; letter-spacing: 0.5px; }
.ob-target {
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; margin: 4px 0;
}
.ob-target input {
  width: 220px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  text-align: center;
  margin-left: 4px;
}
.ob-sub { font-size: 11px; opacity: 0.75; }

.rtp-table, .rev-table { display: flex; flex-direction: column; gap: 6px; }
.rtp-row, .rev-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.rt-ico, .rv-ico {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: grid; place-items: center; flex-shrink: 0;
  font-size: 16px;
}
.rt-body, .rv-body { flex: 1; min-width: 0; }
.rt-name, .rv-name { font-size: 13px; font-weight: 700; }
.rt-meta, .rv-meta { font-size: 11px; color: var(--muted); margin-top: 1px; }
.rt-edge {
  color: var(--success); font-weight: 800; font-size: 14px;
}
.rv-profit {
  color: var(--thai-red); font-weight: 800; font-size: 14px;
}

.calc-card, .code-gen-card, .proof-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px;
  margin: 6px 0 14px;
}
.calc-row, .cg-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.calc-row:last-of-type, .cg-row:last-of-type { border-bottom: 0; }
.calc-row input, .cg-row input, .cg-row select {
  width: 100px;
  text-align: right;
  font-family: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
}
.cg-row select { width: 110px; }
.calc-result {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px solid var(--line-strong);
}
.cr-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
}
.cr-row b { color: var(--ink); font-weight: 800; }
.cr-row.big {
  font-size: 15px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}
.cr-row.big b { color: var(--thai-red); font-size: 17px; }

.weight-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0;
  font-size: 12px;
}
.weight-row .wr-name { width: 90px; }
.weight-row input[type=range] { flex: 1; }
.weight-row .wr-val { width: 38px; text-align: right; font-weight: 700; }

.proof-row { font-size: 12px; padding: 5px 0; line-height: 1.55; }
.proof-row b { color: var(--thai-red); margin-right: 4px; }
.proof-row code {
  background: rgba(0,0,0,0.06); padding: 1px 5px;
  border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: 11px;
}

.code-list { display: flex; flex-direction: column; gap: 6px; }
.cl-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: transform .08s, border-color .15s;
}
.cl-row:active { transform: scale(0.99); }
.cl-row.redeemed { opacity: 0.55; }
.cl-row.expired { opacity: 0.45; text-decoration: line-through; }
.cl-main { display: flex; align-items: center; justify-content: space-between; }
.cl-code {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--ink);
}
.cl-amt { color: var(--thai-red); font-weight: 800; font-size: 14px; }
.cl-meta { margin-top: 3px; }

.empty.small { font-size: 12px; padding: 16px; text-align: center; color: var(--muted); }

/* ============ INFO / WARN BOXES ============ */
.warn-box {
  background: linear-gradient(135deg, #FFF5F5 0%, #FFFBFB 100%);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--r-md);
  padding: 14px;
  margin: 12px 0;
  font-size: 12px;
  line-height: 1.5;
}
.info-box {
  border-radius: var(--r-md);
  padding: 14px;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.5;
}
.info-box.gold {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid rgba(224,180,69,0.4);
}
.info-box.red { background: #FFF5F5; border: 1px solid rgba(239,68,68,0.25); }
.info-box.small { font-size: 11px; padding: 12px; }

/* ============ NUMBER ENTRY ============ */
.number-display {
  background: linear-gradient(180deg, #0F0F12 0%, #1A1A20 100%);
  color: var(--gold-bright);
  border-radius: var(--r-lg);
  padding: 32px 12px;
  text-align: center;
  font-size: 60px;
  font-weight: 700;
  letter-spacing: 14px;
  font-family: 'JetBrains Mono', monospace;
  margin: 16px 0 6px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.05);
  min-height: 120px;
  text-shadow: 0 0 20px rgba(252,211,77,0.45);
}
.number-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.key {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-family: 'JetBrains Mono', monospace;
}
.key:active { transform: scale(0.95); background: #FFF5F5; }
.key.key-fn { background: var(--bg-tint); }
.key.key-ok {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 6px 14px rgba(16,185,129,0.35);
}

/* ============ CONFIRM ============ */
.confirm-card {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 24px 22px;
  margin: 14px 0;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.big-number {
  font-size: 60px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 14px;
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  margin: 8px 0 12px;
}
.confirm-rows { border-top: 1px solid var(--line); padding-top: 14px; }
.confirm-rows .row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  font-weight: 500;
}
.confirm-rows .row.big { font-size: 17px; font-weight: 800; padding-top: 12px; }

/* ============ LOCK ============ */
.lock-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}
.lock-card {
  background: linear-gradient(180deg, #0F0F12 0%, #1F1F26 100%);
  color: var(--gold-bright);
  border-radius: var(--r-xl);
  padding: 40px 24px;
  text-align: center;
  margin: 20px 0;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.lock-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(252,211,77,0.18), transparent 60%);
  pointer-events: none;
}
.lock-ico { font-size: 40px; position: relative; }
.lock-text { font-size: 14px; margin: 10px 0; color: #fff; position: relative; }
.lock-text.muted { color: rgba(255,255,255,0.55); }
.lock-number {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 12px;
  color: var(--gold-bright);
  font-family: 'JetBrains Mono', monospace;
  margin: 12px 0;
  text-shadow: 0 0 30px rgba(252,211,77,0.6);
  position: relative;
}
.lock-countdown {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 6px;
  font-family: 'JetBrains Mono', monospace;
  margin: 18px 0 6px;
  color: #fff;
  position: relative;
}

/* ============ REVEAL ============ */
.outcome-banner {
  text-align: center;
  padding: 26px 20px;
  border-radius: var(--r-xl);
  color: #fff;
  margin: 18px 0;
  box-shadow: var(--shadow-lg);
  animation: pop .35s cubic-bezier(.2,.9,.3,1.3);
  position: relative;
  overflow: hidden;
}
@keyframes pop { from { transform: scale(0.85); opacity: 0;} to { transform: scale(1); opacity: 1;} }
.outcome-banner.jackpot {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 50%, #D97706 100%);
  color: var(--ink);
}
.outcome-banner.match { background: linear-gradient(135deg, var(--thai-red-bright), var(--thai-red-deep)); }
.outcome-banner.near { background: linear-gradient(135deg, var(--deep-navy), var(--navy-deep)); }
.outcome-banner.miss { background: linear-gradient(135deg, #4B5563, #1F2937); }
.outcome-banner .label {
  font-size: 11px;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 600;
}
.outcome-banner .tier {
  font-size: 36px;
  font-weight: 800;
  margin: 6px 0;
  letter-spacing: 1px;
}
.outcome-banner .reward {
  font-size: 13px;
  margin-top: 8px;
  opacity: 0.95;
  line-height: 1.6;
  font-weight: 500;
}

.reward-card-wrap { display: flex; justify-content: center; margin: 20px 0; }
.card-show {
  width: 180px;
  aspect-ratio: 5/7;
  border-radius: var(--r-md);
  position: relative;
  animation: card-reveal .55s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes card-reveal {
  from { transform: rotateY(180deg) scale(0.5); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ============ CARD VISUALS ============ */
/* The new card system renders a full SVG inside .card-thumb. Wrapper just sets
   shape + rarity-tier glow; everything visual is inside the SVG itself. */
.card-thumb {
  aspect-ratio: 5/7;
  border-radius: var(--r-sm);
  overflow: hidden;
  position: relative;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  background: #1A1A20;
  display: block;
}
.card-thumb svg.nft-card,
.card-thumb img.card-img { width: 100%; height: 100%; display: block; object-fit: cover; }
.card-thumb .card-svg-fallback { width: 100%; height: 100%; display: block; }
.card-thumb .card-svg-fallback[hidden] { display: none; }
.card-thumb:active { transform: scale(0.96); }
.card-thumb.common    { border-color: #404040; }
.card-thumb.rare      { border-color: var(--deep-navy);    box-shadow: 0 4px 12px rgba(31,78,121,0.35); }
.card-thumb.epic      { border-color: var(--thai-red);     box-shadow: 0 0 18px rgba(244,63,94,0.5); }
.card-thumb.legendary { border-color: var(--gold);         box-shadow: 0 0 24px rgba(252,211,77,0.65); }
.card-thumb.secret    { border-color: var(--gold);         box-shadow: 0 0 28px rgba(252,211,77,0.85); }
.card-thumb.locked { opacity: 0.25; filter: saturate(0.4) blur(0.5px); }
.card-thumb.picked { outline: 3px solid var(--gold-bright); outline-offset: 1px; }

/* Locked-card fallback (no img + no SVG, just placeholder text) */
.card-thumb:not(:has(img.card-img)):not(:has(svg.nft-card)) {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
  color: #fff;
  background: linear-gradient(145deg, #6B7280, #404040);
}
.card-thumb .card-id,
.card-thumb .card-name,
.card-thumb .card-rarity { display: none; }
.card-thumb:not(:has(img.card-img)):not(:has(svg.nft-card)) .card-id,
.card-thumb:not(:has(img.card-img)):not(:has(svg.nft-card)) .card-name,
.card-thumb:not(:has(img.card-img)):not(:has(svg.nft-card)) .card-rarity { display: block; }
.card-thumb .card-id {
  position: absolute; top: 6px; right: 6px;
  font-size: 9px; font-family: 'JetBrains Mono', monospace;
  background: rgba(0,0,0,0.45); padding: 2px 6px; border-radius: var(--r-xs);
}
.card-thumb .card-name { font-size: 10px; font-weight: 700; text-align: center; line-height: 1.25; }
.card-thumb .card-rarity {
  position: absolute; top: 6px; left: 6px;
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; opacity: 0.85;
}

/* Big reveal card */
.card-show { width: 220px; aspect-ratio: 5/7; overflow: hidden; border-radius: var(--r-md); }
.card-show svg.nft-card,
.card-show img.card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-show .card-svg-fallback { width: 100%; height: 100%; display: block; }
.card-show .card-svg-fallback[hidden] { display: none; }

/* Modal: full-size card view */
.card-detail-card {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 5/7;
  margin: 8px auto 16px;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.card-detail-card svg.nft-card,
.card-detail-card img.card-img { width: 100%; height: 100%; display: block; object-fit: cover; }
.card-detail-card .card-svg-fallback { width: 100%; height: 100%; display: block; }
.card-detail-card .card-svg-fallback[hidden] { display: none; }
.card-detail-lore {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 0;
  font-style: italic;
  text-align: center;
}

/* ============ ALBUM ============ */
.chip-row {
  /* 3-per-row grid — 6 filter chips fit in 2 tidy rows on any phone */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 16px;
  padding-bottom: 4px;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 9px 8px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
  text-align: center;
  transition: all .15s;
  min-width: 0;
}
.chip.active {
  background: linear-gradient(135deg, var(--thai-red), var(--thai-red-bright));
  color: #fff;
  border-color: var(--thai-red);
  box-shadow: var(--shadow-red);
}

.set-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.set-title { font-size: 15px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.2px; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 10px 0 18px;
}

/* ============ FUSE ============ */
.fuse-zone {
  background: var(--surface);
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-xl);
  padding: 18px;
  margin: 14px 0;
  text-align: center;
}
.fuse-slots { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.fuse-slot {
  width: 62px;
  aspect-ratio: 5/7;
  border: 2px dashed var(--thai-red);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--thai-red);
  font-size: 24px;
  overflow: hidden;
  position: relative;
  background: #FFFAFA;
}
.fuse-slot .card-thumb { width: 100%; height: 100%; border-radius: var(--r-xs); }
.fuse-arrow { font-size: 24px; color: var(--gold); margin: 10px 0; }
.fuse-cost {
  background: linear-gradient(135deg, #0F0F12, #1F1F26);
  color: var(--gold-bright);
  padding: 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  margin-top: 8px;
  font-weight: 500;
  line-height: 1.6;
}
.fuse-pool {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.fuse-pool .card-thumb { font-size: 9px; }
.fuse-pool .card-thumb.picked { outline: 3px solid var(--gold-bright); }

/* ============ MARKETPLACE ============ */
.seg-row {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
}
.seg {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.seg.active {
  background: linear-gradient(135deg, var(--thai-red), var(--thai-red-bright));
  color: #fff;
  border-color: var(--thai-red);
  box-shadow: var(--shadow-red);
}

.mp-row {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  margin: 10px 0;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .15s;
}
.mp-row:active { transform: scale(0.99); }
.mp-row .mini { width: 48px; aspect-ratio: 5/7; flex-shrink: 0; }
.mp-row .info { flex: 1; min-width: 0; }
.mp-row .info .name { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; }
.mp-row .info .meta { font-size: 11px; color: var(--muted); font-weight: 500; }
.mp-row .price { font-size: 15px; font-weight: 800; color: var(--thai-red); letter-spacing: -0.3px; }

/* ============ TOPUP (PromptPay QR + slip OCR) ============ */
.topup-step { margin-top: 14px; }

.topup-amount-row { margin-bottom: 8px; }
.topup-amount-input {
  font-size: 26px !important;
  font-weight: 800 !important;
  text-align: center;
  letter-spacing: 1px;
  padding: 14px 12px !important;
}
.topup-quick-picks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 14px;
}
.quick-pick {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: transform .12s, border-color .15s, background .15s;
}
.quick-pick:hover { border-color: var(--thai-red); }
.quick-pick:active { transform: scale(0.97); background: rgba(192,0,0,0.06); }

.promptpay-card {
  background: linear-gradient(160deg, #fff, #fff8e6 80%);
  border: 1px solid var(--gold);
  border-radius: var(--r-lg);
  padding: 18px;
  margin: 12px 0;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.pp-bank-row { margin-bottom: 10px; }
.pp-bank-name {
  font-size: 13px;
  color: var(--deep-navy);
  font-weight: 700;
  letter-spacing: 0.3px;
}
.pp-receiver {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}
.pp-qr-wrap {
  background: #fff;
  border-radius: var(--r-md);
  padding: 14px;
  display: inline-block;
  box-shadow: var(--shadow-sm);
  margin: 8px 0;
}
.pp-qr-wrap img { display: block; image-rendering: pixelated; }
.pp-amount {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 1px dashed var(--gold);
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 14px;
}
.pp-amount b {
  color: var(--thai-red);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.pp-hint { margin-top: 8px; text-align: left; line-height: 1.45; }

.slip-upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  min-height: 130px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.02);
  cursor: pointer;
  margin: 10px 0;
  padding: 14px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.slip-upload-zone:hover { border-color: var(--thai-red); background: rgba(192,0,0,0.04); }
.slip-icon { font-size: 36px; line-height: 1; }
.slip-preview {
  display: block;
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--r-md);
  object-fit: contain;
}

.topup-verify-status {
  margin-top: 8px;
  text-align: center;
  font-weight: 600;
}
.topup-verify-status.ok   { color: var(--success); }
.topup-verify-status.err  { color: var(--thai-red); }
.topup-verify-status.warn { color: #b45309; }

/* Admin pending queue + cg-row col layout */
.cg-row.cg-row--col { display: block; }
.cg-row.cg-row--col span { display: block; margin-bottom: 4px; }
.pending-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.pending-actions .btn { flex: 1; }

/* ============ SHOP ============ */
.pack-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.pack-row .b { font-weight: 800; font-size: 15px; letter-spacing: -0.2px; }
.pack-row.featured {
  border: 2px solid var(--thai-red);
  box-shadow: var(--shadow-red);
}
.pack-row.featured .badge {
  position: absolute;
  top: -10px;
  right: 18px;
  background: linear-gradient(135deg, var(--thai-red), var(--thai-red-bright));
  color: #fff;
  font-size: 10px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-weight: 800;
  box-shadow: var(--shadow-red);
}
.pack-row.whale {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold), #D97706);
  border: none;
  box-shadow: var(--shadow-gold);
}
.pack-row.whale .b { font-size: 17px; }
.pay-methods { text-align: center; margin: 16px 0; }

/* ============ PROFILE ============ */
.profile-head { text-align: center; padding: 16px 0 10px; }
.profile-head .name { font-weight: 800; font-size: 20px; margin-top: 12px; letter-spacing: -0.3px; }
.badges {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  font-weight: 700;
}
.badge.gold { background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: var(--ink); }
.badge.navy { background: var(--deep-navy); color: #fff; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.stat {
  background: var(--surface);
  padding: 16px 8px;
  border-radius: var(--r-md);
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.stat .v.ok { color: var(--success); }

.menu-list {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.menu-row {
  width: 100%;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  text-align: left;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
}
.menu-row:last-child { border-bottom: none; }
.menu-row:active { background: var(--bg-tint); }
.menu-row.danger { color: var(--danger); font-weight: 700; }

/* ============ TOAST ============ */
#toast {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 90%;
}
.toast {
  background: rgba(15, 15, 20, 0.95);
  backdrop-filter: blur(12px);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in .25s cubic-bezier(.2,.9,.3,1.2);
}
.toast.ok { background: linear-gradient(135deg, var(--success), #059669); }
.toast.err { background: linear-gradient(135deg, var(--danger), #B91C1C); }
.toast.gold { background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: var(--ink); }
@keyframes toast-in {
  from { transform: translateY(24px) scale(0.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ============ HOW-TO-PLAY ============ */
.howto-card {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid rgba(224,180,69,0.45);
  border-radius: var(--r-lg);
  padding: 16px;
  margin: 14px 0;
  box-shadow: var(--shadow-sm);
}
.howto-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.howto-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.howto-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
}
.howto-step .step-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--thai-red), var(--thai-red-bright));
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.howto-step .step-text { color: var(--ink); font-weight: 500; }
.howto-step .step-text b { font-weight: 700; }

/* Help button trigger */
.help-fab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--thai-red);
  border: 1px solid var(--line-strong);
  padding: 6px 12px;
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
  box-shadow: var(--shadow-sm);
}

/* ============ RARITY LEGEND ============ */
.rarity-legend {
  display: flex;
  gap: 8px;
  margin: 8px 0 14px;
  padding: 12px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
}
.rarity-legend::-webkit-scrollbar { display: none; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}
.legend-dot {
  width: 12px; height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}
.legend-dot.common    { background: linear-gradient(145deg, #9CA3AF, #404040); }
.legend-dot.rare      { background: linear-gradient(145deg, #3B82F6, #1F4E79); }
.legend-dot.epic      { background: linear-gradient(145deg, #F43F5E, var(--thai-red-deep)); }
.legend-dot.legendary { background: linear-gradient(145deg, var(--gold-bright), #D97706); box-shadow: 0 0 6px rgba(252,211,77,0.6); }
.legend-dot.secret    { background: #000; box-shadow: 0 0 6px rgba(252,211,77,0.6); }

/* ============ EMPTY ============ */
.empty {
  text-align: center;
  padding: 40px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* ============ MODAL ============ */
#modal-root {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  animation: backdrop-in .2s ease;
}
#modal-root.open { display: flex; }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  background: var(--surface);
  width: 100%;
  max-width: 440px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 22px 22px 28px;
  animation: sheet-in .28s cubic-bezier(.2,.9,.3,1.2);
  box-shadow: 0 -16px 48px rgba(0,0,0,0.25);
  position: relative;
}
.modal-sheet::before {
  content: '';
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 40px; height: 4px;
  background: var(--line-strong);
  border-radius: var(--r-full);
}
@keyframes sheet-in {
  from { transform: translateY(80%); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-sheet h3 { font-size: 20px; font-weight: 800; margin: 8px 0 6px; letter-spacing: -0.3px; }
.modal-sheet .sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; font-weight: 500; }
.modal-sheet .row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; font-size: 14px; }
.modal-sheet .row .k { color: var(--muted); }
.modal-sheet .actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-sheet .actions .btn { margin: 0; flex: 1; }

.qr-box {
  background: linear-gradient(135deg, #0F0F12, #1F1F26);
  color: var(--gold-bright);
  padding: 14px;
  border-radius: var(--r-sm);
  margin: 12px 0;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  word-break: break-all;
}
.qr-fake {
  width: 180px;
  height: 180px;
  margin: 10px auto;
  background:
    repeating-linear-gradient(90deg, #fff 0 12px, #1A1A20 12px 24px),
    repeating-linear-gradient(0deg, #fff 0 12px, #1A1A20 12px 24px);
  background-blend-mode: multiply;
  border-radius: var(--r-xs);
  border: 6px solid #fff;
  box-shadow: 0 0 0 6px var(--ink), var(--shadow-lg);
}

.method-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.method-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.method-row .ico { font-size: 24px; }
.method-row.selected {
  border-color: var(--thai-red);
  background: linear-gradient(135deg, #FFF5F5, #FFFAFA);
  box-shadow: var(--shadow-red);
}

.status-line {
  display: flex; align-items: center; gap: 10px;
  padding: 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  margin: 10px 0;
}
.status-line.pending { background: #FFFBEB; color: #92400E; }
.status-line.ok { background: #DCFCE7; color: #166534; }
.status-line.err { background: #FEE2E2; color: #991B1B; }
.status-line .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.2s infinite;
}
.status-line.ok .dot, .status-line.err .dot { animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: 0.3; transform: scale(0.85);} }

.wallet-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--deep-navy);
  color: #fff;
  font-size: 11px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  margin-left: 6px;
}
.wallet-pill.disconnected { background: var(--line-strong); color: var(--muted); }

/* ============= AUTH (welcome / login / register) ============= */
.welcome-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 56px;
  position: relative;
}
.welcome-hero {
  text-align: center;
  padding: 32px 12px 8px;
}
.welcome-logo {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--thai-red);
  margin-bottom: 6px;
}
.welcome-tag {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.welcome-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg, 16px);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.welcome-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  text-align: center;
}
.welcome-card .btn { margin: 0; }
.welcome-foot {
  text-align: center;
  margin-top: 4px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 0 8px;
}
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.auth-form input {
  width: 100%;
  border: 1px solid var(--line-strong, #d1d5db);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--thai-red);
  box-shadow: 0 0 0 3px rgba(192, 0, 0, 0.12);
}
.auth-hint {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.auth-error {
  background: #FFF5F5;
  border: 1px solid rgba(239,68,68,0.35);
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: center;
}
.auth-form .btn { margin: 4px 0 0; }

/* ============================================================
   BRIGHT PREMIUM THEME OVERRIDES
   Layered on top of the original system: warm ivory surfaces,
   gold filigree, ruby accents, deep ink type. Keeps the
   geometry — only flips the palette from royal-dark to
   "white-glove premium".
   ============================================================ */

/* Phone shell — warm ivory with a faint gold-ember radial. */
.phone-shell {
  background:
    radial-gradient(ellipse at top, #FFFAEC 0%, #FBF5E6 55%, #F0E3C2 100%);
}
.phone-shell::before {
  background:
    radial-gradient(circle at 18% 0%, rgba(201,154,44,0.18), transparent 55%),
    radial-gradient(circle at 82% 8%, rgba(190,22,34,0.10), transparent 60%);
}
/* Gold ornament line along the inside edge of the shell. */
.phone-shell::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(201,154,44,0.38);
  border-radius: 28px;
  pointer-events: none;
  z-index: 0;
}
@media (min-width: 600px) {
  body {
    background:
      radial-gradient(circle at 30% 20%, rgba(201,154,44,0.10), transparent 55%),
      linear-gradient(135deg, #F8EDD2 0%, #ECDDB1 100%);
  }
  .phone-shell {
    border: 14px solid #2A1F12;
    box-shadow:
      0 30px 80px rgba(40,28,8,0.35),
      0 0 0 2px rgba(201,154,44,0.45) inset,
      0 0 0 1px rgba(255,255,255,0.6) inset;
  }
}

/* Status bar — deep ink text */
.status-bar { color: var(--ink); }
.signal { color: var(--gold); }

/* Header — gold + ruby logo on cream */
.app-header .logo {
  background: linear-gradient(135deg, var(--thai-red) 0%, var(--gold-dim) 60%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.app-header.sub .title { color: var(--ink); }
.app-header.sub .back, .app-header.sub .spacer { color: var(--thai-red); }
.icon-btn {
  background: rgba(201,154,44,0.10);
  color: var(--ink);
  border: 1px solid rgba(201,154,44,0.30);
}

.avatar {
  background: linear-gradient(135deg, var(--gold), var(--thai-red));
  border-color: rgba(201,154,44,0.50);
}
.avatar-lg {
  background: linear-gradient(135deg, var(--gold), var(--thai-red));
  box-shadow: 0 12px 28px rgba(120,80,10,0.30), inset 0 0 0 4px rgba(255,255,255,0.55);
}

/* Tab bar — frosted ivory glass with gold accent */
.tab-bar {
  background: rgba(255,250,236,0.92);
  border-top: 1px solid rgba(201,154,44,0.30);
  box-shadow: 0 -6px 18px rgba(140,100,20,0.08);
}
.tab-bar .tab { color: var(--muted-2); }
.tab-bar .tab.active {
  color: var(--thai-red);
  background: rgba(190,22,34,0.08);
}
.tab-bar .tab.active::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 30%; right: 30%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  border-radius: 2px;
}

/* Hero banner — bold ruby + gold gradient (intentional rich moment). */
.hero-banner {
  background:
    linear-gradient(135deg, var(--thai-red) 0%, var(--thai-red-bright) 55%, var(--gold-dim) 100%) !important;
  border: 1px solid rgba(201,154,44,0.55);
  box-shadow: 0 14px 30px rgba(160,37,42,0.25), inset 0 0 0 1px rgba(255,255,255,0.20);
  color: #fff;
}
.hero-banner .lottery-pill { color: #fff; border-color: rgba(255,255,255,0.45); background: rgba(255,255,255,0.20); }

/* Generic bright panel skin — used by many components below */
.balance-card,
.howto-card,
.set-card,
.fuse-zone,
.mp-row,
.menu-row,
.lottery-card,
.mode-card,
.lot-chip,
.pack-row,
.calc-card,
.proof-card,
.code-gen-card,
.redeem-card,
.confirm-card,
.stats-summary,
.welcome-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%) !important;
  border: 1px solid rgba(201,154,44,0.30) !important;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(140,100,20,0.10), inset 0 0 0 1px rgba(255,255,255,0.6);
}
/* Two banners that should stay rich + dark for premium contrast */
.tier-banner {
  background: linear-gradient(135deg, var(--deep-navy) 0%, #2A3252 100%) !important;
  border: 1px solid rgba(201,154,44,0.50) !important;
  color: #fff !important;
  box-shadow: 0 14px 30px rgba(26,34,56,0.30);
}
.tier-banner .muted, .tier-banner .tier-desc { color: rgba(255,255,255,0.75) !important; }
.tier-banner .tier-name { color: var(--gold-bright) !important; }
.outcome-banner { color: #fff; }

.balance-card .label, .balance-card .value,
.menu-row, .menu-row span,
.howto-title, .howto-step .step-text,
.set-title,
.lot-name, .lot-meta, .lot-sub, .lot-src,
.mp-row .info .name { color: var(--ink); }
.muted, .muted-2, .small.muted, .howto-step .step-text, .lot-meta { color: var(--muted-2) !important; }

.balance-card.gold,
.mode-card.selected,
.lottery-card.selected,
.pack-row.featured {
  border-color: var(--gold) !important;
  box-shadow: 0 6px 18px rgba(201,154,44,0.22), 0 0 0 1px var(--gold) inset !important;
}

/* Buttons — ruby primary, gold secondary, ink ghost */
.btn-primary {
  background: linear-gradient(180deg, var(--thai-red-bright) 0%, var(--thai-red) 60%, var(--thai-red-deep) 100%);
  color: #FFF6E0;
  border: 1px solid var(--thai-red-deep);
  text-shadow: 0 1px 0 rgba(0,0,0,0.25);
  box-shadow: 0 8px 18px rgba(160,37,42,0.30), inset 0 1px 0 rgba(255,255,255,0.30);
}
.btn-primary:disabled {
  background: linear-gradient(180deg, #E8DDC0 0%, #C9B985 100%);
  color: rgba(60,40,15,0.45);
  border-color: rgba(140,100,20,0.30);
  text-shadow: none;
  box-shadow: none;
}
.btn-secondary {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  color: var(--ink);
  border: 1px solid rgba(201,154,44,0.55);
}
.btn-gold {
  background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold) 55%, var(--gold-dim) 100%);
  color: var(--thai-red-deep);
  border: 1px solid var(--gold-dim);
  text-shadow: 0 1px 0 rgba(255,255,255,0.30);
}
.btn-ghost {
  background: transparent;
  color: var(--thai-red);
  border: 1.5px solid var(--thai-red);
}
.btn-link { color: var(--thai-red); }

/* Info boxes — bright cream/parchment with gold/red accents */
.info-box {
  background: linear-gradient(135deg, #FFFBEB 0%, #FFF4D0 100%);
  border: 1px solid rgba(201,154,44,0.40);
  color: var(--ink);
}
.info-box.gold { background: linear-gradient(135deg, #FFFBEB 0%, #FEF0B5 100%); border-color: rgba(201,154,44,0.55); }
.info-box.red { background: linear-gradient(135deg, #FFF5F5 0%, #FFE9E9 100%); border-color: rgba(220,38,38,0.40); color: var(--ink); }
.warn-box {
  background: linear-gradient(180deg, #FFF5F5 0%, #FFE9E9 100%);
  border: 1px solid rgba(220,38,38,0.40);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 14px;
  margin: 10px 0;
}

/* Number entry pad — dark display + bright keypad (premium combo) */
.number-display {
  background: linear-gradient(180deg, #1A1F2E 0%, #0F1726 100%);
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  text-shadow: 0 0 12px rgba(240,199,94,0.55);
  box-shadow: 0 10px 24px rgba(26,34,56,0.25), inset 0 0 0 1px rgba(255,255,255,0.10);
}
.number-keypad .key {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  color: var(--ink);
  border: 1px solid rgba(201,154,44,0.30);
  box-shadow: 0 2px 6px rgba(140,100,20,0.10);
}
.number-keypad .key:active { transform: scale(0.96); }
.number-keypad .key-ok {
  background: linear-gradient(180deg, var(--thai-red-bright), var(--thai-red));
  color: #FFF6E0;
  border-color: var(--thai-red-deep);
}
.number-keypad .key-fn { color: var(--thai-red); }

/* Confirm + big numbers in ruby-gold */
.big-number, .lock-number, .pickedNumber {
  color: var(--thai-red);
  text-shadow: 0 0 14px rgba(190,22,34,0.20);
}
/* Inside the dark lock-card the big number should stay gold */
.lock-card .lock-number { color: var(--gold-bright); text-shadow: 0 0 30px rgba(240,199,94,0.55); }

/* Risk toggle */
.risk-toggle { background: rgba(201,154,44,0.12); border: 1px solid rgba(201,154,44,0.30); }
.risk-opt { color: var(--muted-2); }
.risk-opt.active {
  background: linear-gradient(180deg, var(--thai-red-bright), var(--thai-red));
  color: #FFF6E0;
}

/* RTP / mode meta strips */
.rtp-strip { color: var(--ink); border: 1px solid rgba(201,154,44,0.30); background: #FFFBEB; border-radius: var(--r-md); padding: 8px 12px; }
.rtp-strip b { color: var(--thai-red); }

/* Lottery strip chips on home */
.lot-chip {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  color: var(--ink);
  border: 1px solid rgba(201,154,44,0.30);
}
.lot-chip.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 6px 14px rgba(201,154,44,0.25);
}
.lc-name { color: var(--ink); }
.lc-meta { color: var(--muted-2); }

/* Album rarity legend + chips */
.rarity-legend, .chip-row .chip {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  color: var(--ink);
  border: 1px solid rgba(201,154,44,0.30);
}
.chip-row .chip.active {
  background: linear-gradient(180deg, var(--thai-red-bright), var(--thai-red));
  color: #FFF6E0;
  border-color: var(--thai-red-deep);
}

/* Progress bars */
.progress { background: rgba(201,154,44,0.20); }
.progress .fill {
  background: linear-gradient(90deg, var(--thai-red), var(--gold));
}

/* Modal sheet */
#modal-root { background: rgba(40,28,8,0.45); }
.modal-sheet {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  color: var(--ink);
  border-top: 1px solid var(--gold);
  box-shadow: 0 -16px 40px rgba(40,28,8,0.30);
}
.modal-sheet h3 { color: var(--ink); }
.modal-sheet .sub, .modal-sheet .row .k { color: var(--muted-2); }

/* Toasts */
.toast {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  color: var(--ink);
  border: 1px solid rgba(201,154,44,0.45);
  box-shadow: 0 6px 18px rgba(140,100,20,0.18);
}
.toast.ok { border-color: rgba(14,159,110,0.55); }
.toast.err { border-color: rgba(220,38,38,0.55); }
.toast.gold { border-color: var(--gold); }

/* Inputs — clean white with gold focus */
.auth-form input,
.redeem-input,
.cg-row input,
.cg-row select,
#owner-target,
#calc-bet-pc,
#calc-cap,
#calc-topup {
  background: #FFFFFF;
  color: var(--ink);
  border: 1px solid rgba(201,154,44,0.45);
}
.auth-form input::placeholder,
.redeem-input::placeholder,
.cg-row input::placeholder { color: rgba(60,40,15,0.40); }
.auth-form input:focus,
.redeem-input:focus,
.cg-row input:focus {
  border-color: var(--thai-red);
  box-shadow: 0 0 0 3px rgba(190,22,34,0.12);
  outline: none;
}
.auth-label { color: var(--ink); }
.auth-hint { color: var(--muted-2); }
.auth-error {
  background: linear-gradient(135deg, #FFF5F5 0%, #FFE9E9 100%);
  border-color: rgba(220,38,38,0.50);
  color: #991B1B;
}

/* Welcome */
.welcome-logo {
  background: linear-gradient(135deg, var(--thai-red) 0%, var(--gold) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome-tag, .welcome-foot { color: var(--muted-2); }
.welcome-card-title { color: var(--ink); }


/* Wallet pill */
.wallet-pill {
  background: rgba(255,255,255,0.85);
  color: var(--thai-red);
  border: 1px solid rgba(201,154,44,0.45);
}
.wallet-pill.disconnected { color: var(--muted-2); border-color: rgba(201,154,44,0.30); }

/* Empty states / muted text helpers used by the new feed/market */
.empty { color: var(--muted-2); text-align: center; padding: 18px 8px; }

/* Headings/block labels in muted gold */
.block-label { color: var(--gold-dim); }
.center { color: var(--ink); }
.center.muted { color: var(--muted-2); }

/* Logout danger row stays red */
.menu-row.danger { color: var(--thai-red); }
.menu-row.danger:hover { background: rgba(190,22,34,0.06); }

/* ============= DREAM INTERPRETER ============= */
.dream-body { padding-bottom: 60px; }

/* Hero */
.dream-hero { text-align: center; margin: 6px 0 18px; }
.dream-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.4em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.dream-eyebrow-dot {
  display: inline-block;
  width: 4px; height: 4px;
  background: var(--thai-red-bright);
  border-radius: 50%;
  margin: 0 10px;
  vertical-align: middle;
  box-shadow: 0 0 6px var(--thai-red-bright);
}
.dream-title-big {
  font-weight: 800;
  font-size: clamp(36px, 9vw, 64px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink) 35%, var(--gold) 85%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dream-tagline {
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin: 0;
}
.dream-sep { color: var(--gold); margin: 0 8px; }

/* Input card */
.dream-input-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  border: 1px solid rgba(201,154,44,0.35);
  border-radius: 16px;
  padding: 20px 18px;
  margin-bottom: 18px;
  position: relative;
  box-shadow: 0 8px 24px rgba(140,100,20,0.12), inset 0 0 0 1px rgba(255,255,255,0.6);
}
.dream-input-card::before, .dream-input-card::after {
  content: ''; position: absolute;
  width: 18px; height: 18px;
  border: 1.5px solid var(--gold);
  opacity: 0.65;
}
.dream-input-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.dream-input-card::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.dream-input-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--gold-dim);
  margin-bottom: 10px;
}
#dream-input {
  width: 100%;
  min-height: 110px;
  background: #FFFFFF;
  border: 1px solid rgba(201,154,44,0.40);
  border-radius: 10px;
  padding: 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  resize: vertical;
  line-height: 1.55;
}
#dream-input:focus {
  outline: none;
  border-color: var(--thai-red);
  box-shadow: 0 0 0 3px rgba(190,22,34,0.12);
}
#dream-input::placeholder { color: rgba(60,40,15,0.40); font-style: italic; }
.dream-input-hint {
  margin: 8px 2px 16px;
  font-style: italic;
  font-size: 12px;
  color: var(--muted-2);
}

/* Risk toggle */
.dream-risk-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dream-risk-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--muted);
}
.dream-risk-toggle { display: flex; gap: 6px; }
.dream-mode-btn {
  padding: 7px 12px;
  background: transparent;
  border: 1px solid rgba(212,175,55,0.30);
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
}
.dream-mode-btn:hover { color: var(--ink); border-color: var(--gold); }
.dream-mode-btn.active {
  background: var(--gold);
  color: var(--thai-red-deep);
  border-color: var(--gold);
}
.dream-mode-btn[data-mode="risk"].active   { background: var(--thai-red-bright); border-color: var(--thai-red-bright); color: #fff; }
.dream-mode-btn[data-mode="allin"].active  { background: var(--thai-red); border-color: var(--thai-red); color: #fff; }

/* Submit button */
.dream-interpret-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold), var(--gold-dim));
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 17px;
  color: var(--thai-red-deep);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.15s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 18px rgba(252,211,77,0.25), inset 0 1px 0 rgba(255,255,255,0.35);
}
.dream-interpret-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(252,211,77,0.40), inset 0 1px 0 rgba(255,255,255,0.35);
}
.dream-interpret-btn:active { transform: translateY(0); }

/* Examples */
.dream-examples {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(212,175,55,0.18);
}
.dream-examples-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--muted-2);
  margin-bottom: 10px;
}
.dream-example-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.dream-example-chip {
  padding: 5px 10px;
  background: rgba(201,154,44,0.10);
  border: 1px solid rgba(201,154,44,0.40);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s ease;
}
.dream-example-chip:hover {
  background: rgba(201,154,44,0.20);
  color: var(--ink);
  border-color: var(--gold);
}

/* Loading */
.dream-loading {
  text-align: center;
  padding: 36px 16px;
}
.dream-spinner {
  width: 48px; height: 48px;
  margin: 0 auto 18px;
  border: 2px solid rgba(212,175,55,0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: dream-spin 1s linear infinite;
}
@keyframes dream-spin { to { transform: rotate(360deg); } }
.dream-loading-text {
  font-style: italic;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.1em;
}

/* Result */
.dream-result { margin: 18px 0; }
.dream-result.active { animation: dream-slide-up 0.6s cubic-bezier(0.2,0.7,0.2,1); }
@keyframes dream-slide-up {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dream-result-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}
.dream-card {
  width: 220px;
  aspect-ratio: 5/7;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 38px rgba(0,0,0,0.55), 0 0 0 1px var(--rc, var(--gold));
}
.dream-card svg.dream-card-svg { display: block; width: 100%; height: 100%; }
.dream-detail-pane {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dream-detail-th {
  font-weight: 800;
  font-size: 22px;
  color: var(--ink);
  margin: 0;
  line-height: 1.15;
  text-align: center;
}
.dream-detail-en {
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin: -4px 0 4px;
  text-align: center;
}
.dream-rarity-stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--rc, var(--gold));
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--rc, var(--gold-dim));
  background: #FFFBEB;
  margin: 0 auto;
}
.dream-rarity-stamp::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--rc, var(--gold));
  box-shadow: 0 0 8px var(--rc, var(--gold));
}
.dream-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.dream-lucky-numbers {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.dream-num-block {
  padding: 12px 18px;
  background: linear-gradient(150deg, var(--gold-bright), var(--gold));
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 26px;
  color: var(--thai-red-deep);
  letter-spacing: 0.1em;
  min-width: 84px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(252,211,77,0.30);
  animation: dream-num-pop 0.55s cubic-bezier(0.2,0.7,0.2,1) backwards;
}
.dream-num-block.three-d {
  background: linear-gradient(150deg, var(--thai-red-bright), var(--thai-red));
  color: #fff;
  box-shadow: 0 4px 16px rgba(244,63,94,0.35);
  animation-delay: 0.15s;
}
.dream-num-block .num-label {
  display: block;
  font-weight: 500;
  font-size: 9px;
  letter-spacing: 0.2em;
  margin-top: 3px;
  opacity: 0.75;
}
@keyframes dream-num-pop {
  from { opacity: 0; transform: scale(0.7) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.dream-interp-box {
  padding: 14px 16px;
  background: linear-gradient(135deg, #FFFBEB 0%, #FFF4D0 100%);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
}
.dream-interp-text {
  font-style: italic;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0;
}
.dream-interp-source {
  display: block;
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted-2);
}
.dream-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.dream-act {
  flex: 1;
  min-width: 88px;
  padding: 11px 14px;
  background: transparent;
  border: 1px solid rgba(212,175,55,0.40);
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
}
.dream-act:hover { border-color: var(--gold-bright); color: var(--gold-bright); }
.dream-act.primary {
  background: var(--thai-red);
  border-color: var(--thai-red);
  color: #fff;
}
.dream-act.primary:hover { background: var(--thai-red-bright); border-color: var(--thai-red-bright); }

/* Album */
.dream-album-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(212,175,55,0.20);
}
.dream-album-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dream-album-title {
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
}
.dream-album-en { font-style: italic; }
.dream-album-count {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.15em;
  padding: 3px 10px;
  border: 1px solid var(--gold);
  border-radius: 4px;
}
.dream-album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.dream-album-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 18px;
  color: var(--muted-2);
  font-style: italic;
}
.dream-album-card {
  cursor: pointer;
  transition: transform 0.25s ease, filter 0.25s ease;
}
.dream-album-card:hover {
  transform: translateY(-3px);
  filter: drop-shadow(0 8px 22px var(--rc, rgba(252,211,77,0.3)));
}
.dream-album-card svg {
  display: block;
  width: 100%;
  aspect-ratio: 5/7;
  border-radius: 10px;
}
.dream-album-meta { margin-top: 6px; padding: 0 2px; }
.dream-album-meta .name {
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dream-album-meta .date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--muted-2);
  letter-spacing: 0.12em;
}

/* ============= ORACLE ============= */
.oracle-list { display: flex; flex-direction: column; gap: 10px; }
.oracle-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-tint) 100%);
  border: 1px solid rgba(212,175,55,0.30);
  border-radius: 14px;
  padding: 14px 16px;
}
.oracle-head { margin-bottom: 8px; }
.oracle-name { font-size: 15px; font-weight: 700; color: var(--gold-bright); }
.oracle-vibe { margin-top: 2px; }
.oracle-hint {
  background: rgba(0,0,0,0.30);
  border-left: 3px solid var(--gold);
  padding: 8px 12px;
  margin: 8px 0;
  font-style: italic;
  font-size: 13px;
  color: var(--ink);
  border-radius: 6px;
}

/* ============= SHRINES ============= */
.shrines-list { display: flex; flex-direction: column; gap: 10px; }
.shrine-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-tint) 100%);
  border: 1px solid rgba(212,175,55,0.30);
  border-radius: 14px;
  padding: 14px 16px;
}
.shrine-name { font-size: 15px; font-weight: 700; color: var(--gold-bright); margin-bottom: 4px; }
.shrine-desc { margin-bottom: 6px; }
.shrine-meta { margin-bottom: 10px; }
.shrine-card .btn { margin: 0; }
.active-buff {
  background: rgba(212,175,55,0.10);
  border: 1px solid rgba(212,175,55,0.30);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--ink);
}

/* ============= SHOP NEW SECTIONS ============= */
.packs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 8px 0 16px;
}
.pack-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-tint) 100%);
  border: 1px solid rgba(212,175,55,0.30);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  position: relative;
}
.pack-card.featured {
  border-color: var(--gold);
  box-shadow: 0 6px 18px rgba(212,175,55,0.22), 0 0 0 1px var(--gold) inset;
}
.pack-badge {
  position: absolute; top: -8px; right: 10px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: var(--thai-red-deep);
  font-size: 10px; font-weight: 800;
  padding: 3px 8px; border-radius: 999px;
}
.pack-name { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.pack-pc {
  font-size: 18px; font-weight: 800; color: var(--gold-bright);
  letter-spacing: 0.5px;
}
.pack-bonus {
  font-size: 11px; color: #10b981; font-weight: 700;
  padding: 2px 6px; border-radius: 6px; background: rgba(16,185,129,0.15);
}
.pack-tag { margin: 6px 0 10px; font-size: 11px; }
.pack-card .btn { width: 100%; }

.season-pass-card {
  background: linear-gradient(135deg, rgba(212,175,55,0.18) 0%, rgba(160,37,42,0.18) 100%);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 16px;
  margin: 8px 0 16px;
  box-shadow: 0 8px 22px rgba(212,175,55,0.20);
}
.pass-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.pass-name { font-size: 16px; font-weight: 800; color: var(--gold-bright); }
.pass-price { font-size: 14px; color: var(--ink); font-weight: 700; }
.pass-perks { list-style: none; padding: 0; margin: 0 0 12px; }
.pass-perks li {
  font-size: 13px; color: var(--ink-soft); padding: 4px 0 4px 20px; position: relative;
}
.pass-perks li::before {
  content: '⚜'; position: absolute; left: 0; color: var(--gold-bright);
}

/* ============================================================
   NEW PAGES — Top-up · Card Guide · QR Exchange · Howto
   Designed to use Tailwind utilities for layout, with
   purpose-built skin classes here for the premium feel.
   ============================================================ */

/* Big balance hero on the top-up page */
.tw-balance-hero {
  background: linear-gradient(135deg, var(--thai-red) 0%, var(--thai-red-bright) 50%, var(--gold-dim) 100%);
  border-radius: var(--r-xl);
  padding: 22px 22px 22px;
  color: #fff;
  text-align: center;
  box-shadow: 0 14px 30px rgba(160,37,42,0.30), inset 0 0 0 1px rgba(255,255,255,0.20);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.tw-balance-hero::before {
  content: '';
  position: absolute;
  inset: -50%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.18), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(252,211,77,0.30), transparent 40%);
  z-index: -1;
}
.tw-balance-eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.90;
}
.tw-balance-value {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -1px;
  margin: 4px 0;
  font-family: 'JetBrains Mono', monospace;
  text-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.tw-balance-rate { font-size: 12px; opacity: 0.85; font-weight: 500; }

/* Rarity info legend (cards-guide page) */
.rarity-info {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  border: 1px solid rgba(201,154,44,0.40);
  border-radius: var(--r-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}
.rarity-info .rarity-name { font-size: 13px; font-weight: 800; }
.rarity-info .rarity-meta { font-size: 10px; color: var(--muted-2); margin-top: 2px; font-weight: 500; }
.rarity-common    { border-color: #C0C0C0; }
.rarity-common    .rarity-name { color: #5B6470; }
.rarity-rare      { border-color: #4A90E2; }
.rarity-rare      .rarity-name { color: #1F4E79; }
.rarity-epic      { border-color: var(--thai-red); }
.rarity-epic      .rarity-name { color: var(--thai-red); }
.rarity-legendary { border-color: var(--gold); box-shadow: 0 0 14px rgba(201,154,44,0.30); }
.rarity-legendary .rarity-name { color: var(--gold-dim); }
.rarity-secret    {
  border-color: var(--gold);
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF0B5 100%);
  box-shadow: 0 0 18px rgba(201,154,44,0.45);
}
.rarity-secret    .rarity-name { color: var(--thai-red-deep); }

/* Card catalog tiles */
.cg-card-tile {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  border: 1px solid rgba(201,154,44,0.30);
  border-radius: var(--r-md);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .12s ease, box-shadow .15s ease;
  box-shadow: 0 4px 10px rgba(140,100,20,0.08);
}
.cg-card-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(140,100,20,0.18); }
.cg-card-tile .card-thumb { width: 100%; }
.cg-card-info { display: flex; flex-direction: column; gap: 2px; }
.cg-card-name { font-size: 13px; font-weight: 800; color: var(--ink); line-height: 1.25; }
.cg-card-id { font-size: 10px; }
.cg-card-value { font-size: 11px; color: var(--thai-red); font-weight: 700; margin-top: 2px; }
.cg-card-howto { font-size: 10px; line-height: 1.35; margin-top: 2px; }
.cg-card-owned { font-size: 10px; font-weight: 700; margin-top: 4px; }
.cg-card-owned.ok { color: var(--success); }

/* QR exchange hub action cards */
.qr-action-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  border: 1.5px solid rgba(201,154,44,0.50);
  border-radius: var(--r-lg);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 6px 14px rgba(140,100,20,0.10);
}
.qr-action-card:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 10px 24px rgba(140,100,20,0.20); }
.qr-action-card:active { transform: scale(0.98); }
.qr-action-title { font-size: 16px; font-weight: 800; color: var(--ink); }
.qr-action-sub { font-size: 11px; color: var(--muted-2); line-height: 1.4; }

/* QR send pool */
.qr-pool-tile { position: relative; }
.qr-pool-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--thai-red);
  color: #FFF6E0;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  box-shadow: 0 2px 6px rgba(160,37,42,0.30);
  z-index: 2;
}

/* QR display card (the big QR shown to the receiver) */
.qr-display-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  border: 1.5px solid var(--gold);
  border-radius: var(--r-lg);
  padding: 18px;
  text-align: center;
  margin: 14px 0;
  box-shadow: 0 12px 28px rgba(140,100,20,0.18);
}
.qr-card-preview { display: flex; justify-content: center; margin-bottom: 14px; }
.qr-card-preview .card-thumb { width: 140px; }
.qr-canvas-wrap {
  background: #FFFFFF;
  border: 1px solid rgba(201,154,44,0.40);
  border-radius: var(--r-sm);
  padding: 12px;
  display: inline-block;
  box-shadow: 0 4px 12px rgba(140,100,20,0.10);
}
.qr-canvas-wrap img { display: block; image-rendering: pixelated; }
.qr-code-text { font-size: 10px; color: var(--muted-2); letter-spacing: 2px; margin-top: 14px; text-transform: uppercase; font-weight: 700; }
.qr-code-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink);
  word-break: break-all;
  background: rgba(201,154,44,0.10);
  border: 1px dashed var(--gold-dim);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  margin: 6px 0 10px;
  user-select: all;
}

/* QR scan area */
.qr-scan-frame {
  position: relative;
  background: #1A1F2E;
  border: 1.5px solid var(--gold);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin: 10px 0;
  aspect-ratio: 4/3;
}
.qr-scan-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qr-scan-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  text-align: center;
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 600;
  background: rgba(0,0,0,0.55);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  letter-spacing: 0.5px;
}

/* Howto section */
.howto-section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--thai-red);
  margin: 22px 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gold);
  letter-spacing: -0.3px;
}
.howto-subsection {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-dim);
  margin: 16px 0 8px;
}
.howto-paragraph {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 10px;
}
.howto-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.howto-list li {
  font-size: 13px;
  color: var(--ink);
  padding: 6px 0;
  line-height: 1.6;
  border-bottom: 1px dashed rgba(201,154,44,0.20);
}
.howto-list li:last-child { border-bottom: none; }

/* Primary-emphasised menu row (in profile) */
.menu-row.primary {
  background: linear-gradient(135deg, var(--thai-red) 0%, var(--thai-red-bright) 100%) !important;
  color: #FFF6E0 !important;
  border-color: var(--thai-red-deep) !important;
  box-shadow: 0 8px 18px rgba(160,37,42,0.30);
}
.menu-row.primary .muted { color: rgba(255,246,224,0.85) !important; }

/* Make sure all screens fit nicely on small viewports */
@media (max-width: 380px) {
  .app-body { padding: 4px 16px 110px; }
  .tw-balance-value { font-size: 36px; }
  .howto-section-title { font-size: 16px; }
}

/* ============ SERVICES HUB CARDS ============ */
.service-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFF8E2 100%);
  border: 1.5px solid rgba(201,154,44,0.35);
  border-radius: var(--r-lg);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(140,100,20,0.08);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s;
  min-height: 120px;
  justify-content: center;
}
.service-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 10px 22px rgba(140,100,20,0.18);
}
.service-card:active { transform: scale(0.97); }
.service-card .service-emoji {
  font-size: 30px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.10));
}
.service-card .service-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.2px;
}
.service-card .service-sub {
  font-size: 10.5px;
  color: var(--muted-2);
  font-weight: 500;
  line-height: 1.35;
}
.service-card--featured {
  background: linear-gradient(135deg, var(--thai-red) 0%, var(--thai-red-bright) 100%);
  border-color: var(--thai-red-deep);
  color: #FFF6E0;
  box-shadow: 0 10px 22px rgba(160,37,42,0.30);
}
.service-card--featured .service-title { color: #FFF6E0; }
.service-card--featured .service-sub { color: rgba(255,246,224,0.85); }
.service-card--accent {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF0B5 100%);
  border-color: var(--gold);
  box-shadow: 0 10px 22px rgba(201,154,44,0.25);
}

/* Full-width service card (for hero / highlighted single items) */
.service-card--wide {
  width: 100%;
  min-height: 96px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  text-align: left;
  column-gap: 16px;
  row-gap: 2px;
  padding: 18px;
  margin: 0 0 6px;
}
.service-card--wide .service-emoji {
  grid-row: 1 / span 2;
  font-size: 38px;
  margin-bottom: 0;
  align-self: center;
}
.service-card--wide .service-title {
  font-size: 17px;
  align-self: end;
}
.service-card--wide .service-sub {
  font-size: 12px;
  text-align: left;
  align-self: start;
}
/* The grid puts wide-card cross-axis = column 2 — leave grid-cols-2 sibling unaffected */
.grid > .service-card--wide { grid-column: 1 / -1; }

/* ============ LANGUAGE TOGGLE (TH/EN) ============ */
.lang-toggle {
  position: absolute;
  top: 22px;
  right: 22px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF8E2 100%);
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(201,154,44,0.20);
  cursor: pointer;
  z-index: 5;
  letter-spacing: 0.5px;
  transition: transform .12s ease, box-shadow .15s ease;
}
.lang-toggle:active { transform: scale(0.94); }
.lang-toggle:hover { box-shadow: 0 6px 16px rgba(201,154,44,0.32); }
.lang-toggle-flag { font-size: 14px; }
.lang-toggle--header {
  position: static;
  padding: 5px 10px;
  font-size: 11px;
  width: auto;
  align-self: center;
}

/* ============ TOGGLE SWITCH (iOS-style) ============ */
.menu-row--toggle {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 12px;
}
.menu-row--toggle .mr-left {
  flex: 1;
  text-align: left;
  font-weight: 700;
}
.toggle-switch {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #D6CBA8;
  border: 1px solid rgba(140,100,20,0.30);
  transition: background 0.22s ease, border-color 0.22s ease;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.10);
}
.toggle-switch .toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(0,0,0,0.20);
  transition: left 0.22s ease, background 0.22s ease;
}
.toggle-switch.on {
  background: linear-gradient(135deg, var(--success) 0%, #0B8964 100%);
  border-color: #0E7A56;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15), 0 0 0 1px rgba(14,159,110,0.35);
}
.toggle-switch.on .toggle-knob {
  left: 24px;
  background: #FFFFFF;
}
/* Tap feedback */
.menu-row--toggle:active .toggle-knob { transform: scale(0.95); }

/* Tighter sub-headings inside services hub */
[data-screen="services"] .howto-subsection {
  font-size: 13px;
  color: var(--thai-red);
  margin: 18px 0 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 800;
}
[data-screen="services"] .howto-subsection:first-of-type { margin-top: 12px; }
