/* Screens: welcome, connect, home, tariffs, bonus, profile. Values from the prototype; positions that were
   inline style attributes are classes here (CSP has no 'unsafe-inline' for styles). */

/* ---------- welcome ---------- */
/* the art is drawn for a 390px wide, 324px tall frame and scaled to fit (js/screens/welcome.js sets --art-s) */
.w-art{position:relative;height:calc(324px * var(--art-s,1));margin-inline:-20px}
.w-art-in{position:absolute;left:0;top:0;width:calc(100% / var(--art-s,1));height:324px;transform:scale(var(--art-s,1));transform-origin:0 0}
.ring{position:absolute;display:block}
.ring .rot{transform-box:fill-box;transform-origin:center;animation:spin 30s linear infinite}
.ring .rot.rev{animation-direction:reverse;animation-duration:24s}
@keyframes spin{to{transform:rotate(360deg)}}
.ring text{font-family:var(--f);font-weight:600}
.ring-a{left:-34px;top:36px;width:250px;height:250px}
.ring-b{left:176px;top:124px;width:200px;height:200px}
.ring-c{inset:0}
.orb{position:absolute;display:block;filter:blur(.35px)}
.orb-a{left:-7px;top:63px;width:196px;height:196px}
.orb-b{left:193px;top:141px;width:166px;height:166px}
.w-side{position:absolute;right:20px;top:0;text-align:right;font-size:19px;line-height:1.08;letter-spacing:-.02em;font-weight:400}
.w-side span{display:block;color:var(--lilac-ink)}
.w-side span:last-child{color:var(--ink)}
.w-stat{display:flex;align-items:flex-end;justify-content:space-between;gap:12px}
.w-stat small{display:block;font-size:14px;color:var(--mute);margin-bottom:4px}
.w-stat .big{font-size:58px;font-weight:300;letter-spacing:-.05em;line-height:1;color:var(--lilac-deep);white-space:nowrap}
.w-stat .note{font-size:14px;color:var(--mute);text-align:right;line-height:1.4;padding-bottom:6px;white-space:nowrap}
.w-cta{display:flex;align-items:center;gap:6px;margin-top:auto}
.w-cta .btn{flex:1;min-width:0}
.circs{display:flex;flex-shrink:0;border-radius:999px}
.circs .circ{background:var(--paper);transition:background-color .2s,color .2s}
.circs .circ + .circ{margin-left:-13px}
.circs .circ.more{background:var(--ink);color:var(--white);border-color:var(--ink)}
.circs:hover .circ{background:var(--ink);color:var(--white)}

/* ---------- home ---------- */
/* the two narrow cards leave the orb its corner; anchored to the bottom so a taller days card never pushes text under it */
.home-orb{position:absolute;right:-74px;bottom:2px;width:200px;height:200px;pointer-events:none}
/* one primary, full width; the outline secondary of the same height sits below it */
.row2{display:flex;flex-direction:column;gap:8px}
.row2 .btn{height:54px;padding:0 16px}
.row2 .is-primary{order:-1}
/* Home carries two stacked 54px buttons: its rhythm is 4px tighter (gaps 12, card padding 12, 8px clearance over the nav) */
.screen[data-screen="home"]{gap:12px;padding-bottom:calc(var(--nav-h) + var(--nav-b) + 8px + var(--in-b))}
.screen[data-screen="home"] .stack{gap:6px}
.screen[data-screen="home"] .dcard{padding-block:12px;min-height:90px}
.foot-note{display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:14px;line-height:1.2;letter-spacing:-.01em}
.foot-note em{font-style:normal;color:var(--lilac)}
.foot-note em.short{color:var(--lilac);font-weight:600}
.capsule{display:inline-flex;align-items:center;gap:8px;height:44px;padding:0 16px 0 7px;border-radius:999px;background:var(--paper);color:var(--ink);font-size:14px;font-weight:600;flex-shrink:0}
.capsule .cdot{width:30px;height:30px;border-radius:50%;background:var(--ink);color:var(--white);display:grid;place-items:center;font-size:12px;font-weight:700}

