/* mobile-v2.css - phones and tablets (< 900 px): soft rounded shapes everywhere and gentle motion.
   Works with mobile-v2.js (page-enter and tap classes). Loads after topbar.css.
   Rollback: remove its <link> and the mobile-v2.js <script>. Computers (>= 900 px) are not affected. */

@media (max-width: 899px) {
  /* ---------- 1. soft shapes: evenly rounded corners instead of cut or "tail" corners ---------- */
  :root, :root[data-theme] {
    --cut: inset(0 round 18px);
    --cut2: inset(0 round 28px);
    --r-tail: 18px;
    --spring: cubic-bezier(.22, 1.2, .36, 1);
    --soft: cubic-bezier(.2, .7, .2, 1);
  }
  .btn, .btn.sm, .btn.ghost, .btn.danger {
    clip-path: none !important; border-radius: 16px !important;
  }
  .chip, .chip.tg, .chip.lk { border-radius: 999px !important; }
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea {
    border-radius: 14px !important;
  }
  .slot, .mc2, .panel, .stat, .tw, .pm-card, .pst { clip-path: none !important; border-radius: 20px !important; }
  .modal { clip-path: none !important; border-radius: 26px !important; }
  .ddm, .language-menu { clip-path: none !important; border-radius: 16px !important; }
  .language-trigger, .theme-btn { clip-path: none !important; border-radius: 50% !important; }
  .rk { clip-path: none !important; border-radius: 999px !important; }
  .bub { border-radius: 20px 20px 20px 8px !important; clip-path: none !important; }
  .bub.me { border-radius: 20px 20px 8px 20px !important; }
  .ts .lk-row .btn, .lk-up .btn, .pf .btn, .ts .btn { border-radius: 14px !important; }
  .mc2 .tagn, .mc2 .ub { border-radius: 999px !important; }

  /* softer surfaces: a light shadow instead of hard lines */
  .panel, .stat, .pm-card { box-shadow: var(--sh1); border-top-width: 0 !important; }
  .mc2 { box-shadow: var(--sh1); }

  /* ---------- Premium page ---------- */
  .pm-seg { display: flex; width: 100%; max-width: 360px; padding: 4px; gap: 4px; border-radius: 999px; background: var(--s2); box-sizing: border-box; }
  .pm-seg button {
    flex: 1; min-height: 40px; border-radius: 999px; font: 700 14px var(--font-b) !important; letter-spacing: 0 !important;
    text-transform: none !important; transition: background .25s var(--soft), color .25s, box-shadow .25s;
  }
  .pm-seg button.on { background: var(--s1); color: var(--t1); box-shadow: var(--sh1); }
  .pm-grid { gap: 16px; }
  .pm-card { border-radius: 24px !important; padding: 22px 20px 20px !important; overflow: hidden; }
  .pm-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--line); }
  .pm-signature::before { background: linear-gradient(90deg, #B8C0D6, #E4E4EC); }
  .pm-reserve::before { background: linear-gradient(90deg, #E5B94E, #FFD36E); }
  .pm-black::before { background: linear-gradient(90deg, #FFD36E, #F7F7FA); }
  .pm-black { border-radius: 24px !important; }
  .pm-card.cur { box-shadow: 0 0 0 2px var(--acc), var(--sh1) !important; }
  .pm-rib {
    top: 16px !important; right: 16px !important; padding: 4px 12px !important; border-radius: 999px;
    font: 700 12px/1.4 var(--font-b) !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--on-acc) !important;
  }
  .pm-price { font-family: var(--font-d) !important; }
  .pm-list li { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; }
  .pm-list li::before {
    flex: none; width: 20px !important; height: 20px; border-radius: 50%; display: grid !important; place-items: center;
    font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; margin-top: 1px;
  }
  .pm-list li.y::before { background: rgba(42, 140, 130, .14); }
  .pm-list li.n::before { background: var(--s2); color: var(--t3); }
  .pm-card .btn { border-radius: 16px !important; }

  /* ---------- Chat list (chat.js, phones) ---------- */
  #view:has(> .inbox, > .newm) > h2 { margin: 0 0 4px; font: 800 30px/1.15 var(--font-d); }
  #view:has(> .inbox, > .newm) > label {
    display: block; margin: 20px 0 10px; font: 700 13px/1.3 var(--font-b); color: var(--t3); letter-spacing: .02em; text-transform: none;
  }
  /* new matches: portrait cards with a soft coral ring, names centred underneath */
  #view .newm { gap: 12px; padding: 4px 2px 6px; }
  #view .newm button { width: 76px; justify-items: center; gap: 6px; text-align: center; font: 600 12.5px/1.3 var(--font-b); color: var(--t1); }
  #view .newm button .av {
    width: 76px !important; height: 100px !important; padding: 2px; box-sizing: border-box; border: 0 !important; border-radius: 20px !important;
    background: linear-gradient(150deg, var(--acc), #FFB36B) !important; box-shadow: none !important; outline: 0 !important;
  }
  #view .newm button .av img { border-radius: 18px; border: 2px solid var(--bg); box-sizing: border-box; }
  #view .newm button > span { max-width: 76px; }
  #view .newm .nm-pic { width: 76px; height: 100px; border-radius: 20px; }
  /* conversations: round photo, name + plan on one line, time on the right, last message below */
  #view .inbox .li {
    gap: 14px; padding: 12px 6px !important; border-bottom: 0; border-radius: 18px; position: relative;
  }
  #view .inbox .li:hover { padding-left: 6px !important; background: var(--s2); }
  #view .inbox .li + .li::before {
    content: ""; position: absolute; top: 0; left: 74px; right: 6px; height: 1px; background: var(--line);
  }
  #view .inbox .li .av {
    width: 54px !important; height: 54px !important; border-radius: 50% !important; clip-path: none !important; font-size: 22px;
  }
  #view .inbox .li .grow { min-width: 0; display: grid; gap: 3px; }
  #view .inbox .ln1 { align-items: center; }
  #view .inbox .ln1 > b {
    display: inline-flex; align-items: center; gap: 6px; min-width: 0; font: 700 16px/1.25 var(--font-b);
    white-space: nowrap; overflow: hidden;
  }
  #view .inbox .ln1 > b > * { flex: none; }
  #view .inbox .ln1 > .muted { flex: none; font-size: 12px; color: var(--t3); }
  #view .inbox .lm { font-size: 14px; color: var(--t2); }
  #view .inbox .li.unr .ln1 > b, #view .inbox .li.unr .lm { color: var(--t1); font-weight: 700; }
  #view .inbox .ub {
    align-self: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; box-sizing: border-box;
    background: #EF3F5A; color: #fff; font: 700 12px/22px var(--font-b);
  }

  /* ---------- 2. motion ---------- */
  /* page enter: the parts of a page rise in one after the other (only when you switch tabs; see mobile-v2.js) */
  @keyframes mvIn {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to { opacity: 1; transform: none; }
  }
  #view.mv-in > * { animation: mvIn .46s var(--soft) both; }
  #view.mv-in > *:nth-child(2) { animation-delay: .05s; }
  #view.mv-in > *:nth-child(3) { animation-delay: .1s; }
  #view.mv-in > *:nth-child(4) { animation-delay: .15s; }
  #view.mv-in > *:nth-child(n+5) { animation-delay: .2s; }

  /* grids and lists: cards and rows come in one by one */
  #view.mv-in .mgrid > *, #view.mv-in .inbox > *, #view.mv-in .newm > *,
  #view.mv-in .pm-card, #view.mv-in .pf .slot {
    animation: mvIn .5s var(--soft) both;
  }
  #view.mv-in .mgrid > *:nth-child(2), #view.mv-in .inbox > *:nth-child(2),
  #view.mv-in .newm > *:nth-child(2), #view.mv-in .pm-card:nth-child(2), #view.mv-in .pf .slot:nth-child(2) { animation-delay: .06s; }
  #view.mv-in .mgrid > *:nth-child(3), #view.mv-in .inbox > *:nth-child(3),
  #view.mv-in .newm > *:nth-child(3), #view.mv-in .pm-card:nth-child(3), #view.mv-in .pf .slot:nth-child(3) { animation-delay: .12s; }
  #view.mv-in .mgrid > *:nth-child(4), #view.mv-in .inbox > *:nth-child(4),
  #view.mv-in .newm > *:nth-child(4), #view.mv-in .pf .slot:nth-child(4) { animation-delay: .18s; }
  #view.mv-in .mgrid > *:nth-child(n+5), #view.mv-in .inbox > *:nth-child(n+5),
  #view.mv-in .newm > *:nth-child(n+5), #view.mv-in .pf .slot:nth-child(n+5) { animation-delay: .24s; }

  /* press: everything you can tap gives a little squeeze */
  .btn, .chip, .mc2, .slot, .dc-row, .inbox > *, .language-option, .theme-btn, .language-trigger, nav#nav button {
    transition: transform .22s var(--spring), background-color .2s, color .2s, box-shadow .2s;
  }
  .btn:active, .chip:active, .theme-btn:active, .language-trigger:active, .language-option:active { transform: scale(.95); }
  .mc2:active, .slot:active, .dc-row:active, .inbox > *:active { transform: scale(.97); }
  nav#nav button:active { transform: scale(.92); }

  /* menu: the tab you just opened pops its icon once */
  @keyframes mvPop {
    0% { transform: scale(.8); }
    55% { transform: scale(1.16) translateY(-1px); }
    100% { transform: scale(1); }
  }
  nav#nav.mv-tap button.on svg { animation: mvPop .45s var(--spring); }
  @keyframes mvDot { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
  nav#nav .nb { animation: mvDot .4s var(--spring) both; }

  /* pop-ups and sheets slide up softly; the toast springs in */
  .modal-back.on .modal { transform: none; transition: transform .38s var(--spring); }
  .toast.on { transition: opacity .25s, transform .45s var(--spring); }
  .language-menu.open { transition: opacity .18s, transform .3s var(--spring), visibility .18s; }
}

