/* Neuro Home — the jar ("копилка"). Own drawing and words, Neuro violet. jar.js. */

/* Screen — laid out like a bank's jar (owner 19.11.2026): the jar on its own picture at the top, edge to edge,
   then a white panel with ONE row of actions. The picture is a ready design or the customer's photo (jar-bg.js). */
#jar { background: var(--ground); }
/* #jar is a .screen: absolutely positioned already (never override it, or the screen grows and stops scrolling). */
#jar .jar-top { display: flex; justify-content: space-between; align-items: center; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  position: absolute; left: 0; right: 0; top: 0; z-index: 3; min-height: 64px; pointer-events: none; }
#jar .jar-top > * { pointer-events: auto; }
#jar .jar-glass { background: rgba(255,255,255,.22); color: #fff; border: 1px solid rgba(255,255,255,.35);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
#jarRoot .scroll { position: relative; z-index: 1; }
.jar-scroll { padding-top: 0 !important; }
.jar-hero { position: relative; margin: 0 -20px; padding: calc(72px + env(safe-area-inset-top, 0px)) 20px 46px; text-align: center; color: #fff; overflow: hidden; isolation: isolate; }
.jar-hero-bg { position: absolute; inset: 0; z-index: -1; background: #4520C2; }
.jar-hero-bg > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.jar-hero-photo { position: absolute; inset: 0; background-size: cover; background-repeat: no-repeat; background-position: 50% 50%; }
.jar-hero-dim { position: absolute; inset: 0; background: #0B0B14; opacity: .35; }
/* A soft veil top and bottom so white text reads on any picture; light designs get a stronger one. */
.jar-hero-veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,11,20,.28) 0%, rgba(11,11,20,0) 26%, rgba(11,11,20,0) 62%, rgba(11,11,20,.32) 100%); }
.jar-hero.light .jar-hero-veil { background: linear-gradient(180deg, rgba(11,11,20,.34) 0%, rgba(11,11,20,.12) 30%, rgba(11,11,20,.12) 60%, rgba(11,11,20,.42) 100%); }
.jar-hero-in { position: relative; text-shadow: 0 1px 12px rgba(0,0,0,.25); }
.jar-title { display: inline-block; max-width: 100%; margin: 0; padding: 6px 14px; border-radius: 99px; font-weight: 700; font-size: 15px; color: #fff;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: none; }
.jar-avail { font-size: 48px; font-weight: 800; letter-spacing: -.02em; color: #fff; margin-top: 12px; line-height: 1.05; }
.jar-sub { color: rgba(255,255,255,.88); font-size: 14px; margin: 4px 0 0; }
.jar-art { position: relative; width: 170px; height: 210px; margin: 14px auto 6px; filter: drop-shadow(0 18px 24px rgba(0,0,0,.25)); }
.jar-art svg { position: relative; width: 100%; height: 100%; z-index: 1; }
.jar-falling { position: absolute; left: 50%; top: -10px; width: 34px; height: 12px; margin-left: -17px; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 35% 35%, #FFE7A3, #FFC23D 60%, #E39A0E); opacity: 0; }
.jar-art.drop .jar-falling { animation: jarCoin 1.1s var(--ease) .25s 2 both; }
.jar-art.land svg { animation: jarShake .45s cubic-bezier(.36,.07,.19,.97); transform-origin: 50% 95%; }
.jar-art.land .jar-coins { animation: jarRattle .4s ease-out; }
@keyframes jarShake { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-5deg) translateX(-2px); } 45% { transform: rotate(4deg) translateX(2px); } 70% { transform: rotate(-2deg); } 85% { transform: rotate(1deg); } }
@keyframes jarRattle { 0%,100% { transform: translateY(0); } 25% { transform: translateY(-6px); } 55% { transform: translateY(2px); } 80% { transform: translateY(-1px); } }
@keyframes jarCoin { 0% { opacity: 0; transform: translateY(-40px) rotateX(0); } 15% { opacity: 1; } 80% { opacity: 1; transform: translateY(150px) rotateX(720deg); } 100% { opacity: 0; transform: translateY(160px); } }
@media (prefers-reduced-motion: reduce) { .jar-art.drop .jar-falling, .jar-art.drop svg, .jar-art.land svg, .jar-art.land .jar-coins { animation: none; } }
.jar-progress { height: 8px; border-radius: 99px; background: rgba(255,255,255,.3); margin: 12px auto 8px; max-width: 300px; overflow: hidden; }
.jar-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #FFE7A3, #FFC23D); transition: width .8s var(--ease); min-width: 4px; }
.jar-goal-line { font-size: 13px; color: rgba(255,255,255,.92); margin: 0; font-weight: 600; }
.jar-goal-line b { color: #fff; }
/* The white panel rises over the picture's bottom edge, like a bank card sheet. */
.jar-panel { position: relative; z-index: 2; margin: -26px -20px 0; padding: 18px 20px 16px; background: var(--ground); border-radius: 26px 26px 0 0; }
.jar-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.jar-actions button { background: none; border: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); display: grid; justify-items: center; gap: 7px; cursor: pointer; min-height: 44px; padding: 0; }
.jar-actions button span { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--violet); box-shadow: var(--shadow-1); }
.jar-actions button.ring span { background: var(--violet); color: #fff; box-shadow: var(--shadow-violet, var(--shadow-1)); }
.jar-actions button[data-jar="share"] .ico { transform: rotate(-45deg); }
.jar-actions button.off { color: var(--ink-4); }
.jar-actions button.off span { color: var(--ink-4); background: var(--line-2); box-shadow: none; }
.jar-hint { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--ink-3); }

