@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #0a0e1a;
  --surface: #12172a;
  --surface2: #1a2138;
  --text: #e6eaf2;
  --dim: #8a94b8;
  --border: #26304f;
  --accent: #14f195;
  --accent2: #9945ff;
  --cyan: #00c2ff;
  --amber: #ffb020;
  --danger: #ff5c7a;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* --- Shell gesture lock: the app never scrolls sideways, never swipe-navigates,
       never rubber-bands into the host. Tabs change by tap only. --- */
html, body {
  overscroll-behavior: none;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
/* overflow:clip (not hidden) on body so it does NOT become a scroll
   container — position:sticky (the timer bar) keeps working. */
body { min-height: 100vh; overflow-x: clip; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--cyan); }

#app { max-width: 480px; margin: 0 auto; padding: 0 12px calc(84px + env(safe-area-inset-bottom)); }

/* ---------- Splash ---------- */
.splash { text-align: center; padding: 32px 8px 24px; }
.splash-mascot { width: 150px; border-radius: 28px; box-shadow: 0 0 60px rgba(153,69,255,.35); }
.splash-title { margin-top: 18px; font-size: 34px; font-weight: 800; line-height: 1.05;
  background: linear-gradient(90deg, #14f195, #00c2ff, #9945ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.splash-tag { margin-top: 8px; font-size: 18px; font-weight: 600; color: var(--dim); }
.btn-primary { display: block; width: 100%; margin-top: 22px; padding: 15px; border-radius: 16px;
  background: linear-gradient(90deg, #14f195, #00c2ff); color: #04241a; font-size: 17px; font-weight: 800; }
.btn-ghost { display: block; width: 100%; margin-top: 10px; padding: 13px; border-radius: 16px;
  background: var(--surface2); color: var(--text); font-weight: 700; font-size: 15px; }
.btn-primary.big, .btn-ghost.big { max-width: 340px; margin-left: auto; margin-right: auto; }
.btn-primary.big { margin-top: 26px; }
.splash-id { margin-top: 14px; font-size: 13px; color: var(--dim); }
.splash-foot { margin-top: 22px; font-size: 12px; color: var(--dim); }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 2px 8px; }
.topbar-mascot { width: 40px; height: 40px; border-radius: 12px; }
.topbar-mid { flex: 1; min-width: 0; }
.topbar-name { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 11px; color: var(--dim); }
.topbar-stats { display: flex; gap: 6px; font-weight: 700; font-size: 13px; }
.topbar-stats span { background: var(--surface2); padding: 5px 9px; border-radius: 999px; }

/* ---------- Goal meter ---------- */
.goal-meter { margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }

/* ---------- Promo banner (above the goal meter) ---------- */
#promo-banner { margin-top: 8px; }
.promo-banner { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(90deg, rgba(153,69,255,.25), rgba(0,194,255,.18)); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 14px; color: var(--text); font-size: 14px; font-weight: 800; text-align: left; }
.promo-banner .promo-arrow { color: var(--accent); font-size: 16px; }
.promo-banner-slot { min-height: 48px; }
adsgram-task { display: block; margin-top: 10px; }
.goal-meter .gm-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; }
.goal-meter .gm-head .gm-count { color: var(--accent); font-family: "JetBrains Mono", monospace; }
.goal-bar { margin-top: 7px; height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; }
.goal-bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #14f195, #00c2ff); transition: width .5s ease; }
.goal-meter .gm-sub { margin-top: 6px; font-size: 11px; color: var(--dim); }

/* ---------- Cards / sections ---------- */
.card { margin-top: 12px; background: var(--surface); border-radius: 20px; padding: 14px; }
.card h3 { font-size: 15px; font-weight: 800; }
.section-title { margin-top: 18px; font-size: 20px; font-weight: 800; }
.section-sub { margin-top: 4px; font-size: 13px; color: var(--dim); }
.dim { color: var(--dim); } .small { font-size: 12px; } .center { text-align: center; }
b.green { color: var(--accent); } b.cyan { color: var(--cyan); }

/* ---------- Play tab ---------- */
.mode-row { display: flex; gap: 8px; margin-top: 12px; }
.mode-row button { flex: 1; padding: 10px; border-radius: 999px; background: var(--surface); color: var(--dim); font-weight: 700; font-size: 14px; }
.mode-row button.active { background: linear-gradient(90deg, #9945ff, #00c2ff); color: #fff; }
.reset-line { margin-top: 10px; text-align: center; font-size: 12px; color: var(--dim); font-family: "JetBrains Mono", monospace; }
.ladder { display: flex; gap: 5px; margin-top: 12px; }
.ladder .day { flex: 1; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 7px 2px; font-size: 11px; }
.ladder .day .d { font-weight: 800; font-size: 12px; }
.ladder .day .p { color: var(--amber); font-weight: 700; margin-top: 2px; }
.ladder .day.done { border-color: var(--accent); color: var(--accent); }
.ladder .day.today { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.ladder .day.chest .p { font-size: 15px; }

.pill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px;
  /* Sticky status bar: the countdown stays on screen while the player
     scrolls to the word checklist. Solid background — no bleed-through. */
  position: sticky; top: 0; z-index: 40;
  background: var(--bg); padding: 8px 2px 6px; margin-left: -2px; margin-right: -2px;
  border-bottom: 1px solid var(--border); }
.pill { background: var(--surface2); padding: 6px 13px; border-radius: 999px; font-size: 14px; font-weight: 700; border: 1px solid var(--border); }
.pill.mono { font-family: "JetBrains Mono", monospace; }
.pill.hint { margin-left: auto; background: rgba(0,194,255,.15); color: var(--cyan); border-color: rgba(0,194,255,.4); }
.pill.hint:disabled { opacity: .4; }
.pill.adhint { background: rgba(153,69,255,.16); color: #cf9fff; border-color: rgba(153,69,255,.45); }
.pill.adhint:disabled { opacity: .4; }
.preview-zone { margin-top: 10px; height: 36px; display: flex; align-items: center; justify-content: center; }
.preview-pill { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--accent2); color: #fff; padding: 6px 16px; border-radius: 999px;
  font-family: "JetBrains Mono", monospace; font-size: 14px; font-weight: 700; letter-spacing: .18em;
  box-shadow: 0 4px 18px rgba(153,69,255,.45); }
.preview-hint { background: var(--surface2); color: var(--dim); padding: 4px 12px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--border); }

/* --- THE GRID owns its gesture. touch-action:none + no selection + pointer
       capture (JS) mean a drag can never become a page/host swipe. --- */
.board { margin-top: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 8px; box-shadow: 0 0 40px rgba(153,69,255,.12); }
.grid {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}
.cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 7px;
  font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: clamp(13px, 4.4vw, 20px); color: var(--text); }
.cell.found { background: linear-gradient(90deg, #14f195, #00c2ff); color: #04241a; }
.cell.wrong { background: var(--danger); color: #fff; }
.cell.preview { background: var(--accent2); color: #fff; }
.cell.hintpulse { box-shadow: 0 0 0 2px var(--cyan) inset; animation: pulseHint .9s ease infinite; }
@keyframes pulseHint { 0%,100% { box-shadow: 0 0 0 0 rgba(0,194,255,.7);} 50% { box-shadow: 0 0 0 6px rgba(0,194,255,0);} }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-5px)} 40%{transform:translateX(5px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
.shake { animation: shake .35s ease; }
@keyframes popIn { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pop-in { animation: popIn .25s ease; }

.word-list { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.word-chip { background: var(--surface2); padding: 6px 12px; border-radius: 10px; font-family: "JetBrains Mono", monospace;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.word-chip.found { background: rgba(20,241,149,.15); color: var(--accent); }
.word-chip.found span { text-decoration: line-through; }
.grid-help { margin-top: 8px; text-align: center; font-size: 12px; color: var(--dim); }

.result-box { margin-top: 14px; text-align: center; background: var(--surface); border: 1px solid var(--accent); border-radius: 20px; padding: 18px 14px; }
.result-box .big-score { font-size: 30px; font-weight: 800; color: var(--accent); }

/* ---------- Tasks ---------- */
.task-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; background: var(--surface); border-radius: 16px; padding: 12px; }
.task-row .t-mid { flex: 1; min-width: 0; }
.task-row .t-title { font-weight: 700; font-size: 14px; }
.task-row .t-desc { font-size: 12px; color: var(--dim); }
.task-row .t-pts { font-weight: 800; color: var(--amber); font-size: 13px; white-space: nowrap; flex-shrink: 0; }
/* min-width:0 on the row buttons is load-bearing: in WKWebView a
   <button> flex item's automatic minimum size is its single-line
   max-content (button text doesn't wrap for intrinsic sizing), so
   the long pending label ("Invoice sent — tap to pay in bot chat")
   refused to shrink and crushed .t-mid to ~90px on phone widths.
   With min-width:0 the button shrinks and wraps its label instead,
   and the text column keeps the available width. */
.btn-claim { background: linear-gradient(90deg, #14f195, #00c2ff); color: #04241a; font-weight: 800; padding: 8px 13px; border-radius: 10px; font-size: 13px; min-width: 0; white-space: normal; text-align: center; }
.btn-claim:disabled { background: var(--surface2); color: var(--dim); }
.btn-open { background: var(--surface2); color: var(--text); font-weight: 700; padding: 8px 13px; border-radius: 10px; font-size: 13px; min-width: 0; white-space: normal; text-align: center; }

/* ---------- Wallet ---------- */
.wallet-addr { font-family: "JetBrains Mono", monospace; font-size: 12px; word-break: break-all; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.stat-box { background: var(--surface2); border-radius: 14px; padding: 10px; }
.stat-box .v { font-size: 17px; font-weight: 800; }
.stat-box .k { font-size: 11px; color: var(--dim); margin-top: 2px; }
.ach-row { display: flex; justify-content: space-between; align-items: center; background: var(--surface2); border-radius: 12px; padding: 9px 12px; margin-top: 6px; font-size: 13px; font-weight: 600; }
.msg { margin-top: 10px; padding: 9px 12px; border-radius: 12px; font-size: 13px; }
.msg.ok { background: rgba(20,241,149,.12); color: var(--accent); }
.msg.err { background: rgba(255,92,122,.12); color: var(--danger); }
.warn-line { margin-top: 10px; font-size: 12px; color: var(--amber); }
.input-row { display: flex; gap: 8px; margin-top: 10px; }
.input-row input { flex: 1; min-width: 0; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px;
  padding: 11px; color: var(--text); font-family: "JetBrains Mono", monospace; font-size: 12px; }
.hist-row { display: flex; justify-content: space-between; gap: 8px; background: var(--surface2); border-radius: 12px; padding: 9px 12px; margin-top: 6px; font-size: 13px; }
.hist-row .amt { font-family: "JetBrains Mono", monospace; font-weight: 700; white-space: nowrap; }
.status-pending { color: var(--amber); font-weight: 700; }
.status-accruing { color: var(--dim); font-weight: 700; }
.status-paid { color: var(--accent); font-weight: 700; }
ul.howto { margin: 8px 0 0 18px; font-size: 13px; color: var(--dim); }
ul.howto li { margin-top: 5px; }
ul.howto b { color: var(--text); }

/* ---------- Invite / boards ---------- */
.board-tabs { display: flex; gap: 6px; margin-top: 12px; }
.board-tabs button { flex: 1; padding: 9px 2px; border-radius: 999px; background: var(--surface); color: var(--dim); font-weight: 700; font-size: 13px; }
.board-tabs button.active { background: linear-gradient(90deg, #9945ff, #00c2ff); color: #fff; }
.lb-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 12px; padding: 9px 12px; margin-top: 6px; font-size: 14px; }
.lb-row.me { background: rgba(20,241,149,.13); box-shadow: 0 0 0 1px rgba(20,241,149,.5) inset; }
.lb-row .rank { width: 26px; font-family: "JetBrains Mono", monospace; font-weight: 700; color: var(--dim); }
.lb-row .who { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .val { font-family: "JetBrains Mono", monospace; font-weight: 700; }
.empty-note { margin-top: 14px; background: var(--surface); border-radius: 16px; padding: 16px; text-align: center; font-size: 13px; color: var(--dim); }
.friend-row { display: flex; justify-content: space-between; background: var(--surface2); border-radius: 12px; padding: 8px 12px; margin-top: 6px; font-size: 13px; }

/* ---------- Tab bar (tap only — no swipe navigation anywhere) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: center; gap: 2px;
  background: rgba(10,14,26,.96); border-top: 1px solid var(--border);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.tabbtn { flex: 1; max-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 19px; color: var(--dim); padding: 4px 0; border-radius: 12px; }
.tabbtn span { font-size: 10px; font-weight: 700; }
.tabbtn.active { color: var(--accent); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 99;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.5); }

.privacy-line { text-align:center; font-size:12px; margin:14px 0 84px; }
.privacy-line a { color:#8b93ad; text-decoration: underline; }
