    * { box-sizing: border-box; }
    :root {
      --ink: #171717;
      --muted: #717171;
      --line: #ececec;
      --soft: #f5f5f5;
      --blue: #198cff;
      --blue-soft: #e9f4ff;
      --page-background: #fff;
      --safe-top: env(safe-area-inset-top, 0px);
      --topbar-gap: 2px;
      --topbar-inner: 44px;
      --topbar-height: calc(var(--safe-top) + var(--topbar-inner) + var(--topbar-gap) * 2);
    }
    html {
      height: -webkit-fill-available;
    }
    html, body {
      height: 100%;
      min-height: 100dvh;
      min-height: -webkit-fill-available;
      margin: 0;
      background: var(--page-background);
      overflow: hidden;
    }
    html[data-profile-theme="dark"],
    html[data-profile-theme="dark"] body {
      --page-background: #09090B;
      background: var(--page-background);
    }
    /* No double-tap page zoom (pinch still works); taps also fire faster. */
    html { touch-action: manipulation; }
    body {
      color: var(--ink);
      background: var(--page-background);
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }
    button, textarea { font: inherit; }
    button { color: inherit; }
    .app {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      max-height: 100%;
      margin: 0;
      overflow: hidden;
      background: var(--page-background);
      display: flex;
      flex-direction: column;
      transition: none;
    }
    html.is-standalone .app {
      top: var(--app-offset, 0px);
      right: 0;
      bottom: auto;
      left: 0;
      height: var(--app-height, 100%);
      max-height: var(--app-height, 100%);
    }
    /* Keyboard open (keyboard-fit.js): the app fills only the visible area
       above the keyboard, so Safari has nothing to slide. */
    html.is-keyboard-open .app {
      top: var(--app-top, 0px);
      left: var(--app-left, 0px);
      right: auto;
      bottom: auto;
      width: var(--app-width, 100%);
      height: var(--app-height, 100%);
      max-height: var(--app-height, 100%);
    }
    .workspace {
      flex: 1 1 0%;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    .pane-chat {
      flex: 1 1 0%;
      min-height: 0;
      display: flex;
      flex-direction: column;
    }
    .pane-chat .main { flex: 1 1 0%; min-height: 0; }
    /* Thread chrome (moved topbar + soul) sits above .main, outside the
       scrolling conversation. */
    html.is-chat-room-chrome .pane-chat > .chat-room-chrome {
      flex: 0 0 auto;
      min-height: 0;
    }
    html.is-chat-room-chrome .pane-chat > .main.is-chat-room-layout {
      flex: 1 1 0%;
      min-height: 0;
    }
    .pane-home, .pane-circle { display: none; }
    .pane-label { display: none; }
    .pane-main {
      flex: 1 1 0%;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      background: #fff;
    }
    .pane-main .conversation {
      flex: 1 1 0%;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: scroll;
      overflow-anchor: none;
      -webkit-overflow-scrolling: touch;
    }
    /* Only the installed app and an open keyboard need to lock the document.
       Locking a normal Safari tab makes its containing block stop at Safari's
       current toolbar viewport, leaving page background below the shell. */
    @media (max-width: 599px) {
      html.is-standalone,
      html.is-standalone body,
      html.is-keyboard-open,
      html.is-keyboard-open body {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
      }
    }
    .topbar {
      position: relative;
      top: 0;
      transform: none;
      flex-shrink: 0;
      height: var(--topbar-height);
      padding: calc(var(--safe-top) + var(--topbar-gap)) 16px var(--topbar-gap);
      display: grid;
      grid-template-columns: 37px 1fr 37px;
      align-items: center;
      pointer-events: none;
      background: #fff;
    }
    .round {
      width: 48px; height: 48px; border: 0; border-radius: 50%;
      display: grid; place-items: center; background: #fff;
      box-shadow: 0 8px 25px rgba(0,0,0,.08);
      cursor: pointer; transition: transform .15s, background .15s;
    }
    #menuButton, #profileButton {
      position: relative;
      z-index: 41;
      pointer-events: auto;
    }
    #menuButton:not(.is-back) {
      color: #fff;
      background: #4a515b;
      border: 1px solid #4a515b;
      box-shadow: 0 8px 20px rgba(74, 81, 91, .18);
    }
    #profileButton {
      color: #30343a;
      background: #fff;
      border: 1px solid #e8eaed;
      box-shadow: none;
    }
    #menuButton:not(.is-back)::after, #profileButton::after {
      position: absolute; right: -2px; bottom: -2px;
      width: 17px; height: 17px; border: 2px solid #fff; border-radius: 50%;
      display: grid; place-items: center; color: #fff; font-size: 8px; font-weight: 850;
    }
    #menuButton:not(.is-back)::after { display: none; }
    #profileButton::after { content: "♥"; background: #d77b5b; }
    .round:active, .send:active { transform: scale(.94); }
    /* #menuButton just turned from "←" back into "+": no pressed look. */
    .round.is-swapping, .round.is-swapping:active { transform: none; transition: none; }
    .round.is-back { font-size: 27px; font-weight: 400; }
    .title {
      justify-self: center; border: 0; background: transparent; cursor: pointer;
      font-weight: 650; font-size: 17px; display: flex; align-items: center; gap: 7px;
    }
    #titleButton { visibility: hidden; pointer-events: none; }
    .app:has(.is-direct-chat, .soul-summary-bar, .soul-assistant-page) .topbar {
      height: var(--topbar-height);
      padding: calc(var(--safe-top) + var(--topbar-gap)) 16px var(--topbar-gap);
      grid-template-columns: 44px minmax(0, 1fr) 44px;
      border-bottom: 1px solid #eeeeec;
    }
    .app:has(.is-direct-chat, .soul-summary-bar, .soul-assistant-page) #menuButton {
      width: 40px;
      height: 40px;
      box-shadow: none;
      background: transparent;
    }
    .app:has(.is-direct-chat, .soul-summary-bar, .soul-assistant-page) #titleButton {
      max-width: 100%;
      visibility: visible;
      pointer-events: none;
      overflow: hidden;
      justify-self: center;
      font-size: 16px;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .app:has(.is-direct-chat, .soul-summary-bar, .soul-assistant-page) #titleButton .chevron { display: none; }
    .app:has(.is-direct-chat, .soul-summary-bar, .soul-assistant-page) #profileButton {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }
    .app:has(.is-direct-chat, .soul-summary-bar, .soul-assistant-page) #profileButton.is-chat-more {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      color: #30343a;
      background: transparent;
      border: 0;
      box-shadow: none;
      font-size: 22px;
      font-weight: 800;
      letter-spacing: .08em;
    }
    .app:has(.is-direct-chat, .soul-summary-bar, .soul-assistant-page) #profileButton.is-chat-more::after {
      display: none;
    }
    #profileButton.is-chat-more .chat-more-mark {
      font-size: 22px;
      font-weight: 800;
      letter-spacing: .12em;
      line-height: 1;
      transform: translateY(-2px);
    }
    .chevron { width: 8px; height: 8px; border-right: 2px solid #777; border-bottom: 2px solid #777; transform: rotate(45deg) translateY(-2px); }
    .me-label {
      font-size: 14px;
      font-weight: 650;
      letter-spacing: -.2px;
    }
    .identity-label {
      display: block;
      font-size: 9px;
      font-weight: 750;
      line-height: 1.08;
      letter-spacing: -.15px;
      text-align: center;
    }
    .main {
      z-index: 1;
      top: 0;
      transform: none;
      flex: 1 1 0%;
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }
    .conversation.is-click-guarded { pointer-events: none; }
    .conversation.is-scroll-frozen { touch-action: none; overscroll-behavior: none; }
    .conversation.is-scroll-frozen:not(:has(.circle-feed-page)) { overflow: hidden; }
    .app.me-scroll-lock .conversation {
      pointer-events: none;
      overscroll-behavior: none;
      touch-action: none;
    }
    .app.me-scroll-hold > .overlay {
      pointer-events: auto;
    }
    .conversation {
      flex: 1 1 0%;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: scroll;
      padding: 16px 25px 12px;
      scrollbar-width: none;
      display: flex;
      flex-direction: column;
      overflow-anchor: none;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      touch-action: pan-y;
    }
    .conversation.pull-refresh-host { position: relative; }
    .pull-refresh-indicator {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      z-index: 6;
      height: 0;
      margin: 0;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      overflow: hidden;
      pointer-events: none;
      color: #667085;
      font-size: 12px;
      font-weight: 650;
    }
    .conversation.is-pull-active .pull-refresh-indicator,
    .conversation.is-refreshing .pull-refresh-indicator {
      height: var(--pull-offset, 0px);
      padding-bottom: 8px;
    }
    .conversation.is-refreshing .pull-refresh-label::before {
      content: "";
      display: inline-block;
      width: 14px;
      height: 14px;
      margin-right: 7px;
      border: 2px solid #98a2b3;
      border-top-color: #475467;
      border-radius: 50%;
      vertical-align: -2px;
      animation: pull-refresh-spin .7s linear infinite;
    }
    .conversation.is-pull-active:not(:has(.circle-feed-page, .main-meet-page)) > :not(.pull-refresh-indicator),
    .conversation.is-refreshing:not(:has(.circle-feed-page, .main-meet-page)) > :not(.pull-refresh-indicator) {
      transform: translateY(var(--pull-offset, 0px));
    }
    .conversation.is-pull-active:not(:has(.circle-feed-page, .main-meet-page)) > :not(.pull-refresh-indicator) { transition: none; }
    .conversation.is-refreshing:not(:has(.circle-feed-page, .main-meet-page)) > :not(.pull-refresh-indicator),
    .conversation:not(.is-pull-active):not(.is-refreshing):not(:has(.circle-feed-page, .main-meet-page)) > :not(.pull-refresh-indicator) {
      transition: transform .22s ease;
    }
    .conversation:has(.circle-feed-page).is-pull-active,
    .conversation:has(.circle-feed-page).is-refreshing {
      padding-top: 0;
    }
    .conversation:has(.circle-feed-page).is-pull-active .circle-private-feed,
    .conversation:has(.circle-feed-page).is-refreshing .circle-private-feed {
      transform: translateY(var(--pull-offset, 0px));
    }
    .conversation:has(.circle-feed-page).is-pull-active .circle-private-feed { transition: none; }
    .conversation:has(.circle-feed-page).is-refreshing .circle-private-feed,
    .conversation:has(.circle-feed-page):not(.is-pull-active):not(.is-refreshing) .circle-private-feed {
      transition: transform .22s ease;
    }
    .main:has(.circle-feed-page) .conversation .pull-refresh-indicator {
      top: 48px;
    }
    @keyframes pull-refresh-spin { to { transform: rotate(360deg); } }
    .main:has(.circle-feed-page) .conversation .pull-refresh-indicator,
    html.is-desktop-board .pane-circle .pull-refresh-indicator {
      color: #667085;
    }
    .conversation::-webkit-scrollbar { display: none; }
    .empty { margin-top: auto; }
    .empty.feed-empty { margin-top: 0; }
    .feed-home { margin: -8px -13px 0; }
    .feed-tabs {
      position: sticky; top: -16px; z-index: 6; display: grid; grid-template-columns: repeat(3, 1fr);
      padding: 8px 10px 0; margin: 0 -12px 12px; background: rgba(255,255,255,.94);
      border-bottom: 1px solid #eee; backdrop-filter: blur(14px);
    }
    .feed-tab { position: relative; padding: 12px 5px 13px; border: 0; background: transparent; color: #888; font-size: 12px; font-weight: 650; cursor: pointer; }
    .feed-tab.active { color: #171717; }
    .feed-tab.active::after { content: ""; position: absolute; left: 28%; right: 28%; bottom: -1px; height: 3px; border-radius: 3px; background: #171717; }
    .feed-home > .feed-tabs { grid-template-columns: 1fr; }
    .feed-home > .home-tabs {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      column-gap: 8px;
      padding-inline: 14px;
    }
    .feed-home > .home-tabs .feed-tab {
      width: 100%;
      min-width: 0;
      text-align: center;
    }
    .feed-page { display: none; animation: feedSlide .22s ease both; }
    .feed-page.active { display: block; }
    @keyframes feedSlide { from { opacity: .45; transform: translateX(10px); } }
    .scout-bubble { max-width: 92%; padding: 11px 13px; border-radius: 16px 16px 16px 5px; color: #333; background: #fff; font-size: 13px; line-height: 1.45; box-shadow: 0 3px 10px rgba(0,0,0,.045); }
    .for-you-chat { display: grid; gap: 10px; min-height: 510px; align-content: start; padding: 4px 2px 18px; }
    .for-you-time { justify-self: center; color: #aaa; font-size: 10px; }
    .discovery-bubble { max-width: 92%; padding: 13px; border-radius: 18px 18px 18px 6px; background: #f4f6fb; font-size: 13px; line-height: 1.45; }
    .discovery-card { margin-top: 10px; padding: 11px; border: 1px solid #e2e5ef; border-radius: 14px; background: #fff; }
    .discovery-card strong, .discovery-card small { display: block; }
    .discovery-card small { margin-top: 4px; color: #777; }
    .discovery-source { display: inline-block; margin-bottom: 7px; padding: 3px 7px; border-radius: 8px; color: #2471bd; background: #e6f2ff; font-size: 9px; font-weight: 750; letter-spacing: .2px; text-transform: uppercase; }
    .scout-user-bubble { display: none; max-width: 88%; margin: 9px 0 0 auto; padding: 10px 12px; border-radius: 16px 16px 5px 16px; background: #dfeeff; font-size: 13px; line-height: 1.4; }
    .scout-user-bubble.show { display: block; }
    .twin-control-intro { padding: 14px; border-radius: 20px 20px 20px 6px; background: linear-gradient(145deg,#F4F4F5,#f5f1e8); font-size: 14px; line-height: 1.48; }
    .twin-control-intro strong { display: block; margin-bottom: 4px; font-size: 16px; }
    .twin-control-list { display: grid; gap: 10px; }
    .twin-control-card { padding: 13px; border: 1px solid #e4e5e1; border-radius: 19px; background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.035); }
    .twin-control-head { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; }
    .twin-control-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--twin-card-color,#F4F4F5); font-size: 19px; }
    .twin-control-head strong, .twin-control-head small { display: block; }
    .twin-control-head small { margin-top: 3px; color: #777; font-size: 11px; line-height: 1.35; }
    .twin-control-source { display: inline-flex; margin: 10px 0 0; padding: 4px 7px; border-radius: 8px; color: #18181B; background: #F4F4F5; font-size: 9px; font-weight: 800; text-transform: uppercase; }
    .twin-control-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
    .twin-control-actions button { min-height: 35px; padding: 0 11px; border: 0; border-radius: 11px; color: #18181B; background: #F4F4F5; font-size: 11px; font-weight: 750; cursor: pointer; }
    .twin-control-actions button.primary { color: #fff; background: #18181B; }
    .twin-inline-chat { margin-top: 10px; padding: 10px; border-radius: 14px; background: #f5f6f3; }
    .twin-inline-message { max-width: 88%; margin-bottom: 7px; padding: 8px 10px; border-radius: 13px 13px 13px 5px; background: #fff; font-size: 12px; line-height: 1.4; }
    .twin-inline-message.mine { margin-left: auto; border-radius: 13px 13px 5px 13px; color: #fff; background: #18181B; }
    .twin-inline-compose { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
    .twin-inline-compose input { min-width: 0; height: 37px; padding: 0 11px; border: 1px solid #dedfd9; border-radius: 19px; outline: 0; background: #fff; }
    .twin-inline-compose button { height: 37px; padding: 0 12px; border: 0; border-radius: 19px; color: #fff; background: #18181B; font-weight: 750; cursor: pointer; }
    .twin-action-result { padding: 11px 13px; border-radius: 17px 17px 17px 6px; background: #F4F4F5; font-size: 13px; line-height: 1.45; }
    .link-page { padding: 0 2px 18px; }
    .link-page-intro { margin: 0 1px 14px; color: #777; font-size: 13px; line-height: 1.45; }
    .link-alphabet { margin: 0 0 8px; padding: 8px 2px; color: #18181B; font-size: 12px; font-weight: 800; letter-spacing: 1.7px; }
    .link-contact-list { display: grid; gap: 10px; }
    .link-contact { position: relative; width: 100%; min-height: 74px; padding: 11px 13px; border: 1px solid #e6e4dd; border-radius: 19px; display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 12px; align-items: center; background: #fff; text-align: left; cursor: pointer; }
    .link-contact:active { transform: scale(.985); background: #f4f7f5; }
    .link-contact-avatar { width: 48px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(145deg,#7d9e8c,#3f6c58); color: #fff; font-size: 24px; }
    .link-contact strong, .link-contact small { display: block; }
    .link-contact small { margin-top: 3px; color: #79837d; font-size: 11px; }
    .link-hobbies { display: flex; gap: 5px; min-width: 73px; min-height: 34px; justify-content: flex-end; align-items: center; }
    .link-contact small:empty { display: none; }
    .link-contact.recent-chat { border-color: #d9e5df; background: linear-gradient(145deg,#fff,#f7fbf9); }
    .link-contact.recent-chat small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .link-chat-meta { align-self: stretch; display: grid; align-content: center; justify-items: end; gap: 4px; color: #3F3F46; }
    .link-chat-meta time { color: #8b938f; font-size: 9px; font-weight: 700; white-space: nowrap; }
    .link-chat-meta > span { font-size: 20px; line-height: 1; }
    .link-hobby { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: #F4F4F5; font-size: 18px; }
    .link-birthday,
    .link-unread-badge { position: absolute; z-index: 2; top: -7px; right: -6px; min-width: 25px; height: 25px; padding: 0 7px; border: 3px solid #fff; border-radius: 999px; display: grid; place-items: center; background: #ef6459; color: #fff; font-size: 11px; font-weight: 850; box-shadow: 0 3px 9px rgba(169,61,53,.22); }
    .link-unread-badge[hidden] { display: none; }

    /* Admin iframe preview (?adminPreview=): all viewports, including narrow iframe. */
    html.is-admin-preview #authScreen,
    html.is-admin-preview .auth-screen { display: none !important; }
    html.is-admin-preview:not(.is-authed) .app { visibility: visible; pointer-events: auto; }
    html.is-admin-preview .app > :not(#visitorMeDrawer) { display: none !important; }
    html.is-admin-preview #visitorMeDrawer {
      width: 100%;
      box-shadow: none;
      transition: none;
    }
    html.is-admin-preview #visitorMeDrawer .circle-reaction-bar,
    html.is-admin-preview #visitorMeDrawer .circle-comments,
    html.is-admin-preview #visitorMeDrawer .circle-link-request-actions,
    html.is-admin-preview #visitorMeDrawer [data-circle-edit] { pointer-events: none; }
    html.is-admin-preview #visitorMeDrawer .circle-bomb,
    html.is-admin-preview #visitorMeDrawer .circle-comment-compose { display: none; }
    .admin-preview-boot {
      display: grid;
      place-items: center;
      gap: 10px;
      min-height: 40vh;
      padding: 40px 16px;
      color: #8a938e;
      font-size: 13px;
    }
    .admin-preview-boot p { margin: 0; }
    .admin-preview-boot-spinner {
      width: 20px;
      height: 20px;
      border: 2px solid #d8dedb;
      border-top-color: #8a938e;
      border-radius: 50%;
      animation: admin-preview-boot-spin .7s linear infinite;
    }
    @keyframes admin-preview-boot-spin { to { transform: rotate(360deg); } }

    /* Page push (Chats → Circle and back): see slideTo in navigation.js. */
    @keyframes navInRight { from { transform: translateX(100%); } }
    @keyframes navOutLeft { to { transform: translateX(-28%); opacity: .7; } }
    @keyframes navInLeft { from { transform: translateX(-28%); opacity: .7; } }
    @keyframes navOutRight { to { transform: translateX(100%); } }
    html.is-nav-push::view-transition-old(root),
    html.is-nav-push::view-transition-new(root) {
      animation-duration: .34s;
      animation-timing-function: cubic-bezier(.2, .8, .2, 1);
      mix-blend-mode: normal;
    }
    html.is-nav-push::view-transition-old(root) { animation-name: navOutLeft; }
    html.is-nav-push::view-transition-new(root) { animation-name: navInRight; box-shadow: -8px 0 24px rgba(0, 0, 0, .08); }
    html.is-nav-push.is-nav-back::view-transition-old(root) { z-index: 2; animation-name: navOutRight; box-shadow: -8px 0 24px rgba(0, 0, 0, .08); }
    html.is-nav-push.is-nav-back::view-transition-new(root) { animation-name: navInLeft; box-shadow: none; }

/* "New version · Tap to refresh": a pill at the top when a newer version is live. */
.new-version-bar { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 50%; z-index: 9000; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 0; border-radius: 999px; background: #20211f; color: #fff; font: inherit; font-size: 14px; box-shadow: 0 8px 24px rgb(0 0 0 / .18); cursor: pointer; animation: new-version-in .3s cubic-bezier(.2, .8, .2, 1); white-space: nowrap; }
.new-version-bar span { opacity: .75; }
.new-version-bar strong { font-weight: 600; }
@keyframes new-version-in { from { opacity: 0; transform: translate(-50%, -12px); } }