/* Backgrounds: the picker and the photo frame */
.jar-bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.jar-bg-tile { position: relative; border: 0; padding: 0; background: var(--line-2); border-radius: 16px; overflow: hidden; aspect-ratio: 3 / 4; cursor: pointer; font: inherit; }
.jar-bg-tile > svg, .jar-bg-tile .jar-bg-ph { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background-size: cover; background-position: center; }
.jar-bg-tile small { position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 3px 6px; border-radius: 8px; font-size: 11.5px; font-weight: 700; color: #fff;
  background: rgba(11,11,20,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jar-bg-tile.on { box-shadow: 0 0 0 3px var(--violet), 0 0 0 5px #fff inset; }
.jar-bg-tile.add { background: var(--violet-50); }
.jar-bg-add { position: absolute; inset: 0 0 26px; display: grid; place-items: center; color: var(--violet); }
.jar-bg-add .ico { width: 30px; height: 30px; }
.jar-bg-tile.add small { background: var(--violet); }
.jar-bg-frame { position: relative; margin: 12px 0 14px; border-radius: 20px; overflow: hidden; aspect-ratio: 4 / 3; background: #2A1A66; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.jar-bg-sample { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: grid; justify-items: center; color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,.3); pointer-events: none; }
.jar-bg-sample b { font-size: 40px; font-weight: 800; }
.jar-bg-sample small { font-size: 13px; opacity: .9; }
.jar-bg-dimrow { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-weight: 600; }
.jar-bg-dimrow input { flex: 1; accent-color: var(--violet); }

.jar-sources { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.jar-sources article { background: var(--surface); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow-1); display: grid; gap: 2px; }
.jar-sources b { font-size: 20px; color: var(--ink); margin-top: 6px; }
.jar-sources small { font-weight: 700; color: var(--ink-2); font-size: 13px; }
.jar-sources em { font-style: normal; color: var(--ink-3); font-size: 12px; }
.jar-ico { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 16px; font-weight: 800; flex: none; }
.jar-ico.friends { background: var(--violet-50); color: var(--violet); }
.jar-ico.cashback { background: var(--green-50); color: var(--green-ink); }
.jar-ico.bonus { background: var(--amber-50); color: var(--amber-ink); }
.jar-ico.spent { background: var(--line-2); color: var(--ink-2); }
.jar-ico.wait { background: var(--line-2); }

.jar-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.jar-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.jar-row:last-child { border-bottom: 0; }
.jar-row .grow { flex: 1; min-width: 0; display: grid; }
.jar-row small { color: var(--ink-3); font-size: 12px; }
.jar-row .amt { font-weight: 800; color: var(--green-ink); }
.jar-row .amt.muted { color: var(--ink-4); }
.jar-row .amt.void { color: var(--ink-4); text-decoration: line-through; }
.jar-empty { padding: 16px; color: var(--ink-3); font-size: 14px; }
.jar-how { margin: 0 0 24px; padding: 14px 14px 14px 34px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); color: var(--ink-2); font-size: 14px; display: grid; gap: 8px; }
.jar-loading { display: grid; place-items: center; min-height: 60%; padding: 40px; }

/* Edit sheet */
.jar-name { width: 100%; margin-top: 12px; }
.jar-goals { display: flex; flex-wrap: wrap; gap: 8px; }
.jar-goal.on { background: var(--violet); color: #fff; }

/* Home card */
.jar-home-card { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 12px 14px; border: 0; cursor: pointer; text-align: left; font: inherit;
  border-radius: var(--r-xl); color: #fff; background: linear-gradient(120deg, var(--violet-800), var(--violet) 60%, #8E66FF); box-shadow: var(--shadow-violet); }
.jar-home-card > svg:first-child { width: 46px; height: 60px; flex: none; }
.jar-home-card .grow { flex: 1; display: grid; }
.jar-home-card small { opacity: .85; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.jar-home-card b { font-size: 22px; }
.jar-home-card em { font-style: normal; font-size: 12.5px; opacity: .9; }

/* Wow prompt */
.jar-wow { display: grid; justify-items: center; text-align: center; gap: 10px; padding-top: 4px; }
.jar-wow > svg { width: 96px; height: 126px; background: var(--violet-50); border-radius: 50%; padding: 10px 18px; box-sizing: content-box; }
.jar-wow .btn { width: 100%; }

/* Invite on Welcome */
.jar-invite { display: grid; justify-items: center; text-align: center; gap: 10px; padding-top: 4px; }
.jar-invite > svg { width: 84px; height: 110px; background: var(--violet-50); border-radius: 50%; padding: 10px 16px; box-sizing: content-box; }
.jar-invite .btn { width: 100%; }

/* Story template overlay */
.jar-story { position: absolute; inset: 0; z-index: 60; background: var(--night); color: #fff; display: none; flex-direction: column; padding: 8px 16px 22px; gap: 12px; overflow-y: auto; }
.jar-story.show { display: flex; }
.jar-story-top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; }
.jar-story-top h2 { margin: 0; text-align: center; font-size: 17px; }
.jar-story-top .icon-btn { color: #fff; background: none; }
.jar-seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--night-2); border-radius: 14px; padding: 4px; }
.jar-seg button { border: 0; background: none; color: rgba(255,255,255,.7); font: inherit; font-weight: 700; padding: 10px; border-radius: 10px; min-height: 40px; cursor: pointer; }
.jar-seg button[aria-selected="true"] { background: var(--violet); color: #fff; }
.jar-story-card { position: relative; border-radius: var(--r-2xl); overflow: hidden; aspect-ratio: 9 / 16; max-height: 56vh; align-self: center; width: auto; height: 56vh; box-shadow: 0 20px 50px -18px rgba(0,0,0,.7); }
.jar-story-preview, .jar-story-preview svg { width: 100%; height: 100%; display: block; }
.jar-story-photo { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--night); color: #fff; display: grid; place-items: center; cursor: pointer; }
.jar-dots { display: flex; gap: 10px; justify-content: center; }
.jar-dots button { width: 10px; height: 10px; border-radius: 50%; border: 0; background: rgba(255,255,255,.35); padding: 0; cursor: pointer; }
.jar-dots button.on { background: #fff; transform: scale(1.2); }
.jar-story-link { display: flex; gap: 10px; align-items: center; background: var(--night-2); border-radius: var(--r-md); padding: 10px 12px; }
.jar-story-link small { color: rgba(255,255,255,.65); display: block; font-size: 12px; }
.jar-story-link .link { color: #B9A2FF; font-weight: 700; padding: 2px 0; word-break: break-all; text-align: left; }
.jar-story .btn { margin-top: auto; }

/* Share targets */
.jar-targets { display: grid; margin-top: 8px; }
.jar-targets button, .jar-targets a { text-decoration: none; display: flex; align-items: center; gap: 14px; border: 0; background: none; font: inherit; font-size: 16px; color: var(--ink); padding: 12px 2px; border-bottom: 1px solid var(--line-2); cursor: pointer; text-align: left; min-height: 52px; }
.jar-targets .tg { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 800; }
.tg.ig { background: linear-gradient(45deg, #F9A03F, #D92E7F 55%, #7B3FE4); }
.tg.fb { background: #1877F2; font-family: Georgia, serif; font-size: 20px; }
.tg.sc { background: #FFFC00; }
.tg.mo { background: var(--violet); }
.tg.sv { background: var(--ink-2); }
#jarRoot { overflow: hidden; }
.jar-steps { margin: 8px 0 14px; padding-left: 22px; display: grid; gap: 8px; color: var(--ink-2); font-size: 15px; }
#sheetBody .jar-story-link { background: var(--violet-50); color: var(--violet-800); margin-bottom: 14px; }
#sheetBody .jar-story-link b { word-break: break-all; font-size: 14px; }

/* Top-ups with real money (services/nh-jar-topup.js) — the "top up" link card, top-ups in the history, the donor's gift */
.jar-held { margin: 10px 0 0; font-size: 13px; color: #6b7280; text-align: center; }
.jar-ico.gifts { background: #FFE8EF; }
.jar-note { display: block; font-style: normal; font-size: 13px; color: #374151; margin-top: 3px; }
.jar-targets .tg.tt { background: #111; color: #fff; }
.jar-targets .tg.yt { background: #FF0033; color: #fff; }
.jar-targets .tg.sq { background: #EDE7FF; color: #35189A; }
.jar-gift-badge { width: 96px; height: 96px; border-radius: 30px; margin: 4px auto 10px; background: linear-gradient(150deg, #FFC23D, #FF8A3D); display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 900; color: #fff; box-shadow: 0 10px 24px rgba(255, 138, 61, .35); }

/* Sending the link without a share sheet (app without the share plugin): WhatsApp, Telegram. */
.jar-targets .tg.wa { background: #25D366; }
.jar-targets .tg.tgm { background: #229ED9; }
/* The story picture to press and hold (iOS menu: Save to Photos, Share…). */
.jar-hold-img { display: block; width: 72%; margin: 12px auto 4px; border-radius: 18px; box-shadow: var(--shadow-2);
  -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
/* The owner's video behind the jar (27.11.2026). */
.jar-hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.jar-bg-vhint { margin: 10px 2px 0; font-size: 13px; }
/* The video on its way (28.11.2026): a pill on the jar, so the owner sees something is happening. */
.jar-video-busy { display: inline-block; margin: 0 auto 8px; padding: 6px 12px; border-radius: 999px; background: rgba(11, 11, 20, .55); color: #fff; font-size: 13px; font-weight: 600; animation: jarBusy 1.4s ease-in-out infinite; }
@keyframes jarBusy { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
/* The video story (28.11.2026): a small "▶ Video story" tag on the preview when the jar has an approved video. */
.jar-story-vid { position: absolute; top: 12px; left: 12px; padding: 6px 10px; border-radius: 999px; background: rgba(11,11,20,.72); color: #fff; font-size: 13px; font-weight: 700; pointer-events: none; }
/* The ready video story: small enough that its Share button shows under it without scrolling. */
video.jar-hold-img { width: auto; max-width: 72%; max-height: 52vh; aspect-ratio: 9 / 16; object-fit: cover; background: #0B0B14; }