/* ---------- connect ---------- */
.platpick{display:flex;align-items:center;justify-content:space-between;gap:12px;height:54px;padding:0 20px;border-radius:999px;background:var(--card);text-align:left;transition:background-color .2s}
.platpick:hover{background:#211E29}
.platpick small{display:block;font-size:12px;color:var(--mute-d)}
.platpick b{font-size:16px;font-weight:500}
.platpick .pp-r{display:flex;gap:6px;align-items:center;font-size:14px;color:var(--lilac)}
.step .app-note{font-size:14px;color:var(--white);min-height:18px}
.step{background:var(--card);border-radius:24px;padding:16px 18px;display:flex;flex-direction:column;gap:8px;position:relative;overflow:hidden;transition:opacity .35s var(--out),width .5s var(--out)}
.step.is-current{width:100%}
.step::before{content:"";position:absolute;inset:0;background:var(--grad-deep);opacity:0;transition:opacity .5s var(--out);z-index:0}
.step > *{position:relative;z-index:1}
.step.is-current::before{opacity:1}
/* locked steps: dimmed by colour, not opacity, so the small label keeps 4.5:1 */
.step.is-locked h3{color:var(--mute-d)}
.step .top{min-height:24px;display:flex;justify-content:space-between;align-items:center;font-size:14px;color:var(--mute-d);transition:color .4s}
.step.is-current .top{color:var(--white)}
.step h3{margin:0;font-size:26px;font-weight:400;letter-spacing:-.035em;line-height:1.05}
.step p{margin:0;font-size:14px;color:var(--mute-d);line-height:1.4;text-wrap:pretty;transition:color .4s}
.step.is-current p{color:var(--white)}
.step .acts{display:grid;grid-template-rows:0fr;transition:grid-template-rows .5s var(--out)}
.step .desc{display:grid;grid-template-rows:0fr;transition:grid-template-rows .5s var(--out),margin-top .5s var(--out);margin-top:-8px}
.step.is-current .desc{grid-template-rows:1fr;margin-top:0}
.step .desc > div{overflow:hidden;min-height:0}
.step.is-current .acts{grid-template-rows:1fr}
.step .acts > div{overflow:hidden;min-height:0}
.step .acts .in{display:flex;flex-direction:column;gap:12px;padding-top:4px}
.step .row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.step .acts .btn{height:44px;padding:0 20px}
.link-sm{font-size:14px;color:var(--white);text-decoration:underline;text-underline-offset:3px;padding:12px 6px;min-height:44px}
.link-sm:disabled{opacity:.4;cursor:default}
.apps{display:grid;grid-template-columns:repeat(var(--n,4),minmax(0,1fr));gap:4px;padding:4px;border-radius:999px;background:rgba(15,13,21,.28)}
.apps button{height:44px;border-radius:999px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;line-height:1.15;font-size:14px;font-weight:500;color:rgba(255,255,255,.85);
  transition:background-color .25s var(--out),color .25s var(--out)}
/* the prototype dimmed "советуем" to .7 opacity; on the gradient that is 3.9:1, so the colour carries the dimming */
.apps button small{font-size:12px;font-weight:500;color:rgba(255,255,255,.82)}
.apps button.is-active small{color:#4A4556}
.apps button:hover{color:var(--white)}
.apps button.is-active{background:var(--paper);color:var(--ink)}
.note-box{font-size:14px;line-height:1.4;color:rgba(255,255,255,.9);background:rgba(15,13,21,.28);border-radius:24px;padding:12px 14px;text-wrap:pretty}
.check{display:flex;align-items:center;gap:10px;font-size:14px;text-align:left;color:var(--white);padding:10px 0;min-height:44px}
.check .bx{width:22px;height:22px;border-radius:7px;border:1.5px solid rgba(255,255,255,.7);display:grid;place-items:center;flex-shrink:0;transition:background-color .2s,border-color .2s}
.check .bx svg{opacity:0;transform:scale(.6);transition:opacity .2s,transform .3s var(--spring)}
.check[aria-checked="true"] .bx{background:var(--white);border-color:var(--white);color:var(--ink)}
.check[aria-checked="true"] .bx svg{opacity:1;transform:none}
.top-r{display:flex;align-items:center;gap:8px}
.picked{font-size:14px;color:var(--paper)}
/* done mark = the selected payment mark (.method .rd) in the same two colours; nothing at all on steps that are not done */
.tick{width:24px;height:24px;border-radius:50%;display:grid;place-items:center;background:var(--lilac);color:var(--ink);transform:scale(.6);opacity:0;
  transition-property:opacity,transform;transition-duration:.3s,.4s;transition-timing-function:var(--out),var(--spring)}
.step.is-done .tick{opacity:1;transform:none}
.help{font-size:14px;color:var(--mute-d);text-align:center}
.help button{color:var(--paper);text-decoration:underline;text-underline-offset:3px;padding:12px 0}

/* ---------- tariffs ---------- */
.t-h{margin:0;font-size:33px;font-weight:400;letter-spacing:-.045em;line-height:1.02;text-wrap:balance}
.t-h em{font-style:normal;color:var(--lilac-deep)}
.t-sub{margin:0;font-size:14px;color:var(--mute);text-wrap:balance}
.tabs{position:relative;display:flex;gap:6px}
.tab{position:relative;z-index:1;height:44px;padding:0 18px;border-radius:999px;border:1.5px solid var(--ink);font-size:16px;font-weight:500;
  transition:color .3s var(--out),border-color .3s var(--out)}
.tab.is-active{color:var(--white);border-color:transparent}
.tabs .ind{position:absolute;left:0;top:0;height:44px;border-radius:999px;background:var(--ink);z-index:0;transition:transform .5s var(--out),width .5s var(--out)}
.chart{background:var(--ink);color:var(--paper);border-radius:24px;padding:16px 18px 12px;position:relative}
.screen[data-screen="tariffs"]{gap:14px}
.chart h4{margin:0;font-size:21px;font-weight:400;letter-spacing:-.03em;line-height:1.1}
.chart h4 em{font-style:normal;color:var(--lilac)}
.bars{display:grid;grid-template-columns:repeat(var(--n,3),1fr);gap:10px;height:var(--bars-h,164px);align-items:end;margin-top:8px;position:relative}
.bar{display:flex;flex-direction:column;align-items:stretch;gap:8px;height:100%;justify-content:flex-end;cursor:pointer}
.bar .col{border-radius:16px;background:transparent;border:1.5px solid var(--line-d);display:flex;flex-direction:column;justify-content:flex-end;align-items:center;padding:0 0 10px;position:relative;
  transform-origin:bottom;transition:background-color .45s var(--out),border-color .45s var(--out),height .6s var(--out)}
.bar:hover .col{border-color:#4A4556}
.bar .col b{font-size:14px;font-weight:500;color:var(--paper);white-space:nowrap;transition:color .4s}
.bar.is-active .col{background:linear-gradient(180deg,#D9C2FB,#A985F2);border-color:transparent}
.bar.is-active .col b{color:var(--ink)}
.bar span{font-size:14px;color:var(--mute-d);text-align:center;transition:color .3s}
.bar.is-active span{color:var(--paper)}
.bar:focus-visible{outline-color:var(--lilac);border-radius:16px}
/* solid tooltip with a tail; --tail is set by placeTip() so the tail points at the bar even when the tip is clamped */
@property --tail{syntax:"<length>";inherits:false;initial-value:50px}
.tip{position:absolute;top:0;left:0;padding:8px 12px;border-radius:14px;background:var(--lilac-2);color:var(--ink);
  font-size:16px;font-weight:600;white-space:nowrap;display:flex;flex-direction:column;gap:2px;transition:transform .55s var(--out),--tail .55s var(--out);z-index:3;pointer-events:none}
.tip small{font-size:12px;font-weight:500;color:#4A4556}
.tip::after{content:"";position:absolute;left:var(--tail,50%);bottom:-5px;width:10px;height:10px;margin-left:-5px;background:inherit;border-radius:0 0 3px 0;transform:rotate(45deg)}
.devrow{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:8px 6px 8px 18px;border:1.5px solid var(--line);border-radius:24px}
.devrow b{font-size:16px;font-weight:500;display:block}
.devrow small{font-size:12px;color:var(--mute);display:block;text-wrap:balance}
.dev-add{height:44px!important;padding:0 16px!important;flex-shrink:0}
.total{display:flex;align-items:center;justify-content:space-between;gap:12px}
.total small{display:block;font-size:12px;color:var(--mute);margin-bottom:4px;white-space:nowrap}
.total .sum{font-size:40px;font-weight:300;letter-spacing:-.05em;line-height:1}
.total .btn{min-width:132px}

/* ---------- bonus ---------- */
.b-mid{display:flex;align-items:center;justify-content:space-between;gap:12px}
.b-bal small{display:block;font-size:14px;color:var(--mute);margin-bottom:4px}
.b-bal .big{font-size:60px;font-weight:300;letter-spacing:-.055em;line-height:1;color:var(--lilac-deep)}
.b-bal .big small{display:inline;font-size:.5em;letter-spacing:-.02em;margin-left:6px;color:inherit}
.prog{margin-top:12px;height:6px;border-radius:6px;background:var(--paper-2);overflow:hidden;width:180px}
.prog i{display:block;height:100%;border-radius:6px;background:var(--grad);transform-origin:left;width:0}
.prog-l{font-size:12px;color:var(--mute);margin-top:8px;max-width:200px;text-wrap:pretty}
.wd-btn{margin-top:10px;height:44px;padding:0 18px}
.badge{position:relative;width:150px;height:150px;flex-shrink:0}
.badge .c{position:absolute;inset:0;display:grid;place-items:center;font-size:34px;font-weight:300;letter-spacing:-.05em}
.levels{display:flex;flex-direction:column;gap:6px}
.lvl{display:flex;align-items:center;justify-content:space-between;height:54px;border:1.5px solid var(--line);border-radius:999px;padding:0 5px 0 20px}
.lvl b{font-size:16px;font-weight:500}
.lvl small{font-size:14px;color:var(--mute);margin-left:8px}
.lvl .pct{height:44px;min-width:66px;padding:0 14px;border-radius:999px;display:grid;place-items:center;font-size:16px;font-weight:600}
.ref{display:flex;align-items:center;gap:6px;padding:6px 6px 6px 18px;background:var(--ink);color:var(--paper);border-radius:999px}
.ref code{flex:1;min-width:0;font-family:var(--mono);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--lilac-2)}
.ref .btn{height:44px;padding:0 18px}
.ex{font-size:12px;color:var(--mute);text-align:center}

/* ---------- profile ---------- */
.who{display:flex;align-items:center;gap:14px}
/* Telegram photo_url when there is one; the letter is the fallback */
.ava{width:52px;height:52px;border-radius:50%;background:var(--card-2);display:grid;place-items:center;font-size:21px;font-weight:600;color:var(--lilac-2);overflow:hidden;flex-shrink:0}
.ava img{width:100%;height:100%;object-fit:cover;display:block;outline:1px solid rgba(255,255,255,.1);outline-offset:-1px;border-radius:50%}
.who > div{min-width:0}
.who b{font-size:22px;font-weight:500;letter-spacing:-.02em;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.who small{font-family:var(--mono);font-size:12px;color:var(--mute-d)}
.who .uname{color:var(--lilac-2)}
.plist{background:var(--card);border-radius:24px;padding:2px 18px}
.plist .r{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:40px;font-size:16px;border-bottom:1px solid #2A2732}
.plist .r:last-child{border-bottom:0}
.plist .r span{color:var(--mute-d)}
.plist .r b{text-align:right}
.sec-t{display:flex;justify-content:space-between;align-items:baseline;padding:0 4px;font-size:16px;font-weight:500;margin:0}
.sec-t small{font-size:14px;color:var(--mute-d);font-weight:400}
.devs{display:flex;flex-direction:column;gap:6px;margin:0;padding:0;list-style:none}
.dev{display:flex;align-items:center;justify-content:space-between;background:var(--card);border-radius:24px;padding:5px 6px 5px 18px;overflow:hidden;min-height:54px}
.dev b{display:block;font-size:16px;font-weight:500}
.dev small{font-size:12px;color:var(--mute-d)}
.dev button{height:44px;padding:0 14px;border-radius:999px;font-size:14px;color:var(--red-d)}
.dev button:hover{background:#2A1A20}
.empty{font-size:14px;color:var(--mute-d);padding:4px;margin:0}
.menu{display:flex;flex-direction:column;gap:6px}
.menu button,.menu a{display:flex;justify-content:space-between;align-items:center;gap:12px;height:54px;padding:0 18px;border-radius:999px;border:1.5px solid var(--line-d);font-size:16px;text-align:left}
.menu button:hover,.menu a:hover{border-color:#4A4556}
.menu small{font-size:14px;color:var(--mute-d)}
.sec-r{display:flex;align-items:center;gap:10px}
.mini{position:relative;height:32px;padding:0 12px;border-radius:999px;border:1.5px solid var(--line-d);font-size:14px;color:var(--paper);transition:border-color .2s}
.mini:hover{border-color:#5A5466}
.mini::after{content:"";position:absolute;inset:-6px 0}
.menu-2{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.menu .stack2{flex-direction:column;align-items:flex-start;justify-content:center;gap:1px;height:54px;border-radius:999px;padding:0 20px}
.menu .stack2 small{font-size:12px}
.menu .tg-l{display:inline-flex;align-items:center;gap:6px}
.menu .tg-l svg{flex-shrink:0}
.docs{display:flex;justify-content:center;gap:4px;font-size:12px;margin-top:-2px}
.menu .docs a{position:relative;color:var(--mute-d);text-decoration:underline;text-underline-offset:3px;padding:0 8px;height:32px;display:inline-flex;align-items:center;border:0;border-radius:999px;font-size:12px}
.menu .docs a::after{content:"";position:absolute;inset:-6px 0}
.menu .docs a:hover{color:var(--paper)}
.menu .danger{border-color:rgba(var(--red-d-a),.45);background:rgba(var(--red-d-a),.08);transition:background-color .2s,border-color .2s}
.menu .danger span{color:var(--red-d);font-weight:600}
.menu .danger small{color:rgba(var(--red-d-a),.85)}
.menu .danger:hover{border-color:var(--red-d);background:rgba(var(--red-d-a),.14)}
.ref.key{background:var(--card)}

/* ---------- small viewports (Telegram on a 360x640 phone, or a half-expanded sheet) ----------
   Same type sizes; the vertical rhythm and the decorative heights give way first. */
@media (max-height:760px){
  :root{--nav-b:12px}
  .screen{gap:12px}
  .screen[data-screen="tariffs"]{gap:10px}
  .bars{--bars-h:128px}
  .chart{padding-top:14px}
  .screen[data-screen="home"]{gap:10px}
  .screen[data-screen="home"] .dcard{min-height:78px;padding-block:10px}
  .screen[data-screen="home"] .dcard .big{font-size:38px}
  .screen[data-screen="profile"]{gap:12px}
  .badge{width:132px;height:132px}
  .b-bal .big{font-size:54px}
}
@media (max-height:680px){
  :root{--nav-b:8px}
  .screen .brand{height:40px}
  .screen[data-screen="home"]{gap:6px}
  .screen[data-screen="home"] .stack{gap:4px}
  .screen[data-screen="home"] .dcard{min-height:62px;padding-block:8px;gap:2px}
  .screen[data-screen="home"] .dcard .big{font-size:32px}
  .home-orb{width:170px;height:170px;right:-64px}
  .row2{gap:6px}
  .row2 .btn{height:48px}
  .step{padding:12px 16px;gap:6px}
  .step h3{font-size:23px}
  .screen[data-screen="connect"]{gap:10px}
  .platpick{height:50px}
  .bars{--bars-h:120px}
  .chart{padding:12px 16px 10px}
  .chart h4{font-size:19px}
  .t-h{font-size:28px}
  .screen[data-screen="tariffs"]{gap:8px}
  .devrow{padding-block:4px}
  .who .ava{width:44px;height:44px}
  .screen[data-screen="profile"]{gap:6px}
  .lvl{height:48px}
  .lvl .pct{height:40px}
  .levels{gap:4px}
  .plist .r{min-height:34px}
  /* menu rows and the device rows keep 44+ px tap targets (the "Отвязать" button stays 44 px) */
  .menu button,.menu a,.menu .stack2{height:46px}
  .dev{min-height:48px;padding-block:2px}
  .dev.sk{height:48px} /* the skeleton row is as tall as the real one: no jump when the list arrives */
}