/* profile preview (peek.js): close button as a frosted white circle with a centred X drawn in CSS,
   readable on any photo colour (the dark see-through circle turned muddy on yellow photos) */
#pk .pk-x {
  top: calc(14px + env(safe-area-inset-top, 0px)) !important; right: 14px !important;
  width: 40px !important; height: 40px !important; padding: 0 !important; border: 0 !important; border-radius: 50% !important;
  background: rgba(255, 255, 255, .86) !important; color: #1B1A2E !important; font-size: 0 !important; line-height: 0 !important;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(20, 18, 31, .22), inset 0 0 0 1px rgba(255, 255, 255, .6) !important;
  transition: transform .25s cubic-bezier(.22, 1.2, .36, 1), background .2s !important;
}
#pk .pk-x::before, #pk .pk-x::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 2px; margin: -1px 0 0 -8px;
  border-radius: 1px; background: currentColor;
}
#pk .pk-x::before { transform: rotate(45deg); }
#pk .pk-x::after { transform: rotate(-45deg); }
#pk .pk-x:hover { background: #fff !important; transform: rotate(90deg); }
#pk .pk-x:active { transform: scale(.9); }
#pk .pk-x:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ---------- open conversation on phones (chat.js thread): softer, like a messaging app ---------- */
@media (max-width: 640px) {
  /* more room for the chat: the app header (logo, theme, language, log out) steps aside inside a conversation */
  .wrap:has(#nav):has(.th) > header { display: none !important; }

  /* top: round icon buttons for Back and More, round photo, name and plan on one line */
  .th-h {
    gap: 10px !important; padding: calc(10px + env(safe-area-inset-top, 0px)) 2px 12px !important;
    border-bottom: 0 !important; box-shadow: 0 10px 18px -16px rgba(20, 18, 31, .45);
  }
  .th-h > .btn.ghost, .th-h .dd > .btn {
    position: relative; flex: none; width: 40px !important; height: 40px !important; min-height: 0 !important; padding: 0 !important;
    border-radius: 50% !important; background: var(--s2) !important; color: var(--t1) !important; font-size: 0 !important;
  }
  .th-h > .btn.ghost::before, .th-h .dd > .btn::before {
    content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; background: currentColor;
    -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat;
  }
  .th-h > .btn.ghost { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E"); }
  .th-h .dd > .btn { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='5' cy='12' r='2'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Ccircle cx='19' cy='12' r='2'/%3E%3C/svg%3E"); }
  .th-h > .av { width: 44px !important; height: 44px !important; border-radius: 50% !important; clip-path: none !important; }
  .th-h .grow { min-width: 0; }
  .th-h .grow > b { display: flex; align-items: center; gap: 6px; min-width: 0; font: 700 16px/1.25 var(--font-b); white-space: nowrap; overflow: hidden; }
  .th-h .grow > b > * { flex: none; }
  .th-h .grow > .muted { margin-top: 2px; font-size: 12px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .th-h .ddm { border-radius: 16px !important; overflow: hidden; box-shadow: var(--sh2); }

  /* messages */
  .th-body { padding: 14px 4px 10px !important; gap: 2px !important; }
  .th-body .day {
    padding: 4px 12px; margin: 14px 0 10px !important; border-radius: 999px; background: var(--s2);
    font: 600 11.5px/1.4 var(--font-b) !important; letter-spacing: 0 !important; color: var(--t2) !important;
  }
  .th-body .bub {
    max-width: 78%; padding: 10px 14px !important; font-size: 15px; line-height: 1.45;
    background: var(--s1); box-shadow: 0 1px 2px rgba(20, 18, 31, .06), 0 3px 10px rgba(20, 18, 31, .05);
  }
  .th-body .bub.me { background: var(--acc); box-shadow: 0 4px 12px rgba(255, 107, 94, .25); }
  .th-body .meta3 { margin: 3px 8px 10px !important; font-size: 11px; }

  /* writing: a rounded field and a round send button with a paper plane */
  .th .comp { gap: 8px !important; padding: 8px 0 6px !important; border-top: 0 !important; align-items: flex-end; }
  .th .comp textarea {
    min-height: 46px !important; padding: 12px 18px !important; border-radius: 24px !important;
    background: var(--s1) !important; border: 1.5px solid var(--line) !important; box-shadow: var(--sh1);
  }
  .th .comp textarea:focus { border-color: var(--acc-t) !important; }
  #sb {
    position: relative; flex: none; width: 46px !important; height: 46px !important; min-height: 0 !important; padding: 0 !important;
    border-radius: 50% !important; font-size: 0 !important; background: var(--acc) !important; color: var(--on-acc) !important;
    box-shadow: 0 6px 14px rgba(255, 107, 94, .35); transition: opacity .2s, box-shadow .2s, transform .2s;
  }
  #sb::before {
    content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -9px; background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M3.4 20.4l17.4-7.5c.8-.4.8-1.5 0-1.8L3.4 3.6c-.7-.3-1.4.3-1.2 1l1.9 6.4 8 1-8 1-1.9 6.4c-.2.7.5 1.3 1.2 1z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M3.4 20.4l17.4-7.5c.8-.4.8-1.5 0-1.8L3.4 3.6c-.7-.3-1.4.3-1.2 1l1.9 6.4 8 1-8 1-1.9 6.4c-.2.7.5 1.3 1.2 1z'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  #sb:disabled { opacity: .4; box-shadow: none; }
  .th .qr button { border-radius: 999px !important; padding: 8px 16px !important; background: var(--s1) !important; box-shadow: var(--sh1); }
  .th .newpill { border-radius: 999px !important; box-shadow: var(--sh2); }
}

/* ---------- advertiser page (/ads, ads-page.js) on phones: nothing squeezed side by side ---------- */
@media (max-width: 640px) {
  /* balance card: the amount on its own row, the two buttons side by side under it */
  .adp-bal { display: grid !important; grid-template-columns: 1fr; gap: 14px !important; }
  .adp-bal .grow { min-width: 0; }
  .adp-bal b { display: block; font-size: 32px !important; line-height: 1.15; word-break: break-word; }
  .adp-bal .adp-acts { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  .adp-bal .adp-acts .btn { width: 100% !important; min-height: 48px; }
  /* ad rows: name and numbers on top, the buttons in a row under them */
  .adp-row { display: grid !important; grid-template-columns: 1fr; gap: 10px !important; }
  .adp-row .grow { min-width: 0 !important; }
  .adp-row .adp-acts { display: flex !important; flex-wrap: wrap; gap: 8px; }
  .adp-row .adp-acts .btn { flex: 1 1 auto; min-height: 42px; }
  .adp-nums { display: flex; flex-wrap: wrap; gap: 4px 12px; }
}

/* chat: bubbles that were already on screen do not animate again (mobile-v2.js marks them) */
#tb > .mv-still { animation: none !important; }

@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  #view.mv-in > *, #view.mv-in * , nav#nav.mv-tap button.on svg, nav#nav .nb { animation: none !important; }
  .btn:active, .chip:active, .mc2:active, .slot:active, .dc-row:active, nav#nav button:active { transform: none !important; }
}
/* end of mobile-v2.css */
