/* ============================================================
   PAYWORTH — liquid green design system
   palette (from reference images):
   pastel green #E2EFD3 · muted green #6B9071 · pine forest #17502F
   olive depth  #535434 · soft sand   #D8D8B6 · fabric yellow #FEEF4C
   ============================================================ */
:root {
  --primary: #6B9071;
  --primary-deep: #17502F;
  --olive: #535434;
  --sand: #D8D8B6;
  --accent: #FEEF4C;
  --danger: #A61330;
  --ok: #2f9e5f;

  --bg-1: #f4faf0;
  --bg-2: #E2EFD3;
  --bg-3: #ffffff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(255, 255, 255, 0.55);
  --border: rgba(23, 80, 47, 0.12);
  --ink: #14261b;
  --ink-2: #4a5c50;
  --shadow: 0 10px 30px rgba(23, 80, 47, 0.10);
  --blur: saturate(140%) blur(14px);
}
[data-theme="dark"] {
  --bg-1: #0a100c;
  --bg-2: #101d15;
  --bg-3: #0d1712;
  --surface: rgba(23, 80, 47, 0.38);
  --surface-2: rgba(23, 80, 47, 0.28);
  --border: rgba(226, 239, 211, 0.14);
  --ink: #E2EFD3;
  --ink-2: #9fb3a4;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --primary: #7fb98a;
  --accent: #FEEF4C;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg-1);
  overflow-x: hidden;
}
/* liquid background */
.liquid { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
  linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%); }
.liquid::before, .liquid::after, .liquid .blob {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55;
}
.liquid::before { width: 60vw; height: 60vw; background: var(--primary);
  top: -20vw; left: -15vw; animation: drift 26s ease-in-out infinite alternate; }
.liquid::after { width: 50vw; height: 50vw; background: var(--primary-deep);
  bottom: -18vw; right: -12vw; opacity: 0.35; animation: drift 32s ease-in-out infinite alternate-reverse; }
.liquid .blob { width: 40vw; height: 40vw; background: var(--sand); opacity: 0.28;
  top: 40%; left: 45%; animation: drift 24s ease-in-out -8s infinite alternate; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(6vw,4vh) scale(1.15); } }
[data-theme="dark"] .liquid::before { opacity: 0.30; }
[data-theme="dark"] .liquid .blob { opacity: 0.16; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 92px; position: relative; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px;
  background: var(--surface); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}
.topbar .logo { font-weight: 800; font-size: 20px; letter-spacing: 0.2px; display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 26px; height: 26px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 900; }
.iconbtn {
  width: 40px; height: 40px; border-radius: 13px; border: 1px solid var(--border);
  background: var(--surface-2); display: grid; place-items: center; cursor: pointer;
  color: var(--ink); transition: transform 0.15s ease, background 0.2s;
}
.iconbtn:active { transform: scale(0.92); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 15px;
  border: 2px solid rgba(255,255,255,0.35);
}

/* ---------- drawer ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(10,20,14,0.45); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: 300px; max-width: 84vw; z-index: 61;
  background: var(--surface); backdrop-filter: var(--blur);
  border-right: 1px solid var(--border);
  transform: translateX(-105%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 4px;
}
.drawer.open, .drawer-mask.open { transform: translateX(0); opacity: 1; pointer-events: auto; }
.drawer .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.drawer .brand .logo-mark { width: 34px; height: 34px; font-size: 17px; }
.drawer .brand b { font-size: 20px; }
.drawer a.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
  transition: background .15s, transform .1s;
}
.drawer a.item:active { transform: scale(0.97); }
.drawer a.item.active { background: linear-gradient(120deg, rgba(107,144,113,0.22), rgba(23,80,47,0.14)); color: var(--primary-deep); }
[data-theme="dark"] .drawer a.item.active { color: var(--ink); }
.drawer a.item .ic { width: 22px; text-align: center; }
.drawer .spacer { flex: 1; }
.drawer .foot { font-size: 12px; color: var(--ink-2); padding: 10px 14px; }

/* ---------- bottom nav ---------- */
.bottomnav {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  width: min(452px, calc(100vw - 20px)); z-index: 50;
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 6px; border-radius: 24px;
  background: var(--surface); backdrop-filter: var(--blur);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink-2); text-decoration: none; font-size: 11px; font-weight: 600;
  padding: 6px 14px; border-radius: 16px; transition: all .18s;
}
.bottomnav a .ic { font-size: 19px; line-height: 1; }
.bottomnav a.active { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-deep)); }

