/* OYVRA — phone + tablet overlay (loaded last) */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body {
  max-width: 100%;
  overflow-x: clip;
}
img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}
button, a, .btn, .icon-btn, .ob-continue, .dock-more {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* iOS: avoid zoom-on-focus */
@media (max-width: 1100px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* ——— Onboarding ——— */
.ob-shell {
  padding-top: max(22px, env(safe-area-inset-top, 0px));
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.ob-preview-bar {
  flex-wrap: wrap;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
}
.ob-preview-links {
  flex-wrap: wrap;
  margin-left: 0;
}

@media (max-width: 1100px) {
  body.ob-body { min-height: 100dvh; }
  .ob-shell {
    min-height: 100dvh;
    width: 100%;
    max-width: none;
  }
  .ob-visual-copy h1 { font-size: clamp(28px, 6vw, 40px); }
  .ob-card {
    width: 100%;
    max-width: none;
    padding: 22px 18px 20px;
  }
  .ob-card.has-stamp { padding-right: 18px; }
  .ob-card h1 { font-size: clamp(26px, 6vw, 32px); }
  .ob-panel { width: 100%; max-width: none; }
  .ob-media { width: 100%; }
  .ob-blob { width: min(100%, 520px); }
  .ob-interests {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .ob-photos {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ob-photos::-webkit-scrollbar { display: none; }
  .ob-picker-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ob-split { grid-template-columns: 1fr; }
  .ob-choices { grid-template-columns: 1fr; }
  .ob-toggle { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .ob-toggle-copy { min-width: 0; }
  .ob-review-head {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .ob-review-head .ob-edit { grid-column: 2; justify-self: start; }
  .ob-review-list > div {
    grid-template-columns: 22px minmax(0, 1fr) auto;
  }
  .ob-review-list span { overflow-wrap: anywhere; }
  .ob-continue,
  .ob-card .btn-block {
    min-height: 48px;
    width: 100%;
    position: sticky;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 6;
  }
  .ob-check { min-height: 48px; }
  .ob-lang { margin-right: 0; }
}

@media (max-width: 720px) {
  .ob-picker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ob-blob img { height: 200px; object-fit: cover; }
}

@media (max-width: 430px) {
  .ob-shell {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .ob-card { padding: 18px 16px 16px; border-radius: 20px; }
  .ob-brand strong { font-size: 18px; letter-spacing: 0.12em; }
  .ob-comm { grid-template-columns: 1fr; }
  .ob-progress { gap: 4px; }
}

/* ——— Auth ——— */
.auth-shell {
  padding-top: max(18px, env(safe-area-inset-top, 0px));
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
}
@media (max-width: 1100px) {
  .auth-shell,
  .auth-shell--signup,
  .auth-shell--login {
    min-height: 100dvh;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .auth-main,
  .auth-shell--signup .auth-main {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }
  .auth-card,
  .auth-shell--signup .auth-card,
  .auth-form,
  .auth-form .input {
    width: 100%;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
  }
  .auth-form-logo img {
    height: 42px;
    max-width: min(240px, calc(100vw - 148px));
  }
  .btn-auth, .auth-card .btn-block { min-height: 48px; width: 100%; }
}

/* ——— Landing gutters + feature slider ——— */
.site-header {
  padding-top: env(safe-area-inset-top, 0px);
}
@media (max-width: 1100px) {
  .site .wrap {
    width: auto !important;
    max-width: none !important;
    margin-left: max(16px, env(safe-area-inset-left, 0px));
    margin-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .lp-hero { gap: 20px; }
  .lp-cta .btn { min-height: 48px; }
  .site-nav a { min-height: 44px; display: flex; align-items: center; }

  .lp-features-bar {
    overflow: visible;
    padding: 20px 0 8px;
  }
  .lp-features-bar .lp-features.wrap,
  .lp-features {
    display: flex !important;
    flex-wrap: nowrap !important;
    grid-template-columns: none !important;
    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: max(16px, env(safe-area-inset-left, 0px));
    -webkit-overflow-scrolling: touch;
    padding: 6px max(16px, env(safe-area-inset-right, 0px)) 18px max(16px, env(safe-area-inset-left, 0px));
    scrollbar-width: none;
  }
  .lp-features::-webkit-scrollbar { display: none; }
  .lp-feature {
    flex: 0 0 min(78vw, 260px);
    width: min(78vw, 260px);
    min-width: min(78vw, 260px);
    scroll-snap-align: start;
    background: #fff;
    border-radius: 22px;
    padding: 18px 16px 16px;
    box-shadow: 0 10px 28px rgba(37, 33, 43, 0.06);
  }
  .lp-feature p { max-width: none; }

  .lp-story-grid,
  .lp-trust {
    display: flex !important;
    flex-wrap: nowrap !important;
    grid-template-columns: none !important;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    scrollbar-width: none;
  }
  .lp-story-grid::-webkit-scrollbar,
  .lp-trust::-webkit-scrollbar { display: none; }
  .lp-story,
  .lp-trust article {
    flex: 0 0 min(86vw, 340px);
    min-width: min(86vw, 340px);
    scroll-snap-align: start;
  }
}
@media (max-width: 760px) {
  .lp-hero-copy h1 { font-size: clamp(30px, 9vw, 42px); }
}

/* ——— App shell (tablets use dock ≤1100) ——— */
@media (max-width: 1100px) {
  :root {
    --app-pad-x: 16px;
  }

  .topbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 8px;
    height: auto;
    min-height: 56px;
    overflow: hidden;
    padding-top: 8px;
    padding-bottom: 8px;
    padding-left: max(var(--app-pad-x), env(safe-area-inset-left, 0px)) !important;
    padding-right: max(var(--app-pad-x), env(safe-area-inset-right, 0px)) !important;
  }
  .topbar .menu-btn {
    display: inline-flex !important;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    min-height: 40px;
  }
  .topbar-title,
  .shell--home .topbar-title {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: 100%;
    margin-right: 4px;
    overflow: hidden !important;
  }
  .shell--home .topbar-title {
    flex: 0 0 auto !important;
    overflow: visible !important;
    margin-right: 0;
  }
  .shell--home .topbar-brand {
    display: inline-flex !important;
    width: 44px;
    height: 44px;
  }
  .shell--home .topbar-brand img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 0;
  }
  .shell--home .topbar-title h1,
  .shell--home .topbar-title h1 #homeGreet {
    display: none !important;
  }
  .topbar-title h1,
  .topbar h1 {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .topbar-sub { display: none !important; }
  .topbar .search,
  .search-kbd { display: none !important; }
  .top-actions,
  .shell--home .top-actions {
    flex: 0 0 auto;
    flex-shrink: 0;
    margin-left: auto !important;
    padding-left: 10px;
    gap: 8px;
    position: relative;
    z-index: 2;
    background: transparent;
  }
  @media (max-width: 430px) {
    .greet-who { display: none; }
  }
  .top-chat span,
  .premium-chip span { display: none !important; }
  .top-chat,
  .premium-chip {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0 !important;
    justify-content: center;
  }
  .shell--home .top-chat,
  .shell--home .premium-chip,
  .shell--home .top-actions > .icon-btn {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    height: 36px;
  }
  .shell--home .top-avatar {
    width: 36px;
    height: 36px;
  }
  .top-avatar {
    display: inline-flex !important;
    flex-shrink: 0;
  }

  .page {
    width: 100%;
    max-width: none;
    padding-left: max(var(--app-pad-x), env(safe-area-inset-left, 0px)) !important;
    padding-right: max(var(--app-pad-x), env(safe-area-inset-right, 0px)) !important;
  }
  .page--split {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .flash-banner {
    margin-left: max(var(--app-pad-x), env(safe-area-inset-left, 0px));
    margin-right: max(var(--app-pad-x), env(safe-area-inset-right, 0px));
  }

  .people-grid,
  .place-grid,
  .event-grid,
  .net-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .match-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }
  .page--discover .discover-layout,
  .discover-layout,
  .page--split,
  .page--me,
  .page--profile,
  .page--networking,
  .cir-detail-grid,
  .safe-body,
  .set-layout,
  .help-split,
  .hs-split,
  .prem-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .settings-grid,
  .detail-grid,
  .two-col,
  .help-split,
  .set-layout,
  .set-row-2,
  .pass-form-grid,
  .me-grid--2,
  .page--me,
  .page--profile,
  .safe-body {
    grid-template-columns: 1fr;
  }
  .app-dock {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    height: var(--dock);
    padding: 8px 6px max(16px, env(safe-area-inset-bottom, 0px));
    overflow: visible;
  }
  .app-dock .dock-more { display: flex; }
  .app-dock a,
  .app-dock .dock-more {
    align-items: center;
    justify-content: flex-start;
    gap: 3px;
    min-height: 0;
    height: 100%;
    padding: 2px 2px 0;
    font-size: 11px;
    line-height: 1.15;
    text-align: center;
  }
  .app-dock svg,
  .app-dock iconify-icon,
  .app-dock iconify-icon:not([width]):not([height]) {
    display: block;
    width: 26px;
    height: 26px;
    font-size: 26px;
    overflow: visible;
    margin: 0 auto;
  }
  .app-dock a span,
  .app-dock .dock-more span {
    display: block;
    width: 100%;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
  }

  .page > .rail.home-rail,
  .shell--home .home-rail {
    display: flex !important;
    flex-direction: column;
  }

  .shell--home .home-explore-stack {
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
  }
  .shell--home .home-explore-stack::-webkit-scrollbar { display: none; }
  .shell--home .home-explore-tile {
    flex: 0 0 min(78vw, 280px);
    min-width: min(78vw, 280px);
    scroll-snap-align: start;
  }
  .shell--home .home-explore-tile img { height: 140px; }
  .shell--home .home-composer-tools {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .shell--home .home-composer-tools::-webkit-scrollbar { display: none; }
  .shell--home .home-tool { flex-shrink: 0; }

  .prem-plan-grid,
  .prem-trust {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 14px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    scrollbar-width: none;
  }
  .prem-plan-grid::-webkit-scrollbar,
  .prem-trust::-webkit-scrollbar { display: none; }
  .prem-plan-grid > *,
  .prem-trust > * {
    flex: 0 0 min(82vw, 320px);
    min-width: min(82vw, 320px);
    scroll-snap-align: start;
  }

  .composer {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
  .swipe-actions { padding-bottom: 8px; }
  .inbox { padding-left: 12px; padding-right: 12px; }

  .page {
    padding-bottom: 20px;
  }
  .card,
  .feed-card,
  .home-composer,
  .cir-hero,
  .trv-hero,
  .evt-hero,
  .disc-filterbar,
  .net-search {
    max-width: 100%;
    min-width: 0;
  }
  .disc-filterbar,
  .cir-toolbar,
  .evt-toolbar,
  .trv-toolbar {
    min-width: 0;
  }
  .evt-intro-aside {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (max-width: 720px) {
  .top-chat {
    min-width: 42px;
    width: 42px;
    padding: 0;
    justify-content: center;
  }

  .cir-grid,
  .evt-grid,
  .trv-grid,
  .hs-topic-grid {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 14px;
    scrollbar-width: none;
  }
  .cir-grid::-webkit-scrollbar,
  .evt-grid::-webkit-scrollbar,
  .trv-grid::-webkit-scrollbar,
  .hs-topic-grid::-webkit-scrollbar { display: none; }

  .cir-grid > *,
  .evt-grid > *,
  .trv-grid > *,
  .hs-topic-grid > * {
    flex: 0 0 min(82vw, 300px);
    min-width: min(82vw, 300px);
    max-width: min(82vw, 300px);
    scroll-snap-align: start;
  }

  .cir-chips,
  .disc-tabs,
  .evt-tabs,
  .trv-chips,
  .seg {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cir-chips::-webkit-scrollbar,
  .disc-tabs::-webkit-scrollbar,
  .evt-tabs::-webkit-scrollbar,
  .trv-chips::-webkit-scrollbar,
  .seg::-webkit-scrollbar { display: none; }
}

@media (max-width: 430px) {
  :root { --app-pad-x: 16px; }
  .people-grid,
  .place-grid,
  .event-grid,
  .net-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .match-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Contain every app page on phone — nothing should clip off the right edge */
@media (max-width: 1100px) {
  .shell,
  .workspace,
  .page,
  .page--wide,
  .page--discover,
  .page--me,
  .page--profile,
  .discover-shell,
  .discover-layout,
  .discover-side,
  .match-shell,
  .net-shell,
  .cir-main,
  .trv-shell,
  .evt-shell,
  .me-main,
  .me-rail,
  .safe-body,
  .set-layout {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .discover-shell,
  .net-shell,
  .match-shell,
  .workspace,
  .page {
    overflow-x: clip;
  }
  .discover-glow,
  .net-glow {
    inset: 0 auto auto 0;
    width: 100%;
    max-width: 100%;
  }

  .disc-filterbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    flex-wrap: nowrap !important;
    padding: 6px;
    border-radius: 18px;
  }
  .disc-tabs {
    width: auto !important;
    min-width: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .disc-tabs::-webkit-scrollbar { display: none; }
  .disc-filters-btn {
    margin-left: 0 !important;
    flex-shrink: 0;
    padding: 0 12px;
    min-height: 36px;
  }

  .section-head,
  .side-head,
  .trv-section-head,
  .evt-section-head,
  .cir-toolbar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 8px;
  }
  .section-head h2,
  .side-head h2,
  .trv-section-head h2,
  .evt-section-head h2 {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .side-see-all,
  .section-head a,
  .evt-see-all {
    flex-shrink: 0;
  }

  .top-chat,
  .premium-chip,
  .icon-btn.search-jump,
  .top-actions > .icon-btn {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }
  .shell--home .top-chat,
  .shell--home .premium-chip,
  .shell--home .icon-btn.search-jump,
  .shell--home .top-actions > .icon-btn,
  .shell--home .top-avatar {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    height: 36px;
  }

  .more-grid a {
    gap: 10px;
    padding: 16px 8px;
    font-size: 13px;
  }
  .more-grid .side-ico {
    width: 58px;
    height: 58px;
  }
  .more-grid a svg,
  .more-grid a iconify-icon,
  .more-grid .side-ico iconify-icon,
  .more-grid .side-ico iconify-icon:not([width]):not([height]) {
    width: 28px;
    height: 28px;
    font-size: 28px;
    color: inherit;
    overflow: visible;
  }
}

/* ——— Mobile chat theme sheet ——— */
.chat-theme-btn { display: none; }
.chat-theme-sheet { display: none; }

@media (max-width: 1180px) {
  .chat-theme-btn { display: inline-flex; }
  .page--split.has-open .chat-theme-btn { display: inline-flex; }

  .chat-theme-sheet:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
  }
  .chat-theme-sheet__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 12, 28, .45);
    cursor: pointer;
  }
  .chat-theme-sheet__panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(82dvh, 640px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 22px 22px 0 0;
    padding: 10px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 40px rgba(40, 20, 60, .18);
    animation: chatThemeUp .22s ease-out;
  }
  .chat-theme-sheet__grab {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(0,0,0,.12);
    margin: 2px auto 12px;
  }
  .chat-theme-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
  }
  .chat-theme-sheet__head .h3 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 1.05rem;
  }
  .chat-theme-sheet__note { margin: 0 0 14px; }
  .tp-theme--sheet .theme-grid--walls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
  .tp-theme--sheet .theme-wall {
    min-height: 88px;
    border-radius: 16px;
  }
  .tp-theme--sheet .tp-music,
  .tp-theme--sheet .tp-music-lock {
    margin-top: 14px;
  }
  body.chat-theme-open {
    overflow: hidden;
  }
}

@keyframes chatThemeUp {
  from { transform: translateY(18px); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}

/* Also show theme control when focus mode hides the profile rail */
body.chat-focus-on .chat-theme-btn {
  display: inline-flex !important;
}
@media (min-width: 1181px) {
  body:not(.chat-focus-on) .chat-theme-sheet { display: none !important; }
}

@media (max-width: 720px) {
  .page--matches .match-grid,
  .match-grid {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  .page--matches .match-tile,
  .match-tile {
    height: auto !important;
  }
  .page--matches .match-row {
    grid-template-columns: 1fr;
    overflow: hidden;
  }
}
