:root {
  --bg: #08080a;
  --bg2: #0e0e12;
  --card: #16161b;
  --card2: #1e1e25;
  --line: #2a2a33;
  --gold: #e8b844;
  --gold2: #ffd978;
  --gold3: #b8891f;
  --text: #f4f4f6;
  --muted: #8d8d99;
  --ok: #4cc38a;
  --bad: #ef5b5b;
  --warn: #f0b429;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --r: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }
#app { min-height: var(--tg-viewport-stable-height, 100vh); display: flex; flex-direction: column; }
#view {
  flex: 1; padding: calc(14px + var(--safe-t)) 14px calc(var(--nav-h) + var(--safe-b) + 20px);
  max-width: 560px; width: 100%; margin: 0 auto;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- навигация (внизу, под большой палец) ---------- */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  padding: 6px 6px calc(6px + var(--safe-b));
  background: rgba(14, 14, 18, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
#nav button {
  flex: 1; max-width: 110px; background: none; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; font: inherit; font-size: 11px; border-radius: 12px; cursor: pointer;
  transition: color .2s, transform .15s;
}
#nav button svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#nav button:active { transform: scale(.92); }
#nav button.on { color: var(--gold); }
#nav button.on svg { filter: drop-shadow(0 0 6px rgba(232, 184, 68, .55)); }

/* ---------- общие элементы ---------- */
.logo { text-align: center; font-weight: 800; font-size: 22px; letter-spacing: .5px; margin: 2px 0 12px; }
.logo span { background: linear-gradient(135deg, var(--gold), var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { margin: 6px 0 12px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; font-weight: 600; }
.card { background: linear-gradient(180deg, var(--card), #121217); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.muted { color: var(--muted); } .gold { color: var(--gold); } .pos { color: var(--ok); } .neg { color: var(--bad); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.sb { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card2); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-size: 18px; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .12s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn.gold { border: 0; color: #1a1405; background: linear-gradient(135deg, var(--gold), var(--gold2)); box-shadow: 0 6px 20px rgba(232, 184, 68, .25); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 99px; padding: 7px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { color: #1a1405; border-color: transparent; background: linear-gradient(135deg, var(--gold), var(--gold2)); font-weight: 700; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--card2); }
.badge.pending { color: var(--warn); } .badge.approved { color: var(--ok); } .badge.rejected { color: var(--bad); }
.list .item { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.item.click { cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 22px 0; }
.bar { height: 8px; border-radius: 99px; background: var(--card2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--gold3), var(--gold2)); transition: width .25s ease; }

/* ---------- клик ---------- */
.balance { text-align: center; margin: 4px 0 6px; }
.balance small { color: var(--muted); font-size: 13px; letter-spacing: .6px; text-transform: uppercase; }
.balance .num { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; background: linear-gradient(135deg, var(--gold), var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.balance .num.bump { animation: bump .25s ease; }
@keyframes bump { 50% { transform: scale(1.06); } }
.tapzone { position: relative; display: flex; justify-content: center; align-items: center; margin: 14px 0 10px; height: min(300px, 62vw); touch-action: manipulation; }
.tapbtn {
  position: relative; overflow: hidden; width: min(260px, 62vw); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  color: #2a1d03; font-weight: 900; font-size: 54px; letter-spacing: 1px; touch-action: manipulation;
  background: radial-gradient(circle at 35% 28%, #fff1bd 0%, var(--gold2) 22%, var(--gold) 55%, var(--gold3) 100%);
  box-shadow: 0 0 0 10px rgba(232, 184, 68, .08), 0 0 0 22px rgba(232, 184, 68, .04), 0 18px 50px rgba(232, 184, 68, .28), inset 0 -10px 24px rgba(0, 0, 0, .25), inset 0 6px 14px rgba(255, 255, 255, .35);
  transition: transform .08s ease, box-shadow .15s ease, filter .3s;
  animation: idle 3s ease-in-out infinite;
}
.tapbtn::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; border: 2px solid rgba(60, 40, 0, .22); pointer-events: none; }
.tapbtn.press { transform: scale(.94); box-shadow: 0 0 0 14px rgba(232, 184, 68, .14), 0 0 0 30px rgba(232, 184, 68, .05), 0 8px 34px rgba(232, 184, 68, .45), inset 0 -6px 18px rgba(0, 0, 0, .3); }
.tapbtn.off { filter: grayscale(.85) brightness(.55); animation: none; cursor: default; }
@keyframes idle { 50% { box-shadow: 0 0 0 12px rgba(232, 184, 68, .1), 0 0 0 26px rgba(232, 184, 68, .03), 0 18px 60px rgba(232, 184, 68, .36), inset 0 -10px 24px rgba(0, 0, 0, .25), inset 0 6px 14px rgba(255, 255, 255, .35); } }
.ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .55); transform: scale(0); animation: ripple .55s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.float { position: fixed; z-index: 30; pointer-events: none; font-weight: 800; font-size: 22px; color: var(--gold2); text-shadow: 0 2px 10px rgba(0, 0, 0, .7); animation: floatUp .9s ease-out forwards; }
@keyframes floatUp { from { opacity: 1; transform: translate(-50%, 0) scale(.9); } to { opacity: 0; transform: translate(-50%, -90px) scale(1.15); } }
.timer { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; color: var(--gold); }

/* ---------- формы ---------- */
label.f { display: block; color: var(--muted); font-size: 13px; margin: 12px 0 6px; }
.input { width: 100%; background: #0d0d11; border: 1px solid var(--line); color: var(--text); border-radius: 14px; padding: 13px 14px; font: inherit; font-size: 16px; outline: none; transition: border-color .2s; }
.input:focus { border-color: var(--gold); }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; border: 1.5px dashed var(--line); border-radius: 14px; color: var(--muted); cursor: pointer; text-align: center; padding: 10px; }
.drop.has { border-style: solid; border-color: var(--gold3); }
img.shot { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: 12px; background: #0d0d11; border: 1px solid var(--line); }
.note { background: rgba(240, 180, 41, .08); border: 1px solid rgba(240, 180, 41, .3); color: var(--gold2); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin: 10px 0; }
.note.err { background: rgba(239, 91, 91, .08); border-color: rgba(239, 91, 91, .35); color: #ffb0b0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; } .kv span:first-child { color: var(--muted); } .kv span:last-child { text-align: right; word-break: break-all; }

/* ---------- окна и уведомления ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .72); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s; }
.modal[hidden] { display: none; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 16px 14px calc(18px + var(--safe-b)); animation: slideUp .25s ease; }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
#toast { position: fixed; left: 14px; right: 14px; bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 50; max-width: 532px; margin: 0 auto; background: var(--card2); border: 1px solid var(--gold3); border-radius: 14px; padding: 11px 14px; text-align: center; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: none; }
.screen-msg { text-align: center; padding: 18vh 24px 0; color: var(--muted); }
.spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; margin: 30px auto; animation: rot .8s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