/* ---------- cards & layout ---------- */
main { padding: 16px 16px 0; }
.card {
  background: var(--surface); backdrop-filter: var(--blur);
  border: 1px solid var(--border); border-radius: 22px;
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card h3 { font-size: 16px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.muted { color: var(--ink-2); font-size: 13px; }
.small { font-size: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(107, 144, 113, 0.16); color: var(--primary-deep);
  border: 1px solid rgba(107,144,113,0.25);
}
[data-theme="dark"] .chip { color: var(--ink); }
.chip.gold { background: rgba(254, 239, 76, 0.18); color: #7a6b00; border-color: rgba(160,140,0,0.3); }
[data-theme="dark"] .chip.gold { color: var(--accent); }
.chip.pending { background: rgba(83, 84, 52, 0.14); color: var(--olive); border-color: rgba(83,84,52,0.3); }
[data-theme="dark"] .chip.pending { color: var(--sand); }
.chip.ok { background: rgba(47,158,95,0.14); color: var(--ok); border-color: rgba(47,158,95,0.3); }
.chip.bad { background: rgba(166,19,48,0.12); color: var(--danger); border-color: rgba(166,19,48,0.3); }

/* hero balance */
.hero {
  background: linear-gradient(140deg, var(--primary) 0%, var(--primary-deep) 90%);
  color: #fff; border-radius: 26px; padding: 22px; position: relative; overflow: hidden;
  box-shadow: 0 14px 34px rgba(23,80,47,0.35); margin-bottom: 14px;
}
.hero::after { content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.12); top: -80px; right: -60px; }
.hero .label { font-size: 13px; opacity: 0.85; }
.hero .amount { font-size: 40px; font-weight: 800; letter-spacing: -0.5px; margin: 4px 0 2px; }
.hero .amount sup { font-size: 18px; font-weight: 700; margin-right: 2px; }
.hero .meta { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.hero .meta .pill { background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.22);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }

/* quick tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.tile {
  background: var(--surface); backdrop-filter: var(--blur); border: 1px solid var(--border);
  border-radius: 18px; padding: 14px 8px; text-align: center; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s; text-decoration: none; color: var(--ink);
}
.tile:active { transform: scale(0.94); }
.tile .ic { font-size: 22px; }
.tile .t { font-size: 11.5px; font-weight: 700; margin-top: 6px; color: var(--ink-2); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; font-weight: 800; font-size: 15px;
  border-radius: 16px; padding: 14px 20px; width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff; transition: transform .15s ease, filter .2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { filter: grayscale(0.6) opacity(0.6); cursor: not-allowed; }
.btn.ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); }
.btn.gold { background: linear-gradient(135deg, #f7e96b, #d9c400); color: #3a3200; }
.btn.danger { background: linear-gradient(135deg, #c24b60, var(--danger)); }
.btn.sm { padding: 9px 14px; font-size: 13px; width: auto; border-radius: 12px; }

/* forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 14px 16px; font-size: 15px; border-radius: 15px;
  border: 1.5px solid var(--border); background: var(--surface-2); color: var(--ink);
  outline: none; transition: border .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px rgba(107,144,113,0.15);
}
.field textarea { resize: vertical; min-height: 90px; }
.otp { display: flex; gap: 8px; justify-content: space-between; }
.otp input { text-align: center; font-size: 22px; font-weight: 800; padding: 14px 4px; width: 100%; }

/* list rows */
.list .item-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 6px;
  border-bottom: 1px dashed var(--border);
}
.list .item-row:last-child { border-bottom: none; }
.list .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(107,144,113,0.15); font-size: 17px; flex-shrink: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .grow .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.amount-pos { color: var(--ok); font-weight: 800; font-size: 14px; white-space: nowrap; }
.amount-neg { color: var(--danger); font-weight: 800; font-size: 14px; white-space: nowrap; }

/* task / campaign cards */
.tcard { display: flex; gap: 12px; align-items: flex-start; }
.tcard .thumb { width: 54px; height: 54px; border-radius: 15px; object-fit: cover;
  background: linear-gradient(135deg, var(--sand), var(--primary)); flex-shrink: 0; }
.tcard .thumb.ph { display: grid; place-items: center; font-size: 22px; color: #fff; }
.tcard .body { flex: 1; min-width: 0; }
.tcard .body b { font-size: 15px; }
.tcard .body p { font-size: 12.5px; color: var(--ink-2); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tcard .reward { text-align: right; flex-shrink: 0; }
.tcard .reward b { font-size: 16px; color: var(--ok); display: block; }
.progress { height: 7px; border-radius: 99px; background: rgba(107,144,113,0.18); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--primary-deep)); }

/* membership */
.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tier { border-radius: 20px; padding: 16px; border: 1.5px solid var(--border);
  background: var(--surface-2); position: relative; }
.tier.current { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(107,144,113,0.18); }
.tier .name { font-weight: 800; font-size: 16px; }
.tier .price { font-size: 22px; font-weight: 800; margin: 4px 0 8px; color: var(--primary-deep); }
[data-theme="dark"] .tier .price { color: var(--ink); }
.tier ul { list-style: none; font-size: 12px; color: var(--ink-2); display: grid; gap: 4px; margin-bottom: 10px; }
.tier ul li::before { content: "✓ "; color: var(--primary); font-weight: 800; }
.tier .ribbon { position: absolute; top: -10px; right: 12px; font-size: 10px; font-weight: 800;
  background: var(--accent); color: #544a00; padding: 3px 9px; border-radius: 99px; }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; padding: 40px 24px; max-width: 480px; margin: 0 auto; }
.auth .brandline { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.auth .brandline .logo-mark { width: 44px; height: 44px; font-size: 22px; border-radius: 14px; }
.auth h1 { font-size: 30px; letter-spacing: -0.5px; margin: 18px 0 6px; }
.auth .sub { color: var(--ink-2); font-size: 15px; margin-bottom: 26px; line-height: 1.5; }
.auth .foot { margin-top: auto; text-align: center; color: var(--ink-2); font-size: 13px; padding: 20px 0; }
.auth a { color: var(--primary-deep); font-weight: 700; text-decoration: none; }
[data-theme="dark"] .auth a { color: var(--primary); }
.notice {
  background: rgba(254,239,76,0.14); border: 1px solid rgba(160,140,0,0.3); color: #6b5e00;
  padding: 12px 14px; border-radius: 14px; font-size: 13px; font-weight: 600; margin-bottom: 14px;
}
[data-theme="dark"] .notice { color: var(--accent); }
.codebox { background: var(--surface-2); border: 1.5px dashed var(--primary); border-radius: 14px;
  padding: 14px; text-align: center; margin-bottom: 14px; }
.codebox .c { font-size: 30px; font-weight: 900; letter-spacing: 8px; color: var(--primary-deep); }
[data-theme="dark"] .codebox .c { color: var(--primary); }

/* ---------- games ---------- */
.gsearch { margin-bottom: 12px; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .fchip { padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2);
  cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.filters .fchip.on { background: linear-gradient(135deg, var(--primary), var(--primary-deep)); color: #fff; border-color: transparent; }
.gcard { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 10px;
  background: var(--surface); backdrop-filter: var(--blur); border: 1px solid var(--border);
  border-radius: 18px; cursor: pointer; transition: transform .12s; }
.gcard:active { transform: scale(0.97); }
.gcard .gic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  font-size: 22px; color: #fff; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep)); }
.gcard .body { flex: 1; min-width: 0; }
.gcard .body b { font-size: 14.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard .body .muted { font-size: 11.5px; }
.gcard .go { text-align: right; flex-shrink: 0; }
.gcard .go b { color: var(--ok); font-size: 13.5px; }
.gcard .go .muted { font-size: 10.5px; }
.gcard.locked { opacity: 0.55; }

/* game modal */
.gamewrap { position: fixed; inset: 0; z-index: 100; background: var(--bg-1); display: none; flex-direction: column; }
.gamewrap.open { display: flex; }
.gamewrap .ghead { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.gamewrap .ghead b { font-size: 17px; }
.gamewrap .stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; }
.gamewrap .result { text-align: center; padding: 30px 20px; }
.gamewrap .result .big { font-size: 52px; font-weight: 900; color: var(--primary-deep); }
[data-theme="dark"] .gamewrap .result .big { color: var(--primary); }
canvas.game { border-radius: 20px; background: var(--surface); border: 1px solid var(--border);
  touch-action: manipulation; max-width: 100%; }

/* toasts */
.toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 200;
  display: flex; flex-direction: column; gap: 8px; width: min(430px, 92vw); }
.toast { padding: 13px 18px; border-radius: 16px; font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep)); box-shadow: var(--shadow);
  animation: pop .25s ease; }
.toast.bad { background: linear-gradient(135deg, #c24b60, var(--danger)); }
.toast.gold { background: linear-gradient(135deg, #f7e96b, #d9c400); color: #3a3200; }
@keyframes pop { from { transform: translateY(-14px) scale(0.95); opacity: 0; } }

/* profile sheet */
.sheet-mask { position: fixed; inset: 0; background: rgba(8,16,11,0.5); z-index: 70; opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet { position: fixed; bottom: 0; left: 50%; transform: translate(-50%, 110%); width: min(480px, 100vw);
  z-index: 71; background: var(--surface); backdrop-filter: var(--blur);
  border-radius: 26px 26px 0 0; border: 1px solid var(--border); padding: 22px 20px 30px;
  transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.sheet.open, .sheet-mask.open { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.sheet .grab { width: 44px; height: 5px; border-radius: 99px; background: var(--border); margin: 0 auto 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 12px; text-align: center; }
.stat b { font-size: 17px; display: block; }
.stat span { font-size: 11px; color: var(--ink-2); font-weight: 600; }

/* section headers */
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 10px; }
.sec-head h2 { font-size: 18px; letter-spacing: -0.3px; }
.sec-head a { font-size: 13px; color: var(--primary-deep); font-weight: 700; text-decoration: none; }
[data-theme="dark"] .sec-head a { color: var(--primary); }

/* empty states */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty .ic { font-size: 42px; margin-bottom: 10px; }

/* loading skeleton */
.sk { background: linear-gradient(90deg, var(--surface-2) 25%, rgba(107,144,113,0.10) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- admin ---------- */
.adminwrap { max-width: 1080px; margin: 0 auto; padding: 20px; }
.adminwrap h1 { font-size: 24px; margin-bottom: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.stat-card b { font-size: 24px; display: block; }
.stat-card span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th { text-align: left; color: var(--ink-2); font-size: 12px; padding: 10px 8px; border-bottom: 1px solid var(--border); }
table.grid td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid img.proof { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; cursor: pointer; border: 1px solid var(--border); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.tabs .tab { padding: 9px 18px; border-radius: 13px; font-weight: 700; font-size: 13.5px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); }
.tabs .tab.on { background: linear-gradient(135deg, var(--primary), var(--primary-deep)); color: #fff; border-color: transparent; }
.proof-lightbox { position: fixed; inset: 0; background: rgba(5,10,7,0.85); z-index: 300;
  display: none; place-items: center; cursor: zoom-out; }
.proof-lightbox.open { display: grid; }
.proof-lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 12px; }

@media (min-width: 700px) {
  .auth { justify-content: center; }
}
